aboutsummaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/core.c1
-rw-r--r--src/sys/core.h11
-rw-r--r--src/sys/kernel.S6
-rw-r--r--src/sys/kernel.h8
-rw-r--r--src/sys/timer.c2
5 files changed, 24 insertions, 4 deletions
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};