]> rtime.felk.cvut.cz Git - l4.git/commitdiff
update
authorl4check <l4check@d050ee49-bd90-4346-b210-929a50b99cfc>
Sun, 14 Apr 2013 21:57:16 +0000 (21:57 +0000)
committerl4check <l4check@d050ee49-bd90-4346-b210-929a50b99cfc>
Sun, 14 Apr 2013 21:57:16 +0000 (21:57 +0000)
git-svn-id: http://svn.tudos.org/repos/oc/tudos/trunk@52 d050ee49-bd90-4346-b210-929a50b99cfc

22 files changed:
kernel/fiasco/src/drivers/keyb-pc.cpp
kernel/fiasco/src/drivers/keyb.cpp
kernel/fiasco/src/kern/arm/bsp/exynos/pic-arm-gic-exynos.cpp
kernel/fiasco/src/kern/arm/bsp/exynos/smc.cpp
kernel/fiasco/src/kern/boot_alloc.cpp
kernel/fiasco/src/kern/ia32/boot_console-ia32-amd64.cpp
kernel/fiasco/src/kern/koptions-def.h
l4/doc/source/pthreads.dox
l4/mk/platforms/exynos4.conf [new file with mode: 0644]
l4/mk/platforms/exynos5.conf [new file with mode: 0644]
l4/pkg/bootstrap/server/src/Make.rules
l4/pkg/bootstrap/server/src/Makefile.platform
l4/pkg/bootstrap/server/src/build.pl
l4/pkg/bootstrap/server/src/libc_support+.cc
l4/pkg/bootstrap/server/src/loader_mbi.cc
l4/pkg/bootstrap/server/src/loader_mbi.h
l4/pkg/bootstrap/server/src/platform/exynos.cc
l4/pkg/bootstrap/server/src/region.cc
l4/pkg/bootstrap/server/src/region.h
l4/pkg/bootstrap/server/src/startup.cc
l4/pkg/bootstrap/server/src/support.h
l4/pkg/l4sys/include/__vm-vmx.h

index 312a31ed3021e1cc566c272412aded52df7c8207..324fca89f98d5c05992e91e489cdf4d966a9ffca 100644 (file)
@@ -105,7 +105,7 @@ enum {
   SHIFT = 0xff,
 };
 
