aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/gdt/gdt.c
diff options
context:
space:
mode:
authorMarvin Borner2019-11-24 23:34:32 +0100
committerMarvin Borner2019-11-24 23:34:32 +0100
commitbb57b124d1bb385d41747f50be7dd4f3625539c1 (patch)
treefe461afad63df40571784565e8d435cba8c8e59c /src/kernel/gdt/gdt.c
parentf9c50b9ff23e9a3e8db5826fef7a6e7ebb8af21d (diff)
Major coding style reformatting -> Kernighan & Ritchie
This project now (hopefully) uses the same style recommended by Kernighan and Ritchie and used in the Linux Kernel
Diffstat (limited to 'src/kernel/gdt/gdt.c')
-rw-r--r--src/kernel/gdt/gdt.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/kernel/gdt/gdt.c b/src/kernel/gdt/gdt.c
index 1c69602..70d5b7f 100644
--- a/src/kernel/gdt/gdt.c
+++ b/src/kernel/gdt/gdt.c
@@ -57,7 +57,8 @@ extern void gdt_flush();
extern void tss_flush();
-void gdt_set_gate(int32_t num, uint32_t base, uint32_t limit, uint8_t access, uint8_t gran) {
+void gdt_set_gate(int32_t num, uint32_t base, uint32_t limit, uint8_t access, uint8_t gran)
+{
// Set descriptor base address
gdt[num].base_low = (base & 0xFFFF);
gdt[num].base_middle = (base >> 16) & 0xFF;
@@ -72,7 +73,8 @@ void gdt_set_gate(int32_t num, uint32_t base, uint32_t limit, uint8_t access, ui
gdt[num].access = access;
}
-void gdt_install() {
+void gdt_install()
+{
// Set GDT pointer and limit
gp.limit = (sizeof(struct gdt_entry) * 6) - 1;
gp.base = &gdt;
@@ -99,10 +101,11 @@ void gdt_install() {
gdt_flush();
tss_flush();
- vga_log("Installed Global Descriptor Table", 2);
+ vga_log("Installed Global Descriptor Table", 1);
}
-void tss_write(int32_t num, uint16_t ss0, uint32_t esp0) {
+void tss_write(int32_t num, uint16_t ss0, uint32_t esp0)
+{
uint32_t base = (uint32_t) &tss_entry;
uint32_t limit = base + sizeof(tss_entry);
@@ -117,6 +120,7 @@ void tss_write(int32_t num, uint16_t ss0, uint32_t esp0) {
tss_entry.ss = tss_entry.ds = tss_entry.es = tss_entry.fs = tss_entry.gs = 0x13;
}
-void set_kernel_stack(uint32_t stack) {
+void set_kernel_stack(uint32_t stack)
+{
tss_entry.esp0 = stack;
}