访问段寄存器MASM [英] Accessing Segment Registers MASM

查看:118
本文介绍了访问段寄存器MASM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试查询FS段寄存器所指向的位于处理环境"块中的值.尝试使用包含的fs:[0]段编译代码会导致错误(错误A2108:使用假定为ERROR的寄存器).

I'm trying to query the value located in the Process Enviornment Block, pointed to by the FS segment register. Attempting to compile code with the fs:[0] segment included results in an error (error A2108: use of register assumed to ERROR).

如何查询段寄存器?!

谢谢

推荐答案

MASM默认情况下假定对段寄存器的任何访问都是错误(通常是错误).您需要使用ASSUME FS:NOTHING重新定义FS寄存器的假设. 您可以将该指令放在文件的顶部,也可以暂时重新设定" FS寄存器.示例:

MASM by default assumes that any access to the segment registers is an error (which usually it is). You need to redefine the assumptions for the FS register using ASSUME FS:NOTHING. You can place this directive at the top of your file, OR you could "reassume" the FS register temporarily. Example:

ASSUME FS:NOTHING
MOV EAX, FS:[0]
ASSUME FS:ERROR

通过这种方式,您可以仅关闭这条指令的错误检查. ASSUME指令仅通知汇编程序该怎么做,它们不会导致发出任何代码.

This way you turn off the error checking only for this single instruction. The ASSUME directives only inform the assembler what to do, they don't cause any code to be emitted.

这篇关于访问段寄存器MASM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