[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-7.2.11 32/41] target/loongarch: Fix qemu-system-loongarch64 asse
From: |
Michael Tokarev |
Subject: |
[Stable-7.2.11 32/41] target/loongarch: Fix qemu-system-loongarch64 assert failed with the option '-d int' |
Date: |
Wed, 10 Apr 2024 08:43:53 +0300 |
From: Song Gao <gaosong@loongson.cn>
qemu-system-loongarch64 assert failed with the option '-d int',
the helper_idle() raise an exception EXCP_HLT, but the exception name is
undefined.
Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20240321123606.1704900-1-gaosong@loongson.cn>
(cherry picked from commit 1590154ee4376819a8c6ee61e849ebf4a4e7cd02)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(Mjt: fixup for lack of 2 commits adding new entries into excp_names[]:
v8.0.0-514-ga3f3db5cda "target/loongarch: Add CHECK_SXE maccro for check LSX
enable" and
v8.1.0-801-gb8f1bdf3d1 "target/loongarch: check_vec support check LASX
instructions")
diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index 46b04cbdad..92dd50e15e 100644
--- a/target/loongarch/cpu.c
+++ b/target/loongarch/cpu.c
@@ -33,31 +33,45 @@ const char * const fregnames[32] = {
"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
};
-static const char * const excp_names[] = {
- [EXCCODE_INT] = "Interrupt",
- [EXCCODE_PIL] = "Page invalid exception for load",
- [EXCCODE_PIS] = "Page invalid exception for store",
- [EXCCODE_PIF] = "Page invalid exception for fetch",
- [EXCCODE_PME] = "Page modified exception",
- [EXCCODE_PNR] = "Page Not Readable exception",
- [EXCCODE_PNX] = "Page Not Executable exception",
- [EXCCODE_PPI] = "Page Privilege error",
- [EXCCODE_ADEF] = "Address error for instruction fetch",
- [EXCCODE_ADEM] = "Address error for Memory access",
- [EXCCODE_SYS] = "Syscall",
- [EXCCODE_BRK] = "Break",
- [EXCCODE_INE] = "Instruction Non-Existent",
- [EXCCODE_IPE] = "Instruction privilege error",
- [EXCCODE_FPD] = "Floating Point Disabled",
- [EXCCODE_FPE] = "Floating Point Exception",
- [EXCCODE_DBP] = "Debug breakpoint",
- [EXCCODE_BCE] = "Bound Check Exception",
+struct TypeExcp {
+ int32_t exccode;
+ const char * const name;
+};
+
+static const struct TypeExcp excp_names[] = {
+ {EXCCODE_INT, "Interrupt"},
+ {EXCCODE_PIL, "Page invalid exception for load"},
+ {EXCCODE_PIS, "Page invalid exception for store"},
+ {EXCCODE_PIF, "Page invalid exception for fetch"},
+ {EXCCODE_PME, "Page modified exception"},
+ {EXCCODE_PNR, "Page Not Readable exception"},
+ {EXCCODE_PNX, "Page Not Executable exception"},
+ {EXCCODE_PPI, "Page Privilege error"},
+ {EXCCODE_ADEF, "Address error for instruction fetch"},
+ {EXCCODE_ADEM, "Address error for Memory access"},
+ {EXCCODE_SYS, "Syscall"},
+ {EXCCODE_BRK, "Break"},
+ {EXCCODE_INE, "Instruction Non-Existent"},
+ {EXCCODE_IPE, "Instruction privilege error"},
+ {EXCCODE_FPD, "Floating Point Disabled"},
+ {EXCCODE_FPE, "Floating Point Exception"},
+ {EXCCODE_DBP, "Debug breakpoint"},
+ {EXCCODE_BCE, "Bound Check Exception"},
+ {EXCCODE_SXD, "128 bit vector instructions Disable exception"},
+ {EXCCODE_ASXD, "256 bit vector instructions Disable exception"},
+ {EXCP_HLT, "EXCP_HLT"},
};
const char *loongarch_exception_name(int32_t exception)
{
- assert(excp_names[exception]);
- return excp_names[exception];
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(excp_names); i++) {
+ if (excp_names[i].exccode == exception) {
+ return excp_names[i].name;
+ }
+ }
+ return "Unknown";
}
void G_NORETURN do_raise_exception(CPULoongArchState *env,
@@ -66,7 +80,7 @@ void G_NORETURN do_raise_exception(CPULoongArchState *env,
{
CPUState *cs = env_cpu(env);
- qemu_log_mask(CPU_LOG_INT, "%s: %d (%s)\n",
+ qemu_log_mask(CPU_LOG_INT, "%s: expection: %d (%s)\n",
__func__,
exception,
loongarch_exception_name(exception));
@@ -143,22 +157,16 @@ static void loongarch_cpu_do_interrupt(CPUState *cs)
CPULoongArchState *env = &cpu->env;
bool update_badinstr = 1;
int cause = -1;
- const char *name;
bool tlbfill = FIELD_EX64(env->CSR_TLBRERA, CSR_TLBRERA, ISTLBR);
uint32_t vec_size = FIELD_EX64(env->CSR_ECFG, CSR_ECFG, VS);
if (cs->exception_index != EXCCODE_INT) {
- if (cs->exception_index < 0 ||
- cs->exception_index >= ARRAY_SIZE(excp_names)) {
- name = "unknown";
- } else {
- name = excp_names[cs->exception_index];
- }
-
qemu_log_mask(CPU_LOG_INT,
"%s enter: pc " TARGET_FMT_lx " ERA " TARGET_FMT_lx
- " TLBRERA " TARGET_FMT_lx " %s exception\n", __func__,
- env->pc, env->CSR_ERA, env->CSR_TLBRERA, name);
+ " TLBRERA " TARGET_FMT_lx " exception: %d (%s)\n",
+ __func__, env->pc, env->CSR_ERA, env->CSR_TLBRERA,
+ cs->exception_index,
+ loongarch_exception_name(cs->exception_index));
}
switch (cs->exception_index) {
--
2.39.2
- [Stable-7.2.11 15/41] hw/nvme: cleanup error reporting in nvme_init_pci(), (continued)
- [Stable-7.2.11 15/41] hw/nvme: cleanup error reporting in nvme_init_pci(), Michael Tokarev, 2024/04/10
- [Stable-7.2.11 22/41] hmat acpi: Fix out of bounds access due to missing use of indirection, Michael Tokarev, 2024/04/10
- [Stable-7.2.11 24/41] tests/unit: Bump test-aio-multithread test timeout to 2 minutes, Michael Tokarev, 2024/04/10
- [Stable-7.2.11 26/41] tests/unit: Bump test-replication timeout to 60 seconds, Michael Tokarev, 2024/04/10
- [Stable-7.2.11 25/41] tests/unit: Bump test-crypto-block test timeout to 5 minutes, Michael Tokarev, 2024/04/10
- [Stable-7.2.11 23/41] migration: Skip only empty block devices, Michael Tokarev, 2024/04/10
- [Stable-7.2.11 27/41] tests: Raise timeouts for bufferiszero and crypto-tlscredsx509, Michael Tokarev, 2024/04/10
- [Stable-7.2.11 29/41] target/i386: use separate MMU indexes for 32-bit accesses, Michael Tokarev, 2024/04/10
- [Stable-7.2.11 30/41] target/i386: fix direction of "32-bit MMU" test, Michael Tokarev, 2024/04/10
- [Stable-7.2.11 33/41] hw/scsi/scsi-generic: Fix io_timeout property not applying, Michael Tokarev, 2024/04/10
- [Stable-7.2.11 32/41] target/loongarch: Fix qemu-system-loongarch64 assert failed with the option '-d int',
Michael Tokarev <=
- [Stable-7.2.11 28/41] target/i386: introduce function to query MMU indices, Michael Tokarev, 2024/04/10
- [Stable-7.2.11 31/41] target/i386: Revert monitor_puts() in do_inject_x86_mce(), Michael Tokarev, 2024/04/10
- [Stable-7.2.11 34/41] monitor/hmp-cmds-target: Append a space in error message in gpa2hva(), Michael Tokarev, 2024/04/10
- [Stable-7.2.11 36/41] tcg/optimize: Fix sign_mask for logical right-shift, Michael Tokarev, 2024/04/10
- [Stable-7.2.11 37/41] target/hppa: Clear psw_n for BE on use_nullify_skip path, Michael Tokarev, 2024/04/10
- [Stable-7.2.11 38/41] gitlab-ci/cirrus: switch from 'master' to 'latest', Michael Tokarev, 2024/04/10
- [Stable-7.2.11 39/41] hw/intc/arm_gicv3: ICC_HPPIR* return SPURIOUS if int group is disabled, Michael Tokarev, 2024/04/10
- [Stable-7.2.11 35/41] virtio-net: Fix vhost virtqueue notifiers for RSS, Michael Tokarev, 2024/04/10
- [Stable-7.2.11 40/41] hw/net/virtio-net: fix qemu set used ring flag even vhost started, Michael Tokarev, 2024/04/10
- [Stable-7.2.11 41/41] hw/virtio: Fix packed virtqueue flush used_idx, Michael Tokarev, 2024/04/10