Firstly, am I correct in thinking that, according to the kernel, memory (possibly) looks a bit like this:
Code: Select all
+--------------------------------------------------------------+
|Kernel code|Kernel heap|Alloced to A|Alloced to B|Alloced to A|
+--------------------------------------------------------------+
Code: Select all
+-------------------------------------------------------------+
|Kernel code|Kernel heap|Alloced to A|Alloced to A|Blank |
+-------------------------------------------------------------+
1 ) Fork to make a new thread
2 ) Allocate some memory for and load my application, possibly putting .text and .data sections where the file format asks.
3 ) Allocate a new, blank stack
4 ) Push onto the new stack the addr of a kill_thread() function
5 ) Push onto the new stack the arguments sent to the application
6 ) Switch to new stack
7 ) Enter user mode
8 ) jmp to the beginning of the process code.
Many thanks,