so this logic is needed for the code to find exactly from where to where the address starts and ends
the project is close to done, now i need to test it before that make the MakeFile then after testing the Readme.md and .gitignore file before making it public
ignore the errors google cloud shell have clang installed in default and well it is blind to which c++ i am using but i can build the files so i am okay to go.
worked to well or basically missed it, modern linux there are two systems PIE (position independent executable) and ASLR (Address Space layout randomization) which randomize the stack where the assembly code for our case is executed which is 0x5a38a5f1e009 but basically the runtime would have usually started from 0x00000000 or lower fixed number.
So basically in assembly the top of the stack is the lowest address and the bottom of the stack is the highest address
𓆣 𝔗̶𝔢̶𝔱̶𝔰̶𝔱̶𝔞̶𝔠̶𝔨̶ 𓆣
So basically in assembly the top of the stack is the lowest address and the bottom of the stack is the highest address
High Addresses (e.g., 0x7FFFFFF.....)
|
|--- [Stack Bottom] (Where the stack began)
| |
| | (Grows Downward as data is pushed)
| v
|--- [Stack Top] (Where %esp / %rsp points - LOWEST address in the stack)
|
| Unallocated Shared Memory Space
|
|--- [Heap Top] (Grows Upward as memory is malloc'd)
| ^
| |
|--- [Heap Bottom]
|
Low Addresses (e.g., 0x0000000.....)