装配 - 堆栈中的数字

时间:2015-05-25 22:01:09

标签: c assembly att x87

这是我的代码的一部分:

.data

.text
.global fx
fx:
    pushl %ebp
    movl %esp,%ebp

    finit
    fldl 8(%ebp)

我从C调用此函数。因为8字节应该有我调用的值,我是对的吗?但我在gdb中看到的是:

(gdb) info float
=>R7: Valid   0x3bf2bd04000000000000 +1.00272590169167575e-312  
  R6: Empty   0x00000000000000000000
  R5: Empty   0x00000000000000000000
  R4: Empty   0x00000000000000000000
  R3: Empty   0x00000000000000000000
  R2: Empty   0x00000000000000000000
  R1: Empty   0x00000000000000000000
  R0: Empty   0x00000000000000000000

Status Word:         0x3802      DE                                    
                       TOP: 7
Control Word:        0x037f   IM DM ZM OM UM PM
                       PC: Extended Precision (64-bits)
                       RC: Round to nearest
Tag Word:            0x3fff
Instruction Pointer: 0x00:0x0804849b
Operand Pointer:     0x00:0xffffcbb0
Opcode:              0xdd45

这是在fldl 8(%ebp)之后。我的朋友做了同样的程序而且工作正常。我做错了什么?

低于我的完整C函数:

#include <stdio.h>
float fx(float x);
float gx(float x);

int main(){

float x;
printf("Podaj wartosc x: ");
scanf("%f",&x);
float wynik1 = fx(x);
float wynik2 = gx(x);

printf("\nWynik funkcji f(x)=%f\nWynik funkcji g(x)=%f\n",wynik1,wynik2);
return 0;
}

1 个答案:

答案 0 :(得分:2)

您正在加载双($(".displayImage").hover(function(){ // $(this).attr('data-img') == 'azotea' or 'nivel8' // so we end up with $('#azotea').show(), for example. $('#' + $(this).attr('data-img')).show(); }, function () { $('#' + $(this).attr('data-img')).hide(); });)而不是浮点数(<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <table> <tbody> <tr> <td style="width: 20%;" class="text-center"> <span class="displayImage" data-img='azotea'>Azotea </span> <span class="displayImage" data-img='nivel8'>Nivel 8 </span> </td> </tr> </tbody> </table> <div class="col-lg-5 text-left"> <img class="displayed" src="images/azotea-n9.jpg" alt="azotea" id="azotea"> <img class="displayed" src="images/test2.jpg" alt="nivel 8" id="nivel8"> </div>)。