diff options
| author | Michal Idziorek <m.i@gmx.at> | 2014-12-02 08:28:18 +0100 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2014-12-02 08:28:18 +0100 |
| commit | b4e8da9b6e43366eaa7198f349ce30421c1d7bf1 (patch) | |
| tree | a0378243e934002e9b4a74fc8321ba46da1dbf38 /kernel | |
| parent | de8c758de78cd7091f80b582cf706fc441f6ca72 (diff) | |
little cleanup
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/kernel.c | 27 | ||||
| -rw-r--r-- | kernel/mem.h | 10 | ||||
| -rw-r--r-- | kernel/smashing.c | 22 | ||||
| -rw-r--r-- | kernel/types.h | 3 |
4 files changed, 31 insertions, 31 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c index 641c442..8adbf37 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -5,9 +5,8 @@ #endif #include <stdint.h> - #include "config.h" - +#include "types.h" #include "lib/logger/log.h" #include "timer.h" @@ -15,9 +14,6 @@ #include "vmem.h" #include "interrupts.h" -#include "syscalls.h" // for syscall_execve - - #include "console.h" @@ -26,25 +22,6 @@ #include "task.h" -// CODE FOR Stack Smashing Protector, TODO: MOVE / and do not duplicate -// with sys.c -// http://wiki.osdev.org/Stack_Smashing_Protector - -#if UINT32_MAX == UINTPTR_MAX -#define STACK_CHK_GUARD 0xe2dee396 -#else -#define STACK_CHK_GUARD 0x595e9fbd94fda766 -#endif - -uintptr_t __stack_chk_guard = STACK_CHK_GUARD; - -__attribute__((noreturn)) -void __stack_chk_fail(void) -{ - panic(FOOLOS_MODULE_NAME,"Stack smashing detected"); -} -// - // mp informs us if this if this is the main processor void kernel_main(uint32_t initial_stack, int mp) { @@ -63,7 +40,7 @@ void kernel_main(uint32_t initial_stack, int mp) // we know that here, the bootloader placed the memory map and // the number of entries. // - mem_init(0xa001,*((uint16_t *)(0xa000))); + mem_init((physical_address)0xa001,(int)(*((uint16_t *)(0xa000)))); // // Activate Virtual Memory (paging) diff --git a/kernel/mem.h b/kernel/mem.h index efc3ebe..521bc4a 100644 --- a/kernel/mem.h +++ b/kernel/mem.h @@ -1,6 +1,4 @@ - -#include <stdint.h> -void* pmmngr_alloc_block (); -//void* pmmngr_alloc_blocks (uint32_t size); -void pmmngr_free_block (void* p); -void mem_init(uint16_t *memmap,uint16_t entries); +#include "types.h" +physical_address* pmmngr_alloc_block (); +void pmmngr_free_block (physical_address* p); +void mem_init(physical_address *memmap,int entries); diff --git a/kernel/smashing.c b/kernel/smashing.c new file mode 100644 index 0000000..a96030c --- /dev/null +++ b/kernel/smashing.c @@ -0,0 +1,22 @@ +#include <stdint.h> +#include "lib/logger/log.h" +// CODE FOR Stack Smashing Protector. +// Do not duplicate with userspace / sys.c +// http://wiki.osdev.org/Stack_Smashing_Protector + +#if UINT32_MAX == UINTPTR_MAX +#define STACK_CHK_GUARD 0xe2dee396 +#else +#define STACK_CHK_GUARD 0x595e9fbd94fda766 +#endif + +#define FOOLOS_MODULE_NAME "ssp" + +uintptr_t __stack_chk_guard = STACK_CHK_GUARD; + +__attribute__((noreturn)) +void __stack_chk_fail(void) +{ + panic(FOOLOS_MODULE_NAME,"Stack smashing detected"); +} +// diff --git a/kernel/types.h b/kernel/types.h new file mode 100644 index 0000000..30abb43 --- /dev/null +++ b/kernel/types.h @@ -0,0 +1,3 @@ +#include <stdint.h> + +typedef uint32_t physical_address; |
