arm: clear highly mapped kernel bss
. added bss range values for the high (paged) kernel and clear it in pre_init . this changes the meaning of the current _edata end _end in the pre_init phase to mean: highly mapped bss; and the new symbols _kern_unpaged_edata ... _kern_unpaged_edata to mean directly mapped (pre_init) bss. This was previously _edata and _end. . added a sanity check in kmain (ben@) The values can be verified by: ${CROSS_TOOLS}/arm-elf32-minix-objdump -xD ${OBJ}/kernel/kernel Signed-off-by: Jan Kobler <eng1@koblersystems.de>
This commit is contained in:
parent
f80046feea
commit
29fe671680
3 changed files with 16 additions and 3 deletions
|
@ -16,11 +16,10 @@ SECTIONS
|
|||
|
||||
.unpaged_text ALIGN(4096) : { unpaged_*.o(.text) }
|
||||
.unpaged_data ALIGN(4096) : { unpaged_*.o(.data .rodata*) }
|
||||
__k_unpaged__kern_unpaged__edata = .;
|
||||
__k_unpaged__edata = .;
|
||||
__k_unpaged__kern_unpaged_edata = .;
|
||||
|
||||
.unpaged_bss ALIGN(4096) : { unpaged_*.o(.bss COMMON) }
|
||||
__k_unpaged__kern_unpaged_end = .;
|
||||
__k_unpaged__end = .;
|
||||
|
||||
. += _kern_offset;
|
||||
|
||||
|
@ -34,12 +33,15 @@ SECTIONS
|
|||
.data ALIGN(4096) : AT(ADDR(.data) - _kern_offset) { *(.data .rodata* ) }
|
||||
. = ALIGN(4096);
|
||||
_edata = .;
|
||||
__k_unpaged__edata = . - _kern_offset;
|
||||
.bss ALIGN(4096) : AT(ADDR(.bss) - _kern_offset) { *(.bss* COMMON)
|
||||
__k_unpaged__kern_size = . - _kern_vir_base;
|
||||
_kern_size = __k_unpaged__kern_size;
|
||||
|
||||
. += 4096;
|
||||
}
|
||||
_end = .;
|
||||
__k_unpaged__end = . - _kern_offset;
|
||||
|
||||
/DISCARD/ :
|
||||
{
|
||||
|
|
|
@ -37,9 +37,14 @@ static void setup_mbi(multiboot_info_t *mbi, char *bootargs);
|
|||
/* Kernel may use memory */
|
||||
int kernel_may_alloc = 1;
|
||||
|
||||
/* kernel bss */
|
||||
extern u32_t _edata;
|
||||
extern u32_t _end;
|
||||
|
||||
/* kernel unpaged bss */
|
||||
extern char _kern_unpaged_edata;
|
||||
extern char _kern_unpaged_end;
|
||||
|
||||
/**
|
||||
*
|
||||
* The following function combines a few things together
|
||||
|
@ -374,6 +379,7 @@ kinfo_t *pre_init(int argc, char **argv)
|
|||
|
||||
/* Clear BSS */
|
||||
memset(&_edata, 0, (u32_t)&_end - (u32_t)&_edata);
|
||||
memset(&_kern_unpaged_edata, 0, (u32_t)&_kern_unpaged_end - (u32_t)&_kern_unpaged_edata);
|
||||
|
||||
/* we get called in a c like fashion where the first arg
|
||||
* is the program name (load address) and the rest are
|
||||
|
|
|
@ -123,6 +123,11 @@ void kmain(kinfo_t *local_cbi)
|
|||
struct boot_image *ip; /* boot image pointer */
|
||||
register struct proc *rp; /* process pointer */
|
||||
register int i, j;
|
||||
static int bss_test;
|
||||
|
||||
/* bss sanity check */
|
||||
assert(bss_test == 0);
|
||||
bss_test = 1;
|
||||
|
||||
/* save a global copy of the boot parameters */
|
||||
memcpy(&kinfo, local_cbi, sizeof(kinfo));
|
||||
|
|
Loading…
Reference in a new issue