Spinlock save cpu flags

This commit is contained in:
2026-03-12 22:48:34 +01:00
parent 19793e9126
commit 4760818118
50 changed files with 704 additions and 461 deletions

View File

@@ -19,20 +19,22 @@
extern void syscall_entry (void);
uintptr_t syscall_dispatch (void* stack_ptr) {
uint64_t fp, fc;
load_kernel_cr3 ();
struct saved_regs* regs = stack_ptr;
spin_lock (&thiscpu->lock);
spin_lock (&thiscpu->lock, &fc);
struct proc* caller = thiscpu->proc_current;
int caller_pid = caller->pid;
spin_lock (&caller->lock);
spin_lock (&caller->lock, &fp);
memcpy (&caller->pdata.regs, regs, sizeof (struct saved_regs));
fx_save (caller->pdata.fx_env);
spin_unlock (&caller->lock);
spin_unlock (&thiscpu->lock);
spin_unlock (&caller->lock, fp);
spin_unlock (&thiscpu->lock, fc);
int syscall_num = regs->rax;
syscall_handler_func_t func = syscall_find_handler (syscall_num);
@@ -50,9 +52,9 @@ uintptr_t syscall_dispatch (void* stack_ptr) {
caller = proc_find_pid (caller_pid);
if (caller != NULL) {
spin_lock (&caller->lock);
spin_lock (&caller->lock, &fp);
caller->pdata.regs.rax = r;
spin_unlock (&caller->lock);
spin_unlock (&caller->lock, fp);
}
bool do_thiscpu = false;