summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/arch/x86_64/idt.h1
-rw-r--r--include/arch/x86_64/object.h1
-rw-r--r--include/arch/x86_64/page.h1
-rw-r--r--include/arch/x86_64/processor.h27
-rw-r--r--include/arch/x86_64/tables.h48
-rw-r--r--include/syscall.h4
6 files changed, 53 insertions, 29 deletions
diff --git a/include/arch/x86_64/idt.h b/include/arch/x86_64/idt.h
index 90ce48b..ca1c484 100644
--- a/include/arch/x86_64/idt.h
+++ b/include/arch/x86_64/idt.h
@@ -8,6 +8,7 @@ typedef struct jove_IVTState
uint64_t r15, r14, r13, r12, r11, r10, r9, r8;
uint64_t rbp, rdi, rsi, rdx, rcx, rbx, rax;
uint64_t rip, cs, rflags, rsp, ss;
+ uint64_t num, err;
} ivt_state_t;
void kpanic_state(ivt_state_t *state, const char *fmt, ...);
diff --git a/include/arch/x86_64/object.h b/include/arch/x86_64/object.h
index 770487b..e13a987 100644
--- a/include/arch/x86_64/object.h
+++ b/include/arch/x86_64/object.h
@@ -12,6 +12,7 @@ typedef struct jove_ThreadControlBlock
void *stack;
uintptr_t sp, ksp;
void *pml4;
+ void *mailbox;
uint8_t kstack[KERNEL_STACKBYTES];
} tcb_t;
diff --git a/include/arch/x86_64/page.h b/include/arch/x86_64/page.h
index 4460720..e62b8d6 100644
--- a/include/arch/x86_64/page.h
+++ b/include/arch/x86_64/page.h
@@ -38,6 +38,7 @@ typedef uint16_t pmli_t;
uintptr_t vmem_ident_tophys(void *vptr);
void *vmem_phys_tovirt(uintptr_t pptr);
+uintptr_t vmem_tophys_koff(uintptr_t v);
void *pmle_get_page(pmle_t entry);
uint8_t pmle_level(pmle_t entry);
diff --git a/include/arch/x86_64/processor.h b/include/arch/x86_64/processor.h
index f8a93ce..1afa6cc 100644
--- a/include/arch/x86_64/processor.h
+++ b/include/arch/x86_64/processor.h
@@ -18,13 +18,22 @@
typedef struct jove_TSS
{
uint32_t resv0;
- uint64_t rsp[3];
- uint32_t resv1;
- uint64_t ist[8];
- uint32_t resv2[2];
- uint16_t resv3;
+ uint64_t rsp0;
+ uint64_t rsp1;
+ uint64_t rsp2;
+ uint64_t resv1;
+ uint64_t resv2;
+ uint64_t ist1;
+ uint64_t ist2;
+ uint64_t ist3;
+ uint64_t ist4;
+ uint64_t ist5;
+ uint64_t ist6;
+ uint64_t ist7;
+ uint64_t resv3;
+ uint16_t resv4;
uint16_t iopb;
-} tss_t;
+} __attribute__((packed)) tss_t;
enum
{
@@ -39,6 +48,12 @@ enum
GDT_ENTRY_COUNT
};
+#define GDT_OFFSET_KERNEL_CODE (GDT_ENTRY_KERNEL_CODE * sizeof(segment_descriptor_t))
+#define GDT_OFFSET_KERNEL_DATA (GDT_ENTRY_KERNEL_DATA * sizeof(segment_descriptor_t))
+#define GDT_OFFSET_USER_DATA (GDT_ENTRY_USER_DATA * sizeof(segment_descriptor_t))
+#define GDT_OFFSET_USER_CODE (GDT_ENTRY_USER_CODE * sizeof(segment_descriptor_t))
+#define GDT_OFFSET_TSS (GDT_ENTRY_TSS_LOW * sizeof(segment_descriptor_t))
+
typedef struct jove_Processor
{
physptr_t pdir;
diff --git a/include/arch/x86_64/tables.h b/include/arch/x86_64/tables.h
index 42651a1..b35dd43 100644
--- a/include/arch/x86_64/tables.h
+++ b/include/arch/x86_64/tables.h
@@ -9,40 +9,44 @@
#define CD_SEGMENT_TYPE_CODE_CONFORMING 4
#define CD_SEGMENT_TYPE_CODE 8
-#define S_SEGMENT_TYPE_LDT 2
-#define S_SEGMENT_TYPE_TSS_AVAIL 9
-#define S_SEGMENT_TYPE_TSS_BUSY 11
-#define S_SEGMENT_TYPE_CALLGATE 12
-#define S_SEGMENT_TYPE_INT_GATE 14
-#define S_SEGMENT_TYPE_TRAP_GATE 15
+#define GDT_SEGMENT_TYPE_LDT 2
+#define GDT_SEGMENT_TYPE_TSS_AVAIL 0b1001
+#define GDT_SEGMENT_TYPE_TSS_BUSY 11
+
+#define GDT_SEGMENT_FLAG_S (1 << 4)
+#define GDT_SEGMENT_FLAG_DPL(l) (l << 5)
+#define GDT_SEGMENT_FLAG_P (1 << 7)
+
+#define GDT_SEGMENT_AVLX_AVL (1 << 4)
+#define GDT_SEGMENT_AVLX_L (1 << 5)
+#define GDT_SEGMENT_AVLX_DB (1 << 6)
+#define GDT_SEGMENT_AVLX_G (1 << 7)
typedef struct jove_SegmentDescriptor
{
uint16_t limit_0_15; /* Segment limit. */
uint16_t base_0_15; /* Segment base. */
uint8_t base_16_23;
- uint8_t type : 4; /* Segment type. */
- uint8_t s : 1; /* Descriptor type (0 = system, 1 = code/data)*/
- uint8_t dpl : 2; /* Descriptor privilege level. */
- uint8_t p : 1; /* Present. */
- uint8_t limit_16_19 : 4;
- uint8_t avl : 1; /* Available for use by system software. */
- uint8_t l : 1; /* 64-bit segment (Ext). */
- uint8_t d_b : 1; /* Default operation size (0 = 16-bit, 1 = 32-bit)*/
- uint8_t g : 1; /* Granularity. */
+ uint8_t type_flags;
+ uint8_t limit_16_19_avlx;
uint8_t base_24_31;
}__attribute__((packed)) segment_descriptor_t;
+#define IDT_IST(v) (v & 7)
+
+#define IDT_TYPE_CALLGATE 12
+#define IDT_TYPE_INT_GATE 0b1110
+#define IDT_TYPE_TRAP_GATE 0b1111
+
+#define IDT_FLAG_DPL(l) (l << 5)
+#define IDT_FLAG_P (1 << 7)
+
typedef struct jove_InterruptGate
{
uint16_t base_0_15;
- uint16_t segment_selector;
- uint8_t ist : 3;
- uint8_t zero_0 : 5;
- uint8_t type : 4;
- uint8_t zero_1 : 1;
- uint8_t dpl : 2;
- uint8_t p : 1;
+ uint16_t cs;
+ uint8_t ist;
+ uint8_t type_flags;
uint16_t base_16_31;
uint32_t base_32_63;
uint32_t resv;
diff --git a/include/syscall.h b/include/syscall.h
index 9025f57..7410acc 100644
--- a/include/syscall.h
+++ b/include/syscall.h
@@ -24,7 +24,9 @@ enum
/*[target path][u8 funcid][u8 memb][u16 ret]*/
INVOKE_OBJDIR_GETMEMB,
/*[target path][u8 funcid][u8 ret]*/
- INVOKE_OBJDIR_LASTMEMB
+ INVOKE_OBJDIR_LASTMEMB,
+ /*[target path][u8 funcid][u8 memb][dest path]*/
+ INVOKE_OBJDIR_MOVE
};
/**@ENUM untyped invokes*/
enum