From 4c00208b3a50be0bc6dd240e59d6d891ef18d8b3 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 23 Feb 2024 17:37:10 -0500 Subject: kernel/amd64: frame: Add macro to init trapframe Signed-off-by: Ian Moffett --- sys/include/arch/amd64/frame.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/include/arch/amd64/frame.h b/sys/include/arch/amd64/frame.h index aaee45c..78c32f4 100644 --- a/sys/include/arch/amd64/frame.h +++ b/sys/include/arch/amd64/frame.h @@ -56,5 +56,13 @@ struct trapframe { uint64_t rsp; uint64_t ss; }; + +#define init_frame(FRAME, IP, SP) \ + (FRAME)->rip = IP; \ + (FRAME)->cs = 0x08; \ + (FRAME)->rflags = 0x202; \ + (FRAME)->rsp = SP; \ + (FRAME)->ss = 0x10; \ + #endif /* !defined(__ASSEMBLER__) */ #endif /* !_AMD64_FRAME_H_ */ -- cgit v1.2.3