Changeset 8e7c9fe in mainline for uspace/lib/math/arch/amd64/src/sin.S
- Timestamp:
- 2014-09-12T03:45:25Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c53b58e
- Parents:
- 3eb0c85 (diff), 105d8d6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/math/arch/amd64/src/sin.S
r3eb0c85 r8e7c9fe 1 1 # 2 # Copyright (c) 20 05Martin Decky2 # Copyright (c) 2014 Martin Decky 3 3 # All rights reserved. 4 4 # … … 27 27 # 28 28 29 #include <libarch/ stack.h>29 #include <libarch/x87.h> 30 30 31 31 .text 32 .section .init, "ax"33 32 34 .global __entry33 .global sin 35 34 36 .set noreorder 37 .option pic2 38 39 ## User-space task entry point 40 # 41 # $a0 ($4) contains the PCB pointer 42 # 43 .ent __entry 44 __entry: 45 .frame $sp, ABI_STACK_FRAME, $ra 46 .cpload $t9 35 sin: 36 pushq %rbp 37 movq %rsp, %rbp 47 38 48 # Allocate the stack frame. 49 addiu $sp, -ABI_STACK_FRAME 39 # compute sine (using red zone) 50 40 51 # Allow PIC code52 .cprestore 1641 movsd %xmm0, -8(%rbp) 42 fldl -8(%rbp) 53 43 54 # Pass pcb_ptr to __main() as the first argument. It is already 55 # in $a0. As the first argument is passed in $a0, no operation 56 # is needed. 44 fsin 57 45 58 jal __main 59 nop 46 # detect if source operand is out of range 60 47 61 # 62 # Not reached. 63 # 64 addiu $sp, ABI_STACK_FRAME 65 .end __entry 48 fnstsw %ax 49 andw $X87_STATUS_WORD_C2_MASK, %ax 50 jnz fix_range 51 52 fstpl -8(%rbp) 53 movsd -8(%rbp), %xmm0 54 55 leave 56 retq 57 58 # argument reduction 59 60 fix_range: 61 fldpi 62 fadd %st(0) 63 fxch %st(1) 64 65 reduce: 66 fprem1 67 fnstsw %ax 68 andw $X87_STATUS_WORD_C2_MASK, %ax 69 jnz reduce 70 71 fstpl %st(1) 72 fsin 73 74 fstpl -8(%rbp) 75 movsd -8(%rbp), %xmm0 76 77 leave 78 retq
Note:
See TracChangeset
for help on using the changeset viewer.