1/* 2Copyright (C) 1996-1997 Id Software, Inc. 3 4This program is free software; you can redistribute it and/or 5modify it under the terms of the GNU General Public License 6as published by the Free Software Foundation; either version 2 7of the License, or (at your option) any later version. 8 9This program is distributed in the hope that it will be useful, 10but WITHOUT ANY WARRANTY; without even the implied warranty of 11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 13See the GNU General Public License for more details. 14 15You should have received a copy of the GNU General Public License 16along with this program; if not, write to the Free Software 17Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 19*/ 20// 21// sys_wina.s 22// x86 assembly-language Win-dependent routines. 23 24#define GLQUAKE 1 // don't include unneeded defs 25#include "asm_i386.h" 26#include "quakeasm.h" 27 28// LATER should be id386-dependent, and have an equivalent C path 29 30 .data 31 32 .align 4 33fpenv: 34 .long 0, 0, 0, 0, 0, 0, 0, 0 35 36 .text 37 38.globl C(MaskExceptions) 39C(MaskExceptions): 40 fnstenv fpenv 41 orl $0x3F,fpenv 42 fldenv fpenv 43 44 ret 45 46#if 0 47.globl C(unmaskexceptions) 48C(unmaskexceptions): 49 fnstenv fpenv 50 andl $0xFFFFFFE0,fpenv 51 fldenv fpenv 52 53 ret 54#endif 55 56 .data 57 58 .align 4 59.globl ceil_cw, single_cw, full_cw, cw, pushed_cw 60ceil_cw: .long 0 61single_cw: .long 0 62full_cw: .long 0 63cw: .long 0 64pushed_cw: .long 0 65 66 .text 67 68.globl C(Sys_LowFPPrecision) 69C(Sys_LowFPPrecision): 70 fldcw single_cw 71 72 ret 73 74.globl C(Sys_HighFPPrecision) 75C(Sys_HighFPPrecision): 76 fldcw full_cw 77 78 ret 79 80.globl C(Sys_PushFPCW_SetHigh) 81C(Sys_PushFPCW_SetHigh): 82 fnstcw pushed_cw 83 fldcw full_cw 84 85 ret 86 87.globl C(Sys_PopFPCW) 88C(Sys_PopFPCW): 89 fldcw pushed_cw 90 91 ret 92 93.globl C(Sys_SetFPCW) 94C(Sys_SetFPCW): 95 fnstcw cw 96 movl cw,%eax 97#if id386 98 andb $0xF0,%ah 99 orb $0x03,%ah // round mode, 64-bit precision 100#endif 101 movl %eax,full_cw 102 103#if id386 104 andb $0xF0,%ah 105 orb $0x0C,%ah // chop mode, single precision 106#endif 107 movl %eax,single_cw 108 109#if id386 110 andb $0xF0,%ah 111 orb $0x08,%ah // ceil mode, single precision 112#endif 113 movl %eax,ceil_cw 114 115 ret 116 117