]> rtime.felk.cvut.cz Git - l4.git/commitdiff
update
authorl4check <l4check@d050ee49-bd90-4346-b210-929a50b99cfc>
Mon, 14 Feb 2011 10:32:37 +0000 (10:32 +0000)
committerl4check <l4check@d050ee49-bd90-4346-b210-929a50b99cfc>
Mon, 14 Feb 2011 10:32:37 +0000 (10:32 +0000)
git-svn-id: http://svn.tudos.org/repos/oc/tudos/trunk@30 d050ee49-bd90-4346-b210-929a50b99cfc

61 files changed:
kernel/fiasco/src/Makefile
kernel/fiasco/src/Modules.ux
kernel/fiasco/src/jdb/jdb_attach_irq.cpp
kernel/fiasco/src/jdb/jdb_io_apic.cpp
kernel/fiasco/src/jdb/jdb_tcb.cpp
kernel/fiasco/src/jdb/jdb_thread_list.cpp
kernel/fiasco/src/kern/arm/bsp/config-arm-pxa_sa1100.cpp
kernel/fiasco/src/kern/arm/bsp/imx/config-arm-imx.cpp
kernel/fiasco/src/kern/arm/bsp/integrator/config-arm-integrator.cpp
kernel/fiasco/src/kern/arm/bsp/kirkwood/config-arm-kirkwood.cpp
kernel/fiasco/src/kern/arm/bsp/omap3/config-arm-omap3.cpp
kernel/fiasco/src/kern/arm/bsp/realview/config-arm-realview.cpp
kernel/fiasco/src/kern/arm/bsp/s3c/config-arm-s3c2410.cpp
kernel/fiasco/src/kern/arm/bsp/tegra2/config-arm-tegra2.cpp
kernel/fiasco/src/kern/arm/thread-arm.cpp
kernel/fiasco/src/kern/context-vcpu.cpp
kernel/fiasco/src/kern/dirq_io_apic.cpp
kernel/fiasco/src/kern/fpu.cpp
kernel/fiasco/src/kern/hpet.cpp
kernel/fiasco/src/kern/ia32/32/entry.S
kernel/fiasco/src/kern/ia32/32/mem_layout-ia32-32.cpp
kernel/fiasco/src/kern/ia32/32/thread-ia32-32.cpp
kernel/fiasco/src/kern/ia32/64/mem_layout-ia32-64.cpp
kernel/fiasco/src/kern/ia32/64/thread-ia32-64.cpp
kernel/fiasco/src/kern/ia32/config-ia32.cpp
kernel/fiasco/src/kern/ia32/context-ia32.cpp
kernel/fiasco/src/kern/ia32/cpu-ia32.cpp
kernel/fiasco/src/kern/ia32/dirq_pic_pin-ia32-ux.cpp
kernel/fiasco/src/kern/ia32/kernel_thread-ia32.cpp
kernel/fiasco/src/kern/ia32/kmem-ia32.cpp
kernel/fiasco/src/kern/ia32/mem_layout-ia32.cpp
kernel/fiasco/src/kern/ia32/startup-ia32.cpp
kernel/fiasco/src/kern/ia32/vm_svm.cpp
kernel/fiasco/src/kern/ia32/vm_vmx.cpp
kernel/fiasco/src/kern/io_apic.cpp
kernel/fiasco/src/kern/irq_controller.cpp
kernel/fiasco/src/kern/ppc32/bsp/mpc52xx/config-ppc32-mpc52xx.cpp
kernel/fiasco/src/kern/ppc32/bsp/qemu/config-ppc32-qemu.cpp
kernel/fiasco/src/kern/ppc32/thread-ppc32.cpp
kernel/fiasco/src/kern/syscalls.cpp
kernel/fiasco/src/kern/tcboffset_in.h
kernel/fiasco/src/kern/thread-ipc.cpp
kernel/fiasco/src/kern/thread.cpp
kernel/fiasco/src/kern/ux/config-ux.cpp
kernel/fiasco/src/kern/ux/cpu-ux.cpp
kernel/fiasco/src/kern/ux/mem_layout-ux.cpp
kernel/fiasco/src/kern/ux/usermode.cpp
l4/conf/Makeconf.boot.example
l4/pkg/bootstrap/server/src/gunzip.c
l4/pkg/bootstrap/server/src/uncompress.c
l4/pkg/examples/sys/vcpu/vcpu.cc
l4/pkg/fuxfprov/server/src/main.cc
l4/pkg/io/server/src/pci.cc
l4/pkg/l4con/server/src/ev.c
l4/pkg/l4re/util/include/region_mapping_svr
l4/pkg/l4sys/include/thread.h
l4/pkg/libstdc++-v3/contrib.inc
l4/pkg/libvbus/include/vbus.h
l4/pkg/libvbus/include/vbus_types.h
l4/pkg/libvcpu/include/vcpu
l4/pkg/libvcpu/lib/src/vcpu.cc

index 66c8bbafc49ddc25c055007ed8d54459f36fcd85..1bcd2748f3e9283962ebcc02365ec6a936f4af65 100644 (file)
@@ -84,6 +84,7 @@ else # ! no ABI
 include $(srcdir)/Makeconf
 
 include $(MODULES_FILE)
+MODULES_FILES += $(srcdir)/Modules.generic
 
 ifdef SUBSYSTEMS
  _modules_read_ = true
index 08d7f11e8a802940224c4bfc18b6fd43b2644ad6..fa6067d4277f339a4f8aff0a5d6bfe989f1d1410 100644 (file)
@@ -67,7 +67,7 @@ VPATH                 += kern/$(CONFIG_XARCH) kern/ia32/32 kern/ia32 kern
 VPATH                  += jdb/ia32 jdb/ia32/32 jdb/ux jdb
 PRIVATE_INCDIR         += kern/$(CONFIG_XARCH) kern/ia32/32 kern/ia32 kern
 
-KERNEL_EXTRA-$(CONFIG_UX_CON)) += ux_con
+KERNEL_EXTRA-$(CONFIG_UX_CON)  += ux_con
 KERNEL_EXTRA-$(CONFIG_UX_NET)  += ux_net
 KERNEL_EXTRA            += $(KERNEL_EXTRA-y)
 
index 8c83e6b3186e2c9aaf2051219797605da979038d..4f9cb52ab29c1e466459212eab282334ba27a17f 100644 (file)
@@ -52,7 +52,7 @@ Jdb_attach_irq::action( int cmd, void *&args, char const *&, int & )
            {
              Irq *r;
              putchar('\n');
-             for (unsigned i = 0; i < Config::Max_num_irqs; ++i)
+              for (unsigned i = 0; i < Config::Max_num_dirqs; ++i)
                {
                  r = static_cast<Irq*>(Irq_chip::hw_chip->irq(i));
                  if (!r)
@@ -168,32 +168,25 @@ PUBLIC
 Kobject_common *
 Jdb_kobject_irq::follow_link(Kobject_common *o)
 {
-  Irq_sender *t = dcast<Irq_sender*>(Kobject::from_dbg(o->dbg_info()));
-  if (!t || !t->owner() || (Smword)t->owner() == -1)
-    return o;
-
-  return Kobject::from_dbg(static_cast<Thread*>(t->owner())->dbg_info());
+  Irq_sender *t = Kobject::dcast<Irq_sender*>(o);
+  return t ? Kobject::pointer_to_obj(t->owner()) : 0;
 }
 
 PUBLIC
 bool
 Jdb_kobject_irq::show_kobject(Kobject_common *, int)
 { return true; }
-#if 0
-  Thread *t = Kobject::dcast<Thread*>(o);
-  return show(t, level);
-#endif
 
 PUBLIC
 int
 Jdb_kobject_irq::show_kobject_short(char *buf, int max, Kobject_common *o)
 {
-  Irq *t = Kobject::dcast<Irq*>(o);
-  Kobject_common *d = follow_link(o);
-  int cnt = 0;
-  return cnt + snprintf(buf, max, " I=%3lx %s L=%lx T=%lx F=%x",
-                        t->irq(), t->pin()->pin_type(), t->obj_id(),
-                        d ? d->dbg_info()->dbg_id() : 0, (unsigned)t->pin()->flags());
+  Irq_sender *t = Kobject::dcast<Irq_sender*>(o);
+  Kobject_common *w = follow_link(o);
+  return snprintf(buf, max, " I=%3lx %s L=%lx T=%lx F=%x",
+                  t->irq(), t->pin()->pin_type(), t->obj_id(),
+                  w ? w->dbg_info()->dbg_id() : 0,
+                 (unsigned)t->pin()->flags());
 }
 
 static
index 9025c89fdadc5adb6e1885593c0b053776cf0612..6261689fe79d1aaf236e88e07cf13ef2380ebd92 100644 (file)
@@ -68,7 +68,14 @@ Jdb_io_apic_module::action (int cmd, void *&, char const *&, int &)
       return NOTHING;
     }
   printf("\nState of IO APIC\n");
-  Io_apic::dump();
+  for (unsigned i = 0; i < Io_apic::Max_ioapics; ++i)
+    {
+      Io_apic *a = Io_apic::apic(i);
+      if (!a->valid())
+       break;
+
+      a->dump();
+    }
 
   // print global LAPIC state
   unsigned khz;
index ae56f69ca26b1cade3a528368df710ef1baf0095..f9a24b5d023de8474988f1d90a5064f83f85f684 100644 (file)
@@ -506,29 +506,29 @@ whole_screen:
 
   char time_str[12];
 
-  putstr("thread: ");
+  putstr("thread  : ");
   Jdb_kobject::print_uid(t, 3);
   print_thread_uid_raw(t);
-  printf("CPU %3u ", t->cpu());
+  printf("\tCPU: %u ", t->cpu());
 
   printf("\tprio: %02x  mode: %s\n",
          t->sched()->prio(),
          t->mode() & Context::Periodic  ?
          t->mode() & Context::Nonstrict ? "Per (IRT)" : "Per (SP)" : "Con");
 
-  printf("state: %03lx ", t->state(false));
+  printf("state   : %03lx ", t->state(false));
   Jdb_thread::print_state_long(t);
 
-  putstr("\n\nwait for: ");
+  putstr("\nwait for: ");
   if (!t->partner())
-    putstr("--- ");
+    putstr("---  ");
   else
     Jdb_thread::print_partner(t, 4);
 
-  putstr("   polling: ");
+  putstr(" polling: ");
   Jdb_thread::print_snd_partner(t, 3);
 
-  putstr("\trcv descr: ");
+  putstr("rcv descr: ");
 
   if (t->state(false) & Thread_ipc_receiving_mask)
     printf("%08lx", t->rcv_regs()->from_spec());
@@ -563,18 +563,18 @@ whole_screen:
         t->sched()->left(), t->sched()->quantum(), Config::char_micro);
   print_kobject(t, t->_pager.raw());
 
