If you are new to OS Development, plan on spending some time here first before going into the other forums.
4 posts • Page 1 of 1
hlt halts the processor until the next interruptafdgdhfrtewdszs wrote:Hello i don't understand why we need to disable interrupts(with cli), i thought using hlt(to halt the cpu would be enough). In addition why do we need to null ds and es?
See why we need to disable interrupts? If we wouldn't use cli, then the cpu would continue running after the next interrupt, which could be anything.
On the question of nulling ds and es, could you post the relevent code where this happens? It's a little hard to explain various cases without the proper context.
ds and es are used implicitly by several common operations which we would want to perform during boot.In addition why do we need to null ds and es?
In the example given, we are getting our running system into a consistant state. Depending on your nasm settings (the ORG statement), the chances are that your variables will be expecting ds set to 0, and having it non-0 would mean that any data reference you tried to use would be referenced other memory, rather than memory in the 512 bytes loaded by the BIOS.