Make malloc actually use the correct region
This commit is contained in:
parent
745623afb2
commit
5b41a9d87a
3 changed files with 9 additions and 5 deletions
|
@ -2,10 +2,10 @@
|
||||||
/* See the end of this file for copyright, licensing, and warranty information. */
|
/* See the end of this file for copyright, licensing, and warranty information. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* stack size is 32K (uses the entire sram1 bank)
|
* stack size is 8K
|
||||||
* TODO: modify flash.ld to actually align this properly
|
* TODO: modify flash.ld to actually align this properly
|
||||||
*/
|
*/
|
||||||
STACK_SIZE = 0x8000;
|
STACK_SIZE = 0x2000;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020 Felix Kopp <sandtler@sandtler.club>
|
* Copyright (c) 2020 Felix Kopp <sandtler@sandtler.club>
|
||||||
|
|
|
@ -141,4 +141,7 @@ SECTIONS
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_end = . ;
|
_end = . ;
|
||||||
|
|
||||||
|
_sheap = .;
|
||||||
|
_eheap = ORIGIN(ram) + LENGTH(ram) - 4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,10 @@ extern uint32_t _srelocate; /* relocate (.data) start */
|
||||||
extern uint32_t _erelocate; /* relocate end */
|
extern uint32_t _erelocate; /* relocate end */
|
||||||
extern uint32_t _szero; /* zero area (.bss) start */
|
extern uint32_t _szero; /* zero area (.bss) start */
|
||||||
extern uint32_t _ezero; /* zero area end */
|
extern uint32_t _ezero; /* zero area end */
|
||||||
/* the entire heap sits in between _ezero and _sstack */
|
|
||||||
extern uint32_t _sstack; /* stack start */
|
extern uint32_t _sstack; /* stack start */
|
||||||
extern uint32_t _estack; /* stack end */
|
extern uint32_t _estack; /* stack end */
|
||||||
|
extern uint32_t _sheap; /* heap start */
|
||||||
|
extern uint32_t _eheap; /* heap end */
|
||||||
|
|
||||||
/* implementation in init/main.c */
|
/* implementation in init/main.c */
|
||||||
void do_bootstrap(void);
|
void do_bootstrap(void);
|
||||||
|
@ -38,8 +39,8 @@ void irq_reset(void)
|
||||||
|
|
||||||
/* There is no userspace yet, so the Kernel gets the entire heap for now */
|
/* There is no userspace yet, so the Kernel gets the entire heap for now */
|
||||||
malloc_init(
|
malloc_init(
|
||||||
&_ezero + sizeof(void *),
|
&_sheap,
|
||||||
(size_t)(&_sstack) - (size_t)(&_ezero) - sizeof(void *)
|
(size_t)(&_sheap) - (size_t)(&_sheap)
|
||||||
);
|
);
|
||||||
|
|
||||||
/* start the Kernel */
|
/* start the Kernel */
|
||||||
|
|
Loading…
Reference in a new issue