Page 1 of 1

Setting EFLAGS after booting

Posted: Sat Dec 23, 2023 10:26 am
by mrjbom
My kernel boots into protected mode with GRUB, the multiboot spec says "Bit 17 (VM) must be cleared. Bit 9 (IF) must be cleared. All other bits are undefined".
Since I think I should set the other bits manually, but which bits and to what value should I set them?
For example, I think I need to set the IOPL bits to 00.

Re: Setting EFLAGS after booting

Posted: Sat Dec 23, 2023 2:51 pm
by nullplan
For most things, you can just set all bits zero. Just

Code: Select all

push $0
popfd
after setting up the stack. This initializes all the spec forgot to mention. It clears VM and IF and IOPL and DF. And then you can work from there.