Exit the application in the operating system without separating memory

I am writing a monolithic operating system (it is a joke to call it an operating system, but it does have very small, school-level functionalists).
When I When talking about monolithic, I mean, it is compiled into a single binary blob and does not support file system etc. At the moment I only have a basic simple user space, which is just an infinite loop.

I I intend to make my operating system more useful, and hope to be able to write user applications that can be terminated like regular applications on a complete operating system.

I don’t have glibc or equivalent. My current library in user space is the code I wrote.
Now my question is how to add a framework to user space applications, which will make them end at a fix point.

I know How to compile a program on a regular system and what happens when the program terminates. However, in my case, I don’t have the luxury of compiling the program against the library. If a program terminates, then my instruction pointer is just a crazy detour. /p>

Currently I am making all applications for “revisiting”, and I pre-populate the application stack (during startup) with the repair address. Is there a better way to deal with this problem?

In addition to the answer, I am very happy to know some operating system concepts.

I am using the x86 emulator platform and statically compiling my binary files. (I do have virtual memory support)< /p>

Manually make the first stack frame and return to any process you need to run. The cleanup code seems to be a A very reasonable method. If your operating system has a “system call”, the user space process cleanup code (may be called exit()) may end with a call to the _exit() system call. You still need the handler to try to “la -la land’ in the case of code execution, because this can still happen (but doing so before you have a page protection system may be a problem).

I am writing a monolithic Operating system (to call it an operating system is a joke, but it does have very small, school-level functionalists).
When I say monolithic, I mean, it is compiled into a single binary blob And does not support file system, etc. At present I only have a basic simple user space, which is just an infinite loop.

I intend to make my operating system more useful, and hope to be able to write user applications Programs, these applications can be terminated like regular applications on a full operating system.

I don’t have glibc or equivalent. My current library in user space is the code I wrote.
Now my question is how to add a framework for user space applications, which will make them terminate at a repair point.

I know how to compile a program on a regular system and what happens when the program terminates. However, In my case, I don’t have the luxury of compiling the program against the library. If a program terminates, then my instruction pointer is just a crazy detour.

Currently I am making all applications for “revisiting” “, and I use the repair address to pre-populate the application stack (during startup). Is there a better way to deal with this problem?

Besides the answer, I’m very happy to know some operating system concepts.

p>

I am using the x86 emulator platform and statically compiling my binary files. (I do have virtual memory support)

Handmade first A stack frame, returning to any process cleanup code you need to run seems to be a very reasonable approach. If your operating system has a “system call”, the user space process cleanup code (maybe called exit()) may be called The _exit() system call ends. You still need to handle the situation where the program tries to execute code in “la-la land”, because this can still happen (but if you have This may be a difficult problem for a page protection system before).

Leave a Comment

Your email address will not be published.