Annotation of sys/arch/alpha/alpha/sys_machdep.c, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: sys_machdep.c,v 1.6 2002/04/28 20:55:14 pvalchev Exp $ */
! 2: /* $NetBSD: sys_machdep.c,v 1.14 2002/01/14 00:53:16 thorpej Exp $ */
! 3:
! 4: /*-
! 5: * Copyright (c) 2000 The NetBSD Foundation, Inc.
! 6: * All rights reserved.
! 7: *
! 8: * This code is derived from software contributed to The NetBSD Foundation
! 9: * by Jason R. Thorpe.
! 10: *
! 11: * Redistribution and use in source and binary forms, with or without
! 12: * modification, are permitted provided that the following conditions
! 13: * are met:
! 14: * 1. Redistributions of source code must retain the above copyright
! 15: * notice, this list of conditions and the following disclaimer.
! 16: * 2. Redistributions in binary form must reproduce the above copyright
! 17: * notice, this list of conditions and the following disclaimer in the
! 18: * documentation and/or other materials provided with the distribution.
! 19: * 3. All advertising materials mentioning features or use of this software
! 20: * must display the following acknowledgement:
! 21: * This product includes software developed by the NetBSD
! 22: * Foundation, Inc. and its contributors.
! 23: * 4. Neither the name of The NetBSD Foundation nor the names of its
! 24: * contributors may be used to endorse or promote products derived
! 25: * from this software without specific prior written permission.
! 26: *
! 27: * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
! 28: * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! 29: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! 30: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
! 31: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! 32: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! 33: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! 34: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! 35: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! 36: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! 37: * POSSIBILITY OF SUCH DAMAGE.
! 38: */
! 39:
! 40: /*
! 41: * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
! 42: * All rights reserved.
! 43: *
! 44: * Author: Chris G. Demetriou
! 45: *
! 46: * Permission to use, copy, modify and distribute this software and
! 47: * its documentation is hereby granted, provided that both the copyright
! 48: * notice and this permission notice appear in all copies of the
! 49: * software, derivative works or modified versions, and any portions
! 50: * thereof, and that both notices appear in supporting documentation.
! 51: *
! 52: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
! 53: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
! 54: * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
! 55: *
! 56: * Carnegie Mellon requests users of this software to return to
! 57: *
! 58: * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
! 59: * School of Computer Science
! 60: * Carnegie Mellon University
! 61: * Pittsburgh PA 15213-3890
! 62: *
! 63: * any improvements or extensions that they make and grant Carnegie the
! 64: * rights to redistribute these changes.
! 65: */
! 66:
! 67: #include <sys/param.h>
! 68: #include <sys/systm.h>
! 69: #ifndef NO_IEEE
! 70: #include <sys/device.h>
! 71: #include <sys/proc.h>
! 72: #endif
! 73:
! 74: #include <sys/mount.h>
! 75: #include <sys/syscallargs.h>
! 76:
! 77: #ifndef NO_IEEE
! 78: #include <machine/fpu.h>
! 79: #include <machine/sysarch.h>
! 80:
! 81: #include <dev/pci/pcivar.h>
! 82:
! 83: int
! 84: sys_sysarch(struct proc *p, void *v, register_t *retval)
! 85: {
! 86: struct sys_sysarch_args /* {
! 87: syscallarg(int) op;
! 88: syscallarg(void *) parms;
! 89: } */ *uap = v;
! 90: int error = 0;
! 91:
! 92: switch(SCARG(uap, op)) {
! 93: case ALPHA_FPGETMASK:
! 94: *retval = FP_C_TO_OPENBSD_MASK(p->p_md.md_flags);
! 95: break;
! 96: case ALPHA_FPGETSTICKY:
! 97: *retval = FP_C_TO_OPENBSD_FLAG(p->p_md.md_flags);
! 98: break;
! 99: case ALPHA_FPSETMASK:
! 100: case ALPHA_FPSETSTICKY:
! 101: {
! 102: fp_except m;
! 103: u_int64_t md_flags;
! 104: struct alpha_fp_except_args args;
! 105:
! 106: error = copyin(SCARG(uap, parms), &args, sizeof args);
! 107: if (error)
! 108: return error;
! 109: m = args.mask;
! 110: md_flags = p->p_md.md_flags;
! 111: switch (SCARG(uap, op)) {
! 112: case ALPHA_FPSETMASK:
! 113: *retval = FP_C_TO_OPENBSD_MASK(md_flags);
! 114: md_flags = SET_FP_C_MASK(md_flags, m);
! 115: break;
! 116: case ALPHA_FPSETSTICKY:
! 117: *retval = FP_C_TO_OPENBSD_FLAG(md_flags);
! 118: md_flags = SET_FP_C_FLAG(md_flags, m);
! 119: break;
! 120: }
! 121: alpha_write_fp_c(p, md_flags);
! 122: break;
! 123: }
! 124: case ALPHA_GET_FP_C:
! 125: {
! 126: struct alpha_fp_c_args args;
! 127:
! 128: args.fp_c = alpha_read_fp_c(p);
! 129: error = copyout(&args, SCARG(uap, parms), sizeof args);
! 130: break;
! 131: }
! 132: case ALPHA_SET_FP_C:
! 133: {
! 134: struct alpha_fp_c_args args;
! 135:
! 136: error = copyin(SCARG(uap, parms), &args, sizeof args);
! 137: if (error)
! 138: return (error);
! 139: if ((args.fp_c >> 63) != 0)
! 140: args.fp_c |= IEEE_INHERIT;
! 141: alpha_write_fp_c(p, args.fp_c);
! 142: break;
! 143: }
! 144:
! 145: default:
! 146: error = EINVAL;
! 147: break;
! 148: }
! 149:
! 150: return (error);
! 151: }
! 152: #else
! 153: int sys_sysarch(struct proc *p, void *v, register_t *retval)
! 154: {
! 155: return (ENOSYS);
! 156: }
! 157: #endif
CVSweb