1 1.5 christos /* $NetBSD: fpsetround.S,v 1.5 2011/09/30 23:45:41 christos Exp $ */ 2 1.2 perry 3 1.1 mycroft /* 4 1.4 christos * Written by Frank van der Linden at Wasabi Systems for NetBSD. 5 1.1 mycroft * Public domain. 6 1.1 mycroft */ 7 1.1 mycroft 8 1.1 mycroft #include <machine/asm.h> 9 1.1 mycroft 10 1.4 christos /* 11 1.4 christos * XXX set both the x87 control word 12 1.4 christos * Applications should only set exception and round flags 13 1.4 christos */ 14 1.4 christos 15 1.4 christos 16 1.3 thorpej #ifdef WEAK_ALIAS 17 1.3 thorpej WEAK_ALIAS(fpsetround, _fpsetround) 18 1.3 thorpej ENTRY(_fpsetround) 19 1.3 thorpej #else 20 1.1 mycroft ENTRY(fpsetround) 21 1.3 thorpej #endif 22 1.1 mycroft 23 1.4 christos fnstcw -4(%esp) 24 1.4 christos movl -4(%esp), %edx 25 1.4 christos movl %edx, %eax 26 1.4 christos andl $0x00000c00, %eax 27 1.4 christos andl $0xfffff3ff, %edx 28 1.5 christos movl 4(%esp), %ecx 29 1.5 christos orl %ecx, %edx 30 1.4 christos movl %edx, -4(%esp) 31 1.4 christos fldcw -4(%esp) 32 1.1 mycroft 33 1.1 mycroft ret 34