2 * Helpers for loads and stores
4 * Copyright (c) 2007 Jocelyn Mayer
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
20 #include "qemu/osdep.h"
22 #include "exec/helper-proto.h"
23 #include "exec/exec-all.h"
24 #include "exec/cpu_ldst.h"
26 static void do_unaligned_access(CPUAlphaState
*env
, vaddr addr
, uintptr_t retaddr
)
31 cpu_restore_state(env_cpu(env
), retaddr
);
34 insn
= cpu_ldl_code(env
, pc
);
36 env
->trap_arg0
= addr
;
37 env
->trap_arg1
= insn
>> 26; /* opcode */
38 env
->trap_arg2
= (insn
>> 21) & 31; /* dest regno */
41 #ifdef CONFIG_USER_ONLY
42 void alpha_cpu_record_sigbus(CPUState
*cs
, vaddr addr
,
43 MMUAccessType access_type
, uintptr_t retaddr
)
45 do_unaligned_access(cpu_env(cs
), addr
, retaddr
);
48 void alpha_cpu_do_unaligned_access(CPUState
*cs
, vaddr addr
,
49 MMUAccessType access_type
,
50 int mmu_idx
, uintptr_t retaddr
)
52 CPUAlphaState
*env
= cpu_env(cs
);
54 do_unaligned_access(env
, addr
, retaddr
);
55 cs
->exception_index
= EXCP_UNALIGN
;
60 void alpha_cpu_do_transaction_failed(CPUState
*cs
, hwaddr physaddr
,
61 vaddr addr
, unsigned size
,
62 MMUAccessType access_type
,
63 int mmu_idx
, MemTxAttrs attrs
,
64 MemTxResult response
, uintptr_t retaddr
)
66 CPUAlphaState
*env
= cpu_env(cs
);
68 env
->trap_arg0
= addr
;
69 env
->trap_arg1
= access_type
== MMU_DATA_STORE
? 1 : 0;
70 cs
->exception_index
= EXCP_MCHK
;
72 cpu_loop_exit_restore(cs
, retaddr
);
74 #endif /* CONFIG_USER_ONLY */