Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想更新数据段选择器以指向 GDT 中的其他条目。但是由于我对汇编很陌生,所以我不能在我的代码中做到这一点。但是,我使用以下汇编指令更新了代码段选择器:
ljmp $(GDT_TABLE_INDEX), $(1f) //This instruction simply points code segment to some other entry in GDT and move to next label.
是否还有一些类似或替代指令来更新数据段选择器?
mov您可以使用该指令更改数据段选择器。例如,如果要设置ds为0x1234,请使用:
mov
ds
0x1234
mov $1234, %ax mov %ax, %ds
请注意,没有mov imm, sreg指令,因此您首先必须将选择器的编号移动到通用寄存器中。pop您可能还会发现进入段寄存器很方便:
mov imm, sreg
pop
push $1234 pop %ds