Let’s Build an Own Operating System (PrimitiveOS)

Part 6- Integrate user modes

The Road to User Mode….

User Mode Vs Kernel Mode

Loading an External Program

Getting into hands-on

Step 1

GRUB Modules

module /modules/program

Step 2

Step 3

Executing a Program

Step 4

Compiling

nasm -f bin program.s -o program

Step 5

Finding the Program in Memory

Step 6

Jumping to the Code

typedef void (*call_module_t)(void);
/* ... */
call_module_t start_program = (call_module_t) address_of_module;
start_program();
/* we'll never get here, unless the module code returns */

Checking the progress

The Beginning of User Mode

Software Engineering, University of Kelaniya, Sri Lanka