Add: exec feature for binaries
This commit is contained in:
@@ -120,17 +120,6 @@ void kmain(multiboot2_info *mb_info)
|
||||
|
||||
// usually the place where i do testing
|
||||
|
||||
void* binary_file = load_file_from_initrd((uint8_t*)initrd_addr, "./hello.bin");
|
||||
if (binary_file == NULL)
|
||||
{
|
||||
printf("[debug] Failed to load test program!\n");
|
||||
} else {
|
||||
printf("[debug] Test program loaded!\n");
|
||||
}
|
||||
|
||||
void (*program_entry)() = (void (*)())binary_file;
|
||||
program_entry();
|
||||
|
||||
timer_install();
|
||||
keyboard_install();
|
||||
printf("[kernel] spawning shell...\n");
|
||||
|
||||
@@ -225,7 +225,7 @@ syscall_common_stub:
|
||||
|
||||
mov eax, ds
|
||||
push eax ; save ds
|
||||
mov ax, 0x10 ; kernel segment
|
||||
mov ax, 0x01 ; kernel segment YES I CHEATED I KNOW THIS SUCKS
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
|
||||
@@ -146,6 +146,7 @@ void shell_install()
|
||||
register_command("lspci", program_lspci);
|
||||
register_command("naval", program_navalbattle);
|
||||
register_command("snake", program_snake);
|
||||
register_command("exec", program_exec);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "../libc/stdio.h"
|
||||
|
||||
void handle_syscall(int syscall_number, void* arg)
|
||||
void handle_syscall(int syscall_number)
|
||||
{
|
||||
switch(syscall_number)
|
||||
{
|
||||
@@ -29,5 +29,5 @@ void syscall_handler()
|
||||
|
||||
printf("[syscall] syscall_number=%d, arg=%p\n", syscall_number, arg);
|
||||
|
||||
handle_syscall(syscall_number, arg);
|
||||
handle_syscall(syscall_number);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user