]> rtime.felk.cvut.cz Git - l4.git/commitdiff
update
authorl4check <l4check@d050ee49-bd90-4346-b210-929a50b99cfc>
Sat, 11 May 2013 11:01:29 +0000 (11:01 +0000)
committerl4check <l4check@d050ee49-bd90-4346-b210-929a50b99cfc>
Sat, 11 May 2013 11:01:29 +0000 (11:01 +0000)
git-svn-id: http://svn.tudos.org/repos/oc/tudos/trunk@54 d050ee49-bd90-4346-b210-929a50b99cfc

140 files changed:
kernel/fiasco/src/jdb/ia32/jdb-ia32-amd64.cpp
kernel/fiasco/src/jdb/jdb.cpp
kernel/fiasco/src/jdb/ppc32/jdb-ppc32.cpp
kernel/fiasco/src/jdb/sparc/jdb-sparc.cpp
kernel/fiasco/src/kern/arm/bsp/exynos/pic-arm-gic-exynos.cpp
kernel/fiasco/src/kern/arm/bsp/tegra/Kconfig [new file with mode: 0644]
kernel/fiasco/src/kern/arm/bsp/tegra/Modules [new file with mode: 0644]
kernel/fiasco/src/kern/arm/bsp/tegra/bootstrap-arm-tegra.cpp [new file with mode: 0644]
kernel/fiasco/src/kern/arm/bsp/tegra/config-arm-tegra.cpp [new file with mode: 0644]
kernel/fiasco/src/kern/arm/bsp/tegra/kernel_uart-arm-tegra.cpp [new file with mode: 0644]
kernel/fiasco/src/kern/arm/bsp/tegra/mem_layout-arm-tegra.cpp [new file with mode: 0644]
kernel/fiasco/src/kern/arm/bsp/tegra/outer_cache-arm-tegra.cpp [new file with mode: 0644]
kernel/fiasco/src/kern/arm/bsp/tegra/pic-arm-tegra.cpp [new file with mode: 0644]
kernel/fiasco/src/kern/arm/bsp/tegra/platform_control-arm-tegra.cpp [new file with mode: 0644]
kernel/fiasco/src/kern/arm/bsp/tegra/reset-arm-tegra.cpp [new file with mode: 0644]
kernel/fiasco/src/kern/arm/bsp/tegra/timer-arm-tegra.cpp [new file with mode: 0644]
kernel/fiasco/src/kern/arm/bsp/tegra/uart-16550-arm-tegra.cpp [new file with mode: 0644]
kernel/fiasco/src/kern/arm/paging-arm.cpp
kernel/fiasco/src/kern/ia32/vmx.cpp
kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-1
kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-2
kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-vexpress-1
kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-vexpress-2
kernel/fiasco/src/templates/globalconfig.out.arm-imx21
kernel/fiasco/src/templates/globalconfig.out.arm-imx35
kernel/fiasco/src/templates/globalconfig.out.arm-imx51
kernel/fiasco/src/templates/globalconfig.out.arm-imx6
kernel/fiasco/src/templates/globalconfig.out.arm-int-1
kernel/fiasco/src/templates/globalconfig.out.arm-int-2
kernel/fiasco/src/templates/globalconfig.out.arm-kirkwood
kernel/fiasco/src/templates/globalconfig.out.arm-omap3evm
kernel/fiasco/src/templates/globalconfig.out.arm-omap4-panda
kernel/fiasco/src/templates/globalconfig.out.arm-pxa
kernel/fiasco/src/templates/globalconfig.out.arm-rv-1
kernel/fiasco/src/templates/globalconfig.out.arm-rv-2
kernel/fiasco/src/templates/globalconfig.out.arm-rv-3
kernel/fiasco/src/templates/globalconfig.out.arm-rv-4-noinl
kernel/fiasco/src/templates/globalconfig.out.arm-s3c
kernel/fiasco/src/templates/globalconfig.out.arm-sa
kernel/fiasco/src/templates/globalconfig.out.arm-t2
kernel/fiasco/src/templates/globalconfig.out.arm-v6
kernel/fiasco/src/templates/globalconfig.out.arm-v6-mp-eb
kernel/fiasco/src/templates/globalconfig.out.arm-v6-mp-pb
kernel/fiasco/src/templates/globalconfig.out.arm-v7
kernel/fiasco/src/templates/globalconfig.out.ux-2
kernel/fiasco/tool/kconfig/Makefile
kernel/fiasco/tool/kconfig/README
kernel/fiasco/tool/kconfig/scripts/Makefile.headersinst
kernel/fiasco/tool/kconfig/scripts/Makefile.lib
kernel/fiasco/tool/kconfig/scripts/Makefile.modpost
kernel/fiasco/tool/kconfig/scripts/basic/fixdep.c
kernel/fiasco/tool/kconfig/scripts/kconfig/Makefile
kernel/fiasco/tool/kconfig/scripts/kconfig/conf.c
kernel/fiasco/tool/kconfig/scripts/kconfig/expr.c
kernel/fiasco/tool/kconfig/scripts/kconfig/gconf.c
kernel/fiasco/tool/kconfig/scripts/kconfig/lkc.h
kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/check-lxdialog.sh
kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/dialog.h
kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/inputbox.c
kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/menubox.c
kernel/fiasco/tool/kconfig/scripts/kconfig/mconf.c
kernel/fiasco/tool/kconfig/scripts/kconfig/menu.c
kernel/fiasco/tool/kconfig/scripts/kconfig/nconf.c
kernel/fiasco/tool/kconfig/scripts/kconfig/nconf.gui.c
kernel/fiasco/tool/kconfig/scripts/kconfig/qconf.cc
kernel/fiasco/tool/kconfig/scripts/kconfig/symbol.c
kernel/fiasco/tool/kconfig/scripts/kconfig/util.c
kernel/fiasco/tool/kconfig/scripts/kconfig/zconf.l
kernel/fiasco/tool/kconfig/scripts/kconfig/zconf.lex.c_shipped
l4/mk/Makeconf
l4/mk/defconfig/config.arm-rv
l4/pkg/l4re/include/env
l4/pkg/l4re/include/impl/mem_alloc_impl.h
l4/pkg/l4re/include/mem_alloc
l4/pkg/l4re/util/include/kumem_alloc
l4/pkg/l4re_c/include/mem_alloc.h
l4/pkg/l4re_c/lib/src/mem_alloc.cc
l4/pkg/l4sys/include/ARCH-amd64/utcb.h
l4/pkg/l4sys/include/ARCH-arm/L4API-l4f/ipc.h
l4/pkg/l4sys/include/ARCH-arm/utcb.h
l4/pkg/l4sys/include/ARCH-ppc32/L4API-l4f/ipc.h
l4/pkg/l4sys/include/ARCH-ppc32/utcb.h
l4/pkg/l4sys/include/ARCH-sparc/L4API-l4f/ipc.h
l4/pkg/l4sys/include/ARCH-x86/utcb.h
l4/pkg/l4sys/include/__vm-vmx.h
l4/pkg/l4sys/include/compiler.h
l4/pkg/l4sys/include/utcb.h
l4/pkg/l4util/include/ARCH-amd64/cpu.h
l4/pkg/l4util/include/ARCH-arm/irq.h
l4/pkg/l4util/include/ARCH-sparc/irq.h
l4/pkg/l4util/include/ARCH-x86/cpu.h
l4/pkg/libc_backends/Control
l4/pkg/libc_backends/lib/l4re_file/file.cc
l4/pkg/libc_backends/lib/sig_noop/Makefile [new file with mode: 0644]
l4/pkg/libc_backends/lib/sig_noop/sig.cc [new file with mode: 0644]
l4/pkg/libcrypto/Control
l4/pkg/libcrypto/examples/test/Makefile
l4/pkg/libcrypto/include/private/linux.h
l4/pkg/libcrypto/include/private/sha1_linux.h
l4/pkg/libcrypto/include/sha1.h
l4/pkg/libcrypto/lib/Makefile
l4/pkg/libcrypto/lib/sha1_linux_new/Makefile [new file with mode: 0644]
l4/pkg/libcrypto/lib/sha1_linux_new/cryptohash.h [new file with mode: 0644]
l4/pkg/libcrypto/lib/sha1_linux_new/extra.h [new file with mode: 0644]
l4/pkg/libcrypto/lib/sha1_linux_new/sha1.c [new file with mode: 0644]
l4/pkg/libcrypto/lib/sha1_linux_new/sha1_generic.c [new file with mode: 0644]
l4/pkg/libpng/lib/build/Makefile
l4/pkg/lxfuxlibc/include/lxfuxlc.h
l4/pkg/lxfuxlibc/lib/src/lxfuxlc.c
l4/pkg/moe/server/src/alloc.cc
l4/pkg/moe/server/src/alloc.h
l4/pkg/sqlite/lib/README
l4/pkg/sqlite/lib/contrib/configure
l4/pkg/sqlite/lib/contrib/configure.ac
l4/pkg/sqlite/lib/contrib/sqlite3.c
l4/pkg/sqlite/lib/contrib/sqlite3.h
l4/tool/kconfig/Makefile
l4/tool/kconfig/README
l4/tool/kconfig/scripts/Makefile.headersinst
l4/tool/kconfig/scripts/Makefile.lib
l4/tool/kconfig/scripts/Makefile.modpost
l4/tool/kconfig/scripts/basic/fixdep.c
l4/tool/kconfig/scripts/kconfig/Makefile
l4/tool/kconfig/scripts/kconfig/conf.c
l4/tool/kconfig/scripts/kconfig/expr.c
l4/tool/kconfig/scripts/kconfig/gconf.c
l4/tool/kconfig/scripts/kconfig/lkc.h
l4/tool/kconfig/scripts/kconfig/lxdialog/check-lxdialog.sh
l4/tool/kconfig/scripts/kconfig/lxdialog/dialog.h
l4/tool/kconfig/scripts/kconfig/lxdialog/inputbox.c
l4/tool/kconfig/scripts/kconfig/lxdialog/menubox.c
l4/tool/kconfig/scripts/kconfig/mconf.c
l4/tool/kconfig/scripts/kconfig/menu.c
l4/tool/kconfig/scripts/kconfig/nconf.c
l4/tool/kconfig/scripts/kconfig/nconf.gui.c
l4/tool/kconfig/scripts/kconfig/qconf.cc
l4/tool/kconfig/scripts/kconfig/symbol.c
l4/tool/kconfig/scripts/kconfig/util.c
l4/tool/kconfig/scripts/kconfig/zconf.l
l4/tool/kconfig/scripts/kconfig/zconf.lex.c_shipped