-  putstr("\ttask: ");
+  putstr("\ttask     : ");
   if (t->space() == Kernel_task::kernel_task())
     putstr(" kernel        ");
   else
     print_kobject(static_cast<Task*>(t->space()));
 
-  putstr("\tutcb: ");
-  printf("%08lx", (Mword)t->utcb().kern());
-
   putstr("\nexc-hndl: ");
   print_kobject(t, t->_exc_handler.raw());
 
+  printf("\tUTCB     : %08lx/%08lx",
+         (Mword)t->utcb().kern(), (Mword)t->utcb().usr().get());
+
 #if 0
   putstr("\tready  lnk: ");
   if (t->state(false) & Thread_ready)
@@ -599,22 +599,23 @@ whole_screen:
 
   putchar('\n');
 
-  putstr("vCPU  st: ");
+  putstr("vCPU    : ");
   if (t->state(false) & Thread_vcpu_enabled)
     {
       char st1[7];
       char st2[7];
       Vcpu_state *v = t->vcpu_state().kern();
-      printf("c=%s s=%s sf=%c e-ip=%08lx e-sp=%08lx S=",
+      printf("%08lx/%08lx S=", (Mword)v, (Mword)t->vcpu_state().usr().get());
+      print_kobject(static_cast<Task*>(t->vcpu_user_space()));
+      putchar('\n');
+      printf("vCPU    : c=%s s=%s sf=%c e-ip=%08lx e-sp=%08lx\n",
              vcpu_state_str(v->state, st1, sizeof(st1)),
              vcpu_state_str(v->_saved_state, st2, sizeof(st2)),
              (v->sticky_flags & Vcpu_state::Sf_irq_pending) ? 'P' : '-',
              v->_entry_ip, v->_entry_sp);
-      print_kobject(static_cast<Task*>(t->vcpu_user_space()));
     }
   else
-    putstr("---");
-  putchar('\n');
+    putstr("---\nvCPU    : ---\n");
 
   Address ksp  = is_current_thread ? ef->ksp()
                                   : (Address)t->get_kernel_sp();
index bd7ad0d31b84a3fcb96dd2a63def2ca746adf490..fd9cf076f539bf2467a3c6b0febc58d0ffde791c 100644 (file)
@@ -746,7 +746,7 @@ Jdb_thread_list::list_threads(Thread *t_start, char pr)
                                        Thread_busy  |
                                        Thread_rcvlong_in_progress))
                      && (!t->partner()->id().is_irq() ||
-                          t->partner()->id().irq() > Config::Max_num_irqs))
+                          t->partner()->id().irq() > Config::Max_num_dirqs))
                    {
                      t_current = static_cast<Thread*>(t->partner());
                      redraw = true;
index ff98dcddd9bf10dfb0e432ee59124894be76c6e6..943183a3ab72cc3d1166e4177710ec14854d6ff5 100644 (file)
@@ -13,12 +13,7 @@ public:
   enum
   {
     Scheduling_irq       = 26,
-    scheduler_irq_vector = Scheduling_irq,
-    Max_num_irqs         = 64,
     Max_num_dirqs        = 32,
-
-    Vkey_irq             = 27,
-    Tbuf_irq             = 28,
   };
 };
 
index 5e5cbc316b48ad1af6946be35bf155805c7312d8..e03f69c6f1126abe0926508be5f907413accbfc0 100644 (file)
@@ -8,11 +8,7 @@ public:
   enum
   {
     Scheduling_irq       = 26,
-    scheduler_irq_vector = Scheduling_irq,
-    Max_num_irqs         = 66,
     Max_num_dirqs        = 64,
-    Vkey_irq             = 64,
-    Tbuf_irq             = 65,
   };
 };
 
@@ -26,11 +22,7 @@ public:
   enum
   {
     Scheduling_irq       = 40,
-    scheduler_irq_vector = Scheduling_irq,
-    Max_num_irqs         = 130,
     Max_num_dirqs        = 128,
-    Vkey_irq             = 128,
-    Tbuf_irq             = 129,
   };
 };
 
index b283f50866be84620a4fed41697a7e2d2615f169..7c84754ae5ff38d05d0e17d9fb3751d9eab08b67 100644 (file)
@@ -8,11 +8,7 @@ public:
   enum
   {
     Scheduling_irq       = 6,
-    scheduler_irq_vector = Scheduling_irq,
-    Max_num_irqs         = 50,
     Max_num_dirqs        = 48,
-    Vkey_irq             = 48,
-    Tbuf_irq             = 49,
   };
 };
 
index b7f25cc608b158ab4e35980ea0201c1e5a023c40..679b0c0575288447dcf3b2fa8336dca05b6f64f9 100644 (file)
@@ -7,13 +7,7 @@ EXTENSION class Config
 public:
   enum
   {
-    Max_num_irqs         = 66,
     Max_num_dirqs        = 64,
-
-    Vkey_irq             = 64,
-    Tbuf_irq             = 65,
-
     Scheduling_irq       = 1,
-    scheduler_irq_vector = Scheduling_irq,
   };
 };
index 5bafe56ecab03108b040f4b4b4b2de72d569122a..7cfd2d152e0147633ff30069c68cc34aaceeaf19 100644 (file)
@@ -12,11 +12,6 @@ public:
   enum
   {
     Scheduling_irq       = 37,
-    scheduler_irq_vector = Scheduling_irq,
-    Max_num_irqs         = 98,
     Max_num_dirqs        = 96,
-
-    Vkey_irq             = 96,
-    Tbuf_irq             = 97,
   };
 };
index 2b58c8eb80a8d4bb05abb9314900adb42d7d20b6..b92a83e3461d7470ebfb46407f479e7f554b5b0f 100644 (file)
@@ -7,11 +7,7 @@ EXTENSION class Config
 public:
   enum
   {
-    Max_num_irqs         = 258,
     Max_num_dirqs        = 256,
-
-    Vkey_irq             = 256,
-    Tbuf_irq             = 257,
   };
 };
 
@@ -23,7 +19,6 @@ public:
   enum
   {
     Scheduling_irq       = 36,
-    scheduler_irq_vector = Scheduling_irq,
   };
 };
 
@@ -35,7 +30,6 @@ public:
   enum
   {
     Scheduling_irq       = 29,
-    scheduler_irq_vector = Scheduling_irq,
   };
 };
 
index 8577f31ee01be3bb74fab2ff4ff5301abf3836c9..610898c1e87550ea6c13403332a07a091f4d0c0a 100644 (file)
@@ -8,11 +8,7 @@ public:
   enum
   {
     Scheduling_irq       = 14,
-    scheduler_irq_vector = Scheduling_irq,
-    Max_num_irqs         = 67,
     Max_num_dirqs        = 65,
-    Vkey_irq             = 65,
-    Tbuf_irq             = 66,
   };
 };
 
index fe5149723de7d8a1d64c6ce9b6c1bcfd829efceb..2d8fc444ff58d2815f515f09a0990b064b41e2d4 100644 (file)
@@ -7,13 +7,7 @@ EXTENSION class Config
 public:
   enum
   {
-    Max_num_irqs         = 258,
-    Max_num_dirqs        = 256,
-
-    Vkey_irq             = 256,
-    Tbuf_irq             = 257,
-
+    Max_num_dirqs        = 160,
     Scheduling_irq       = 29,
-    scheduler_irq_vector = Scheduling_irq,
   };
 };
index 3fa00c2bcf81ea6410b3cbaa5b5e1996e772f85b..3a7786412b0f8636d5717473ee4ba545fb215c88 100644 (file)
@@ -47,11 +47,13 @@ Thread::print_page_fault_error(Mword e)
          (e & 0x00020000)?'r':'w');
 }
 
-PUBLIC template<typename T> inline
+PUBLIC inline
 void FIASCO_NORETURN
