Skip to content

Commit a47dddd

Browse files
committed
exec: Change cpu_abort() argument to CPUState
Signed-off-by: Andreas Färber <[email protected]>
1 parent bb0e627 commit a47dddd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+301
-206
lines changed

cputlb.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr)
322322
if (cc->do_unassigned_access) {
323323
cc->do_unassigned_access(cpu, addr, false, true, 0, 4);
324324
} else {
325-
cpu_abort(env1, "Trying to execute code outside RAM or ROM at 0x"
325+
cpu_abort(cpu, "Trying to execute code outside RAM or ROM at 0x"
326326
TARGET_FMT_lx "\n", addr);
327327
}
328328
}

exec.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -709,9 +709,8 @@ void cpu_single_step(CPUState *cpu, int enabled)
709709
#endif
710710
}
711711

712-
void cpu_abort(CPUArchState *env, const char *fmt, ...)
712+
void cpu_abort(CPUState *cpu, const char *fmt, ...)
713713
{
714-
CPUState *cpu = ENV_GET_CPU(env);
715714
va_list ap;
716715
va_list ap2;
717716

include/exec/cpu-all.h

-3
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,6 @@ int page_check_range(target_ulong start, target_ulong len, int flags);
360360

361361
CPUArchState *cpu_copy(CPUArchState *env);
362362

363-
void QEMU_NORETURN cpu_abort(CPUArchState *env, const char *fmt, ...)
364-
GCC_FMT_ATTR(2, 3);
365-
366363
/* Flags for use in ENV->INTERRUPT_PENDING.
367364
368365
The numbers assigned here are non-sequential in order to preserve

include/qom/cpu.h

+3
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,9 @@ int cpu_watchpoint_remove(CPUState *cpu, vaddr addr,
617617
void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint);
618618
void cpu_watchpoint_remove_all(CPUState *cpu, int mask);
619619

620+
void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...)
621+
GCC_FMT_ATTR(2, 3);
622+
620623
#ifdef CONFIG_SOFTMMU
621624
extern const struct VMStateDescription vmstate_cpu_common;
622625
#else

linux-user/m68k-sim.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ static int translate_openflags(int flags)
9898
#define ARG(x) tswap32(args[x])
9999
void do_m68k_simcall(CPUM68KState *env, int nr)
100100
{
101+
M68kCPU *cpu = m68k_env_get_cpu(env);
101102
uint32_t *args;
102103

103104
args = (uint32_t *)(unsigned long)(env->aregs[7] + 4);
@@ -165,6 +166,6 @@ void do_m68k_simcall(CPUM68KState *env, int nr)
165166
check_err(env, lseek(ARG(0), (int32_t)ARG(1), ARG(2)));
166167
break;
167168
default:
168-
cpu_abort(env, "Unsupported m68k sim syscall %d\n", nr);
169+
cpu_abort(CPU(cpu), "Unsupported m68k sim syscall %d\n", nr);
169170
}
170171
}

linux-user/main.c

+40-40
Original file line numberDiff line numberDiff line change
@@ -1577,11 +1577,11 @@ void cpu_loop(CPUPPCState *env)
15771577
/* Just go on */
15781578
break;
15791579
case POWERPC_EXCP_CRITICAL: /* Critical input */
1580-
cpu_abort(env, "Critical interrupt while in user mode. "
1580+
cpu_abort(cs, "Critical interrupt while in user mode. "
15811581
"Aborting\n");
15821582
break;
15831583
case POWERPC_EXCP_MCHECK: /* Machine check exception */
1584-
cpu_abort(env, "Machine check exception while in user mode. "
1584+
cpu_abort(cs, "Machine check exception while in user mode. "
15851585
"Aborting\n");
15861586
break;
15871587
case POWERPC_EXCP_DSI: /* Data storage exception */
@@ -1645,7 +1645,7 @@ void cpu_loop(CPUPPCState *env)
16451645
queue_signal(env, info.si_signo, &info);
16461646
break;
16471647
case POWERPC_EXCP_EXTERNAL: /* External input */
1648-
cpu_abort(env, "External interrupt while in user mode. "
1648+
cpu_abort(cs, "External interrupt while in user mode. "
16491649
"Aborting\n");
16501650
break;
16511651
case POWERPC_EXCP_ALIGN: /* Alignment exception */
@@ -1739,11 +1739,11 @@ void cpu_loop(CPUPPCState *env)
17391739
}
17401740
break;
17411741
case POWERPC_EXCP_TRAP:
1742-
cpu_abort(env, "Tried to call a TRAP\n");
1742+
cpu_abort(cs, "Tried to call a TRAP\n");
17431743
break;
17441744
default:
17451745
/* Should not happen ! */
1746-
cpu_abort(env, "Unknown program exception (%02x)\n",
1746+
cpu_abort(cs, "Unknown program exception (%02x)\n",
17471747
env->error_code);
17481748
break;
17491749
}
@@ -1759,7 +1759,7 @@ void cpu_loop(CPUPPCState *env)
17591759
queue_signal(env, info.si_signo, &info);
17601760
break;
17611761
case POWERPC_EXCP_SYSCALL: /* System call exception */
1762-
cpu_abort(env, "Syscall exception while in user mode. "
1762+
cpu_abort(cs, "Syscall exception while in user mode. "
17631763
"Aborting\n");
17641764
break;
17651765
case POWERPC_EXCP_APU: /* Auxiliary processor unavailable */
@@ -1771,23 +1771,23 @@ void cpu_loop(CPUPPCState *env)
17711771
queue_signal(env, info.si_signo, &info);
17721772
break;
17731773
case POWERPC_EXCP_DECR: /* Decrementer exception */
1774-
cpu_abort(env, "Decrementer interrupt while in user mode. "
1774+
cpu_abort(cs, "Decrementer interrupt while in user mode. "
17751775
"Aborting\n");
17761776
break;
17771777
case POWERPC_EXCP_FIT: /* Fixed-interval timer interrupt */
1778-
cpu_abort(env, "Fix interval timer interrupt while in user mode. "
1778+
cpu_abort(cs, "Fix interval timer interrupt while in user mode. "
17791779
"Aborting\n");
17801780
break;
17811781
case POWERPC_EXCP_WDT: /* Watchdog timer interrupt */
1782-
cpu_abort(env, "Watchdog timer interrupt while in user mode. "
1782+
cpu_abort(cs, "Watchdog timer interrupt while in user mode. "
17831783
"Aborting\n");
17841784
break;
17851785
case POWERPC_EXCP_DTLB: /* Data TLB error */
1786-
cpu_abort(env, "Data TLB exception while in user mode. "
1786+
cpu_abort(cs, "Data TLB exception while in user mode. "
17871787
"Aborting\n");
17881788
break;
17891789
case POWERPC_EXCP_ITLB: /* Instruction TLB error */
1790-
cpu_abort(env, "Instruction TLB exception while in user mode. "
1790+
cpu_abort(cs, "Instruction TLB exception while in user mode. "
17911791
"Aborting\n");
17921792
break;
17931793
case POWERPC_EXCP_SPEU: /* SPE/embedded floating-point unavail. */
@@ -1799,37 +1799,37 @@ void cpu_loop(CPUPPCState *env)
17991799
queue_signal(env, info.si_signo, &info);
18001800
break;
18011801
case POWERPC_EXCP_EFPDI: /* Embedded floating-point data IRQ */
1802-
cpu_abort(env, "Embedded floating-point data IRQ not handled\n");
1802+
cpu_abort(cs, "Embedded floating-point data IRQ not handled\n");
18031803
break;
18041804
case POWERPC_EXCP_EFPRI: /* Embedded floating-point round IRQ */
1805-
cpu_abort(env, "Embedded floating-point round IRQ not handled\n");
1805+
cpu_abort(cs, "Embedded floating-point round IRQ not handled\n");
18061806
break;
18071807
case POWERPC_EXCP_EPERFM: /* Embedded performance monitor IRQ */
1808-
cpu_abort(env, "Performance monitor exception not handled\n");
1808+
cpu_abort(cs, "Performance monitor exception not handled\n");
18091809
break;
18101810
case POWERPC_EXCP_DOORI: /* Embedded doorbell interrupt */
1811-
cpu_abort(env, "Doorbell interrupt while in user mode. "
1811+
cpu_abort(cs, "Doorbell interrupt while in user mode. "
18121812
"Aborting\n");
18131813
break;
18141814
case POWERPC_EXCP_DOORCI: /* Embedded doorbell critical interrupt */
1815-
cpu_abort(env, "Doorbell critical interrupt while in user mode. "
1815+
cpu_abort(cs, "Doorbell critical interrupt while in user mode. "
18161816
"Aborting\n");
18171817
break;
18181818
case POWERPC_EXCP_RESET: /* System reset exception */
1819-
cpu_abort(env, "Reset interrupt while in user mode. "
1819+
cpu_abort(cs, "Reset interrupt while in user mode. "
18201820
"Aborting\n");
18211821
break;
18221822
case POWERPC_EXCP_DSEG: /* Data segment exception */
1823-
cpu_abort(env, "Data segment exception while in user mode. "
1823+
cpu_abort(cs, "Data segment exception while in user mode. "
18241824
"Aborting\n");
18251825
break;
18261826
case POWERPC_EXCP_ISEG: /* Instruction segment exception */
1827-
cpu_abort(env, "Instruction segment exception "
1827+
cpu_abort(cs, "Instruction segment exception "
18281828
"while in user mode. Aborting\n");
18291829
break;
18301830
/* PowerPC 64 with hypervisor mode support */
18311831
case POWERPC_EXCP_HDECR: /* Hypervisor decrementer exception */
1832-
cpu_abort(env, "Hypervisor decrementer interrupt "
1832+
cpu_abort(cs, "Hypervisor decrementer interrupt "
18331833
"while in user mode. Aborting\n");
18341834
break;
18351835
case POWERPC_EXCP_TRACE: /* Trace exception */
@@ -1839,19 +1839,19 @@ void cpu_loop(CPUPPCState *env)
18391839
break;
18401840
/* PowerPC 64 with hypervisor mode support */
18411841
case POWERPC_EXCP_HDSI: /* Hypervisor data storage exception */
1842-
cpu_abort(env, "Hypervisor data storage exception "
1842+
cpu_abort(cs, "Hypervisor data storage exception "
18431843
"while in user mode. Aborting\n");
18441844
break;
18451845
case POWERPC_EXCP_HISI: /* Hypervisor instruction storage excp */
1846-
cpu_abort(env, "Hypervisor instruction storage exception "
1846+
cpu_abort(cs, "Hypervisor instruction storage exception "
18471847
"while in user mode. Aborting\n");
18481848
break;
18491849
case POWERPC_EXCP_HDSEG: /* Hypervisor data segment exception */
1850-
cpu_abort(env, "Hypervisor data segment exception "
1850+
cpu_abort(cs, "Hypervisor data segment exception "
18511851
"while in user mode. Aborting\n");
18521852
break;
18531853
case POWERPC_EXCP_HISEG: /* Hypervisor instruction segment excp */
1854-
cpu_abort(env, "Hypervisor instruction segment exception "
1854+
cpu_abort(cs, "Hypervisor instruction segment exception "
18551855
"while in user mode. Aborting\n");
18561856
break;
18571857
case POWERPC_EXCP_VPU: /* Vector unavailable exception */
@@ -1863,58 +1863,58 @@ void cpu_loop(CPUPPCState *env)
18631863
queue_signal(env, info.si_signo, &info);
18641864
break;
18651865
case POWERPC_EXCP_PIT: /* Programmable interval timer IRQ */
1866-
cpu_abort(env, "Programmable interval timer interrupt "
1866+
cpu_abort(cs, "Programmable interval timer interrupt "
18671867
"while in user mode. Aborting\n");
18681868
break;
18691869
case POWERPC_EXCP_IO: /* IO error exception */
1870-
cpu_abort(env, "IO error exception while in user mode. "
1870+
cpu_abort(cs, "IO error exception while in user mode. "
18711871
"Aborting\n");
18721872
break;
18731873
case POWERPC_EXCP_RUNM: /* Run mode exception */
1874-
cpu_abort(env, "Run mode exception while in user mode. "
1874+
cpu_abort(cs, "Run mode exception while in user mode. "
18751875
"Aborting\n");
18761876
break;
18771877
case POWERPC_EXCP_EMUL: /* Emulation trap exception */
1878-
cpu_abort(env, "Emulation trap exception not handled\n");
1878+
cpu_abort(cs, "Emulation trap exception not handled\n");
18791879
break;
18801880
case POWERPC_EXCP_IFTLB: /* Instruction fetch TLB error */
1881-
cpu_abort(env, "Instruction fetch TLB exception "
1881+
cpu_abort(cs, "Instruction fetch TLB exception "
18821882
"while in user-mode. Aborting");
18831883
break;
18841884
case POWERPC_EXCP_DLTLB: /* Data load TLB miss */
1885-
cpu_abort(env, "Data load TLB exception while in user-mode. "
1885+
cpu_abort(cs, "Data load TLB exception while in user-mode. "
18861886
"Aborting");
18871887
break;
18881888
case POWERPC_EXCP_DSTLB: /* Data store TLB miss */
1889-
cpu_abort(env, "Data store TLB exception while in user-mode. "
1889+
cpu_abort(cs, "Data store TLB exception while in user-mode. "
18901890
"Aborting");
18911891
break;
18921892
case POWERPC_EXCP_FPA: /* Floating-point assist exception */
1893-
cpu_abort(env, "Floating-point assist exception not handled\n");
1893+
cpu_abort(cs, "Floating-point assist exception not handled\n");
18941894
break;
18951895
case POWERPC_EXCP_IABR: /* Instruction address breakpoint */
1896-
cpu_abort(env, "Instruction address breakpoint exception "
1896+
cpu_abort(cs, "Instruction address breakpoint exception "
18971897
"not handled\n");
18981898
break;
18991899
case POWERPC_EXCP_SMI: /* System management interrupt */
1900-
cpu_abort(env, "System management interrupt while in user mode. "
1900+
cpu_abort(cs, "System management interrupt while in user mode. "
19011901
"Aborting\n");
19021902
break;
19031903
case POWERPC_EXCP_THERM: /* Thermal interrupt */
1904-
cpu_abort(env, "Thermal interrupt interrupt while in user mode. "
1904+
cpu_abort(cs, "Thermal interrupt interrupt while in user mode. "
19051905
"Aborting\n");
19061906
break;
19071907
case POWERPC_EXCP_PERFM: /* Embedded performance monitor IRQ */
1908-
cpu_abort(env, "Performance monitor exception not handled\n");
1908+
cpu_abort(cs, "Performance monitor exception not handled\n");
19091909
break;
19101910
case POWERPC_EXCP_VPUA: /* Vector assist exception */
1911-
cpu_abort(env, "Vector assist exception not handled\n");
1911+
cpu_abort(cs, "Vector assist exception not handled\n");
19121912
break;
19131913
case POWERPC_EXCP_SOFTP: /* Soft patch exception */
1914-
cpu_abort(env, "Soft patch exception not handled\n");
1914+
cpu_abort(cs, "Soft patch exception not handled\n");
19151915
break;
19161916
case POWERPC_EXCP_MAINT: /* Maintenance exception */
1917-
cpu_abort(env, "Maintenance exception while in user mode. "
1917+
cpu_abort(cs, "Maintenance exception while in user mode. "
19181918
"Aborting\n");
19191919
break;
19201920
case POWERPC_EXCP_STOP: /* stop translation */
@@ -1970,7 +1970,7 @@ void cpu_loop(CPUPPCState *env)
19701970
/* just indicate that signals should be handled asap */
19711971
break;
19721972
default:
1973-
cpu_abort(env, "Unknown exception 0x%d. Aborting\n", trapnr);
1973+
cpu_abort(cs, "Unknown exception 0x%d. Aborting\n", trapnr);
19741974
break;
19751975
}
19761976
process_pending_signals(env);

target-alpha/helper.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ void alpha_cpu_do_interrupt(CPUState *cs)
452452
}
453453
break;
454454
default:
455-
cpu_abort(env, "Unhandled CPU exception");
455+
cpu_abort(cs, "Unhandled CPU exception");
456456
}
457457

458458
/* Remember where the exception happened. Emulate real hardware in

target-arm/helper.c

+25-10
Original file line numberDiff line numberDiff line change
@@ -2671,29 +2671,40 @@ int arm_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int rw,
26712671
/* These should probably raise undefined insn exceptions. */
26722672
void HELPER(v7m_msr)(CPUARMState *env, uint32_t reg, uint32_t val)
26732673
{
2674-
cpu_abort(env, "v7m_mrs %d\n", reg);
2674+
ARMCPU *cpu = arm_env_get_cpu(env);
2675+
2676+
cpu_abort(CPU(cpu), "v7m_msr %d\n", reg);
26752677
}
26762678

26772679
uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
26782680
{
2679-
cpu_abort(env, "v7m_mrs %d\n", reg);
2681+
ARMCPU *cpu = arm_env_get_cpu(env);
2682+
2683+
cpu_abort(CPU(cpu), "v7m_mrs %d\n", reg);
26802684
return 0;
26812685
}
26822686

26832687
void switch_mode(CPUARMState *env, int mode)
26842688
{
2685-
if (mode != ARM_CPU_MODE_USR)
2686-
cpu_abort(env, "Tried to switch out of user mode\n");
2689+
ARMCPU *cpu = arm_env_get_cpu(env);
2690+
2691+
if (mode != ARM_CPU_MODE_USR) {
2692+
cpu_abort(CPU(cpu), "Tried to switch out of user mode\n");
2693+
}
26872694
}
26882695

26892696
void HELPER(set_r13_banked)(CPUARMState *env, uint32_t mode, uint32_t val)
26902697
{
2691-
cpu_abort(env, "banked r13 write\n");
2698+
ARMCPU *cpu = arm_env_get_cpu(env);
2699+
2700+
cpu_abort(CPU(cpu), "banked r13 write\n");
26922701
}
26932702

26942703
uint32_t HELPER(get_r13_banked)(CPUARMState *env, uint32_t mode)
26952704
{
2696-
cpu_abort(env, "banked r13 read\n");
2705+
ARMCPU *cpu = arm_env_get_cpu(env);
2706+
2707+
cpu_abort(CPU(cpu), "banked r13 read\n");
26972708
return 0;
26982709
}
26992710

@@ -2892,7 +2903,7 @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
28922903
do_v7m_exception_exit(env);
28932904
return;
28942905
default:
2895-
cpu_abort(env, "Unhandled exception 0x%x\n", cs->exception_index);
2906+
cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index);
28962907
return; /* Never happens. Keep compiler happy. */
28972908
}
28982909

@@ -3017,7 +3028,7 @@ void arm_cpu_do_interrupt(CPUState *cs)
30173028
offset = 4;
30183029
break;
30193030
default:
3020-
cpu_abort(env, "Unhandled exception 0x%x\n", cs->exception_index);
3031+
cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index);
30213032
return; /* Never happens. Keep compiler happy. */
30223033
}
30233034
/* High vectors. */
@@ -3695,6 +3706,8 @@ uint32_t HELPER(get_r13_banked)(CPUARMState *env, uint32_t mode)
36953706

36963707
uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
36973708
{
3709+
ARMCPU *cpu = arm_env_get_cpu(env);
3710+
36983711
switch (reg) {
36993712
case 0: /* APSR */
37003713
return xpsr_read(env) & 0xf8000000;
@@ -3725,13 +3738,15 @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
37253738
return env->v7m.control;
37263739
default:
37273740
/* ??? For debugging only. */
3728-
cpu_abort(env, "Unimplemented system register read (%d)\n", reg);
3741+
cpu_abort(CPU(cpu), "Unimplemented system register read (%d)\n", reg);
37293742
return 0;
37303743
}
37313744
}
37323745

37333746
void HELPER(v7m_msr)(CPUARMState *env, uint32_t reg, uint32_t val)
37343747
{
3748+
ARMCPU *cpu = arm_env_get_cpu(env);
3749+
37353750
switch (reg) {
37363751
case 0: /* APSR */
37373752
xpsr_write(env, val, 0xf8000000);
@@ -3794,7 +3809,7 @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t reg, uint32_t val)
37943809
break;
37953810
default:
37963811
/* ??? For debugging only. */
3797-
cpu_abort(env, "Unimplemented system register write (%d)\n", reg);
3812+
cpu_abort(CPU(cpu), "Unimplemented system register write (%d)\n", reg);
37983813
return;
37993814
}
38003815
}

0 commit comments

Comments
 (0)