clear bss - #1
Open
jankobler wants to merge 1 commit into
Open
Conversation
values were wrong for:
__k_unpaged__edata
_k_unpaged__end
The paged bss: _edata ... _end
and the unpaged bss: _kern_unpaged_edata ... _kern_unpaged_edata
are cleared now.
The values can be verified by:
${CROSS_TOOLS}/arm-elf32-minix-objdump -xD ${OBJ}/kernel/kernel
Signed-off-by: Jan Kobler <eng1@koblersystems.de>jankobler
commented
Jun 4, 2014
Author
In the file pre_init.c the address values of _k_unpaged* are used. Source in function pre_init /* 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); When you disassemble the kernel with ${CROSS_TOOLS}/arm-elf32-minix-objdump -xD ${OBJ}/kernel/kernel
you can see that the areas which are cleared by __k_unpaged_memset are really disassembly of function pre_init 80200be4 <__k_unpaged_pre_init>:
80200be4: e92d47f0 push {r4, r5, r6, r7, r8, r9, sl, lr}
80200be8: e1a05000 mov r5, r0
80200bec: e59f217c ldr r2, [pc, #380] ; 80200d70 <__k_unpaged_$d>
80200bf0: e1a04001 mov r4, r1
80200bf4: e59f0178 ldr r0, [pc, #376] ; 80200d74 <__k_unpaged_$d+0x4>
80200bf8: e3a01000 mov r1, #0
80200bfc: e0602002 rsb r2, r0, r2
80200c00: eb0004af bl 80201ec4 <__k_unpaged_memset>
80200c04: e59f016c ldr r0, [pc, #364] ; 80200d78 <__k_unpaged_$d+0x8>
80200c08: e59f216c ldr r2, [pc, #364] ; 80200d7c <__k_unpaged_$d+0xc>
80200c0c: e3a01000 mov r1, #0
80200c10: e0602002 rsb r2, r0, r2
80200c14: eb0004aa bl 80201ec4 <__k_unpaged_memset>
used data 80200d70 <__k_unpaged_$d>: 80200d70: 802822cc 80200d74: 8023f000 80200d78: 802059b0 80200d7c: 8021c3d0 These are the values of 802822cc g *ABS* 00000000 __k_unpaged__end 8023f000 g *ABS* 00000000 __k_unpaged__edata 802059b0 g *ABS* 00000000 __k_unpaged__kern_unpaged_edata 8021c3d0 g *ABS* 00000000 __k_unpaged__kern_unpaged_end The values point all between . = _kern_phys_base and . += _kern_offset You can list the variables in the bss sections: ${CROSS_TOOLS}/arm-elf32-minix-objdump -xD ${OBJ}/kernel/kernel | sort | grep bss
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I had problems with uncleared bss. E.g. the static variable pt_inuse was not set to zero.
I think I have found the reason for it.
The values were wrong for:
__k_unpaged__edata
__k_unpaged__end
I think the unpaged bss _kern_unpaged_edata ... _kern_unpaged_edata has to be cleared too.
Therefore the paged bss: _edata ... _end
and the unpaged bss: _kern_unpaged_edata ... _kern_unpaged_edata
are both cleared now in the function pre_init.
The values can be verified by:
${CROSS_TOOLS}/arm-elf32-minix-objdump -xD ${OBJ}/kernel/kernel