不支持的指令`列表`

时间:2015-04-16 19:43:11

标签: assembly x86 gas att

我正在构建一个用于教育目的的内核。

我的操作系统启动如下:GRUB -> boot.S -> init.c

boot.S中我想加载一个中断描述符表。这是我的文件的摘录:

# load_idt - Loads the interrupt descriptor table (IDT).
# stack: [esp + 4] the address of the first entry in the IDT
#        [esp    ] the return address
load_idt: 
    movl    4(%esp),%eax    # load the address of the IDT into register eax
    lidt   %eax            # load the IDT
    ret                     # return to the calling function

我正在使用gas编译,所以我正在使用at& t语法。
但是,当我尝试编译它时,编译器似乎无法识别lidt指令。

  

gcc -Wa, - 32 -MMD -c -o boot.o boot.S boot.S:汇编程序消息:
  boot.S:65:错误:不支持的指令`lidt' :食谱   目标' boot.o'失败了:*** [boot.o]错误1

那么正确的指令是什么?

修改:我尝试使用lidtl,这也不起作用

1 个答案:

答案 0 :(得分:3)

lidt需要内存引用。正确的语法是lidt (%eax)。不可否认,错误信息可能更好。然后,我的gas版本(来自GNU Binutils for Debian 2.22)确实说operand type mismatch for 'lidt'

PS:gas可以切换到英特尔语法,因此没有理由使用& t。等效的intel语法当然是lidt [eax],而lidt eax会产生相同的错误。

相关问题