summaryrefslogtreecommitdiff
path: root/sys/inc
diff options
context:
space:
mode:
Diffstat (limited to 'sys/inc')
-rw-r--r--sys/inc/arch/amd64/gdt.h17
-rw-r--r--sys/inc/mu/cpu.h7
2 files changed, 23 insertions, 1 deletions
diff --git a/sys/inc/arch/amd64/gdt.h b/sys/inc/arch/amd64/gdt.h
index dacfbda..291ab3c 100644
--- a/sys/inc/arch/amd64/gdt.h
+++ b/sys/inc/arch/amd64/gdt.h
@@ -30,9 +30,26 @@
#ifndef _MACHINE_GDT_H_
#define _MACHINE_GDT_H_
+#include <sys/types.h>
+#include <sys/cdefs.h>
+
#define GDT_KERNCODE 0x08
#define GDT_KERNDATA 0x10
#define GDT_USERCODE 0x18
#define GDT_USERDATA 0x20
+struct __packed gdt_entry {
+ uint16_t limit;
+ uint16_t base_low;
+ uint8_t base_mid;
+ uint8_t access;
+ uint8_t granularity;
+ uint8_t base_hi;
+};
+
+struct __packed gdtr {
+ uint16_t limit;
+ uintptr_t offset;
+};
+
#endif /* !_MACHINE_GDT_H_ */
diff --git a/sys/inc/mu/cpu.h b/sys/inc/mu/cpu.h
index 288ba9e..524e42a 100644
--- a/sys/inc/mu/cpu.h
+++ b/sys/inc/mu/cpu.h
@@ -33,7 +33,8 @@
#include <sys/queue.h>
#include <sys/types.h>
#include <os/process.h>
-#include <md/mcb.h>
+#include <md/mcb.h> /* shared */
+#include <md/gdt.h> /* shared */
/*
* Processor descriptor
@@ -41,12 +42,16 @@
* @id: Logical ID of the processor
* @mcb: Machine core block
* @curproc: Current process
+ * @ap_gdt: GDT for APs [unused for BSP]
+ * @ap_gdtr: GDTR for APs [unused for BSP]
* @pqueue: Process queue
*/
struct cpu_info {
uint8_t id;
struct mcb mcb;
struct process *curproc;
+ struct gdt_entry ap_gdt[256];
+ struct gdtr ap_gdtr;
TAILQ_HEAD(, process) pqueue;
};