index a9145d58e3c931b077e3f4e47dd4313e005585c5..f3103f31a07428fb6df1179d691eaf5d81f73cfd 100644 (file)
@@ -827,6 +827,9 @@ Jdb::handle_user_request(Cpu_number cpu)
 {
   Jdb_entry_frame *entry_frame = Jdb::entry_frame.cpu(cpu);
 
+  if (entry_frame->debug_ipi())
+    return cpu != Cpu_number::boot_cpu();
+
   if (entry_frame->_trapno == 3)
     {
       Space *task = get_task(cpu);
index 6a944eec3a77c24c5a8b538acc06fc3d9c532a74..2e63342219885316c995352c3b2acc215c363461 100644 (file)
@@ -938,7 +938,7 @@ Jdb_base_cmds::action (int cmd, void *&, char const *&, int &)
     return NOTHING;
 
   Jdb_core::short_mode = !Jdb_core::short_mode;
-  printf("\ntoggle mode: now in %s command mode (use %s) to switch back\n",
+  printf("\ntoggle mode: now in %s command mode (use '%s' to switch back)\n",
          Jdb_core::short_mode ? "short" : "long",
          Jdb_core::short_mode ? "*" : "mode");
   return NOTHING;
index cdc9d7b288317e98998c00853903ce67d0600954..08bca1c4b1019322df8169c4a5f477c1b76033b2 100644 (file)
@@ -71,6 +71,9 @@ Jdb::handle_user_request(Cpu_number cpu)
   Space * task = get_task(cpu);
   char tmp;
 
+  if (ef->debug_ipi())
+    return cpu != Cpu_number::boot_cpu();
+
   if (!peek(str, task, tmp) || tmp != '*')
     return false;
   if (!peek(str+1, task, tmp) || tmp != '#')
index 962cf2c75c377fd59387206ea4f6023b6a1118dd..a378ccc39dada5163bff6b2cf553f67d43550f90 100644 (file)
@@ -71,6 +71,9 @@ Jdb::handle_user_request(Cpu_number cpu)
   Space * task = get_task(cpu);
   char tmp;
 
+  if (ef->debug_ipi())
+    return cpu != Cpu_number::boot_cpu();
+
   if (!peek(str, task, tmp) || tmp != '*')
     return false;
   if (!peek(str+1, task, tmp) || tmp != '#')
index 40d17baf8891d8c31fa49935b00997d67fddbdb2..6f6dd76a0dcc952039c3d2212f5500944d5d5a47 100644 (file)
@@ -434,8 +434,8 @@ Mgr_int::Mgr_int()
 
   _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), 16 * 8);
+  _ei_gc2 = new Boot_object<Gpio_eint_chip>(Kmem::mmio_remap(Mem_layout::Gpio2_phys_base), (29 - 21 + 1) * 8);
 
   // Combiners
   for (unsigned i = 0; i < 40; ++i)
@@ -481,11 +481,11 @@ Mgr_int::Mgr_int()
   _cc->unmask(8 * 24 + 0);
 
   static Chip_block soc[] = {
-    { 96,                _gic },
-    { 54 * 8,            _cc },
-    { 32,                _wu_gc },
-    { 16 * 8,            _ei_gc1 },
-    { (29 - 21 + 1) * 8, _ei_gc2 },
+    { 96,                 _gic },
+    { 54 * 8,             _cc },
+    { 32,                 _wu_gc },
+    { _ei_gc1->nr_irqs(), _ei_gc1 },
+    { _ei_gc2->nr_irqs(), _ei_gc2 },
   };
 
   _block = soc;
diff --git a/kernel/fiasco/src/kern/arm/bsp/tegra/Kconfig b/kernel/fiasco/src/kern/arm/bsp/tegra/Kconfig
new file mode 100644 (file)
index 0000000..9f47294
--- /dev/null
@@ -0,0 +1,34 @@
+# PF: TEGRA
+# PFDESCR: NVIDIA Tegra platform
+# PFSELECT: CAN_ARM_CPU_CORTEX_A9 CAN_ARM_CACHE_L2CXX0
+# PFDEPENDS: ARM
+
+choice
+       prompt "Tegra Platform"
+       default PF_TEGRA2
+
+config PF_TEGRA2
+       bool "Tegra2"
+       depends on PF_TEGRA
+
+config PF_TEGRA3
+       bool "Tegra3"
+       depends on PF_TEGRA
+
+endchoice
+
+choice
+       prompt "Platform Timer"
+       default PF_TEGRA_TIMER_MP
+
+config PF_TEGRA_TIMER_MP
+       bool "MP timer"
+       help
+         ARM local-core multi-processor timer.
+
+config PF_TEGRA_TIMER_TMR
+       bool "TMR timer"
+       help
+         Single broadcasting timer.
+
+endchoice
diff --git a/kernel/fiasco/src/kern/arm/bsp/tegra/Modules b/kernel/fiasco/src/kern/arm/bsp/tegra/Modules
new file mode 100644 (file)
index 0000000..3b62051
--- /dev/null
@@ -0,0 +1,27 @@
+# vim:set ft=make:
+
+PREPROCESS_PARTS        += tegra 16550 pic_gic generic_tickless_idle
+PREPROCESS_PARTS-$(CONFIG_PF_TEGRA2) += tegra2
+PREPROCESS_PARTS-$(CONFIG_PF_TEGRA3) += tegra3
+PREPROCESS_PARTS-$(CONFIG_PF_TEGRA_TIMER_MP)  += mptimer
+PREPROCESS_PARTS-$(CONFIG_PF_TEGRA_TIMER_TMR) += tegra_timer_tmr
+RAM_PHYS_BASE-$(CONFIG_PF_TEGRA2) := $(if $(CONFIG_ARM_EM_TZ),0x30000000,0x0)
+RAM_PHYS_BASE-$(CONFIG_PF_TEGRA3) := $(if $(CONFIG_ARM_EM_TZ),0xa0000000,0x80000000)
+RAM_PHYS_BASE                     := $(RAM_PHYS_BASE-y)
+INTERFACES_KERNEL       += gic
+MPCORE_PHYS_BASE        := 0x50040000
+
+uart_IMPL             += uart-16550 uart-16550-arm-tegra
+config_IMPL           += config-arm-tegra
+mem_layout_IMPL       += mem_layout-arm-tegra
+pic_IMPL              += pic-gic pic-arm-tegra
+bootstrap_IMPL        += bootstrap-arm-tegra
+timer_IMPL            += $(if $(CONFIG_PF_TEGRA_TIMER_MP),timer-arm-tegra timer-arm-mptimer)
+timer_IMPL            += $(if $(CONFIG_PF_TEGRA_TIMER_TMR),timer-arm-tegra)
+timer_tick_IMPL       += $(if $(CONFIG_PF_TEGRA_TIMER_MP),timer_tick-single-vector)
+timer_tick_IMPL       += $(if $(CONFIG_PF_TEGRA_TIMER_TMR),timer_tick-broadcast)
+kernel_uart_IMPL      += kernel_uart-arm-tegra
+reset_IMPL            += reset-arm-tegra
+clock_IMPL            += clock-generic
+platform_control_IMPL += platform_control-arm-tegra
+outer_cache_IMPL      += outer_cache-arm-tegra
diff --git a/kernel/fiasco/src/kern/arm/bsp/tegra/bootstrap-arm-tegra.cpp b/kernel/fiasco/src/kern/arm/bsp/tegra/bootstrap-arm-tegra.cpp
new file mode 100644 (file)
index 0000000..f343559
--- /dev/null
@@ -0,0 +1,5 @@
+INTERFACE [arm && tegra]:
+
+namespace Bootstrap {
+enum { Cache_flush_area = 0, };
+}
diff --git a/kernel/fiasco/src/kern/arm/bsp/tegra/config-arm-tegra.cpp b/kernel/fiasco/src/kern/arm/bsp/tegra/config-arm-tegra.cpp
new file mode 100644 (file)
index 0000000..94dba2e
--- /dev/null
@@ -0,0 +1,7 @@
+INTERFACE[arm && tegra2]:
+
+#define TARGET_NAME "Tegra2"
+
+INTERFACE[arm && tegra3]:
+
+#define TARGET_NAME "Tegra3"
diff --git a/kernel/fiasco/src/kern/arm/bsp/tegra/kernel_uart-arm-tegra.cpp b/kernel/fiasco/src/kern/arm/bsp/tegra/kernel_uart-arm-tegra.cpp
new file mode 100644 (file)
index 0000000..0221f01
--- /dev/null
@@ -0,0 +1,26 @@
+INTERFACE:
+
+// On ARM the MMIO for the uart is accessible before the MMU is fully up
+EXTENSION class Kernel_uart { enum { Bsp_init_mode = Init_before_mmu }; };
+
+IMPLEMENTATION [arm && tegra2 && serial]:
+
+#include "kmem.h"
+
+IMPLEMENT
+bool Kernel_uart::startup(unsigned, int)
+{
+  return Uart::startup(Kmem::mmio_remap(Mem_layout::Uart_phys_base) + 0x300 /* UARTD */, 122);
+}
+
+IMPLEMENTATION [arm && tegra3 && serial]:
+
+#include "kmem.h"
+
+IMPLEMENT
+bool Kernel_uart::startup(unsigned, int)
+{
+  if (0)
+    return Uart::startup(Kmem::mmio_remap(Mem_layout::Uart_phys_base), 68); // uarta
+  return Uart::startup(Kmem::mmio_remap(Mem_layout::Uart_phys_base) + 0x200, 78); // uartc
+}
diff --git a/kernel/fiasco/src/kern/arm/bsp/tegra/mem_layout-arm-tegra.cpp b/kernel/fiasco/src/kern/arm/bsp/tegra/mem_layout-arm-tegra.cpp
new file mode 100644 (file)
index 0000000..f93a86e
--- /dev/null
@@ -0,0 +1,21 @@
+INTERFACE [arm && tegra]:
+
+EXTENSION class Mem_layout
+{
+public:
+  enum Phys_layout_tegra : Address
+  {
+    Mp_scu_phys_base      = 0x50040000,
+    L2cxx0_phys_base      = 0x50043000,
+
+    Gic_cpu_phys_base     = 0x50040100,
+    Gic_dist_phys_base    = 0x50041000,
+    Gic2_cpu_phys_base    = 0x50020000,
+    Gic2_dist_phys_base   = 0x50021000,
+
+    Tmr_phys_base         = 0x60005000,
+    Clock_reset_phys_base = 0x60006000,
+    Uart_phys_base        = 0x70006000,
+    Pmc_phys_base         = 0x7000e400,
+  };
+};
diff --git a/kernel/fiasco/src/kern/arm/bsp/tegra/outer_cache-arm-tegra.cpp b/kernel/fiasco/src/kern/arm/bsp/tegra/outer_cache-arm-tegra.cpp
new file mode 100644 (file)
index 0000000..620935d
--- /dev/null
@@ -0,0 +1,18 @@
+IMPLEMENTATION [arm && tegra && outer_cache_l2cxx0]:
+
+IMPLEMENT
+Mword
+Outer_cache::platform_init(Mword aux_control)
+{
+  l2cxx0->write<Mword>(0x331, L2cxx0::TAG_RAM_CONTROL);
+  l2cxx0->write<Mword>(0x441, L2cxx0::DATA_RAM_CONTROL);
+
+  aux_control &= 0x8200c3fe;
+  aux_control |=   (1 <<  0)  // Full Line of Zero Enable
+                 | (4 << 17)  // 128kb waysize
+                 | (1 << 28)  // data prefetch
+                 | (1 << 29)  // insn prefetch
+                 | (1 << 30)  // early BRESP enable
+                ;
+  return aux_control;
+}
diff --git a/kernel/fiasco/src/kern/arm/bsp/tegra/pic-arm-tegra.cpp b/kernel/fiasco/src/kern/arm/bsp/tegra/pic-arm-tegra.cpp
new file mode 100644 (file)
index 0000000..0c50059
--- /dev/null
@@ -0,0 +1,42 @@
+INTERFACE [arm && pic_gic && tegra]:
+
+#include "gic.h"
+
+//-------------------------------------------------------------------
+IMPLEMENTATION [arm && pic_gic && tegra]:
+
+#include "irq_chip.h"
+#include "irq_mgr_multi_chip.h"
+#include "gic.h"
+#include "kmem.h"
+
+IMPLEMENT FIASCO_INIT
+void Pic::init()
+{
+  typedef Irq_mgr_multi_chip<8> M;
+
+  M *m = new Boot_object<M>(1);
+
+  gic.construct(Kmem::mmio_remap(Mem_layout::Gic_cpu_phys_base),
+                Kmem::mmio_remap(Mem_layout::Gic_dist_phys_base));
+  m->add_chip(0, gic, gic->nr_irqs());
+
+  Irq_mgr::mgr = m;
+}
+
+IMPLEMENT inline
+Pic::Status Pic::disable_all_save()
+{ return 0; }
+
+IMPLEMENT inline
+void Pic::restore_all(Status)
+{}
+
+//-------------------------------------------------------------------
+IMPLEMENTATION [arm && mp && pic_gic && tegra]:
+
+PUBLIC static
+void Pic::init_ap(Cpu_number, bool resume)
+{
+  gic->init_ap(resume);
+}
diff --git a/kernel/fiasco/src/kern/arm/bsp/tegra/platform_control-arm-tegra.cpp b/kernel/fiasco/src/kern/arm/bsp/tegra/platform_control-arm-tegra.cpp
new file mode 100644 (file)
index 0000000..d5cbbf0
--- /dev/null
@@ -0,0 +1,167 @@
+INTERFACE [arm && mp && tegra]:
+
+#include "mem_layout.h"
+
+EXTENSION class Platform_control
+{
+private:
+  enum
+  {
+    Reset_vector_addr              = 0x6000f100,
+    Clk_rst_ctrl_clk_cpu_cmplx     = 0x6000604c,
+    Clk_rst_ctrl_rst_cpu_cmplx_clr = 0x60006344,
+    Unhalt_addr                    = 0x60007014,
+
+    CLK_RST_CONTROLLER_RST_CPU_CMPLX_SET = 0x340,
+    CLK_RST_CONTROLLER_RST_CPU_CMPLX_CLR = 0x344,
+  };
+
+  static Mword _orig_reset_vector;
+};
+
+INTERFACE [arm && mp && tegra3]:
+
+EXTENSION class Platform_control
+{
+private:
+  enum
+  {
+    PMC_PWRGATE_TOGGLE          = 0x30,
+    PMC_PWRGATE_REMOVE_CLAMPING = 0x34,
+    PMC_PWRGATE_STATUS_0        = 0x38,
+
+    PMC_PWRGATE_TOGGLE_START = 1 << 8,
+
+    CLK_RST_CONTROLLER_CLK_CPU_CMPLX_SET_0 = 0x348,
+    CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR_0 = 0x34c,
+  };
+};
+
+// ------------------------------------------------------------------------
+IMPLEMENTATION [arm && mp && tegra2 && !arm_em_ns]:
+
+PRIVATE static
+void
+Platform_control::init_cpus()
+{
+  // clocks on other cpu
+  Mword r = Io::read<Mword>(Kmem::mmio_remap(Clk_rst_ctrl_clk_cpu_cmplx));
+  Io::write<Mword>(r & ~(1 << 9), Kmem::mmio_remap(Clk_rst_ctrl_clk_cpu_cmplx));
+  Io::write<Mword>((1 << 13) | (1 << 9) | (1 << 5) | (1 << 1),
+                  Kmem::mmio_remap(Clk_rst_ctrl_rst_cpu_cmplx_clr));
+
+  // kick cpu1
+  Io::write<Mword>(0, Kmem::mmio_remap(Unhalt_addr));
+}
+
+// ------------------------------------------------------------------------
+IMPLEMENTATION [arm && mp && tegra3]:
+
+#include "io.h"
+#include "mem.h"
+#include "kmem.h"
+#include "mmio_register_block.h"
+#include "poll_timeout_kclock.h"
+
+PRIVATE static
+Mword
+Platform_control::pwr_status(int gate)
+{
+  Mword r = Io::read<Mword>(Kmem::mmio_remap(Kmem::Pmc_phys_base + PMC_PWRGATE_STATUS_0));
+  return r & (1 << gate);
+}
+
+PRIVATE static
+void
+Platform_control::delay()
+{
+  for (int delay = 20000; delay; --delay)
+    Mem::barrier();
+}
+
+PRIVATE static
+void
+Platform_control::init_cpus()
+{
+  int cpu_powergates[4]        = { 0, 9, 10, 11 };
+  int flowctrl_cpu_halt_ofs[4] = { 0, 0x14, 0x1c, 0x24 };
+  int flowctrl_cpu_csr_ofs[4]  = { 8, 0x18, 0x20, 0x28 };
+  Mmio_register_block clk_rst(Kmem::mmio_remap(Mem_layout::Clock_reset_phys_base));
+  Mmio_register_block pmc(Kmem::mmio_remap(Mem_layout::Pmc_phys_base));
+  Mmio_register_block flow_ctrl(Kmem::mmio_remap(0x60007000));
+
+  for (unsigned i = 1; i < 4; ++i)
+    {
+      assert(i < 4);
+      int gate = cpu_powergates[i];
+
+      // put cpu into reset
+      clk_rst.write<Mword>(0x1111 << i, CLK_RST_CONTROLLER_RST_CPU_CMPLX_SET);
+      Mem::dmb();
+
+      // flowctrl halt
+      flow_ctrl.write<Mword>(0, flowctrl_cpu_halt_ofs[i]);
+      flow_ctrl.read<Mword>(flowctrl_cpu_halt_ofs[i]);
+
+      if (!pwr_status(gate))
+        {
+          pmc.write<Mword>(PMC_PWRGATE_TOGGLE_START | gate, PMC_PWRGATE_TOGGLE);
+
+          Poll_timeout_kclock pt(100000);
+          while (pt.test(pwr_status(gate)))
+            Proc::pause();
+
+          if (pt.timed_out())
+            return;
+        }
+
+      // power is on now
+
+      // enable cpu clock
+      clk_rst.write<Mword>(1 << (8 + i), CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR_0);
+      clk_rst.read<Mword>(CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR_0);
+      delay();
+
+      // remove clamping
+      pmc.write<Mword>(1 << gate, PMC_PWRGATE_REMOVE_CLAMPING);
+      delay();
+
+      // clear flow csr
+      flow_ctrl.write<Mword>(0, flowctrl_cpu_csr_ofs[i]);
+      Mem::wmb();
+      flow_ctrl.read<Mword>(flowctrl_cpu_csr_ofs[i]);
+
+      // out of reset
+      clk_rst.write<Mword>(0x1111 << i, CLK_RST_CONTROLLER_RST_CPU_CMPLX_CLR);
+      Mem::wmb();
+    }
+}
+
+// ------------------------------------------------------------------------
+IMPLEMENTATION [arm && mp && tegra && !arm_em_ns]:
+
+#include "io.h"
+#include "kmem.h"
+
+Mword Platform_control::_orig_reset_vector;
+
+PRIVATE static
+void Platform_control::reset_orig_reset_vector()
+{
+  Io::write<Mword>(_orig_reset_vector, Kmem::mmio_remap(Reset_vector_addr));
+}
+
+PUBLIC static
+void
+Platform_control::boot_ap_cpus(Address phys_reset_vector)
+{
+  // remember original reset vector
+  _orig_reset_vector = Io::read<Mword>(Kmem::mmio_remap(Reset_vector_addr));
+
+  // set (temporary) new reset vector
+  Io::write<Mword>(phys_reset_vector, Kmem::mmio_remap(Reset_vector_addr));
+
+  //atexit(reset_orig_reset_vector);
+
+  init_cpus();
+}
diff --git a/kernel/fiasco/src/kern/arm/bsp/tegra/reset-arm-tegra.cpp b/kernel/fiasco/src/kern/arm/bsp/tegra/reset-arm-tegra.cpp
new file mode 100644 (file)
index 0000000..b4ade09
--- /dev/null
@@ -0,0 +1,13 @@
+IMPLEMENTATION [arm && tegra]:
+
+#include "kmem.h"
+#include "mmio_register_block.h"
+
+void __attribute__ ((noreturn))
+platform_reset(void)
+{
+  Mmio_register_block b(Kmem::mmio_remap(Mem_layout::Pmc_phys_base));
+  b.modify<Mword>(0x10, 0, 0);
+  for (;;)
+    ;
+}
diff --git a/kernel/fiasco/src/kern/arm/bsp/tegra/timer-arm-tegra.cpp b/kernel/fiasco/src/kern/arm/bsp/tegra/timer-arm-tegra.cpp
new file mode 100644 (file)
index 0000000..ccf0e75
--- /dev/null
@@ -0,0 +1,79 @@
+// --------------------------------------------------------------------------
+INTERFACE [arm && tegra2 && mptimer]:
+
+EXTENSION class Timer
+{
+private:
+  static Mword interval() { return 249999; }
+};
+
+// --------------------------------------------------------------------------
+INTERFACE [arm && tegra3 && mptimer]:
+
+EXTENSION class Timer
+{
+private:
+  static Mword interval() { return 499999; }
+};
+
+// --------------------------------------------------------------------------
+INTERFACE [arm && tegra_timer_tmr]:
+
+#include "mmio_register_block.h"
+
+EXTENSION class Timer
+{
+public:
+  static unsigned irq() { return 32; };
+
+private:
+  static Static_object<Mmio_register_block> _tmr;
+
+  struct Reg { enum
+  {
+    PTV = 0,
+    PCR = 4,
+  }; };
+};
+
+// --------------------------------------------------------------------------
+IMPLEMENTATION [arm && tegra_timer_tmr]:
+
+#include "kmem.h"
+
+Static_object<Mmio_register_block> Timer::_tmr;
+
+IMPLEMENT
+void Timer::init(Cpu_number cpu)
+{
+  if (cpu == Cpu_number::boot_cpu())
+    {
+      _tmr.construct(Kmem::mmio_remap(Mem_layout::Tmr_phys_base));
+      _tmr->write<Mword>(  (1 << 31) // enable
+                         | (1 << 30) // periodic
+                         | (Config::Scheduler_granularity & 0x1fffffff),
+                         Reg::PTV);
+    }
+}
+
+
+PUBLIC static inline
+void
+Timer::acknowledge()
+{
+  _tmr->write<Mword>(1 << 30, Reg::PCR);
+}
+
+IMPLEMENT inline
+void
+Timer::update_one_shot(Unsigned64)
+{}
+
+IMPLEMENT inline NEEDS["config.h", "kip.h"]
+Unsigned64
+Timer::system_clock()
+{
+  if (Config::Scheduler_one_shot)
+    return 0;
+  return Kip::k()->clock;
+}
diff --git a/kernel/fiasco/src/kern/arm/bsp/tegra/uart-16550-arm-tegra.cpp b/kernel/fiasco/src/kern/arm/bsp/tegra/uart-16550-arm-tegra.cpp
new file mode 100644 (file)
index 0000000..081c080
--- /dev/null
@@ -0,0 +1,34 @@
+INTERFACE [16550 && tegra2]:
+
+EXTENSION class Uart
+{
+public:
+  enum {
+    Base_rate     = 13478400,
+    Base_ier_bits = 1 << 6,
+
+    Access_shift  = 2,
+  };
+};
+
+INTERFACE [16550 && tegra3]:
+
+EXTENSION class Uart
+{
+public:
+  enum {
+    Base_rate     = 25459200,
+    Base_ier_bits = 1 << 6,
+
+    Access_shift  = 2,
+  };
+};
+
+
+IMPLEMENTATION [16550 && tegra]:
+
+IMPLEMENT inline NEEDS[Uart::mcr, Uart::ier]
+void Uart::enable_rcv_irq()
+{
+  ier(ier() | 1);
+}
index 5dda90ef67f915a3f516f0c091f85ae6d3d19388..7c010d31bc123676500f33cc40a790f79ccdd80e 100644 (file)
@@ -315,7 +315,7 @@ Pte_ptr::write_back(void *start, void *end)
 { Mem_unit::clean_dcache(start, end); }
 
 //---------------------------------------------------------------------------
-IMPLEMENTATION [arm && armv6]:
+IMPLEMENTATION [arm && (armv6 || armca8)]:
 
 PUBLIC static inline
 bool
@@ -337,7 +337,7 @@ Pte_ptr::write_back(void *start, void *end)
 { Mem_unit::clean_dcache(start, end); }
 
 //---------------------------------------------------------------------------
-IMPLEMENTATION [arm && armv7]:
+IMPLEMENTATION [arm && armca9]:
 
 PUBLIC static inline
 bool
@@ -357,7 +357,6 @@ void
 Pte_ptr::write_back(void *, void *)
 {}
 
-
 //---------------------------------------------------------------------------
 IMPLEMENTATION [arm && armv5]:
 
index 6f0104707484826e4ffb4b6bdf4613dd9d6b6a0a..58bcfc22d794f376d0bfabf7b5e11c9680668ce1 100644 (file)
@@ -370,7 +370,7 @@ Vmx_info::init()
       procbased_ctls.enforce(31, true);
 
       procbased_ctls2 = Cpu::rdmsr(0x48b);
-      if (procbased_ctls2.allowed(1))
+      if (procbased_ctls2.allowed(Vmx::PRB2_enable_ept))
        ept_vpid_cap = Cpu::rdmsr(0x48c);
 
 
@@ -519,14 +519,14 @@ Vmx::Vmx(Cpu_number cpu)
   // check for EPT support
   if (cpu == Cpu_number::boot_cpu())
     {
-      if (info.procbased_ctls2.allowed(1))
+      if (info.procbased_ctls2.allowed(PRB2_enable_ept))
         WARNX(Info, "VMX:  EPT supported\n");
       else
         WARNX(Info, "VMX:  No EPT available\n");
     }
 
   // check for vpid support
-  if (info.procbased_ctls2.allowed(5))
+  if (info.procbased_ctls2.allowed(PRB2_enable_vpid))
     _has_vpid = true;
 
   c.set_cr4(c.get_cr4() | (1 << 13)); // set CR4.VMXE to 1
index 6eec3f0d25e8fe060f9d98206cf340cd97134ff2..3bea4c6eae0d2499b06e2eb19d0535a8b1616ca2 100644 (file)
@@ -9,10 +9,10 @@
 CONFIG_ARM=y
 # CONFIG_PPC32 is not set
 # CONFIG_SPARC is not set
-CONFIG_PF_REALVIEW=y
 # CONFIG_PF_IMX is not set
+CONFIG_PF_REALVIEW=y
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 9eaf903cadb0d0a2c77c78b26293ee9975db1af0..2703578afd7050abb99f5b9eecf1b825913df223 100644 (file)
@@ -9,10 +9,10 @@
 CONFIG_ARM=y
 # CONFIG_PPC32 is not set
 # CONFIG_SPARC is not set
-CONFIG_PF_REALVIEW=y
 # CONFIG_PF_IMX is not set
+CONFIG_PF_REALVIEW=y
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 2706fa1d3db51551f003963df8546defe1ee711b..7fc29616185a5b59afe824db843ea44817a4a51a 100644 (file)
@@ -9,10 +9,10 @@
 CONFIG_ARM=y
 # CONFIG_PPC32 is not set
 # CONFIG_SPARC is not set
-CONFIG_PF_REALVIEW=y
 # CONFIG_PF_IMX is not set
+CONFIG_PF_REALVIEW=y
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 0226ac1419e91f539548b262edd74040499aa424..9eaf7504d8fe30e99c293a7c5f8602fc24c571fa 100644 (file)
@@ -9,10 +9,10 @@
 CONFIG_ARM=y
 # CONFIG_PPC32 is not set
 # CONFIG_SPARC is not set
-CONFIG_PF_REALVIEW=y
 # CONFIG_PF_IMX is not set
+CONFIG_PF_REALVIEW=y
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 5345d4d35b0ab27345fe96fb94ba59a1de3937e8..92b13b214c386e9a2dc4d695295f9fa0f203ed58 100644 (file)
@@ -7,10 +7,10 @@
 # CONFIG_IA32 is not set
 # CONFIG_AMD64 is not set
 CONFIG_ARM=y
-# CONFIG_PF_REALVIEW is not set
 CONFIG_PF_IMX=y
+# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 6ab4cb49ba5ad4d814fee62cc1968ac1572d1152..d018eff89a5b2bb09acca81af2ac15d31eda6586 100644 (file)
@@ -7,10 +7,10 @@
 # CONFIG_IA32 is not set
 # CONFIG_AMD64 is not set
 CONFIG_ARM=y
-# CONFIG_PF_REALVIEW is not set
 CONFIG_PF_IMX=y
+# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 8e8ceba6435d6e43e4731858f4603c9c0022bdb9..a836c3d63e3549ef36f3f13cbbedf87d48fea8c6 100644 (file)
@@ -7,10 +7,10 @@
 # CONFIG_IA32 is not set
 # CONFIG_AMD64 is not set
 CONFIG_ARM=y
-# CONFIG_PF_REALVIEW is not set
 CONFIG_PF_IMX=y
+# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 09116d9df5e33e4443b4bf0d353320ded5b89307..f7b466585e625c0a60f4591ab6c6d81ed92f2cd3 100644 (file)
@@ -7,10 +7,10 @@
 # CONFIG_IA32 is not set
 # CONFIG_AMD64 is not set
 CONFIG_ARM=y
-# CONFIG_PF_REALVIEW is not set
 CONFIG_PF_IMX=y
+# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index d148c931823c501db544d14bc269d28aff804c40..69d9dd5b55ae0848cddd9e71af90bd5d560bc4bd 100644 (file)
@@ -7,10 +7,10 @@
 # CONFIG_IA32 is not set
 # CONFIG_AMD64 is not set
 CONFIG_ARM=y
-# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_IMX is not set
+# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 814dae0816154f8702c46d71503b933f17420191..b9c711098708779eb6633c5f23387250daf867db 100644 (file)
@@ -7,10 +7,10 @@
 # CONFIG_IA32 is not set
 # CONFIG_AMD64 is not set
 CONFIG_ARM=y
-# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_IMX is not set
+# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 4f79252c3820608f9379d6f26270523fdbe70668..fc88006e513b45ba4759ffc5f4fe3d10d60a6739 100644 (file)
@@ -7,10 +7,10 @@
 # CONFIG_IA32 is not set
 # CONFIG_AMD64 is not set
 CONFIG_ARM=y
-# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_IMX is not set
+# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 5678cb0f32374aff0037c067799d968c75f830a3..d5638c63dbbd10d6b52ba69d0daf86e1d1f5d89d 100644 (file)
@@ -7,10 +7,10 @@
 # CONFIG_IA32 is not set
 # CONFIG_AMD64 is not set
 CONFIG_ARM=y
-# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_IMX is not set
+# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 CONFIG_PF_OMAP=y
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 884977112d137db1e570914c91c4b0eb744f6cf8..e509b199e83bea1d06537877663f28aedebe18e4 100644 (file)
@@ -9,10 +9,10 @@
 CONFIG_ARM=y
 # CONFIG_PPC32 is not set
 # CONFIG_SPARC is not set
-# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_IMX is not set
+# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 CONFIG_PF_OMAP=y
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 92cc2966a759097f02f0972fabf373a1e11c1b7c..66dba43d578f74ba8fb947139a347b276e6baefd 100644 (file)
@@ -7,10 +7,10 @@
 # CONFIG_IA32 is not set
 # CONFIG_AMD64 is not set
 CONFIG_ARM=y
-# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_IMX is not set
+# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 CONFIG_PF_XSCALE=y
 # CONFIG_PF_SA1100 is not set
index dd627549c1ab5af5cea9824e8f0056021e596d7a..a2d19ca77dc876de6990eec0b7a71c1747f417aa 100644 (file)
@@ -7,10 +7,10 @@
 # CONFIG_IA32 is not set
 # CONFIG_AMD64 is not set
 CONFIG_ARM=y
-CONFIG_PF_REALVIEW=y
 # CONFIG_PF_IMX is not set
+CONFIG_PF_REALVIEW=y
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 33ad50799583387a8eb33a87c68c22316c7b4091..fa693127943c244e5bd1999f2255656c59f353cd 100644 (file)
@@ -7,10 +7,10 @@
 # CONFIG_IA32 is not set
 # CONFIG_AMD64 is not set
 CONFIG_ARM=y
-CONFIG_PF_REALVIEW=y
 # CONFIG_PF_IMX is not set
+CONFIG_PF_REALVIEW=y
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 3e7347255a2686f41d5c59ea4daff1aa420263ae..fbb189c8d7dfa717e40cbb25ada9c9a82dbb3a0c 100644 (file)
@@ -7,10 +7,10 @@
 # CONFIG_IA32 is not set
 # CONFIG_AMD64 is not set
 CONFIG_ARM=y
-CONFIG_PF_REALVIEW=y
 # CONFIG_PF_IMX is not set
+CONFIG_PF_REALVIEW=y
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 29a746c3d21c878ed4af8676f212cd8f9d679949..4a65cead75a7391e67db22a69b138d89565c15ae 100644 (file)
@@ -7,10 +7,10 @@
 # CONFIG_IA32 is not set
 # CONFIG_AMD64 is not set
 CONFIG_ARM=y
-CONFIG_PF_REALVIEW=y
 # CONFIG_PF_IMX is not set
+CONFIG_PF_REALVIEW=y
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 39dd12603ce1eb2b2b83b36dc833dc2083fc81c0..88f34a84e7811fdfb3a4a2a1c2a1eb6838d88eb7 100644 (file)
@@ -7,10 +7,10 @@
 # CONFIG_IA32 is not set
 # CONFIG_AMD64 is not set
 CONFIG_ARM=y
-# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_IMX is not set
+# CONFIG_PF_REALVIEW is not set
 CONFIG_PF_S3C2410=y
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 0b117918e8d94205ff2a20825638d527ce356d69..f947c6c6312adb1c84585fd11c3c96b3d4bd9da7 100644 (file)
@@ -7,10 +7,10 @@
 # CONFIG_IA32 is not set
 # CONFIG_AMD64 is not set
 CONFIG_ARM=y
-# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_IMX is not set
+# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 CONFIG_PF_SA1100=y
index bbcbea4deb2105b1b3cd2a2287a3b99156488d7a..f651a1c6784bd94723f8e05ee6c0ae94afdfd17f 100644 (file)
@@ -9,46 +9,37 @@
 CONFIG_ARM=y
 # CONFIG_PPC32 is not set
 # CONFIG_SPARC is not set
-# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_IMX is not set
+# CONFIG_PF_REALVIEW is not set
 # CONFIG_PF_S3C2410 is not set
-CONFIG_PF_TEGRA2=y
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
 # CONFIG_PF_EXYNOS is not set
 # CONFIG_PF_KIRKWOOD is not set
-# CONFIG_PF_INTEGRATOR is not set
+CONFIG_PF_INTEGRATOR=y
 # CONFIG_PF_BCM2835 is not set
-CONFIG_BSP_NAME="tegra2"
-CONFIG_PF_TEGRA_TIMER_MP=y
-# CONFIG_PF_TEGRA_TIMER_TMR is not set
+CONFIG_BSP_NAME="integrator"
 CONFIG_ABI_VF=y
-CONFIG_PF_ARM_MP_CAPABLE=y
-CONFIG_CAN_ARM_CPU_CORTEX_A9=y
-CONFIG_CAN_ARM_CACHE_L2CXX0=y
-CONFIG_ARM_CORTEX_A9=y
+CONFIG_CAN_ARM_CPU_926=y
+CONFIG_CAN_ARM_CPU_1176=y
+CONFIG_ARM_926=y
+# CONFIG_ARM_1176 is not set
 CONFIG_ARM_ALIGNMENT_CHECK=y
 CONFIG_ARM_EM_STD=y
-# CONFIG_ARM_EM_NS is not set
-# CONFIG_ARM_EM_TZ is not set
-CONFIG_ARM_ENABLE_SWP=y
-CONFIG_ARM_CACHE_L2CXX0=y
 CONFIG_FPU=y
 # CONFIG_ARM_CPU_ERRATA is not set
 
 #
 # Kernel options
 #
-CONFIG_MP=y
-CONFIG_MP_MAX_CPUS=4
 CONFIG_CONTEXT_4K=y
 CONFIG_FINE_GRAINED_CPUTIME=y
 # CONFIG_SCHED_FIXED_PRIO is not set
 # CONFIG_SCHED_WFQ is not set
 CONFIG_SCHED_FP_WFQ=y
 # CONFIG_DISABLE_VIRT_OBJ_SPACE is not set
-CONFIG_VIRT_OBJ_SPACE=y
 
 #
 # Debugging
@@ -81,8 +72,6 @@ CONFIG_LABEL="T2-mp"
 CONFIG_EXPERIMENTAL=y
 CONFIG_PERF_CNT=y
 CONFIG_BIT32=y
-CONFIG_ARM_V7=y
-CONFIG_ARM_V6PLUS=y
 CONFIG_WARN_LEVEL=2
 CONFIG_XARCH="arm"
 CONFIG_ABI="vf"
index 8e3b7aa538a570fa362dadf75201faf2cf1d9e48..8ff08f9f89a8811b748e0a087cc3621bbb31ae97 100644 (file)
@@ -7,10 +7,10 @@
 # CONFIG_IA32 is not set
 # CONFIG_AMD64 is not set
 CONFIG_ARM=y
-CONFIG_PF_REALVIEW=y
 # CONFIG_PF_IMX is not set
+CONFIG_PF_REALVIEW=y
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 205a568eec5d8776e57e05ca8edd9a38e2a7f47a..05897e87a693d5b732b31366665b22d9b3396e75 100644 (file)
@@ -9,10 +9,10 @@
 CONFIG_ARM=y
 # CONFIG_PPC32 is not set
 # CONFIG_SPARC is not set
-CONFIG_PF_REALVIEW=y
 # CONFIG_PF_IMX is not set
+CONFIG_PF_REALVIEW=y
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index e2326df5e4f37c8ea1dc48ec09c3f7db2f25ee09..e8139d50aa2c402ebdbe8478c021976a0d1f7d6e 100644 (file)
@@ -9,10 +9,10 @@
 CONFIG_ARM=y
 # CONFIG_PPC32 is not set
 # CONFIG_SPARC is not set
-CONFIG_PF_REALVIEW=y
 # CONFIG_PF_IMX is not set
+CONFIG_PF_REALVIEW=y
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index 2512e4734a5a224aa49bcc225a2ce50ece0b492d..257f5852795d5f7047112a25be6abc55b4f906f6 100644 (file)
@@ -7,10 +7,10 @@
 # CONFIG_IA32 is not set
 # CONFIG_AMD64 is not set
 CONFIG_ARM=y
-CONFIG_PF_REALVIEW=y
 # CONFIG_PF_IMX is not set
+CONFIG_PF_REALVIEW=y
 # CONFIG_PF_S3C2410 is not set
-# CONFIG_PF_TEGRA2 is not set
+# CONFIG_PF_TEGRA is not set
 # CONFIG_PF_OMAP is not set
 # CONFIG_PF_XSCALE is not set
 # CONFIG_PF_SA1100 is not set
index da26698b3de30ac14bf3c4cbfedf6b6a46a5f3a3..c633f228e203e2788f54a2fa9bb5ec9861f7b551 100644 (file)
@@ -30,7 +30,6 @@ CONFIG_SCHED_PIT=y
 #
 # Kernel options
 #
-# CONFIG_MP is not set
 CONFIG_CONTEXT_4K=y
 # CONFIG_FINE_GRAINED_CPUTIME is not set
 # CONFIG_UX_CON is not set
index 614645ebec432510df3a3d8a9456e82ce24097dc..85d02285f0dd220277c4917d428d8d442a1330f4 100644 (file)
@@ -1,5 +1,5 @@
 VERSION = 3
-PATCHLEVEL = 8
+PATCHLEVEL = 9
 SUBLEVEL = 0
 EXTRAVERSION =
 NAME = Unicycling Gorilla
@@ -165,7 +165,8 @@ export srctree objtree VPATH
 # then ARCH is assigned, getting whatever value it gets normally, and 
 # SUBARCH is subsequently ignored.
 
-SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
+SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
+                                 -e s/sun4u/sparc64/ \
                                  -e s/arm.*/arm/ -e s/sa110/arm/ \
                                  -e s/s390x/s390/ -e s/parisc64/parisc/ \
                                  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
@@ -191,7 +192,6 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
 # "make" in the configured kernel build directory always uses that.
 # Default value for CROSS_COMPILE is not to prefix executables
 # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
-export KBUILD_BUILDHOST := $(SUBARCH)
 ARCH           ?= $(SUBARCH)
 CROSS_COMPILE  ?= $(CONFIG_CROSS_COMPILE:"%"=%)
 
@@ -513,7 +513,8 @@ ifeq ($(KBUILD_EXTMOD),)
 # Carefully list dependencies so we do not try to build scripts twice
 # in parallel
 PHONY += scripts
-scripts: scripts_basic include/config/auto.conf include/config/tristate.conf
+scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \
+        asm-generic
        $(Q)$(MAKE) $(build)=$(@)
 
 # Objects we will link into vmlinux / subdirs we need to visit
@@ -619,7 +620,8 @@ KBUILD_AFLAGS       += -gdwarf-2
 endif
 
 ifdef CONFIG_DEBUG_INFO_REDUCED
-KBUILD_CFLAGS  += $(call cc-option, -femit-struct-debug-baseonly)
+KBUILD_CFLAGS  += $(call cc-option, -femit-struct-debug-baseonly) \
+                  $(call cc-option,-fno-var-tracking)
 endif
 
 ifdef CONFIG_FUNCTION_TRACER
@@ -719,11 +721,11 @@ endif # INSTALL_MOD_STRIP
 export mod_strip_cmd
 
 
-ifeq ($(CONFIG_MODULE_SIG),y)
+ifdef CONFIG_MODULE_SIG_ALL
 MODSECKEY = ./signing_key.priv
 MODPUBKEY = ./signing_key.x509
 export MODPUBKEY
-mod_sign_cmd = perl $(srctree)/scripts/sign-file $(MODSECKEY) $(MODPUBKEY)
+mod_sign_cmd = perl $(srctree)/scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(MODSECKEY) $(MODPUBKEY)
 else
 mod_sign_cmd = true
 endif
@@ -1397,7 +1399,7 @@ quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN   $(wildcard $(rm-files))
 # Run depmod only if we have System.map and depmod is executable
 quiet_cmd_depmod = DEPMOD  $(KERNELRELEASE)
       cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
-                   $(KERNELRELEASE)
+                   $(KERNELRELEASE) "$(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX))"
 
 # Create temporary dir for module support files
 # clean it up only when building all modules
index 7c04e27841d5144545c2dd9323ff4f01c1071e55..be58b4cbaabfb44f8ac91bdca9b59ce054c93d37 100644 (file)
@@ -1,3 +1,3 @@
 
-kconfig taken from vanilla Linux 3.8, and slightly patched.
+kconfig taken from vanilla Linux 3.9, and slightly patched.
 
index 06ba4a70bd4d0db666a4b50b90b73f33e7c6b81e..477d137c0557b8b70571d9e6e0873e2af221d53b 100644 (file)
@@ -7,15 +7,15 @@
 #
 # ==========================================================================
 
-# called may set destination dir (when installing to asm/)
-_dst := $(or $(destination-y),$(dst),$(obj))
-
 # generated header directory
 gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj)))
 
 kbuild-file := $(srctree)/$(obj)/Kbuild
 include $(kbuild-file)
 
+# called may set destination dir (when installing to asm/)
+_dst := $(if $(destination-y),$(destination-y),$(if $(dst),$(dst),$(obj)))
+
 old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild
 ifneq ($(wildcard $(old-kbuild-file)),)
 include $(old-kbuild-file)
@@ -48,13 +48,14 @@ all-files     := $(header-y) $(genhdr-y) $(wrapper-files)
 output-files  := $(addprefix $(installdir)/, $(all-files))
 
 input-files   := $(foreach hdr, $(header-y), \
-                  $(or \
+                  $(if $(wildcard $(srcdir)/$(hdr)), \
                        $(wildcard $(srcdir)/$(hdr)), \
-                       $(wildcard $(oldsrcdir)/$(hdr)), \
-                       $(error Missing UAPI file $(srcdir)/$(hdr)) \
+                       $(if $(wildcard $(oldsrcdir)/$(hdr)), \
+                               $(wildcard $(oldsrcdir)/$(hdr)), \
+                               $(error Missing UAPI file $(srcdir)/$(hdr))) \
                   )) \
                 $(foreach hdr, $(genhdr-y), \
-                  $(or \
+                  $(if $(wildcard $(gendir)/$(hdr)), \
                        $(wildcard $(gendir)/$(hdr)), \
                        $(error Missing generated UAPI file $(gendir)/$(hdr)) \
                   ))
index bdf42fdf64c9adb0095a1ff0ad3437499d0ba87c..07125e697d7a980efdb0f9136ee5741fe8cf0473 100644 (file)
@@ -156,6 +156,11 @@ cpp_flags      = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \
 
 ld_flags       = $(LDFLAGS) $(ldflags-y)
 
+dtc_cpp_flags  = -Wp,-MD,$(depfile) -nostdinc                            \
+                -I$(srctree)/arch/$(SRCARCH)/boot/dts                   \
+                -I$(srctree)/arch/$(SRCARCH)/include/dts                \
+                -undef -D__DTS__
+
 # Finds the multi-part object the current object will be linked into
 modname-multi = $(sort $(foreach m,$(multi-used),\
                $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=))))
@@ -269,6 +274,15 @@ cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile
 $(obj)/%.dtb: $(src)/%.dts FORCE
        $(call if_changed_dep,dtc)
 
+dtc-tmp = $(subst $(comma),_,$(dot-target).dts)
+
+quiet_cmd_dtc_cpp = DTC+CPP $@
+cmd_dtc_cpp = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
+       $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) $(dtc-tmp)
+
+$(obj)/%.dtb: $(src)/%.dtsp FORCE
+       $(call if_changed_dep,dtc_cpp)
+
 # Bzip2
 # ---------------------------------------------------------------------------
 
index a1cb0222ebe642b6fd91093f2a01bd301b026e6e..cf82c832458fb036c1269d01c6df0fd8be18bf1c 100644 (file)
@@ -66,10 +66,6 @@ modules   := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o)))
 # Stop after building .o files if NOFINAL is set. Makes compile tests quicker
 _modpost: $(if $(KBUILD_MODPOST_NOFINAL), $(modules:.ko:.o),$(modules))
 
-ifneq ($(KBUILD_BUILDHOST),$(ARCH))
-        cross_build := 1
-endif
-
 # Step 2), invoke modpost
 #  Includes step 3,4
 modpost = scripts/mod/modpost                    \
@@ -80,8 +76,7 @@ modpost = scripts/mod/modpost                    \
  $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \
  $(if $(KBUILD_EXTMOD),-o $(modulesymfile))      \
  $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S)      \
- $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \
- $(if $(cross_build),-c)
+ $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
 
 quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
       cmd_modpost = $(modpost) -s
index cb1f50cf12e3bda6fe798365a9c31b15adf0477a..7f6425e24ce3ad985635e9249a64552f661566f2 100644 (file)
@@ -409,7 +409,7 @@ static void traps(void)
        int *p = (int *)test;
 
        if (*p != INT_CONF) {
-               fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianess? %#x\n",
+               fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianness? %#x\n",
                        *p);
                exit(2);
        }
index 3091794e935488c797e73207e6d0b82a7dbf99b4..231b4759c714dae5aa9034ef1365e1338cc3bb72 100644 (file)
@@ -11,6 +11,9 @@ else
 Kconfig := Kconfig
 endif
 
+# We need this, in case the user has it in its environment
+unexport CONFIG_
+
 xconfig: $(obj)/qconf
        $< $(Kconfig)
 
index 4da3b4adfad233cb97728b0e0278f8143919cee3..e39fcd8143ea78b2c9c10a2983610fe75bbcb2e3 100644 (file)
@@ -36,6 +36,7 @@ enum input_mode {
 } input_mode = oldaskconfig;
 
 static int indent = 1;
+static int tty_stdio;
 static int valid_stdin = 1;
 static int sync_kconfig;
 static int conf_cnt;
@@ -108,6 +109,8 @@ static int conf_askvalue(struct symbol *sym, const char *def)
        case oldaskconfig:
                fflush(stdout);
                xfgets(line, 128, stdin);
+               if (!tty_stdio)
+                       printf("\n");
                return 1;
        default:
                break;
@@ -495,6 +498,8 @@ int main(int ac, char **av)
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
 
+       tty_stdio = isatty(0) && isatty(1) && isatty(2);
+
        while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) {
                input_mode = (enum input_mode)opt;
                switch (opt) {
@@ -621,7 +626,7 @@ int main(int ac, char **av)
                                return 1;
                        }
                }
