开发者

Stack size required for bios interrupt call

I am working on a small bootloader for learning purposes. Is there any specification/information available about the (free) stack size required f开发者_JS百科or a bios interrupt call?


before entering the interrupt handler, all registers are pushed to the stack along with the far return address, sum your registers sizes up and add the space needed to store the return address to get the minimal stack size .

take note that you will need some more space if you are pushing more data into the stack while in the interrupt handler


From http://www.o3one.org/hwdocs/bios_doc/pci_bios_21.pdf ("Calling Conventions" on page 3), it looks like the BIOS call can use up to 1024 bytes of stack space. My googling hasn't turned up any other sources.


I've noticed that if you are using int 0x13 you should have a stack that is at least 4096 bytes. Modern BIOSes often have an AHCI compatible int 0x13 handler, and since AHCI is quite complicated the BIOS int 0x13 requires a lot of stack space.

In the perfect world the BIOS should have it's own stack, but many BIOSes rely on the stack you provide.


The simple answer is that the stack that the BIOS used to make interrupt calls (including the int 13h to load the boot sector from the usb flash drive) prior to loading the boot sector is sufficient for boot sector use.

The happy answer is that the BIOS interrupts (except for the newer bloated PCI) are designed to execute in minimal space so there is no need to setup a stack in the boot sector.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