Second Stage Bootloader is not working...

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

Re: Second Stage Bootloader is not working...

Post by nullplan »

neon wrote:For these scenarios you'll need to switch between real and protected modes or use unreal mode.
In addition to what Octo said, you really should not be using unreal mode. Unreal mode can be destroyed whenever BIOS switches to protected mode and then back to real mode. Indeed, BIOS has no way to tell that unreal mode is in use. And BIOS can switch modes potentially on every interrupt it handles, both hardware and software. There is a lot of hardware that cannot be serviced in real mode at all, e.g. USB and NVMe. SeaBIOS exists and you can look up its source code, and see all the mode switches in there.

On the flipside, function 15/87 is used in popular boot loaders, and therefore highly likely to be both present and working.
Carpe diem!
Octocontrabass
Member
Member
Posts: 5218
Joined: Mon Mar 25, 2013 7:01 pm

Re: Second Stage Bootloader is not working...

Post by Octocontrabass »

nullplan wrote:Unreal mode can be destroyed whenever BIOS switches to protected mode and then back to real mode.
Ah, good point. You'd have to set up a #GP handler to catch the segment limit violations and return to unreal mode, and that's usually not worth the extra trouble for a bootloader.
nullplan
Member
Member
Posts: 1643
Joined: Wed Aug 30, 2017 8:24 am

Re: Second Stage Bootloader is not working...

Post by nullplan »

Octocontrabass wrote:Ah, good point. You'd have to set up a #GP handler to catch the segment limit violations and return to unreal mode, and that's usually not worth the extra trouble for a bootloader.
True. Plus, #GP is interrupt 9, which in BIOS compatible mode is supposed to be IRQ 1, the keyboard interrupt. So you'd need to deal with that, and the whole rat's tail just keeps getting longer.
Carpe diem!
Octocontrabass
Member
Member
Posts: 5218
Joined: Mon Mar 25, 2013 7:01 pm

Re: Second Stage Bootloader is not working...

Post by Octocontrabass »

...You mean interrupt 13 and IRQ5?
nullplan
Member
Member
Posts: 1643
Joined: Wed Aug 30, 2017 8:24 am

Re: Second Stage Bootloader is not working...

Post by nullplan »

And that's why i should have looked it up in the CPU manual rather than in RBIL. You are absolutely correct.
Carpe diem!
protos
Posts: 8
Joined: Sun Aug 27, 2023 3:47 pm
Freenode IRC: krypniok
Contact:

Re: Second Stage Bootloader is not working...

Post by protos »

I have kinda adopt the direction from above, now i get it that the interrupt cannot go over 1MB, okay, i can then copy it over on chunks if i need later. and no, i really dont want to use any existing stuff for boot anything. now the other boggling questing to me ist, can you give me working Bochs BGA Code ?

Back in the time on DOS witj DJGPP, i could swear i had changed the bios-font without, mode swiching ? Oh and btw, can you also re-teach me how to do that, at least in that emulator ?

However, i thank you all for your might <3

Code: Select all

https://github.com/krypniok/deuteros
Octocontrabass
Member
Member
Posts: 5218
Joined: Mon Mar 25, 2013 7:01 pm

Re: Second Stage Bootloader is not working...

Post by Octocontrabass »

protos wrote:Back in the time on DOS witj DJGPP, i could swear i had changed the bios-font without, mode swiching ? Oh and btw, can you also re-teach me how to do that, at least in that emulator ?
Changing the text mode font is a VGA feature.

In real mode, you can call INT 0x10 AX=0x1100 or INT 0x10 AX=0x1110 to load a new font.

In protected mode, you can poke some VGA registers to access the VGA memory where the font is stored to load a new font.
Post Reply