-               valid_stdin = isatty(0) && isatty(1) && isatty(2);
+               valid_stdin = tty_stdio;
        }
 
        switch (input_mode) {
index 290ce41f8ba46fcee2d61b6d7f3bd157593f4b66..d6626521f9b9ab9d166fcb9e916a6ea5bc8a7eba 100644 (file)
@@ -13,7 +13,7 @@
 
 struct expr *expr_alloc_symbol(struct symbol *sym)
 {
-       struct expr *e = calloc(1, sizeof(*e));
+       struct expr *e = xcalloc(1, sizeof(*e));
        e->type = E_SYMBOL;
        e->left.sym = sym;
        return e;
@@ -21,7 +21,7 @@ struct expr *expr_alloc_symbol(struct symbol *sym)
 
 struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
 {
-       struct expr *e = calloc(1, sizeof(*e));
+       struct expr *e = xcalloc(1, sizeof(*e));
        e->type = type;
        e->left.expr = ce;
        return e;
@@ -29,7 +29,7 @@ struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
 
 struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2)
 {
-       struct expr *e = calloc(1, sizeof(*e));
+       struct expr *e = xcalloc(1, sizeof(*e));
        e->type = type;
        e->left.expr = e1;
        e->right.expr = e2;
@@ -38,7 +38,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e
 
 struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2)
 {
-       struct expr *e = calloc(1, sizeof(*e));
+       struct expr *e = xcalloc(1, sizeof(*e));
        e->type = type;
        e->left.sym = s1;
        e->right.sym = s2;
@@ -66,7 +66,7 @@ struct expr *expr_copy(const struct expr *org)
        if (!org)
                return NULL;
 
-       e = malloc(sizeof(*org));
+       e = xmalloc(sizeof(*org));
        memcpy(e, org, sizeof(*org));
        switch (org->type) {
        case E_SYMBOL:
index 7491559f273ee61526edccfbf408520ff6518401..35ddf225fb264f7da8fef06aad68d0bb19098dc4 100644 (file)
@@ -10,6 +10,7 @@
 #  include <config.h>
 #endif
 
+#include <stdlib.h>
 #include "lkc.h"
 #include "images.c"
 
@@ -22,7 +23,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <time.h>
-#include <stdlib.h>
 
 //#define DEBUG
 
index 97c967e6268142a735efda4bed893729b6ab0157..593cd2a97ee23562c77f78b9bb510d799cc57b72 100644 (file)
@@ -39,6 +39,12 @@ extern "C" {
 #ifndef CONFIG_
 #define CONFIG_ "CONFIG_"
 #endif
+static inline const char *CONFIG_prefix(void)
+{
+       return getenv( "CONFIG_" ) ?: CONFIG_;
+}
+#undef CONFIG_
+#define CONFIG_ CONFIG_prefix()
 
 #define TF_COMMAND     0x0001
 #define TF_PARAM       0x0002
@@ -116,6 +122,8 @@ void menu_set_type(int type);
 /* util.c */
 struct file *file_lookup(const char *name);
 int file_write_dep(const char *name);
+void *xmalloc(size_t size);
+void *xcalloc(size_t nmemb, size_t size);
 
 struct gstr {
        size_t len;
index c8e8a7154753b858e9f51e9c3d6816962d8f549b..80788137c670b2b7e7740c99803f03edd9803a3f 100644 (file)
@@ -21,6 +21,7 @@ ccflags()
 {
        if [ -f /usr/include/ncursesw/curses.h ]; then
                echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"'
+               echo ' -DNCURSES_WIDECHAR=1'
        elif [ -f /usr/include/ncurses/ncurses.h ]; then
                echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
        elif [ -f /usr/include/ncurses/curses.h ]; then
index ee17a5264d5b456c0672a77b06964bfc1ccd29d7..307022a8beef1ac758080b3299853c8eae5e043d 100644 (file)
@@ -221,7 +221,6 @@ int dialog_menu(const char *title, const char *prompt,
                const void *selected, int *s_scroll);
 int dialog_checklist(const char *title, const char *prompt, int height,
                     int width, int list_height);
-extern char dialog_input_result[];
 int dialog_inputbox(const char *title, const char *prompt, int height,
                    int width, const char *init);
 
index dd8e587c50e26eada18fe35995aaa0ec301f42fc..21404a04d7c34dc37d9f29ffe804b6abeb3f2a62 100644 (file)
@@ -45,7 +45,8 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
                     const char *init)
 {
        int i, x, y, box_y, box_x, box_width;
-       int input_x = 0, scroll = 0, key = 0, button = -1;
+       int input_x = 0, key = 0, button = -1;
+       int show_x, len, pos;
        char *instr = dialog_input_result;
        WINDOW *dialog;
 
@@ -97,14 +98,17 @@ do_resize:
        wmove(dialog, box_y, box_x);
        wattrset(dialog, dlg.inputbox.atr);
 
-       input_x = strlen(instr);
+       len = strlen(instr);
+       pos = len;
 
-       if (input_x >= box_width) {
-               scroll = input_x - box_width + 1;
+       if (len >= box_width) {
+               show_x = len - box_width + 1;
                input_x = box_width - 1;
                for (i = 0; i < box_width - 1; i++)
-                       waddch(dialog, instr[scroll + i]);
+                       waddch(dialog, instr[show_x + i]);
        } else {
+               show_x = 0;
+               input_x = len;
                waddstr(dialog, instr);
        }
 
@@ -121,45 +125,104 @@ do_resize:
                        case KEY_UP:
                        case KEY_DOWN:
                                break;
-                       case KEY_LEFT:
-                               continue;
-                       case KEY_RIGHT:
-                               continue;
                        case KEY_BACKSPACE:
                        case 127:
-                               if (input_x || scroll) {
+                               if (pos) {
                                        wattrset(dialog, dlg.inputbox.atr);
-                                       if (!input_x) {
-                                               scroll = scroll < box_width - 1 ? 0 : scroll - (box_width - 1);
-                                               wmove(dialog, box_y, box_x);
-                                               for (i = 0; i < box_width; i++)
-                                                       waddch(dialog,
-                                                              instr[scroll + input_x + i] ?
-                                                              instr[scroll + input_x + i] : ' ');
-                                               input_x = strlen(instr) - scroll;
+                                       if (input_x == 0) {
+                                               show_x--;
                                        } else
                                                input_x--;
-                                       instr[scroll + input_x] = '\0';
-                                       mvwaddch(dialog, box_y, input_x + box_x, ' ');
+
+                                       if (pos < len) {
+                                               for (i = pos - 1; i < len; i++) {
+                                                       instr[i] = instr[i+1];
+                                               }
+                                       }
+
+                                       pos--;
+                                       len--;
+                                       instr[len] = '\0';
+                                       wmove(dialog, box_y, box_x);
+                                       for (i = 0; i < box_width; i++) {
+                                               if (!instr[show_x + i]) {
+                                                       waddch(dialog, ' ');
+                                                       break;
+                                               }
+                                               waddch(dialog, instr[show_x + i]);
+                                       }
                                        wmove(dialog, box_y, input_x + box_x);
                                        wrefresh(dialog);
                                }
                                continue;
+                       case KEY_LEFT:
+                               if (pos > 0) {
+                                       if (input_x > 0) {
+                                               wmove(dialog, box_y, --input_x + box_x);
+                                       } else if (input_x == 0) {
+                                               show_x--;
+                                               wmove(dialog, box_y, box_x);
+                                               for (i = 0; i < box_width; i++) {
+                                                       if (!instr[show_x + i]) {
+                                                               waddch(dialog, ' ');
+                                                               break;
+                                                       }
+                                                       waddch(dialog, instr[show_x + i]);
+                                               }
+                                               wmove(dialog, box_y, box_x);
+                                       }
+                                       pos--;
+                               }
+                               continue;
+                       case KEY_RIGHT:
+                               if (pos < len) {
+                                       if (input_x < box_width - 1) {
+                                               wmove(dialog, box_y, ++input_x + box_x);
+                                       } else if (input_x == box_width - 1) {
+                                               show_x++;
+                                               wmove(dialog, box_y, box_x);
+                                               for (i = 0; i < box_width; i++) {
+                                                       if (!instr[show_x + i]) {
+                                                               waddch(dialog, ' ');
+                                                               break;
+                                                       }
+                                                       waddch(dialog, instr[show_x + i]);
+                                               }
+                                               wmove(dialog, box_y, input_x + box_x);
+                                       }
+                                       pos++;
+                               }
+                               continue;
                        default:
                                if (key < 0x100 && isprint(key)) {
-                                       if (scroll + input_x < MAX_LEN) {
+                                       if (len < MAX_LEN) {
                                                wattrset(dialog, dlg.inputbox.atr);
-                                               instr[scroll + input_x] = key;
-                                               instr[scroll + input_x + 1] = '\0';
+                                               if (pos < len) {
+                                                       for (i = len; i > pos; i--)
+                                                               instr[i] = instr[i-1];
+                                                       instr[pos] = key;
+                                               } else {
+                                                       instr[len] = key;
+                                               }
+                                               pos++;
+                                               len++;
+                                               instr[len] = '\0';
+
                                                if (input_x == box_width - 1) {
-                                                       scroll++;
-                                                       wmove(dialog, box_y, box_x);
-                                                       for (i = 0; i < box_width - 1; i++)
-                                                               waddch(dialog, instr [scroll + i]);
+                                                       show_x++;
                                                } else {
-                                                       wmove(dialog, box_y, input_x++ + box_x);
-                                                       waddch(dialog, key);
+                                                       input_x++;
+                                               }
+
+                                               wmove(dialog, box_y, box_x);
+                                               for (i = 0; i < box_width; i++) {
+                                                       if (!instr[show_x + i]) {
+                                                               waddch(dialog, ' ');
+                                                               break;
+                                                       }
+                                                       waddch(dialog, instr[show_x + i]);
                                                }
+                                               wmove(dialog, box_y, input_x + box_x);
                                                wrefresh(dialog);
                                        } else
                                                flash();        /* Alarm user about overflow */
index 1d604738fa1314a3479362082208b3591385d890..48d382e7e3746bebd850114d4f7557dbc37c49db 100644 (file)
@@ -26,7 +26,7 @@
  *
  *    *)  A bugfix for the Page-Down problem
  *
- *    *)  Formerly when I used Page Down and Page Up, the cursor would be set 
+ *    *)  Formerly when I used Page Down and Page Up, the cursor would be set
  *        to the first position in the menu box.  Now lxdialog is a bit
  *        smarter and works more like other menu systems (just have a look at
  *        it).
@@ -154,12 +154,14 @@ static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x,
  */
 static void print_buttons(WINDOW * win, int height, int width, int selected)
 {
-       int x = width / 2 - 16;
+       int x = width / 2 - 28;
        int y = height - 2;
 
        print_button(win, gettext("Select"), y, x, selected == 0);
        print_button(win, gettext(" Exit "), y, x + 12, selected == 1);
        print_button(win, gettext(" Help "), y, x + 24, selected == 2);
+       print_button(win, gettext(" Save "), y, x + 36, selected == 3);
+       print_button(win, gettext(" Load "), y, x + 48, selected == 4);
 
        wmove(win, y, x + 1 + 12 * selected);
        wrefresh(win);
@@ -372,7 +374,7 @@ do_resize:
                case TAB:
                case KEY_RIGHT:
                        button = ((key == KEY_LEFT ? --button : ++button) < 0)
-                           ? 2 : (button > 2 ? 0 : button);
+                           ? 4 : (button > 4 ? 0 : button);
 
                        print_buttons(dialog, height, width, button);
                        wrefresh(menu);
@@ -399,17 +401,17 @@ do_resize:
                                return 2;
                        case 's':
                        case 'y':
-                               return 3;
+                               return 5;
                        case 'n':
-                               return 4;
+                               return 6;
                        case 'm':
-                               return 5;
+                               return 7;
                        case ' ':
-                               return 6;
+                               return 8;
                        case '/':
-                               return 7;
+                               return 9;
                        case 'z':
-                               return 8;
+                               return 10;
                        case '\n':
                                return button;
                        }
index 53975cf876083ecba455a7033222b2ccc3690686..566288a763709e1c6c6fb138ad2162a54a4b12c6 100644 (file)
@@ -280,6 +280,7 @@ static struct menu *current_menu;
 static int child_count;
 static int single_menu_mode;
 static int show_all_options;
+static int save_and_exit;
 
 static void conf(struct menu *menu, struct menu *active_menu);
 static void conf_choice(struct menu *menu);
@@ -348,15 +349,19 @@ static void search_conf(void)
 {
        struct symbol **sym_arr;
        struct gstr res;
+       struct gstr title;
        char *dialog_input;
        int dres, vscroll = 0, hscroll = 0;
        bool again;
 
+       title = str_new();
+       str_printf( &title, _("Enter %s (sub)string to search for "
+                             "(with or without \"%s\")"), CONFIG_, CONFIG_);
+
 again:
        dialog_clear();
        dres = dialog_inputbox(_("Search Configuration Parameter"),
-                             _("Enter " CONFIG_ " (sub)string to search for "
-                               "(with or without \"" CONFIG_ "\")"),
+                             str_get(&title),
                              10, 75, "");
        switch (dres) {
        case 0:
@@ -365,6 +370,7 @@ again:
                show_helptext(_("Search Configuration"), search_help);
                goto again;
        default:
+               str_free(&title);
                return;
        }
 
@@ -398,6 +404,7 @@ again:
                str_free(&res);
        } while (again);
        free(sym_arr);
+       str_free(&title);
 }
 
 static void build_conf(struct menu *menu)
@@ -592,14 +599,6 @@ static void conf(struct menu *menu, struct menu *active_menu)
                build_conf(menu);
                if (!child_count)
                        break;
-               if (menu == &rootmenu) {
-                       item_make("--- ");
-                       item_set_tag(':');
-                       item_make(_("    Load an Alternate Configuration File"));
-                       item_set_tag('L');
-                       item_make(_("    Save an Alternate Configuration File"));
-                       item_set_tag('S');
-               }
                dialog_clear();
                res = dialog_menu(prompt ? _(prompt) : _("Main Menu"),
                                  _(menu_instructions),
@@ -636,12 +635,6 @@ static void conf(struct menu *menu, struct menu *active_menu)
                        case 's':
                                conf_string(submenu);
                                break;
-                       case 'L':
-                               conf_load();
-                               break;
-                       case 'S':
-                               conf_save();
-                               break;
                        }
                        break;
                case 2:
@@ -651,6 +644,12 @@ static void conf(struct menu *menu, struct menu *active_menu)
                                show_helptext(_("README"), _(mconf_readme));
                        break;
                case 3:
+                       conf_save();
+                       break;
+               case 4:
+                       conf_load();
+                       break;
+               case 5:
                        if (item_is_tag('t')) {
                                if (sym_set_tristate_value(sym, yes))
                                        break;
@@ -658,24 +657,24 @@ static void conf(struct menu *menu, struct menu *active_menu)
                                        show_textbox(NULL, setmod_text, 6, 74);
                        }
                        break;
-               case 4:
+               case 6:
                        if (item_is_tag('t'))
                                sym_set_tristate_value(sym, no);
                        break;
-               case 5:
+               case 7:
                        if (item_is_tag('t'))
                                sym_set_tristate_value(sym, mod);
                        break;
-               case 6:
+               case 8:
                        if (item_is_tag('t'))
                                sym_toggle_tristate_value(sym);
                        else if (item_is_tag('m'))
                                conf(submenu, NULL);
                        break;
-               case 7:
+               case 9:
                        search_conf();
                        break;
-               case 8:
+               case 10:
                        show_all_options = !show_all_options;
                        break;
                }
@@ -702,6 +701,17 @@ static void show_helptext(const char *title, const char *text)
        show_textbox(title, text, 0, 0);
 }
 
+static void conf_message_callback(const char *fmt, va_list ap)
+{
+       char buf[PATH_MAX+1];
+
+       vsnprintf(buf, sizeof(buf), fmt, ap);
+       if (save_and_exit)
+               printf("%s", buf);
+       else
+               show_textbox(NULL, buf, 6, 60);
+}
+
 static void show_help(struct menu *menu)
 {
        struct gstr help = str_new();
@@ -870,6 +880,7 @@ static int handle_exit(void)
 {
        int res;
 
+       save_and_exit = 1;
        dialog_clear();
        if (conf_get_changed())
                res = dialog_yesno(NULL,
@@ -941,6 +952,7 @@ int main(int ac, char **av)
        }
 
        set_config_filename(conf_get_configname());
+       conf_set_message_callback(conf_message_callback);
        do {
                conf(&rootmenu, NULL);
                res = handle_exit();
index e98a05c8e50882d3b2833a2f4d05761dcffd22d3..f3bffa309333061ed5d852e7c00132107017add5 100644 (file)
@@ -48,7 +48,7 @@ void menu_add_entry(struct symbol *sym)
 {
        struct menu *menu;
 
-       menu = malloc(sizeof(*menu));
+       menu = xmalloc(sizeof(*menu));
        memset(menu, 0, sizeof(*menu));
        menu->sym = sym;
        menu->parent = current_menu;
@@ -531,7 +531,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
                        location = menu;
        }
        if (head && location) {
-               jump = malloc(sizeof(struct jump_key));
+               jump = xmalloc(sizeof(struct jump_key));
 
                if (menu_is_visible(prop->menu)) {
                        /*
index 87d4b15da951031896868789df7a992d21fcc73b..dbf31edd22b261edafc003e6c3e0c3420e866c97 100644 (file)
  */
 #define _GNU_SOURCE
 #include <string.h>
+#include <stdlib.h>
 
 #include "lkc.h"
 #include "nconf.h"
 #include <ctype.h>
 
-static const char nconf_readme[] = N_(
-"Overview\n"
-"--------\n"
-"This interface let you select features and parameters for the build.\n"
-"Features can either be built-in, modularized, or ignored. Parameters\n"
-"must be entered in as decimal or hexadecimal numbers or text.\n"
+static const char nconf_global_help[] = N_(
+"Help windows\n"
+"------------\n"
+"o  Global help:  Unless in a data entry window, pressing <F1> will give \n"
+"   you the global help window, which you are just reading.\n"
 "\n"
-"Menu items beginning with following braces represent features that\n"
-"  [ ] can be built in or removed\n"
-"  < > can be built in, modularized or removed\n"
-"  { } can be built in or modularized (selected by other feature)\n"
-"  - - are selected by other feature,\n"
-"  XXX cannot be selected. Use Symbol Info to find out why,\n"
-"while *, M or whitespace inside braces means to build in, build as\n"
-"a module or to exclude the feature respectively.\n"
+"o  A short version of the global help is available by pressing <F3>.\n"
 "\n"
-"To change any of these features, highlight it with the cursor\n"
-"keys and press <Y> to build it in, <M> to make it a module or\n"
-"<N> to removed it.  You may also press the <Space Bar> to cycle\n"
-"through the available options (ie. Y->N->M->Y).\n"
+"o  Local help:  To get help related to the current menu entry, use any\n"
+"   of <?> <h>, or if in a data entry window then press <F1>.\n"
 "\n"
-"Some additional keyboard hints:\n"
 "\n"
-"Menus\n"
-"----------\n"
-"o  Use the Up/Down arrow keys (cursor keys) to highlight the item\n"
-"   you wish to change use <Enter> or <Space>. Goto submenu by \n"
-"   pressing <Enter> of <right-arrow>. Use <Esc> or <left-arrow> to go back.\n"
-"   Submenus are designated by \"--->\".\n"
-"\n"
-"   Searching: pressing '/' triggers interactive search mode.\n"
-"              nconfig performs a case insensitive search for the string\n"
-"              in the menu prompts (no regex support).\n"
-"              Pressing the up/down keys highlights the previous/next\n"
-"              matching item. Backspace removes one character from the\n"
-"              match string. Pressing either '/' again or ESC exits\n"
-"              search mode. All other keys behave normally.\n"
+"Menu entries\n"
+"------------\n"
+"This interface lets you select features and parameters for the kernel\n"
+"build.  Kernel features can either be built-in, modularized, or removed.\n"
+"Parameters must be entered as text or decimal or hexadecimal numbers.\n"
 "\n"
-"   You may also use the <PAGE UP> and <PAGE DOWN> keys to scroll\n"
-"   unseen options into view.\n"
+"Menu entries beginning with following braces represent features that\n"
+"  [ ]  can be built in or removed\n"
+"  < >  can be built in, modularized or removed\n"
+"  { }  can be built in or modularized, are selected by another feature\n"
+"  - -  are selected by another feature\n"
+"  XXX  cannot be selected.  Symbol Info <F2> tells you why.\n"
+"*, M or whitespace inside braces means to build in, build as a module\n"
+"or to exclude the feature respectively.\n"
 "\n"
-"o  To exit a menu use the just press <ESC> <F5> <F8> or <left-arrow>.\n"
+"To change any of these features, highlight it with the movement keys\n"
+"listed below and press <y> to build it in, <m> to make it a module or\n"
+"<n> to remove it.  You may press the <Space> key to cycle through the\n"
+"available options.\n"
 "\n"
-"o  To get help with an item, press <F1>\n"
-"   Shortcut: Press <h> or <?>.\n"
+"A trailing \"--->\" designates a submenu.\n"
 "\n"
 "\n"
-"Radiolists  (Choice lists)\n"
-"-----------\n"
-"o  Use the cursor keys to select the option you wish to set and press\n"
-"   <S> or the <SPACE BAR>.\n"
+"Menu navigation keys\n"
+"----------------------------------------------------------------------\n"
+"Linewise up                 <Up>\n"
+"Linewise down               <Down>\n"
+"Pagewise up                 <Page Up>\n"
+"Pagewise down               <Page Down>\n"
+"First entry                 <Home>\n"
+"Last entry                  <End>\n"
+"Enter a submenu             <Right>  <Enter>\n"
+"Go back to parent menu      <Left>   <Esc>  <F5>\n"
+"Close a help window         <Enter>  <Esc>  <F5>\n"
+"Close entry window, apply   <Enter>\n"
+"Close entry window, forget  <Esc>  <F5>\n"
+"Start incremental, case-insensitive search for STRING in menu entries,\n"
+"    no regex support, STRING is displayed in upper left corner\n"
+"                            </>STRING\n"
+"    Remove last character   <Backspace>\n"
+"    Jump to next hit        <Down>\n"
+"    Jump to previous hit    <Up>\n"
+"Exit menu search mode       </>  <Esc>\n"
+"Search for configuration variables with or without leading CONFIG_\n"
+"                            <F8>RegExpr<Enter>\n"
+"Verbose search help         <F8><F1>\n"
+"----------------------------------------------------------------------\n"
 "\n"
-"   Shortcut: Press the first letter of the option you wish to set then\n"
-"             press <S> or <SPACE BAR>.\n"
+"Unless in a data entry window, key <1> may be used instead of <F1>,\n"
+"<2> instead of <F2>, etc.\n"
 "\n"
-"o  To see available help for the item, press <F1>\n"
-"   Shortcut: Press <H> or <?>.\n"
 "\n"
+"Radiolist (Choice list)\n"
+"-----------------------\n"
+"Use the movement keys listed above to select the option you wish to set\n"
+"and press <Space>.\n"
 "\n"
-"Data Entry\n"
-"-----------\n"
-"o  Enter the requested information and press <ENTER>\n"
-"   If you are entering hexadecimal values, it is not necessary to\n"
-"   add the '0x' prefix to the entry.\n"
 "\n"
-"o  For help, press <F1>.\n"
+"Data entry\n"
+"----------\n"
+"Enter the requested information and press <Enter>.  Hexadecimal values\n"
+"may be entered without the \"0x\" prefix.\n"
 "\n"
 "\n"
-"Text Box    (Help Window)\n"
-"--------\n"
-"o  Use the cursor keys to scroll up/down/left/right.  The VI editor\n"
-"   keys h,j,k,l function here as do <u>, <d> and <SPACE BAR> for\n"
-"   those who are familiar with less and lynx.\n"
+"Text Box (Help Window)\n"
+"----------------------\n"
+"Use movement keys as listed in table above.\n"
 "\n"
-"o  Press <Enter>, <F1>, <F5>, <F9>, <q> or <Esc> to exit.\n"
+"Press any of <Enter> <Esc> <q> <F5> <F9> to exit.\n"
 "\n"
 "\n"
-"Alternate Configuration Files\n"
+"Alternate configuration files\n"
 "-----------------------------\n"
-"nconfig supports the use of alternate configuration files for\n"
-"those who, for various reasons, find it necessary to switch\n"
-"between different configurations.\n"
+"nconfig supports switching between different configurations.\n"
+"Press <F6> to save your current configuration.  Press <F7> and enter\n"
+"a file name to load a previously saved configuration.\n"
 "\n"
-"At the end of the main menu you will find two options.  One is\n"
-"for saving the current configuration to a file of your choosing.\n"
-"The other option is for loading a previously saved alternate\n"
-"configuration.\n"
 "\n"
-"Even if you don't use alternate configuration files, but you\n"
-"find during a nconfig session that you have completely messed\n"
-"up your settings, you may use the \"Load Alternate...\" option to\n"
-"restore your previously saved settings from \".config\" without\n"
-"restarting nconfig.\n"
+"Terminal configuration\n"
+"----------------------\n"
+"If you use nconfig in a xterm window, make sure your TERM environment\n"
+"variable specifies a terminal configuration which supports at least\n"
+"16 colors.  Otherwise nconfig will look rather bad.\n"
 "\n"
-"Other information\n"
-"-----------------\n"
-"If you use nconfig in an XTERM window make sure you have your\n"
-"$TERM variable set to point to a xterm definition which supports color.\n"
-"Otherwise, nconfig will look rather bad.  nconfig will not\n"
-"display correctly in a RXVT window because rxvt displays only one\n"
-"intensity of color, bright.\n"
+"If the \"stty size\" command reports the current terminalsize correctly,\n"
+"nconfig will adapt to sizes larger than the traditional 80x25 \"standard\"\n"
+"and display longer menus properly.\n"
 "\n"
-"nconfig will display larger menus on screens or xterms which are\n"
-"set to display more than the standard 25 row by 80 column geometry.\n"
-"In order for this to work, the \"stty size\" command must be able to\n"
-"display the screen's current row and column geometry.  I STRONGLY\n"
-"RECOMMEND that you make sure you do NOT have the shell variables\n"
-"LINES and COLUMNS exported into your environment.  Some distributions\n"
-"export those variables via /etc/profile.  Some ncurses programs can\n"
-"become confused when those variables (LINES & COLUMNS) don't reflect\n"
-"the true screen size.\n"
 "\n"
-"Optional personality available\n"
-"------------------------------\n"
-"If you prefer to have all of the options listed in a single menu, rather\n"
-"than the default multimenu hierarchy, run the nconfig with NCONFIG_MODE\n"
-"environment variable set to single_menu. Example:\n"
+"Single menu mode\n"
+"----------------\n"
+"If you prefer to have all of the menu entries listed in a single menu,\n"
+"rather than the default multimenu hierarchy, run nconfig with\n"
+"NCONFIG_MODE environment variable set to single_menu.  Example:\n"
 "\n"
 "make NCONFIG_MODE=single_menu nconfig\n"
 "\n"
-"<Enter> will then unroll the appropriate category, or enfold it if it\n"
-"is already unrolled.\n"
+"<Enter> will then unfold the appropriate category, or fold it if it\n"
+"is already unfolded.  Folded menu entries will be designated by a\n"
+"leading \"++>\" and unfolded entries by a leading \"-->\".\n"
 "\n"
-"Note that this mode can eventually be a little more CPU expensive\n"
-"(especially with a larger number of unrolled categories) than the\n"
-"default mode.\n"
+"Note that this mode can eventually be a little more CPU expensive than\n"
+"the default mode, especially with a larger number of unfolded submenus.\n"
 "\n"),
 menu_no_f_instructions[] = N_(
-" You do not have function keys support. Please follow the\n"
-" following instructions:\n"
-" Arrow keys navigate the menu.\n"
-" <Enter> or <right-arrow> selects submenus --->.\n"
-" Capital Letters are hotkeys.\n"
-" Pressing <Y> includes, <N> excludes, <M> modularizes features.\n"
-" Pressing SpaceBar toggles between the above options.\n"
-" Press <Esc> or <left-arrow> to go back one menu,\n"
-" <?> or <h> for Help, </> for Search.\n"
-" <1> is interchangeable with <F1>, <2> with <F2>, etc.\n"
-" Legend: [*] built-in  [ ] excluded  <M> module  < > module capable.\n"
-" <Esc> always leaves the current window.\n"),
+"Legend:  [*] built-in  [ ] excluded  <M> module  < > module capable.\n"
+"Submenus are designated by a trailing \"--->\".\n"
+"\n"
+"Use the following keys to navigate the menus:\n"
+"Move up or down with <Up> and <Down>.\n"
+"Enter a submenu with <Enter> or <Right>.\n"
+"Exit a submenu to its parent menu with <Esc> or <Left>.\n"
+"Pressing <y> includes, <n> excludes, <m> modularizes features.\n"
+"Pressing <Space> cycles through the available options.\n"
+"To search for menu entries press </>.\n"
+"<Esc> always leaves the current window.\n"
+"\n"
+"You do not have function keys support.\n"
+"Press <1> instead of <F1>, <2> instead of <F2>, etc.\n"
+"For verbose global help use key <1>.\n"
+"For help related to the current menu entry press <?> or <h>.\n"),
 menu_instructions[] = N_(
-" Arrow keys navigate the menu.\n"
-" <Enter> or <right-arrow> selects submenus --->.\n"
-" Capital Letters are hotkeys.\n"
-" Pressing <Y> includes, <N> excludes, <M> modularizes features.\n"
-" Pressing SpaceBar toggles between the above options\n"
-" Press <Esc>, <F5> or <left-arrow> to go back one menu,\n"
-" <?>, <F1> or <h> for Help, </> for Search.\n"
-" <1> is interchangeable with <F1>, <2> with <F2>, etc.\n"
-" Legend: [*] built-in  [ ] excluded  <M> module  < > module capable.\n"
-" <Esc> always leaves the current window\n"),
+"Legend:  [*] built-in  [ ] excluded  <M> module  < > module capable.\n"
+"Submenus are designated by a trailing \"--->\".\n"
+"\n"
+"Use the following keys to navigate the menus:\n"
+"Move up or down with <Up> or <Down>.\n"
+"Enter a submenu with <Enter> or <Right>.\n"
+"Exit a submenu to its parent menu with <Esc> or <Left>.\n"
+"Pressing <y> includes, <n> excludes, <m> modularizes features.\n"
+"Pressing <Space> cycles through the available options.\n"
+"To search for menu entries press </>.\n"
+"<Esc> always leaves the current window.\n"
+"\n"
+"Pressing <1> may be used instead of <F1>, <2> instead of <F2>, etc.\n"
+"For verbose global help press <F1>.\n"
+"For help related to the current menu entry press <?> or <h>.\n"),
 radiolist_instructions[] = N_(
-" Use the arrow keys to navigate this window or\n"
-" press the hotkey of the item you wish to select\n"
-" followed by the <SPACE BAR>.\n"
-" Press <?>, <F1> or <h> for additional information about this option.\n"),
+"Press <Up>, <Down>, <Home> or <End> to navigate a radiolist, select\n"
+"with <Space>.\n"
+"For help related to the current entry press <?> or <h>.\n"
+"For global help press <F1>.\n"),
 inputbox_instructions_int[] = N_(
 "Please enter a decimal value.\n"
 "Fractions will not be accepted.\n"
-"Press <RETURN> to accept, <ESC> to cancel."),
+"Press <Enter> to apply, <Esc> to cancel."),
 inputbox_instructions_hex[] = N_(
 "Please enter a hexadecimal value.\n"
-"Press <RETURN> to accept, <ESC> to cancel."),
+"Press <Enter> to apply, <Esc> to cancel."),
 inputbox_instructions_string[] = N_(
 "Please enter a string value.\n"
-"Press <RETURN> to accept, <ESC> to cancel."),
+"Press <Enter> to apply, <Esc> to cancel."),
 setmod_text[] = N_(
-"This feature depends on another which\n"
-"has been configured as a module.\n"
-"As a result, this feature will be built as a module."),
+"This feature depends on another feature which has been configured as a\n"
+"module.  As a result, the current feature will be built as a module too."),
 load_config_text[] = N_(
 "Enter the name of the configuration file you wish to load.\n"
-"Accept the name shown to restore the configuration you\n"
-"last retrieved.  Leave blank to abort."),
+"Accept the name shown to restore the configuration you last\n"
+"retrieved.  Leave empty to abort."),
 load_config_help[] = N_(
-"\n"
 "For various reasons, one may wish to keep several different\n"
 "configurations available on a single machine.\n"
 "\n"
 "If you have saved a previous configuration in a file other than the\n"
-"default one, entering its name here will allow you to modify that\n"
-"configuration.\n"
+"default one, entering its name here will allow you to load and modify\n"
+"that configuration.\n"
 "\n"
-"If you are uncertain, then you have probably never used alternate\n"
-"configuration files.  You should therefor leave this blank to abort.\n"),
+"Leave empty to abort.\n"),
 save_config_text[] = N_(
 "Enter a filename to which this configuration should be saved\n"
-"as an alternate.  Leave blank to abort."),
+"as an alternate.  Leave empty to abort."),
 save_config_help[] = N_(
-"\n"
-"For various reasons, one may wish to keep different configurations\n"
-"available on a single machine.\n"
+"For various reasons, one may wish to keep several different\n"
+"configurations available on a single machine.\n"
 "\n"
 "Entering a file name here will allow you to later retrieve, modify\n"
 "and use the current configuration as an alternate to whatever\n"
 "configuration options you have selected at that time.\n"
 "\n"
-"If you are uncertain what all this means then you should probably\n"
-"leave this blank.\n"),
+"Leave empty to abort.\n"),
 search_help[] = N_(
-"\n"
-"Search for symbols and display their relations. Regular expressions\n"
-"are allowed.\n"
-"Example: search for \"^FOO\"\n"
+"Search for symbols (configuration variable names CONFIG_*) and display\n"
+"their relations.  Regular expressions are supported.\n"
+"Example:  Search for \"^FOO\".\n"
 "Result:\n"
 "-----------------------------------------------------------------\n"
 "Symbol: FOO [ = m]\n"
@@ -229,26 +222,26 @@ search_help[] = N_(
 "Selects: LIBCRC32\n"
 "Selected by: BAR\n"
 "-----------------------------------------------------------------\n"
-"o The line 'Prompt:' shows the text used in the menu structure for\n"
-"  this symbol\n"
-"o The 'Defined at' line tell at what file / line number the symbol\n"
-"  is defined\n"
-"o The 'Depends on:' line tell what symbols needs to be defined for\n"
-"  this symbol to be visible in the menu (selectable)\n"
-"o The 'Location:' lines tell where in the menu structure this symbol\n"
-"  is located\n"
-"    A location followed by a [ = y] indicate that this is a selectable\n"
-"    menu item - and current value is displayed inside brackets.\n"
-"o The 'Selects:' line tell what symbol will be automatically\n"
-"  selected if this symbol is selected (y or m)\n"
-"o The 'Selected by' line tell what symbol has selected this symbol\n"
+"o  The line 'Prompt:' shows the text displayed for this symbol in\n"
+"   the menu hierarchy.\n"
+"o  The 'Defined at' line tells at what file / line number the symbol is\n"
+"   defined.\n"
+"o  The 'Depends on:' line lists symbols that need to be defined for\n"
+"   this symbol to be visible and selectable in the menu.\n"
+"o  The 'Location:' lines tell, where in the menu structure this symbol\n"
+"   is located.  A location followed by a [ = y] indicates that this is\n"
+"   a selectable menu item, and the current value is displayed inside\n"
+"   brackets.\n"
+"o  The 'Selects:' line tells, what symbol will be automatically selected\n"
+"   if this symbol is selected (y or m).\n"
+"o  The 'Selected by' line tells what symbol has selected this symbol.\n"
 "\n"
 "Only relevant lines are shown.\n"
 "\n\n"
 "Search examples:\n"
-"Examples: USB  => find all symbols containing USB\n"
-"          ^USB => find all symbols starting with USB\n"
-"          USB$ => find all symbols ending with USB\n"
+"USB  => find all symbols containing USB\n"
+"^USB => find all symbols starting with USB\n"
+"USB$ => find all symbols ending with USB\n"
 "\n");
 
 struct mitem {
@@ -319,19 +312,19 @@ struct function_keys function_keys[] = {
        },
        {
                .key_str = "F2",
-               .func = "Sym Info",
+               .func = "SymInfo",
                .key = F_SYMBOL,
                .handler = handle_f2,
        },
        {
                .key_str = "F3",
-               .func = "Insts",
+               .func = "Help 2",
                .key = F_INSTS,
                .handler = handle_f3,
        },
        {
                .key_str = "F4",
-               .func = "Config",
+               .func = "ShowAll",
                .key = F_CONF,
                .handler = handle_f4,
        },
@@ -355,7 +348,7 @@ struct function_keys function_keys[] = {
        },
        {
                .key_str = "F8",
-               .func = "Sym Search",
+               .func = "SymSearch",
                .key = F_SEARCH,
                .handler = handle_f8,
        },
@@ -392,7 +385,7 @@ static void print_function_line(void)
 static void handle_f1(int *key, struct menu *current_item)
 {
        show_scroll_win(main_window,
-                       _("README"), _(nconf_readme));
+                       _("Global help"), _(nconf_global_help));
        return;
 }
 
@@ -407,7 +400,7 @@ static void handle_f2(int *key, struct menu *current_item)
 static void handle_f3(int *key, struct menu *current_item)
 {
        show_scroll_win(main_window,
-                       _("Instructions"),
+                       _("Short help"),
                        _(current_instructions));
        return;
 }
@@ -696,13 +689,18 @@ static void search_conf(void)
 {
        struct symbol **sym_arr;
        struct gstr res;
+       struct gstr title;
        char *dialog_input;
        int dres;
+
+       title = str_new();
+       str_printf( &title, _("Enter %s (sub)string to search for "
+                             "(with or without \"%s\")"), CONFIG_, CONFIG_);
+
 again:
        dres = dialog_inputbox(main_window,
                        _("Search Configuration Parameter"),
-                       _("Enter " CONFIG_ " (sub)string to search for "
-                               "(with or without \"" CONFIG_ "\")"),
+                       str_get(&title),
                        "", &dialog_input_result, &dialog_input_result_len);
        switch (dres) {
        case 0:
@@ -712,6 +710,7 @@ again:
                                _("Search Configuration"), search_help);
                goto again;
        default:
+               str_free(&title);
                return;
        }
 
@@ -726,6 +725,7 @@ again:
        show_scroll_win(main_window,
                        _("Search Results"), str_get(&res));
        str_free(&res);
+       str_free(&title);
 }
 
 
index 379003c7a2b4d8cef60e25548fcb9567ca3656c5..9f8c44ecc703a1ea9cd27d3e656e5352f8e6ba86 100644 (file)
@@ -48,7 +48,7 @@ static void set_normal_colors(void)
        init_pair(INPUT_FIELD, -1, -1);
 
        init_pair(FUNCTION_HIGHLIGHT, -1, -1);
-       init_pair(FUNCTION_TEXT, COLOR_BLUE, -1);
+       init_pair(FUNCTION_TEXT, COLOR_YELLOW, -1);
 }
 
 /* available attributes:
index df274febb3e51d6331c5b64e4f29a64f51817538..1500c38f0ccabf5908f7704f683759b0e754ebce 100644 (file)
@@ -6,6 +6,7 @@
 #include <qglobal.h>
 
 #if QT_VERSION < 0x040000
+#include <stddef.h>
 #include <qmainwindow.h>
 #include <qvbox.h>
 #include <qvaluelist.h>
index 22a3c400fc41119c8c8f4197c3dfcdde87b0a882..ecc5aa5f865db7d253facefc10cc77fc2404e41d 100644 (file)
@@ -656,11 +656,11 @@ bool sym_set_string_value(struct symbol *sym, const char *newval)
        size = strlen(newval) + 1;
        if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) {
                size += 2;
-               sym->def[S_DEF_USER].val = val = malloc(size);
+               sym->def[S_DEF_USER].val = val = xmalloc(size);
                *val++ = '0';
                *val++ = 'x';
        } else if (!oldval || strcmp(oldval, newval))
-               sym->def[S_DEF_USER].val = val = malloc(size);
+               sym->def[S_DEF_USER].val = val = xmalloc(size);
        else
                return true;
 
@@ -812,7 +812,7 @@ struct symbol *sym_lookup(const char *name, int flags)
                hash = 0;
        }
 
-       symbol = malloc(sizeof(*symbol));
+       symbol = xmalloc(sizeof(*symbol));
        memset(symbol, 0, sizeof(*symbol));
        symbol->name = new_name;
        symbol->type = S_UNKNOWN;
@@ -863,7 +863,7 @@ const char *sym_expand_string_value(const char *in)
        size_t reslen;
 
        reslen = strlen(in) + 1;
-       res = malloc(reslen);
+       res = xmalloc(reslen);
        res[0] = '\0';
 
        while ((src = strchr(in, '$'))) {
@@ -921,7 +921,7 @@ const char *sym_escape_string_value(const char *in)
                p++;
        }
 
-       res = malloc(reslen);
+       res = xmalloc(reslen);
        res[0] = '\0';
 
        strcat(res, "\"");
@@ -1228,7 +1228,7 @@ struct property *prop_alloc(enum prop_type type, struct symbol *sym)
        struct property *prop;
        struct property **propp;
 
-       prop = malloc(sizeof(*prop));
+       prop = xmalloc(sizeof(*prop));
        memset(prop, 0, sizeof(*prop));
        prop->type = type;
        prop->sym = sym;
index d0b8b2318e489577fd82713fd79b1759c3ff170b..6e7fbf1968090463f37ec1af70d65fb0af28a391 100644 (file)
@@ -23,7 +23,7 @@ struct file *file_lookup(const char *name)
                }
        }
 
-       file = malloc(sizeof(*file));
+       file = xmalloc(sizeof(*file));
        memset(file, 0, sizeof(*file));
        file->name = file_name;
        file->next = file_list;
@@ -81,7 +81,7 @@ int file_write_dep(const char *name)
 struct gstr str_new(void)
 {
        struct gstr gs;
-       gs.s = malloc(sizeof(char) * 64);
+       gs.s = xmalloc(sizeof(char) * 64);
        gs.len = 64;
        gs.max_width = 0;
        strcpy(gs.s, "\0");
@@ -138,3 +138,22 @@ const char *str_get(struct gstr *gs)
        return gs->s;
 }
 
+void *xmalloc(size_t size)
+{
+       void *p = malloc(size);
+       if (p)
+               return p;
+       fprintf(stderr, "Out of memory.\n");
+       exit(1);
+}
+
+void *xcalloc(size_t nmemb, size_t size)
+{
+       void *p = calloc(nmemb, size);
+       if (p)
+               return p;
+       fprintf(stderr, "Out of memory.\n");
+       exit(1);
+}
+
+
index 00f9d3a9cf8b96fd85639339019bf1bc2afab306..6555a475453b882d2970c7ae4b16b5c4eb3286cf 100644 (file)
@@ -40,7 +40,7 @@ static void zconf_endfile(void);
 
 static void new_string(void)
 {
-       text = malloc(START_STRSIZE);
+       text = xmalloc(START_STRSIZE);
        text_asize = START_STRSIZE;
        text_size = 0;
        *text = 0;
@@ -62,7 +62,7 @@ static void append_string(const char *str, int size)
 
 static void alloc_string(const char *str, int size)
 {
-       text = malloc(size + 1);
+       text = xmalloc(size + 1);
        memcpy(text, str, size);
        text[size] = 0;
 }
@@ -288,7 +288,7 @@ void zconf_initscan(const char *name)
                exit(1);
        }
 
-       current_buf = malloc(sizeof(*current_buf));
+       current_buf = xmalloc(sizeof(*current_buf));
        memset(current_buf, 0, sizeof(*current_buf));
 
        current_file = file_lookup(name);
@@ -299,7 +299,7 @@ void zconf_nextfile(const char *name)
 {
        struct file *iter;
        struct file *file = file_lookup(name);
-       struct buffer *buf = malloc(sizeof(*buf));
+       struct buffer *buf = xmalloc(sizeof(*buf));
        memset(buf, 0, sizeof(*buf));
 
        current_buf->state = YY_CURRENT_BUFFER;
index c32b1a49f5a30923b70e097e7241735772ad4b67..a0521aa5974b514e7bfcb1811746c283702862f2 100644 (file)
@@ -802,7 +802,7 @@ static void zconf_endfile(void);
 
 static void new_string(void)
 {
-       text = malloc(START_STRSIZE);
+       text = xmalloc(START_STRSIZE);
        text_asize = START_STRSIZE;
        text_size = 0;
        *text = 0;
@@ -824,7 +824,7 @@ static void append_string(const char *str, int size)
 
 static void alloc_string(const char *str, int size)
 {
-       text = malloc(size + 1);
+       text = xmalloc(size + 1);
        memcpy(text, str, size);
        text[size] = 0;
 }
@@ -2343,7 +2343,7 @@ void zconf_initscan(const char *name)
                exit(1);
        }
 
-       current_buf = malloc(sizeof(*current_buf));
+       current_buf = xmalloc(sizeof(*current_buf));
        memset(current_buf, 0, sizeof(*current_buf));
 
        current_file = file_lookup(name);
@@ -2354,7 +2354,7 @@ void zconf_nextfile(const char *name)
 {
        struct file *iter;
        struct file *file = file_lookup(name);
-       struct buffer *buf = malloc(sizeof(*buf));
+       struct buffer *buf = xmalloc(sizeof(*buf));
        memset(buf, 0, sizeof(*buf));
 
        current_buf->state = YY_CURRENT_BUFFER;
index 6391db03dd8227d748e2d77c8fd46649ae0a46ba..c96e3f73a72194904f076815bc6f6abfe2d62fa6 100644 (file)
@@ -455,7 +455,7 @@ GCCMAJORVERSION_f=$(shell $(callcc) -dumpversion | sed -e 's/\([^.]*\).*/\1/')
 GCCMINORVERSION_f=$(shell $(callcc) -dumpversion | sed -e 's/[^.]*\.\([^.]*\).*/\1/')
 GCCSUBVERSION_f        = $(shell $(callcc) -dumpversion | sed -e 's/.*\.\(.*\)/\1/')
 LDVERSION_f     = $(shell $(firstword $(LD)) -v | sed -e 's/.* \([0-9]\)\.\([^. ]*\).*/\1\2/')