-static const unsigned char keymap[][2] = {
+static unsigned char keymap[][2] = {
   {0       },          /* 0 */
   {27, 27 },           /* 1 - ESC */
   {'1',        '!'},           /* 2 */
@@ -133,8 +133,7 @@ static const unsigned char keymap[][2] = {
   {'o',        'O'},
   {'p',        'P'},
   {'[',        '{'},
-// {']','}'},          /* 27 */
-  {'+',        '*'},           /* 27 */
+  {']', '}'},          /* 27 */
   {'\r','\r'},         /* 28 - Enter */
   {0,  0  },           /* 29 - Ctrl */
   {'a',        'A'},           /* 30 */
@@ -160,8 +159,7 @@ static const unsigned char keymap[][2] = {
   {'m',        'M'},
   {',',        '<'},
   {'.',        '>'},
-// {'/', '?'},         /* 53 */
-  {'-',        '_'},           /* 53 */
+  {'/', '?'},          /* 53 */
   {SHIFT, SHIFT},      /* 54 - Right Shift */
   {0,   0},            /* 55 - Print Screen */
   {0,   0},            /* 56 - Alt */
@@ -194,6 +192,37 @@ static const unsigned char keymap[][2] = {
   {0xae,0xae},         /* 83 - Numeric keypad '.' */
 };
 
+IMPLEMENT
+void
+Keyb::set_keymap(Keyb::Keymap km)
+{
+  // This is a one-time switch over only.
+  if (km == Keymap_de)
+    {
+      // Simple patch to german layout
+      keymap[ 3][1] = '"';
+      keymap[ 7][1] = '&';
+      keymap[ 8][1] = '/';
+      keymap[ 9][1] = '(';
+      keymap[10][1] = ')';
+      keymap[11][1] = '=';
+      keymap[12][1] = '?';
+      keymap[13][1] = '`';
+      keymap[21][0] = 'z';
+      keymap[21][1] = 'Z';
+      keymap[27][0] = '+';
+      keymap[27][1] = '*';
+      keymap[41][0] = '^';
+      keymap[43][0] = '#';
+      keymap[43][1] = '\'';
+      keymap[44][0] = 'y';
+      keymap[44][1] = 'Y';
+      keymap[51][1] = ';';
+      keymap[52][1] = ':';
+      keymap[53][0] = '-';
+      keymap[53][1] = '_';
+    }
+}
 
 IMPLEMENT
 int Keyb::getchar(bool wait)
index c0efa7dcce93e5c204310aca67fa8f395c99918e..c154c1e55b7e735b415d8ccd4ec12108d9f3745d 100644 (file)
@@ -15,6 +15,9 @@ public:
 
   // implemented empty
   int write(char const *str, size_t len);
+
+  enum Keymap { Keymap_en, Keymap_de };
+  void set_keymap(Keymap);
 };
 
 
@@ -22,7 +25,7 @@ IMPLEMENTATION:
 
 IMPLEMENT
 int
-Keyb::write( char const *, size_t len)
+Keyb::write(char const *, size_t len)
 {
   return len;
 }
@@ -33,4 +36,3 @@ Keyb::get_attributes() const
 {
   return DIRECT | IN;
 }
-
index cc76efc219736263d23b7f2358925b60e3c48fea..40d17baf8891d8c31fa49935b00997d67fddbdb2 100644 (file)
@@ -59,8 +59,8 @@ private:
   unsigned offs(Mword pin) const { return (pin >> 3) * 4; }
 
 public:
-  Gpio_eint_chip(Mword gpio_base)
-    : Irq_chip_gen(8 * 16), _gpio_base(gpio_base)
+  Gpio_eint_chip(Mword gpio_base, unsigned num_irqs)
+    : Irq_chip_gen(num_irqs), _gpio_base(gpio_base)
   {}
 
   void mask(Mword pin)
@@ -322,14 +322,15 @@ Gpio_cascade_wu23_irq::handle(Upstream_irq const *u)
 class Gpio_cascade_xab_irq : public Irq_base
 {
 public:
-  explicit Gpio_cascade_xab_irq(Gpio_eint_chip *g)
-  : _eint_gc(g)
+  explicit Gpio_cascade_xab_irq(Gpio_eint_chip *g, unsigned special = 0)
+  : _eint_gc(g), _special(special)
   { set_hit(&handler_wrapper<Gpio_cascade_xab_irq>); }
 
   void switch_mode(unsigned) {}
 
 private:
   Gpio_eint_chip *_eint_gc;
+  unsigned _special;
 };
 
 PUBLIC
@@ -338,7 +339,23 @@ Gpio_cascade_xab_irq::handle(Upstream_irq const *u)
 {
   Mword p = _eint_gc->pending();
   Upstream_irq ui(this, u);
-  _eint_gc->irq(p - 8)->hit(&ui);
+  if (1)
+    {
+      int grp = (p >> 3) & 0x1f;
+      int pin = p & 7;
+
+      if (_special == 1)
+        {
+          if (grp > 7)
+            grp += 5;
+        }
+      else if (_special == 2)
+        grp += 2;
+
+      _eint_gc->irq((grp - 1) * 8 + pin)->hit(&ui);
+    }
+  else
+    _eint_gc->irq(p - 8)->hit(&ui);
 }
 
 // ------------
@@ -571,8 +588,8 @@ Mgr_ext::Mgr_ext()
   _cc = new Boot_object<Combiner_chip>();
 
   _wu_gc = new Boot_object<Gpio_wakeup_chip>(Kmem::Gpio2_phys_base);
-  _ei_gc1 = new Boot_object<Gpio_eint_chip>(Kmem::mmio_remap(Mem_layout::Gpio1_phys_base));
-  _ei_gc2 = new Boot_object<Gpio_eint_chip>(Kmem::mmio_remap(Mem_layout::Gpio2_phys_base));
+  _ei_gc1 = new Boot_object<Gpio_eint_chip>(Kmem::mmio_remap(Mem_layout::Gpio1_phys_base), 18 * 8);
+  _ei_gc2 = new Boot_object<Gpio_eint_chip>(Kmem::mmio_remap(Mem_layout::Gpio2_phys_base), 14 * 8);
 
   // Combiners
   for (unsigned i = 0; i < 16; ++i)
@@ -601,11 +618,11 @@ Mgr_ext::Mgr_ext()
   g->unmask(64);
 
   // xa GIC:32+47
-  g->alloc(new Boot_object<Gpio_cascade_xab_irq>(_ei_gc1), 79);
+  g->alloc(new Boot_object<Gpio_cascade_xab_irq>(_ei_gc1, Platform::is_4412() ? 1 : 0), 79);
   g->unmask(79);
 
   // xb GIC:32+46
-  g->alloc(new Boot_object<Gpio_cascade_xab_irq>(_ei_gc2), 78);
+  g->alloc(new Boot_object<Gpio_cascade_xab_irq>(_ei_gc2, Platform::is_4412() ? 2 : 0), 78);
   g->unmask(78);
 
 
@@ -634,8 +651,8 @@ Mgr_ext::Mgr_ext()
     { 160,               _gic.cpu(Cpu_number(0)) },
     { 20 * 8,            _cc },
     {  4 * 8,            _wu_gc },
-    { 13 * 8,            _ei_gc1 },
-    { 12 * 8,            _ei_gc2 },
+    { 18 * 8,            _ei_gc1 },
+    { 14 * 8,            _ei_gc2 },
     //{  1 * 8,            _ei_gc3 }, // Do not know upstream IRQ-num :(
     //{  5 * 8,            _ei_gc4 }, // Do not know upstream IRQ-num :(
   };
@@ -792,10 +809,10 @@ Mgr::Mgr()
 
   _wu_gc = new Boot_object<Gpio_wakeup_chip>(Kmem::Gpio1_phys_base);
 
-  _ei_gc1 = new Boot_object<Gpio_eint_chip>(Kmem::mmio_remap(Mem_layout::Gpio1_phys_base));
-  _ei_gc2 = new Boot_object<Gpio_eint_chip>(Kmem::mmio_remap(Mem_layout::Gpio2_phys_base));
-  _ei_gc3 = new Boot_object<Gpio_eint_chip>(Kmem::mmio_remap(Mem_layout::Gpio3_phys_base));
-  _ei_gc4 = new Boot_object<Gpio_eint_chip>(Kmem::mmio_remap(Mem_layout::Gpio4_phys_base));
+  _ei_gc1 = new Boot_object<Gpio_eint_chip>(Kmem::mmio_remap(Mem_layout::Gpio1_phys_base), 13 * 8);
+  _ei_gc2 = new Boot_object<Gpio_eint_chip>(Kmem::mmio_remap(Mem_layout::Gpio2_phys_base),  8 * 8);
+  _ei_gc3 = new Boot_object<Gpio_eint_chip>(Kmem::mmio_remap(Mem_layout::Gpio3_phys_base),  5 * 8);
+  _ei_gc4 = new Boot_object<Gpio_eint_chip>(Kmem::mmio_remap(Mem_layout::Gpio4_phys_base),  1 * 8);
 
   // Combiners
   for (unsigned i = 0; i < 32; ++i)
@@ -835,13 +852,13 @@ Mgr::Mgr()
   //  - part4: ext-int 0x700: 50
 
   static Chip_block socblock[] = {
-    { 160,     Pic::gic },
-    { 32 * 8,  _cc },
-    { 32,      _wu_gc },
-    { 13 * 8,  _ei_gc1 },
-    {  8 * 8,  _ei_gc2 },
-    {  5 * 8,  _ei_gc3 },
-    {  1 * 8,  _ei_gc4 },
+    { 160,                Pic::gic },
+    { 32 * 8,             _cc },
+    { 32,                 _wu_gc },
+    { _ei_gc1->nr_irqs(), _ei_gc1 },
+    { _ei_gc2->nr_irqs(), _ei_gc2 },
+    { _ei_gc3->nr_irqs(), _ei_gc3 },
+    { _ei_gc4->nr_irqs(), _ei_gc4 },
   };
 
   _block = socblock;
index 6c0b8a6ffd30cef7c60ab1609ccfd6080612386a..0d787a2f1dd9586b750c698a0710657b3134deb4 100644 (file)
@@ -59,7 +59,7 @@ IMPLEMENTATION [exynos && arm_em_ns && arm_smif_mc]:
 
 IMPLEMENT
 void
-Exynos_smc::cpuboot(Mword phys_start, unsigned cpu)
+Exynos_smc::cpuboot(Mword, unsigned cpu)
 {
   call(Cpu1boot, cpu);
 }
index be23d89dc238f10e1efecf805b87e8603e8fc418..b3d503e79fdd29bcf7c620213834a61158caa1a9 100644 (file)
@@ -7,6 +7,7 @@ INTERFACE:
 class Boot_alloced
 {
 private:
+  enum { Debug_boot_alloc };
   struct Block : cxx::S_list_item
   { size_t size; };
 
@@ -39,7 +40,8 @@ PUBLIC static
 void *
 Boot_alloced::alloc(size_t size)
 {
-  printf("Boot_alloc: size=0x%lx\n", (unsigned long)size);
+  if (Debug_boot_alloc)
+    printf("Boot_alloc: size=0x%lx\n", (unsigned long)size);
 
   // this is best fit list-based allocation
 
@@ -61,8 +63,9 @@ Boot_alloced::alloc(size_t size)
        alloc_size <<= 1;
 
       Block *b = (Block*)Kmem_alloc::allocator()->unaligned_alloc(alloc_size);
-      printf("Boot_alloc: allocated extra memory block @%p (size=%lx)\n",
-             b, alloc_size);
+      if (Debug_boot_alloc)
+        printf("Boot_alloc: allocated extra memory block @%p (size=%lx)\n",
+               b, alloc_size);
 
       if (!b)
        return 0;
@@ -76,12 +79,14 @@ Boot_alloced::alloc(size_t size)
   void *b = *best;
   Block *rem = (Block *)(((Address)b + size + sizeof(Block) - 1) & ~(sizeof(Block) - 1));
   long rem_sz = (Address)b + (*best)->size - (Address)rem;
-  printf("Boot_alloc: @ %p\n", b);
+  if (Debug_boot_alloc)
+    printf("Boot_alloc: @ %p\n", b);
   if (rem_sz > (long)sizeof(Block))
     {
       rem->size = rem_sz;
       _free.replace(best, rem);
-      printf("Boot_alloc: remaining free block @ %p (size=%lx)\n", rem, rem_sz);
+      if (Debug_boot_alloc)
+        printf("Boot_alloc: remaining free block @ %p (size=%lx)\n", rem, rem_sz);
     }
   else
     _free.erase(best);
index 6e40cda294f9390b76edadbdebd82ecd04a1b47a..6cbb1d52be616a48cd1048e6c6513c45c8c7eb46 100644 (file)
@@ -29,6 +29,8 @@ IMPLEMENT FIASCO_INIT
 void Boot_console::init()
 {
   keyb.construct();
+  if (Koptions::o()->opt(Koptions::F_keymap_de))
+    keyb->set_keymap(Keyb::Keymap_de);
   Kconsole::console()->register_console(keyb);
 
   if (Koptions::o()->opt(Koptions::F_noscreen))
index e3e8bf0b7a2a46f229708044cc6cbe37b628f70d..3727858a04b72ce34b6b08e23c006969741ab325 100644 (file)
@@ -20,6 +20,7 @@ namespace L4_kernel_options
     F_apic              = 1 << 8,
     F_loadcnt           = 1 << 9,
     F_watchdog          = 1 << 10,
+    F_keymap_de         = 1 << 11,
     F_irq0              = 1 << 13,
     F_nosfn             = 1 << 15,
     F_jdb_never_stop    = 1 << 16,
index d445e825bc686d57372f3f3286c92f21383c343d..edf1b7d05c1a182e9827ee43516a2be171ac24b2 100644 (file)
@@ -19,7 +19,7 @@ The L4Re specific parts will be described herein.
   </li>
   <li>Return the local thread capability of a pthread thread:
 
-  Use \c pthread_getl4cap(pthread_t *t) to get the capability index of
+  Use \c pthread_getl4cap(pthread_t t) to get the capability index of
   the pthread t.
 
   For example:
diff --git a/l4/mk/platforms/exynos4.conf b/l4/mk/platforms/exynos4.conf
new file mode 100644 (file)
index 0000000..c9ecac0
--- /dev/null
@@ -0,0 +1,4 @@
+PLATFORM_NAME        = "Samsung Exynos4"
+PLATFORM_ARCH        = arm
+PLATFORM_RAM_BASE    = 0x40000000
+PLATFORM_RAM_SIZE_MB = 1024
diff --git a/l4/mk/platforms/exynos5.conf b/l4/mk/platforms/exynos5.conf
new file mode 100644 (file)
index 0000000..10f33ef
--- /dev/null
@@ -0,0 +1,4 @@
+PLATFORM_NAME        = "Samsung Exynos5"
+PLATFORM_ARCH        = arm
+PLATFORM_RAM_BASE    = 0x40000000
+PLATFORM_RAM_SIZE_MB = 2047
index 6e5cf757f8456b059bbfa2081e9cc41fc119f580..aaa657039c29b138eca14078adecd7be3df05292 100644 (file)
@@ -132,6 +132,14 @@ LOADER_MBI  := 1
 CPPFLAGS         += -DSINGLE_SECTION
 endif
 
+ifeq ($(ARCH),ppc32)
+LOADER_MBI      := 1
+endif
+
+ifeq ($(ARCH),sparc)
+LOADER_MBI      := 1
+endif
+
 
 # convenience
 ifneq ($(E),)
@@ -230,11 +238,11 @@ LOADER_MBI         = 1
 CPPFLAGS       += -DREALMODE_LOADING -DSINGLE_SECTION
 # don't install bootstrap_$(ENTRY_FN).elf
 INSTALL_FILES   = bootstrap.load
+MOD_ADDR        = 0x00150000
 endif
 
 ifneq ($(LOADER_MBI),0)
 SRC_CC         += loader_mbi.cc
-MOD_ADDR        = 0x00150000
 CPPFLAGS       += -DLOADER_MBI
 endif
 
index a84a1ca38867733b173c56595b909976bf252bea..26341e6535179ecac014b0a3159b71bea5f074e2 100644 (file)
@@ -21,6 +21,8 @@ SUPPORT_CC_arm-om              := platform/om.cc
 SUPPORT_CC_arm-kirkwood        := platform/kirkwood.cc
 SUPPORT_CC_arm-rpi_a           := platform/rpi.cc
 SUPPORT_CC_arm-rpi_b           := platform/rpi.cc
+SUPPORT_CC_arm-exynos4         := platform/exynos.cc
+SUPPORT_CC_arm-exynos5         := platform/exynos.cc
 
 # PPC
 SUPPORT_CC_ppc32-mpc5200       := platform/mpc5200.cc
index e2e2adb81791903b7e4e98cc25963bae582327ea..22382d6ec333a9297482c85cd2f4f00d7077b9b7 100755 (executable)
@@ -130,8 +130,9 @@ sub build_obj($$$)
   unlink("$modname.extra.s", "$modname.obj", "$modname.ugz");
 }
 
-sub build_mbi_modules_obj(@)
+sub build_mbi_modules_obj($@)
 {
+  my $cmdline = shift;
   my @mods = @_;
   my $asm_string;
 
@@ -159,6 +160,10 @@ sub build_mbi_modules_obj(@)
                    ".ascii \"$mods[$i]->{cmdline}\"; .byte 0; \n";
   }
 
+  $asm_string .= ".global _mbi_cmdline          \n".
+                 "_mbi_cmdline:                 \n".
+                 ".ascii \"$cmdline\"; .byte 0; \n";
+
   write_to_file("mbi_modules.s", $asm_string);
   system("$prog_cc $flags_cc -c -o mbi_modules.bin mbi_modules.s");
   unlink("mbi_modules.s");
@@ -178,7 +183,7 @@ sub build_objects(@)
     $mods[$i]->{modname} = sprintf "mod%02d", $i;
   }
 
-  build_mbi_modules_obj(@mods);
+  build_mbi_modules_obj($entry{bootstrap}{cmdline}, @mods);
 
   for (my $i = 0; $i < @mods; $i++) {
     build_obj($mods[$i]->{cmdline}, $mods[$i]->{modname},
@@ -205,7 +210,11 @@ sub list_files(@)
 sub dump_entry(@)
 {
   my %entry = @_;
-  print join(' ', map { $_->{cmdline} } @{$entry{mods}}), "\n";
+  print "modaddr=$entry{modaddr}\n";
+  print "$entry{bootstrap}{command}\n";
+  print "$entry{bootstrap}{cmdline}\n";
+  print join("\n", map { $_->{cmdline} } @{$entry{mods}}), "\n";
+  print join(' ', map { $_ } @{$entry{files}}), "\n";
 }
 
 # ------------------------------------------------------------------------
index 952a272487631d075b0beb221bc70530a200df4b..7e959d6a659538e4356dc2f33d9c2defd0da1487 100644 (file)
@@ -247,8 +247,7 @@ getchar(void)
 
   do
     c = uart()->get_char(0);
-  while (c == -1)
-    ;
+  while (c == -1);
   return c;
 }
 
index a007479f76fec802ecb1bfaf1d2e947479c49442..9c070fbce6ed33c1bfa1f3d555038370be616bf5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
+ * (c) 2008-2013 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
  *               Alexander Warg <warg@os.inf.tu-dresden.de>
  *     economic rights: Technische Universität Dresden (Germany)
  *
 
 #include "loader_mbi.h"
 
-l4util_mb_info_t loader_mbi;
+static l4util_mb_info_t my_loader_mbi;
 
-l4util_mb_info_t *init_loader_mbi(void *realmode_pointer)
+l4util_mb_info_t *loader_mbi()
 {
-  loader_mbi.flags      = L4UTIL_MB_MEMORY;
-  loader_mbi.mem_lower  = 0x9f * 4;
+  return &my_loader_mbi;
+}
+
+void loader_mbi_add_cmdline(const char *cmdline)
+{
+  my_loader_mbi.cmdline = (l4_uint32_t)(unsigned long)cmdline;
+  my_loader_mbi.flags |= L4UTIL_MB_CMDLINE;
+}
+
+l4util_mb_info_t *init_loader_mbi_x86_realmode(void *realmode_pointer)
+{
+  my_loader_mbi.flags     |= L4UTIL_MB_MEMORY;
+  my_loader_mbi.mem_lower  = 0x9f * 4;
 
   unsigned long *cmd_line_ptr;
 
-  loader_mbi.mem_upper  = *(unsigned long *)((char *)realmode_pointer + 0x1e0);
-  printf("Detected memory size: %dKB\n", loader_mbi.mem_upper);
+  my_loader_mbi.mem_upper  = *(unsigned long *)((char *)realmode_pointer + 0x1e0);
+  printf("Detected memory size: %dKB\n", my_loader_mbi.mem_upper);
 
   cmd_line_ptr = (unsigned long *)((char *)realmode_pointer + 0x228);
   if (cmd_line_ptr && *cmd_line_ptr)
     {
-      loader_mbi.flags |= L4UTIL_MB_CMDLINE;
-      loader_mbi.cmdline = *cmd_line_ptr;
+      my_loader_mbi.flags |= L4UTIL_MB_CMDLINE;
+      my_loader_mbi.cmdline = *cmd_line_ptr;
     }
-  
-  return &loader_mbi;
+
+  return &my_loader_mbi;
 }
index c9fe258604092433743f00d76688497e62770e30..62122eee001605b67c19962b4ca7658d3ccb9621 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
+ * (c) 2008-2013 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
  *               Alexander Warg <warg@os.inf.tu-dresden.de>
  *     economic rights: Technische Universität Dresden (Germany)
  *
@@ -12,6 +12,8 @@
 
 #include <l4/util/mb_info.h>
 
-l4util_mb_info_t *init_loader_mbi(void *);
+l4util_mb_info_t *loader_mbi();
+l4util_mb_info_t *init_loader_mbi_x86_realmode(void *);
+void loader_mbi_add_cmdline(const char *cmdline);
 
 #endif /* ! __BOOTSTRAP__LOADER_MBI_H__ */
index 68f96163e4e73798a8487db282c29e8f16e5184e..28ba4ab328edc382757131ed20ee0d6191a6f981 100644 (file)
@@ -2,11 +2,11 @@
  * \file
  * \brief  Support for Exynos platforms
  *
- * \author Adam Lackorznynski <adam@os.inf.tu-dresden.de>
+ * \author Adam Lackorzynski <adam@os.inf.tu-dresden.de>
  *
  */
 /*
- * (c) 2011-2013 Author(s)
+ * (c) 2013 Author(s)
  *     economic rights: Technische Universität Dresden (Germany)
  *
  * This file is part of TUD:OS and distributed under the terms of the
@@ -28,14 +28,30 @@ public:
   void init()
   {
     static L4::Uart_s5pv210 _uart;
+    const unsigned long uart_offset = 0x10000;
+    unsigned long uart_base;
     unsigned uart_nr = 2;
-    unsigned long uart_base = 0x12c00000;
-    unsigned long uart_offset = 0x10000;
+
+#ifdef PLATFORM_TYPE_exynos4
+    uart_base = 0x13800000;
+#else
+    uart_base = 0x12c00000;
+#endif
 
     static L4::Io_register_block_mmio r(uart_base + uart_nr * uart_offset);
     _uart.startup(&r);
     set_stdio_uart(&_uart);
   }
+
+  void reboot()
+  {
+#ifdef PLATFORM_TYPE_exynos4
+    *(unsigned *)0x10020400 = 1;
+#else
+    *(unsigned *)0x10040400 = 1;
+#endif
+  }
+
 };
 }
 
index ea1b18ff56c8fba56358ff55bc96476a99d17023..77543fe9aee79d69a948fe0d8aa7b5023f53ed71 100644 (file)
@@ -102,6 +102,7 @@ Region_list::add_nolimitcheck(Region const &region, bool may_overlap)
 
   *_end = region;
   ++_end;
+  _combined_size += region.size();
 }
 
 void
@@ -115,22 +116,22 @@ Region_list::add(Region const &region, bool may_overlap)
       return;
     }
 
-  if (mem.begin() >= _upper_limit)
+  if (_combined_size >= _max_combined_size)
     {
-      printf("  Dropping %s region ", _name);
+      printf("  Dropping '%s' region ", _name);
       mem.print();
-      printf(" due to %lld MB limit\n", _upper_limit >> 20);
+      printf(" due to %lld MB limit\n", _max_combined_size >> 20);
       return;
     }
 
-  if (mem.end() >= _upper_limit - 1)
+  if (_combined_size + mem.size() > _max_combined_size)
     {
-      printf("  Limiting %s region ", _name);
+      printf("  Limiting '%s' region ", _name);
       mem.print();
-      mem.end(_upper_limit - 1);
+      mem.end(mem.begin() + _max_combined_size - _combined_size - 1);
       printf(" to ");
       mem.print();
-      printf(" due to %lld MB limit\n", _upper_limit >> 20);
+      printf(" due to %lld MB limit\n", _max_combined_size >> 20);
     }
 
   add_nolimitcheck(mem, may_overlap);
@@ -159,7 +160,7 @@ Region_list::contains(Region const &o)
 void
 Region::print() const
 {
-  printf("  [%9llx, %9llx] {%9llx}", begin(), end(), end() - begin() + 1);
+  printf("  [%9llx, %9llx] {%9llx}", begin(), end(), size());
 }
 
 void
index 0890280a60df31b1da55090ba3775f74b856ffc6..8a20eeb8de3f627d0827374c7d3eafde146bc865 100644 (file)
@@ -68,6 +68,8 @@ public:
   void end(unsigned long long e) { _end = e; }
   /** Get the name of the region. */
   char const *name() const { return _name; }
+  /** Get size of the region */
+  unsigned long long size() const { return _end - _begin + 1; }
   /** Set the name of the region. */
   void name(char const *name) { _name = name; }
   /** Get the type of the region. */
@@ -124,12 +126,13 @@ public:
    */
   void init(Region *store, unsigned size,
             const char *name,
-            unsigned long long upper_limit = ~0ULL)
+            unsigned long long max_combined_size = ~0ULL)
   {
     _reg = _end = store;
     _max = _reg + size;
     _name = name;
-    _upper_limit = upper_limit;
+    _max_combined_size = max_combined_size;
+    _combined_size = 0;
   }
 
   /** Search for a region that overlaps o. */
@@ -145,12 +148,6 @@ public:
   unsigned long long find_free(Region const &search,
                                unsigned long long size, unsigned align);
 
-  /**
-   * Add a new memory region to the list. The new region must not overlap
-   * any known region.
-   */
-  void add_nolimitcheck(Region const &r, bool may_overlap = false);
-
   /**
    * Add a new region, with a upper limit check and verboseness.
    */
@@ -182,13 +179,19 @@ protected:
   Region *_reg;
 
   const char *_name;
-  unsigned long long _upper_limit;
+  unsigned long long _max_combined_size;
+  unsigned long long _combined_size;
 
 private:
   void swap(Region *a, Region *b);
   unsigned long long next_free(unsigned long long start);
   bool test_fit(unsigned long long start, unsigned long long _size);
 
+  /**
+   * Add a new memory region to the list. The new region must not overlap
+   * any known region.
+   */
+  void add_nolimitcheck(Region const &r, bool may_overlap = false);
 };
 
 #endif
index 9ac1e61c244e679651b9014168c00dec0dfbc83b..e6db7bf4e4e6e9f54aa10483a56919cabd502666 100644 (file)
@@ -332,8 +332,8 @@ dump_ram_map(bool show_total = false)
   for (Region *i = ram.begin(); i < ram.end(); ++i)
     {
       printf("  RAM: %016llx - %016llx: %lldkB\n",
-             i->begin(), i->end(), (i->end() - i->begin() + 1) >> 10);
-      sum += i->end() - i->begin() + 1;
+             i->begin(), i->end(), i->size() >> 10);
+      sum += i->size();
     }
   if (show_total)
     printf("  Total RAM: %lldMB\n", sum >> 20);
@@ -934,6 +934,7 @@ extern mod_info _module_info_end[];
 
 extern l4util_mb_mod_t _modules_mbi_start[];
 extern l4util_mb_mod_t _modules_mbi_end[];
+extern char _mbi_cmdline[];
 
 /**
  * Create the basic multi-boot structure in IMAGE_MODE
@@ -1111,6 +1112,22 @@ startup(l4util_mb_info_t *mbi, l4_umword_t flag,
         ;
     }
 
+#ifdef IMAGE_MODE
+    {
+      loader_mbi_add_cmdline(_mbi_cmdline);
+      mbi = loader_mbi();
+    }
+#endif
+
+  if (check_arg(mbi, "-wait"))
+    {
+      puts("\nL4 Bootstrapper is waiting for key input to continue...");
+      if (getchar() == -1)
+        puts("   ...no key input available.");
+      else
+        puts("    ...going on.");
+    }
+
   puts("\nL4 Bootstrapper");
   puts("  Build: #" BUILD_NR " " BUILD_DATE
 #ifdef ARCH_x86
@@ -1140,7 +1157,7 @@ startup(l4util_mb_info_t *mbi, l4_umword_t flag,
 
 #ifdef REALMODE_LOADING
   /* create synthetic multi boot info */
-  mbi = init_loader_mbi(realmode_si);
+  mbi = init_loader_mbi_x86_realmode(realmode_si);
   (void)flag;
 #else
   (void)realmode_si;
@@ -1148,27 +1165,24 @@ startup(l4util_mb_info_t *mbi, l4_umword_t flag,
 #endif
 
 #elif defined(ARCH_arm)
-  l4util_mb_info_t my_mbi;
-  memset(&my_mbi, 0, sizeof(my_mbi));
-  mbi = &my_mbi;
+  mbi = loader_mbi();
 
   (void)realmode_si;
   (void)flag;
 
 #elif defined(ARCH_ppc32)
+  mbi = loader_mbi();
+
   (void)realmode_si;
   (void)flag;
 
-  l4util_mb_info_t my_mbi;
   L4_drivers::Of_if of_if;
 
   printf("  Detecting ram size ...\n");
   unsigned long ram_size = of_if.detect_ramsize();
   printf("    Total memory size is %luMB\n", ram_size / (1024 * 1024));
 
-  /* setup mbi and detect OF devices */
-  memset(&my_mbi, 0, sizeof(my_mbi));
-  mbi = &my_mbi;
+  /* detect OF devices */
   unsigned long drives_addr, drives_length;
 
   if (of_if.detect_devices(&drives_addr, &drives_length))
@@ -1180,9 +1194,7 @@ startup(l4util_mb_info_t *mbi, l4_umword_t flag,
   ram.add(Region::n(0x0, ram_size, ".ram", Region::Ram));
 
 #elif defined(ARCH_sparc)
-  l4util_mb_info_t my_mbi;
-  memset(&my_mbi, 0, sizeof(my_mbi));
-  mbi = &my_mbi;
+  mbi = loader_mbi();
 
   (void)realmode_si;
   (void)flag;
@@ -1203,7 +1215,7 @@ startup(l4util_mb_info_t *mbi, l4_umword_t flag,
     roottask = 0;
 
   if (const char *s = check_arg(mbi, "-modaddr"))
-    _mod_addr = strtoul(s + 9, 0, 0);
+    _mod_addr = RAM_BASE + strtoul(s + 9, 0, 0);
 
   _mod_addr = l4_round_page(_mod_addr);
 
index 2763f755ec638a2114c200335fdc5167315b073c..860c4762022b5125832c4b1c13e9245693d5f2af 100644 (file)
@@ -75,7 +75,7 @@ public:
     unsigned long ram_size_mb = scan_ram_size(RAM_BASE, RAM_SIZE_MB);
     printf("  Memory size is %ldMB%s (%08lx - %08lx)\n",
            ram_size_mb, ram_size_mb != RAM_SIZE_MB ? " (Limited by Scan)" : "",
-           (unsigned long)RAM_BASE, RAM_BASE + (ram_size_mb << 20));
+           (unsigned long)RAM_BASE, RAM_BASE + (ram_size_mb << 20) - 1);
     ram->add(Region::n(RAM_BASE,
                        (unsigned long long)RAM_BASE + (ram_size_mb << 20),
                        ".ram", Region::Ram));
index 846d1d7b9e56446119e553c04ec78e3c8f0c63c3..3ed3c0f464c02114cd873b1b66aece35f5265ca8 100644 (file)
@@ -397,8 +397,7 @@ L4_INLINE
 void
 l4_vm_vmx_copy_state(void const *vmcs, void *_dst, void const *_src) L4_NOTHROW
 {
-  l4_uint8_t const *offsets = (l4_uint8_t const *)vmcs;
-  offsets += 0x20;
+  l4_uint8_t const *offsets = (l4_uint8_t const *)vmcs + 0x20;
 
   unsigned offs = offsets[28] * 64;
   unsigned size = offsets[29] * 64;