Setting EFLAGS after booting

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
mrjbom
Member
Member
Posts: 315
Joined: Sun Jul 21, 2019 7:34 am

Setting EFLAGS after booting

Post 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.
nullplan
Member
Member
Posts: 1789
Joined: Wed Aug 30, 2017 8:24 am

Re: Setting EFLAGS after booting

Post 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.
Carpe diem!
Post Reply