Implement serial logging. Finish modularizing power management.
[monolithium.git] / kernel / src / exec / aout.c
index c8a572a6ef80da364332b78e81b2dd9137f26182..6d071962b88a9987e458b0a3a519c101e0cb335d 100644 (file)
@@ -22,7 +22,7 @@
 #include <heap.h>
 #include <syscalls.h>
 
-dword_t load_aout(handle_t file, process_params_t *parameters, thread_state_t *initial_state)
+dword_t load_aout(handle_t file, thread_state_t *initial_state)
 {
     aout_header_t header;
     size_t bytes_read;
@@ -51,9 +51,8 @@ dword_t load_aout(handle_t file, process_params_t *parameters, thread_state_t *i
     if (ret != ERR_SUCCESS) return ret;
 
     initial_state->regs.esp = (uintptr_t)address + 0x200000;
-    init_user_stack((uintptr_t*)&initial_state->regs.esp, parameters);
 
-    address = (void*)0x100000;
+    address = (void*)0x1000;
 
     switch (header.midmag & 0xFFFF)
     {
@@ -97,8 +96,8 @@ dword_t load_aout(handle_t file, process_params_t *parameters, thread_state_t *i
                       INVALID_HANDLE,
                       section,
                       &address,
-                      0ULL,
-                      PAGE_ALIGN_UP(header.text_size + sizeof(aout_header_t)),
+                      (qword_t)sizeof(aout_header_t),
+                      PAGE_ALIGN_UP(header.text_size),
                       MEMORY_BLOCK_ACCESSIBLE
                       | MEMORY_BLOCK_WRITABLE
                       | MEMORY_BLOCK_USERMODE
@@ -144,7 +143,7 @@ dword_t load_aout(handle_t file, process_params_t *parameters, thread_state_t *i
         }
 
         syscall(SYSCALL_CLOSE_OBJECT, section);
-        initial_state->regs.eip = (uintptr_t)address + header.entry_point + sizeof(aout_header_t);
+        initial_state->regs.eip = (uintptr_t)address + header.entry_point;
         break;
     }