Page 3 of 3

Re: kernel load address > 1MB access in realmode

Posted: Sat Dec 03, 2022 4:20 pm
by Octocontrabass
rdos wrote:I checked my copy code again, and I actually reload cs like you are supposed to, but I'm still not sure if this is required.
It is required. Intel makes it very clear that skipping this step can cause random crashes. I suspect it's caused by the RSM instruction faulting due to an invalid saved state, but Intel doesn't elaborate.
rdos wrote:I can see one potential problem with the code. You never reload ds and es with selectors with a 64k limit, which means you leave the copy procedure with "unreal mode" selectors.
Is this really a problem? Code that expects to run in real mode won't access beyond 64k in the first place, so should be fine to leave it be.
mtbro wrote:Isn't es segment in es:edi implied?
All of the operands are implied. You only need to write them if you want to ensure the assembler emits the correct prefixes instead of using the defaults.
mtbro wrote:when does data selector reloading take effect ?
In protected mode, a segment load updates all segment attributes. In real mode, a segment load updates the base but does not update the limit (and may or may not update other segment attributes - that part is undefined behavior).
nullplan wrote:it does not use an interrupt from the HC to trigger that, it just checks on the pipe in the timer interrupt
Huh, that's interesting. Every other BIOS I've seen uses SMM to emulate a PS/2 keyboard.