From: Matthias Kruk Date: Mon, 16 Sep 2019 04:45:10 +0000 (+0900) Subject: Fix curly brackets X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=4c25d18730fd709ac6bb2e7720ebe86c0e955615;p=corax Fix curly brackets --- diff --git a/kernel/arch/cpu.c b/kernel/arch/cpu.c index 7164830..86fe61c 100644 --- a/kernel/arch/cpu.c +++ b/kernel/arch/cpu.c @@ -26,14 +26,16 @@ struct cpu _cpu[CONFIG_SMP_CPUS]; #if defined(CONFIG_SMP) && CONFIG_SMP_CPUS > 1 -int cpu_get_id(void) { +int cpu_get_id(void) +{ /* FIXME: implement this properly */ return(0); } #endif /* CONFIG_SMP */ -void _segment_descriptor_set(segment_descriptor_t *sd, u32_t type, u32_t base, u32_t limit, u32_t dpl) { +void _segment_descriptor_set(segment_descriptor_t *sd, u32_t type, u32_t base, u32_t limit, u32_t dpl) +{ sd->sd_high = type; switch(type) { case SD_TYPE_CODE: @@ -60,7 +62,8 @@ void _segment_descriptor_set(segment_descriptor_t *sd, u32_t type, u32_t base, u return; } -void cpu_debug(void) { +void cpu_debug(void) +{ u32_t i; for(i = 0; i < 256; i++) { diff --git a/kernel/arch/debug.c b/kernel/arch/debug.c index 0467265..3793a3c 100644 --- a/kernel/arch/debug.c +++ b/kernel/arch/debug.c @@ -61,7 +61,8 @@ static i32_t vga_offset = VGA_BUFFER_SIZE; #define VGA_SET_FONT(c) vga_attrs = (vga_attrs & 0xf0ff) | VGA_FONT(c) #define VGA_SET_BACKGROUND(c) vga_attrs = (vga_attrs & 0x0fff) | VGA_BACKGROUND(c) -i64_t _i64div(i64_t dividend, i64_t divisor) { +i64_t _i64div(i64_t dividend, i64_t divisor) +{ i64_t quotient; int sign; @@ -90,7 +91,8 @@ i64_t _i64div(i64_t dividend, i64_t divisor) { return(sign > 0 ? quotient : -quotient); } -i64_t _i64mod(i64_t dividend, i64_t divisor) { +i64_t _i64mod(i64_t dividend, i64_t divisor) +{ if(divisor == 0) { PANIC("Can't divide by zero"); } @@ -110,7 +112,8 @@ i64_t _i64mod(i64_t dividend, i64_t divisor) { return(dividend); } -u64_t _u64div(u64_t dividend, u64_t divisor) { +u64_t _u64div(u64_t dividend, u64_t divisor) +{ u64_t quotient = 0; if(divisor == 0) { @@ -124,7 +127,8 @@ u64_t _u64div(u64_t dividend, u64_t divisor) { return(quotient); } -u64_t _u64mod(u64_t dividend, u64_t divisor) { +u64_t _u64mod(u64_t dividend, u64_t divisor) +{ if(divisor == 0) { PANIC("Can't divide by zero"); } @@ -136,7 +140,8 @@ u64_t _u64mod(u64_t dividend, u64_t divisor) { return(dividend); } -void* memset(void *dst, int val, u32_t n) { +void* memset(void *dst, int val, u32_t n) +{ char *ptr; ptr = dst; @@ -146,7 +151,8 @@ void* memset(void *dst, int val, u32_t n) { return(dst); } -void* memcpy(void *dst, const void *src, u32_t n) { +void* memcpy(void *dst, const void *src, u32_t n) +{ char *d; const char *s; @@ -158,7 +164,8 @@ void* memcpy(void *dst, const void *src, u32_t n) { return(dst); } -static void _putchar(int c) { +static void _putchar(int c) +{ if(c == '\n') { vga_offset += VGA_BUFFER_COLS - (vga_offset % VGA_BUFFER_COLS); } else { @@ -174,7 +181,8 @@ static void _putchar(int c) { return; } -int dbg_printf(const char *format, ...) { +int dbg_printf(const char *format, ...) +{ int n; char c; char size; @@ -461,7 +469,8 @@ int dbg_printf(const char *format, ...) { return(n); } -void dbg_panic(const char *func, const char *file, i32_t line, const char *msg) { +void dbg_panic(const char *func, const char *file, i32_t line, const char *msg) +{ /* vga_attrs = 0x0400; *//* VGA_FONT(VGA_RED) | VGA_BACKGROUND(VGA_BLACK); */ VGA_SET_FONT(VGA_RED); diff --git a/kernel/arch/interrupt.c b/kernel/arch/interrupt.c index 3eee8ef..e1ae81c 100644 --- a/kernel/arch/interrupt.c +++ b/kernel/arch/interrupt.c @@ -110,7 +110,8 @@ int _exc_handle(stack_frame_t ctx) return(0); } -int _sys_handle(stack_frame_t ctx) { +int _sys_handle(stack_frame_t ctx) +{ switch(ctx.intn) { case SYS_VECTOR_CORAX: dbg_printf("_corax_call(0x%x, 0x%x, 0x%x);\n", ctx.eax, ctx.ebx, ctx.ecx); diff --git a/kernel/arch/paging.c b/kernel/arch/paging.c index 09ed515..66a02d3 100644 --- a/kernel/arch/paging.c +++ b/kernel/arch/paging.c @@ -41,7 +41,8 @@ static const char *_str_pg_mode[] = { "Intel64 mode" }; -void* pg_dir_create(void) { +void* pg_dir_create(void) +{ void *dir; dir = NULL; @@ -55,7 +56,8 @@ void* pg_dir_create(void) { return(dir); } -static void* _phys_alloc(u32_t size, u32_t align) { +static void* _phys_alloc(u32_t size, u32_t align) +{ extern u32_t _mem_start; void *addr; @@ -76,7 +78,8 @@ static void* _phys_alloc(u32_t size, u32_t align) { return(addr); } -void* pg_init(struct multiboot_info *info) { +void* pg_init(struct multiboot_info *info) +{ struct memory_map *mmap; u64_t mem_size; u64_t map_end; diff --git a/kernel/core/main.c b/kernel/core/main.c index a105ffe..09f8cef 100644 --- a/kernel/core/main.c +++ b/kernel/core/main.c @@ -74,7 +74,8 @@ void _print_mptbl(void *tbl) return; } -int corax(void *mb_info, u32_t magic) { +int corax(void *mb_info, u32_t magic) +{ dbg_printf("Corax 0.1 - As the Crow flies\n"); dbg_printf("(C) 2019 Matthias Kruk \n"); dbg_printf("Compiled on %s at %s\n", __DATE__, __TIME__);