-Thread::fast_return_to_user(Mword ip, Mword sp, arg)
+Thread::fast_return_to_user(Mword ip, Mword sp, Vcpu_state *arg)
 {
   extern char __iret[];
+  assert_kdb((regs()->psr & Proc::Status_mode_mask) == Proc::Status_mode_user);
+
   regs()->ip(ip);
   regs()->sp(sp); // user-sp is in lazy user state and thus handled by
                   // fill_user_state()
@@ -60,7 +62,7 @@ Thread::fast_return_to_user(Mword ip, Mword sp, T arg)
   regs()->psr &= ~Proc::Status_thumb;
 
     {
-      register Mword r0 asm("r0") = (Mword)arg;
+      register Vcpu_state *r0 asm("r0") = arg;
 
       asm volatile
        ("mov sp, %0  \t\n"
@@ -142,8 +144,8 @@ extern "C" {
   {
 #if 0 // Double PF detect
     static unsigned long last_pfa = ~0UL;
-    LOG_MSG_3VAL(current(),"PF", pfa, last_pfa, pc);
-    if (last_pfa == pfa)
+    LOG_MSG_3VAL(current(),"PF", pfa, error_code, pc);
+    if (last_pfa == pfa || pfa == 0)
       kdb_ke("DBF");
     last_pfa = pfa;
 #endif
index a926f97e760a090fd6016df7b9fee2f9e3601ed7..6fdf6551dadde10f344e32329954e5f0ce5698ed 100644 (file)
@@ -40,7 +40,7 @@ Context::vcpu_save_state_and_upcall()
 }
 
 PUBLIC inline NEEDS["fpu.h"]
-void
+bool
 Context::vcpu_enter_kernel_mode(Vcpu_state *vcpu)
 {
   if (EXPECT_FALSE(state() & Thread_vcpu_enabled))
@@ -66,9 +66,11 @@ Context::vcpu_enter_kernel_mode(Vcpu_state *vcpu)
                Fpu::enable();
 
              space()->switchin_context(vcpu_user_space());
+             return true;
            }
        }
     }
+  return false;
 }
 
 
index f5108362c639acfc137321f14561047c54440452..6370be8ae03931b182318d5e4972fb2fc34e5542 100644 (file)
@@ -26,6 +26,7 @@ IMPLEMENTATION:
 #include "receiver.h"
 #include "idt.h"
 #include "irq.h"
+#include "vkey.h"
 
 enum
 {
@@ -46,18 +47,21 @@ Dirq_io_apic::Chip::legacy_override(unsigned irq)
 IMPLEMENT
 unsigned
 Dirq_io_apic::Chip::nr_irqs() const
-{ return Io_apic::nr_irqs(); }
+{ return Io_apic::total_irqs(); }
 
 
 IMPLEMENT
 void
 Dirq_io_apic::Chip::setup(Irq_base *irq, unsigned irqnum)
 {
+  unsigned apic_idx = Io_apic::find_apic(irqnum);
+  irqnum -= Io_apic::apic(apic_idx)->gsi_offset();
+
   //irq->pin()->set_mode(Default_mode);
   if (irq->pin()->get_mode() & Irq::Trigger_level)
-    irq->pin()->replace<Pin_io_apic_level>(irqnum);
+    irq->pin()->replace<Pin_io_apic_level>(apic_idx, irqnum);
   else
-    irq->pin()->replace<Pin_io_apic_edge>(irqnum);
+    irq->pin()->replace<Pin_io_apic_edge>(apic_idx, irqnum);
 }
 
 IMPLEMENT
@@ -67,9 +71,15 @@ Dirq_io_apic::Chip::alloc(Irq_base *irq, unsigned irqnum)
   if (!Dirq_pic_pin::Chip::alloc(irq, irqnum))
     return false;
 
-  Io_apic_entry e = Io_apic::apic()->read_entry(irqnum);
+
+  unsigned apic_idx = Io_apic::find_apic(irqnum);
+  Io_apic *a = Io_apic::apic(apic_idx);
+  unsigned lirqn = irqnum - a->gsi_offset();
+
+
+  Io_apic_entry e = a->read_entry(lirqn);
   e.vector(vector(irqnum));
-  Io_apic::apic()->write_entry(irqnum, e);
+  a->write_entry(lirqn, e);
   return true;
 }
 
@@ -97,28 +107,50 @@ Mword to_io_apic_polarity(unsigned mode)
              : Io_apic_entry::High_active;
 }
 
-class Pin_io_apic_level : public Dirq_pic_pin
+class Pin_io_apic_level : public Irq_pin
 {
 public:
-  explicit Pin_io_apic_level(unsigned irq) : Dirq_pic_pin(irq) {}
+  explicit Pin_io_apic_level(unsigned apic, unsigned irq)
+  { payload()[0] = apic + (irq << 16); }
+
+  unsigned irq() const { return payload()[0] >> 16; }
+  unsigned apic_idx() const { return payload()[0] & 0xffff; }
+  Io_apic *apic() const { return Io_apic::apic(apic_idx()); }
+  unsigned gsi() const { return apic()->gsi_offset() + irq(); }
 };
 
 class Pin_io_apic_edge : public Pin_io_apic_level
 {
 public:
-  explicit Pin_io_apic_edge(unsigned irq) : Pin_io_apic_level(irq) {}
+  explicit Pin_io_apic_edge(unsigned apic, unsigned irq)
+  : Pin_io_apic_level(apic, irq) {}
 };
 
+PUBLIC
+bool
+Pin_io_apic_level::check_debug_irq()
+{
+  return !Vkey::check_(gsi());
+}
 
+PUBLIC
+void
+Pin_io_apic_level::unbind_irq()
+{
+  do_mask();
+  disable();
+  Irq_chip::hw_chip->free(Irq::self(this), gsi());
+  replace<Sw_irq_pin>();
+}
 
 PUBLIC
 void
 Pin_io_apic_level::disable()
 {
   extern char entry_int_apic_ignore[];
-  unsigned vector = this->vector();
+  unsigned vector = Dirq_pic_pin::Chip::vector(gsi());
+  Dirq_pic_pin::Chip::vfree(Irq_base::self(this), vector);
   Idt::set_entry(vector, Address(&entry_int_apic_ignore), false);
-  disable_vector();
 }
 
 PUBLIC void
@@ -132,12 +164,12 @@ Pin_io_apic_edge::do_mask_and_ack()
 PUBLIC void
 Pin_io_apic_edge::do_set_mode(unsigned mode)
 {
-  Io_apic_entry e = Io_apic::apic()->read_entry(irq());
+  Io_apic_entry e = apic()->read_entry(irq());
   e.polarity(to_io_apic_polarity(mode));
   e.trigger(to_io_apic_trigger(mode));
-  Io_apic::apic()->write_entry(irq(), e);
+  apic()->write_entry(irq(), e);
   if (mode & Irq::Trigger_level)
-    new (this) Pin_io_apic_level(irq());
+    new (this) Pin_io_apic_level(apic_idx(), irq());
 }
 
 
@@ -145,8 +177,8 @@ PUBLIC void
 Pin_io_apic_level::do_mask()
 {
   assert (cpu_lock.test());
-  Io_apic::mask(irq());
-  Io_apic::sync();
+  apic()->mask(irq());
+  apic()->sync();
 }
 
 
@@ -165,8 +197,8 @@ Pin_io_apic_level::do_mask_and_ack()
 {
   assert (cpu_lock.test());
   __mask();
-  Io_apic::mask(irq());
-  Io_apic::sync();
+  apic()->mask(irq());
+  apic()->sync();
   Apic::irq_ack();
 }
 
@@ -175,25 +207,25 @@ PUBLIC void
 Pin_io_apic_level::do_unmask()
 {
   assert (cpu_lock.test());
-  Io_apic::unmask(irq());
+  apic()->unmask(irq());
 }
 
 PUBLIC void
 Pin_io_apic_level::set_cpu(unsigned cpu)
 {
-  Io_apic::set_dest(irq(), Cpu::cpus.cpu(cpu).phys_id());
+  apic()->set_dest(irq(), Cpu::cpus.cpu(cpu).phys_id());
 }
 
 
 PUBLIC void
 Pin_io_apic_level::do_set_mode(unsigned mode)
 {
-  Io_apic_entry e = Io_apic::apic()->read_entry(irq());
+  Io_apic_entry e = apic()->read_entry(irq());
   e.polarity(to_io_apic_polarity(mode));
   e.trigger(to_io_apic_trigger(mode));
-  Io_apic::apic()->write_entry(irq(), e);
+  apic()->write_entry(irq(), e);
   if (!(mode & Irq::Trigger_level))
-    new (this) Pin_io_apic_edge(irq());
+    new (this) Pin_io_apic_edge(apic_idx(), irq());
 }
 
 
index 09629f02f039033bbccf58ea1fcebbb550edf2ca..6caf09e8954adf6318b6b8b5d26b8c404e47ace8 100644 (file)
@@ -75,7 +75,7 @@ unsigned Fpu::state_size()
 
 IMPLEMENT inline
 unsigned Fpu::state_align()
-{ return 0; }
+{ return 1; }
 
 IMPLEMENT
 void Fpu::init(unsigned)
index f1c4df8a2d6bf7648084a39689a9f2f0e6eb8068..17cf76f9c386ee3fb0bf3e99b48105c59ce4852c 100644 (file)
@@ -174,11 +174,14 @@ Hpet::init()
 
   Address offs;
   Address a = _acpi_hpet->base_address.addr;
-  Kmem::map_phys_page(a, Mem_layout::Hpet_page, false, true, &offs);
+  Address va = Mem_layout::alloc_io_vmem(Config::PAGE_SIZE);
+  assert (va);
+  Kmem::map_phys_page(a, va, false, true, &offs);
 
   Kip::k()->add_mem_region(Mem_desc(a, a + 1023, Mem_desc::Reserved));
 
-  _hpet = (Hpet_device *)(Mem_layout::Hpet_page + offs);
+  _hpet = (Hpet_device *)(va + offs);
 
   _hpet->dump();
 
index 9f306cc7a1a0af6544fe4498ae5cc2cbb89ae2a1..8948a31b1426bd974fc74936cf3f622532802c0e 100644 (file)
@@ -127,11 +127,13 @@ _slowtraps:
 slowtraps:
 #ifdef CONFIG_PF_UX
 # define REG_GS CPU_GS
+# define REG_FS CPU_FS
 #else
 # define REG_GS %gs
+# define REG_FS %fs
 #endif
 
-       pushl   %fs             /* we save the segment regs in the trap   */
+       pushl   REG_FS          /* we save the segment regs in the trap   */
        pushl   REG_GS          /* state, but we do not restore them.  We */
        pushl   %ds             /* rather reload them using               */
        pushl   %es             /* RESET_{KERNEL,USER}_SEGMENTS           */
@@ -183,7 +185,7 @@ in_slowtrap:
 
        addl    $4*2,%esp               /* Pop ds, es segment registers */
        popl    REG_GS
-       popl    %fs                     /* Restore segment registers */
+       popl    REG_FS                  /* Restore segment registers */
        popa
        addl    $4*2,%esp               /* Pop trap number and error code */
        iret
@@ -655,8 +657,8 @@ leave_by_vcpu_upcall:
        call    thread_restore_exc_state
 
        ESP_TO_TCB_AT %ecx
-       mov OFS__THREAD__USER_VCPU(%ecx), %eax /* vcpu state poiner from TCB */
-       mov OFS__THREAD__VCPU_STATE(%ecx), %ecx /* vcpu state poiner from TCB */
+       mov OFS__THREAD__USER_VCPU(%ecx), %eax /* vcpu state pointer from TCB */
+       mov OFS__THREAD__VCPU_STATE(%ecx), %ecx /* vcpu state pointer from TCB */
        addl $(VAL__SIZEOF_TRAP_STATE - 20), %ecx /* skip return frame */
        mov SCRATCH_REGISTER_SIZE(%esp),  %edx
        mov %edx, (%ecx)                                /* EIP */
@@ -685,13 +687,7 @@ leave_by_vcpu_upcall:
 
        /*add SCRATCH_REGISTER_SIZE, %esp*/
 
