Hello. Dis is just what the topic title says. Also can be translated as "how do i make an API for coding my OS' software".
So, if, say, i have a simple monotasking operating system running in kernel mode with some filesystem support that includes tools for reading an executable format (ELF, for example) and other files, so how do i actually "execute" them? Load the executable into memory, store the current EIP position, then move it to the start of executable in memory, and when that new program finishes, it calls some function that restores previous EIP position? How do i call previously declared kernel functions then? Jumping the EIP back'n'forth? So that when writing software for my OS, i need to reference these functions by corresponding addresses in memory?
Eh, i know, this might sound idiotic.
A silly noobish question about executables
Re: A silly noobish question about executables
If you're not worrying about switching between kernel and user modes, you can just use the call instruction. Load the executable into memory, then call its entry point, and have it return when it's done. In between, let it call some standard points in the kernel that it can know through something like a table at a fixed address. Or, you could use the int instruction and use the hardware version of that table. This is in fact how DOS works.
Re: A silly noobish question about executables
Eh, lol, that's a lot simplier than i thought. Thanks.