-GCCSYSLIBDIRS_f = $(shell $(callcc) -print-search-dirs | sed '/^libraries:/{s/^libraries: /-L/;s/:/ -L/g;q;};d')
+GCCSYSLIBDIRS_f = $(shell $(callcc) -print-search-dirs | sed '/^libraries:/{s/^libraries: =\?/-L/;s/:/ -L/g;q;};d')
 GCCDIR_f       = $(shell $(callcc) -print-search-dirs | sed -ne 's+^install: \(.*[^/][^/]*\)/+\1+p' )
 GCCLIB_file_f   = $(shell $(callcc) -print-file-name=$(1))
 GCCLIB_HOST_f  = $(shell $(callcc) -print-libgcc-file-name)
index 5f6704c90786983161e40f5e36764a1d72ffc917..df93e75ff71f1fb76b095330e1d35e61e3f9c5c2 100644 (file)
@@ -22,6 +22,8 @@ CONFIG_CPU_ARM_ARMV5TE=y
 # CONFIG_CPU_ARM_ARMV7A is not set
 # CONFIG_CPU_ARM_ARMV7R is not set
 # CONFIG_PLATFORM_TYPE_beagleboard is not set
+# CONFIG_PLATFORM_TYPE_exynos4 is not set
+# CONFIG_PLATFORM_TYPE_exynos5 is not set
 # CONFIG_PLATFORM_TYPE_imx21 is not set
 # CONFIG_PLATFORM_TYPE_imx35 is not set
 # CONFIG_PLATFORM_TYPE_imx51 is not set
index 217ac066363a6b53595ea3cbf62fbd91aa706a57..73f2df1c6408e787fbbe22c5f0fe9d29c17c8055 100644 (file)
@@ -201,7 +201,7 @@ namespace L4Re
       if (Cap_entry const *e = get(name, l))
        return L4::Cap<T>(e->cap);
 
-      return L4::Cap<T>(-L4_ENOENT); //L4::Cap<T>::Invalid;
+      return L4::Cap<T>(-L4_ENOENT);
     }
 
     /**
index 3fdb0f0496e32475b15f86c416aeadd096ec78d1..1c3cce19b1fac2a20c8a4b2d626f329694c5964c 100644 (file)
@@ -36,12 +36,14 @@ namespace L4Re
 
 long
 Mem_alloc::alloc(unsigned long size,
-                 L4::Cap<Dataspace> mem, unsigned long flags) const throw()
+                 L4::Cap<Dataspace> mem, unsigned long flags,
+                 unsigned long align) const throw()
 {
   L4::Cap<L4::Factory> f(cap());
   return l4_error(f->create(mem, L4Re::Dataspace::Protocol)
                   << l4_umword_t(size)
-                  << l4_umword_t(flags));
+                  << l4_umword_t(flags)
+                  << l4_umword_t(align));
 }
 
 long
index 7e6910b966ce6b1efc2e5fff119b2d33ed093869..81169a3e8bae1306ae4335805bbe7ebee343ad88 100644 (file)
@@ -81,6 +81,7 @@ public:
     Pinned       = 0x02, ///< Allocate pinned data space, if supported by the allocator
     Super_pages  = 0x04, ///< Allocate super pages, if supported by the allocator
   };
+
   /**
    * \brief Allocate anonymous memory.
    *
@@ -89,13 +90,17 @@ public:
    *               granularity).
    * \param mem   Object capability for the data space to be allocated.
    * \param flags Flags, see #Mem_alloc_flags, default none
+   * \param align Log2 alignment of dataspace if supported by allocator,
+   *              will be at least L4_PAGESHIFT,
+   *              with Super_pages flag set at least L4_SUPERPAGESHIFT,
+   *              default 0
    *
    * \return 0 on success, <0 on error
    *         - -#L4_ENOMEM
    *         - IPC errors
    */
   long alloc(unsigned long size, L4::Cap<Dataspace> mem,
-             unsigned long flags = 0) const throw();
+             unsigned long flags = 0, unsigned long align = 0) const throw();
   /**
    * \brief Free data space.
    *
index 6c20128ee5d6b24e6f1082f88762be84c09c6d1c..2413b7b7e24e20f250fbedec1117afef8c58631a 100644 (file)
@@ -39,7 +39,7 @@ namespace L4Re { namespace Util {
  * \brief Allocate state area.
  *
  * \retval mem         Pointer to memory that has been allocated.
- * \retval pages_order Size to allocate, in log2 pages.
+ * \param  pages_order Size to allocate, in log2 pages.
  * \param  task        Task to use for allocation.
  * \param  rm          Region manager to use for allocation.
  *
index 5141e9f220aa425c3bdfc4ff7361ea7ee75bf57f..2faa37cfd5868b55a29f983c73c4e7ef35a60cfb 100644 (file)
@@ -67,6 +67,31 @@ L4_CV L4_INLINE long
 l4re_ma_alloc(unsigned long size, l4re_ds_t const mem,
               unsigned long flags) L4_NOTHROW;
 
+/**
+ * \brief Allocate memory
+ * \ingroup api_l4re_c_mem_alloc
+ *
+ * \param  size   Size to be requested in bytes (granularity
+ *                 is (super)pages and the size is rounded up to this
+ *                 granularity).
+ * \param  mem    Capability slot to put the requested dataspace in
+ * \param  flags  Flags, see #l4re_ma_flags
+ * \param  align  Log2 alignment of dataspace if supported by allocator,
+ *                will be at least L4_PAGESHIFT,
+ *                with Super_pages flag set at least L4_SUPERPAGESHIFT,
+ *                default 0
+ * \return 0 on success, <0 on error
+ *
+ * \see L4Re::Mem_alloc::alloc and \see l4re_ma_alloc
+ *
+ * The memory allocator returns a dataspace.
+ *
+ * \note This function is using the L4Re::Env::env()->mem_alloc() service.
+ */
+L4_CV L4_INLINE long
+l4re_ma_alloc_align(unsigned long size, l4re_ds_t const mem,
+                    unsigned long flags, unsigned long align) L4_NOTHROW;
+
 /**
  * \brief Free memory.
  * \ingroup api_l4re_c_mem_alloc
@@ -90,6 +115,10 @@ l4re_ma_free(l4re_ds_t const mem) L4_NOTHROW;
  * \param  size   Size to be requested.
  * \param  mem    Capability slot to put the requested dataspace in
  * \param  flags  Flags, see #l4re_ma_flags
+ * \param  align  Log2 alignment of dataspace if supported by allocator,
+ *                will be at least L4_PAGESHIFT,
+ *                with Super_pages flag set at least L4_SUPERPAGESHIFT,
+ *                default 0
  * \return 0 on success, <0 on error
  *
  * \see L4Re::Mem_alloc::alloc
@@ -97,8 +126,9 @@ l4re_ma_free(l4re_ds_t const mem) L4_NOTHROW;
  * The memory allocator returns a dataspace.
  */
 L4_CV long
-l4re_ma_alloc_srv(l4_cap_idx_t srv, unsigned long size, l4re_ds_t const mem,
-                  unsigned long flags) L4_NOTHROW;
+l4re_ma_alloc_align_srv(l4_cap_idx_t srv, unsigned long size,
+                        l4re_ds_t const mem, unsigned long flags,
+                        unsigned long align) L4_NOTHROW;
 
 /**
  * \brief Free memory.
@@ -123,7 +153,16 @@ L4_CV L4_INLINE long
 l4re_ma_alloc(unsigned long size, l4re_ds_t const mem,
               unsigned long flags) L4_NOTHROW
 {
-  return l4re_ma_alloc_srv(l4re_global_env->mem_alloc, size, mem, flags);
+  return l4re_ma_alloc_align_srv(l4re_global_env->mem_alloc, size, mem,
+                                 flags, 0);
+}
+
+L4_CV L4_INLINE long
+l4re_ma_alloc_align(unsigned long size, l4re_ds_t const mem,
+                    unsigned long flags, unsigned long align) L4_NOTHROW
+{
+  return l4re_ma_alloc_align_srv(l4re_global_env->mem_alloc, size, mem,
+                                 flags, align);
 }
 
 L4_CV L4_INLINE long
index b96df5122582163418e5fb328c86550b292b6530..e72467e0188f4c8a850cf6e7e886bc6c113a1773 100644 (file)
 
 
 long
-l4re_ma_alloc_srv(l4_cap_idx_t srv, unsigned long size, l4re_ds_t const mem,
-                  unsigned long flags) L4_NOTHROW
+l4re_ma_alloc_align_srv(l4_cap_idx_t srv, unsigned long size,
+                        l4re_ds_t const mem, unsigned long flags,
+                        unsigned long align) L4_NOTHROW
 {
   L4::Cap<L4Re::Mem_alloc> x(srv);
   L4::Cap<L4Re::Dataspace> ds(mem);
-  return x->alloc(size, ds, flags);
+  return x->alloc(size, ds, flags, align);
 }
 
 long
index 23460e2d823313c49afff43768d1be1dad5ccced..58b91a2da3c2c47a0f28060f1f2b78eba178b80d 100644 (file)
@@ -93,7 +93,7 @@ typedef struct l4_exc_regs_t
 L4_INLINE l4_utcb_t *l4_utcb_direct(void) L4_NOTHROW
 {
   l4_utcb_t *res;
-  __asm__ __volatile__ ( "mov %%gs:0, %0 \n" : "=r"(res));
+  __asm__ ( "mov %%gs:0, %0 \n" : "=r"(res));
   return res;
 }
 
index 17967fd2d23688a9ccc874ceedcea70e14553505..b64018755496f9093724e96f6c4bedf65d36031c 100644 (file)
@@ -40,7 +40,7 @@ l4_ipc(l4_cap_idx_t dest, l4_utcb_t *utcb,
 {
   register l4_umword_t _dest     __asm__("r2") = dest | flags;
   register l4_umword_t _timeout  __asm__("r3") = timeout.raw;
-  register l4_msgtag_t _tag      __asm__("r0") = tag;
+  register l4_umword_t _tag      __asm__("r0") = tag.raw;
   register l4_umword_t _label    __asm__("r4") = slabel;
   (void)utcb;
 
@@ -48,22 +48,18 @@ l4_ipc(l4_cap_idx_t dest, l4_utcb_t *utcb,
     ("mov lr, pc    \n"
      "mov pc, %[sc] \n"
      :
-     "=r" (_dest),
-     "=r" (_timeout),
-     "=r" (_label),
-     "=r" (_tag)
+     "+r" (_dest),
+     "+r" (_timeout),
+     "+r" (_label),
+     "+r" (_tag)
      :
-     "0" (_dest),
-     "1" (_timeout),
-     "2" (_label),
-     "3" (_tag),
      [sc] "i" (L4_SYSCALL_INVOKE)
      :
      "cc", "memory", "lr");
 
   if (rlabel)
     *rlabel = _label;
-  tag.raw = _tag.raw; // because gcc doesn't return out of registers variables
+  tag.raw = _tag;
 
   return tag;
 }
index 24d334991124253400aa4bf3bdb93cd66bafa7d6..37dcac4bbcc35bd4110ea20545ced8734cc3cd6f 100644 (file)
@@ -80,9 +80,9 @@ typedef struct l4_exc_regs_t
 L4_INLINE l4_utcb_t *l4_utcb_direct(void) L4_NOTHROW
 {
   register l4_utcb_t *utcb __asm__ ("r0");
-  __asm__ volatile ("mov lr, pc          \n"
-                    "mov pc, #0xffffff00 \n"
-                    : "=r"(utcb) : : "lr");
+  __asm__ ("mov lr, pc          \n"
+           "mov pc, #0xffffff00 \n"
+           : "=r"(utcb) : : "lr");
   return utcb;
 }
 #endif
index e1a3e82932eb3e6232b1ab192e54626cc5048cc4..e06a8140f70ba1692e12060cf405f38678154670 100644 (file)
 #define L4_SYSCALL_INVOKE              (-0x00000004-L4_SYSCALL_MAGIC_OFFSET)
 
 L4_INLINE l4_msgtag_t
-l4_ipc_call(l4_cap_idx_t dest, l4_utcb_t *utcb,
-            l4_msgtag_t tag,
-            l4_timeout_t timeout) L4_NOTHROW
+l4_ipc(l4_cap_idx_t dest, l4_utcb_t *utcb,
+       l4_umword_t flags,
+       l4_umword_t slabel,
+       l4_msgtag_t tag,
+       l4_umword_t *rlabel,
+       l4_timeout_t timeout) L4_NOTHROW
 {
-  register l4_umword_t _dest     __asm__("r4") = dest | L4_SYSF_CALL;
+  register l4_umword_t _dest     __asm__("r4") = dest | flags;
   register l4_umword_t _timeout  __asm__("r5") = timeout.raw;
-  register l4_umword_t _flags    __asm__("r6") = 0;
-  register l4_msgtag_t _tag      __asm__("r3") = tag;
+  register l4_umword_t _tag      __asm__("r3") = tag.raw;
+  register l4_umword_t _lab      __asm__("r6") = slabel;
   (void)utcb;
 
   __asm__ __volatile__
-    (" bla %[addr] \n"
+    ("bla %[addr]"
      :
-     "=r" (_dest),
-     "=r" (_timeout),
-     "=r" (_flags),
-     "=r" (_tag)
+     "+r" (_dest),
+     "+r" (_timeout),
+     "+r" (_lab),
+     "+r" (_tag)
      :
-     [addr]"i" (L4_SYSCALL_INVOKE),
-     "0" (_dest),
-     "1" (_timeout),
-     "2" (_flags),
-     "3" (_tag)
+     [addr] "i" (L4_SYSCALL_INVOKE)
      :
-     "lr", "memory");
+     "memory", "lr");
 
-  tag.raw = _tag.raw; // because gcc doesn't return out of registers variables
+  if (rlabel)
+    *rlabel = _lab;
+  tag.raw = _tag;
   return tag;
 }
 
+
+L4_INLINE l4_msgtag_t
+l4_ipc_call(l4_cap_idx_t dest, l4_utcb_t *utcb,
+            l4_msgtag_t tag,
+            l4_timeout_t timeout) L4_NOTHROW
+{
+  return l4_ipc(dest, utcb, L4_SYSF_CALL, 0, tag, 0, timeout);
+}
+
 L4_INLINE l4_msgtag_t
 l4_ipc_reply_and_wait(l4_utcb_t *utcb, l4_msgtag_t tag,
                       l4_umword_t *label,
                       l4_timeout_t timeout) L4_NOTHROW
 {
-  register l4_umword_t _dest     __asm__("r4") = L4_INVALID_CAP | L4_SYSF_REPLY_AND_WAIT;
-  register l4_umword_t _timeout  __asm__("r5") = timeout.raw;
-  register l4_msgtag_t _tag      __asm__("r3") = tag;
-  register l4_umword_t _flags    __asm__("r6") = 0;
-  (void)utcb;
-
-  __asm__ __volatile__
-    (" bla %[addr] \n"
-     :
-     "=r" (_dest),
-     "=r" (_timeout),
-     "=r" (_flags),
-     "=r" (_tag)
-     :
-     [addr]"i" (L4_SYSCALL_INVOKE),
-     "0" (_dest),
-     "1" (_timeout),
-     "2" (_flags),
-     "3" (_tag)
-     :
-     "lr", "memory");
-  *label = _flags;
-  tag.raw = _tag.raw; // because gcc doesn't return out of registers variables
-  return tag;
+  return l4_ipc(L4_INVALID_CAP, utcb, L4_SYSF_REPLY_AND_WAIT, 0, tag, label, timeout);
 }
 
 L4_INLINE l4_msgtag_t
@@ -103,30 +90,7 @@ l4_ipc_send_and_wait(l4_cap_idx_t dest, l4_utcb_t *utcb,
                      l4_umword_t *src,
                      l4_timeout_t timeout) L4_NOTHROW
 {
-  register l4_umword_t _dest     __asm__("r4") = dest | L4_SYSF_SEND_AND_WAIT;
-  register l4_umword_t _timeout  __asm__("r5") = timeout.raw;
-  register l4_msgtag_t _tag      __asm__("r3") = tag;
-  register l4_umword_t _flags    __asm__("r6") = 0;
-  (void)utcb;
-
-  __asm__ __volatile__
-    (" bla %[addr] \n"
-     :
-     "=r" (_dest),
-     "=r" (_timeout),
-     "=r" (_flags),
-     "=r" (_tag)
-     :
-     [addr] "i" (L4_SYSCALL_INVOKE),
-     "0" (_dest),
-     "1" (_timeout),
-     "2" (_flags),
-     "3" (_tag)
-     :
-     "memory", "lr");
-  *src = _flags;
-  tag.raw = _tag.raw; // because gcc doesn't return out of registers variables
-  return tag;
+  return l4_ipc(dest, utcb, L4_SYSF_SEND_AND_WAIT, 0, tag, src, timeout);
 }
 
 L4_INLINE l4_msgtag_t
@@ -134,129 +98,25 @@ l4_ipc_send(l4_cap_idx_t dest, l4_utcb_t *utcb,
             l4_msgtag_t tag,
             l4_timeout_t timeout) L4_NOTHROW
 {
-  register l4_umword_t _dest     __asm__("r4") = dest | L4_SYSF_SEND;
-  register l4_umword_t _timeout  __asm__("r5") = timeout.raw;
-  register l4_umword_t _flags    __asm__("r6") = 0;
-  register l4_msgtag_t _tag      __asm__("r3") = tag;
-  (void)utcb;
-
-  __asm__ __volatile__
-    ("bla %[addr] \n"
-     :
-     "=r" (_dest),
-     "=r" (_timeout),
-     "=r" (_flags),
-     "=r" (_tag)
-     :
-     [addr] "i" (L4_SYSCALL_INVOKE),
-     "0" (_dest),
-     "1" (_timeout),
-     "2" (_flags),
-     "3" (_tag)
-     :
-     "memory", "lr");
-  tag.raw = _tag.raw; // because gcc doesn't return out of registers variables
-  return tag;
+  return l4_ipc(dest, utcb, L4_SYSF_SEND, 0, tag, 0, timeout);
 }
 
 L4_INLINE l4_msgtag_t
 l4_ipc_wait(l4_utcb_t *utcb, l4_umword_t *src,
             l4_timeout_t timeout) L4_NOTHROW
 {
-  l4_msgtag_t rtag;
-  register l4_umword_t _r        __asm__("r4") = L4_INVALID_CAP | L4_SYSF_WAIT;
-  register l4_umword_t _timeout  __asm__("r5") = timeout.raw;
-  register l4_msgtag_t _tag      __asm__("r3");
-  register l4_umword_t _flags    __asm__("r6") = 0;
-  (void)utcb;
-  _tag.raw = 0;
-
-  __asm__ __volatile__
-    ("bla %[addr] \n"
-     :
-     "=r"(_r),
-     "=r"(_timeout),
-     "=r"(_flags),
-     "=r"(_tag)
-     :
-     [addr] "i"(L4_SYSCALL_INVOKE),
-     "0"(_r),
-     "1"(_timeout),
-     "2"(_flags),
-     "3"(_tag)
-
-     :
-     "memory", "lr");
-  *src     = _flags;
-  rtag.raw = _tag.raw; // because gcc doesn't return out of registers variables
-  return rtag;
+  l4_msgtag_t t;
+  t.raw = 0;
+  return l4_ipc(L4_INVALID_CAP, utcb, L4_SYSF_WAIT, 0, t, src, timeout);
 }
 
 L4_INLINE l4_msgtag_t
 l4_ipc_receive(l4_cap_idx_t src, l4_utcb_t *utcb,
                l4_timeout_t timeout) L4_NOTHROW
 {
-  l4_msgtag_t rtag;
-  register l4_umword_t _r        __asm__("r4") = src | L4_SYSF_RECV;
-  register l4_umword_t _timeout  __asm__("r5") = timeout.raw;
-  register l4_msgtag_t _tag      __asm__("r3");
-  register l4_umword_t _flags    __asm__("r6") = 0;
-  (void)utcb;
-
-  _tag.raw = 0;
-
-  __asm__ __volatile__
-    ("bla %[addr] \n"
-     :
-     "=r"(_r),
-     "=r"(_timeout),
-     "=r"(_flags),
-     "=r"(_tag)
-     :
-     [addr] "i"(L4_SYSCALL_INVOKE),
-     "0"(_r),
-     "1"(_timeout),
-     "2"(_flags),
-     "3"(_tag)
-     :
-     "memory", "lr");
-  rtag.raw = _tag.raw; // because gcc doesn't return out of registers variables
-  return rtag;
-}
-
-// todo: let all calls above use this single call
-L4_INLINE l4_msgtag_t
-l4_ipc(l4_cap_idx_t dest, l4_utcb_t *utcb,
-       l4_umword_t flags,
-       l4_umword_t slabel,
-       l4_msgtag_t tag,
-       l4_umword_t *rlabel,
-       l4_timeout_t timeout) L4_NOTHROW
-{
-  register l4_umword_t _dest     __asm__("r4") = dest | flags;
-  register l4_umword_t _timeout  __asm__("r5") = timeout.raw;
-  register l4_msgtag_t _tag      __asm__("r3") = tag;
-  register l4_umword_t _lab      __asm__("r6") = slabel;
-  (void)utcb;
-
-  __asm__ __volatile__
-    ("bla %[addr] \n"
-     :
-     "=r" (_dest),
-     "=r" (_timeout),
-     "=r" (_lab),
-     "=r" (_tag)
-     :
-     [addr] "i" (L4_SYSCALL_INVOKE),
-     "0" (_dest),
-     "1" (_timeout),
-     "2" (_lab),
-     "3" (_tag)
-     :
-     "memory", "lr");
-  *rlabel = _lab;
-  tag.raw = _tag.raw; // because gcc doesn't return out of registers variables
-  return tag;
+  l4_msgtag_t t;
+  t.raw = 0;
+  return l4_ipc(src, utcb, L4_SYSF_RECV, 0, t, 0, timeout);
 }
 
 #include <l4/sys/ipc-impl.h>
index 8ede8d975d1735296419e3bfdd487547a2db94fe..bfdeb44ff0e809c20ae37277c40cbf64c6dd65d4 100644 (file)
@@ -83,7 +83,7 @@ L4_INLINE l4_utcb_t *l4_utcb_direct(void) L4_NOTHROW
 {
   l4_utcb_t *utcb;
 
-  __asm__ __volatile__
+  __asm__
   ("mr %[utcb], %%r2\n"
    : [utcb] "=r" (utcb)
    : );
index ea4ca87c8a6197cb9c23da6bf5b5702493254118..5963ba1b71d960786d989941521564c32fd6d1b3 100644 (file)
 #include <l4/sys/syscall_defs.h>
 
 L4_INLINE l4_msgtag_t
-l4_ipc_call(l4_cap_idx_t dest, l4_utcb_t *utcb,
-            l4_msgtag_t tag,
-            l4_timeout_t timeout) L4_NOTHROW
+l4_ipc(l4_cap_idx_t dest, l4_utcb_t *utcb,
+       l4_umword_t flags,
+       l4_umword_t slabel,
+       l4_msgtag_t tag,
+       l4_umword_t *rlabel,
+       l4_timeout_t timeout) L4_NOTHROW
 {
        (void)dest;
        (void)utcb;
+       (void)flags;
+       (void)slabel;
        (void)tag;
+       (void)rlabel;
        (void)timeout;
        l4_msgtag_t t;
        t.raw = ~0;
        return t;
 }
 
+
+L4_INLINE l4_msgtag_t
+l4_ipc_call(l4_cap_idx_t dest, l4_utcb_t *utcb,
+            l4_msgtag_t tag,
+            l4_timeout_t timeout) L4_NOTHROW
+{
+  return l4_ipc(dest, utcb, L4_SYSF_CALL, 0, tag, 0, timeout);
+}
+
 L4_INLINE l4_msgtag_t
 l4_ipc_reply_and_wait(l4_utcb_t *utcb, l4_msgtag_t tag,
                       l4_umword_t *label,
                       l4_timeout_t timeout) L4_NOTHROW
 {
-       (void)utcb;
-       (void)tag;
-       (void)label;
-       (void)timeout;
-       l4_msgtag_t t;
-       t.raw = ~0;
-       return t;
+  return l4_ipc(L4_INVALID_CAP, utcb, L4_SYSF_REPLY_AND_WAIT, 0, tag, label, timeout);
 }
 
-
 L4_INLINE l4_msgtag_t
 l4_ipc_send_and_wait(l4_cap_idx_t dest, l4_utcb_t *utcb,
                      l4_msgtag_t tag,
                      l4_umword_t *src,
                      l4_timeout_t timeout) L4_NOTHROW
 {
-       (void)dest;
-       (void)utcb;
-       (void)tag;
-       (void)src;
-       (void)timeout;
-       l4_msgtag_t t;
-       t.raw = ~0;
-       return t;
+  return l4_ipc(dest, utcb, L4_SYSF_SEND_AND_WAIT, 0, tag, src, timeout);
 }
 
 L4_INLINE l4_msgtag_t
@@ -80,61 +81,27 @@ l4_ipc_send(l4_cap_idx_t dest, l4_utcb_t *utcb,
             l4_msgtag_t tag,
             l4_timeout_t timeout) L4_NOTHROW
 {
-       (void)dest;
-       (void)utcb;
-       (void)tag;
-       (void)timeout;
-       l4_msgtag_t t;
-       t.raw = ~0;
-       return t;
+  return l4_ipc(dest, utcb, L4_SYSF_SEND, 0, tag, 0, timeout);
 }
 
 L4_INLINE l4_msgtag_t
 l4_ipc_wait(l4_utcb_t *utcb, l4_umword_t *src,
             l4_timeout_t timeout) L4_NOTHROW
 {
-       (void)utcb;
-       (void)src;
-       (void)timeout;
-       l4_msgtag_t t;
-       t.raw = ~0;
-       return t;
+  l4_msgtag_t t;
+  t.raw = 0;
+  return l4_ipc(L4_INVALID_CAP, utcb, L4_SYSF_WAIT, 0, t, src, timeout);
 }
 
 L4_INLINE l4_msgtag_t
 l4_ipc_receive(l4_cap_idx_t src, l4_utcb_t *utcb,
                l4_timeout_t timeout) L4_NOTHROW
 {
-       (void)utcb;
-       (void)src;
-       (void)timeout;
-       l4_msgtag_t t;
-       t.raw = ~0;
-       return t;
-}
-
-// todo: let all calls above use this single call
-L4_INLINE l4_msgtag_t
-l4_ipc(l4_cap_idx_t dest, l4_utcb_t *utcb,
-       l4_umword_t flags,
-       l4_umword_t slabel,
-       l4_msgtag_t tag,
-       l4_umword_t *rlabel,
-       l4_timeout_t timeout) L4_NOTHROW
-{
-       (void)dest;
-       (void)utcb;
-       (void)flags;
-       (void)slabel;
-       (void)tag;
-       (void)rlabel;
-       (void)timeout;
-       l4_msgtag_t t;
-       t.raw = ~0;
-       return t;
+  l4_msgtag_t t;
+  t.raw = 0;
+  return l4_ipc(src, utcb, L4_SYSF_RECV, 0, t, 0, timeout);
 }
 
-
 #include <l4/sys/ipc-impl.h>
 
 #endif //__GNUC__
index 4973a9a6d263a37b573f15f9693d459d8235431f..db5f0c87b4fe1d212b53649038b44a88a1b006e2 100644 (file)
@@ -102,7 +102,7 @@ typedef struct l4_exc_regs_t
 L4_INLINE l4_utcb_t *l4_utcb_direct(void) L4_NOTHROW
 {
   l4_utcb_t *utcb;
-  __asm__ __volatile__ ("mov %%fs:0, %0" : "=r" (utcb));
+  __asm__ ("mov %%fs:0, %0" : "=r" (utcb));
   return utcb;
 }
 
index 3ed3c0f464c02114cd873b1b66aece35f5265ca8..7df12f20db3d44f2331baf1e837d81ed053e11ad 100644 (file)
@@ -33,7 +33,7 @@
 
 
 /**
- * \brief Exported VMX capability regsiters.
+ * \brief Exported VMX capability registers.
  * \ingroup l4_vm_vmx_api
  */
 enum L4_vm_vmx_caps_regs
