aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/syscall
diff options
context:
space:
mode:
authorMarvin Borner2020-03-18 17:32:50 +0100
committerMarvin Borner2020-03-18 17:32:50 +0100
commitf495cc1e93710c233292a503720ec235a61b685c (patch)
tree23b0b4b82b6d80001c1ffdb15f00b93cbdc65722 /src/kernel/syscall
parentc6657aac0c5d5ecf347bc082cb6df38e1174d297 (diff)
Applied official linux kernel code style guidelines
Due to my change to vim and the clang-format plugin this was needed!
Diffstat (limited to 'src/kernel/syscall')
-rw-r--r--src/kernel/syscall/actions/sys_alloc.c2
-rw-r--r--src/kernel/syscall/actions/sys_free.c4
-rw-r--r--src/kernel/syscall/actions/sys_get_pointers.c13
-rw-r--r--src/kernel/syscall/actions/sys_read.c16
-rw-r--r--src/kernel/syscall/actions/sys_write.c8
-rw-r--r--src/kernel/syscall/syscall.c38
6 files changed, 40 insertions, 41 deletions
diff --git a/src/kernel/syscall/actions/sys_alloc.c b/src/kernel/syscall/actions/sys_alloc.c
index 24abe4d..65269de 100644
--- a/src/kernel/syscall/actions/sys_alloc.c
+++ b/src/kernel/syscall/actions/sys_alloc.c
@@ -2,5 +2,5 @@
uint32_t sys_alloc(uint32_t count)
{
- return 0; // (uint32_t) umalloc(count);
+ return 0; // (uint32_t) umalloc(count);
} \ No newline at end of file
diff --git a/src/kernel/syscall/actions/sys_free.c b/src/kernel/syscall/actions/sys_free.c
index f1a0371..cbd4c70 100644
--- a/src/kernel/syscall/actions/sys_free.c
+++ b/src/kernel/syscall/actions/sys_free.c
@@ -3,6 +3,6 @@
uint32_t sys_free(uint32_t ptr)
{
- kfree((void *) ptr);
- return 0;
+ kfree((void *)ptr);
+ return 0;
} \ No newline at end of file
diff --git a/src/kernel/syscall/actions/sys_get_pointers.c b/src/kernel/syscall/actions/sys_get_pointers.c
index cd824db..181630b 100644
--- a/src/kernel/syscall/actions/sys_get_pointers.c
+++ b/src/kernel/syscall/actions/sys_get_pointers.c
@@ -4,14 +4,15 @@
#include <kernel/memory/alloc.h>
struct userspace_pointers {
- unsigned char *fb;
- struct font *font;
+ unsigned char *fb;
+ struct font *font;
};
uint32_t sys_get_pointers()
{
- struct userspace_pointers *pointers = (struct userspace_pointers *) kmalloc(sizeof(struct userspace_pointers));
- pointers->fb = fb;
- pointers->font = font;
- return (uint32_t) pointers;
+ struct userspace_pointers *pointers =
+ (struct userspace_pointers *)kmalloc(sizeof(struct userspace_pointers));
+ pointers->fb = fb;
+ pointers->font = font;
+ return (uint32_t)pointers;
} \ No newline at end of file
diff --git a/src/kernel/syscall/actions/sys_read.c b/src/kernel/syscall/actions/sys_read.c
index ed2cca8..24d83d1 100644
--- a/src/kernel/syscall/actions/sys_read.c
+++ b/src/kernel/syscall/actions/sys_read.c
@@ -6,16 +6,16 @@
uint32_t sys_read(char *buf)
{
- keyboard_clear_buffer();
- keyboard_char_buffer = 0;
- while (keyboard_char_buffer != '\n') {
- getch();
- }
- memcpy(buf, keyboard_buffer, strlen(keyboard_buffer));
- return strlen(buf);
+ keyboard_clear_buffer();
+ keyboard_char_buffer = 0;
+ while (keyboard_char_buffer != '\n') {
+ getch();
+ }
+ memcpy(buf, keyboard_buffer, strlen(keyboard_buffer));
+ return strlen(buf);
}
uint32_t sys_readc()
{
- return (uint32_t) getch();
+ return (uint32_t)getch();
} \ No newline at end of file
diff --git a/src/kernel/syscall/actions/sys_write.c b/src/kernel/syscall/actions/sys_write.c
index f747be8..f15004f 100644
--- a/src/kernel/syscall/actions/sys_write.c
+++ b/src/kernel/syscall/actions/sys_write.c
@@ -4,12 +4,12 @@
uint32_t sys_write(char *buf)
{
- printf(buf);
- return strlen((const char *) buf);
+ printf(buf);
+ return strlen((const char *)buf);
}
uint32_t sys_writec(char ch)
{
- writec(ch);
- return 0;
+ writec(ch);
+ return 0;
} \ No newline at end of file
diff --git a/src/kernel/syscall/syscall.c b/src/kernel/syscall/syscall.c
index bb3a01e..d8bc4b8 100644
--- a/src/kernel/syscall/syscall.c
+++ b/src/kernel/syscall/syscall.c
@@ -6,35 +6,33 @@
typedef uint32_t (*syscall_func)(unsigned int, ...);
-uint32_t (*syscalls[])() = {
- [0] = (uint32_t (*)()) halt_loop, // DEBUG!
- [1] = sys_write,
- [2] = sys_read,
- [3] = (uint32_t (*)()) sys_writec,
- [4] = sys_readc,
- [5] = sys_get_pointers,
- [6] = sys_alloc,
- [7] = sys_free
-};
+uint32_t (*syscalls[])() = { [0] = (uint32_t(*)())halt_loop, // DEBUG!
+ [1] = sys_write,
+ [2] = sys_read,
+ [3] = (uint32_t(*)())sys_writec,
+ [4] = sys_readc,
+ [5] = sys_get_pointers,
+ [6] = sys_alloc,
+ [7] = sys_free };
void syscall_handler(struct regs *r)
{
- serial_printf("Received syscall!");
+ serial_printf("Received syscall!");
- if (r->eax >= sizeof(syscalls) / sizeof(*syscalls))
- return;
+ if (r->eax >= sizeof(syscalls) / sizeof(*syscalls))
+ return;
- syscall_func location = (syscall_func) syscalls[r->eax];
- if (!location)
- return;
+ syscall_func location = (syscall_func)syscalls[r->eax];
+ if (!location)
+ return;
- serial_printf("[SYSCALL] %d (0x%x) 0x%x 0x%x 0x%x 0x%x 0x%x", r->eax, location, r->ebx, r->ecx, r->edx, r->esi,
- r->edi);
+ serial_printf("[SYSCALL] %d (0x%x) 0x%x 0x%x 0x%x 0x%x 0x%x", r->eax, location, r->ebx,
+ r->ecx, r->edx, r->esi, r->edi);
- r->eax = location(r->ebx, r->ecx, r->edx, r->esi, r->edi);
+ r->eax = location(r->ebx, r->ecx, r->edx, r->esi, r->edi);
}
void syscalls_install()
{
- isr_install_handler(0x80, syscall_handler);
+ isr_install_handler(0x80, syscall_handler);
} \ No newline at end of file