8 #include "jdb_module.h"
10 #include "mem_layout.h"
13 #include "static_init.h"
16 class Jdb_iomap : public Jdb_module
19 Jdb_iomap() FIASCO_INIT;
21 static char first_char;
26 char Jdb_iomap::first_char;
27 Space *Jdb_iomap::space;
33 // base addresses of the two IO bitmap pages
34 Address bitmap_1, bitmap_2;
35 bitmap_1 = space->virt_to_phys(Mem_layout::Io_bitmap);
36 bitmap_2 = space->virt_to_phys(Mem_layout::Io_bitmap + Config::PAGE_SIZE);
40 printf("\nIO bitmap for space %p ", space);
41 if(bitmap_1 == ~0UL && bitmap_2 == ~0UL)
42 { // no memory mapped for the IO bitmap
48 putstr("mapped to [");
50 printf(L4_PTR_FMT " ", (Address)Kmem::phys_to_virt(bitmap_1));
55 printf("/ " L4_PTR_FMT, (Address)Kmem::phys_to_virt(bitmap_2));
60 puts("]\n\nPorts assigned:");
62 bool mapped = false, any_mapped = false;
65 for(unsigned i = 0; i < Mem_layout::Io_port_max; i++ )
67 if (space->io_lookup(i) != mapped)
71 mapped = any_mapped = true;
84 printf("%04x ", (unsigned)Mem_layout::Io_port_max -1);
89 printf("\n\nPort counter: %lu ", space->get_io_counter() );
90 if(count == space->get_io_counter())
93 printf("%sshould be %u\033[m\n", Jdb::esc_emph, count);
97 Jdb_module::Action_code
98 Jdb_iomap::action(int cmd, void *&args, char const *&fmt, int &next_char)
102 if (args == &first_char)
104 if (isxdigit(first_char))
108 next_char = first_char;
109 return EXTRA_INPUT_WITH_NEXTCHAR;
114 else if (args != &task)
120 space = cxx::dyn_cast<Task*>(reinterpret_cast<Kobject*>(task));
131 Jdb_module::Cmd const *
132 Jdb_iomap::cmds() const
136 { 0, "r", "iomap", "%C",
137 "r[<taskno>]\tdisplay IO bitmap of current/given task",
145 Jdb_iomap::num_cmds() const
151 Jdb_iomap::Jdb_iomap()
155 static Jdb_iomap jdb_iomap INIT_PRIORITY(JDB_MODULE_INIT_PRIO);