wip: thread and processes handle

This commit is contained in:
0x35c
2025-11-05 16:19:21 +01:00
parent 56cfe9f2be
commit 374ea13173
25 changed files with 243 additions and 340 deletions

View File

@ -0,0 +1,31 @@
.intel_syntax noprefix
.section .text
.global switch_thread
switch_thread:
push ebx
push ebp
push edi
push esi
mov eax, [current_tcb]
// save the current stack pointer to the old stack
mov [eax+0], esp
// stack pointer + the 4 regs pushed
// and + 1 to get the argument (next thread)
mov esi, [esp+(4+1)*4]
mov [current_tcb], esi
mov eax, [current_tcb]
mov esp, [eax+0] // get esp
pop esi
pop edi
pop ebp
pop ebx
iret