Annotation of OpenXM_contrib/gnuplot/ctrl87.c, Revision 1.1
1.1 ! maekawa 1: /* $Id: ctrl87.c,v 1.2 1998/03/22 22:31:27 drd Exp $ */
! 2:
! 3:
! 4: /* GNUPLOT - ctrl87.c */
! 5:
! 6: /*[
! 7: * Copyright 1986 - 1993, 1998 Thomas Williams, Colin Kelley
! 8: *
! 9: * Permission to use, copy, and distribute this software and its
! 10: * documentation for any purpose with or without fee is hereby granted,
! 11: * provided that the above copyright notice appear in all copies and
! 12: * that both that copyright notice and this permission notice appear
! 13: * in supporting documentation.
! 14: *
! 15: * Permission to modify the software is granted, but not the right to
! 16: * distribute the complete modified source code. Modifications are to
! 17: * be distributed as patches to the released version. Permission to
! 18: * distribute binaries produced by compiling modified sources is granted,
! 19: * provided you
! 20: * 1. distribute the corresponding source modifications from the
! 21: * released version in the form of a patch file along with the binaries,
! 22: * 2. add special version identification to distinguish your version
! 23: * in addition to the base release version number,
! 24: * 3. provide your name and address as the primary contact for the
! 25: * support of your modified version, and
! 26: * 4. retain our contact information in regard to use of the base
! 27: * software.
! 28: * Permission to distribute the released version of the source code along
! 29: * with corresponding source modifications in the form of a patch file is
! 30: * granted with same provisions 2 through 4 for binary distributions.
! 31: *
! 32: * This software is provided "as is" without express or implied warranty
! 33: * to the extent permitted by applicable law.
! 34: ]*/
! 35:
! 36:
! 37: #define __CONTROL87_C__
! 38:
! 39:
! 40: #include "ctrl87.h"
! 41:
! 42:
! 43: /***** _control87 *****/
! 44: unsigned short _control87(unsigned short newcw, unsigned short mask)
! 45: {
! 46: unsigned short cw;
! 47:
! 48: asm volatile(" \n\
! 49: wait \n\
! 50: fstcw %0 "
! 51: : /* outputs */ "=g" (cw)
! 52: : /* inputs */
! 53: );
! 54:
! 55: if(mask) { /* mask is not 0 */
! 56: asm volatile(" \n\
! 57: mov %2, %%ax \n\
! 58: mov %3, %%bx \n\
! 59: and %%bx, %%ax \n\
! 60: not %%bx \n\
! 61: nop \n\
! 62: wait \n\
! 63: mov %1, %%dx \n\
! 64: and %%bx, %%dx \n\
! 65: or %%ax, %%dx \n\
! 66: mov %%dx, %0 \n\
! 67: wait \n\
! 68: fldcw %1 "
! 69: : /* outputs */ "=g" (cw)
! 70: : /* inputs */ "g" (cw), "g" (newcw), "g" (mask)
! 71: : /* registers */ "ax", "bx", "dx"
! 72: );
! 73: }
! 74:
! 75: return cw;
! 76: } /* _control87 */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>