G
G
German2020-06-11 01:27:46
assembler
German, 2020-06-11 01:27:46

How to find the stack address in x86 architecture?

Hello.
In my kernel, I need to find the range in which the stack is located.
In the .text section, I configure esp like this:
mov esp, stack_space
And in the .bss section, I reserve space for the stack

section .bss
resb 8192
stack_space:

The complete code can be found here

Now, I need to find the address where the stack starts.
I know that it grows down, which means if its address is for example 0x3000, and the size allocated using resb is 2KB, then the range in which the stack is located will be 0x1000 - 0x3000, right?
But how can I find his address?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2020-06-11
@mrjbom

how can i find his address?

Put a mark in the right place. Load label address into register
section .bss
stack_bottom:
resb 8192
stack_top:
.text
mov eax, stack_bottom

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question