Page 1 of 1

How can i expose OS services to applications?

Posted: Tue Aug 31, 2004 11:00 pm
by AltCtrlDel
i want to give applications running on the OS access to certaine routines in my OS, but without invoking interrupts

how can this be done using normal C libraries,what about passing pointers from the applications to such routines.

plz, if u could supply a simple example i would be very thankful

thnx

RE:How can i expose OS services to applications?

Posted: Tue Aug 31, 2004 11:00 pm
by SystemHalted
Why cant  you use interrupts?

RE:How can i expose OS services to applications?

Posted: Wed Sep 01, 2004 11:00 pm
by AltCtrlDel
it is not 'I cant use interrupts'
it is 'I  dont want to use interrupts'

i just think that exposing services using library routines is more suitable for use in high level languages

RE:How can i expose OS services to applications?

Posted: Wed Sep 01, 2004 11:00 pm
by GT
High level languages generally have a library that handles OS calls, for example, the C language has a library called libc that handles all OS calls, so C programs never have to call interrupts, they just call libc functions.

When you write the libc library, of course, that will have to use interrupts or whatever syscall mechanism your OS uses...

RE:How can i expose OS services to applications?

Posted: Wed Sep 01, 2004 11:00 pm
by pkd
When I load my library in I create a Table with all Function names (mangled ie _Z5PrintPc) and the address which they are linked at when loaded, I then link the application at runtime from a elf.object (not linked).

The OS call mechanism I use is Syscall/Sysret (you could also use sysenter/sysleave if these are not supported) and have a single entry point to the System functions. When calling I have function number in eax, and copy the User stack to the system stack for parameters.

I am using paged memory and the kernel as well as library routines are mapped to every Apps User space.

hope this helps
pkd.

RE:How can i expose OS services to applications?

Posted: Fri Sep 03, 2004 11:00 pm
by AltCtrlDel
that was really helpful, but can u give me some online resource on implementing system calls this way or even just 'a more detailed illustration' of system calls

thnx