I've been messing around with a toy kernel and I'm confused about accessing a symbol's address.
Suppose I'm defining the stack I want to use like this:
_stack_bot:
.skip 4096
_stack_top:
I can't load the stack using:
movl _stack_top, %esp
because that's going to move a 4 byte value starting at the address starting at _stack_top into %ecx, which is incorrect.
Instead I do this:
movl $_stack_top, %esp
but, I can also do this:
lea _stack_top, %esp
Both load the same address, and everything works. My question is, is there any difference between the two in this context?