tasking: fix ELF file execution

This commit is contained in:
2025-06-07 18:18:05 +03:00
parent 9f721a72b7
commit 5fa2393fd6
7 changed files with 133 additions and 68 deletions
+20 -2
View File
@@ -16,10 +16,27 @@ sys_exit_handler:
mov fs, ax
mov gs, ax
mov eax, [esp+44] ; System call number
mov ebx, [esp+32] ; Arg1
mov ecx, [esp+40] ; Arg2
mov edx, [esp+36] ; Arg3
mov esi, [esp+28] ; Arg4
mov edi, [esp+24] ; Arg5
; Print debug information
push edi ; arg5
push esi ; arg4
push edx ; arg3
push ecx ; arg2
push ebx ; arg1
push eax ; syscall number
push syscall_debug_fmt
; Выполняем действие
push sys_exit_msg
;push sys_exit_msg
call printf
add esp, 4
;add esp, 4
add esp, 28
; Восстанавливаем сегменты Ring 3
pop gs
@@ -47,3 +64,4 @@ heh:
section .data
sys_exit_msg: db "Returned from Ring 3", 0
syscall_debug_fmt: db "Syscall #%x, args: 0x%x 0x%x 0x%x 0x%x 0x%x", 10, 0