FFREE ST(i)修改x87标记字中的哪些位? [英] Which bits in the x87 tag word does FFREE ST(i) modify?

查看:169
本文介绍了FFREE ST(i)修改x87标记字中的哪些位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此示例是用NASM编写的:

This example was written in NASM:

section .bss
    var28: resb  28


section .text
    _main:

        ; Initialize
            finit
            fldpi
        ; Read Tag Word
            fstenv [var28]
            mov    ax, [var28 + 8] ; move the Tag Word to ax

此时,ax = 0011 1111 1111 1111,这意味着ST7 = 00(有效),其余为11(空).

At this point ax = 0011 1111 1111 1111, which means ST7 = 00 (valid), and the rest is 11 (empty).

其余代码:

        ; FFREE ST(i)

            ffree ST7 ; Sets tag for ST(i) to empty.
            ; Read Tag Word
                fstenv [var28]
                mov    ax, [var28 + 8] ; move the Tag Word to ax

这时ax也= 0011 1111 11111111.
我的问题是,不应该是ax = 11 11 1111 1111 1111吗?

At this point ax = 0011 1111 1111 1111 too.
My question is, shouldn't be ax = 1111 1111 1111 1111?

推荐答案

这时ax = 0011 1111 1111 1111,这意味着ST7 = 00(有效), 其余为11(空).

At this point ax = 0011 1111 1111 1111, which means ST7 = 00 (valid), and the rest is 11 (empty).

.标记字指的是寄存器(R7..R0),而ST(i)指的是可以更改的堆栈顶部"(TOS).

No. The Tag Word refers to the registers (R7..R0), while ST(i) refers to the "top of the stack" (TOS) which can change.

第一个fldpi将TOS(= ST(0))设置为寄存器R7,并将PI装入该寄存器.第二个fld会将TOS更改为寄存器R6并填充该寄存器.然后,ST(0)将指向第二个fld的寄存器. ffree st0将释放R6(标签字中的第二个标签)并将ST0设置为R7.状态字包含TOS当前指向的寄存器的三位数字.

The first fldpi sets the TOS (=ST(0)) to register R7 and loads PI into that register. A second fld would change the TOS to register R6 and fill that register. ST(0) would point then to the register of the second fld. ffree st0 would free R6 (the second tag in the Tag Word) and set ST0 to R7. The Status Word contains a three-bit number with the register to which the TOS currently points.

在示例程序中,fldpi将PI加载到指向R7的ST(0)中.要清空R7,您必须使用ffree st0.

In your example program, fldpi loads PI into ST(0) which points to R7. To empty R7 you have to use ffree st0.

请查看英特尔手册第8卷第8章. 1 详细讨论.

这篇关于FFREE ST(i)修改x87标记字中的哪些位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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