OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 18, 2024 4:43 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Why 0x80?
PostPosted: Sat Mar 07, 2015 5:51 am 
Offline
Member
Member

Joined: Thu Feb 20, 2014 4:49 am
Posts: 31
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?

:-"


Last edited by Coomer69 on Mon Aug 03, 2020 2:01 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: Why 0x80?
PostPosted: Sat Mar 07, 2015 6:05 am 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
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).


Top
 Profile  
 
 Post subject: Re: Why 0x80?
PostPosted: Sat Mar 07, 2015 6:10 am 
Offline
Member
Member

Joined: Wed Oct 30, 2013 1:57 pm
Posts: 306
Location: Germany
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.

_________________
managarm


Top
 Profile  
 
 Post subject: Re: Why 0x80?
PostPosted: Sat Mar 07, 2015 7:01 am 
Offline
Member
Member

Joined: Thu Feb 20, 2014 4:49 am
Posts: 31
no92 wrote:
There's nothing special about it, you could use 0x100 as well

Surely, 0x100 would be impossible since the interrupts begin at 0 and there are only 256 (0xFF) of them?


Top
 Profile  
 
 Post subject: Re: Why 0x80?
PostPosted: Sat Mar 07, 2015 7:27 am 
Offline
Member
Member

Joined: Wed Oct 30, 2013 1:57 pm
Posts: 306
Location: Germany
SapphireBeauty wrote:
no92 wrote:
There's nothing special about it, you could use 0x100 as well

Surely, 0x100 would be impossible since the interrupts begin at 0 and there are only 256 (0xFF) of them?

Oops, I meant 100 decimal :D

_________________
managarm


Top
 Profile  
 
 Post subject: Re: Why 0x80?
PostPosted: Sat Mar 07, 2015 7:39 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 16, 2014 5:59 am
Posts: 543
Location: Shahpur, Layyah, Pakistan
no92 wrote:
Oops, I meant 100 decimal :D

I used 100 decimal for interrupt in my OS.


Top
 Profile  
 
 Post subject: Re: Why 0x80?
PostPosted: Sat Mar 07, 2015 7:44 am 
Offline
Member
Member

Joined: Thu Feb 20, 2014 4:49 am
Posts: 31
no92 wrote:
Oops, I meant 100 decimal :D

That makes more sense :)
muazzam wrote:
I used 100 decimal for interrupt in my OS.

I'm using 0xFF, nice and easy to remember :)


Top
 Profile  
 
 Post subject: Re: Why 0x80?
PostPosted: Sat Mar 07, 2015 8:54 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
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.


Top
 Profile  
 
 Post subject: Re: Why 0x80?
PostPosted: Thu Apr 23, 2015 6:16 am 
Offline
Member
Member

Joined: Wed Jul 18, 2007 5:51 am
Posts: 170
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: DotBot [Bot] and 60 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group