-#ifdef CONFIG_PF_UX
-# define REG_GS CPU_GS
-#else
-# define REG_GS %gs
-#endif
-
-       pushl   %fs             /* we save the segment regs in the trap   */
+       pushl   REG_FS          /* we save the segment regs in the trap   */
        pushl   REG_GS          /* state, but we do not restore them.  We */
        pushl   %ds             /* rather reload them using               */
        pushl   %es             /* RESET_{KERNEL,USER}_SEGMENTS           */
@@ -711,7 +707,7 @@ vcpu_resume:
        //popl %es
        //popl %ds
        popl REG_GS
-       popl %fs
+       popl REG_FS
        popa
        addl $(2*4), %esp
        iret
index 18aa1e2156f2c8f514d9062b74a7bd34c4c88b08..b2b72adf375ecf70a49902d4e77afe3dd18136cd 100644 (file)
@@ -23,12 +23,10 @@ public:
     Space_index       = 0xea000000,    ///< % 4MB
     Service_page      = 0xeac00000,    ///< % 4MB   global mappings
     Local_apic_page   = Service_page + 0x0000,   ///< % 4KB
-    Io_apic_page      = Service_page + 0x1000,
     Kmem_tmp_page_1   = Service_page + 0x2000,   ///< % 4KB size 8KB
     Kmem_tmp_page_2   = Service_page + 0x4000,   ///< % 4KB size 8KB
     Tbuf_status_page  = Service_page + 0x6000,   ///< % 4KB
     Tbuf_ustatus_page = Tbuf_status_page,
-    Hpet_page         = Service_page + 0x7000,   ///< % 4KB
     Jdb_bench_page    = Service_page + 0x8000,   ///< % 4KB
     Jdb_bts_area      = Service_page + 0xf000,   ///< % 4KB size 0x81000
     Utcb_ptr_page     = Service_page + 0xfd000,  ///< % 4KB
@@ -38,9 +36,8 @@ public:
     Tbuf_buffer_area  = Service_page + 0x200000, ///< % 2MB
     Tbuf_ubuffer_area = Tbuf_buffer_area,
     // 0xeb800000-0xec000000 (8MB) free
-    __free_1          = 0xec000000,    ///< % 4MB
-    __free_2          = 0xec400000,    ///< % 4MB
-    __free_3          = 0xec800000,    ///< % 4MB
+    Io_map_area_start = 0xec000000,
+    Io_map_area_end   = 0xec800000,
     __free_4          = 0xec880000,    ///< % 4MB
     Jdb_debug_start   = 0xecc00000,    ///< % 4MB   JDB symbols/lines
     Jdb_debug_end     = 0xee000000,    ///< % 4MB
index 992f2bd66a6a29a5db0d7f38868318dd9e82c2a7..a8be398bd66df6f4e9b0b3dff4c6fcb94f2d19fd 100644 (file)
@@ -6,6 +6,7 @@ Thread::fast_return_to_user(Mword ip, Mword sp, T arg)
 {
   assert_kdb(cpu_lock.test());
   assert_kdb(current() == this);
+  assert_kdb(Config::Is_ux || (regs()->cs() & 3 == 3));
 
   regs()->ip(ip);
   regs()->sp(sp);
index 2d460e55bb28b70ddab0869db99fe4325b61d600..535f8e4e238d3638e4c853ab6886595a77cd31ee 100644 (file)
@@ -23,12 +23,10 @@ public:
     Space_index       = 200,
     Service_page      = 0xffffffffeac00000UL,    ///< % 4MB global mappings
     Local_apic_page   = Service_page + 0x0000,   ///< % 4KB
-    Io_apic_page      = Service_page + 0x1000,   ///< % 4KB
     Kmem_tmp_page_1   = Service_page + 0x2000,   ///< % 4KB size 8KB
     Kmem_tmp_page_2   = Service_page + 0x4000,   ///< % 4KB size 8KB
     Tbuf_status_page  = Service_page + 0x6000,   ///< % 4KB
     Tbuf_ustatus_page = Tbuf_status_page,
-    Hpet_page         = Service_page + 0x7000,   ///< % 4KB
     Jdb_bench_page    = Service_page + 0x8000,   ///< % 4KB
     Utcb_ptr_page     = Service_page + 0xfd000,  ///< % 4KB
     Utcb_ptr_offset   = Utcb_ptr_page,
@@ -37,8 +35,8 @@ public:
     Tbuf_buffer_area  = Service_page + 0x200000, ///< % 2MB
     Tbuf_ubuffer_area = Tbuf_buffer_area,
     // 0xffffffffeb800000-0xfffffffffec000000 (8MB) free
-    ___free_1         = 0xffffffffec000000UL, ///< % 4MB
-    ___free_2         = 0xffffffffec400000UL, ///< % 4MB
+    Io_map_area_start = 0xffffffffec000000UL,
+    Io_map_area_end   = 0xffffffffec800000UL,
     ___free_3         = 0xffffffffec800000UL, ///< % 4MB
     ___free_4         = 0xffffffffec880000UL, ///< % 4MB
     Jdb_debug_start   = 0xffffffffecc00000UL,    ///< % 4MB   JDB symbols/lines
index 13745db770298829956032679e21216bf42643e0..910d10984d600babea9b44e49da1de34dc251d11 100644 (file)
@@ -6,6 +6,10 @@ PUBLIC template<typename T> inline
 void FIASCO_NORETURN
 Thread::fast_return_to_user(Mword ip, Mword sp, T arg)
 {
+  assert_kdb(cpu_lock.test());
+  assert_kdb(current() == this);
+  assert_kdb(regs()->cs() & 3 == 3);
+
   regs()->ip(ip);
   regs()->sp(sp);
   asm volatile
@@ -25,7 +29,7 @@ Thread::invoke_arch(L4_msg_tag & /*tag*/, Utcb * /*utcb*/)
 }
 
 IMPLEMENT inline
-Mword 
+Mword
 Thread::user_sp() const
 { return exception_triggered()?_exc_cont.sp(regs()):regs()->sp(); }
 
index 01b1986a9ef6aa8201158a7eb293aac2ca9827bd..6fae4713005d3d93ffc18fb10843232d3bd6b452 100644 (file)
@@ -12,11 +12,7 @@ public:
     // can access user memory directly
     Access_user_mem = Access_user_mem_direct,
 
-    Max_num_dirqs       = 32,
-
-    Tbuf_irq            = Max_num_dirqs + 0,
-
-    Max_num_irqs        = Max_num_dirqs + 4,
+    Max_num_dirqs       = 128,
 
     /// Timer vector used with APIC timer or IOAPIC
     Apic_timer_vector = APIC_IRQ_BASE + 0,
index d28e9ad92ab4e346979acc1665aee3b2b1a2c7cc..036e2be61046b479eced8b79d572a8e33293fbc8 100644 (file)
@@ -46,7 +46,7 @@ Context::switchin_context(Context *from)
   load_segments();
 
   // update the global UTCB pointer to make the thread find its UTCB
-  // using gs:[0]
+  // using fs:[0]
   Mem_layout::user_utcb_ptr(current_cpu()) = utcb().usr();
 }
 
index 4db8ed4cde0c5aee13df602447e48910e474f7ac..161108c617741fc45943c009c7fc48ab0d4d88cf 100644 (file)
@@ -1184,15 +1184,6 @@ Cpu::get_ss()
   return val;
 }
 
-PUBLIC static inline
-Unsigned32
-Cpu::get_fs()
-{
-  Unsigned32 val;
-  asm volatile ("mov %%fs, %0" : "=rm" (val));
-  return val;
-}
-
 PUBLIC static inline
 void
 Cpu::set_ds(Unsigned32 val)
@@ -1203,12 +1194,6 @@ void
 Cpu::set_es(Unsigned32 val)
 { asm volatile ("mov %0, %%es" : : "rm" (val)); }
 
-PUBLIC static inline
-void
-Cpu::set_fs(Unsigned32 val)
-{ asm volatile ("mov %0, %%fs" : : "rm" (val)); }
-
-
 //----------------------------------------------------------------------------
 IMPLEMENTATION[ia32, amd64]:
 
@@ -1668,11 +1653,21 @@ Cpu::enable_ldt(Address addr, int size)
 }
 
 
+PUBLIC static inline
+Unsigned32
+Cpu::get_fs()
+{ Unsigned32 val; asm volatile ("mov %%fs, %0" : "=rm" (val)); return val; }
+
 PUBLIC static inline
 Unsigned32
 Cpu::get_gs()
 { Unsigned32 val; asm volatile ("mov %%gs, %0" : "=rm" (val)); return val; }
 
+PUBLIC static inline
+void
+Cpu::set_fs(Unsigned32 val)
+{ asm volatile ("mov %0, %%fs" : : "rm" (val)); }
+
 PUBLIC static inline
 void
 Cpu::set_gs(Unsigned32 val)
index 1b26f2d4529d25559931f783d6dee7ea97e05671..c53ea4e55a6a82a84a5fdfde8b2f76e29ee09e75 100644 (file)
@@ -26,7 +26,7 @@ public:
     unsigned nr_irqs() const { return 16; }
 
     bool valloc(Irq_base *irq, unsigned vector);
-    bool vfree(Irq_base *irq, unsigned vector);
+    static bool vfree(Irq_base *irq, unsigned vector);
     virtual void disable_irq(unsigned vector);
 
   protected:
index b7d89c14cf5c0c55ffca1e8b7d6f229c7ba0d95d..29d035215aa2d5fc3b057cdd739eda43bd6f3690 100644 (file)
@@ -37,7 +37,7 @@ Kernel_thread::bootstrap_arch()
   //
   // initialize interrupts
   //
