Is there any particular reason why the Unix/Linux developers chose 0x80 for the system call interrupt? Is there an advantage to using that particular interrupt or did they just pick it out of a hat?
Why 0x80?
Re: Why 0x80?
It doesn't fall into the range of the CPU exception vectors or the default IRQ vectors as set up by the BIOS. Seems good enough.
In terms of the instruction set, 0x80 is no different than most other values. There's just one int n instruction (unless we're talking about int3 and into, which would be awkward to use), unlike several variants of push n (byte and word sized).
In terms of the instruction set, 0x80 is no different than most other values. There's just one int n instruction (unless we're talking about int3 and into, which would be awkward to use), unlike several variants of push n (byte and word sized).
-
- Member
- Posts: 307
- Joined: Wed Oct 30, 2013 1:57 pm
- Libera.chat IRC: no92
- Location: Germany
- Contact:
Re: Why 0x80?
There's nothing special about it, you could use 0x100 as well, as long as it doesn't conflict with any predefined vectors. It's 128 in decimal, which us nice (power of two ...), but nothing more. The IDT fits 256 entries, which make this number nice in two ways. This only goes for protected mode; in long mode we have the syscall instruction.
Re: Why 0x80?
Surely, 0x100 would be impossible since the interrupts begin at 0 and there are only 256 (0xFF) of them?no92 wrote:There's nothing special about it, you could use 0x100 as well
-
- Member
- Posts: 307
- Joined: Wed Oct 30, 2013 1:57 pm
- Libera.chat IRC: no92
- Location: Germany
- Contact:
Re: Why 0x80?
Oops, I meant 100 decimalSapphireBeauty wrote:Surely, 0x100 would be impossible since the interrupts begin at 0 and there are only 256 (0xFF) of them?no92 wrote:There's nothing special about it, you could use 0x100 as well
Re: Why 0x80?
I used 100 decimal for interrupt in my OS.no92 wrote: Oops, I meant 100 decimal
Re: Why 0x80?
That makes more sense :)no92 wrote:Oops, I meant 100 decimal :D
I'm using 0xFF, nice and easy to remember :)muazzam wrote:I used 100 decimal for interrupt in my OS.
Re: Why 0x80?
If you are starting from scratch I think it makes a lot more sense to use sysenter/sysexit rather than an interrupt for system calls.
-
- Member
- Posts: 170
- Joined: Wed Jul 18, 2007 5:51 am
Re: Why 0x80?
According to the "Programmer's Technical Reference for MSDOS and the IBM PC", INT 0x80 was reserved for BASIC.
http://www.o3one.org/hwdocs/bios_doc/dosref22.html
The implications are obvious, INT 0x80 would never be used by hardware or the BIOS, and so it was safe for Linux to use it.
My question is.... did Linus know this fact or was there another reason he chose 0x80?
http://www.o3one.org/hwdocs/bios_doc/dosref22.html
The implications are obvious, INT 0x80 would never be used by hardware or the BIOS, and so it was safe for Linux to use it.
My question is.... did Linus know this fact or was there another reason he chose 0x80?