2 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
3 * Alexander Warg <warg@os.inf.tu-dresden.de>
4 * economic rights: Technische Universität Dresden (Germany)
6 * This file is part of TUD:OS and distributed under the terms of the
7 * GNU General Public License 2.
8 * Please see the COPYING-GPL-2 file for details.
14 #include <l4/sys/types.h>
15 #include <l4/sys/ipc.h>
17 #include <l4/cxx/iostream>
19 enum { PORT_SHIFT = 12 };
21 static Mem_man io_ports;
23 void init_io_ports(l4_kernel_info_t * /*info*/)
25 io_ports.add_free(Region::kr(0, (64*1024) << PORT_SHIFT));
30 L4::cout << "IO PORTS--------------------------\n";
34 void handle_io_page_fault(l4_umword_t t, l4_utcb_t *utcb, Answer *a)
36 unsigned long port, size;
37 l4_fpage_t fp = (l4_fpage_t&)l4_utcb_mr_u(utcb)->mr[0];
38 port = l4_fpage_page(fp) << PORT_SHIFT;
39 size = l4_fpage_size(fp) + PORT_SHIFT;
41 unsigned long i = io_ports.alloc(Region::bs(port, 1UL << size, t));
43 a->snd_fpage(l4_iofpage(port >> PORT_SHIFT, size - PORT_SHIFT));