-  if (!Io_apic::apic())
+  if (!Io_apic::active())
     {
       Irq_chip::hw_chip->reserve(2);           // reserve cascade irq
       Pic::enable_locked(2);                   // allow cascaded irqs
@@ -64,7 +64,7 @@ Kernel_thread::bootstrap_arch()
     }
   else
     {
-      if (!Io_apic::apic() && !user_irq0
+      if (!Io_apic::active() && !user_irq0
           && !Config::scheduler_mode == Config::SCHED_PIT)
        Irq_chip::hw_chip->reserve(0); // reserve irq0 even though
     }
index 31ac0a66141bec54f2c1191bf4f6097d9850e765..069f6b76873b5ade9bf7cbafcdf457090f4008c7 100644 (file)
@@ -296,7 +296,8 @@ void
 Kmem::map_phys_page(Address phys, Address virt,
                     bool cached, bool global, Address *offs=0)
 {
-  Pdir::Iter i = kdir->walk(Virt_addr(virt));
+  Pdir::Iter i = kdir->walk(Virt_addr(virt), 100, Mapped_allocator::allocator()
+);
   Pte_base *e = i.e;
   Mword pte = phys & Config::PAGE_MASK;
 
index a2152b0319fbaa7eee93eba0f47b417fd383d32e..d31b902fa98b69ebefc4e5a8fab31fa23bfdeaa8 100644 (file)
@@ -4,12 +4,28 @@ EXTENSION class Mem_layout
 {
 public:
   enum { Io_port_max = (1UL << 16) };
+
+  static Address _io_map_ptr;
 };
 
 IMPLEMENTATION [ia32 || amd64 || ux]:
 
 #include "static_assert.h"
 
+Address Mem_layout::_io_map_ptr = Mem_layout::Io_map_area_end;
+
+PUBLIC static inline
+Address
+Mem_layout::alloc_io_vmem(unsigned long bytes)
+{
+  bytes = (bytes + Config::PAGE_SIZE - 1) & ~(Config::PAGE_SIZE - 1);
+  if (_io_map_ptr - bytes < Io_map_area_start)
+    return 0;
+
+  _io_map_ptr -= bytes;
+  return _io_map_ptr;
+}
+
 PUBLIC static inline NEEDS["static_assert.h"]
 template< typename V >
 bool
index c4328a5c36952b8183ef3c95a29b5191b8c4599a..4cd0c14d4b7784ddd401fe7f082c1ead20a20850 100644 (file)
@@ -74,9 +74,10 @@ Startup::stage2()
        {
          unsigned const pic_pin
            = Io_apic::legacy_override(Config::scheduler_irq_vector - Pic_base);
-         Io_apic_entry e = Io_apic::apic()->read_entry(pic_pin);
+         // assume the legacy irqs are routet to IO-APIC 0
+         Io_apic_entry e = Io_apic::apic(0)->read_entry(pic_pin);
          e.vector(Config::Apic_timer_vector);
-         Io_apic::apic()->write_entry(pic_pin, e);
+         Io_apic::apic(0)->write_entry(pic_pin, e);
          Config::scheduler_irq_vector = Config::Apic_timer_vector;
        }
     }
index a42a422f9b01ff043d1cba6d2821120281bf6490..bf6a27acab5d39abaa54973b402e6c8fe19122e4 100644 (file)
@@ -681,7 +681,7 @@ Vm_svm::resume_vcpu(Context *ctxt, Vcpu_state *vcpu, bool user_mode)
 
       int r = do_resume_vcpu(ctxt, vcpu, vmcb_s);
 
-      // test for error or non-IRQ exit resason
+      // test for error or non-IRQ exit reason
       if (r <= 0)
        return r;
 
@@ -695,8 +695,10 @@ Vm_svm::resume_vcpu(Context *ctxt, Vcpu_state *vcpu, bool user_mode)
       // leave the kernel to not overwrite the vcpu-regs
       // with bogus state.
       Thread *t = nonull_static_cast<Thread*>(ctxt);
-      if (t->exception_triggered())
-       t->fast_return_to_user(vcpu->_entry_ip, vcpu->_entry_sp, t->vcpu_state().usr().get());
+
+      if (t->continuation_test_and_restore())
+        t->fast_return_to_user(vcpu->_entry_ip, vcpu->_entry_sp,
+                               t->vcpu_state().usr().get());
     }
 }
 
index eac02623fd15e605ca0805664bd30df67c38a222..2f73948e9cadb89216d4b1e7d6c79f4b61d942c0 100644 (file)
@@ -560,7 +560,7 @@ Vm_vmx::resume_vcpu(Context *ctxt, Vcpu_state *vcpu, bool user_mode)
 
       int r = do_resume_vcpu(ctxt, vcpu, vmcs_s);
 
-      // test for error or non-IRQ exit resason
+      // test for error or non-IRQ exit reason
       if (r <= 0)
        return r;
 
@@ -574,8 +574,8 @@ Vm_vmx::resume_vcpu(Context *ctxt, Vcpu_state *vcpu, bool user_mode)
       // leave the kernel to not overwrite the vcpu-regs
       // with bogus state.
       Thread *t = nonull_static_cast<Thread*>(ctxt);
-      if (t->exception_triggered())
-       t->fast_return_to_user(vcpu->_entry_ip, vcpu->_entry_sp, t->vcpu_state().usr().get());
+      if (t->continuation_test_and_restore())
+        t->fast_return_to_user(vcpu->_entry_ip, vcpu->_entry_sp,
+                               t->vcpu_state().usr().get());
     }
 }
-
index 1a6df7d61d84dcbebc874bb9d4664a0d0af7d163..ee83b714994cc2ed474993a2b210d915e2f3aa51 100644 (file)
@@ -44,15 +44,25 @@ public:
 
 class Io_apic
 {
-private:
-  Unsigned32 volatile adr;
-  Unsigned32 dummy[3];
-  Unsigned32 volatile data;
+public:
+  enum { Max_ioapics = 6 };
 
-  static Io_apic *_apic;
+private:
+  struct Apic
+  {
+    Unsigned32 volatile adr;
+    Unsigned32 dummy[3];
+    Unsigned32 volatile data;
+  } __attribute__((packed));
+
+  Apic *_apic;
+  Spin_lock<> _l;
+  unsigned _offset;
+
+  static Io_apic _apics[Max_ioapics];
+  static unsigned _nr_irqs;
   static Acpi_madt const *_madt;
-  static Spin_lock<> _l;
-} __attribute__((packed));
+};
 
 IMPLEMENTATION:
 
@@ -62,10 +72,9 @@ IMPLEMENTATION:
 #include "kip.h"
 #include "lock_guard.h"
 
-Io_apic *Io_apic::_apic;
+Io_apic Io_apic::_apics[Io_apic::Max_ioapics];
 Acpi_madt const *Io_apic::_madt;
-Spin_lock<> Io_apic::_l;
-
+unsigned Io_apic::_nr_irqs;
 
 
 PRIVATE inline NEEDS["lock_guard.h"]
@@ -73,9 +82,9 @@ Mword
 Io_apic::read(int reg)
 {
   Lock_guard<typeof(_l)> g(&_l);
-  adr = reg;
+  _apic->adr = reg;
   asm volatile ("": : :"memory");
-  return data;
+  return _apic->data;
 }
 
 PRIVATE inline NEEDS["lock_guard.h"]
@@ -84,12 +93,12 @@ Io_apic::modify(int reg, Mword set_bits, Mword del_bits)
 {
   register Mword tmp;
   Lock_guard<typeof(_l)> g(&_l);
-  adr = reg;
+  _apic->adr = reg;
   asm volatile ("": : :"memory");
-  tmp = data;
+  tmp = _apic->data;
   tmp &= ~del_bits;
   tmp |= set_bits;
-  data = tmp;
+  _apic->data = tmp;
 }
 
 PRIVATE inline NEEDS["lock_guard.h"]
@@ -97,9 +106,9 @@ void
 Io_apic::write(int reg, Mword value)
 {
   Lock_guard<typeof(_l)> g(&_l);
-  adr = reg;
+  _apic->adr = reg;
   asm volatile ("": : :"memory");
-  data = value;
+  _apic->data = value;
 }
 
 PRIVATE inline
@@ -143,20 +152,59 @@ Io_apic::init()
     }
   printf("MADT = %p\n", _madt);
 
-  Acpi_madt::Io_apic const *ioapic
-    = static_cast<Acpi_madt::Io_apic const *>(_madt->find(Acpi_madt::IOAPIC, 0));
+  int n_apics = 0;
 
-  if (!ioapic)
+  for (n_apics = 0;
+       Acpi_madt::Io_apic const *ioapic = static_cast<Acpi_madt::Io_apic const *>(_madt->find(Acpi_madt::IOAPIC, n_apics));
+       ++n_apics)
+    {
+
+      if (n_apics >= Max_ioapics)
+       {
+         printf("Maximum number of IO-APICs exceeded ignore further IO-APICs\n");
+         break;
+       }
+
+      printf("IO-APIC[%2d]: struct: %p adr=%x\n", n_apics, ioapic, ioapic->adr);
+
+      Address offs;
+      Address va = Mem_layout::alloc_io_vmem(Config::PAGE_SIZE);
+      assert (va);
+
+      Kmem::map_phys_page(ioapic->adr, va, false, true, &offs);
+
+      Kip::k()->add_mem_region(Mem_desc(ioapic->adr, ioapic->adr + Config::PAGE_SIZE -1, Mem_desc::Reserved));
+
+
+      Io_apic *apic = Io_apic::apic(n_apics);
+      apic->_apic = (Io_apic::Apic*)(va + offs);
+      apic->write(0, 0);
+      unsigned ne = apic->num_entries();
+      apic->_offset = _nr_irqs;
+      _nr_irqs += ne + 1;
+
+      for (unsigned i = 0; i <= ne; ++i)
+        {
+          int v = 0x20+i;
+          Io_apic_entry e(v, Io_apic_entry::Fixed, Io_apic_entry::Physical,
+              Io_apic_entry::High_active, Io_apic_entry::Edge, 0);
+          apic->write_entry(i, e);
+        }
+
+      printf("IO-APIC[%2d]: pins %u\n", n_apics, ne);
+      apic->dump();
+    }
+
+  if (!n_apics)
     {
       printf("IO-APIC: Could not find IO-APIC in MADT, skip init\n");
       return false;
     }
 
-  printf("IO-APIC: struct: %p adr=%x\n", ioapic, ioapic->adr);
+
   printf("IO-APIC: dual 8259: %s\n", _madt->apic_flags & 1 ? "yes" : "no");
 
-  unsigned tmp = 0;
-  for (;;++tmp)
+  for (unsigned tmp = 0;;++tmp)
     {
       Acpi_madt::Irq_source const *irq
        = static_cast<Acpi_madt::Irq_source const *>(_madt->find(Acpi_madt::Irq_src_ovr, tmp));
@@ -167,35 +215,14 @@ Io_apic::init()
       printf("IO-APIC: ovr[%2u] %02x -> %x\n", tmp, irq->src, irq->irq);
     }
 