@@ -56,7 +56,7 @@ enum L4_vm_vmx_caps_regs
 
 
 /**
- * \brief Exported VMX capability regsiters (default to 1 bits).
+ * \brief Exported VMX capability registers (default to 1 bits).
  * \ingroup l4_vm_vmx_api
  */
 enum L4_vm_vmx_dfl1_regs
index ab76bc24e599ca4045b10653a4ca3433baab8448..3fd145a60371aee916f56a208635114972cc8717 100644 (file)
  */
 #define L4_NORETURN __attribute__((noreturn))
 
+#define L4_PURE __attribute__((pure))
+
 /**
  * No instrumentation function attribute.
  * \hideinitializer
index 18dd3743adf0222702b184e14e3a025ab3b5fe7d..eec61c90676ce6fedd7db881c051ba3983001fd0 100644 (file)
@@ -133,59 +133,59 @@ __BEGIN_DECLS
  *
  * This is a weak function which can be overwritten by applications.
  */
-L4_CV l4_utcb_t *l4_utcb_wrap(void) L4_NOTHROW;
+L4_CV l4_utcb_t *l4_utcb_wrap(void) L4_NOTHROW L4_PURE;
 
 /**
  * \internal
  * \brief Get the UTCB address.
  * \ingroup l4_utcb_api
  */
-L4_INLINE l4_utcb_t *l4_utcb_direct(void) L4_NOTHROW;
+L4_INLINE l4_utcb_t *l4_utcb_direct(void) L4_NOTHROW L4_PURE;
 
 /**
  * \brief Get the UTCB address.
  * \ingroup l4_utcb_api
  */
-L4_INLINE l4_utcb_t *l4_utcb(void) L4_NOTHROW;
+L4_INLINE l4_utcb_t *l4_utcb(void) L4_NOTHROW L4_PURE;
 
 /**
  * \brief Get the message-register block of a UTCB.
  * \ingroup l4_utcb_api
  * \returns A pointer to the message-register block of \c u.
  */
-L4_INLINE l4_msg_regs_t *l4_utcb_mr(void) L4_NOTHROW;
+L4_INLINE l4_msg_regs_t *l4_utcb_mr(void) L4_NOTHROW L4_PURE;
 
 /**
  * \internal
  * \param u the UTCB pointer to access.
  */
-L4_INLINE l4_msg_regs_t *l4_utcb_mr_u(l4_utcb_t *u) L4_NOTHROW;
+L4_INLINE l4_msg_regs_t *l4_utcb_mr_u(l4_utcb_t *u) L4_NOTHROW L4_PURE;
 
 /**
  * \brief Get the buffer-register block of a UTCB.
  * \ingroup l4_utcb_api
  * \returns A pointer to the buffer-register block of \c u.
  */
-L4_INLINE l4_buf_regs_t *l4_utcb_br(void) L4_NOTHROW;
+L4_INLINE l4_buf_regs_t *l4_utcb_br(void) L4_NOTHROW L4_PURE;
 
 /**
  * \internal
  * \param u the UTCB pointer to access.
  */
-L4_INLINE l4_buf_regs_t *l4_utcb_br_u(l4_utcb_t *u) L4_NOTHROW;
+L4_INLINE l4_buf_regs_t *l4_utcb_br_u(l4_utcb_t *u) L4_NOTHROW L4_PURE;
 
 /**
  * \brief Get the thread-control-register block of a UTCB.
  * \ingroup l4_utcb_api
  * \returns A pointer to the thread-control-register block of \c u.
  */
-L4_INLINE l4_thread_regs_t *l4_utcb_tcr(void) L4_NOTHROW;
+L4_INLINE l4_thread_regs_t *l4_utcb_tcr(void) L4_NOTHROW L4_PURE;
 
 /**
  * \internal
  * \param u the UTCB pointer to access.
  */
-L4_INLINE l4_thread_regs_t *l4_utcb_tcr_u(l4_utcb_t *u) L4_NOTHROW;
+L4_INLINE l4_thread_regs_t *l4_utcb_tcr_u(l4_utcb_t *u) L4_NOTHROW L4_PURE;
 
 /**
  * \defgroup l4_utcb_exc_api Exception registers
@@ -198,13 +198,13 @@ L4_INLINE l4_thread_regs_t *l4_utcb_tcr_u(l4_utcb_t *u) L4_NOTHROW;
  * \ingroup l4_utcb_exc_api
  * \returns A pointer to the exception message in \c u.
  */
-L4_INLINE l4_exc_regs_t *l4_utcb_exc(void) L4_NOTHROW;
+L4_INLINE l4_exc_regs_t *l4_utcb_exc(void) L4_NOTHROW L4_PURE;
 
 /**
  * \internal
  * \param u the UTCB pointer to access.
  */
-L4_INLINE l4_exc_regs_t *l4_utcb_exc_u(l4_utcb_t *u) L4_NOTHROW;
+L4_INLINE l4_exc_regs_t *l4_utcb_exc_u(l4_utcb_t *u) L4_NOTHROW L4_PURE;
 
 /**
  * \brief Access function to get the program counter of the exception state.
@@ -213,7 +213,7 @@ L4_INLINE l4_exc_regs_t *l4_utcb_exc_u(l4_utcb_t *u) L4_NOTHROW;
  * \param  u  UTCB
  * \return The program counter register out of the exception state.
  */
-L4_INLINE l4_umword_t l4_utcb_exc_pc(l4_exc_regs_t *u) L4_NOTHROW;
+L4_INLINE l4_umword_t l4_utcb_exc_pc(l4_exc_regs_t *u) L4_NOTHROW L4_PURE;
 
 /**
  * \brief Set the program counter register in the exception state.
@@ -229,7 +229,7 @@ L4_INLINE void l4_utcb_exc_pc_set(l4_exc_regs_t *u, l4_addr_t pc) L4_NOTHROW;
  * \brief Get the value out of an exception UTCB that describes the type of exception.
  * \ingroup l4_utcb_exc_api
  */
-L4_INLINE unsigned long l4_utcb_exc_typeval(l4_exc_regs_t *u) L4_NOTHROW;
+L4_INLINE unsigned long l4_utcb_exc_typeval(l4_exc_regs_t *u) L4_NOTHROW L4_PURE;
 
 /**
  * \brief Check whether an exception IPC is a page fault.
@@ -240,13 +240,13 @@ L4_INLINE unsigned long l4_utcb_exc_typeval(l4_exc_regs_t *u) L4_NOTHROW;
  * Function to check whether an exception IPC is a page fault, also applies
  * to I/O pagefaults.
  */
-L4_INLINE int l4_utcb_exc_is_pf(l4_exc_regs_t *u) L4_NOTHROW;
+L4_INLINE int l4_utcb_exc_is_pf(l4_exc_regs_t *u) L4_NOTHROW L4_PURE;
 
 /**
  * \brief Function to get the L4 style page fault address out of an exception.
  * \ingroup l4_utcb_exc_api
  */
-L4_INLINE l4_addr_t l4_utcb_exc_pfa(l4_exc_regs_t *u) L4_NOTHROW;
+L4_INLINE l4_addr_t l4_utcb_exc_pfa(l4_exc_regs_t *u) L4_NOTHROW L4_PURE;
 
 /**
  * \brief Enable or disable inheritance of FPU state to receiver.
index 5f8d83140e8ef4f2787e9f63b20d0ced28e57934..c47bef0e98afbcc1a704aa0aaf27f9b540e1c45a 100644 (file)
@@ -65,25 +65,7 @@ l4util_cpu_pause(void)
 L4_INLINE int
 l4util_cpu_has_cpuid(void)
 {
-  unsigned long eax;
-
-  asm volatile(
-               "pushf                  \t\n"
-               "pop %%rax              \t\n" /* get eflags */
-               "mov %%rax, %%rbx       \t\n" /* save it */
-               "xorq $0x200000, %%rax  \t\n" /* toggle ID bit */
-               "push %%rax             \t\n"
-               "popf                   \t\n" /* set again */
-               "pushf                  \t\n"
-               "pop %%rax              \t\n" /* get it again */
-               "xor %%rax, %%rbx       \t\n"
-               "push %%rbx             \t\n"
-               "popf                   \t\n" /* restore saved flags */
-               : "=a" (eax)
-               : /* no input */
-               : "rbx");
-
-  return eax & 0x200000;
+  return 1;
 }
 
 L4_INLINE void
index 2fe6f5c28896628b10fc65b6f92d7ed0ca9322c7..2c4aa968d3fe3826f486760fc8e8ea4fa5a269d5 100644 (file)
@@ -18,7 +18,6 @@
 
 #ifdef __GNUC__
 
-#include <l4/sys/kdebug.h>
 #include <l4/sys/compiler.h>
 
 EXTERN_C_BEGIN
@@ -28,53 +27,40 @@ L4_INLINE void l4util_sti (void);
 L4_INLINE void l4util_flags_save(l4_umword_t *flags);
 L4_INLINE void l4util_flags_restore(l4_umword_t *flags);
 
-/** \brief Disable all interrupts
- * \internal
- */
 L4_INLINE
 void
-l4util_cli (void)
+l4util_cli(void)
 {
-  l4_sys_cli();
+  extern void __do_not_use_l4util_cli(void);
+  __do_not_use_l4util_cli();
 }
 
-/** \brief Enable all interrupts
- * \internal
- */
+
 L4_INLINE
 void
-l4util_sti (void)
+l4util_sti(void)
 {
-  l4_sys_sti();
+  extern void __do_not_use_l4util_sti(void);
+  __do_not_use_l4util_sti();
 }
 
-/**
- * \brief Do not use
- * \internal
- *
- * !!!!!!!
- *  We probably need some primitive like in linux here which
- *    enable/disable interrupts on l4util_flags_restore
- *
- */
 
 L4_INLINE
 void
 l4util_flags_save(l4_umword_t *flags)
 {
   (void)flags;
-  enter_kdebug("l4util_flags_save");
+  extern void __do_not_use_l4util_flags_save(void);
+  __do_not_use_l4util_flags_save();
 }
 
-/** \brief Restore processor flags. Can be used to restore the interrupt flag
- * \internal
- */
 L4_INLINE
 void
 l4util_flags_restore(l4_umword_t *flags)
 {
   (void)flags;
-  enter_kdebug("l4util_flags_restore");
+  extern void __do_not_use_l4util_flags_restore(void);
+  __do_not_use_l4util_flags_restore();
 }
 
 EXTERN_C_END
index 6d5e1c804d8d3c25c4e0a74c4ee46874b6cbfd5c..c8e0369717f2e0a716925714d98ac3de407500bb 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef __L4UTIL_SPARC_IRQ_H
 #define __L4UTIL_SPARC_IRQ_H
 
-#include <l4/sys/kdebug.h>
+#include <l4/sys/compiler.h>
 
 EXTERN_C_BEGIN
 
@@ -14,7 +14,8 @@ L4_INLINE
 void
 l4util_cli(void)
 {
-       enter_kdebug("l4util_cli");
+  extern void __do_not_use_l4util_cli(void);
+  __do_not_use_l4util_cli();
 }
 
 
@@ -22,7 +23,8 @@ L4_INLINE
 void
 l4util_sti(void)
 {
-       enter_kdebug("l4util_sti");
+  extern void __do_not_use_l4util_sti(void);
+  __do_not_use_l4util_sti();
 }
 
 
@@ -31,7 +33,8 @@ void
 l4util_flags_save(l4_umword_t *flags)
 {
   (void)flags;
-  enter_kdebug("l4util_flags_save");
+  extern void __do_not_use_l4util_flags_save(void);
+  __do_not_use_l4util_flags_save();
 }
 
 L4_INLINE
@@ -39,7 +42,8 @@ void
 l4util_flags_restore(l4_umword_t *flags)
 {
   (void)flags;
-  enter_kdebug("l4util_flags_restore");
+  extern void __do_not_use_l4util_flags_restore(void);
+  __do_not_use_l4util_flags_restore();
 }
 
 EXTERN_C_END
index 7ef1ae7ef1388eaed4610729a9ae3754360f34d3..9f5cb94296e2ed7740b0f5a46224f8f9ec640990 100644 (file)
@@ -76,7 +76,7 @@ l4util_cpu_has_cpuid(void)
                "popfl                  \t\n" /* set again */
                "pushfl                 \t\n"
                "popl %%eax             \t\n" /* get it again */
-               "xorl %%eax, %%ebx      \t\n"
+               "xorl %%ebx, %%eax      \t\n"
                "pushl %%ebx            \t\n"
                "popfl                  \t\n" /* restore saved flags */
                "popl %%ebx              \t\n"
@@ -94,14 +94,13 @@ l4util_cpu_cpuid(unsigned long mode,
 {
   asm volatile("pushl %%ebx      \t\n"
                "cpuid            \t\n"
-               "mov %%ebx, %[b]  \t\n"
+               "mov %%ebx, %%esi \t\n"
                "popl %%ebx       \t\n"
-               :     "=a" (*eax),
-                 [b] "=m" (*ebx),
-                     "=c" (*ecx),
-                     "=d" (*edx)
-               : "a"  (mode)
-               );
+               : "=a" (*eax),
+                 "=S" (*ebx),
+                 "=c" (*ecx),
+                 "=d" (*edx)
+               : "a"  (mode));
 }
 
 L4_INLINE unsigned int
index 0692e84e3cea9199d3e13283776228cc39a2d912..be184ad133da7377a81a15eea2f4f479a9b517ee 100644 (file)
@@ -1,5 +1,5 @@
 Provides: libc_be_socket_noop libc_be_l4re libc_support_misc
           libc_be_fs_noop libc_be_math libc_be_l4refile
-         libc_be_minimal_log_io libmount libc_be_sig
+         libc_be_minimal_log_io libmount libc_be_sig libc_be_sig_noop
 Requires: l4re libsupc++ libl4re-vfs
 Maintainer: adam@os.inf.tu-dresden.de
index 230a026fb0232463d399571336e926d8eb57236a..0b993e26369852eb5c3b23c3fdafee7305958cc5 100644 (file)
@@ -406,9 +406,22 @@ L4B_REDIRECT_2(int,       lstat64,     const char *, struct stat64 *)
   }
 
 L4B_REDIRECT_1(int, unlink,  const char *)
-L4B_REDIRECT_2(int, rename,  const char *, const char *)
 L4B_REDIRECT_2(int, mkdir,   const char *, mode_t)
 L4B_REDIRECT_1(int, rmdir,   const char *)
+#undef L4B_REDIRECT
+
+#define L4B_REDIRECT(ret, func, ptlist, plist) \
+  extern "C" ret func ptlist L4_NOTHROW                         \
+  {                                                             \
+    cxx::Ref_ptr<L4Re::Vfs::File> dir1;                         \
+    cxx::Ref_ptr<L4Re::Vfs::File> dir2;                         \
+    _a1 = __internal_resolvedir(AT_FDCWD, _a1, 0, 0, &dir1);    \
+    _a2 = __internal_resolvedir(AT_FDCWD, _a2, 0, 0, &dir2);    \
+    ret r = dir1->func plist;     \
+    POST();                                                     \
+  }
+
+L4B_REDIRECT_2(int, rename,  const char *, const char *)
 L4B_REDIRECT_2(int, link,    const char *, const char *)
 L4B_REDIRECT_2(int, symlink, const char *, const char *)
 #undef L4B_REDIRECT
diff --git a/l4/pkg/libc_backends/lib/sig_noop/Makefile b/l4/pkg/libc_backends/lib/sig_noop/Makefile
new file mode 100644 (file)
index 0000000..21e0d93
--- /dev/null
@@ -0,0 +1,9 @@
+PKGDIR  ?= ../..
+L4DIR   ?= $(PKGDIR)/../..
+
+TARGET      = libc_be_sig_noop.a libc_be_sig_noop.so
+PC_FILENAME = libc_be_sig_noop
+SRC_CC      = sig.cc
+CXXFLAGS        = -fno-exceptions
+
+include $(L4DIR)/mk/lib.mk
diff --git a/l4/pkg/libc_backends/lib/sig_noop/sig.cc b/l4/pkg/libc_backends/lib/sig_noop/sig.cc
new file mode 100644 (file)
index 0000000..82b4270
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * NOOP POSIX signal backend
+ * 
+ * (c) 2013 Bjoern Doebel <doebel@os.inf.tu-dresden.de>,
+ *     economic rights: Technische Universität Dresden (Germany)
+ * This file is part of TUD:OS and distributed under the terms of the
+ * GNU Lesser General Public License 2.1.
+ * Please see the COPYING-LGPL-2.1 file for details.
+ */
+
+#include <errno.h>
+#include <signal.h>
+
+extern "C"
+sighandler_t signal(int, sighandler_t) L4_NOTHROW
+{
+  return SIG_ERR;
+}
+
+extern "C"
+int sigaction(int, const struct sigaction *, struct sigaction *) L4_NOTHROW
+{
+  errno = EINVAL;
+  return -1;
+}
+
+extern "C"
+int sigprocmask(int, const sigset_t *, sigset_t *) throw()
+{
+  errno = EINVAL;
+  return -1;
+}
+
+extern "C"
+int sigpending(sigset_t *) throw()
+{
+  errno = EFAULT;
+  return -1;
+}
+
+int sigsuspend(const sigset_t *) throw()
+{
+  errno = EFAULT;
+  return -1;
+}
+
+extern "C"
+int killpg(int, int) throw()
+{
+  errno = EPERM;
+  return -1;
+}
+
index af26370764e457cdf731841c605a604ae71f3879..a81480a4cb460b4336c8cecd4a80b3dd565b9254 100644 (file)
@@ -1,6 +1,6 @@
 provides: libcrypto_aes_linux libcrypto_aes_linux_586
           libcrypto_aes_openssl libcrypto_base64 libcrypto_modes libcrypto_pad
-          libcrypto_rsaref2 libcrypto_sha1_linux libcrypto_sha1_openssl
-          libcrypto_sha1_oslo libcrypto_sha1_ref
+          libcrypto_rsaref2 libcrypto_sha1_linux libcrypto_sha1_linux_new
+          libcrypto_sha1_openssl libcrypto_sha1_oslo libcrypto_sha1_ref
 requires: libc log l4util stdlibs
 Maintainer: weinhold@os.inf.tu-dresden.de
index a96dd0d608da0e6f46432eec6fdc4dfbae2bfa3d..97e37c095f1a2d1a5f90b0f2a0c815cf38e6b6f9 100644 (file)
@@ -10,7 +10,7 @@ SYSTEMS               = x86-l4f
 # list additional library paths and libraries here
 LIBS           = -lcrypto_pad -lcrypto_rsaref2 -lcrypto_modes
 LIBS_crypto_test_ref     = -lcrypto_sha1_ref -lcrypto_aes_linux_586.o
-LIBS_crypto_test_linux   = -lcrypto_sha1_linux -lcrypto_aes_linux.o
+LIBS_crypto_test_linux   = -lcrypto_sha1_linux_new -lcrypto_aes_linux.o
 LIBS_crypto_test_oslo    = -lcrypto_sha1_oslo -lcrypto_aes_linux.o
 LIBS_crypto_test_openssl = -lcrypto_sha1_openssl -lcrypto_aes_openssl
 
index 53f21fbb8dd5374ebf7c5e78058adc017d67f066..44309a202c9406c6967500fd9bb880c2dcc4df4b 100644 (file)
@@ -24,6 +24,16 @@ typedef uint16_t u16;
 typedef uint32_t u32;
 typedef uint64_t u64;
 
+typedef uint8_t  __u8;
+typedef uint16_t __u16;
+typedef uint32_t __u32;
+typedef uint64_t __u64;
+
+typedef __u32 __be32;
+typedef __u64 __be64;
+
+#define EXPORT_SYMBOL(x)
+
 #ifdef __LIBCRYPTO_INTERNAL__
 
 #define __u32 u32
@@ -52,7 +62,20 @@ typedef uint64_t u64;
                 (((__u32)(__x) & (__u32)0xff000000UL) >> 24) )); \
 })
 
