NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: nobody on April 13, 2006, 01:35:20 AM
-
Hi.
Please tell me how to use "lgdt".
I wrote a progoram below.
......................
......................
lgdt gdtr
......................
......................
gdtr
dw 2048 - 1
dd gdt
......................
......................
Running nasm gave me the message,
"os.asm:47: error: invalid combination of opcode and operands"
I rewrote my program,
lgdt [gdtr]
and I got no error message this time, but why ?
-
Ummm, 'cause that's the correct syntax?
"LGDT" (and "LIDT") take a "mem" operand (not "imm"). In Nasm's syntax, "[foo]" is a memory operand, "foo" is a plain immediate number. Same idea as:
mov [foo], eax ; okay
mov foo, eax ; BZZZT!
Now, as to the contents of that memory area... best consult the Intel/AMD manual... or perhaps you already know that...
Best,
Frank
-
Dear Frank
Thank you for your answer.
Well...."'cause that is the correct syntax"...
Yes, I know that from the reference manual of
Intel.But I feel "LGDT [GDTR]" that's a little bit of strange....
Any way thank you very much.
Shiozaki Tetsurou