2007-04-05 08:58:33 +02:00
|
|
|
/*
|
2012-03-24 17:51:13 +01:00
|
|
|
* Helpers for loads and stores
|
2007-09-16 23:08:06 +02:00
|
|
|
*
|
2007-04-05 08:58:33 +02:00
|
|
|
* Copyright (c) 2007 Jocelyn Mayer
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2020-10-23 14:33:53 +02:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2007-04-05 08:58:33 +02:00
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2009-07-16 22:47:01 +02:00
|
|
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
2007-04-05 08:58:33 +02:00
|
|
|
*/
|
|
|
|
|
2016-01-26 19:17:04 +01:00
|
|
|
#include "qemu/osdep.h"
|
2011-07-13 14:44:15 +02:00
|
|
|
#include "cpu.h"
|
2014-04-08 07:31:41 +02:00
|
|
|
#include "exec/helper-proto.h"
|
2016-03-15 13:18:37 +01:00
|
|
|
#include "exec/exec-all.h"
|
2014-03-28 19:42:10 +01:00
|
|
|
#include "exec/cpu_ldst.h"
|
2007-04-05 08:58:33 +02:00
|
|
|
|
2021-07-24 00:20:55 +02:00
|
|
|
static void do_unaligned_access(CPUAlphaState *env, vaddr addr, uintptr_t retaddr)
|
2011-04-19 01:13:12 +02:00
|
|
|
{
|
|
|
|
uint64_t pc;
|
|
|
|
uint32_t insn;
|
|
|
|
|
2022-10-24 15:09:57 +02:00
|
|
|
cpu_restore_state(env_cpu(env), retaddr);
|
2011-04-19 01:13:12 +02:00
|
|
|
|
|
|
|
pc = env->pc;
|
2012-03-24 17:51:13 +01:00
|
|
|
insn = cpu_ldl_code(env, pc);
|
2011-04-19 01:13:12 +02:00
|
|
|
|
|
|
|
env->trap_arg0 = addr;
|
|
|
|
env->trap_arg1 = insn >> 26; /* opcode */
|
|
|
|
env->trap_arg2 = (insn >> 21) & 31; /* dest regno */
|
2021-07-24 00:20:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_USER_ONLY
|
|
|
|
void alpha_cpu_record_sigbus(CPUState *cs, vaddr addr,
|
|
|
|
MMUAccessType access_type, uintptr_t retaddr)
|
|
|
|
{
|
|
|
|
AlphaCPU *cpu = ALPHA_CPU(cs);
|
|
|
|
CPUAlphaState *env = &cpu->env;
|
|
|
|
|
|
|
|
do_unaligned_access(env, addr, retaddr);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
void alpha_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
|
|
|
|
MMUAccessType access_type,
|
|
|
|
int mmu_idx, uintptr_t retaddr)
|
|
|
|
{
|
|
|
|
AlphaCPU *cpu = ALPHA_CPU(cs);
|
|
|
|
CPUAlphaState *env = &cpu->env;
|
|
|
|
|
|
|
|
do_unaligned_access(env, addr, retaddr);
|
2013-08-26 08:31:06 +02:00
|
|
|
cs->exception_index = EXCP_UNALIGN;
|
2012-03-24 17:51:08 +01:00
|
|
|
env->error_code = 0;
|
2013-08-27 17:52:12 +02:00
|
|
|
cpu_loop_exit(cs);
|
2011-04-19 01:13:12 +02:00
|
|
|
}
|
|
|
|
|
2017-08-08 14:42:52 +02:00
|
|
|
void alpha_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
|
|
|
|
vaddr addr, unsigned size,
|
|
|
|
MMUAccessType access_type,
|
|
|
|
int mmu_idx, MemTxAttrs attrs,
|
|
|
|
MemTxResult response, uintptr_t retaddr)
|
2011-04-19 01:13:12 +02:00
|
|
|
{
|
2013-05-27 06:49:53 +02:00
|
|
|
AlphaCPU *cpu = ALPHA_CPU(cs);
|
|
|
|
CPUAlphaState *env = &cpu->env;
|
|
|
|
|
2011-04-19 01:13:12 +02:00
|
|
|
env->trap_arg0 = addr;
|
2017-08-08 14:42:52 +02:00
|
|
|
env->trap_arg1 = access_type == MMU_DATA_STORE ? 1 : 0;
|
2014-06-28 22:06:19 +02:00
|
|
|
cs->exception_index = EXCP_MCHK;
|
|
|
|
env->error_code = 0;
|
2018-04-09 11:13:20 +02:00
|
|
|
cpu_loop_exit_restore(cs, retaddr);
|
2011-04-19 01:13:12 +02:00
|
|
|
}
|
2012-03-24 17:51:13 +01:00
|
|
|
#endif /* CONFIG_USER_ONLY */
|