-  if (tmp)
-    printf("IO-APIC: NOTE IRQ overrides are ignored!\n");
-
-  Address offs;
-  Kmem::map_phys_page(ioapic->adr, Mem_layout::Io_apic_page,
-                     false, true, &offs);
-
-  Kip::k()->add_mem_region(Mem_desc(ioapic->adr, ioapic->adr + Config::PAGE_SIZE -1, Mem_desc::Reserved));
-
-
-  Io_apic *apic = (Io_apic*)(Mem_layout::Io_apic_page + offs);
-  _apic = apic;
-  apic->write(0, 0);
-  unsigned ne = apic->num_entries();
-
-  for (unsigned i = 0; i <= ne; ++i)
-    {
-      int v = 0x20+i;
-      Io_apic_entry e(v, Io_apic_entry::Fixed, Io_apic_entry::Physical,
-                      Io_apic_entry::High_active, Io_apic_entry::Edge, 0);
-      apic->write_entry(i, e);
-    }
-
-  printf("IO-APIC: pins %u\n", ne);
-  dump();
-
   return true;
 };
 
+PUBLIC static
+unsigned
+Io_apic::total_irqs()
+{ return _nr_irqs; }
+
 PUBLIC static 
 unsigned
 Io_apic::legacy_override(unsigned i)
@@ -218,14 +245,14 @@ Io_apic::legacy_override(unsigned i)
   return i;
 }
 
