Page 1 of 1

apis

Posted: Tue Jan 24, 2006 12:00 am
by robert macabre
i was just wondering, is there a 'correct' way to make the apis available for programs i write for my operating system? i'm not to that point yet, but i'm always thinking ahead, you know? my plan right now is to pass a pointer to an "api index" function to the program, but as i recall from my experience with palm os (i never programmed c/asm in windows) you raised an interrupt to use the apis. is there a standard way to do incorporate apis, and if not, what are some of your methods?

Re: apis

Posted: Tue Jan 24, 2006 12:00 am
by Da_Maestro
Most OSs will require the software to raise an interrupt to access the API.

However, 386 Protected mode has a special function for this, called a "Call Gate"

A call gate works by assigning a segment number to the entry point of your API. A call or jump to any point inside this segment is redirected to the entry point of the API.

You can use the protection mechanisms to determine who can use the call gate. See the intel-docs for info on call gates
http://www.intel.com

Re: apis

Posted: Tue Jan 24, 2006 12:00 am
by robert macabre
well, i'm really not too concerned about protection because my os has one main application. i think i may just go with my "index function" method though because, like i said, it's going to have one main use. though i am interested in the plain interrupt method, it seems like it could be simple but i'm not sure of the best way to go about trying that. do you know of any online resources where i could read some theory or see some examples?

Re: apis

Posted: Thu Jan 26, 2006 12:00 am
by Da_Maestro
Linux source code

It's available in a few places....google it :-)

Re: apis

Posted: Thu Jan 26, 2006 12:00 am
by robert macabre
thanks :]