The instructions being generated by clang required that SSE2 be enabled before they could be used. For anyone encountering a similar issue, SSE instructions can be enabled by following the SSE article on the osdev.org wiki.
문제
I've encountered an unexpected "Invalid Opcode" exception being raised in my kernel code, that only appears when:
running the code in QEMU (to be fair, I haven't actually tried any other emulators/hardware)
the code is compiled with -O2 or higher. If compiled with -O0 or -O1, no exception is raised.
Obviously clang is outputting some opcodes that qemu doesn't support, but I'm unsure as to how to work around this. I'd like to avoid compiling with a lower optimization level, if possible.
The relevant code seems fairly innocuous - it's just filling values in an array of bitmaps:
for (uint32_t i = 0; i < kNumBitmapEntries; i++) {
if (i > map_index) {
bitmaps[i] = ~0;
} else {
bitmaps[i] = 0;
}
}
Is there a way to enable/add the opcodes being generated to qemu?
해결책
제휴하지 않습니다 StackOverflow