Moved PCB for each process to kernel heap

This commit is contained in:
2022-07-03 13:17:06 -05:00
parent e3026b2601
commit 5c7d002bbf
8 changed files with 144 additions and 104 deletions

View File

@@ -25,14 +25,63 @@ isr_syscall:
.global isr_preempt
.type isr_preempt, @function
isr_preempt:
// Disable interrupts for now
cli
// Save process's base pointer
push %ebp
// Save base pointer; it points to the interrupt stack frame
mov %esp, %ebp
sub $4, %ebp
// Save EAX on stack so it can be used as a buffer
push %eax
// Load EFLAGS, then push it onto stack
mov 8(%ebp), %eax
push %eax
// Load EIP, then push it onto stack
mov 16(%ebp), %eax
push %eax
// Load CS, then push it onto stack
mov 12(%ebp), %eax
push %eax
// Load ESP, then push it onto stack
mov 4(%ebp), %eax
push %eax
// Load SS, then push it onto stack
mov (%ebp), %eax
push %eax
// Load EBP, then push it onto stack
mov -4(%ebp), %eax
push %eax
// Push GP registers onto stack
push %esi
push %edi
push %edx
push %ecx
push %ebx
// Restore saved value of EAX, then push it onto stack
mov -8(%ebp), %eax
push %eax
// Push pointer to the process context saved on the stack
push %esp
push $0x800
call save_context
add $8, %esp
push $0x800
mov %ebp, %esp
call next_process
add $8, %esp
push %eax
call load_context