summaryrefslogtreecommitdiff
path: root/kernel/include
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-04-04 12:00:48 -0400
committerFreya Murphy <freya@freyacat.org>2025-04-04 12:00:48 -0400
commitceef8e2d87ec60042827e6d6aaf73b6df774051c (patch)
tree16721f404e8aeeba05d8769ceabab8334ed4d176 /kernel/include
parentswitch to c11 (diff)
downloadcomus-ceef8e2d87ec60042827e6d6aaf73b6df774051c.tar.gz
comus-ceef8e2d87ec60042827e6d6aaf73b6df774051c.tar.bz2
comus-ceef8e2d87ec60042827e6d6aaf73b6df774051c.zip
fmt
Diffstat (limited to '')
-rw-r--r--kernel/include/comus/cpu.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/kernel/include/comus/cpu.h b/kernel/include/comus/cpu.h
index 58fb33d..a976695 100644
--- a/kernel/include/comus/cpu.h
+++ b/kernel/include/comus/cpu.h
@@ -9,6 +9,65 @@
#ifndef _CPU_H
#define _CPU_H
+#include <stdint.h>
+
+typedef union {
+ uint64_t raw;
+ struct {
+ uint64_t cf : 1;
+ uint64_t : 1;
+ uint64_t pf : 1;
+ uint64_t : 1;
+ uint64_t af : 1;
+ uint64_t : 1;
+ uint64_t zf : 1;
+ uint64_t sf : 1;
+ uint64_t tf : 1;
+ uint64_t if_ : 1;
+ uint64_t df : 1;
+ uint64_t of : 1;
+ uint64_t iopl : 2;
+ uint64_t nt : 1;
+ uint64_t md : 1;
+ uint64_t rf : 1;
+ uint64_t vm : 1;
+ uint64_t ac : 1;
+ uint64_t vif : 1;
+ uint64_t vip : 1;
+ uint64_t id : 1;
+ uint64_t : 42;
+ };
+} rflags_t;
+
+typedef struct {
+ // registers
+ uint64_t r15;
+ uint64_t r14;
+ uint64_t r13;
+ uint64_t r12;
+ uint64_t r11;
+ uint64_t r10;
+ uint64_t r9;
+ uint64_t r8;
+ uint64_t rbp;
+ uint64_t rdi;
+ uint64_t rsi;
+ uint64_t rdx;
+ uint64_t rcx;
+ uint64_t rbx;
+ uint64_t rax;
+ // instruction pointer
+ uint64_t rip;
+ // code segment
+ uint64_t cs;
+ // rflags
+ rflags_t rflags;
+ // stack pointer
+ uint64_t rsp;
+ // stack segment
+ uint64_t ss;
+} regs_t;
+
/**
* Initalize current cpu
*/