Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
I have finally gotten my multitasking to work, and I have now implemented an Exec function that allows me to execute bin and com files. This will later be upgraded to run ELF files. At the moment I just need some advice.
When the exec function is called, I load the file to memory, then I create a new user task for the program. I now need to implement a way to kill the task and free the memory used by it when the program is finished running. My problem is how would I implement this. Would adding a system call in the program at the end be the easiest way? ie:
Almost - under UNIX that call is executed when main returns, or when exit() is called. It's a function called _exit() - exit() calls all functions registered with atexit(), then falls through to _exit() which calls your OS cleanup code.