From 3a8ed19bf83f11ff00c4904fab2cc083b7e33478 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Wed, 5 Jan 2022 14:01:29 -0800 Subject: Cleaned up/ Standardized --- src/sys/core.c | 1 + src/sys/core.h | 11 +++++++++++ src/sys/kernel.S | 6 ++++-- src/sys/kernel.h | 8 ++++++++ src/sys/timer.c | 2 -- 5 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 src/sys/kernel.h (limited to 'src/sys') diff --git a/src/sys/core.c b/src/sys/core.c index 37cd6a5..97a77c0 100644 --- a/src/sys/core.c +++ b/src/sys/core.c @@ -13,6 +13,7 @@ #include "../util/status.h" #include "../util/time.h" +#define SYS_CORE_C #ifndef VERSION char* os_info_v = "?"; #else diff --git a/src/sys/core.h b/src/sys/core.h index fa9e1b5..9e25f9d 100644 --- a/src/sys/core.h +++ b/src/sys/core.h @@ -1,6 +1,10 @@ #ifndef SYS_CORE_H #define SYS_CORE_H +#ifndef SYS_CORE_C +extern char* os_info_v; +#endif + extern unsigned long cntfrq; static inline unsigned long load32(unsigned long addr) @@ -41,6 +45,13 @@ static inline void setsp(void* in) asm volatile ("mov sp, %0" :: "r"(in)); } +static inline void* heap_end(void) +{ + unsigned long value; + asm volatile ("ldr %0, =__bss_end": "=r"(value)); + return (void*)value; +} + enum { // The offset for the MMIO area diff --git a/src/sys/kernel.S b/src/sys/kernel.S index a691ebf..e0333ca 100644 --- a/src/sys/kernel.S +++ b/src/sys/kernel.S @@ -2,12 +2,10 @@ .globl kernel_main kernel_main: - push {lr} bl sysinit kernel_main.loop: wfe b kernel_main.loop - pop {lr} .section ".data" .globl cntfrq @@ -19,3 +17,7 @@ cmdidx: .globl cmd cmd: .space 2049 + +.section ".bss.heap" +mheap: + .space 0x100000 diff --git a/src/sys/kernel.h b/src/sys/kernel.h new file mode 100644 index 0000000..e724513 --- /dev/null +++ b/src/sys/kernel.h @@ -0,0 +1,8 @@ +#ifndef SYS_KERNEL_H +#define SYS_KERNEL_H + +extern unsigned long cntfrq; +extern unsigned long cmdidx; +extern char cmd[2048]; + +#endif diff --git a/src/sys/timer.c b/src/sys/timer.c index 9419f80..3753561 100644 --- a/src/sys/timer.c +++ b/src/sys/timer.c @@ -9,8 +9,6 @@ /// Cycles Per Second #define CPS 10 -extern char* os_info_v; - #define SYS_TIMER_C static unsigned long exe_cnt = 0; struct Mutex exe_cnt_m = {.addr = &exe_cnt, .pid = NULL_PID}; -- cgit v1.2.1