Permalink
Browse files

update

  • Loading branch information...
1 parent b92c84a commit 200c47fa0e8202a6f3a954d7e8cddad801654410 @astrotycoon committed Mar 22, 2012
View
Binary file not shown.
View
Binary file not shown.
View
@@ -0,0 +1,17 @@
+#getstatus.s - Get FPU Status register contents by using FSTSW instrction
+#fstsw %ax --> get infomation into ax
+#fstsw (memory) --> get infomation into memory
+.section .bss
+ .lcomm status, 2
+
+.section .text
+.globl _start
+_start:
+ fstsw %ax
+ fstsw status
+
+ movl $1, %eax # call exit()
+ movl $0, %ebx # return 0
+ int $0x80
+
+
View
Binary file not shown.
View
Binary file not shown.
View
@@ -0,0 +1,18 @@
+#setprec.s - An example of setting the precision bits int the Control Register
+.section .data
+newvalue:
+ .byte 0x7f, 0x00
+
+.section .bss
+ .lcomm control, 2
+
+.section .text
+.globl _start
+_start:
+ fstcw control
+ fldcw newvalue
+ fstcw control
+
+ movl $1, %eax
+ movl $0, %ebx
+ int $0x80
View
Binary file not shown.
View
Binary file not shown.
View
@@ -0,0 +1,34 @@
+#stacktest.s - An example of working with the FPU stack
+.section .data
+value1:
+ .int 40
+value2:
+ .float 92.4405
+value3:
+ .double 221.440321
+
+.section .bss
+ .lcomm int1, 4
+ .lcomm control, 2
+ .lcomm status, 2
+ .lcomm result, 4
+
+.section .text
+.globl _start
+_start:
+ finit
+ fstcw control # get ctrl-information into memory of control
+ fstsw status # get stat-information into memory of status
+
+ filds value1 # push value1 into FPU
+ fists int1 # pop st(0) into memory of int1
+
+ flds value2 # push value2 into FPU
+ fldl value3 # push value3 into FPU
+ fst %st(4) # get %st(0) into %st(4)
+ fxch %st(1) # xchange %st(0) and %st(1)
+ fstps result # pop %st(0) into memory of reslut
+
+ movl $1, %eax
+ movl $0, %ebx
+ int $0x80

0 comments on commit 200c47f

Please sign in to comment.