From c08ea499551bb4dd41537ac1241e03757f360759 Mon Sep 17 00:00:00 2001 From: l4check Date: Sat, 11 May 2013 11:01:29 +0000 Subject: [PATCH 1/1] update git-svn-id: http://svn.tudos.org/repos/oc/tudos/trunk@54 d050ee49-bd90-4346-b210-929a50b99cfc --- kernel/fiasco/src/jdb/ia32/jdb-ia32-amd64.cpp | 3 + kernel/fiasco/src/jdb/jdb.cpp | 2 +- kernel/fiasco/src/jdb/ppc32/jdb-ppc32.cpp | 3 + kernel/fiasco/src/jdb/sparc/jdb-sparc.cpp | 3 + .../arm/bsp/exynos/pic-arm-gic-exynos.cpp | 14 +- kernel/fiasco/src/kern/arm/bsp/tegra/Kconfig | 34 ++ kernel/fiasco/src/kern/arm/bsp/tegra/Modules | 27 ++ .../arm/bsp/tegra/bootstrap-arm-tegra.cpp | 5 + .../kern/arm/bsp/tegra/config-arm-tegra.cpp | 7 + .../arm/bsp/tegra/kernel_uart-arm-tegra.cpp | 26 ++ .../arm/bsp/tegra/mem_layout-arm-tegra.cpp | 21 ++ .../arm/bsp/tegra/outer_cache-arm-tegra.cpp | 18 + .../src/kern/arm/bsp/tegra/pic-arm-tegra.cpp | 42 +++ .../bsp/tegra/platform_control-arm-tegra.cpp | 167 +++++++++ .../kern/arm/bsp/tegra/reset-arm-tegra.cpp | 13 + .../kern/arm/bsp/tegra/timer-arm-tegra.cpp | 79 ++++ .../arm/bsp/tegra/uart-16550-arm-tegra.cpp | 34 ++ kernel/fiasco/src/kern/arm/paging-arm.cpp | 5 +- kernel/fiasco/src/kern/ia32/vmx.cpp | 6 +- .../templates/globalconfig.out.arm-a9-mp-1 | 4 +- .../templates/globalconfig.out.arm-a9-mp-2 | 4 +- .../globalconfig.out.arm-a9-mp-vexpress-1 | 4 +- .../globalconfig.out.arm-a9-mp-vexpress-2 | 4 +- .../src/templates/globalconfig.out.arm-imx21 | 4 +- .../src/templates/globalconfig.out.arm-imx35 | 4 +- .../src/templates/globalconfig.out.arm-imx51 | 4 +- .../src/templates/globalconfig.out.arm-imx6 | 4 +- .../src/templates/globalconfig.out.arm-int-1 | 4 +- .../src/templates/globalconfig.out.arm-int-2 | 4 +- .../templates/globalconfig.out.arm-kirkwood | 4 +- .../templates/globalconfig.out.arm-omap3evm | 4 +- .../globalconfig.out.arm-omap4-panda | 4 +- .../src/templates/globalconfig.out.arm-pxa | 4 +- .../src/templates/globalconfig.out.arm-rv-1 | 4 +- .../src/templates/globalconfig.out.arm-rv-2 | 4 +- .../src/templates/globalconfig.out.arm-rv-3 | 4 +- .../templates/globalconfig.out.arm-rv-4-noinl | 4 +- .../src/templates/globalconfig.out.arm-s3c | 4 +- .../src/templates/globalconfig.out.arm-sa | 4 +- .../src/templates/globalconfig.out.arm-t2 | 27 +- .../src/templates/globalconfig.out.arm-v6 | 4 +- .../templates/globalconfig.out.arm-v6-mp-eb | 4 +- .../templates/globalconfig.out.arm-v6-mp-pb | 4 +- .../src/templates/globalconfig.out.arm-v7 | 4 +- .../src/templates/globalconfig.out.ux-2 | 1 - kernel/fiasco/tool/kconfig/Makefile | 18 +- kernel/fiasco/tool/kconfig/README | 2 +- .../tool/kconfig/scripts/Makefile.headersinst | 15 +- .../fiasco/tool/kconfig/scripts/Makefile.lib | 14 + .../tool/kconfig/scripts/Makefile.modpost | 7 +- .../tool/kconfig/scripts/basic/fixdep.c | 2 +- .../tool/kconfig/scripts/kconfig/Makefile | 3 + .../tool/kconfig/scripts/kconfig/conf.c | 7 +- .../tool/kconfig/scripts/kconfig/expr.c | 10 +- .../tool/kconfig/scripts/kconfig/gconf.c | 2 +- .../fiasco/tool/kconfig/scripts/kconfig/lkc.h | 8 + .../kconfig/lxdialog/check-lxdialog.sh | 1 + .../kconfig/scripts/kconfig/lxdialog/dialog.h | 1 - .../scripts/kconfig/lxdialog/inputbox.c | 121 +++++-- .../scripts/kconfig/lxdialog/menubox.c | 20 +- .../tool/kconfig/scripts/kconfig/mconf.c | 54 +-- .../tool/kconfig/scripts/kconfig/menu.c | 4 +- .../tool/kconfig/scripts/kconfig/nconf.c | 340 +++++++++--------- .../tool/kconfig/scripts/kconfig/nconf.gui.c | 2 +- .../tool/kconfig/scripts/kconfig/qconf.cc | 1 + .../tool/kconfig/scripts/kconfig/symbol.c | 12 +- .../tool/kconfig/scripts/kconfig/util.c | 23 +- .../tool/kconfig/scripts/kconfig/zconf.l | 8 +- .../scripts/kconfig/zconf.lex.c_shipped | 8 +- l4/mk/Makeconf | 2 +- l4/mk/defconfig/config.arm-rv | 2 + l4/pkg/l4re/include/env | 2 +- l4/pkg/l4re/include/impl/mem_alloc_impl.h | 6 +- l4/pkg/l4re/include/mem_alloc | 7 +- l4/pkg/l4re/util/include/kumem_alloc | 2 +- l4/pkg/l4re_c/include/mem_alloc.h | 45 ++- l4/pkg/l4re_c/lib/src/mem_alloc.cc | 7 +- l4/pkg/l4sys/include/ARCH-amd64/utcb.h | 2 +- l4/pkg/l4sys/include/ARCH-arm/L4API-l4f/ipc.h | 16 +- l4/pkg/l4sys/include/ARCH-arm/utcb.h | 6 +- .../l4sys/include/ARCH-ppc32/L4API-l4f/ipc.h | 214 ++--------- l4/pkg/l4sys/include/ARCH-ppc32/utcb.h | 2 +- .../l4sys/include/ARCH-sparc/L4API-l4f/ipc.h | 87 ++--- l4/pkg/l4sys/include/ARCH-x86/utcb.h | 2 +- l4/pkg/l4sys/include/__vm-vmx.h | 4 +- l4/pkg/l4sys/include/compiler.h | 2 + l4/pkg/l4sys/include/utcb.h | 30 +- l4/pkg/l4util/include/ARCH-amd64/cpu.h | 20 +- l4/pkg/l4util/include/ARCH-arm/irq.h | 36 +- l4/pkg/l4util/include/ARCH-sparc/irq.h | 14 +- l4/pkg/l4util/include/ARCH-x86/cpu.h | 15 +- l4/pkg/libc_backends/Control | 2 +- l4/pkg/libc_backends/lib/l4re_file/file.cc | 15 +- l4/pkg/libc_backends/lib/sig_noop/Makefile | 9 + l4/pkg/libc_backends/lib/sig_noop/sig.cc | 53 +++ l4/pkg/libcrypto/Control | 4 +- l4/pkg/libcrypto/examples/test/Makefile | 2 +- l4/pkg/libcrypto/include/private/linux.h | 58 +++ l4/pkg/libcrypto/include/private/sha1_linux.h | 93 ++++- l4/pkg/libcrypto/include/sha1.h | 9 +- l4/pkg/libcrypto/lib/Makefile | 2 +- l4/pkg/libcrypto/lib/sha1_linux_new/Makefile | 13 + .../libcrypto/lib/sha1_linux_new/cryptohash.h | 18 + l4/pkg/libcrypto/lib/sha1_linux_new/extra.h | 1 + l4/pkg/libcrypto/lib/sha1_linux_new/sha1.c | 212 +++++++++++ .../lib/sha1_linux_new/sha1_generic.c | 179 +++++++++ l4/pkg/libpng/lib/build/Makefile | 1 - l4/pkg/lxfuxlibc/include/lxfuxlc.h | 22 ++ l4/pkg/lxfuxlibc/lib/src/lxfuxlc.c | 15 + l4/pkg/moe/server/src/alloc.cc | 21 +- l4/pkg/moe/server/src/alloc.h | 3 +- l4/pkg/sqlite/lib/README | 2 +- l4/pkg/sqlite/lib/contrib/configure | 20 +- l4/pkg/sqlite/lib/contrib/configure.ac | 2 +- l4/pkg/sqlite/lib/contrib/sqlite3.c | 8 +- l4/pkg/sqlite/lib/contrib/sqlite3.h | 4 +- l4/tool/kconfig/Makefile | 18 +- l4/tool/kconfig/README | 2 +- l4/tool/kconfig/scripts/Makefile.headersinst | 15 +- l4/tool/kconfig/scripts/Makefile.lib | 14 + l4/tool/kconfig/scripts/Makefile.modpost | 7 +- l4/tool/kconfig/scripts/basic/fixdep.c | 2 +- l4/tool/kconfig/scripts/kconfig/Makefile | 3 + l4/tool/kconfig/scripts/kconfig/conf.c | 7 +- l4/tool/kconfig/scripts/kconfig/expr.c | 10 +- l4/tool/kconfig/scripts/kconfig/gconf.c | 2 +- l4/tool/kconfig/scripts/kconfig/lkc.h | 8 + .../kconfig/lxdialog/check-lxdialog.sh | 1 + .../kconfig/scripts/kconfig/lxdialog/dialog.h | 1 - .../scripts/kconfig/lxdialog/inputbox.c | 121 +++++-- .../scripts/kconfig/lxdialog/menubox.c | 20 +- l4/tool/kconfig/scripts/kconfig/mconf.c | 54 +-- l4/tool/kconfig/scripts/kconfig/menu.c | 4 +- l4/tool/kconfig/scripts/kconfig/nconf.c | 340 +++++++++--------- l4/tool/kconfig/scripts/kconfig/nconf.gui.c | 2 +- l4/tool/kconfig/scripts/kconfig/qconf.cc | 1 + l4/tool/kconfig/scripts/kconfig/symbol.c | 12 +- l4/tool/kconfig/scripts/kconfig/util.c | 23 +- l4/tool/kconfig/scripts/kconfig/zconf.l | 8 +- .../scripts/kconfig/zconf.lex.c_shipped | 8 +- 140 files changed, 2270 insertions(+), 1020 deletions(-) create mode 100644 kernel/fiasco/src/kern/arm/bsp/tegra/Kconfig create mode 100644 kernel/fiasco/src/kern/arm/bsp/tegra/Modules create mode 100644 kernel/fiasco/src/kern/arm/bsp/tegra/bootstrap-arm-tegra.cpp create mode 100644 kernel/fiasco/src/kern/arm/bsp/tegra/config-arm-tegra.cpp create mode 100644 kernel/fiasco/src/kern/arm/bsp/tegra/kernel_uart-arm-tegra.cpp create mode 100644 kernel/fiasco/src/kern/arm/bsp/tegra/mem_layout-arm-tegra.cpp create mode 100644 kernel/fiasco/src/kern/arm/bsp/tegra/outer_cache-arm-tegra.cpp create mode 100644 kernel/fiasco/src/kern/arm/bsp/tegra/pic-arm-tegra.cpp create mode 100644 kernel/fiasco/src/kern/arm/bsp/tegra/platform_control-arm-tegra.cpp create mode 100644 kernel/fiasco/src/kern/arm/bsp/tegra/reset-arm-tegra.cpp create mode 100644 kernel/fiasco/src/kern/arm/bsp/tegra/timer-arm-tegra.cpp create mode 100644 kernel/fiasco/src/kern/arm/bsp/tegra/uart-16550-arm-tegra.cpp create mode 100644 l4/pkg/libc_backends/lib/sig_noop/Makefile create mode 100644 l4/pkg/libc_backends/lib/sig_noop/sig.cc create mode 100644 l4/pkg/libcrypto/lib/sha1_linux_new/Makefile create mode 100644 l4/pkg/libcrypto/lib/sha1_linux_new/cryptohash.h create mode 100644 l4/pkg/libcrypto/lib/sha1_linux_new/extra.h create mode 100644 l4/pkg/libcrypto/lib/sha1_linux_new/sha1.c create mode 100644 l4/pkg/libcrypto/lib/sha1_linux_new/sha1_generic.c diff --git a/kernel/fiasco/src/jdb/ia32/jdb-ia32-amd64.cpp b/kernel/fiasco/src/jdb/ia32/jdb-ia32-amd64.cpp index a9145d58e..f3103f31a 100644 --- a/kernel/fiasco/src/jdb/ia32/jdb-ia32-amd64.cpp +++ b/kernel/fiasco/src/jdb/ia32/jdb-ia32-amd64.cpp @@ -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); diff --git a/kernel/fiasco/src/jdb/jdb.cpp b/kernel/fiasco/src/jdb/jdb.cpp index 6a944eec3..2e6334221 100644 --- a/kernel/fiasco/src/jdb/jdb.cpp +++ b/kernel/fiasco/src/jdb/jdb.cpp @@ -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; diff --git a/kernel/fiasco/src/jdb/ppc32/jdb-ppc32.cpp b/kernel/fiasco/src/jdb/ppc32/jdb-ppc32.cpp index cdc9d7b28..08bca1c4b 100644 --- a/kernel/fiasco/src/jdb/ppc32/jdb-ppc32.cpp +++ b/kernel/fiasco/src/jdb/ppc32/jdb-ppc32.cpp @@ -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 != '#') diff --git a/kernel/fiasco/src/jdb/sparc/jdb-sparc.cpp b/kernel/fiasco/src/jdb/sparc/jdb-sparc.cpp index 962cf2c75..a378ccc39 100644 --- a/kernel/fiasco/src/jdb/sparc/jdb-sparc.cpp +++ b/kernel/fiasco/src/jdb/sparc/jdb-sparc.cpp @@ -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 != '#') diff --git a/kernel/fiasco/src/kern/arm/bsp/exynos/pic-arm-gic-exynos.cpp b/kernel/fiasco/src/kern/arm/bsp/exynos/pic-arm-gic-exynos.cpp index 40d17baf8..6f6dd76a0 100644 --- a/kernel/fiasco/src/kern/arm/bsp/exynos/pic-arm-gic-exynos.cpp +++ b/kernel/fiasco/src/kern/arm/bsp/exynos/pic-arm-gic-exynos.cpp @@ -434,8 +434,8 @@ Mgr_int::Mgr_int() _cc = new Boot_object(); _wu_gc = new Boot_object(Kmem::Gpio2_phys_base); - _ei_gc1 = new Boot_object(Kmem::mmio_remap(Mem_layout::Gpio1_phys_base)); - _ei_gc2 = new Boot_object(Kmem::mmio_remap(Mem_layout::Gpio2_phys_base)); + _ei_gc1 = new Boot_object(Kmem::mmio_remap(Mem_layout::Gpio1_phys_base), 16 * 8); + _ei_gc2 = new Boot_object(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 index 000000000..9f4729448 --- /dev/null +++ b/kernel/fiasco/src/kern/arm/bsp/tegra/Kconfig @@ -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 index 000000000..3b6205138 --- /dev/null +++ b/kernel/fiasco/src/kern/arm/bsp/tegra/Modules @@ -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 index 000000000..f34355933 --- /dev/null +++ b/kernel/fiasco/src/kern/arm/bsp/tegra/bootstrap-arm-tegra.cpp @@ -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 index 000000000..94dba2eae --- /dev/null +++ b/kernel/fiasco/src/kern/arm/bsp/tegra/config-arm-tegra.cpp @@ -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 index 000000000..0221f01d1 --- /dev/null +++ b/kernel/fiasco/src/kern/arm/bsp/tegra/kernel_uart-arm-tegra.cpp @@ -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 index 000000000..f93a86e43 --- /dev/null +++ b/kernel/fiasco/src/kern/arm/bsp/tegra/mem_layout-arm-tegra.cpp @@ -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 index 000000000..620935d3a --- /dev/null +++ b/kernel/fiasco/src/kern/arm/bsp/tegra/outer_cache-arm-tegra.cpp @@ -0,0 +1,18 @@ +IMPLEMENTATION [arm && tegra && outer_cache_l2cxx0]: + +IMPLEMENT +Mword +Outer_cache::platform_init(Mword aux_control) +{ + l2cxx0->write(0x331, L2cxx0::TAG_RAM_CONTROL); + l2cxx0->write(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 index 000000000..0c500599c --- /dev/null +++ b/kernel/fiasco/src/kern/arm/bsp/tegra/pic-arm-tegra.cpp @@ -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(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 index 000000000..d5cbbf005 --- /dev/null +++ b/kernel/fiasco/src/kern/arm/bsp/tegra/platform_control-arm-tegra.cpp @@ -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(Kmem::mmio_remap(Clk_rst_ctrl_clk_cpu_cmplx)); + Io::write(r & ~(1 << 9), Kmem::mmio_remap(Clk_rst_ctrl_clk_cpu_cmplx)); + Io::write((1 << 13) | (1 << 9) | (1 << 5) | (1 << 1), + Kmem::mmio_remap(Clk_rst_ctrl_rst_cpu_cmplx_clr)); + + // kick cpu1 + Io::write(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(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(0x1111 << i, CLK_RST_CONTROLLER_RST_CPU_CMPLX_SET); + Mem::dmb(); + + // flowctrl halt + flow_ctrl.write(0, flowctrl_cpu_halt_ofs[i]); + flow_ctrl.read(flowctrl_cpu_halt_ofs[i]); + + if (!pwr_status(gate)) + { + pmc.write(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(1 << (8 + i), CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR_0); + clk_rst.read(CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR_0); + delay(); + + // remove clamping + pmc.write(1 << gate, PMC_PWRGATE_REMOVE_CLAMPING); + delay(); + + // clear flow csr + flow_ctrl.write(0, flowctrl_cpu_csr_ofs[i]); + Mem::wmb(); + flow_ctrl.read(flowctrl_cpu_csr_ofs[i]); + + // out of reset + clk_rst.write(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(_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(Kmem::mmio_remap(Reset_vector_addr)); + + // set (temporary) new reset vector + Io::write(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 index 000000000..b4ade0990 --- /dev/null +++ b/kernel/fiasco/src/kern/arm/bsp/tegra/reset-arm-tegra.cpp @@ -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(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 index 000000000..ccf0e75ea --- /dev/null +++ b/kernel/fiasco/src/kern/arm/bsp/tegra/timer-arm-tegra.cpp @@ -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 _tmr; + + struct Reg { enum + { + PTV = 0, + PCR = 4, + }; }; +}; + +// -------------------------------------------------------------------------- +IMPLEMENTATION [arm && tegra_timer_tmr]: + +#include "kmem.h" + +Static_object 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( (1 << 31) // enable + | (1 << 30) // periodic + | (Config::Scheduler_granularity & 0x1fffffff), + Reg::PTV); + } +} + + +PUBLIC static inline +void +Timer::acknowledge() +{ + _tmr->write(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 index 000000000..081c080e2 --- /dev/null +++ b/kernel/fiasco/src/kern/arm/bsp/tegra/uart-16550-arm-tegra.cpp @@ -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); +} diff --git a/kernel/fiasco/src/kern/arm/paging-arm.cpp b/kernel/fiasco/src/kern/arm/paging-arm.cpp index 5dda90ef6..7c010d31b 100644 --- a/kernel/fiasco/src/kern/arm/paging-arm.cpp +++ b/kernel/fiasco/src/kern/arm/paging-arm.cpp @@ -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]: diff --git a/kernel/fiasco/src/kern/ia32/vmx.cpp b/kernel/fiasco/src/kern/ia32/vmx.cpp index 6f0104707..58bcfc22d 100644 --- a/kernel/fiasco/src/kern/ia32/vmx.cpp +++ b/kernel/fiasco/src/kern/ia32/vmx.cpp @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-1 b/kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-1 index 6eec3f0d2..3bea4c6ea 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-1 +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-1 @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-2 b/kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-2 index 9eaf903ca..2703578af 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-2 +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-2 @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-vexpress-1 b/kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-vexpress-1 index 2706fa1d3..7fc296161 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-vexpress-1 +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-vexpress-1 @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-vexpress-2 b/kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-vexpress-2 index 0226ac141..9eaf7504d 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-vexpress-2 +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-a9-mp-vexpress-2 @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-imx21 b/kernel/fiasco/src/templates/globalconfig.out.arm-imx21 index 5345d4d35..92b13b214 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-imx21 +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-imx21 @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-imx35 b/kernel/fiasco/src/templates/globalconfig.out.arm-imx35 index 6ab4cb49b..d018eff89 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-imx35 +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-imx35 @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-imx51 b/kernel/fiasco/src/templates/globalconfig.out.arm-imx51 index 8e8ceba64..a836c3d63 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-imx51 +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-imx51 @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-imx6 b/kernel/fiasco/src/templates/globalconfig.out.arm-imx6 index 09116d9df..f7b466585 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-imx6 +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-imx6 @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-int-1 b/kernel/fiasco/src/templates/globalconfig.out.arm-int-1 index d148c9318..69d9dd5b5 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-int-1 +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-int-1 @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-int-2 b/kernel/fiasco/src/templates/globalconfig.out.arm-int-2 index 814dae081..b9c711098 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-int-2 +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-int-2 @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-kirkwood b/kernel/fiasco/src/templates/globalconfig.out.arm-kirkwood index 4f79252c3..fc88006e5 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-kirkwood +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-kirkwood @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-omap3evm b/kernel/fiasco/src/templates/globalconfig.out.arm-omap3evm index 5678cb0f3..d5638c63d 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-omap3evm +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-omap3evm @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-omap4-panda b/kernel/fiasco/src/templates/globalconfig.out.arm-omap4-panda index 884977112..e509b199e 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-omap4-panda +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-omap4-panda @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-pxa b/kernel/fiasco/src/templates/globalconfig.out.arm-pxa index 92cc2966a..66dba43d5 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-pxa +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-pxa @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-rv-1 b/kernel/fiasco/src/templates/globalconfig.out.arm-rv-1 index dd627549c..a2d19ca77 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-rv-1 +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-rv-1 @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-rv-2 b/kernel/fiasco/src/templates/globalconfig.out.arm-rv-2 index 33ad50799..fa6931279 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-rv-2 +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-rv-2 @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-rv-3 b/kernel/fiasco/src/templates/globalconfig.out.arm-rv-3 index 3e7347255..fbb189c8d 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-rv-3 +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-rv-3 @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-rv-4-noinl b/kernel/fiasco/src/templates/globalconfig.out.arm-rv-4-noinl index 29a746c3d..4a65cead7 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-rv-4-noinl +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-rv-4-noinl @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-s3c b/kernel/fiasco/src/templates/globalconfig.out.arm-s3c index 39dd12603..88f34a84e 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-s3c +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-s3c @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-sa b/kernel/fiasco/src/templates/globalconfig.out.arm-sa index 0b117918e..f947c6c63 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-sa +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-sa @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-t2 b/kernel/fiasco/src/templates/globalconfig.out.arm-t2 index bbcbea4de..f651a1c67 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-t2 +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-t2 @@ -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" diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-v6 b/kernel/fiasco/src/templates/globalconfig.out.arm-v6 index 8e3b7aa53..8ff08f9f8 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-v6 +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-v6 @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-v6-mp-eb b/kernel/fiasco/src/templates/globalconfig.out.arm-v6-mp-eb index 205a568ee..05897e87a 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-v6-mp-eb +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-v6-mp-eb @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-v6-mp-pb b/kernel/fiasco/src/templates/globalconfig.out.arm-v6-mp-pb index e2326df5e..e8139d50a 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-v6-mp-pb +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-v6-mp-pb @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.arm-v7 b/kernel/fiasco/src/templates/globalconfig.out.arm-v7 index 2512e4734..257f58527 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.arm-v7 +++ b/kernel/fiasco/src/templates/globalconfig.out.arm-v7 @@ -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 diff --git a/kernel/fiasco/src/templates/globalconfig.out.ux-2 b/kernel/fiasco/src/templates/globalconfig.out.ux-2 index da26698b3..c633f228e 100644 --- a/kernel/fiasco/src/templates/globalconfig.out.ux-2 +++ b/kernel/fiasco/src/templates/globalconfig.out.ux-2 @@ -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 diff --git a/kernel/fiasco/tool/kconfig/Makefile b/kernel/fiasco/tool/kconfig/Makefile index 614645ebe..85d02285f 100644 --- a/kernel/fiasco/tool/kconfig/Makefile +++ b/kernel/fiasco/tool/kconfig/Makefile @@ -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 diff --git a/kernel/fiasco/tool/kconfig/README b/kernel/fiasco/tool/kconfig/README index 7c04e2784..be58b4cba 100644 --- a/kernel/fiasco/tool/kconfig/README +++ b/kernel/fiasco/tool/kconfig/README @@ -1,3 +1,3 @@ -kconfig taken from vanilla Linux 3.8, and slightly patched. +kconfig taken from vanilla Linux 3.9, and slightly patched. diff --git a/kernel/fiasco/tool/kconfig/scripts/Makefile.headersinst b/kernel/fiasco/tool/kconfig/scripts/Makefile.headersinst index 06ba4a70b..477d137c0 100644 --- a/kernel/fiasco/tool/kconfig/scripts/Makefile.headersinst +++ b/kernel/fiasco/tool/kconfig/scripts/Makefile.headersinst @@ -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)) \ )) diff --git a/kernel/fiasco/tool/kconfig/scripts/Makefile.lib b/kernel/fiasco/tool/kconfig/scripts/Makefile.lib index bdf42fdf6..07125e697 100644 --- a/kernel/fiasco/tool/kconfig/scripts/Makefile.lib +++ b/kernel/fiasco/tool/kconfig/scripts/Makefile.lib @@ -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 # --------------------------------------------------------------------------- diff --git a/kernel/fiasco/tool/kconfig/scripts/Makefile.modpost b/kernel/fiasco/tool/kconfig/scripts/Makefile.modpost index a1cb0222e..cf82c8324 100644 --- a/kernel/fiasco/tool/kconfig/scripts/Makefile.modpost +++ b/kernel/fiasco/tool/kconfig/scripts/Makefile.modpost @@ -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 diff --git a/kernel/fiasco/tool/kconfig/scripts/basic/fixdep.c b/kernel/fiasco/tool/kconfig/scripts/basic/fixdep.c index cb1f50cf1..7f6425e24 100644 --- a/kernel/fiasco/tool/kconfig/scripts/basic/fixdep.c +++ b/kernel/fiasco/tool/kconfig/scripts/basic/fixdep.c @@ -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); } diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/Makefile b/kernel/fiasco/tool/kconfig/scripts/kconfig/Makefile index 3091794e9..231b4759c 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/Makefile +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/Makefile @@ -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) diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/conf.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/conf.c index 4da3b4adf..e39fcd814 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/conf.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/conf.c @@ -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) { diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/expr.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/expr.c index 290ce41f8..d6626521f 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/expr.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/expr.c @@ -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: diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/gconf.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/gconf.c index 7491559f2..35ddf225f 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/gconf.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/gconf.c @@ -10,6 +10,7 @@ # include #endif +#include #include "lkc.h" #include "images.c" @@ -22,7 +23,6 @@ #include #include #include -#include //#define DEBUG diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/lkc.h b/kernel/fiasco/tool/kconfig/scripts/kconfig/lkc.h index 97c967e62..593cd2a97 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/lkc.h +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/lkc.h @@ -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; diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/check-lxdialog.sh b/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/check-lxdialog.sh index c8e8a7154..80788137c 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/check-lxdialog.sh +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/check-lxdialog.sh @@ -21,6 +21,7 @@ ccflags() { if [ -f /usr/include/ncursesw/curses.h ]; then echo '-I/usr/include/ncursesw -DCURSES_LOC=""' + echo ' -DNCURSES_WIDECHAR=1' elif [ -f /usr/include/ncurses/ncurses.h ]; then echo '-I/usr/include/ncurses -DCURSES_LOC=""' elif [ -f /usr/include/ncurses/curses.h ]; then diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/dialog.h b/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/dialog.h index ee17a5264..307022a8b 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/dialog.h +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/dialog.h @@ -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); diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/inputbox.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/inputbox.c index dd8e587c5..21404a04d 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/inputbox.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/inputbox.c @@ -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 */ diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/menubox.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/menubox.c index 1d604738f..48d382e7e 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/menubox.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/menubox.c @@ -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; } diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/mconf.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/mconf.c index 53975cf87..566288a76 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/mconf.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/mconf.c @@ -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(); diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/menu.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/menu.c index e98a05c8e..f3bffa309 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/menu.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/menu.c @@ -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)) { /* diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/nconf.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/nconf.c index 87d4b15da..dbf31edd2 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/nconf.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/nconf.c @@ -7,215 +7,208 @@ */ #define _GNU_SOURCE #include +#include #include "lkc.h" #include "nconf.h" #include -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 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 .\n" "\n" -"To change any of these features, highlight it with the cursor\n" -"keys and press to build it in, to make it a module or\n" -" to removed it. You may also press the 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 , or if in a data entry window then press .\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 or . Goto submenu by \n" -" pressing of . Use or 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 and 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 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 or .\n" +"To change any of these features, highlight it with the movement keys\n" +"listed below and press to build it in, to make it a module or\n" +" to remove it. You may press the key to cycle through the\n" +"available options.\n" "\n" -"o To get help with an item, press \n" -" Shortcut: Press 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" -" or the .\n" +"Menu navigation keys\n" +"----------------------------------------------------------------------\n" +"Linewise up \n" +"Linewise down \n" +"Pagewise up \n" +"Pagewise down \n" +"First entry \n" +"Last entry \n" +"Enter a submenu \n" +"Go back to parent menu \n" +"Close a help window \n" +"Close entry window, apply \n" +"Close entry window, forget \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 \n" +" Jump to next hit \n" +" Jump to previous hit \n" +"Exit menu search mode \n" +"Search for configuration variables with or without leading CONFIG_\n" +" RegExpr\n" +"Verbose search help \n" +"----------------------------------------------------------------------\n" "\n" -" Shortcut: Press the first letter of the option you wish to set then\n" -" press or .\n" +"Unless in a data entry window, key <1> may be used instead of ,\n" +"<2> instead of , etc.\n" "\n" -"o To see available help for the item, press \n" -" Shortcut: Press 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 .\n" "\n" -"Data Entry\n" -"-----------\n" -"o Enter the requested information and press \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 .\n" +"Data entry\n" +"----------\n" +"Enter the requested information and press . 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 , and 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 , , , , or to exit.\n" +"Press any of 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 to save your current configuration. Press 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" -" will then unroll the appropriate category, or enfold it if it\n" -"is already unrolled.\n" +" 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" -" or selects submenus --->.\n" -" Capital Letters are hotkeys.\n" -" Pressing includes, excludes, modularizes features.\n" -" Pressing SpaceBar toggles between the above options.\n" -" Press or to go back one menu,\n" -" or for Help, for Search.\n" -" <1> is interchangeable with , <2> with , etc.\n" -" Legend: [*] built-in [ ] excluded module < > module capable.\n" -" always leaves the current window.\n"), +"Legend: [*] built-in [ ] excluded 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 and .\n" +"Enter a submenu with or .\n" +"Exit a submenu to its parent menu with or .\n" +"Pressing includes, excludes, modularizes features.\n" +"Pressing cycles through the available options.\n" +"To search for menu entries press .\n" +" always leaves the current window.\n" +"\n" +"You do not have function keys support.\n" +"Press <1> instead of , <2> instead of , etc.\n" +"For verbose global help use key <1>.\n" +"For help related to the current menu entry press or .\n"), menu_instructions[] = N_( -" Arrow keys navigate the menu.\n" -" or selects submenus --->.\n" -" Capital Letters are hotkeys.\n" -" Pressing includes, excludes, modularizes features.\n" -" Pressing SpaceBar toggles between the above options\n" -" Press , or to go back one menu,\n" -" , or for Help, for Search.\n" -" <1> is interchangeable with , <2> with , etc.\n" -" Legend: [*] built-in [ ] excluded module < > module capable.\n" -" always leaves the current window\n"), +"Legend: [*] built-in [ ] excluded 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 or .\n" +"Enter a submenu with or .\n" +"Exit a submenu to its parent menu with or .\n" +"Pressing includes, excludes, modularizes features.\n" +"Pressing cycles through the available options.\n" +"To search for menu entries press .\n" +" always leaves the current window.\n" +"\n" +"Pressing <1> may be used instead of , <2> instead of , etc.\n" +"For verbose global help press .\n" +"For help related to the current menu entry press or .\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 .\n" -" Press , or for additional information about this option.\n"), +"Press , , or to navigate a radiolist, select\n" +"with .\n" +"For help related to the current entry press or .\n" +"For global help press .\n"), inputbox_instructions_int[] = N_( "Please enter a decimal value.\n" "Fractions will not be accepted.\n" -"Press to accept, to cancel."), +"Press to apply, to cancel."), inputbox_instructions_hex[] = N_( "Please enter a hexadecimal value.\n" -"Press to accept, to cancel."), +"Press to apply, to cancel."), inputbox_instructions_string[] = N_( "Please enter a string value.\n" -"Press to accept, to cancel."), +"Press to apply, 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); } diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/nconf.gui.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/nconf.gui.c index 379003c7a..9f8c44ecc 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/nconf.gui.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/nconf.gui.c @@ -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: diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/qconf.cc b/kernel/fiasco/tool/kconfig/scripts/kconfig/qconf.cc index df274febb..1500c38f0 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/qconf.cc +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/qconf.cc @@ -6,6 +6,7 @@ #include #if QT_VERSION < 0x040000 +#include #include #include #include diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/symbol.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/symbol.c index 22a3c400f..ecc5aa5f8 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/symbol.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/symbol.c @@ -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; diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/util.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/util.c index d0b8b2318..6e7fbf196 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/util.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/util.c @@ -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); +} + + diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/zconf.l b/kernel/fiasco/tool/kconfig/scripts/kconfig/zconf.l index 00f9d3a9c..6555a4754 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/zconf.l +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/zconf.l @@ -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; diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/zconf.lex.c_shipped b/kernel/fiasco/tool/kconfig/scripts/kconfig/zconf.lex.c_shipped index c32b1a49f..a0521aa59 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/zconf.lex.c_shipped +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/zconf.lex.c_shipped @@ -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; diff --git a/l4/mk/Makeconf b/l4/mk/Makeconf index 6391db03d..c96e3f73a 100644 --- a/l4/mk/Makeconf +++ b/l4/mk/Makeconf @@ -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) diff --git a/l4/mk/defconfig/config.arm-rv b/l4/mk/defconfig/config.arm-rv index 5f6704c90..df93e75ff 100644 --- a/l4/mk/defconfig/config.arm-rv +++ b/l4/mk/defconfig/config.arm-rv @@ -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 diff --git a/l4/pkg/l4re/include/env b/l4/pkg/l4re/include/env index 217ac0663..73f2df1c6 100644 --- a/l4/pkg/l4re/include/env +++ b/l4/pkg/l4re/include/env @@ -201,7 +201,7 @@ namespace L4Re if (Cap_entry const *e = get(name, l)) return L4::Cap(e->cap); - return L4::Cap(-L4_ENOENT); //L4::Cap::Invalid; + return L4::Cap(-L4_ENOENT); } /** diff --git a/l4/pkg/l4re/include/impl/mem_alloc_impl.h b/l4/pkg/l4re/include/impl/mem_alloc_impl.h index 3fdb0f049..1c3cce19b 100644 --- a/l4/pkg/l4re/include/impl/mem_alloc_impl.h +++ b/l4/pkg/l4re/include/impl/mem_alloc_impl.h @@ -36,12 +36,14 @@ namespace L4Re long Mem_alloc::alloc(unsigned long size, - L4::Cap mem, unsigned long flags) const throw() + L4::Cap mem, unsigned long flags, + unsigned long align) const throw() { L4::Cap 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 diff --git a/l4/pkg/l4re/include/mem_alloc b/l4/pkg/l4re/include/mem_alloc index 7e6910b96..81169a3e8 100644 --- a/l4/pkg/l4re/include/mem_alloc +++ b/l4/pkg/l4re/include/mem_alloc @@ -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 mem, - unsigned long flags = 0) const throw(); + unsigned long flags = 0, unsigned long align = 0) const throw(); /** * \brief Free data space. * diff --git a/l4/pkg/l4re/util/include/kumem_alloc b/l4/pkg/l4re/util/include/kumem_alloc index 6c20128ee..2413b7b7e 100644 --- a/l4/pkg/l4re/util/include/kumem_alloc +++ b/l4/pkg/l4re/util/include/kumem_alloc @@ -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. * diff --git a/l4/pkg/l4re_c/include/mem_alloc.h b/l4/pkg/l4re_c/include/mem_alloc.h index 5141e9f22..2faa37cfd 100644 --- a/l4/pkg/l4re_c/include/mem_alloc.h +++ b/l4/pkg/l4re_c/include/mem_alloc.h @@ -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 diff --git a/l4/pkg/l4re_c/lib/src/mem_alloc.cc b/l4/pkg/l4re_c/lib/src/mem_alloc.cc index b96df5122..e72467e01 100644 --- a/l4/pkg/l4re_c/lib/src/mem_alloc.cc +++ b/l4/pkg/l4re_c/lib/src/mem_alloc.cc @@ -26,12 +26,13 @@ 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 x(srv); L4::Cap ds(mem); - return x->alloc(size, ds, flags); + return x->alloc(size, ds, flags, align); } long diff --git a/l4/pkg/l4sys/include/ARCH-amd64/utcb.h b/l4/pkg/l4sys/include/ARCH-amd64/utcb.h index 23460e2d8..58b91a2da 100644 --- a/l4/pkg/l4sys/include/ARCH-amd64/utcb.h +++ b/l4/pkg/l4sys/include/ARCH-amd64/utcb.h @@ -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; } diff --git a/l4/pkg/l4sys/include/ARCH-arm/L4API-l4f/ipc.h b/l4/pkg/l4sys/include/ARCH-arm/L4API-l4f/ipc.h index 17967fd2d..b64018755 100644 --- a/l4/pkg/l4sys/include/ARCH-arm/L4API-l4f/ipc.h +++ b/l4/pkg/l4sys/include/ARCH-arm/L4API-l4f/ipc.h @@ -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; } diff --git a/l4/pkg/l4sys/include/ARCH-arm/utcb.h b/l4/pkg/l4sys/include/ARCH-arm/utcb.h index 24d334991..37dcac4bb 100644 --- a/l4/pkg/l4sys/include/ARCH-arm/utcb.h +++ b/l4/pkg/l4sys/include/ARCH-arm/utcb.h @@ -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 diff --git a/l4/pkg/l4sys/include/ARCH-ppc32/L4API-l4f/ipc.h b/l4/pkg/l4sys/include/ARCH-ppc32/L4API-l4f/ipc.h index e1a3e8293..e06a8140f 100644 --- a/l4/pkg/l4sys/include/ARCH-ppc32/L4API-l4f/ipc.h +++ b/l4/pkg/l4sys/include/ARCH-ppc32/L4API-l4f/ipc.h @@ -36,65 +36,52 @@ #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 diff --git a/l4/pkg/l4sys/include/ARCH-ppc32/utcb.h b/l4/pkg/l4sys/include/ARCH-ppc32/utcb.h index 8ede8d975..bfdeb44ff 100644 --- a/l4/pkg/l4sys/include/ARCH-ppc32/utcb.h +++ b/l4/pkg/l4sys/include/ARCH-ppc32/utcb.h @@ -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) : ); diff --git a/l4/pkg/l4sys/include/ARCH-sparc/L4API-l4f/ipc.h b/l4/pkg/l4sys/include/ARCH-sparc/L4API-l4f/ipc.h index ea4ca87c8..5963ba1b7 100644 --- a/l4/pkg/l4sys/include/ARCH-sparc/L4API-l4f/ipc.h +++ b/l4/pkg/l4sys/include/ARCH-sparc/L4API-l4f/ipc.h @@ -31,48 +31,49 @@ #include 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 #endif //__GNUC__ diff --git a/l4/pkg/l4sys/include/ARCH-x86/utcb.h b/l4/pkg/l4sys/include/ARCH-x86/utcb.h index 4973a9a6d..db5f0c87b 100644 --- a/l4/pkg/l4sys/include/ARCH-x86/utcb.h +++ b/l4/pkg/l4sys/include/ARCH-x86/utcb.h @@ -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; } diff --git a/l4/pkg/l4sys/include/__vm-vmx.h b/l4/pkg/l4sys/include/__vm-vmx.h index 3ed3c0f46..7df12f20d 100644 --- a/l4/pkg/l4sys/include/__vm-vmx.h +++ b/l4/pkg/l4sys/include/__vm-vmx.h @@ -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 diff --git a/l4/pkg/l4sys/include/compiler.h b/l4/pkg/l4sys/include/compiler.h index ab76bc24e..3fd145a60 100644 --- a/l4/pkg/l4sys/include/compiler.h +++ b/l4/pkg/l4sys/include/compiler.h @@ -218,6 +218,8 @@ */ #define L4_NORETURN __attribute__((noreturn)) +#define L4_PURE __attribute__((pure)) + /** * No instrumentation function attribute. * \hideinitializer diff --git a/l4/pkg/l4sys/include/utcb.h b/l4/pkg/l4sys/include/utcb.h index 18dd3743a..eec61c906 100644 --- a/l4/pkg/l4sys/include/utcb.h +++ b/l4/pkg/l4sys/include/utcb.h @@ -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. diff --git a/l4/pkg/l4util/include/ARCH-amd64/cpu.h b/l4/pkg/l4util/include/ARCH-amd64/cpu.h index 5f8d83140..c47bef0e9 100644 --- a/l4/pkg/l4util/include/ARCH-amd64/cpu.h +++ b/l4/pkg/l4util/include/ARCH-amd64/cpu.h @@ -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 diff --git a/l4/pkg/l4util/include/ARCH-arm/irq.h b/l4/pkg/l4util/include/ARCH-arm/irq.h index 2fe6f5c28..2c4aa968d 100644 --- a/l4/pkg/l4util/include/ARCH-arm/irq.h +++ b/l4/pkg/l4util/include/ARCH-arm/irq.h @@ -18,7 +18,6 @@ #ifdef __GNUC__ -#include #include 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 diff --git a/l4/pkg/l4util/include/ARCH-sparc/irq.h b/l4/pkg/l4util/include/ARCH-sparc/irq.h index 6d5e1c804..c8e036971 100644 --- a/l4/pkg/l4util/include/ARCH-sparc/irq.h +++ b/l4/pkg/l4util/include/ARCH-sparc/irq.h @@ -1,7 +1,7 @@ #ifndef __L4UTIL_SPARC_IRQ_H #define __L4UTIL_SPARC_IRQ_H -#include +#include 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 diff --git a/l4/pkg/l4util/include/ARCH-x86/cpu.h b/l4/pkg/l4util/include/ARCH-x86/cpu.h index 7ef1ae7ef..9f5cb9429 100644 --- a/l4/pkg/l4util/include/ARCH-x86/cpu.h +++ b/l4/pkg/l4util/include/ARCH-x86/cpu.h @@ -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 diff --git a/l4/pkg/libc_backends/Control b/l4/pkg/libc_backends/Control index 0692e84e3..be184ad13 100644 --- a/l4/pkg/libc_backends/Control +++ b/l4/pkg/libc_backends/Control @@ -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 diff --git a/l4/pkg/libc_backends/lib/l4re_file/file.cc b/l4/pkg/libc_backends/lib/l4re_file/file.cc index 230a026fb..0b993e263 100644 --- a/l4/pkg/libc_backends/lib/l4re_file/file.cc +++ b/l4/pkg/libc_backends/lib/l4re_file/file.cc @@ -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 dir1; \ + cxx::Ref_ptr 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 index 000000000..21e0d9333 --- /dev/null +++ b/l4/pkg/libc_backends/lib/sig_noop/Makefile @@ -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 index 000000000..82b42709b --- /dev/null +++ b/l4/pkg/libc_backends/lib/sig_noop/sig.cc @@ -0,0 +1,53 @@ +/* + * NOOP POSIX signal backend + * + * (c) 2013 Bjoern Doebel , + * 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 +#include + +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; +} + diff --git a/l4/pkg/libcrypto/Control b/l4/pkg/libcrypto/Control index af2637076..a81480a4c 100644 --- a/l4/pkg/libcrypto/Control +++ b/l4/pkg/libcrypto/Control @@ -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 diff --git a/l4/pkg/libcrypto/examples/test/Makefile b/l4/pkg/libcrypto/examples/test/Makefile index a96dd0d60..97e37c095 100644 --- a/l4/pkg/libcrypto/examples/test/Makefile +++ b/l4/pkg/libcrypto/examples/test/Makefile @@ -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 diff --git a/l4/pkg/libcrypto/include/private/linux.h b/l4/pkg/libcrypto/include/private/linux.h index 53f21fbb8..44309a202 100644 --- a/l4/pkg/libcrypto/include/private/linux.h +++ b/l4/pkg/libcrypto/include/private/linux.h @@ -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 */ diff --git a/l4/pkg/libcrypto/include/private/sha1_linux.h b/l4/pkg/libcrypto/include/private/sha1_linux.h index f3a183eee..03f0b7c6f 100644 --- a/l4/pkg/libcrypto/include/private/sha1_linux.h +++ b/l4/pkg/libcrypto/include/private/sha1_linux.h @@ -4,7 +4,7 @@ * \author Carsten Weinhold */ /* - * Copyright (C) 2006 Carsten Weinhold + * Copyright (C) 2006-2012 Carsten Weinhold * Technische Universitaet Dresden, Operating Systems Research Group * * This file is part of the libcrypto package, which is distributed under @@ -17,11 +17,96 @@ #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 */ diff --git a/l4/pkg/libcrypto/include/sha1.h b/l4/pkg/libcrypto/include/sha1.h index 83a1ae8cb..1cc4488ef 100644 --- a/l4/pkg/libcrypto/include/sha1.h +++ b/l4/pkg/libcrypto/include/sha1.h @@ -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]; diff --git a/l4/pkg/libcrypto/lib/Makefile b/l4/pkg/libcrypto/lib/Makefile index 19b5cc2eb..5d86487ba 100644 --- a/l4/pkg/libcrypto/lib/Makefile +++ b/l4/pkg/libcrypto/lib/Makefile @@ -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 index 000000000..ad82d9646 --- /dev/null +++ b/l4/pkg/libcrypto/lib/sha1_linux_new/Makefile @@ -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 index 000000000..2cd9f1cf9 --- /dev/null +++ b/l4/pkg/libcrypto/lib/sha1_linux_new/cryptohash.h @@ -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 index 000000000..8b1378917 --- /dev/null +++ b/l4/pkg/libcrypto/lib/sha1_linux_new/extra.h @@ -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 index 000000000..4926a17b4 --- /dev/null +++ b/l4/pkg/libcrypto/lib/sha1_linux_new/sha1.c @@ -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 +#include +#include +#include +#include + +#else + +#define __LIBCRYPTO_INTERNAL__ +#include +#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 index 000000000..f4ab79c05 --- /dev/null +++ b/l4/pkg/libcrypto/lib/sha1_linux_new/sha1_generic.c @@ -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 + * Copyright (c) Jean-Francois Dive + * + * 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 +#include +#include +#include +#include +#include +#include + +#else + +#include + +#define __LIBCRYPTO_INTERNAL__ +#include +//#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 */ diff --git a/l4/pkg/libpng/lib/build/Makefile b/l4/pkg/libpng/lib/build/Makefile index 772f1e0eb..02dd2210e 100644 --- a/l4/pkg/libpng/lib/build/Makefile +++ b/l4/pkg/libpng/lib/build/Makefile @@ -2,7 +2,6 @@ PKGDIR ?= ../.. L4DIR ?= $(PKGDIR)/../.. TARGET = libl4png.a libl4png.so -#LIBS = $(GCCLIB) REQUIRES_LIBS = zlib CONTRIB_INCDIR = libpng diff --git a/l4/pkg/lxfuxlibc/include/lxfuxlc.h b/l4/pkg/lxfuxlibc/include/lxfuxlc.h index ecd6cb52b..045991dd1 100644 --- a/l4/pkg/lxfuxlibc/include/lxfuxlc.h +++ b/l4/pkg/lxfuxlibc/include/lxfuxlc.h @@ -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); diff --git a/l4/pkg/lxfuxlibc/lib/src/lxfuxlc.c b/l4/pkg/lxfuxlibc/lib/src/lxfuxlc.c index 7408a3508..0595a7429 100644 --- a/l4/pkg/lxfuxlibc/lib/src/lxfuxlc.c +++ b/l4/pkg/lxfuxlibc/lib/src/lxfuxlc.c @@ -33,13 +33,16 @@ #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 /* ======================================================================== diff --git a/l4/pkg/moe/server/src/alloc.cc b/l4/pkg/moe/server/src/alloc.cc index 7d206fe26..66259a5ee 100644 --- a/l4/pkg/moe/server/src/alloc.cc +++ b/l4/pkg/moe/server/src/alloc.cc @@ -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(align, L4_SUPERPAGESHIFT); + else + align = cxx::max(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() << "; " << flags.value() << "\n"; cxx::Auto_ptr mo(alloc(size.value(), - flags.is_of_int() ? flags.value() : 0)); + flags.is_of_int() ? flags.value() : 0, + align.is_of_int() ? align.value() : 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 mo(alloc(size,flags)); diff --git a/l4/pkg/moe/server/src/alloc.h b/l4/pkg/moe/server/src/alloc.h index 8b6a59ffb..854ba2db9 100644 --- a/l4/pkg/moe/server/src/alloc.h +++ b/l4/pkg/moe/server/src/alloc.h @@ -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(); diff --git a/l4/pkg/sqlite/lib/README b/l4/pkg/sqlite/lib/README index 6b9d539be..dbcee7429 100644 --- a/l4/pkg/sqlite/lib/README +++ b/l4/pkg/sqlite/lib/README @@ -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. diff --git a/l4/pkg/sqlite/lib/contrib/configure b/l4/pkg/sqlite/lib/contrib/configure index 48205bbca..568b9b8cf 100755 --- a/l4/pkg/sqlite/lib/contrib/configure +++ b/l4/pkg/sqlite/lib/contrib/configure @@ -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 . # @@ -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\\" diff --git a/l4/pkg/sqlite/lib/contrib/configure.ac b/l4/pkg/sqlite/lib/contrib/configure.ac index 9560f9147..9980d4edb 100644 --- a/l4/pkg/sqlite/lib/contrib/configure.ac +++ b/l4/pkg/sqlite/lib/contrib/configure.ac @@ -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. diff --git a/l4/pkg/sqlite/lib/contrib/sqlite3.c b/l4/pkg/sqlite/lib/contrib/sqlite3.c index 7b957a8aa..ca12d7e0a 100644 --- a/l4/pkg/sqlite/lib/contrib/sqlite3.c +++ b/l4/pkg/sqlite/lib/contrib/sqlite3.c @@ -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); } diff --git a/l4/pkg/sqlite/lib/contrib/sqlite3.h b/l4/pkg/sqlite/lib/contrib/sqlite3.h index 1332eb162..69b4586a3 100644 --- a/l4/pkg/sqlite/lib/contrib/sqlite3.h +++ b/l4/pkg/sqlite/lib/contrib/sqlite3.h @@ -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 diff --git a/l4/tool/kconfig/Makefile b/l4/tool/kconfig/Makefile index 614645ebe..85d02285f 100644 --- a/l4/tool/kconfig/Makefile +++ b/l4/tool/kconfig/Makefile @@ -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 diff --git a/l4/tool/kconfig/README b/l4/tool/kconfig/README index 7c04e2784..be58b4cba 100644 --- a/l4/tool/kconfig/README +++ b/l4/tool/kconfig/README @@ -1,3 +1,3 @@ -kconfig taken from vanilla Linux 3.8, and slightly patched. +kconfig taken from vanilla Linux 3.9, and slightly patched. diff --git a/l4/tool/kconfig/scripts/Makefile.headersinst b/l4/tool/kconfig/scripts/Makefile.headersinst index 06ba4a70b..477d137c0 100644 --- a/l4/tool/kconfig/scripts/Makefile.headersinst +++ b/l4/tool/kconfig/scripts/Makefile.headersinst @@ -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)) \ )) diff --git a/l4/tool/kconfig/scripts/Makefile.lib b/l4/tool/kconfig/scripts/Makefile.lib index bdf42fdf6..07125e697 100644 --- a/l4/tool/kconfig/scripts/Makefile.lib +++ b/l4/tool/kconfig/scripts/Makefile.lib @@ -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 # --------------------------------------------------------------------------- diff --git a/l4/tool/kconfig/scripts/Makefile.modpost b/l4/tool/kconfig/scripts/Makefile.modpost index a1cb0222e..cf82c8324 100644 --- a/l4/tool/kconfig/scripts/Makefile.modpost +++ b/l4/tool/kconfig/scripts/Makefile.modpost @@ -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 diff --git a/l4/tool/kconfig/scripts/basic/fixdep.c b/l4/tool/kconfig/scripts/basic/fixdep.c index cb1f50cf1..7f6425e24 100644 --- a/l4/tool/kconfig/scripts/basic/fixdep.c +++ b/l4/tool/kconfig/scripts/basic/fixdep.c @@ -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); } diff --git a/l4/tool/kconfig/scripts/kconfig/Makefile b/l4/tool/kconfig/scripts/kconfig/Makefile index 3091794e9..231b4759c 100644 --- a/l4/tool/kconfig/scripts/kconfig/Makefile +++ b/l4/tool/kconfig/scripts/kconfig/Makefile @@ -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) diff --git a/l4/tool/kconfig/scripts/kconfig/conf.c b/l4/tool/kconfig/scripts/kconfig/conf.c index 4da3b4adf..e39fcd814 100644 --- a/l4/tool/kconfig/scripts/kconfig/conf.c +++ b/l4/tool/kconfig/scripts/kconfig/conf.c @@ -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) { diff --git a/l4/tool/kconfig/scripts/kconfig/expr.c b/l4/tool/kconfig/scripts/kconfig/expr.c index 290ce41f8..d6626521f 100644 --- a/l4/tool/kconfig/scripts/kconfig/expr.c +++ b/l4/tool/kconfig/scripts/kconfig/expr.c @@ -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: diff --git a/l4/tool/kconfig/scripts/kconfig/gconf.c b/l4/tool/kconfig/scripts/kconfig/gconf.c index 7491559f2..35ddf225f 100644 --- a/l4/tool/kconfig/scripts/kconfig/gconf.c +++ b/l4/tool/kconfig/scripts/kconfig/gconf.c @@ -10,6 +10,7 @@ # include #endif +#include #include "lkc.h" #include "images.c" @@ -22,7 +23,6 @@ #include #include #include -#include //#define DEBUG diff --git a/l4/tool/kconfig/scripts/kconfig/lkc.h b/l4/tool/kconfig/scripts/kconfig/lkc.h index f7032ff7d..7cd4610d4 100644 --- a/l4/tool/kconfig/scripts/kconfig/lkc.h +++ b/l4/tool/kconfig/scripts/kconfig/lkc.h @@ -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; diff --git a/l4/tool/kconfig/scripts/kconfig/lxdialog/check-lxdialog.sh b/l4/tool/kconfig/scripts/kconfig/lxdialog/check-lxdialog.sh index c8e8a7154..80788137c 100644 --- a/l4/tool/kconfig/scripts/kconfig/lxdialog/check-lxdialog.sh +++ b/l4/tool/kconfig/scripts/kconfig/lxdialog/check-lxdialog.sh @@ -21,6 +21,7 @@ ccflags() { if [ -f /usr/include/ncursesw/curses.h ]; then echo '-I/usr/include/ncursesw -DCURSES_LOC=""' + echo ' -DNCURSES_WIDECHAR=1' elif [ -f /usr/include/ncurses/ncurses.h ]; then echo '-I/usr/include/ncurses -DCURSES_LOC=""' elif [ -f /usr/include/ncurses/curses.h ]; then diff --git a/l4/tool/kconfig/scripts/kconfig/lxdialog/dialog.h b/l4/tool/kconfig/scripts/kconfig/lxdialog/dialog.h index ee17a5264..307022a8b 100644 --- a/l4/tool/kconfig/scripts/kconfig/lxdialog/dialog.h +++ b/l4/tool/kconfig/scripts/kconfig/lxdialog/dialog.h @@ -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); diff --git a/l4/tool/kconfig/scripts/kconfig/lxdialog/inputbox.c b/l4/tool/kconfig/scripts/kconfig/lxdialog/inputbox.c index dd8e587c5..21404a04d 100644 --- a/l4/tool/kconfig/scripts/kconfig/lxdialog/inputbox.c +++ b/l4/tool/kconfig/scripts/kconfig/lxdialog/inputbox.c @@ -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 */ diff --git a/l4/tool/kconfig/scripts/kconfig/lxdialog/menubox.c b/l4/tool/kconfig/scripts/kconfig/lxdialog/menubox.c index 1d604738f..48d382e7e 100644 --- a/l4/tool/kconfig/scripts/kconfig/lxdialog/menubox.c +++ b/l4/tool/kconfig/scripts/kconfig/lxdialog/menubox.c @@ -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; } diff --git a/l4/tool/kconfig/scripts/kconfig/mconf.c b/l4/tool/kconfig/scripts/kconfig/mconf.c index 53975cf87..566288a76 100644 --- a/l4/tool/kconfig/scripts/kconfig/mconf.c +++ b/l4/tool/kconfig/scripts/kconfig/mconf.c @@ -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(); diff --git a/l4/tool/kconfig/scripts/kconfig/menu.c b/l4/tool/kconfig/scripts/kconfig/menu.c index e98a05c8e..f3bffa309 100644 --- a/l4/tool/kconfig/scripts/kconfig/menu.c +++ b/l4/tool/kconfig/scripts/kconfig/menu.c @@ -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)) { /* diff --git a/l4/tool/kconfig/scripts/kconfig/nconf.c b/l4/tool/kconfig/scripts/kconfig/nconf.c index 87d4b15da..dbf31edd2 100644 --- a/l4/tool/kconfig/scripts/kconfig/nconf.c +++ b/l4/tool/kconfig/scripts/kconfig/nconf.c @@ -7,215 +7,208 @@ */ #define _GNU_SOURCE #include +#include #include "lkc.h" #include "nconf.h" #include -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 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 .\n" "\n" -"To change any of these features, highlight it with the cursor\n" -"keys and press to build it in, to make it a module or\n" -" to removed it. You may also press the 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 , or if in a data entry window then press .\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 or . Goto submenu by \n" -" pressing of . Use or 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 and 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 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 or .\n" +"To change any of these features, highlight it with the movement keys\n" +"listed below and press to build it in, to make it a module or\n" +" to remove it. You may press the key to cycle through the\n" +"available options.\n" "\n" -"o To get help with an item, press \n" -" Shortcut: Press 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" -" or the .\n" +"Menu navigation keys\n" +"----------------------------------------------------------------------\n" +"Linewise up \n" +"Linewise down \n" +"Pagewise up \n" +"Pagewise down \n" +"First entry \n" +"Last entry \n" +"Enter a submenu \n" +"Go back to parent menu \n" +"Close a help window \n" +"Close entry window, apply \n" +"Close entry window, forget \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 \n" +" Jump to next hit \n" +" Jump to previous hit \n" +"Exit menu search mode \n" +"Search for configuration variables with or without leading CONFIG_\n" +" RegExpr\n" +"Verbose search help \n" +"----------------------------------------------------------------------\n" "\n" -" Shortcut: Press the first letter of the option you wish to set then\n" -" press or .\n" +"Unless in a data entry window, key <1> may be used instead of ,\n" +"<2> instead of , etc.\n" "\n" -"o To see available help for the item, press \n" -" Shortcut: Press 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 .\n" "\n" -"Data Entry\n" -"-----------\n" -"o Enter the requested information and press \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 .\n" +"Data entry\n" +"----------\n" +"Enter the requested information and press . 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 , and 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 , , , , or to exit.\n" +"Press any of 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 to save your current configuration. Press 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" -" will then unroll the appropriate category, or enfold it if it\n" -"is already unrolled.\n" +" 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" -" or selects submenus --->.\n" -" Capital Letters are hotkeys.\n" -" Pressing includes, excludes, modularizes features.\n" -" Pressing SpaceBar toggles between the above options.\n" -" Press or to go back one menu,\n" -" or for Help, for Search.\n" -" <1> is interchangeable with , <2> with , etc.\n" -" Legend: [*] built-in [ ] excluded module < > module capable.\n" -" always leaves the current window.\n"), +"Legend: [*] built-in [ ] excluded 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 and .\n" +"Enter a submenu with or .\n" +"Exit a submenu to its parent menu with or .\n" +"Pressing includes, excludes, modularizes features.\n" +"Pressing cycles through the available options.\n" +"To search for menu entries press .\n" +" always leaves the current window.\n" +"\n" +"You do not have function keys support.\n" +"Press <1> instead of , <2> instead of , etc.\n" +"For verbose global help use key <1>.\n" +"For help related to the current menu entry press or .\n"), menu_instructions[] = N_( -" Arrow keys navigate the menu.\n" -" or selects submenus --->.\n" -" Capital Letters are hotkeys.\n" -" Pressing includes, excludes, modularizes features.\n" -" Pressing SpaceBar toggles between the above options\n" -" Press , or to go back one menu,\n" -" , or for Help, for Search.\n" -" <1> is interchangeable with , <2> with , etc.\n" -" Legend: [*] built-in [ ] excluded module < > module capable.\n" -" always leaves the current window\n"), +"Legend: [*] built-in [ ] excluded 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 or .\n" +"Enter a submenu with or .\n" +"Exit a submenu to its parent menu with or .\n" +"Pressing includes, excludes, modularizes features.\n" +"Pressing cycles through the available options.\n" +"To search for menu entries press .\n" +" always leaves the current window.\n" +"\n" +"Pressing <1> may be used instead of , <2> instead of , etc.\n" +"For verbose global help press .\n" +"For help related to the current menu entry press or .\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 .\n" -" Press , or for additional information about this option.\n"), +"Press , , or to navigate a radiolist, select\n" +"with .\n" +"For help related to the current entry press or .\n" +"For global help press .\n"), inputbox_instructions_int[] = N_( "Please enter a decimal value.\n" "Fractions will not be accepted.\n" -"Press to accept, to cancel."), +"Press to apply, to cancel."), inputbox_instructions_hex[] = N_( "Please enter a hexadecimal value.\n" -"Press to accept, to cancel."), +"Press to apply, to cancel."), inputbox_instructions_string[] = N_( "Please enter a string value.\n" -"Press to accept, to cancel."), +"Press to apply, 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); } diff --git a/l4/tool/kconfig/scripts/kconfig/nconf.gui.c b/l4/tool/kconfig/scripts/kconfig/nconf.gui.c index 379003c7a..9f8c44ecc 100644 --- a/l4/tool/kconfig/scripts/kconfig/nconf.gui.c +++ b/l4/tool/kconfig/scripts/kconfig/nconf.gui.c @@ -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: diff --git a/l4/tool/kconfig/scripts/kconfig/qconf.cc b/l4/tool/kconfig/scripts/kconfig/qconf.cc index df274febb..1500c38f0 100644 --- a/l4/tool/kconfig/scripts/kconfig/qconf.cc +++ b/l4/tool/kconfig/scripts/kconfig/qconf.cc @@ -6,6 +6,7 @@ #include #if QT_VERSION < 0x040000 +#include #include #include #include diff --git a/l4/tool/kconfig/scripts/kconfig/symbol.c b/l4/tool/kconfig/scripts/kconfig/symbol.c index 22a3c400f..ecc5aa5f8 100644 --- a/l4/tool/kconfig/scripts/kconfig/symbol.c +++ b/l4/tool/kconfig/scripts/kconfig/symbol.c @@ -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; diff --git a/l4/tool/kconfig/scripts/kconfig/util.c b/l4/tool/kconfig/scripts/kconfig/util.c index d0b8b2318..6e7fbf196 100644 --- a/l4/tool/kconfig/scripts/kconfig/util.c +++ b/l4/tool/kconfig/scripts/kconfig/util.c @@ -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); +} + + diff --git a/l4/tool/kconfig/scripts/kconfig/zconf.l b/l4/tool/kconfig/scripts/kconfig/zconf.l index 00f9d3a9c..6555a4754 100644 --- a/l4/tool/kconfig/scripts/kconfig/zconf.l +++ b/l4/tool/kconfig/scripts/kconfig/zconf.l @@ -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; diff --git a/l4/tool/kconfig/scripts/kconfig/zconf.lex.c_shipped b/l4/tool/kconfig/scripts/kconfig/zconf.lex.c_shipped index c32b1a49f..a0521aa59 100644 --- a/l4/tool/kconfig/scripts/kconfig/zconf.lex.c_shipped +++ b/l4/tool/kconfig/scripts/kconfig/zconf.lex.c_shipped @@ -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; -- 2.39.2