+#define ___swab64(x) ((__u64)(                         \
+       (((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) |   \
+       (((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) |   \
+       (((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) |   \
+       (((__u64)(x) & (__u64)0x00000000ff000000ULL) <<  8) |   \
+       (((__u64)(x) & (__u64)0x000000ff00000000ULL) >>  8) |   \
+       (((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) |   \
+       (((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) |   \
+       (((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56)))
+
 #define be32_to_cpu(x) ___swab32(x)
+#define be64_to_cpu(x) ___swab64(x)
+#define cpu_to_be32(x) ___swab32(x)
+#define cpu_to_be64(x) ___swab64(x)
 
 /* ************************************************************** */
 
@@ -71,6 +94,41 @@ typedef uint64_t u64;
 #define EINVAL -1
 #endif
 
+/* ************************************************************** */
+
+/* BEGIN: copied from Linux 3.3.0 sources (GPLv2) */
+
+/**
+ * rol32 - rotate a 32-bit value left
+ * @word: value to rotate
+ * @shift: bits to roll
+ */
+static inline __u32 rol32(__u32 word, unsigned int shift)
+{
+       return (word << shift) | (word >> (32 - shift));
+}
+
+/**
+ * ror32 - rotate a 32-bit value right
+ * @word: value to rotate
+ * @shift: bits to roll
+ */
+static inline __u32 ror32(__u32 word, unsigned int shift)
+{
+       return (word >> shift) | (word << (32 - shift));
+}
+
+static inline u32 __get_unaligned_be32(const u8 *p)
+{
+       return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
+}
+static inline u32 get_unaligned_be32(const u32 *p)
+{
+    return __get_unaligned_be32((const u8 *)p);
+}
+
+/* END: copied from Linux 3.3.0 sources (GPLv2) */
+
 #endif /* __LIBCRYPTO_INTERNAL__ */
 
 #endif /* __TFS_LINUX_H */
index f3a183eeead1f718fead0443eddec0af5a092dc5..03f0b7c6f898ef5d43b6258dd85c31a7dc912a0d 100644 (file)
@@ -4,7 +4,7 @@
  * \author  Carsten Weinhold <weinhold@os.inf.tu-dresden.de>
  */
 /*
- * Copyright (C) 2006  Carsten Weinhold <weinhold@os.inf.tu-dresden.de>
+ * Copyright (C) 2006-2012  Carsten Weinhold <weinhold@os.inf.tu-dresden.de>
  * Technische Universitaet Dresden, Operating Systems Research Group
  *
  * This file is part of the libcrypto package, which is distributed under
 
 #include "linux.h"
 
+/* all code below has been copied from Linux 3.3.0 sources (GPLv2) */
+
+#define SHA1_DIGEST_SIZE        20
+#define SHA1_BLOCK_SIZE         64
+
+#define SHA224_DIGEST_SIZE     28
+#define SHA224_BLOCK_SIZE      64
+
+#define SHA256_DIGEST_SIZE      32
+#define SHA256_BLOCK_SIZE       64
+
+#define SHA384_DIGEST_SIZE      48
+#define SHA384_BLOCK_SIZE       128
+
+#define SHA512_DIGEST_SIZE      64
+#define SHA512_BLOCK_SIZE       128
+
+#define SHA1_H0                0x67452301UL
+#define SHA1_H1                0xefcdab89UL
+#define SHA1_H2                0x98badcfeUL
+#define SHA1_H3                0x10325476UL
+#define SHA1_H4                0xc3d2e1f0UL
+
 struct sha1_ctx {
-        u64 count;
-        u32 state[5];
-        u8 buffer[64];
+       u64 count;
+       u32 state[SHA1_DIGEST_SIZE / 4];
+       u8 buffer[SHA1_BLOCK_SIZE];
+};
+
+struct sha1_state {
+       u64 count;
+       u32 state[SHA1_DIGEST_SIZE / 4];
+       u8 buffer[SHA1_BLOCK_SIZE];
+};
+
+#define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(16)))
+
+struct hash_tfm {
+#if 0
+       int (*init)(struct hash_desc *desc);
+       int (*update)(struct hash_desc *desc,
+                     struct scatterlist *sg, unsigned int nsg);
+       int (*final)(struct hash_desc *desc, u8 *out);
+       int (*digest)(struct hash_desc *desc, struct scatterlist *sg,
+                     unsigned int nsg, u8 *out);
+       int (*setkey)(struct crypto_hash *tfm, const u8 *key,
+                     unsigned int keylen);
+       unsigned int digestsize;
+#endif
 };
 
+struct crypto_alg;
+
+struct crypto_tfm {
+
+       u32 crt_flags;
+       
+       union {
+               //struct ablkcipher_tfm ablkcipher;
+               //struct aead_tfm aead;
+               //struct blkcipher_tfm blkcipher;
+               //struct cipher_tfm cipher;
+               struct hash_tfm hash;
+               //struct compress_tfm compress;
+               //struct rng_tfm rng;
+       } crt_u;
+
+       void (*exit)(struct crypto_tfm *tfm);
+       
+       struct crypto_alg *__crt_alg;
+
+       void *__crt_ctx[] CRYPTO_MINALIGN_ATTR;
+};
+
+struct crypto_shash {
+       unsigned int descsize;
+       struct crypto_tfm base;
+};
+
+struct shash_desc {
+       struct crypto_shash *tfm;
+       u32 flags;
+
+       void *__ctx[] CRYPTO_MINALIGN_ATTR;
+};
+
+static inline void *shash_desc_ctx(struct shash_desc *desc)
+{
+       return desc->__ctx;
+}
+
 #endif /* __CRYPTO_SHA1_LINUX_H */
 
index 83a1ae8cbf4221d2a76996c416de7e12025f989f..1cc4488efdfee6364593a20cde87acd1f717fb29 100644 (file)
@@ -42,10 +42,11 @@ EXTERN_C_BEGIN
 
 typedef union
 {
-    SHA1Context     __sha1_ref_ctx;
-    struct sha1_ctx __sha1_linux_ctx;    
-    struct Context  __sha1_oslo_ctx;
-    SHA_CTX         __sha1_openssl;
+    SHA1Context       __sha1_ref_ctx;
+    struct sha1_ctx   __sha1_linux_ctx;    
+    struct shash_desc __sha1_linux_new_ctx;
+    struct Context    __sha1_oslo_ctx;
+    SHA_CTX           __sha1_openssl;
 } crypto_sha1_ctx_t;
 
 typedef char crypto_sha1_digest_t[SHA1_DIGEST_SIZE];
index 19b5cc2eb60c2af40f57f960692622140ab7dbaa..5d86487bab42fc7dc14d81ebde92bfc4a6070d36 100644 (file)
@@ -6,6 +6,6 @@ L4DIR   ?= $(PKGDIR)/../..
 # line and adapt it.
 TARGET = aes_linux aes_linux_586 aes_openssl \
         sha1_linux sha1_ref sha1_oslo sha1_openssl \
-        base64 modes pad rsaref2
+        sha1_linux_new base64 modes pad rsaref2
 
 include $(L4DIR)/mk/subdir.mk
diff --git a/l4/pkg/libcrypto/lib/sha1_linux_new/Makefile b/l4/pkg/libcrypto/lib/sha1_linux_new/Makefile
new file mode 100644 (file)
index 0000000..ad82d96
--- /dev/null
@@ -0,0 +1,13 @@
+PKGDIR?= ../..
+L4DIR ?= $(PKGDIR)/../..
+
+# the name of your library
+TARGET = $(PKGNAME)_sha1_linux_new.a
+BUILD_PIC = $(TARGET)
+SYSTEMS = x86 arm amd64
+PC_FILENAME = $(PKGNAME)_sha1_linux_new
+
+# list your .c files here
+SRC_C  = sha1.c sha1_generic.c
+
+include $(L4DIR)/mk/lib.mk
diff --git a/l4/pkg/libcrypto/lib/sha1_linux_new/cryptohash.h b/l4/pkg/libcrypto/lib/sha1_linux_new/cryptohash.h
new file mode 100644 (file)
index 0000000..2cd9f1c
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef __CRYPTOHASH_H
+#define __CRYPTOHASH_H
+
+#define SHA_DIGEST_WORDS 5
+#define SHA_MESSAGE_BYTES (512 /*bits*/ / 8)
+#define SHA_WORKSPACE_WORDS 16
+
+void sha_init(__u32 *buf);
+void sha_transform(__u32 *digest, const char *data, __u32 *W);
+
+#define MD5_DIGEST_WORDS 4
+#define MD5_MESSAGE_BYTES 64
+
+void md5_transform(__u32 *hash, __u32 const *in);
+
+__u32 half_md4_transform(__u32 buf[4], __u32 const in[8]);
+
+#endif
diff --git a/l4/pkg/libcrypto/lib/sha1_linux_new/extra.h b/l4/pkg/libcrypto/lib/sha1_linux_new/extra.h
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/l4/pkg/libcrypto/lib/sha1_linux_new/sha1.c b/l4/pkg/libcrypto/lib/sha1_linux_new/sha1.c
new file mode 100644 (file)
index 0000000..4926a17
--- /dev/null
@@ -0,0 +1,212 @@
+/*
+ * SHA1 routine optimized to do word accesses rather than byte accesses,
+ * and to avoid unnecessary copies into the context array.
+ *
+ * This was based on the git SHA1 implementation.
+ */
+
+#define BUILD_FOR_L4 1
+#ifndef BUILD_FOR_L4
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/bitops.h>
+#include <linux/cryptohash.h>
+#include <asm/unaligned.h>
+
+#else
+
+#define __LIBCRYPTO_INTERNAL__
+#include <l4/crypto/private/sha1_linux.h>
+#include "cryptohash.h"
+#define CONFIG_X86 1
+
+#endif
+
+/*
+ * If you have 32 registers or more, the compiler can (and should)
+ * try to change the array[] accesses into registers. However, on
+ * machines with less than ~25 registers, that won't really work,
+ * and at least gcc will make an unholy mess of it.
+ *
+ * So to avoid that mess which just slows things down, we force
+ * the stores to memory to actually happen (we might be better off
+ * with a 'W(t)=(val);asm("":"+m" (W(t))' there instead, as
+ * suggested by Artur Skawina - that will also make gcc unable to
+ * try to do the silly "optimize away loads" part because it won't
+ * see what the value will be).
+ *
+ * Ben Herrenschmidt reports that on PPC, the C version comes close
+ * to the optimized asm with this (ie on PPC you don't want that
+ * 'volatile', since there are lots of registers).
+ *
+ * On ARM we get the best code generation by forcing a full memory barrier
+ * between each SHA_ROUND, otherwise gcc happily get wild with spilling and
+ * the stack frame size simply explode and performance goes down the drain.
+ */
+
+#ifdef CONFIG_X86
+  #define setW(x, val) (*(volatile __u32 *)&W(x) = (val))
+#elif defined(CONFIG_ARM)
+  #define setW(x, val) do { W(x) = (val); __asm__("":::"memory"); } while (0)
+#else
+  #define setW(x, val) (W(x) = (val))
+#endif
+
+/* This "rolls" over the 512-bit array */
+#define W(x) (array[(x)&15])
+
+/*
+ * Where do we get the source from? The first 16 iterations get it from
+ * the input data, the next mix it from the 512-bit array.
+ */
+#define SHA_SRC(t) get_unaligned_be32((__u32 *)data + t)
+#define SHA_MIX(t) rol32(W(t+13) ^ W(t+8) ^ W(t+2) ^ W(t), 1)
+
+#define SHA_ROUND(t, input, fn, constant, A, B, C, D, E) do { \
+       __u32 TEMP = input(t); setW(t, TEMP); \
+       E += TEMP + rol32(A,5) + (fn) + (constant); \
+       B = ror32(B, 2); } while (0)
+
+#define T_0_15(t, A, B, C, D, E)  SHA_ROUND(t, SHA_SRC, (((C^D)&B)^D) , 0x5a827999, A, B, C, D, E )
+#define T_16_19(t, A, B, C, D, E) SHA_ROUND(t, SHA_MIX, (((C^D)&B)^D) , 0x5a827999, A, B, C, D, E )
+#define T_20_39(t, A, B, C, D, E) SHA_ROUND(t, SHA_MIX, (B^C^D) , 0x6ed9eba1, A, B, C, D, E )
+#define T_40_59(t, A, B, C, D, E) SHA_ROUND(t, SHA_MIX, ((B&C)+(D&(B^C))) , 0x8f1bbcdc, A, B, C, D, E )
+#define T_60_79(t, A, B, C, D, E) SHA_ROUND(t, SHA_MIX, (B^C^D) ,  0xca62c1d6, A, B, C, D, E )
+
+/**
+ * sha_transform - single block SHA1 transform
+ *
+ * @digest: 160 bit digest to update
+ * @data:   512 bits of data to hash
+ * @array:  16 words of workspace (see note)
+ *
+ * This function generates a SHA1 digest for a single 512-bit block.
+ * Be warned, it does not handle padding and message digest, do not
+ * confuse it with the full FIPS 180-1 digest algorithm for variable
+ * length messages.
+ *
+ * Note: If the hash is security sensitive, the caller should be sure
+ * to clear the workspace. This is left to the caller to avoid
+ * unnecessary clears between chained hashing operations.
+ */
+void sha_transform(__u32 *digest, const char *data, __u32 *array)
+{
+       __u32 A, B, C, D, E;
+
+       A = digest[0];
+       B = digest[1];
+       C = digest[2];
+       D = digest[3];
+       E = digest[4];
+
+       /* Round 1 - iterations 0-16 take their input from 'data' */
+       T_0_15( 0, A, B, C, D, E);
+       T_0_15( 1, E, A, B, C, D);
+       T_0_15( 2, D, E, A, B, C);
+       T_0_15( 3, C, D, E, A, B);
+       T_0_15( 4, B, C, D, E, A);
+       T_0_15( 5, A, B, C, D, E);
+       T_0_15( 6, E, A, B, C, D);
+       T_0_15( 7, D, E, A, B, C);
+       T_0_15( 8, C, D, E, A, B);
+       T_0_15( 9, B, C, D, E, A);
+       T_0_15(10, A, B, C, D, E);
+       T_0_15(11, E, A, B, C, D);
+       T_0_15(12, D, E, A, B, C);
+       T_0_15(13, C, D, E, A, B);
+       T_0_15(14, B, C, D, E, A);
+       T_0_15(15, A, B, C, D, E);
+
+       /* Round 1 - tail. Input from 512-bit mixing array */
+       T_16_19(16, E, A, B, C, D);
+       T_16_19(17, D, E, A, B, C);
+       T_16_19(18, C, D, E, A, B);
+       T_16_19(19, B, C, D, E, A);
+
+       /* Round 2 */
+       T_20_39(20, A, B, C, D, E);
+       T_20_39(21, E, A, B, C, D);
+       T_20_39(22, D, E, A, B, C);
+       T_20_39(23, C, D, E, A, B);
+       T_20_39(24, B, C, D, E, A);
+       T_20_39(25, A, B, C, D, E);
+       T_20_39(26, E, A, B, C, D);
+       T_20_39(27, D, E, A, B, C);
+       T_20_39(28, C, D, E, A, B);
+       T_20_39(29, B, C, D, E, A);
+       T_20_39(30, A, B, C, D, E);
+       T_20_39(31, E, A, B, C, D);
+       T_20_39(32, D, E, A, B, C);
+       T_20_39(33, C, D, E, A, B);
+       T_20_39(34, B, C, D, E, A);
+       T_20_39(35, A, B, C, D, E);
+       T_20_39(36, E, A, B, C, D);
+       T_20_39(37, D, E, A, B, C);
+       T_20_39(38, C, D, E, A, B);
+       T_20_39(39, B, C, D, E, A);
+
+       /* Round 3 */
+       T_40_59(40, A, B, C, D, E);
+       T_40_59(41, E, A, B, C, D);
+       T_40_59(42, D, E, A, B, C);
+       T_40_59(43, C, D, E, A, B);
+       T_40_59(44, B, C, D, E, A);
+       T_40_59(45, A, B, C, D, E);
+       T_40_59(46, E, A, B, C, D);
+       T_40_59(47, D, E, A, B, C);
+       T_40_59(48, C, D, E, A, B);
+       T_40_59(49, B, C, D, E, A);
+       T_40_59(50, A, B, C, D, E);
+       T_40_59(51, E, A, B, C, D);
+       T_40_59(52, D, E, A, B, C);
+       T_40_59(53, C, D, E, A, B);
+       T_40_59(54, B, C, D, E, A);
+       T_40_59(55, A, B, C, D, E);
+       T_40_59(56, E, A, B, C, D);
+       T_40_59(57, D, E, A, B, C);
+       T_40_59(58, C, D, E, A, B);
+       T_40_59(59, B, C, D, E, A);
+
+       /* Round 4 */
+       T_60_79(60, A, B, C, D, E);
+       T_60_79(61, E, A, B, C, D);
+       T_60_79(62, D, E, A, B, C);
+       T_60_79(63, C, D, E, A, B);
+       T_60_79(64, B, C, D, E, A);
+       T_60_79(65, A, B, C, D, E);
+       T_60_79(66, E, A, B, C, D);
+       T_60_79(67, D, E, A, B, C);
+       T_60_79(68, C, D, E, A, B);
+       T_60_79(69, B, C, D, E, A);
+       T_60_79(70, A, B, C, D, E);
+       T_60_79(71, E, A, B, C, D);
+       T_60_79(72, D, E, A, B, C);
+       T_60_79(73, C, D, E, A, B);
+       T_60_79(74, B, C, D, E, A);
+       T_60_79(75, A, B, C, D, E);
+       T_60_79(76, E, A, B, C, D);
+       T_60_79(77, D, E, A, B, C);
+       T_60_79(78, C, D, E, A, B);
+       T_60_79(79, B, C, D, E, A);
+
+       digest[0] += A;
+       digest[1] += B;
+       digest[2] += C;
+       digest[3] += D;
+       digest[4] += E;
+}
+EXPORT_SYMBOL(sha_transform);
+
+/**
+ * sha_init - initialize the vectors for a SHA1 digest
+ * @buf: vector to initialize
+ */
+void sha_init(__u32 *buf)
+{
+       buf[0] = 0x67452301;
+       buf[1] = 0xefcdab89;
+       buf[2] = 0x98badcfe;
+       buf[3] = 0x10325476;
+       buf[4] = 0xc3d2e1f0;
+}
diff --git a/l4/pkg/libcrypto/lib/sha1_linux_new/sha1_generic.c b/l4/pkg/libcrypto/lib/sha1_linux_new/sha1_generic.c
new file mode 100644 (file)
index 0000000..f4ab79c
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+ * Cryptographic API.
+ *
+ * SHA1 Secure Hash Algorithm.
+ *
+ * Derived from cryptoapi implementation, adapted for in-place
+ * scatterlist interface.
+ *
+ * Copyright (c) Alan Smithee.
+ * Copyright (c) Andrew McDonald <andrew@mcdonald.org.uk>
+ * Copyright (c) Jean-Francois Dive <jef@linuxbe.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ */
+#define BUILD_FOR_L4 1
+#ifndef BUILD_FOR_L4
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/mm.h>
+#include <linux/cryptohash.h>
+#include <linux/types.h>
+#include <crypto/sha.h>
+#include <asm/byteorder.h>
+
+#else
+
+#include <string.h>
+
+#define __LIBCRYPTO_INTERNAL__
+#include <l4/crypto/sha1.h>
+//#include "crypto/internal/hash.h"
+#include "cryptohash.h"
+
+#endif
+
+static int sha1_init(struct shash_desc *desc)
+{
+       struct sha1_state *sctx = shash_desc_ctx(desc);
+
+       *sctx = (struct sha1_state){
+               .state = { SHA1_H0, SHA1_H1, SHA1_H2, SHA1_H3, SHA1_H4 },
+       };
+
+       return 0;
+}
+
+static int sha1_update(struct shash_desc *desc, const u8 *data,
+                       unsigned int len)
+{
+       struct sha1_state *sctx = shash_desc_ctx(desc);
+       unsigned int partial, done;
+       const u8 *src;
+
+       partial = sctx->count % SHA1_BLOCK_SIZE;
+       sctx->count += len;
+       done = 0;
+       src = data;
+
+       if ((partial + len) >= SHA1_BLOCK_SIZE) {
+               u32 temp[SHA_WORKSPACE_WORDS];
+
+               if (partial) {
+                       done = -partial;
+                       memcpy(sctx->buffer + partial, data,
+                              done + SHA1_BLOCK_SIZE);
+                       src = sctx->buffer;
+               }
+
+               do {
+                       sha_transform(sctx->state, (const char *)src, temp);
+                       done += SHA1_BLOCK_SIZE;
+                       src = data + done;
+               } while (done + SHA1_BLOCK_SIZE <= len);
+
+               memset(temp, 0, sizeof(temp));
+               partial = 0;
+       }
+       memcpy(sctx->buffer + partial, src, len - done);
+
+       return 0;
+}
+EXPORT_SYMBOL(crypto_sha1_update);
+
+
+/* Add padding and return the message digest. */
+static int sha1_final(struct shash_desc *desc, u8 *out)
+{
+       struct sha1_state *sctx = shash_desc_ctx(desc);
+       __be32 *dst = (__be32 *)out;
+       u32 i, index, padlen;
+       __be64 bits;
+       static const u8 padding[64] = { 0x80, };
+
+       bits = cpu_to_be64(sctx->count << 3);
+
+       /* Pad out to 56 mod 64 */
+       index = sctx->count & 0x3f;
+       padlen = (index < 56) ? (56 - index) : ((64+56) - index);
+       sha1_update(desc, padding, padlen);
+
+       /* Append length */
+       sha1_update(desc, (const u8 *)&bits, sizeof(bits));
+
+       /* Store state in digest */
+       for (i = 0; i < 5; i++)
+               dst[i] = cpu_to_be32(sctx->state[i]);
+
+       /* Wipe context */
+       memset(sctx, 0, sizeof *sctx);
+
+       return 0;
+}
+
+#ifndef BUILD_FOR_L4
+
+static int sha1_export(struct shash_desc *desc, void *out)
+{
+       struct sha1_state *sctx = shash_desc_ctx(desc);
+
+       memcpy(out, sctx, sizeof(*sctx));
+       return 0;
+}
+
+static int sha1_import(struct shash_desc *desc, const void *in)
+{
+       struct sha1_state *sctx = shash_desc_ctx(desc);
+
+       memcpy(sctx, in, sizeof(*sctx));
+       return 0;
+}
+
+static struct shash_alg alg = {
+       .digestsize     =       SHA1_DIGEST_SIZE,
+       .init           =       sha1_init,
+       .update         =       crypto_sha1_update,
+       .final          =       sha1_final,
+       .export         =       sha1_export,
+       .import         =       sha1_import,
+       .descsize       =       sizeof(struct sha1_state),
+       .statesize      =       sizeof(struct sha1_state),
+       .base           =       {
+               .cra_name       =       "sha1",
+               .cra_driver_name=       "sha1-generic",
+               .cra_flags      =       CRYPTO_ALG_TYPE_SHASH,
+               .cra_blocksize  =       SHA1_BLOCK_SIZE,
+               .cra_module     =       THIS_MODULE,
+       }
+};
+
+static int __init sha1_generic_mod_init(void)
+{
+       return crypto_register_shash(&alg);
+}
+
+static void __exit sha1_generic_mod_fini(void)
+{
+       crypto_unregister_shash(&alg);
+}
+
+module_init(sha1_generic_mod_init);
+module_exit(sha1_generic_mod_fini);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm");
+
+MODULE_ALIAS("sha1");
+
+#else
+
+crypto_digest_setup_fn_t  sha1_digest_setup  = (crypto_digest_setup_fn_t)  sha1_init;
+crypto_digest_update_fn_t sha1_digest_update = (crypto_digest_update_fn_t) sha1_update;
+crypto_digest_final_fn_t  sha1_digest_final  = (crypto_digest_final_fn_t)  sha1_final;
+
+#endif /* BUILD_FOR_L4 */
index 772f1e0ebb17eac55d1163d41fdd7d329ddddf2d..02dd2210e9658048bdad247d16255b43557f6d0c 100644 (file)
@@ -2,7 +2,6 @@ PKGDIR          ?= ../..
 L4DIR           ?= $(PKGDIR)/../..
 
 TARGET          = libl4png.a libl4png.so
-#LIBS            = $(GCCLIB)
 REQUIRES_LIBS   = zlib
 CONTRIB_INCDIR  = libpng
 
index ecd6cb52b82f100cd8b39b5b574c1f8222597daa..045991dd1f802125e1b65d95e6814ef6f84b05a2 100644 (file)
@@ -72,6 +72,25 @@ struct lx_iovec {
 
 typedef signed int lx_pid_t;
 
+/* see asm-generic/statfs.h */
+typedef struct {
+       int val[2];
+} lx__kernel_fsid_t;
+
+struct lx_statfs {
+       unsigned long f_type;
+       unsigned long f_bsize;
+       unsigned long f_blocks;
+       unsigned long f_bfree;
+       unsigned long f_bavail;
+       unsigned long f_files;
+       unsigned long f_ffree;
+       lx__kernel_fsid_t f_fsid;
+       unsigned long f_namelen;
+       unsigned long f_frsize;
+       unsigned long f_spare[5];
+};
+
 /* see asm/stat.h */
 struct lx_stat {
         unsigned long  st_dev;
@@ -235,14 +254,17 @@ struct lx_sockaddr_un {
 /*  42 */ extern int           lx_pipe(int filesdes[2]);
 /*  54 */ extern long          lx_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg);
 /*  78 */ extern long          lx_gettimeofday(struct lx_timeval *tv, struct lx_timezone *tz);
+/*  81 */ extern void          lx_sync(void);
 /*  82 */ extern int           lx_select(int n, lx_fd_set *readfds, lx_fd_set *writefds, lx_fd_set *exceptfds, struct lx_timeval *timeout);
 /*  93 */ extern int           lx_ftruncate(int fd, unsigned long ofs);
+/*  93 */ extern int           lx_statfs(const char *path, struct lx_statfs *buf);
 /* 102 */ extern int           lx_socketcall(int call, unsigned long *args);
 /* 106 */ extern int           lx_stat(const char *filename, struct lx_stat *buf);
 /* 107 */ extern int           lx_lstat(const char *filename, struct lx_stat *buf);
 /* 108 */ extern int           lx_fstat(int filedes, struct lx_stat *buf);
 /* 117 */ extern int           lx_ipc(unsigned int call, int first, int second, int third, const void *ptr, long fifth);
 /* 118 */ extern int           lx_fsync(int fd);
+/* 140 */ extern long long     lx_lseek64(int fd, unsigned long long offset, int origin);
 /* 145 */ extern lx_ssize_t    lx_readv(int fd, const struct lx_iovec *iov, int cnt);
 /* 146 */ extern lx_ssize_t    lx_writev(int fd, const struct lx_iovec *iov, int cnt);
 /* 148 */ extern int           lx_fdatasync(int fd);
index 7408a35083263025890242c92192bb37f96b2c55..0595a74298b2b09477d60f76a456b213bf26764c 100644 (file)
 #define __NR_pipe              42
 #define __NR_ioctl             54
 #define __NR_gettimeofday      78
+#define __NR_sync              81
 #define __NR_ftruncate         93
+#define __NR_statfs            99
 #define __NR_socketcall                102
 #define __NR_stat              106
 #define __NR_lstat             107
 #define __NR_fstat             108
 #define __NR_ipc               117
 #define __NR_fsync             118
+#define __NR___lx_priv__llseek 140
 #define __NR_select            142 /* new select */
 #define __NR_readv             145
 #define __NR_writev            146
@@ -200,9 +203,11 @@ __lx_syscall2(int, mkdir, const char *, filename, int, mode)
 __lx_syscall1(int, rmdir, const char *, filename)
 __lx_syscall1(int, pipe, int *, filedes)
 __lx_syscall3(long, ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
+__lx_syscall0(void, sync)
 __lx_syscall2(long, gettimeofday, struct lx_timeval *, tv, struct lx_timezone *, tz)
 __lx_syscall5(int, select, int, n, lx_fd_set *, readfds, lx_fd_set *, writefds, lx_fd_set *, exceptfds, struct lx_timeval *, timeout)
 __lx_syscall2(int, ftruncate, int, fd, unsigned long, ofs)
+__lx_syscall2(int, statfs, const char *, path, struct lx_statfs *, buf)
 __lx_syscall2(int, socketcall, int, call, unsigned long *, args);
 __lx_syscall2(int, stat, const char *, filename, struct lx_stat *, buf)
 __lx_syscall2(int, lstat, const char *, filename, struct lx_stat *, buf)
@@ -216,6 +221,8 @@ __lx_syscall3(int, poll, struct lx_pollfd *, fds, lx_nfds_t, nfds, int, timeout)
 #ifdef __i386__
 int lx___lx_priv_ftruncate64(int, unsigned long, unsigned long);
 __lx_syscall3(int, __lx_priv_ftruncate64, int, fd, unsigned long, high_length, unsigned long, low_length);
+int lx___lx_priv__llseek(int, unsigned long, unsigned long, long long *, int);
+__lx_syscall5(int, __lx_priv__llseek, int, fd, unsigned long, high_length, unsigned long, low_length, long long *, result, int, whence);
 #else
 __lx_syscall2(int, ftruncate64, int, fd, unsigned long, length);
 #endif
@@ -237,6 +244,14 @@ int lx_ftruncate64(int fd, unsigned long long length)
 {
   return lx___lx_priv_ftruncate64(fd, length << 32, length);
 }
+
+long long lx_lseek64(int, unsigned long long, int);
+long long lx_lseek64(int fd, unsigned long long offset, int whence)
+{
+  long long result;
+  int err = lx___lx_priv__llseek(fd, offset >> 32, offset & 0xffffffff, &result, whence);
+  return (err) ? err : result;
+}
 #endif
 
 /* ========================================================================
index 7d206fe265252d65a8b00921c041b87408117495..66259a5eed06487f818064c48e02f43b2bc4b696 100644 (file)
@@ -90,7 +90,7 @@ void Allocator::operator delete (void *m) throw()
 }
 
 Moe::Dataspace *
-Allocator::alloc(unsigned long size, unsigned long flags)
+Allocator::alloc(unsigned long size, unsigned long flags, unsigned long align)
 {
   if (size == 0)
     throw L4::Bounds_error("stack too small");
@@ -99,9 +99,14 @@ Allocator::alloc(unsigned long size, unsigned long flags)
   Moe::Dataspace *mo;
   if (flags & L4Re::Mem_alloc::Continuous
       || flags & L4Re::Mem_alloc::Pinned)
-    mo = new (&_quota) Moe::Dataspace_annon(size, true,
-       flags & L4Re::Mem_alloc::Super_pages
-         ? L4_SUPERPAGESHIFT : L4_PAGESHIFT);
+    {
+      if (flags & L4Re::Mem_alloc::Super_pages)
+        align = cxx::max<unsigned long>(align, L4_SUPERPAGESHIFT);
+      else
+        align = cxx::max<unsigned long>(align, L4_PAGESHIFT);
+
+      mo = new (&_quota) Moe::Dataspace_annon(size, true, align);
+    }
   else
     mo = Moe::Dataspace_noncont::create(&_quota, size);
 
@@ -258,15 +263,16 @@ Allocator::disp_factory(l4_umword_t r, L4::Ipc::Iostream &ios)
        }
     case L4Re::Dataspace::Protocol:
        {
-         L4::Ipc::Varg size, flags;
-         ios >> size >> flags;
+         L4::Ipc::Varg size, flags, align;
+         ios >> size >> flags >> align;
 
          if (!size.is_of_int())
            return -L4_EINVAL;
 
          // L4::cout << "MEM: alloc ... " << size.value<l4_umword_t>() << "; " << flags.value<l4_umword_t>() << "\n";
          cxx::Auto_ptr<Moe::Dataspace> mo(alloc(size.value<l4_umword_t>(),
-               flags.is_of_int() ? flags.value<l4_umword_t>() : 0));
+               flags.is_of_int() ? flags.value<l4_umword_t>() : 0,
+                align.is_of_int() ? align.value<l4_umword_t>() : 0));
 
          // L4::cout << "MO=" << mo.get() << "\n";
          ko = object_pool.cap_alloc()->alloc(mo.get());
@@ -312,6 +318,7 @@ Allocator::dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios)
              unsigned long flags;
              ios >> size >> flags;
 
+              printf("MOE: WARNING: Using deprecated interface L4Re::Mem_alloc_::Alloc\n");
              //L4::cout << "MEM: alloc ... " << size << "; " << flags << "\n";
               cxx::Auto_ptr<Moe::Dataspace> mo(alloc(size,flags));
 
index 8b6a59ffba47b8f6aa0358781426c6dc3ec5c252..854ba2db92540a3f54f9a8393a27cf98f1080abe 100644 (file)
@@ -33,7 +33,8 @@ public:
 
   Moe::Quota *quota() { return &_quota; }
 
-  Moe::Dataspace *alloc(unsigned long size, unsigned long flags = 0);
+  Moe::Dataspace *alloc(unsigned long size, unsigned long flags = 0,
+                        unsigned long align = 0);
 
   virtual ~Allocator();
 
index 6b9d539be08f1b8b05b3fc4a33256d06faf50b75..dbcee742996178ccc719d8432c291af7460c6dd2 100644 (file)
@@ -1,7 +1,7 @@
 
 
 The contrib directory contains the nearly unmodified contents of
-sqlite-autoconf-3071601.tar.gz
+sqlite-autoconf-3071602.tar.gz
 
 The current change is to undef HAVE_POSIX_FALLOCATE in case of uclibc
 because uclibc does not have it.
index 48205bbca479d6ceba9d86ca55ae4b429a2e995f..568b9b8cfadfee893b47b8a3d2f587b80df5a85a 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for sqlite 3.7.16.1.
+# Generated by GNU Autoconf 2.69 for sqlite 3.7.16.2.
 #
 # Report bugs to <http://www.sqlite.org>.
 #
@@ -734,8 +734,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='sqlite'
 PACKAGE_TARNAME='sqlite'
-PACKAGE_VERSION='3.7.16.1'
-PACKAGE_STRING='sqlite 3.7.16.1'
+PACKAGE_VERSION='3.7.16.2'
+PACKAGE_STRING='sqlite 3.7.16.2'
 PACKAGE_BUGREPORT='http://www.sqlite.org'
 PACKAGE_URL=''
 
@@ -1455,7 +1455,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures sqlite 3.7.16.1 to adapt to many kinds of systems.
+\`configure' configures sqlite 3.7.16.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1525,7 +1525,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of sqlite 3.7.16.1:";;
+     short | recursive ) echo "Configuration of sqlite 3.7.16.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1635,7 +1635,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-sqlite configure 3.7.16.1
+sqlite configure 3.7.16.2
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2255,7 +2255,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by sqlite $as_me 3.7.16.1, which was
+It was created by sqlite $as_me 3.7.16.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2924,7 +2924,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='sqlite'
- VERSION='3.7.16.1'
+ VERSION='3.7.16.2'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -20493,7 +20493,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by sqlite $as_me 3.7.16.1, which was
+This file was extended by sqlite $as_me 3.7.16.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -20550,7 +20550,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-sqlite config.status 3.7.16.1
+sqlite config.status 3.7.16.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
index 9560f914750402017f621098cc030edf26f73c8d..9980d4edbf913b78cfe294713223acfa74a97a80 100644 (file)
@@ -8,7 +8,7 @@
 #
 
 AC_PREREQ(2.61)
-AC_INIT(sqlite, 3.7.16.1, http://www.sqlite.org)
+AC_INIT(sqlite, 3.7.16.2, http://www.sqlite.org)
 AC_CONFIG_SRCDIR([sqlite3.c])
 
 # Use automake.
index 7b957a8aa74f9e2e1c898180515a5112b7927b30..ca12d7e0a25851aa93bbb72b7c26bc4833f16469 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
 ** This file is an amalgamation of many separate C source files from SQLite
-** version 3.7.16.1.  By combining all the individual C code files into this 
+** version 3.7.16.2.  By combining all the individual C code files into this 
 ** single large file, the entire code can be compiled as a single translation
 ** unit.  This allows many compilers to do optimizations that would not be
 ** possible if the files were compiled separately.  Performance improvements
@@ -678,9 +678,9 @@ extern "C" {
 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
 ** [sqlite_version()] and [sqlite_source_id()].
 */
-#define SQLITE_VERSION        "3.7.16.1"
+#define SQLITE_VERSION        "3.7.16.2"
 #define SQLITE_VERSION_NUMBER 3007016
-#define SQLITE_SOURCE_ID      "2013-03-29 13:44:34 527231bc67285f01fb18d4451b28f61da3c4e39d"
+#define SQLITE_SOURCE_ID      "2013-04-12 11:52:43 cbea02d93865ce0e06789db95fd9168ebac970c7"
 
 /*
 ** CAPI3REF: Run-Time Library Version Numbers
@@ -32796,7 +32796,7 @@ static int winCheckReservedLock(sqlite3_file *id, int *pResOut){
     rc = 1;
     OSTRACE(("TEST WR-LOCK %d %d (local)\n", pFile->h, rc));
   }else{
-    rc = winLockFile(&pFile->h, SQLITE_LOCKFILE_FLAGS, RESERVED_BYTE, 0, 1, 0);
+    rc = winLockFile(&pFile->h, SQLITE_LOCKFILEEX_FLAGS,RESERVED_BYTE, 0, 1, 0);
     if( rc ){
       winUnlockFile(&pFile->h, RESERVED_BYTE, 0, 1, 0);
     }
index 1332eb162895f03945e070c041cee71a8fccd1ae..69b4586a3f1ccd4ba1704d339cd6e2d7b8874b10 100644 (file)
@@ -107,9 +107,9 @@ extern "C" {
 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
 ** [sqlite_version()] and [sqlite_source_id()].
 */
-#define SQLITE_VERSION        "3.7.16.1"
+#define SQLITE_VERSION        "3.7.16.2"
 #define SQLITE_VERSION_NUMBER 3007016
-#define SQLITE_SOURCE_ID      "2013-03-29 13:44:34 527231bc67285f01fb18d4451b28f61da3c4e39d"
+#define SQLITE_SOURCE_ID      "2013-04-12 11:52:43 cbea02d93865ce0e06789db95fd9168ebac970c7"
 
 /*
 ** CAPI3REF: Run-Time Library Version Numbers
index 614645ebec432510df3a3d8a9456e82ce24097dc..85d02285f0dd220277c4917d428d8d442a1330f4 100644 (file)
@@ -1,5 +1,5 @@
 VERSION = 3
-PATCHLEVEL = 8
+PATCHLEVEL = 9
 SUBLEVEL = 0
 EXTRAVERSION =
 NAME = Unicycling Gorilla
@@ -165,7 +165,8 @@ export srctree objtree VPATH
 # then ARCH is assigned, getting whatever value it gets normally, and 
 # SUBARCH is subsequently ignored.
 
-SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
+SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
+                                 -e s/sun4u/sparc64/ \
                                  -e s/arm.*/arm/ -e s/sa110/arm/ \
                                  -e s/s390x/s390/ -e s/parisc64/parisc/ \
                                  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
@@ -191,7 +192,6 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
 # "make" in the configured kernel build directory always uses that.
 # Default value for CROSS_COMPILE is not to prefix executables
 # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
-export KBUILD_BUILDHOST := $(SUBARCH)
 ARCH           ?= $(SUBARCH)
 CROSS_COMPILE  ?= $(CONFIG_CROSS_COMPILE:"%"=%)
 
@@ -513,7 +513,8 @@ ifeq ($(KBUILD_EXTMOD),)
 # Carefully list dependencies so we do not try to build scripts twice
 # in parallel
 PHONY += scripts
-scripts: scripts_basic include/config/auto.conf include/config/tristate.conf
+scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \
+        asm-generic
        $(Q)$(MAKE) $(build)=$(@)
 
 # Objects we will link into vmlinux / subdirs we need to visit
@@ -619,7 +620,8 @@ KBUILD_AFLAGS       += -gdwarf-2
 endif
 
 ifdef CONFIG_DEBUG_INFO_REDUCED
-KBUILD_CFLAGS  += $(call cc-option, -femit-struct-debug-baseonly)
+KBUILD_CFLAGS  += $(call cc-option, -femit-struct-debug-baseonly) \
+                  $(call cc-option,-fno-var-tracking)
 endif
 
 ifdef CONFIG_FUNCTION_TRACER
@@ -719,11 +721,11 @@ endif # INSTALL_MOD_STRIP
 export mod_strip_cmd
 
 
-ifeq ($(CONFIG_MODULE_SIG),y)
+ifdef CONFIG_MODULE_SIG_ALL
 MODSECKEY = ./signing_key.priv
 MODPUBKEY = ./signing_key.x509
 export MODPUBKEY
-mod_sign_cmd = perl $(srctree)/scripts/sign-file $(MODSECKEY) $(MODPUBKEY)
+mod_sign_cmd = perl $(srctree)/scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(MODSECKEY) $(MODPUBKEY)
 else
 mod_sign_cmd = true
 endif
@@ -1397,7 +1399,7 @@ quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN   $(wildcard $(rm-files))
 # Run depmod only if we have System.map and depmod is executable
 quiet_cmd_depmod = DEPMOD  $(KERNELRELEASE)
       cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
-                   $(KERNELRELEASE)
+                   $(KERNELRELEASE) "$(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX))"
 
 # Create temporary dir for module support files
 # clean it up only when building all modules
index 7c04e27841d5144545c2dd9323ff4f01c1071e55..be58b4cbaabfb44f8ac91bdca9b59ce054c93d37 100644 (file)
@@ -1,3 +1,3 @@
 
-kconfig taken from vanilla Linux 3.8, and slightly patched.
+kconfig taken from vanilla Linux 3.9, and slightly patched.
 
index 06ba4a70bd4d0db666a4b50b90b73f33e7c6b81e..477d137c0557b8b70571d9e6e0873e2af221d53b 100644 (file)
@@ -7,15 +7,15 @@
 #
 # ==========================================================================
 
-# called may set destination dir (when installing to asm/)
-_dst := $(or $(destination-y),$(dst),$(obj))
-
 # generated header directory
 gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj)))
 
 kbuild-file := $(srctree)/$(obj)/Kbuild
 include $(kbuild-file)
 
+# called may set destination dir (when installing to asm/)
+_dst := $(if $(destination-y),$(destination-y),$(if $(dst),$(dst),$(obj)))
+
 old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild
 ifneq ($(wildcard $(old-kbuild-file)),)
 include $(old-kbuild-file)
@@ -48,13 +48,14 @@ all-files     := $(header-y) $(genhdr-y) $(wrapper-files)
 output-files  := $(addprefix $(installdir)/, $(all-files))
 
 input-files   := $(foreach hdr, $(header-y), \
-                  $(or \
+                  $(if $(wildcard $(srcdir)/$(hdr)), \
                        $(wildcard $(srcdir)/$(hdr)), \
-                       $(wildcard $(oldsrcdir)/$(hdr)), \
-                       $(error Missing UAPI file $(srcdir)/$(hdr)) \
+                       $(if $(wildcard $(oldsrcdir)/$(hdr)), \
+                               $(wildcard $(oldsrcdir)/$(hdr)), \
+                               $(error Missing UAPI file $(srcdir)/$(hdr))) \
                   )) \
                 $(foreach hdr, $(genhdr-y), \
-                  $(or \
+                  $(if $(wildcard $(gendir)/$(hdr)), \
                        $(wildcard $(gendir)/$(hdr)), \
                        $(error Missing generated UAPI file $(gendir)/$(hdr)) \
                   ))
index bdf42fdf64c9adb0095a1ff0ad3437499d0ba87c..07125e697d7a980efdb0f9136ee5741fe8cf0473 100644 (file)
@@ -156,6 +156,11 @@ cpp_flags      = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \
 
 ld_flags       = $(LDFLAGS) $(ldflags-y)
 
+dtc_cpp_flags  = -Wp,-MD,$(depfile) -nostdinc                            \
+                -I$(srctree)/arch/$(SRCARCH)/boot/dts                   \
+                -I$(srctree)/arch/$(SRCARCH)/include/dts                \
+                -undef -D__DTS__
+
 # Finds the multi-part object the current object will be linked into
 modname-multi = $(sort $(foreach m,$(multi-used),\
                $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=))))
@@ -269,6 +274,15 @@ cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile
 $(obj)/%.dtb: $(src)/%.dts FORCE
        $(call if_changed_dep,dtc)
 
+dtc-tmp = $(subst $(comma),_,$(dot-target).dts)
+
+quiet_cmd_dtc_cpp = DTC+CPP $@
+cmd_dtc_cpp = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
+       $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) $(dtc-tmp)
+
+$(obj)/%.dtb: $(src)/%.dtsp FORCE
+       $(call if_changed_dep,dtc_cpp)
+
 # Bzip2
 # ---------------------------------------------------------------------------
 
index a1cb0222ebe642b6fd91093f2a01bd301b026e6e..cf82c832458fb036c1269d01c6df0fd8be18bf1c 100644 (file)
@@ -66,10 +66,6 @@ modules   := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o)))
 # Stop after building .o files if NOFINAL is set. Makes compile tests quicker
 _modpost: $(if $(KBUILD_MODPOST_NOFINAL), $(modules:.ko:.o),$(modules))
 
-ifneq ($(KBUILD_BUILDHOST),$(ARCH))
-        cross_build := 1
-endif
-
 # Step 2), invoke modpost
 #  Includes step 3,4
 modpost = scripts/mod/modpost                    \
@@ -80,8 +76,7 @@ modpost = scripts/mod/modpost                    \
  $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \
  $(if $(KBUILD_EXTMOD),-o $(modulesymfile))      \
  $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S)      \
- $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \
- $(if $(cross_build),-c)
+ $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
 
 quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
       cmd_modpost = $(modpost) -s
index cb1f50cf12e3bda6fe798365a9c31b15adf0477a..7f6425e24ce3ad985635e9249a64552f661566f2 100644 (file)
@@ -409,7 +409,7 @@ static void traps(void)
        int *p = (int *)test;
 
        if (*p != INT_CONF) {
-               fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianess? %#x\n",
+               fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianness? %#x\n",
                        *p);
                exit(2);
        }
index 3091794e935488c797e73207e6d0b82a7dbf99b4..231b4759c714dae5aa9034ef1365e1338cc3bb72 100644 (file)
@@ -11,6 +11,9 @@ else
 Kconfig := Kconfig
 endif
 
+# We need this, in case the user has it in its environment
+unexport CONFIG_
+
 xconfig: $(obj)/qconf
        $< $(Kconfig)
 
index 4da3b4adfad233cb97728b0e0278f8143919cee3..e39fcd8143ea78b2c9c10a2983610fe75bbcb2e3 100644 (file)
@@ -36,6 +36,7 @@ enum input_mode {
 } input_mode = oldaskconfig;
 
 static int indent = 1;
+static int tty_stdio;
 static int valid_stdin = 1;
 static int sync_kconfig;
 static int conf_cnt;
@@ -108,6 +109,8 @@ static int conf_askvalue(struct symbol *sym, const char *def)
        case oldaskconfig:
                fflush(stdout);
                xfgets(line, 128, stdin);
+               if (!tty_stdio)
+                       printf("\n");
                return 1;
        default:
                break;
@@ -495,6 +498,8 @@ int main(int ac, char **av)
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
 
+       tty_stdio = isatty(0) && isatty(1) && isatty(2);
+
        while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) {
                input_mode = (enum input_mode)opt;
                switch (opt) {
@@ -621,7 +626,7 @@ int main(int ac, char **av)
                                return 1;
                        }
                }
-               valid_stdin = isatty(0) && isatty(1) && isatty(2);
+               valid_stdin = tty_stdio;
        }
 
        switch (input_mode) {
index 290ce41f8ba46fcee2d61b6d7f3bd157593f4b66..d6626521f9b9ab9d166fcb9e916a6ea5bc8a7eba 100644 (file)
@@ -13,7 +13,7 @@
 
 struct expr *expr_alloc_symbol(struct symbol *sym)
 {
-       struct expr *e = calloc(1, sizeof(*e));
+       struct expr *e = xcalloc(1, sizeof(*e));
        e->type = E_SYMBOL;
        e->left.sym = sym;
        return e;
@@ -21,7 +21,7 @@ struct expr *expr_alloc_symbol(struct symbol *sym)
 
 struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
 {
-       struct expr *e = calloc(1, sizeof(*e));
+       struct expr *e = xcalloc(1, sizeof(*e));
        e->type = type;
        e->left.expr = ce;
        return e;
@@ -29,7 +29,7 @@ struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
 
 struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2)
 {
-       struct expr *e = calloc(1, sizeof(*e));
+       struct expr *e = xcalloc(1, sizeof(*e));
        e->type = type;
        e->left.expr = e1;
        e->right.expr = e2;
@@ -38,7 +38,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e
 
 struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2)
 {
-       struct expr *e = calloc(1, sizeof(*e));
+       struct expr *e = xcalloc(1, sizeof(*e));
        e->type = type;
        e->left.sym = s1;
        e->right.sym = s2;
@@ -66,7 +66,7 @@ struct expr *expr_copy(const struct expr *org)
        if (!org)
                return NULL;
 
-       e = malloc(sizeof(*org));
+       e = xmalloc(sizeof(*org));
        memcpy(e, org, sizeof(*org));
        switch (org->type) {
        case E_SYMBOL:
index 7491559f273ee61526edccfbf408520ff6518401..35ddf225fb264f7da8fef06aad68d0bb19098dc4 100644 (file)
@@ -10,6 +10,7 @@
 #  include <config.h>
 #endif
 
+#include <stdlib.h>
 #include "lkc.h"
 #include "images.c"
 
@@ -22,7 +23,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <time.h>
-#include <stdlib.h>
 
 //#define DEBUG
 
index f7032ff7db19de110de4d0ee701da5f5a022503a..7cd4610d42fb07ff5a98389b1075e754deaf3e58 100644 (file)
@@ -39,6 +39,12 @@ extern "C" {
 #ifndef CONFIG_
 #define CONFIG_ "CONFIG_"
 #endif
+static inline const char *CONFIG_prefix(void)
+{
+       return getenv( "CONFIG_" ) ?: CONFIG_;
+}
+#undef CONFIG_
+#define CONFIG_ CONFIG_prefix()
 
 #define TF_COMMAND     0x0001
 #define TF_PARAM       0x0002
@@ -116,6 +122,8 @@ void menu_set_type(int type);
 /* util.c */
 struct file *file_lookup(const char *name);
 int file_write_dep(const char *name);
+void *xmalloc(size_t size);
+void *xcalloc(size_t nmemb, size_t size);
 
 struct gstr {
        size_t len;
index c8e8a7154753b858e9f51e9c3d6816962d8f549b..80788137c670b2b7e7740c99803f03edd9803a3f 100644 (file)
@@ -21,6 +21,7 @@ ccflags()
 {
        if [ -f /usr/include/ncursesw/curses.h ]; then
                echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"'
+               echo ' -DNCURSES_WIDECHAR=1'
        elif [ -f /usr/include/ncurses/ncurses.h ]; then
                echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
        elif [ -f /usr/include/ncurses/curses.h ]; then
index ee17a5264d5b456c0672a77b06964bfc1ccd29d7..307022a8beef1ac758080b3299853c8eae5e043d 100644 (file)
@@ -221,7 +221,6 @@ int dialog_menu(const char *title, const char *prompt,
                const void *selected, int *s_scroll);
 int dialog_checklist(const char *title, const char *prompt, int height,
                     int width, int list_height);
-extern char dialog_input_result[];
 int dialog_inputbox(const char *title, const char *prompt, int height,
                    int width, const char *init);
 
index dd8e587c50e26eada18fe35995aaa0ec301f42fc..21404a04d7c34dc37d9f29ffe804b6abeb3f2a62 100644 (file)
@@ -45,7 +45,8 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
                     const char *init)
 {
        int i, x, y, box_y, box_x, box_width;
-       int input_x = 0, scroll = 0, key = 0, button = -1;
+       int input_x = 0, key = 0, button = -1;
+       int show_x, len, pos;
        char *instr = dialog_input_result;
        WINDOW *dialog;
 
@@ -97,14 +98,17 @@ do_resize:
        wmove(dialog, box_y, box_x);
        wattrset(dialog, dlg.inputbox.atr);
 
-       input_x = strlen(instr);
+       len = strlen(instr);
+       pos = len;
 
-       if (input_x >= box_width) {
-               scroll = input_x - box_width + 1;
+       if (len >= box_width) {
+               show_x = len - box_width + 1;
                input_x = box_width - 1;
                for (i = 0; i < box_width - 1; i++)
-                       waddch(dialog, instr[scroll + i]);
+                       waddch(dialog, instr[show_x + i]);
        } else {
+               show_x = 0;
+               input_x = len;
                waddstr(dialog, instr);
        }
 
@@ -121,45 +125,104 @@ do_resize:
                        case KEY_UP:
                        case KEY_DOWN:
                                break;
-                       case KEY_LEFT:
-                               continue;
-                       case KEY_RIGHT:
-                               continue;
                        case KEY_BACKSPACE:
                        case 127:
-                               if (input_x || scroll) {
+                               if (pos) {
                                        wattrset(dialog, dlg.inputbox.atr);
-                                       if (!input_x) {
-                                               scroll = scroll < box_width - 1 ? 0 : scroll - (box_width - 1);
-                                               wmove(dialog, box_y, box_x);
-                                               for (i = 0; i < box_width; i++)
-                                                       waddch(dialog,
-                                                              instr[scroll + input_x + i] ?
-                                                              instr[scroll + input_x + i] : ' ');
-                                               input_x = strlen(instr) - scroll;
+                                       if (input_x == 0) {
+                                               show_x--;
                                        } else
                                                input_x--;
-                                       instr[scroll + input_x] = '\0';
-                                       mvwaddch(dialog, box_y, input_x + box_x, ' ');
+
+                                       if (pos < len) {
+                                               for (i = pos - 1; i < len; i++) {
+                                                       instr[i] = instr[i+1];
+                                               }
+                                       }
+
+                                       pos--;
+                                       len--;
+                                       instr[len] = '\0';
+                                       wmove(dialog, box_y, box_x);
+                                       for (i = 0; i < box_width; i++) {
+                                               if (!instr[show_x + i]) {
+                                                       waddch(dialog, ' ');
+                                                       break;
+                                               }
+                                               waddch(dialog, instr[show_x + i]);
+                                       }
                                        wmove(dialog, box_y, input_x + box_x);
                                        wrefresh(dialog);
                                }
                                continue;
+                       case KEY_LEFT:
+                               if (pos > 0) {
+                                       if (input_x > 0) {
+                                               wmove(dialog, box_y, --input_x + box_x);
+                                       } else if (input_x == 0) {
+                                               show_x--;
+                                               wmove(dialog, box_y, box_x);
+                                               for (i = 0; i < box_width; i++) {
+                                                       if (!instr[show_x + i]) {
+                                                               waddch(dialog, ' ');
+                                                               break;
+                                                       }
+                                                       waddch(dialog, instr[show_x + i]);
+                                               }
+                                               wmove(dialog, box_y, box_x);
+                                       }
+                                       pos--;
+                               }
+                               continue;
+                       case KEY_RIGHT:
+                               if (pos < len) {
+                                       if (input_x < box_width - 1) {
+                                               wmove(dialog, box_y, ++input_x + box_x);
+                                       } else if (input_x == box_width - 1) {
+                                               show_x++;
+                                               wmove(dialog, box_y, box_x);
+                                               for (i = 0; i < box_width; i++) {
+                                                       if (!instr[show_x + i]) {
+                                                               waddch(dialog, ' ');
+                                                               break;
+                                                       }
+                                                       waddch(dialog, instr[show_x + i]);
+                                               }
+                                               wmove(dialog, box_y, input_x + box_x);
+                                       }
+                                       pos++;
+                               }
+                               continue;
                        default:
                                if (key < 0x100 && isprint(key)) {
-                                       if (scroll + input_x < MAX_LEN) {
+                                       if (len < MAX_LEN) {
                                                wattrset(dialog, dlg.inputbox.atr);
-                                               instr[scroll + input_x] = key;
-                                               instr[scroll + input_x + 1] = '\0';
+                                               if (pos < len) {
+                                                       for (i = len; i > pos; i--)
+                                                               instr[i] = instr[i-1];
+                                                       instr[pos] = key;
+                                               } else {
+                                                       instr[len] = key;
+                                               }
+                                               pos++;
+                                               len++;
+                                               instr[len] = '\0';
+
                                                if (input_x == box_width - 1) {
-                                                       scroll++;
-                                                       wmove(dialog, box_y, box_x);
-                                                       for (i = 0; i < box_width - 1; i++)
-                                                               waddch(dialog, instr [scroll + i]);
+                                                       show_x++;
                                                } else {
-                                                       wmove(dialog, box_y, input_x++ + box_x);
-                                                       waddch(dialog, key);
+                                                       input_x++;
+                                               }
+
+                                               wmove(dialog, box_y, box_x);
+                                               for (i = 0; i < box_width; i++) {
+                                                       if (!instr[show_x + i]) {
+                                                               waddch(dialog, ' ');
+                                                               break;
+                                                       }
+                                                       waddch(dialog, instr[show_x + i]);
                                                }
+                                               wmove(dialog, box_y, input_x + box_x);
                                                wrefresh(dialog);
                                        } else
                                                flash();        /* Alarm user about overflow */
index 1d604738fa1314a3479362082208b3591385d890..48d382e7e3746bebd850114d4f7557dbc37c49db 100644 (file)
@@ -26,7 +26,7 @@
  *
  *    *)  A bugfix for the Page-Down problem
  *
- *    *)  Formerly when I used Page Down and Page Up, the cursor would be set 
+ *    *)  Formerly when I used Page Down and Page Up, the cursor would be set
  *        to the first position in the menu box.  Now lxdialog is a bit
  *        smarter and works more like other menu systems (just have a look at
  *        it).
@@ -154,12 +154,14 @@ static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x,
  */
 static void print_buttons(WINDOW * win, int height, int width, int selected)
 {
-       int x = width / 2 - 16;
+       int x = width / 2 - 28;
        int y = height - 2;
 
        print_button(win, gettext("Select"), y, x, selected == 0);
        print_button(win, gettext(" Exit "), y, x + 12, selected == 1);
        print_button(win, gettext(" Help "), y, x + 24, selected == 2);
+       print_button(win, gettext(" Save "), y, x + 36, selected == 3);
+       print_button(win, gettext(" Load "), y, x + 48, selected == 4);
 
        wmove(win, y, x + 1 + 12 * selected);
        wrefresh(win);
@@ -372,7 +374,7 @@ do_resize:
                case TAB:
                case KEY_RIGHT:
                        button = ((key == KEY_LEFT ? --button : ++button) < 0)
-                           ? 2 : (button > 2 ? 0 : button);
+                           ? 4 : (button > 4 ? 0 : button);
 
                        print_buttons(dialog, height, width, button);
                        wrefresh(menu);
@@ -399,17 +401,17 @@ do_resize:
                                return 2;
                        case 's':
                        case 'y':
-                               return 3;
+                               return 5;
                        case 'n':
-                               return 4;
+                               return 6;
                        case 'm':
-                               return 5;
+                               return 7;
                        case ' ':
-                               return 6;
+                               return 8;
                        case '/':
-                               return 7;
+                               return 9;
                        case 'z':
-                               return 8;
+                               return 10;
                        case '\n':
                                return button;
                        }
index 53975cf876083ecba455a7033222b2ccc3690686..566288a763709e1c6c6fb138ad2162a54a4b12c6 100644 (file)
@@ -280,6 +280,7 @@ static struct menu *current_menu;
 static int child_count;
 static int single_menu_mode;
 static int show_all_options;
+static int save_and_exit;
 
 static void conf(struct menu *menu, struct menu *active_menu);
 static void conf_choice(struct menu *menu);
@@ -348,15 +349,19 @@ static void search_conf(void)
 {
        struct symbol **sym_arr;
        struct gstr res;
+       struct gstr title;
        char *dialog_input;
        int dres, vscroll = 0, hscroll = 0;
        bool again;
 
+       title = str_new();
+       str_printf( &title, _("Enter %s (sub)string to search for "
+                             "(with or without \"%s\")"), CONFIG_, CONFIG_);
+
 again:
        dialog_clear();
        dres = dialog_inputbox(_("Search Configuration Parameter"),
-                             _("Enter " CONFIG_ " (sub)string to search for "
-                               "(with or without \"" CONFIG_ "\")"),
+                             str_get(&title),
                              10, 75, "");
        switch (dres) {
        case 0:
@@ -365,6 +370,7 @@ again:
                show_helptext(_("Search Configuration"), search_help);
                goto again;
        default:
+               str_free(&title);
                return;
        }
 
@@ -398,6 +404,7 @@ again:
                str_free(&res);
        } while (again);
        free(sym_arr);
+       str_free(&title);
 }
 
 static void build_conf(struct menu *menu)
@@ -592,14 +599,6 @@ static void conf(struct menu *menu, struct menu *active_menu)
                build_conf(menu);
                if (!child_count)
                        break;
-               if (menu == &rootmenu) {
-                       item_make("--- ");
-                       item_set_tag(':');
-                       item_make(_("    Load an Alternate Configuration File"));
-                       item_set_tag('L');
-                       item_make(_("    Save an Alternate Configuration File"));
-                       item_set_tag('S');
-               }
                dialog_clear();
                res = dialog_menu(prompt ? _(prompt) : _("Main Menu"),
                                  _(menu_instructions),
@@ -636,12 +635,6 @@ static void conf(struct menu *menu, struct menu *active_menu)
                        case 's':
                                conf_string(submenu);
                                break;
-                       case 'L':
-                               conf_load();
-                               break;
-                       case 'S':
-                               conf_save();
-                               break;
                        }
                        break;
                case 2:
@@ -651,6 +644,12 @@ static void conf(struct menu *menu, struct menu *active_menu)
                                show_helptext(_("README"), _(mconf_readme));
                        break;
                case 3:
+                       conf_save();
+                       break;
+               case 4:
+                       conf_load();
+                       break;
+               case 5:
                        if (item_is_tag('t')) {
                                if (sym_set_tristate_value(sym, yes))
                                        break;
@@ -658,24 +657,24 @@ static void conf(struct menu *menu, struct menu *active_menu)
                                        show_textbox(NULL, setmod_text, 6, 74);
                        }
                        break;
-               case 4:
+               case 6:
                        if (item_is_tag('t'))
                                sym_set_tristate_value(sym, no);
                        break;
-               case 5:
+               case 7:
                        if (item_is_tag('t'))
                                sym_set_tristate_value(sym, mod);
                        break;
-               case 6:
+               case 8:
                        if (item_is_tag('t'))
                                sym_toggle_tristate_value(sym);
                        else if (item_is_tag('m'))
                                conf(submenu, NULL);
                        break;
-               case 7:
+               case 9:
                        search_conf();
                        break;
-               case 8:
+               case 10:
                        show_all_options = !show_all_options;
                        break;
                }
@@ -702,6 +701,17 @@ static void show_helptext(const char *title, const char *text)
        show_textbox(title, text, 0, 0);
 }
 
+static void conf_message_callback(const char *fmt, va_list ap)
+{
+       char buf[PATH_MAX+1];
+
+       vsnprintf(buf, sizeof(buf), fmt, ap);
+       if (save_and_exit)
+               printf("%s", buf);
+       else
+               show_textbox(NULL, buf, 6, 60);
+}
+
 static void show_help(struct menu *menu)
 {
        struct gstr help = str_new();
@@ -870,6 +880,7 @@ static int handle_exit(void)
 {
        int res;
 
+       save_and_exit = 1;
        dialog_clear();
        if (conf_get_changed())
                res = dialog_yesno(NULL,
@@ -941,6 +952,7 @@ int main(int ac, char **av)
        }
 
        set_config_filename(conf_get_configname());
+       conf_set_message_callback(conf_message_callback);
        do {
                conf(&rootmenu, NULL);
                res = handle_exit();
index e98a05c8e50882d3b2833a2f4d05761dcffd22d3..f3bffa309333061ed5d852e7c00132107017add5 100644 (file)
@@ -48,7 +48,7 @@ void menu_add_entry(struct symbol *sym)
 {
        struct menu *menu;
 
-       menu = malloc(sizeof(*menu));
+       menu = xmalloc(sizeof(*menu));
        memset(menu, 0, sizeof(*menu));
        menu->sym = sym;
        menu->parent = current_menu;
@@ -531,7 +531,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
                        location = menu;
        }
        if (head && location) {
-               jump = malloc(sizeof(struct jump_key));
+               jump = xmalloc(sizeof(struct jump_key));
 
                if (menu_is_visible(prop->menu)) {
                        /*
index 87d4b15da951031896868789df7a992d21fcc73b..dbf31edd22b261edafc003e6c3e0c3420e866c97 100644 (file)
  */
 #define _GNU_SOURCE
 #include <string.h>
+#include <stdlib.h>
 
 #include "lkc.h"
 #include "nconf.h"
 #include <ctype.h>
 
-static const char nconf_readme[] = N_(
-"Overview\n"
-"--------\n"
-"This interface let you select features and parameters for the build.\n"
-"Features can either be built-in, modularized, or ignored. Parameters\n"
-"must be entered in as decimal or hexadecimal numbers or text.\n"
+static const char nconf_global_help[] = N_(
+"Help windows\n"
+"------------\n"
+"o  Global help:  Unless in a data entry window, pressing <F1> will give \n"
+"   you the global help window, which you are just reading.\n"
 "\n"
-"Menu items beginning with following braces represent features that\n"
-"  [ ] can be built in or removed\n"
-"  < > can be built in, modularized or removed\n"
-"  { } can be built in or modularized (selected by other feature)\n"
-"  - - are selected by other feature,\n"
-"  XXX cannot be selected. Use Symbol Info to find out why,\n"
-"while *, M or whitespace inside braces means to build in, build as\n"
-"a module or to exclude the feature respectively.\n"
+"o  A short version of the global help is available by pressing <F3>.\n"
 "\n"
-"To change any of these features, highlight it with the cursor\n"
-"keys and press <Y> to build it in, <M> to make it a module or\n"
-"<N> to removed it.  You may also press the <Space Bar> to cycle\n"
-"through the available options (ie. Y->N->M->Y).\n"
+"o  Local help:  To get help related to the current menu entry, use any\n"
+"   of <?> <h>, or if in a data entry window then press <F1>.\n"
 "\n"
-"Some additional keyboard hints:\n"
 "\n"
-"Menus\n"
-"----------\n"
-"o  Use the Up/Down arrow keys (cursor keys) to highlight the item\n"
-"   you wish to change use <Enter> or <Space>. Goto submenu by \n"
-"   pressing <Enter> of <right-arrow>. Use <Esc> or <left-arrow> to go back.\n"
-"   Submenus are designated by \"--->\".\n"
-"\n"
-"   Searching: pressing '/' triggers interactive search mode.\n"
-"              nconfig performs a case insensitive search for the string\n"
-"              in the menu prompts (no regex support).\n"
-"              Pressing the up/down keys highlights the previous/next\n"
-"              matching item. Backspace removes one character from the\n"
-"              match string. Pressing either '/' again or ESC exits\n"
-"              search mode. All other keys behave normally.\n"
+"Menu entries\n"
+"------------\n"
+"This interface lets you select features and parameters for the kernel\n"
+"build.  Kernel features can either be built-in, modularized, or removed.\n"
+"Parameters must be entered as text or decimal or hexadecimal numbers.\n"
 "\n"
-"   You may also use the <PAGE UP> and <PAGE DOWN> keys to scroll\n"
-"   unseen options into view.\n"
+"Menu entries beginning with following braces represent features that\n"
+"  [ ]  can be built in or removed\n"
+"  < >  can be built in, modularized or removed\n"
+"  { }  can be built in or modularized, are selected by another feature\n"
+"  - -  are selected by another feature\n"
+"  XXX  cannot be selected.  Symbol Info <F2> tells you why.\n"
+"*, M or whitespace inside braces means to build in, build as a module\n"
+"or to exclude the feature respectively.\n"
 "\n"
-"o  To exit a menu use the just press <ESC> <F5> <F8> or <left-arrow>.\n"
+"To change any of these features, highlight it with the movement keys\n"
+"listed below and press <y> to build it in, <m> to make it a module or\n"
+"<n> to remove it.  You may press the <Space> key to cycle through the\n"
+"available options.\n"
 "\n"
-"o  To get help with an item, press <F1>\n"
-"   Shortcut: Press <h> or <?>.\n"
+"A trailing \"--->\" designates a submenu.\n"
 "\n"
 "\n"
-"Radiolists  (Choice lists)\n"
-"-----------\n"
-"o  Use the cursor keys to select the option you wish to set and press\n"
-"   <S> or the <SPACE BAR>.\n"
+"Menu navigation keys\n"
+"----------------------------------------------------------------------\n"
+"Linewise up                 <Up>\n"
+"Linewise down               <Down>\n"
+"Pagewise up                 <Page Up>\n"
+"Pagewise down               <Page Down>\n"
+"First entry                 <Home>\n"
+"Last entry                  <End>\n"
+"Enter a submenu             <Right>  <Enter>\n"
+"Go back to parent menu      <Left>   <Esc>  <F5>\n"
+"Close a help window         <Enter>  <Esc>  <F5>\n"
+"Close entry window, apply   <Enter>\n"
+"Close entry window, forget  <Esc>  <F5>\n"
+"Start incremental, case-insensitive search for STRING in menu entries,\n"
+"    no regex support, STRING is displayed in upper left corner\n"
+"                            </>STRING\n"
+"    Remove last character   <Backspace>\n"
+"    Jump to next hit        <Down>\n"
+"    Jump to previous hit    <Up>\n"
+"Exit menu search mode       </>  <Esc>\n"
+"Search for configuration variables with or without leading CONFIG_\n"
+"                            <F8>RegExpr<Enter>\n"
+"Verbose search help         <F8><F1>\n"
+"----------------------------------------------------------------------\n"
 "\n"
-"   Shortcut: Press the first letter of the option you wish to set then\n"
-"             press <S> or <SPACE BAR>.\n"
+"Unless in a data entry window, key <1> may be used instead of <F1>,\n"
+"<2> instead of <F2>, etc.\n"
 "\n"
-"o  To see available help for the item, press <F1>\n"
-"   Shortcut: Press <H> or <?>.\n"
 "\n"
+"Radiolist (Choice list)\n"
+"-----------------------\n"
+"Use the movement keys listed above to select the option you wish to set\n"
+"and press <Space>.\n"
 "\n"
-"Data Entry\n"
-"-----------\n"
-"o  Enter the requested information and press <ENTER>\n"
-"   If you are entering hexadecimal values, it is not necessary to\n"
-"   add the '0x' prefix to the entry.\n"
 "\n"
-"o  For help, press <F1>.\n"
+"Data entry\n"
+"----------\n"
+"Enter the requested information and press <Enter>.  Hexadecimal values\n"
+"may be entered without the \"0x\" prefix.\n"
 "\n"
 "\n"
-"Text Box    (Help Window)\n"
-"--------\n"
-"o  Use the cursor keys to scroll up/down/left/right.  The VI editor\n"
-"   keys h,j,k,l function here as do <u>, <d> and <SPACE BAR> for\n"
-"   those who are familiar with less and lynx.\n"
+"Text Box (Help Window)\n"
+"----------------------\n"
+"Use movement keys as listed in table above.\n"
 "\n"
-"o  Press <Enter>, <F1>, <F5>, <F9>, <q> or <Esc> to exit.\n"
+"Press any of <Enter> <Esc> <q> <F5> <F9> to exit.\n"
 "\n"
 "\n"
-"Alternate Configuration Files\n"
+"Alternate configuration files\n"
 "-----------------------------\n"
-"nconfig supports the use of alternate configuration files for\n"
-"those who, for various reasons, find it necessary to switch\n"
-"between different configurations.\n"
+"nconfig supports switching between different configurations.\n"
+"Press <F6> to save your current configuration.  Press <F7> and enter\n"
+"a file name to load a previously saved configuration.\n"
 "\n"
-"At the end of the main menu you will find two options.  One is\n"
-"for saving the current configuration to a file of your choosing.\n"
-"The other option is for loading a previously saved alternate\n"
-"configuration.\n"
 "\n"
-"Even if you don't use alternate configuration files, but you\n"
-"find during a nconfig session that you have completely messed\n"
-"up your settings, you may use the \"Load Alternate...\" option to\n"
-"restore your previously saved settings from \".config\" without\n"
-"restarting nconfig.\n"
+"Terminal configuration\n"
+"----------------------\n"
+"If you use nconfig in a xterm window, make sure your TERM environment\n"
+"variable specifies a terminal configuration which supports at least\n"
+"16 colors.  Otherwise nconfig will look rather bad.\n"
 "\n"
-"Other information\n"
-"-----------------\n"
-"If you use nconfig in an XTERM window make sure you have your\n"
-"$TERM variable set to point to a xterm definition which supports color.\n"
-"Otherwise, nconfig will look rather bad.  nconfig will not\n"
-"display correctly in a RXVT window because rxvt displays only one\n"
-"intensity of color, bright.\n"
+"If the \"stty size\" command reports the current terminalsize correctly,\n"
+"nconfig will adapt to sizes larger than the traditional 80x25 \"standard\"\n"
+"and display longer menus properly.\n"
 "\n"
-"nconfig will display larger menus on screens or xterms which are\n"
-"set to display more than the standard 25 row by 80 column geometry.\n"
-"In order for this to work, the \"stty size\" command must be able to\n"
-"display the screen's current row and column geometry.  I STRONGLY\n"
-"RECOMMEND that you make sure you do NOT have the shell variables\n"
-"LINES and COLUMNS exported into your environment.  Some distributions\n"
-"export those variables via /etc/profile.  Some ncurses programs can\n"
-"become confused when those variables (LINES & COLUMNS) don't reflect\n"
-"the true screen size.\n"
 "\n"
-"Optional personality available\n"
-"------------------------------\n"
-"If you prefer to have all of the options listed in a single menu, rather\n"
-"than the default multimenu hierarchy, run the nconfig with NCONFIG_MODE\n"
-"environment variable set to single_menu. Example:\n"
+"Single menu mode\n"
+"----------------\n"
+"If you prefer to have all of the menu entries listed in a single menu,\n"
+"rather than the default multimenu hierarchy, run nconfig with\n"
+"NCONFIG_MODE environment variable set to single_menu.  Example:\n"
 "\n"
 "make NCONFIG_MODE=single_menu nconfig\n"
 "\n"
-"<Enter> will then unroll the appropriate category, or enfold it if it\n"
-"is already unrolled.\n"
+"<Enter> will then unfold the appropriate category, or fold it if it\n"
+"is already unfolded.  Folded menu entries will be designated by a\n"
+"leading \"++>\" and unfolded entries by a leading \"-->\".\n"
 "\n"
-"Note that this mode can eventually be a little more CPU expensive\n"
-"(especially with a larger number of unrolled categories) than the\n"
-"default mode.\n"
+"Note that this mode can eventually be a little more CPU expensive than\n"
+"the default mode, especially with a larger number of unfolded submenus.\n"
 "\n"),
 menu_no_f_instructions[] = N_(
-" You do not have function keys support. Please follow the\n"
-" following instructions:\n"
-" Arrow keys navigate the menu.\n"
-" <Enter> or <right-arrow> selects submenus --->.\n"
-" Capital Letters are hotkeys.\n"
-" Pressing <Y> includes, <N> excludes, <M> modularizes features.\n"
-" Pressing SpaceBar toggles between the above options.\n"
-" Press <Esc> or <left-arrow> to go back one menu,\n"
-" <?> or <h> for Help, </> for Search.\n"
-" <1> is interchangeable with <F1>, <2> with <F2>, etc.\n"
-" Legend: [*] built-in  [ ] excluded  <M> module  < > module capable.\n"
-" <Esc> always leaves the current window.\n"),
+"Legend:  [*] built-in  [ ] excluded  <M> module  < > module capable.\n"
+"Submenus are designated by a trailing \"--->\".\n"
+"\n"
+"Use the following keys to navigate the menus:\n"
+"Move up or down with <Up> and <Down>.\n"
+"Enter a submenu with <Enter> or <Right>.\n"
+"Exit a submenu to its parent menu with <Esc> or <Left>.\n"
+"Pressing <y> includes, <n> excludes, <m> modularizes features.\n"
+"Pressing <Space> cycles through the available options.\n"
+"To search for menu entries press </>.\n"
+"<Esc> always leaves the current window.\n"
+"\n"
+"You do not have function keys support.\n"
+"Press <1> instead of <F1>, <2> instead of <F2>, etc.\n"
+"For verbose global help use key <1>.\n"
+"For help related to the current menu entry press <?> or <h>.\n"),
 menu_instructions[] = N_(
-" Arrow keys navigate the menu.\n"
-" <Enter> or <right-arrow> selects submenus --->.\n"
-" Capital Letters are hotkeys.\n"
-" Pressing <Y> includes, <N> excludes, <M> modularizes features.\n"
-" Pressing SpaceBar toggles between the above options\n"
-" Press <Esc>, <F5> or <left-arrow> to go back one menu,\n"
-" <?>, <F1> or <h> for Help, </> for Search.\n"
-" <1> is interchangeable with <F1>, <2> with <F2>, etc.\n"
-" Legend: [*] built-in  [ ] excluded  <M> module  < > module capable.\n"
-" <Esc> always leaves the current window\n"),
+"Legend:  [*] built-in  [ ] excluded  <M> module  < > module capable.\n"
+"Submenus are designated by a trailing \"--->\".\n"
+"\n"
+"Use the following keys to navigate the menus:\n"
+"Move up or down with <Up> or <Down>.\n"
+"Enter a submenu with <Enter> or <Right>.\n"
+"Exit a submenu to its parent menu with <Esc> or <Left>.\n"
+"Pressing <y> includes, <n> excludes, <m> modularizes features.\n"
+"Pressing <Space> cycles through the available options.\n"
+"To search for menu entries press </>.\n"
+"<Esc> always leaves the current window.\n"
+"\n"
+"Pressing <1> may be used instead of <F1>, <2> instead of <F2>, etc.\n"
+"For verbose global help press <F1>.\n"
+"For help related to the current menu entry press <?> or <h>.\n"),
 radiolist_instructions[] = N_(
-" Use the arrow keys to navigate this window or\n"
-" press the hotkey of the item you wish to select\n"
-" followed by the <SPACE BAR>.\n"
-" Press <?>, <F1> or <h> for additional information about this option.\n"),
+"Press <Up>, <Down>, <Home> or <End> to navigate a radiolist, select\n"
+"with <Space>.\n"
+"For help related to the current entry press <?> or <h>.\n"
+"For global help press <F1>.\n"),
 inputbox_instructions_int[] = N_(
 "Please enter a decimal value.\n"
 "Fractions will not be accepted.\n"
-"Press <RETURN> to accept, <ESC> to cancel."),
+"Press <Enter> to apply, <Esc> to cancel."),
 inputbox_instructions_hex[] = N_(
 "Please enter a hexadecimal value.\n"
-"Press <RETURN> to accept, <ESC> to cancel."),
+"Press <Enter> to apply, <Esc> to cancel."),
 inputbox_instructions_string[] = N_(
 "Please enter a string value.\n"
-"Press <RETURN> to accept, <ESC> to cancel."),
+"Press <Enter> to apply, <Esc> to cancel."),
 setmod_text[] = N_(
-"This feature depends on another which\n"
-"has been configured as a module.\n"
-"As a result, this feature will be built as a module."),
+"This feature depends on another feature which has been configured as a\n"
+"module.  As a result, the current feature will be built as a module too."),
 load_config_text[] = N_(
 "Enter the name of the configuration file you wish to load.\n"
-"Accept the name shown to restore the configuration you\n"
-"last retrieved.  Leave blank to abort."),
+"Accept the name shown to restore the configuration you last\n"
+"retrieved.  Leave empty to abort."),
 load_config_help[] = N_(
-"\n"
 "For various reasons, one may wish to keep several different\n"
 "configurations available on a single machine.\n"
 "\n"
 "If you have saved a previous configuration in a file other than the\n"
-"default one, entering its name here will allow you to modify that\n"
-"configuration.\n"
+"default one, entering its name here will allow you to load and modify\n"
+"that configuration.\n"
 "\n"
-"If you are uncertain, then you have probably never used alternate\n"
-"configuration files.  You should therefor leave this blank to abort.\n"),
+"Leave empty to abort.\n"),
 save_config_text[] = N_(
 "Enter a filename to which this configuration should be saved\n"
-"as an alternate.  Leave blank to abort."),
+"as an alternate.  Leave empty to abort."),
 save_config_help[] = N_(
-"\n"
-"For various reasons, one may wish to keep different configurations\n"
-"available on a single machine.\n"
+"For various reasons, one may wish to keep several different\n"
+"configurations available on a single machine.\n"
 "\n"
 "Entering a file name here will allow you to later retrieve, modify\n"
 "and use the current configuration as an alternate to whatever\n"
 "configuration options you have selected at that time.\n"
 "\n"
-"If you are uncertain what all this means then you should probably\n"
-"leave this blank.\n"),
+"Leave empty to abort.\n"),
 search_help[] = N_(
-"\n"
-"Search for symbols and display their relations. Regular expressions\n"
-"are allowed.\n"
-"Example: search for \"^FOO\"\n"
+"Search for symbols (configuration variable names CONFIG_*) and display\n"
+"their relations.  Regular expressions are supported.\n"
+"Example:  Search for \"^FOO\".\n"
 "Result:\n"
 "-----------------------------------------------------------------\n"
 "Symbol: FOO [ = m]\n"
@@ -229,26 +222,26 @@ search_help[] = N_(
 "Selects: LIBCRC32\n"
 "Selected by: BAR\n"
 "-----------------------------------------------------------------\n"
-"o The line 'Prompt:' shows the text used in the menu structure for\n"
-"  this symbol\n"
-"o The 'Defined at' line tell at what file / line number the symbol\n"
-"  is defined\n"
-"o The 'Depends on:' line tell what symbols needs to be defined for\n"
-"  this symbol to be visible in the menu (selectable)\n"
-"o The 'Location:' lines tell where in the menu structure this symbol\n"
-"  is located\n"
-"    A location followed by a [ = y] indicate that this is a selectable\n"
-"    menu item - and current value is displayed inside brackets.\n"
-"o The 'Selects:' line tell what symbol will be automatically\n"
-"  selected if this symbol is selected (y or m)\n"
-"o The 'Selected by' line tell what symbol has selected this symbol\n"
+"o  The line 'Prompt:' shows the text displayed for this symbol in\n"
+"   the menu hierarchy.\n"
+"o  The 'Defined at' line tells at what file / line number the symbol is\n"
+"   defined.\n"
+"o  The 'Depends on:' line lists symbols that need to be defined for\n"
+"   this symbol to be visible and selectable in the menu.\n"
+"o  The 'Location:' lines tell, where in the menu structure this symbol\n"
+"   is located.  A location followed by a [ = y] indicates that this is\n"
+"   a selectable menu item, and the current value is displayed inside\n"
+"   brackets.\n"
+"o  The 'Selects:' line tells, what symbol will be automatically selected\n"
+"   if this symbol is selected (y or m).\n"
+"o  The 'Selected by' line tells what symbol has selected this symbol.\n"
 "\n"
 "Only relevant lines are shown.\n"
 "\n\n"
 "Search examples:\n"
-"Examples: USB  => find all symbols containing USB\n"
-"          ^USB => find all symbols starting with USB\n"
-"          USB$ => find all symbols ending with USB\n"
+"USB  => find all symbols containing USB\n"
+"^USB => find all symbols starting with USB\n"
+"USB$ => find all symbols ending with USB\n"
 "\n");
 
 struct mitem {
@@ -319,19 +312,19 @@ struct function_keys function_keys[] = {
        },
        {
                .key_str = "F2",
-               .func = "Sym Info",
+               .func = "SymInfo",
                .key = F_SYMBOL,
                .handler = handle_f2,
        },
        {
                .key_str = "F3",
-               .func = "Insts",
+               .func = "Help 2",
                .key = F_INSTS,
                .handler = handle_f3,
        },
        {
                .key_str = "F4",
-               .func = "Config",
+               .func = "ShowAll",
                .key = F_CONF,
                .handler = handle_f4,
        },
@@ -355,7 +348,7 @@ struct function_keys function_keys[] = {
        },
        {
                .key_str = "F8",
-               .func = "Sym Search",
+               .func = "SymSearch",
                .key = F_SEARCH,
                .handler = handle_f8,
        },
@@ -392,7 +385,7 @@ static void print_function_line(void)
 static void handle_f1(int *key, struct menu *current_item)
 {
        show_scroll_win(main_window,
-                       _("README"), _(nconf_readme));
+                       _("Global help"), _(nconf_global_help));
        return;
 }
 
@@ -407,7 +400,7 @@ static void handle_f2(int *key, struct menu *current_item)
 static void handle_f3(int *key, struct menu *current_item)
 {
        show_scroll_win(main_window,
-                       _("Instructions"),
+                       _("Short help"),
                        _(current_instructions));
        return;
 }
@@ -696,13 +689,18 @@ static void search_conf(void)
 {
        struct symbol **sym_arr;
        struct gstr res;
+       struct gstr title;
        char *dialog_input;
        int dres;
+
+       title = str_new();
+       str_printf( &title, _("Enter %s (sub)string to search for "
+                             "(with or without \"%s\")"), CONFIG_, CONFIG_);
+
 again:
        dres = dialog_inputbox(main_window,
                        _("Search Configuration Parameter"),
-                       _("Enter " CONFIG_ " (sub)string to search for "
-                               "(with or without \"" CONFIG_ "\")"),
+                       str_get(&title),
                        "", &dialog_input_result, &dialog_input_result_len);
        switch (dres) {
        case 0:
@@ -712,6 +710,7 @@ again:
                                _("Search Configuration"), search_help);
                goto again;
        default:
+               str_free(&title);
                return;
        }
 
@@ -726,6 +725,7 @@ again:
        show_scroll_win(main_window,
                        _("Search Results"), str_get(&res));
        str_free(&res);
+       str_free(&title);
 }
 
 
index 379003c7a2b4d8cef60e25548fcb9567ca3656c5..9f8c44ecc703a1ea9cd27d3e656e5352f8e6ba86 100644 (file)
@@ -48,7 +48,7 @@ static void set_normal_colors(void)
        init_pair(INPUT_FIELD, -1, -1);
 
        init_pair(FUNCTION_HIGHLIGHT, -1, -1);
-       init_pair(FUNCTION_TEXT, COLOR_BLUE, -1);
+       init_pair(FUNCTION_TEXT, COLOR_YELLOW, -1);
 }
 
 /* available attributes:
index df274febb3e51d6331c5b64e4f29a64f51817538..1500c38f0ccabf5908f7704f683759b0e754ebce 100644 (file)
@@ -6,6 +6,7 @@
 #include <qglobal.h>
 
 #if QT_VERSION < 0x040000
+#include <stddef.h>
 #include <qmainwindow.h>
 #include <qvbox.h>
 #include <qvaluelist.h>
index 22a3c400fc41119c8c8f4197c3dfcdde87b0a882..ecc5aa5f865db7d253facefc10cc77fc2404e41d 100644 (file)
@@ -656,11 +656,11 @@ bool sym_set_string_value(struct symbol *sym, const char *newval)
        size = strlen(newval) + 1;
        if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) {
                size += 2;
-               sym->def[S_DEF_USER].val = val = malloc(size);
+               sym->def[S_DEF_USER].val = val = xmalloc(size);
                *val++ = '0';
                *val++ = 'x';
        } else if (!oldval || strcmp(oldval, newval))
-               sym->def[S_DEF_USER].val = val = malloc(size);
+               sym->def[S_DEF_USER].val = val = xmalloc(size);
        else
                return true;
 
@@ -812,7 +812,7 @@ struct symbol *sym_lookup(const char *name, int flags)
                hash = 0;
        }
 
-       symbol = malloc(sizeof(*symbol));
+       symbol = xmalloc(sizeof(*symbol));
        memset(symbol, 0, sizeof(*symbol));
        symbol->name = new_name;
        symbol->type = S_UNKNOWN;
@@ -863,7 +863,7 @@ const char *sym_expand_string_value(const char *in)
        size_t reslen;
 
        reslen = strlen(in) + 1;
-       res = malloc(reslen);
+       res = xmalloc(reslen);
        res[0] = '\0';
 
        while ((src = strchr(in, '$'))) {
@@ -921,7 +921,7 @@ const char *sym_escape_string_value(const char *in)
                p++;
        }
 
-       res = malloc(reslen);
+       res = xmalloc(reslen);
        res[0] = '\0';
 
        strcat(res, "\"");
@@ -1228,7 +1228,7 @@ struct property *prop_alloc(enum prop_type type, struct symbol *sym)
        struct property *prop;
        struct property **propp;
 
-       prop = malloc(sizeof(*prop));
+       prop = xmalloc(sizeof(*prop));
        memset(prop, 0, sizeof(*prop));
        prop->type = type;
        prop->sym = sym;
index d0b8b2318e489577fd82713fd79b1759c3ff170b..6e7fbf1968090463f37ec1af70d65fb0af28a391 100644 (file)
@@ -23,7 +23,7 @@ struct file *file_lookup(const char *name)
                }
        }
 
-       file = malloc(sizeof(*file));
+       file = xmalloc(sizeof(*file));
        memset(file, 0, sizeof(*file));
        file->name = file_name;
        file->next = file_list;
@@ -81,7 +81,7 @@ int file_write_dep(const char *name)
 struct gstr str_new(void)
 {
        struct gstr gs;
-       gs.s = malloc(sizeof(char) * 64);
+       gs.s = xmalloc(sizeof(char) * 64);
        gs.len = 64;
        gs.max_width = 0;
        strcpy(gs.s, "\0");
@@ -138,3 +138,22 @@ const char *str_get(struct gstr *gs)
        return gs->s;
 }
 
+void *xmalloc(size_t size)
+{
+       void *p = malloc(size);
+       if (p)
+               return p;
+       fprintf(stderr, "Out of memory.\n");
+       exit(1);
+}
+
+void *xcalloc(size_t nmemb, size_t size)
+{
+       void *p = calloc(nmemb, size);
+       if (p)
+               return p;
+       fprintf(stderr, "Out of memory.\n");
+       exit(1);
+}
+
+
index 00f9d3a9cf8b96fd85639339019bf1bc2afab306..6555a475453b882d2970c7ae4b16b5c4eb3286cf 100644 (file)
@@ -40,7 +40,7 @@ static void zconf_endfile(void);
 
 static void new_string(void)
 {
-       text = malloc(START_STRSIZE);
+       text = xmalloc(START_STRSIZE);
        text_asize = START_STRSIZE;
        text_size = 0;
        *text = 0;
@@ -62,7 +62,7 @@ static void append_string(const char *str, int size)
 
 static void alloc_string(const char *str, int size)
 {
-       text = malloc(size + 1);
+       text = xmalloc(size + 1);
        memcpy(text, str, size);
        text[size] = 0;
 }
@@ -288,7 +288,7 @@ void zconf_initscan(const char *name)
                exit(1);
        }
 
-       current_buf = malloc(sizeof(*current_buf));
+       current_buf = xmalloc(sizeof(*current_buf));
        memset(current_buf, 0, sizeof(*current_buf));
 
        current_file = file_lookup(name);
@@ -299,7 +299,7 @@ void zconf_nextfile(const char *name)
 {
        struct file *iter;
        struct file *file = file_lookup(name);
-       struct buffer *buf = malloc(sizeof(*buf));
+       struct buffer *buf = xmalloc(sizeof(*buf));
        memset(buf, 0, sizeof(*buf));
 
        current_buf->state = YY_CURRENT_BUFFER;
index c32b1a49f5a30923b70e097e7241735772ad4b67..a0521aa5974b514e7bfcb1811746c283702862f2 100644 (file)
@@ -802,7 +802,7 @@ static void zconf_endfile(void);
 
 static void new_string(void)
 {
-       text = malloc(START_STRSIZE);
+       text = xmalloc(START_STRSIZE);
        text_asize = START_STRSIZE;
        text_size = 0;
        *text = 0;
@@ -824,7 +824,7 @@ static void append_string(const char *str, int size)
 
 static void alloc_string(const char *str, int size)
 {
-       text = malloc(size + 1);
+       text = xmalloc(size + 1);
        memcpy(text, str, size);
        text[size] = 0;
 }
@@ -2343,7 +2343,7 @@ void zconf_initscan(const char *name)
                exit(1);
        }
 
-       current_buf = malloc(sizeof(*current_buf));
+       current_buf = xmalloc(sizeof(*current_buf));
        memset(current_buf, 0, sizeof(*current_buf));
 
        current_file = file_lookup(name);
@@ -2354,7 +2354,7 @@ void zconf_nextfile(const char *name)
 {
        struct file *iter;
        struct file *file = file_lookup(name);
-       struct buffer *buf = malloc(sizeof(*buf));
+       struct buffer *buf = xmalloc(sizeof(*buf));
        memset(buf, 0, sizeof(*buf));
 
        current_buf->state = YY_CURRENT_BUFFER;