From bb57b124d1bb385d41747f50be7dd4f3625539c1 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sun, 24 Nov 2019 23:34:32 +0100 Subject: 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 --- src/kernel/gdt/gdt.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/kernel/gdt/gdt.c') 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; } -- cgit v1.2.3