-PUBLIC static
+PUBLIC
 void
 Io_apic::dump()
 {
-  unsigned ne = _apic->num_entries();
+  unsigned ne = num_entries();
   for (unsigned i = 0; i <= ne; ++i)
     {
-      Io_apic_entry e = _apic->read_entry(i);
+      Io_apic_entry e = read_entry(i);
       printf("  PIN[%2u%c]: vector=%2x, del=%u, dm=%s, dest=%u (%s, %s)\n",
             i, e.mask() ? 'm' : '.',
             e.vector(), e.delivery(), e.dest_mode() ? "logical" : "physical",
@@ -239,54 +266,74 @@ Io_apic::dump()
 PUBLIC static inline
 bool
 Io_apic::active()
-{ return _apic; }
+{ return _apics[0]._apic; }
 
-PUBLIC static inline NEEDS["kdb_ke.h", Io_apic::modify]
+PUBLIC inline
+bool
+Io_apic::valid() const { return _apic; }
+
+PUBLIC inline NEEDS["kdb_ke.h", Io_apic::modify]
 void
 Io_apic::mask(unsigned irq)
 {
   //assert_kdb(irq <= _apic->num_entries());
-  _apic->modify(0x10 + irq * 2, 1UL << 16, 0);
+  modify(0x10 + irq * 2, 1UL << 16, 0);
 }
 
-PUBLIC static inline NEEDS["kdb_ke.h", Io_apic::modify]
+PUBLIC inline NEEDS["kdb_ke.h", Io_apic::modify]
 void
 Io_apic::unmask(unsigned irq)
 {
   //assert_kdb(irq <= _apic->num_entries());
-  _apic->modify(0x10 + irq * 2, 0, 1UL << 16);
+  modify(0x10 + irq * 2, 0, 1UL << 16);
 }
 
-PUBLIC static inline NEEDS["kdb_ke.h", Io_apic::read]
+PUBLIC inline NEEDS["kdb_ke.h", Io_apic::read]
 bool
 Io_apic::masked(unsigned irq)
 {
   //assert_kdb(irq <= _apic->num_entries());
-  return _apic->read(0x10 + irq * 2) & (1UL << 16);
+  return read(0x10 + irq * 2) & (1UL << 16);
 }
 
-PUBLIC static inline NEEDS[Io_apic::read]
+PUBLIC inline NEEDS[Io_apic::read]
 void
 Io_apic::sync()
 {
   (void)_apic->data;
 }
 
-PUBLIC static inline NEEDS["kdb_ke.h", Io_apic::modify]
+PUBLIC inline NEEDS["kdb_ke.h", Io_apic::modify]
 void
 Io_apic::set_dest(unsigned irq, Mword dst)
 {
   //assert_kdb(irq <= _apic->num_entries());
-  _apic->modify(0x11 + irq * 2, dst & (~0UL << 24), ~0UL << 24);
+  modify(0x11 + irq * 2, dst & (~0UL << 24), ~0UL << 24);
 }
 
-PUBLIC static inline NEEDS[Io_apic::num_entries]
+PUBLIC inline NEEDS[Io_apic::num_entries]
 unsigned
 Io_apic::nr_irqs()
-{ return _apic->num_entries() + 1; }
+{ return num_entries() + 1; }
+
+PUBLIC inline
+unsigned
+Io_apic::gsi_offset() const { return _offset; }
 
 PUBLIC static inline
 Io_apic *
-Io_apic::apic()
-{ return _apic; }
+Io_apic::apic(unsigned idx)
+{ return &_apics[idx]; }
+
+PUBLIC static
+unsigned
+Io_apic::find_apic(unsigned irqnum)
+{
+  for (unsigned i = Max_ioapics; i > 0; --i)
+    {
+      if (_apics[i-1]._apic && _apics[i-1]._offset < irqnum)
+       return i - 1;
+    }
+  return 0;
+};
 
index 6077c0ae771703230e4e7ebdbd34d5753109ada6..dab612275d050976c18313c599499b10bc262f3a 100644 (file)
@@ -53,7 +53,7 @@ Icu::icu_bind_irq(Irq *irq, unsigned irqnum)
     return commit_result(-L4_err::EInval);
 
   irq->pin()->unbind_irq();
+
   if (!c->alloc(irq, irqnum & ~Msi_bit))
     return commit_result(-L4_err::EPerm);
 
index 3130d2844bd42d54a87bbb40636b5e0a05da6297..b7c43068facf243e297660bafe45b5dbc8c4878f 100644 (file)
@@ -9,10 +9,6 @@ EXTENSION class Config
 public:
   enum
   {
-
     Max_num_dirqs = Pic::IRQ_MAX,
-    Vkey_irq      = Max_num_dirqs,
-    Tbuf_irq      = Max_num_dirqs + 1,
-    Max_num_irqs  = Max_num_dirqs + 2,
   };
 };
index ac60dccfde7f1528e7ae92834c156463f3ac70f8..f32b34057fce39cea4431f2ca60451da80a19acc 100644 (file)
@@ -8,8 +8,5 @@ public:
   enum
   {
     Max_num_dirqs = 3,
-    Vkey_irq      = Max_num_dirqs,
-    Tbuf_irq      = Max_num_dirqs + 1,
-    Max_num_irqs  = Max_num_dirqs + 2,
   };
 };
index 704e3071a67d4fddfd065f91437111c748b08e77..2ebdab7a8ea4ff59c07d1fdd2cfa4890b3175b8e 100644 (file)
@@ -87,6 +87,7 @@ void FIASCO_NORETURN
 Thread::fast_return_to_user(Mword ip, Mword sp, T arg)
 {
   (void)ip; (void)sp; (void)arg;
+  //assert_kdb(check that exiting privs are user privs);
   // XXX: UNIMPLEMENTED
   panic("__builtin_trap()");
 }
index 6d3f6fbf385ffa7bb6aff143317191bda8cdc8d2..e43060511d42f01ec4bc21ede0b46a95c7f7d56b 100644 (file)
@@ -7,7 +7,6 @@ extern "C"
 void
 sys_ipc_wrapper()
 {
-  // FIXME: use UTCB from user, not the kernel var (remove access utcb
   assert_kdb (!(current()->state() & Thread_drq_ready));
 
   Thread *curr = current_thread();
@@ -15,7 +14,6 @@ sys_ipc_wrapper()
 
   Obj_cap obj = f->ref();
   Utcb *utcb = curr->utcb().access(true);
-  // printf("sys_invoke_object(f=%p, obj=%x)\n", f, f->obj_ref());
   unsigned char rights;
   Kobject_iface *o = obj.deref(&rights);
   L4_msg_tag e;
index 5c42ba1d5f2cb94eff03ca1035551d197a5d9daa..fb1f69cd67592b4132a8f10d99c6cd8c8d1e5887 100644 (file)
@@ -37,7 +37,7 @@
 #if defined(CONFIG_ARM)
   DUMP_OFFSET  (THREAD, UTCB_SIZE, sizeof(Utcb))
 #else
-  DUMP_MEMBER1 (THREAD, Context, _vcpu_state,          VCPU_STATE)
+  DUMP_MEMBER1 (THREAD, Context, _vcpu_state._k,       VCPU_STATE)
 #endif
 #if 0
   DUMP_MEMBER1 (SCHED_CONTEXT, Sched_context,_owner,           OWNER)
index feca98a976ba863c01c6cf414c4a5740306311ce..f95fd298e0f732997c3822f30ce401baadb19e88 100644 (file)
@@ -919,7 +919,13 @@ Thread::send_exception(Trap_state *ts)
 
       if (_exc_cont.valid())
        return 1;
-      vcpu_enter_kernel_mode(vcpu);
+      if (vcpu_enter_kernel_mode(vcpu))
+       {
+         // enter_kernel_mode has switched the address space from user to
+         // kernel space, so reevaluate the address of the VCPU state area
+         vcpu = vcpu_state().access();
+       }
+
       spill_user_state();
       LOG_TRACE("VCPU events", "vcpu", this, __context_vcpu_log_fmt,
          Vcpu_log *l = tbe->payload<Vcpu_log>();
index 83000e4ba29aa2af00b6db4e94ec2ad4b0393a57..8aefef6ffbc0fdc794848a3e4af48f8491716356 100644 (file)
@@ -409,6 +409,16 @@ bool
 Thread::exception_triggered() const
 { return _exc_cont.valid(); }
 
+PUBLIC inline
+bool
+Thread::continuation_test_and_restore()
+{
+  bool v = _exc_cont.valid();
+  if (v)
+    _exc_cont.restore(regs());
+  return v;
+}
+
 //
 // state requests/manipulation
 //
index b3eeba319817ad123eed1390e8dc286100f978e9..94ba65cf40ae2fe49d3a5023ce385ef8340cc216 100644 (file)
@@ -43,8 +43,6 @@ public:
   enum {
     Scheduling_irq = 0,
     Max_num_dirqs = 16,
-    Max_num_irqs  = Max_num_dirqs + 4,
-    Tbuf_irq = Max_num_dirqs + 1,
     Is_ux = 1,
   };
 };
index b3deb360f4a7150e12a14dd5fc09d4400c5fe627..dc3bb9e8090778acce9f3f2dfa6c4c5308409387 100644 (file)
@@ -16,6 +16,7 @@ private:
   static Tss *tss asm ("CPU_TSS");
   static int msr_dev;
   static unsigned long _gs asm ("CPU_GS");
+  static unsigned long _fs asm ("CPU_FS");
   static Mword _kern_ds asm ("KERN_DS");
   static Mword _kern_es asm ("KERN_ES");
 
@@ -41,7 +42,8 @@ IMPLEMENTATION[ux]:
 Proc::Status volatile Proc::virtual_processor_state = 0;
 Tss *Cpu::tss;
 int Cpu::msr_dev = -1;
-unsigned long Cpu::_gs; // XXX percpu
+unsigned long Cpu::_gs; // for mp: percpu
+unsigned long Cpu::_fs; // for mp: percpu
 unsigned long Cpu::_kern_ds;
 unsigned long Cpu::_kern_es;
 
@@ -180,11 +182,21 @@ void
 Cpu::debugctl_disable()
 {}
 
+PUBLIC static inline
+void
+Cpu::set_fs(Unsigned32 val)
+{ _fs = val; }
+
 PUBLIC static inline
 void
 Cpu::set_gs(Unsigned32 val)
 { _gs = val; }
 
+PUBLIC static inline
+Unsigned32
+Cpu::get_fs()
+{ return _fs; }
+
 PUBLIC static inline
 Unsigned32
 Cpu::get_gs()
index db9bbae0857a8013afe5bfee8569d1dcedb458da..e6f3e6211136266118ef92eb6836f68c4875beed 100644 (file)
@@ -39,6 +39,8 @@ public:
     Caps_end           = 0x5f000000,
     Idt                = 0x5f001000,
     Tbuf_status_page   = 0x5f002000,  ///< % 4KB   for jdb_tbuf
+    Io_map_area_start  = 0x5f003000,
+    Io_map_area_end    = 0x5f006000,
     Tbuf_buffer_area   = 0x5f200000,  ///< % 2MB   tracebuffer
     Io_bitmap          = 0x5f800000,  ///< % 4MB   dummy
     _Free_1            = 0x5fc00000,  ///< % 4MB   dummy
@@ -64,6 +66,8 @@ public:
     Caps_end           = 0x2f000000,
     Idt                = 0x2f001000,
     Tbuf_status_page   = 0x2f002000,  ///< % 4KB   for jdb_tbuf
+    Io_map_area_start  = 0x2f003000,
+    Io_map_area_end    = 0x2f006000,
     Tbuf_buffer_area   = 0x2f200000,  ///< % 2MB   tracebuffer
     Io_bitmap          = 0x2f800000,  ///< % 4MB   dummy
     Glibc_mmap_start   = 0x40000000,  ///<         fixed, Linux kernel spec.
index b6accf93271dc6d234c1d197c2f4a0a6bcc96260..697cf1e2f6f3ee5127ab4631166d041cce2b7501 100644 (file)
@@ -514,7 +514,7 @@ Usermode::iret_to_user_mode (unsigned _cpu,
            "        Fixing up!\n");
       regs.xds = Cpu::kern_ds();
       regs.xes = Cpu::kern_es();
-      regs.xfs = 0;
+      regs.xgs = 0;
       check(ptrace (PTRACE_SETREGS, pid, NULL, &regs));
     }
   else
index b52aeaaac20acd3ed84698a07ea724a385e1735e..c0e2d22d0aca040cfee50a508a0b8da9017cfa5c 100644 (file)
@@ -18,7 +18,7 @@
 # files or any other data file you might want to load. Note that the bin and
 # lib directories of the build-tree are automatically added to the search
 # path.
-# MODULES_SEARCH_PATH = /path/to/cfgs:/path/to/foo:..
+# MODULE_SEARCH_PATH = /path/to/cfgs:/path/to/foo:..
 #
 # 'image' just builds what's configured:
 # - default: just ELF
index 832ff9af52d21935f2131b888799548535427d35..9c15df569959369d9f98ba8e5692a2b087be93f0 100644 (file)
@@ -166,7 +166,7 @@ static void initialize_tables (void);
 
 static void show_progress(int done, int len)
 {
-  int r = printf("%d%%", (done * 100) / len);
+  int r = printf("%lld%%", ((unsigned long long)done * 100) / len);
   while (r-- > 0)
     putchar('\b');
   fflush(NULL);
index 61d11426ec660ec9fd1f870c38493bd8aba06636..7e133887691606bf3a7f22e682aa207606eb27d2 100644 (file)
@@ -102,9 +102,9 @@ decompress(const char *name, void *start, void *destbuf,
   if (!compressed_file)
     return start;
 
-  printf("  Uncompressing %s from %p to %p (%d to %d bytes, %+d%%).\n",
+  printf("  Uncompressing %s from %p to %p (%d to %d bytes, %+lld%%).\n",
         name, start, destbuf, size, size_uncompressed,
-       100*size_uncompressed/size - 100);
+       100*(unsigned long long)size_uncompressed/size - 100);
 
   // Add 10 to detect too short given size
   if ((read_size = grub_read(destbuf, size_uncompressed + 10))
index 06f30141b4ee05bd526aa93b0832c8c55124e6bb..45db486353496d7f8051f5f2a9921fff550cfa67 100644 (file)
@@ -46,7 +46,7 @@ extern char my_super_code_excp_after[];
 
 #if defined(ARCH_x86) || defined(ARCH_amd64)
 
-static unsigned long gs;
+static unsigned long fs;
 static unsigned long ds;
 
 asm
@@ -82,7 +82,7 @@ asm
 
 static void setup_user_state_arch(L4vcpu::Vcpu *v)
 {
-  asm volatile ("mov %%gs, %0" : "=r"(gs));
+  asm volatile ("mov %%fs, %0" : "=r"(fs));
   asm volatile ("mov %%ds, %0" : "=r"(ds));
 #ifndef __amd64__
   v->r()->gs = ds;
@@ -97,8 +97,8 @@ static void handler_prolog()
 {
   asm volatile ("mov %0, %%es \t\n"
                 "mov %0, %%ds \t\n"
-                "mov %1, %%gs \t\n"
-                : : "r"(ds), "r"(gs));
+                "mov %1, %%fs \t\n"
+                : : "r"(ds), "r"(fs));
 }
 
 #elif defined(ARCH_arm)
index 11423ff0b7c81002cbcdeadb26eeb56bda088d46..e94d045db10685fc2ab10e493f38dcd5427f41f4 100644 (file)
@@ -49,7 +49,7 @@ static L4Re::Util::Registry_server<> server(l4_utcb(),
                                             L4Re::Env::env()->factory());
 
 enum {
-  Max_search_paths = 10,
+  Max_search_paths = 20,
 };
 
 static char *search_paths[Max_search_paths];
@@ -499,9 +499,10 @@ Fprov_server::dispatch(l4_umword_t, L4::Ipc_iostream &ios)
 int
 main(int argc, char *argv[])
 {
-  setup(argc, argv);
   try
     {
+      setup(argc, argv);
+
       int err = mount("/", fprov_prefix, "fuxfs", 0, 0);
       if (err == -1)
         {
index 3e9598180d0238924f8924d6090fb0519afaa5fd..6b7da9e661f4c26b15726dad04096d8717578724 100644 (file)
@@ -532,7 +532,7 @@ Pci_dev::discover_pci_caps()
          l4_umword_t msg = 0;
          if (l4_error(system_icu()->icu->msi_info(msi, &msg)) < 0)
            {
-             printf("WARNING: could not get MSI message, use noremal IRQ\n");
+             printf("WARNING: could not get MSI message, use normal IRQ\n");
              continue;
            }
 
index 1f378f0c03c212c079720f97de3b70aa3e9297b2..c5ae56311e436f8e41d65e134b51ebeb90f3dc27 100644 (file)
@@ -169,6 +169,10 @@ handle_event(struct l4input *ev)
       /* ignored */
       return;
     }
+  else if (ev->type == EV_SYN)
+    {
+      /* Pass through */
+    }
   else
     {
       printf("handle_event: Unknown event type %d\n", ev->type);
index 8d31d65bf14e99302c45f0a90ea6aa82dd296f83..6836084826abf1b921c03a0eee50118e9f8eef22 100644 (file)
@@ -191,7 +191,7 @@ int region_pf_handler(RM *rm, IOS &ios)
   typename RM::Region_handler::Ops::Map_result result;
   if (int err = n->second.map(addr, n->first, writable, &result))
     {
-      Dbg(Dbg::Warn, "rm").printf("mapping for pf failed with %d @%lx pc=%lx\n",
+      Dbg(Dbg::Warn, "rm").printf("mapping for page fault failed with %d @%lx pc=%lx\n",
                                   err, addr, pc);
       // generate exception
       ios << (l4_umword_t)~0;
index 25f2b0fc063c02e1e28da96988e0368ce0588d34..14955daaef1d5c6249bedb921a9d83cd2a3b8062 100644 (file)
@@ -413,7 +413,9 @@ l4_thread_vcpu_resume_start_u(l4_utcb_t *utcb) L4_NOTHROW;
  *                  for the current thread.
  * \param tag       Tag to use, returned by l4_thread_vcpu_resume_start()
  *
- * \return System call result message tag.
+ * \return System call result message tag. In extended vCPU mode and when
+ * the virtual interrupts are cleared, the return code 1 flags an incoming
+ * IPC message, whereas 0 indicates a VM exit.
  *
  * To resume into another address space the capability to the target task
  * must be set in the vCPU-state (\see l4_vcpu_state_t). The task needs
index 7e26a5feaa55a472f6bd2ed911ec721492feb1a8..19590e451fdb6ae8d3ae882b46e8a89864c8e58a 100644 (file)
@@ -34,6 +34,7 @@ ifeq ("$(GCCMAJORVERSION)", "4")
 endif
 
 STDCXX_CONTRIB_DIR = $(STDCXX_PKG_DIR)/contrib/libstdc++-v3-$(STDCXX_CONTRIB_VERSION)
+DEFINES += -Dlinux
 
 CPU_H_x86   := i386
 CPU_H_ppc32 := powerpc
index 352846a4c89f68cec5be2ec9f5ff72f38308cb74..d4186e036548d31e29a385bebee9cf5245778572 100644 (file)
@@ -24,10 +24,10 @@ __BEGIN_DECLS
 /**
  * \brief Find a device by the HID APCI conforming or L4Io static name.
  *
- * \param  vbus                capability of the system bus
- * \param  parent      handle to the parent to start the search
- * \retval child       handle to the found device
- * \param  hid         HID name of the device
+ * \param  vbus         Capability of the system bus
+ * \param  parent       Handle to the parent to start the search
+ * \retval child        Handle to the found device
+ * \param  hid          HID name of the device
  * \retval devinfo      Device information structure (might be NULL)
  * \retval reshandle    Resource handle (might be NULL)
  *
@@ -41,11 +41,11 @@ l4vbus_get_device_by_hid(l4_cap_idx_t vbus, l4vbus_device_handle_t parent,
 /**
  * \brief Find next child following \a child.
  *
- * \param  vbus                capability of the system bus
- * \param  parent      handle to the parent device (use 0 for the system bus)
- * \param  child       handle to the child device (use 0 to get the first
+ * \param  vbus         Capability of the system bus
+ * \param  parent       Handle to the parent device (use 0 for the system bus)
+ * \param  child        Handle to the child device (use 0 to get the first
  *                      child)
- * \retval next                handle to the successor of child
+ * \retval next         Handle to the successor of child
  * \retval devinfo      device information (might be NULL)
  *
  * \return 0 on succes, else failure
@@ -58,11 +58,11 @@ l4vbus_get_next_device(l4_cap_idx_t vbus, l4vbus_device_handle_t parent,
 /**
  * \brief Iterate over the resources of a device
  *
- * \param  vbus                capability of the system bus
- * \param  dev         handle of the device
- * \retval res_idx     Index of the resource, the number of resources is
- *                     availabnle in the devinfo from get device functions.
- * \retval res         descriptor of the resource
+ * \param  vbus         Capability of the system bus
+ * \param  dev          Handle of the device
+ * \retval res_idx      Index of the resource, the number of resources is
+ *                      availabnle in the devinfo from get device functions.
+ * \retval res          Descriptor of the resource
  *
  * \return 0 on succes, else failure
  */
@@ -74,9 +74,9 @@ l4vbus_get_resource(l4_cap_idx_t vbus, l4vbus_device_handle_t dev,
 /**
  * \brief Request a resource of a specific type
  *
- * \param  vbus                capability of the system bus
- * \param  res         descriptor of the resource
- * \param  flags       optional flags
+ * \param  vbus         Capability of the system bus
+ * \param  res          Descriptor of the resource
+ * \param  flags        Optional flags
  *
  * \return 0 on succes, else failure
  *
@@ -95,16 +95,25 @@ l4vbus_request_resource(l4_cap_idx_t vbus, l4vbus_resource_t *res,
 /**
  * \brief Release a previously requested resource
  *
- * \param  vbus                capability of the system bus
- * \param  res         descriptor of the resource
+ * \param  vbus         Capability of the system bus.
+ * \param  res          Descriptor of the resource.
  *
  * \return 0 on succes, else failure
  */
 int L4_CV
 l4vbus_release_resource(l4_cap_idx_t vbus, l4vbus_resource_t *res);
 
+/**
+ * \brief Get capability of ICU.
+ *
+ * \param  vbus         Capability of the system bus.
+ * \param  icu          ICU device handle.
+ * \param  cap          Capability slot for the capability.
+ *
+ * \return 0 on succes, else failure
+ */
 int L4_CV
 l4vbus_vicu_get_cap(l4_cap_idx_t vbus, l4vbus_device_handle_t icu,
-                    l4_cap_idx_t res);
+                    l4_cap_idx_t cap);
 
 __END_DECLS
index 0902e343215489474c46aaf78b4eb6db43efe95b..d66e1e37eb40bde730739c8878dd3544d4752fbb 100644 (file)
@@ -15,9 +15,9 @@ typedef l4_mword_t l4vbus_device_handle_t;
 typedef l4_addr_t l4vbus_paddr_t;
 
 typedef struct {
-  l4_uint16_t    type;            /**< resource type */
-  l4_uint16_t    flags;
-  l4vbus_paddr_t start;           /**< start of res. range */
+  l4_uint16_t    type;            /**< Resource type, see l4vbus_resource_type_t */
+  l4_uint16_t    flags;           /**< Flags */
+  l4vbus_paddr_t start;           /**< Start of res. range */
   l4vbus_paddr_t end;             /**< (inclusive) end of res. range */
 } l4vbus_resource_t;
 
@@ -29,19 +29,18 @@ enum l4vbus_resource_type_t {
   L4VBUS_RESOURCE_MAX,         /**< Maximum resource id */
 };
 
-enum {
+enum l4vbus_consts_t {
   L4VBUS_DEV_NAME_LEN = 64,
   L4VBUS_MAX_DEPTH = 100,
 };
 
 typedef struct {
-  int           type;                      /**< type */
-  char          name[L4VBUS_DEV_NAME_LEN]; /**< name */
-  unsigned      num_resources;             /**< resources count */
-  unsigned      flags;
+  int           type;                      /**< Type */
+  char          name[L4VBUS_DEV_NAME_LEN]; /**< Name */
+  unsigned      num_resources;             /**< Resources count */
+  unsigned      flags;                     /**< Flags */
 } l4vbus_device_t;
 
-enum
-{
+enum l4vbus_device_flags_t {
   L4VBUS_DEVICE_F_CHILDREN = 0x10,
 };
index 2e7a21d84ab5c85bfd0f6e082ad5b0d7c9883504..4ba4efd7021d1f2bee62094a5920ab91889fafcf 100644 (file)
@@ -32,6 +32,12 @@ class State
 {
 public:
   State() {}
+
+  /**
+   * \brief Initialize state.
+   *
+   * \param v Initial state.
+   */
   explicit State(l4vcpu_state_t v) : _s(v) {}
 
   /**
@@ -66,6 +72,9 @@ private:
 class Vcpu : private l4_vcpu_state_t
 {
 public:
+  /**
+   * \brief IRQ status type.
+   */
   typedef l4vcpu_irq_state_t Irq_state;
 
   /**
@@ -112,8 +121,11 @@ public:
   /**
    * \brief Enable the vCPU for event delivery.
    *
+   * \param utcb             The UTCB to use.
    * \param do_event_work_cb Call-back function that is called in case an
    *                         event (such as an interrupt) is pending.
+   * \param setup_ipc        Call-back function that is called before an
+   *                         IPC operation is called.
    */
   void irq_enable(l4_utcb_t *utcb, l4vcpu_event_hndl_t do_event_work_cb,
                   l4vcpu_setup_ipc_t setup_ipc) throw()
@@ -123,14 +135,26 @@ public:
    * \brief Restore a previously saved IRQ/event state.
    *
    * \param s                IRQ state to be restored.
+   * \param utcb             The UTCB to use.
    * \param do_event_work_cb Call-back function that is called in case an
    *                         event (such as an interrupt) is pending.
+   * \param setup_ipc        Call-back function that is called before an
+   *                         IPC operation is called.
    */
   void irq_restore(Irq_state s, l4_utcb_t *utcb,
                    l4vcpu_event_hndl_t do_event_work_cb,
                    l4vcpu_setup_ipc_t setup_ipc) throw()
   { l4vcpu_irq_restore(this, s, utcb, do_event_work_cb, setup_ipc); }
 
+  /**
+   * \brief Halt/block the vCPU.
+   *
+   * \param utcb             The UTCB to use.
+   * \param do_event_work_cb Call-back function that is called in case an
+   *                         event (such as an interrupt) is pending.
+   * \param setup_ipc        Call-back function that is called before an
+   *                         IPC operation is called.
+   */
   void halt(l4_utcb_t *utcb, l4vcpu_event_hndl_t do_event_work_cb,
             l4vcpu_setup_ipc_t setup_ipc) throw()
   { l4vcpu_halt(this, utcb, do_event_work_cb, setup_ipc); }
@@ -195,7 +219,7 @@ public:
 
   /**
    * \brief Set vCPU entry instruction pointer.
-   * \param sp  Instruction pointer address to set.
+   * \param ip  Instruction pointer address to set.
    */
   void entry_ip(l4_umword_t ip)
   { l4_vcpu_state_t::entry_ip = ip; }
index 16d14200ce73843b8c9efe699d2f556bce6c4896..51bbe1be167a6e597162588deb9e11a1838f0524 100644 (file)
@@ -25,9 +25,9 @@ L4_CV void
 l4vcpu_print_state(l4_vcpu_state_t *vcpu,
                    const char *prefix) L4_NOTHROW
 {
-  printf("%svcpu=%p state=%lx savedstate=%lx label=%lx\n",
+  printf("%svcpu=%p state=%x savedstate=%x label=%lx\n",
          prefix, vcpu, vcpu->state, vcpu->saved_state, vcpu->i.label);
-  printf("%ssticky=%lx user_task=%lx\n",
+  printf("%ssticky=%x user_task=%lx\n",
          prefix, vcpu->sticky_flags, vcpu->user_task << L4_CAP_SHIFT);
   printf("%sentry_sp=%lx entry_ip=%lx\n",
          prefix, vcpu->entry_sp, vcpu->entry_ip);
@@ -54,7 +54,7 @@ do_l4vcpu_ext_alloc(L4vcpu::Vcpu **vcpu,
 
 L4_CV int
 l4vcpu_ext_alloc(l4_vcpu_state_t **vcpu, l4_addr_t *ext_state,
-                      l4_cap_idx_t task, l4_cap_idx_t regmgr) L4_NOTHROW
+                 l4_cap_idx_t task, l4_cap_idx_t regmgr) L4_NOTHROW
 {
   L4::Cap<L4::Task> t(task);
   L4::Cap<L4Re::Rm> r(regmgr);