summaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-10-15 22:07:13 -0400
committerIan Moffett <ian@osmora.org>2025-10-15 22:07:13 -0400
commit71518294bb57d3d9c8252704b21a549d58bd8f46 (patch)
treee6775041634032848bed51e9f37b37de04877e39 /src/sys
parent750a12a404e472b9c2bffb0404dc153fa1a23a91 (diff)
kern/amd64: trap: Copy trapframe on syscall entryHEADmasterdev
Ensure that the trapframe in the PCB is the latest, upon kernel entry we copy it so it isn't stale. Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/arch/amd64/cpu/trap.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/sys/arch/amd64/cpu/trap.c b/src/sys/arch/amd64/cpu/trap.c
index 921a036..ae3a0cc 100644
--- a/src/sys/arch/amd64/cpu/trap.c
+++ b/src/sys/arch/amd64/cpu/trap.c
@@ -39,6 +39,7 @@
#include <sys/syslog.h>
#include <sys/syscall.h>
#include <machine/trap.h>
+#include <string.h>
/*
* Trap type to type string conversion table
@@ -154,6 +155,7 @@ trap_syscall(struct trapframe *tf)
struct syscall_domain *scdp;
struct syscall_win *scwp;
struct proc *self;
+ struct md_pcb *pcbp;
struct syscall_args scargs = {
.arg[0] = tf->rdi,
.arg[1] = tf->rsi,
@@ -179,6 +181,9 @@ trap_syscall(struct trapframe *tf)
return;
}
+ pcbp = &self->pcb;
+ memcpy(&pcbp->tf, tf, sizeof(pcbp->tf));
+
if (tf->rax < scwp->nimpl && tf->rax > 0) {
tf->rax = scwp->sctab[tf->rax](&scargs);
}