I want to know how the values of "bootstacktop" and "bootstack" are calculated by the assembler, when the code sets the value for %esp:
# Set the stack pointer
movl $(bootstacktop),%esp
At the end of the same assembly file, is the "definition" of "bootstacktop" is given:
###################################################################
# boot stack
###################################################################
.p2align PGSHIFT # force page alignment
.globl bootstack
bootstack:
.space KSTKSIZE
.globl bootstacktop
bootstacktop:
I found the value, looking at the deassebly, for 'bootstacktop', here is the part of the deassembly for the above 'mov' instruction:
# Set the stack pointer
movl $(bootstacktop),%esp
f0100034: bc 00 40 11 f0 mov $0xf0114000,%esp
Value of KSTKSIZE is 8*4096, PGSHIFT is 12. How did the value of 'bootsacktop' become '0xf0114000'? And whats the value of 'bootstack'?
Here is the linker script: http://pastebin.com/9DPakfgx
inc/memlayout.h