打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
lgdt in nasm

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>






本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Nasm中文手册三
汇编语言11---基本语法与分段_db 100 dup(0)
汇编指令: LGDT、LIDT、LLDT、LMSW、LOADALL、LOADALL286、...
NASM汇编笔记
汇编教程nasm《nasm中文手册 》(有一件事NASM不能处理)
实战X86寄存器
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服