]>
Commit | Line | Data |
---|---|---|
4c9649a9 | 1 | /* |
c3082755 | 2 | * Helpers for loads and stores |
5fafdf24 | 3 | * |
4c9649a9 JM |
4 | * Copyright (c) 2007 Jocelyn Mayer |
5 | * | |
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 | |
d6ea4236 | 9 | * version 2.1 of the License, or (at your option) any later version. |
4c9649a9 JM |
10 | * |
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. | |
15 | * | |
16 | * You should have received a copy of the GNU Lesser General Public | |
8167ee88 | 17 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. |
4c9649a9 JM |
18 | */ |
19 | ||
e2e5e114 | 20 | #include "qemu/osdep.h" |
3e457172 | 21 | #include "cpu.h" |
2ef6175a | 22 | #include "exec/helper-proto.h" |
63c91552 | 23 | #include "exec/exec-all.h" |
f08b6170 | 24 | #include "exec/cpu_ldst.h" |
4c9649a9 | 25 | |
e7424abc | 26 | static void do_unaligned_access(CPUAlphaState *env, vaddr addr, uintptr_t retaddr) |
5b450407 RH |
27 | { |
28 | uint64_t pc; | |
29 | uint32_t insn; | |
30 | ||
e7424abc | 31 | cpu_restore_state(env_cpu(env), retaddr, true); |
5b450407 RH |
32 | |
33 | pc = env->pc; | |
c3082755 | 34 | insn = cpu_ldl_code(env, pc); |
5b450407 RH |
35 | |
36 | env->trap_arg0 = addr; | |
37 | env->trap_arg1 = insn >> 26; /* opcode */ | |
38 | env->trap_arg2 = (insn >> 21) & 31; /* dest regno */ | |
e7424abc RH |
39 | } |
40 | ||
41 | #ifdef CONFIG_USER_ONLY | |
42 | void alpha_cpu_record_sigbus(CPUState *cs, vaddr addr, | |
43 | MMUAccessType access_type, uintptr_t retaddr) | |
44 | { | |
45 | AlphaCPU *cpu = ALPHA_CPU(cs); | |
46 | CPUAlphaState *env = &cpu->env; | |
47 | ||
48 | do_unaligned_access(env, addr, retaddr); | |
49 | } | |
50 | #else | |
51 | void alpha_cpu_do_unaligned_access(CPUState *cs, vaddr addr, | |
52 | MMUAccessType access_type, | |
53 | int mmu_idx, uintptr_t retaddr) | |
54 | { | |
55 | AlphaCPU *cpu = ALPHA_CPU(cs); | |
56 | CPUAlphaState *env = &cpu->env; | |
57 | ||
58 | do_unaligned_access(env, addr, retaddr); | |
27103424 | 59 | cs->exception_index = EXCP_UNALIGN; |
b9f0923e | 60 | env->error_code = 0; |
5638d180 | 61 | cpu_loop_exit(cs); |
5b450407 RH |
62 | } |
63 | ||
6ad4d7ee PM |
64 | void alpha_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, |
65 | vaddr addr, unsigned size, | |
66 | MMUAccessType access_type, | |
67 | int mmu_idx, MemTxAttrs attrs, | |
68 | MemTxResult response, uintptr_t retaddr) | |
5b450407 | 69 | { |
c658b94f AF |
70 | AlphaCPU *cpu = ALPHA_CPU(cs); |
71 | CPUAlphaState *env = &cpu->env; | |
72 | ||
5b450407 | 73 | env->trap_arg0 = addr; |
6ad4d7ee | 74 | env->trap_arg1 = access_type == MMU_DATA_STORE ? 1 : 0; |
ba9c5de5 RH |
75 | cs->exception_index = EXCP_MCHK; |
76 | env->error_code = 0; | |
afd46fca | 77 | cpu_loop_exit_restore(cs, retaddr); |
5b450407 | 78 | } |
c3082755 | 79 | #endif /* CONFIG_USER_ONLY */ |