9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] acid - i386 floating point register issue ?
@ 2007-01-05 20:34 Philip Dye
  2007-01-05 22:21 ` Russ Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Philip Dye @ 2007-01-05 20:34 UTC (permalink / raw)
  To: 9fans

On an i386, I am unable to get acid to properly report the values in the
floating point registers.

Could someone please explain what I am doing wrong ?

Thank you,

Philip Dye

- - - - -

Simple example:

    #include <u.h>
    #include <libc.h>
    void main ( void )
    {
      double x ;
      x = atof("3.5") ;
      print("===== main  x  = %g\n",x) ;
      exits(nil) ;
    }

Use:

    example : acid 8.out
    8.out:386 plan 9 executable

    /sys/lib/acid/port
    /sys/lib/acid/386
    acid: new()
    7118: system call       _main   SUBL    $0x48,SP
    7118: breakpoint        main+0x3        MOVL    $.string(SB),AX
    acid: asm(main)
    main 0x00001020 SUBL    $0x1c,SP
    main+0x3 0x00001023     MOVL    $.string(SB),AX
    main+0x8 0x00001028     MOVL    AX,0x0(SP)
    main+0xb 0x0000102b     CALL    atof(SB)
    main+0x10 0x00001030    FMOVDP  F0,x+0x14(SP)
    main+0x14 0x00001034    MOVL    $.string+0x4(SB),AX
    main+0x19 0x00001039    MOVL    AX,0x0(SP)
    main+0x1c 0x0000103c    FMOVD   x+0x14(SP),F0
    main+0x20 0x00001040    FMOVDP  F0,0x4(SP)
    main+0x24 0x00001044    CALL    print(SB)
    main+0x29 0x00001049    ADDL    $0x1c,SP
    main+0x2c 0x0000104c    RET
    _main 0x0000104d        SUBL    $0x48,SP
    acid: bpset(main+0x10)
    acid: cont()
    7118: breakpoint        main+0x10       FMOVDP  F0,x+0x14(SP)
    acid: fpr()
    F0       0.
    F1       0.
    F2       0.
    F3       0.
    F4       0.
    F5       0.
    F6       0.
    F7       0.
    control 0x0272
    status  0x3900
    tag     0x3fff
    ip offset       0x00001743
    cs selector     0x0023
    opcode  0xe907
    data operand offset     0xeee8
    operand selector        0x001b
    acid: print("===== ACID  F0 = ",*(F0\F),"\n")
    ===== ACID  F0 = 0

    acid: cont()
    ===== main  x  = 3.5
    7118: breakpoint        main+0x14       MOVL    $.string+0x4(SB),AX
    <stdin>:9: (error) msg: pid=7118 startstop: process exited

- - - - -



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-01-05 22:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-05 20:34 [9fans] acid - i386 floating point register issue ? Philip Dye
2007-01-05 22:21 ` Russ Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).