How would i go about implimenting a standard API for my OS? I would like this API to be available to all programs available in my OS? How would i go about doing this?
~Ricky
API
Re: API
All you need to do to make your API available is document it!
the API delivery mechanism can be any multitude of methods from INT calls to a syscall jump table, etc.
as long as its documented nicely.
the API delivery mechanism can be any multitude of methods from INT calls to a syscall jump table, etc.
as long as its documented nicely.
-- Stu --
Re: API
Examples of APIs range from DOS (a few 8086 interrupts and functions for the few services that it provides) to BeOS (a whole class library including interfaces to the kernel, the GUI, the file system, and a lot more).
So it's up to you -- decide on a means of calling your kernel (a system call interface -- on the x86, usually by interrupts) and write a HLL layer around it.
So it's up to you -- decide on a means of calling your kernel (a system call interface -- on the x86, usually by interrupts) and write a HLL layer around it.
Re: API
Just to clarify here, if you're writing your OS in protected mode and you're using multiple levels of protection, you can't just export the addresses of entry points into the kernel and then document those, because user code jumping from a numerically higher CPL to a lower DPL will cause a protection fault. ?That's what the talk concerning syscalls, ints etc... are about. ?With interrupts, your API is more processor independent and you have the choice of running the system call as a new task or in the context of the task that called it. OTOH, using intel call gates is also a very good way of doing a system call. ?You put a call gate entry into the GDT (with the offset of some handler), then you just call that call gate, and there you are executing the kernel code. ?Check out the 80386 Programmer's Reference Manual at http://webster.cs.ucr.edu/Page_asm/Doc386/TOC.HTM for more info on this type of stuff.