+waitpid()
[meinos.git] / kernel2 / ioport.c
blob4fb41a4d6711af36f9197ac9045e18f3cbbefac0
1 /*
2 meinOS - A unix-like x86 microkernel operating system
3 Copyright (C) 2008 Janosch Gräf <janosch.graef@gmx.net>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include <sys/types.h>
20 #include <ioport.h>
21 #include <syscall.h>
23 int ioport_init() {
24 iopb_general = malloc(IOPORT_MAXNUM/sizeof(*iopb_general));
25 if (syscall_create(SYSCALL_IO_REG,ioport_reg,1)==-1) return -1;
26 if (syscall_create(SYSCALL_IO_UNREG,ioport_unreg,1)==-1) return -1;
27 return 0;
30 int ioport_reg(unsigned int port) {
31 /*if (port>=IOPORT_MAXNUM) return -ENOENT;
32 if (proc_current->iopb==NULL) return -EPERM;
33 if (IOPORT_ISREG(iopb_general,port)) return -EEXIST;
35 IOPORT_REG(iopb_general,port);
36 IOPORT_REG(proc_current->iopb,port);*/
37 return 0;
40 int ioport_unreg(unsigned int port) {
41 /*if (port>=IOPORT_MAXNUM) return -ENOENT;
42 if (proc_current->iopb==NULL) return -EPERM;
43 if (!IOPORT_ISREG(proc_current->iopb,port)) return -EPERM;
45 IOPORT_UNREG(iopb_general,port);
46 IOPORT_UNREG(proc_current->iopb,port);*/
47 return 0;