-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bochs fails to boot with cpu model = pentium or pentium_mmx #63
Comments
Fixing the PGE issue is not especially hard (CPUID.0x1 EDX bit 13 contains the support information) and it is definitely possible to map the kernel without the "G" bit enabled (at a performance cost); but the compiler is generating unsupported instructions:
In both cases, the culprit is a CMOVE:
and
(which funnily enough means that the PANIC itself recursively causes a PANIC) https://stackoverflow.com/questions/30150274/purpose-of-cmove-instruction-in-x86-assembly |
In theory it should be possible to set -march=i586 and disable the generation of CMOVE (as the instruction was part of the Pentium Pro first, aka i686), but for some reason as of yet unclear,
I have not yet investigated this - but one possible theory is that since my cross-compiler is built for i686, its own libgcc contains the CMOV. So, the tl;dr of this is that in order to boot on a Pentium, we'd need an entire toolchain + kernel + userspace built for i586 instead of i686. This is probably not worth the cost, since the Pentium Pro was first introduced in 1995 |
On a side note, during the teardown of init due to the "invalid opcode" error, we get a page fault:
|
If I had to guess, the sequence
corresponds to:
which makes me think that we want/need to validate "frame" as a "valid and mapped address" before trying to read from it |
In trying to get #63 to work, I ran into two issues: - the earlyboot "invalid opcode" handler was using a mismatched format string; - the backtrace API must check that the frame pointer is valid before trying to dereference it
This issue would require reworking the toolchain to support the i586 as its target instead of i686 - it is probably not worth pursuing. Closing for now, and will open a new file if there's a reason why Pentium support is critical |
If one sets the Bochs CPU model (http://bochs.sourceforge.net/doc/docbook/user/cpu-models.html) to either
pentium
orpentium_mmx
the boot fails at:At a glance, this is in loader.s:
Do we need to do this so early at boot? Can we use CPUID to detect whether this is supported? Can we try and do it later on, and panic?
The text was updated successfully, but these errors were encountered: