http://coding.derkeiler.com/Archive/Assembler/comp.lang.asm.x86/2011-11/msg00137.html
[for Usenet newsgroups, you're reply goes in-between or after]
The Intel spec states that in either case, 16-bit or 32-bit operand size,
you will always need to specify a 6-byte memory location (for 64-bit,
make that a 10-byte location):
lgdt fword [mem]
FYI, that's not valid NASM syntax. 'fword' is for MASM.
Older NASM supports BYTE, WORD, DWORD, QWORD,
TWORD (i.e., TWORD is MASM's TBYTE). Newer NASM
supports those and OWORD, YWORD for SSE and YMM
registers.
but if the operand size is 16-bits, from the linear base address only 3
bytes (instead of 4 bytes) will actually be used (with the remaining byte
being set to zero in the GDTR). This is implicitely done by the CPU
and not by the assembler.
I've seen this a half-dozen times recently. So, it's time to mention it.
There is no 'cite' in implicitly.
Rod Pemberton
////////////////////
oxygen 发表于 2005-1-2 23:42
nasm的lidt/lgdt指令的语法好奇怪
使用nasm编写了一个引导程序
.
.
.
lidt [idt_48]
lgdt [gdt_48]
.
.
.
idt_48:DB 0, 0
DB 0, 0, 0, 0
gdt_48:DW 0x0800
DW gdt, 0
lidt/lgdt指令的操作数是一个指向6字节数据的内存地址。idt_48是内存地址。那应该是lidt idt_48才对。但这样的话编译是通不过的。一定要写成lidt [idt_48]才能编译通过。nasm的这个特性应该如何来理解?
AspireForce 发表于 2005-2-17 00:24
nasm的lidt/lgdt指令的语法好奇怪
idt_48是偏移值,[idt_48]是内存中的数据,当然要这样了
npuangel 发表于 2005-2-27 22:10
nasm的lidt/lgdt指令的语法好奇怪
你对nasm很了解吗有没有资料给我一点啊
/////
What would you do with it if you had it?
lgdt [fwordvar]
...
fwordvar df ???
Seems to me you'd need to break it up anyway...
fwordvar:
dw
dd <*linear* address>
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。