Lord of Shadows
2[H]4U
- Joined
- Mar 9, 2004
- Messages
- 3,322
Hello, I'm writing a compiler using flex/bison and am storing all variables in my symbol table as offsets from either ebp or the data segment if their globals. My target platform is linux protected mode x86 using intel syntax with the gnu assembler, but the code works fine with masm given a different header. (I really hate at&t syntax)
My problem is that I dont know how to find where the data segment begins in protected mode. I assumed that the data segment register held the offset to the begining of the data segment, but I dont think that is the case in protected mode.
http://www.lshift.net/blog/2010/03/31/what-has-happened-to-the-segment-registers
There has to be an easy way to find this offset right? I'd like to have the offset at compile time if possible. Any ideas?
My problem is that I dont know how to find where the data segment begins in protected mode. I assumed that the data segment register held the offset to the begining of the data segment, but I dont think that is the case in protected mode.
http://www.lshift.net/blog/2010/03/31/what-has-happened-to-the-segment-registers
There has to be an easy way to find this offset right? I'd like to have the offset at compile time if possible. Any ideas?