It's been a long time since I last posted here, but I'm back messing with OS design and I have a question:
I'm writing my kernel in C, and now it's time to implement a simple "API" for third party binaries to use the system functions. My basic idea is that I'll know the address of each of my kernel functions (I'll keep them at the beginning of the code, never changing it). In asm this idea works very well, because I can easily call a a procedure by a memory address (or by a constant which points to that address, to make things easier), but I don't know how to do something similar in C.
In assembly, for example, I'll add some something like this at a specific location of my kernel:
Code: Select all
call os_function_one
ret
call os_function_two
ret
call os_function_three
ret
Code: Select all
os_function_one equ 0x0400
os_function_two equ 0x0404
os_function_three equ 0x0408
It's a simple concept, by I'm having a hard time thinking on how to implement this to use with C development, not asm. Any ideas?
Thanks in advance,
Fergo.