i386_get_ioperm.c revision 37917
137904Sjlemon/*-
237904Sjlemon * Copyright (c) 1998 Jonathan Lemon
337904Sjlemon * All rights reserved.
437904Sjlemon *
537904Sjlemon * Redistribution and use in source and binary forms, with or without
637904Sjlemon * modification, are permitted provided that the following conditions
737904Sjlemon * are met:
837904Sjlemon * 1. Redistributions of source code must retain the above copyright
937904Sjlemon *    notice, this list of conditions and the following disclaimer.
1037904Sjlemon * 2. Redistributions in binary form must reproduce the above copyright
1137904Sjlemon *    notice, this list of conditions and the following disclaimer in the
1237904Sjlemon *    documentation and/or other materials provided with the distribution.
1337904Sjlemon *
1437904Sjlemon * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1537904Sjlemon * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1637904Sjlemon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1737904Sjlemon * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1837904Sjlemon * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1937904Sjlemon * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2037904Sjlemon * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2137904Sjlemon * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2237904Sjlemon * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2337904Sjlemon * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2437904Sjlemon * SUCH DAMAGE.
2537904Sjlemon *
2637917Sjlemon *	$Id: i386_get_ioperm.c,v 1.1 1998/07/28 03:39:03 jlemon Exp $
2737904Sjlemon */
2837904Sjlemon
2937904Sjlemon#if defined(LIBC_RCS) && !defined(lint)
3037917Sjlemonstatic const char rcsid[] = "$Id: i386_get_ioperm.c,v 1.1 1998/07/28 03:39:03 jlemon Exp $";
3137904Sjlemon#endif /* LIBC_RCS and not lint */
3237904Sjlemon
3337904Sjlemon#include <machine/sysarch.h>
3437904Sjlemon
3537904Sjlemonstruct parms {
3637917Sjlemon	unsigned int 	start;
3737917Sjlemon	unsigned int	length;
3837904Sjlemon        int	 	enable;
3937904Sjlemon};
4037904Sjlemon
4137904Sjlemonint
4237917Sjlemoni386_get_ioperm(unsigned int start, unsigned int *length, int *enable)
4337904Sjlemon{
4437904Sjlemon	struct parms p;
4537904Sjlemon	int error;
4637904Sjlemon
4737904Sjlemon	p.start = start;
4837904Sjlemon	p.length = *length;
4937904Sjlemon	p.enable = *enable;
5037904Sjlemon
5137904Sjlemon	error = sysarch(I386_GET_IOPERM, (char *)&p);
5237904Sjlemon
5337904Sjlemon	*length = p.length;
5437904Sjlemon	*enable = p.enable;
5537904Sjlemon
5637904Sjlemon	return (error);
5737904Sjlemon}
58