aboutsummaryrefslogtreecommitdiff
path: root/include/arch
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2020-11-24 15:59:23 -0700
committerJosh Rahm <joshuarahm@gmail.com>2020-11-24 15:59:23 -0700
commit0c0f5c3d8397ba5168f0cd01b25ba70c238b36e0 (patch)
treed986372cf7266cd1e090b7974e744c77c1871bdc /include/arch
parentecbcb2509f4b811bce0a56e07de9737d14815251 (diff)
downloadstm32l4-0c0f5c3d8397ba5168f0cd01b25ba70c238b36e0.tar.gz
stm32l4-0c0f5c3d8397ba5168f0cd01b25ba70c238b36e0.tar.bz2
stm32l4-0c0f5c3d8397ba5168f0cd01b25ba70c238b36e0.zip
Fix kalloc. Now the HEAP START and HEAP END globals are defined by the linker script.
Diffstat (limited to 'include/arch')
-rw-r--r--include/arch/arm/arch.h3
-rw-r--r--include/arch/x86_64/arch.h7
2 files changed, 7 insertions, 3 deletions
diff --git a/include/arch/arm/arch.h b/include/arch/arm/arch.h
index 22d0987..8bd47c2 100644
--- a/include/arch/arm/arch.h
+++ b/include/arch/arm/arch.h
@@ -40,4 +40,7 @@ _Static_assert(sizeof(void*) == sizeof(uint32_t), "Pointers must be 32 bits");
extern uint32_t DATA_SEGMENT_START;
extern uint32_t DATA_SEGMENT_STOP;
+extern unsigned char HEAP_START;
+extern unsigned char HEAP_STOP;
+
#endif /* ARCH_H_ */
diff --git a/include/arch/x86_64/arch.h b/include/arch/x86_64/arch.h
index c17721d..a7ba776 100644
--- a/include/arch/x86_64/arch.h
+++ b/include/arch/x86_64/arch.h
@@ -1,6 +1,7 @@
#ifndef ARCH_H_
#define ARCH_H_
+#include <stdint.h>
#include "fake_env.h"
#define ARCH_PC
@@ -30,8 +31,8 @@
// Pretend there's a data segement at the start of SRAM1 for more accurate
// testing.
-#define GHOST_DATA_SEGMENT_SIZE 1234
-#define DATA_SEGMENT_START (*((uint8_t*)SRAM1_BASE))
-#define DATA_SEGMENT_STOP (*(((uint8_t*)SRAM1_BASE) + GHOST_DATA_SEGMENT_SIZE))
+#define GHOST_DATA_SEGMENT_SIZE 1200
+#define HEAP_START (*(((unsigned char*)SRAM1_BASE) + GHOST_DATA_SEGMENT_SIZE))
+#define HEAP_STOP (*(&HEAP_START + 16384 - GHOST_DATA_SEGMENT_SIZE))
#endif /* ARCH_H_ */