aboutsummaryrefslogtreecommitdiff
path: root/sys/include/arch/amd64
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-02-23 17:37:10 -0500
committerIan Moffett <ian@osmora.org>2024-02-23 17:37:10 -0500
commit4c00208b3a50be0bc6dd240e59d6d891ef18d8b3 (patch)
tree53b255201d0ac3392669bc8d8cc583665f2936dc /sys/include/arch/amd64
parent3338174636e9bfda1a27af218d3581e831b4ca23 (diff)
kernel/amd64: frame: Add macro to init trapframe
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/include/arch/amd64')
-rw-r--r--sys/include/arch/amd64/frame.h8
1 files changed, 8 insertions, 0 deletions
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_ */