What defines the 32 CPU interrupt logic?

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
itarato
Posts: 9
Joined: Sat Dec 12, 2020 12:35 pm

What defines the 32 CPU interrupt logic?

Post by itarato »

Apology for noob question. I'm following an OS from scratch tutorial and got to the point of memory management: https://wiki.osdev.org/Detecting_Memory_(x86) I want to know my available and detected memory space. The page explains using INT 0x12 or INT 0x15.
My confusion is around these interrupts. In an earlier phase I defined the base 32 CPU interrupts as explained in https://wiki.osdev.org/Interrupt_Descriptor_Table - including 0x12 and 0x15. Now obviously calling INT 0x12 or the other will go to my routines.

In case of memory detection (INT 0x12) - am I correct that it's my responsibility to write the code that detects the memory and sets the size in AX? Which would leave me a question - how do I really detect the memory?
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: What defines the 32 CPU interrupt logic?

Post by Gigasoft »

What? No. You have to call the function provided by the BIOS, in real mode. It just happens that BIOS software interrupt numbers overlap with exception numbers, since these exceptions did not exist on the 8086 used in early PCs.
PeterX
Member
Member
Posts: 590
Joined: Fri Nov 22, 2019 5:46 am

Re: What defines the 32 CPU interrupt logic?

Post by PeterX »

If you have to deal with a Legacy BIOS PC, you detect memory by using the mentioned BIOS interrupts in the real mode part of the bootloader. Then you hand over the memory "table" to the protected mode kernel. The interrupts in the protected mode kernel are unrelated to the BIOS interrupts.

If you have to deal with an UEFI PC, you repeatedly use the UEFI function GetMemoryMap() to detect memory usage.

Greetings
Peter
itarato
Posts: 9
Joined: Sat Dec 12, 2020 12:35 pm

Re: What defines the 32 CPU interrupt logic?

Post by itarato »

Gigasoft wrote:What? No. You have to call the function provided by the BIOS, in real mode. It just happens that BIOS software interrupt numbers overlap with exception numbers, since these exceptions did not exist on the 8086 used in early PCs.
Aaaah. Just tried it and it looks promising. Much appreciated. Also the explanation makes sense, much appreciated!
Post Reply