Results 1 to 2 of 2
Hi i am running linux and intel x86 cpu. I have been learning at&t asm using gcc and gdb and am trying to print the values of the fpu stack ...
- 07-29-2010 #1Just Joined!
- Join Date
- Jul 2010
- Posts
- 2
printing fpu register problem (at&t asm)
Hi i am running linux and intel x86 cpu. I have been learning at&t asm using gcc and gdb and am trying to print the values of the fpu stack with no success. My code is:
The output i get in bash isCode:.section .data #; Uninitialized data section output: #; Mem lable .asciz "The value is %d\n" #; Null terminated ascii string value1: #; Mem lable .float 00.00 #; Single precision floating point value value2: #; Mem lable .float 01.00 #; Single precision floating point value value3: #; Mem lable .float 02.00 #; Single precision floating point value value4: #; Mem lable .float 03.00 #; Single precision floating point value value5: #; Mem lable .float 04.00 #; Single precision floating point value value6: #; Mem lable .float 05.00 #; Single precision floating point value value7: #; Mem lable .float 06.00 #; Single precision floating point value .section .bss #; Uninitialized data section .lcomm data, 4 #; Reserve 4 bytes in memory .section .text #; Code execute section .globl main #; Make 'main' global main: #; Start execute here nop #; No operation movl $7, %ecx #; Load 7 into ecx flds value1 #; Load 'value1' into fpu stack flds value2 #; Load 'value2' into fpu stack flds value3 #; Load 'value3' into fpu stack flds value4 #; Load 'value4' into fpu stack flds value5 #; Load 'value5' into fpu stack flds value6 #; Load 'value6' into fpu stack flds value7 #; Load 'value7' into fpu stack loop1: #; Code lable non globl movl %ecx, %esi #; Load ecx into esi fsts data #; Pop from fpu reg into data push $data #; Push mem location for 'data' onto stack push $output #; Push 'value1' onto stack call printf #; Call C function PRINTF add $8, %esp #; Load 8 into esp, quick & dirty stack clear movl %esi, %ecx #; Load edx into ecx jcxz done #; Jump to done if ecx is 0 loop loop1 #; Decrement ecx and jump to 'loop1' if ecx 0 done: #; Code lable call exit #; Call C function EXIT
I did as much debugging as i could in gdb and i think the problem is to do with fsts dataCode:The value is 134520912 The value is 134520912 The value is 134520912 The value is 134520912 The value is 134520912 The value is 134520912 The value is 134520912
If anyone has any advice or tips I would appreciate it loads.
thanks J0rd_Last edited by j0rd; 07-29-2010 at 04:07 PM. Reason: conciseness
- 08-02-2010 #2Just Joined!
- Join Date
- Jul 2010
- Posts
- 2
sorry to do this but....bump


Reply With Quote