hi:) The gdtr reg saves the base address of gdt , whether is this address a linear address or phisical address ? thanks!
On Mon, Feb 18, 2013 at 1:55 AM, horseriver <horserivers@gmail.com> wrote:
hi:)
The gdtr reg saves the base address of gdt , whether is this address a linear address or phisical address ?
According to Intel® 64 and IA-32 Architectures Software Developer’s Manual Volume 3B: System Programming Guide, Part 2 for 64 bit machines: On processors that support Intel 64 architecture, the base-address fields for FS, GS, GDTR, IDTR, and TR must contain canonical addresses. Look for definition of canonical addresses here: http://en.wikipedia.org/wiki/X86-64 According to this book all addresses in GDTR, LDTR and IDTR are linear addresses http://books.google.co.uk/books?id=l8QPUGuElFwC&pg=SA7-PA15&lpg=SA7-PA15&dq=... Intel® 64 and IA-32 Architectures Software Developer’s Manual Volume 3A: System Programming Guide, Part 1 page 65 The linear address of the base of the GDT is contained in the GDT register (GDTR); the linear address of the LDT is contained in the LDT register (LDTR). However for 32 bit registers, this document provides some details in protected mode: http://home.swipnet.se/smaffy/asm/info/PMODEDetailedApproach.txt
thanks!
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Thank you Warm Regards Anuz
hi:) I have compiled a .S file ,using command gcc -c x.S -o x. Then I use objdump to look up its asm code, even find that some code is not the same as that .S file , more important is , some code in origin .S file has disappear . what is about the reason ? If it is due to version , why some code chould get lost after compile? thanks!
On Mon, Feb 18, 2013 at 5:07 AM, horseriver <horserivers@gmail.com> wrote: > hi:) > > I have compiled a .S file ,using command gcc -c x.S -o x. > Then I use objdump to look up its asm code, even find that some code is > not the > same as that .S file , more important is , some code in origin .S file > has disappear . > > what is about the reason ? If it is due to version , why some code > chould get lost after compile? > > Couple of things 1. Please don't piggy back questions over the unrelated topic, that is totally misdirecting the discussion. 2. You ask a lot of question related to compilation and stuff, which are off-topic here, why not READ a little bit more or consult relevant documentation? 3. You seem to do no homework before asking viz googling or reading basic books on relevant topic for example in this case reading a book on assembly language programming. When you write any assembly code(or for that matter any code) your code is written to be read by HUMANS and not machines. For machines a lot of that code is redundant and has no use so machine code will be generated in such a form that it is most optimized for the execution. For example take any *.c code and do #gcc -S *.c you will see an equivalent assembly code. It may not exactly be similar to the code which you will write in assembly for same logic. There are some rules according to which compilers generate code, please read some book on compilers and lex and yacc. > thanks! > -- Thank you Warm Regards Anuz
On Mon, Feb 18, 2013 at 3:05 PM, Anuz Pratap Singh Tomar < chambilkethakur@gmail.com> wrote: > > > On Mon, Feb 18, 2013 at 5:07 AM, horseriver <horserivers@gmail.com> wrote: > >> hi:) >> >> I have compiled a .S file ,using command gcc -c x.S -o x. >> Then I use objdump to look up its asm code, even find that some code is >> not the >> same as that .S file , more important is , some code in origin .S file >> has disappear . >> >> what is about the reason ? If it is due to version , why some code >> chould get lost after compile? >> >> Couple of things > 1. Please don't piggy back questions over the unrelated topic, that is > totally misdirecting the discussion. > 2. You ask a lot of question related to compilation and stuff, which are > off-topic here, why not READ a little bit more or consult relevant > documentation? > 3. You seem to do no homework before asking viz googling or reading basic > books on relevant topic for example in this case reading a book on assembly > language programming. > > When you write any assembly code(or for that matter any code) your code is > written to be read by HUMANS and not machines. For machines a lot of that > code is redundant and has no use so machine code will be generated in such > a form that it is most optimized for the execution. For example take any > *.c code and do > > #gcc -S *.c > you will see an equivalent assembly code. It may not exactly be similar to > the code which you will write in assembly for same logic. There are some > rules according to which compilers generate code, please read some book on > compilers and lex and yacc. > > > Some more info about objdump and assembly code and why they are different. http://stackoverflow.com/questions/4309771/disassembling-modifying-and-then-reassembling-a-linux-executable And bit of correction: s/it is most optimized for the execution/it is optimized for compilation if there are no optimization flags used/ > >> thanks! >> > > > > -- > Thank you > Warm Regards > Anuz > -- Thank you Warm Regards Anuz
participants (2)
-
Anuz Pratap Singh Tomar -
horseriver