proc: add current_pt_regs

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-07-21 20:21:44 -04:00
commit 3ca26e6068
2 changed files with 6 additions and 0 deletions

View file

@ -38,5 +38,6 @@ struct cpu_local *tls_get();
struct proc *get_cur_proc();
struct thread *get_cur_thread();
void enter_userspace_init(struct thread *thread, uaddr_t entry);
struct pt_regs *current_pt_regs();
#endif /* _ARCH_PROC_H_ */

View file

@ -2,6 +2,11 @@
#include <kernel/syscall.h>
#include <arch/proc.h>
struct pt_regs *current_pt_regs()
{
return (struct pt_regs *)(tls_get()->kernel_rsp - sizeof(struct pt_regs));
}
static inline i64 _do_syscall(struct pt_regs *regs)
{
syscall_t c = get_syscall(regs->rax);