diff --git a/kernel/fiasco/src/Makerules.VERSION b/kernel/fiasco/src/Makerules.VERSION index 3922d3f5..cbfe5f92 100644 --- a/kernel/fiasco/src/Makerules.VERSION +++ b/kernel/fiasco/src/Makerules.VERSION @@ -6,18 +6,19 @@ $(filter kip%.o,$(OBJ_ABI)): $(VERSION) $(VERSION): FORCE $(GENVER_MESSAGE) - $(VERBOSE)if [ -d $(srcdir)/.svn ]; then \ - v=`svnversion -nc $(srcdir)`; v=$${v%[A-Z]}; \ - echo "#define CODE_VERSION \"r$${v#*:}\"" > $@; \ - elif [ -d $(srcdir)/.git ]; then \ - v=`git rev-parse --verify --short HEAD 2>/dev/null` \ - echo "#define CODE_VERSION \"$$v\"" > $@; \ - elif [ -d $(srcdir)/.hg ]; then \ - v=`hg id 2>/dev/null` \ - echo "#define CODE_VERSION \"$${v% *}\"" > $@; \ - else \ - echo "#define CODE_VERSION \"UNKNOWN\"" > $@; \ - fi + $(VERBOSE)v=`git rev-parse --verify --short HEAD 2>/dev/null`;\ + if [ -z "$$v" ]; then \ + v=`svnversion -nc $(srcdir)`; \ + if [ -n "$$v" ]; then \ + v=$${v%[A-Z]}; v="r$${v#*:}"; \ + else \ + v=`hg id 2>/dev/null`; \ + if [ -n "$$v" ]; then \ + v="$${v% *}"; \ + fi \ + fi \ + fi; \ + echo "#define CODE_VERSION \"$$v\"" > $@ $(VERBOSE)echo "#define BUILD_DATE \"$$(date)\"" >> $@ $(VERBOSE)if [ -e .build_nr ]; then \ nr=$$(($$(cat .build_nr) + 1)); \ diff --git a/kernel/fiasco/src/drivers/io.cpp b/kernel/fiasco/src/drivers/io.cpp index e1a0685a..412bdb5a 100644 --- a/kernel/fiasco/src/drivers/io.cpp +++ b/kernel/fiasco/src/drivers/io.cpp @@ -127,17 +127,17 @@ IMPLEMENTATION: IMPLEMENT inline template< typename T> void Io::mask(T mask, Address address) -{ write(read(address) & mask, address); } +{ write(read(address) & mask, address); } IMPLEMENT inline template< typename T> void Io::clear(T clearbits, Address address) -{ write(read(address) & ~clearbits, address); } +{ write(read(address) & ~clearbits, address); } IMPLEMENT inline template< typename T> void Io::set(T setbits, Address address) -{ write(read(address) | setbits, address); } +{ write(read(address) | setbits, address); } diff --git a/kernel/fiasco/src/jdb/jdb_tbuf_show.cpp b/kernel/fiasco/src/jdb/jdb_tbuf_show.cpp index d88ef390..d91c4a95 100644 --- a/kernel/fiasco/src/jdb/jdb_tbuf_show.cpp +++ b/kernel/fiasco/src/jdb/jdb_tbuf_show.cpp @@ -782,33 +782,37 @@ restart: { typedef Tb_entry::Group_order Group_order; - Tb_entry const *ce = Jdb_tbuf::lookup(_absy + addy); - Tb_entry_formatter const *fmt = Tb_entry_formatter::get_fmt(ce); Group_order pt; + Tb_entry const *ce = Jdb_tbuf::lookup(_absy + addy); - if (fmt) - pt = fmt->has_partner(ce); - - if (!pt.not_grouped()) + if (ce) { - if (!pt.is_first()) - find_group(&group, ce, true, lines, pt.depth()); - if (!pt.is_last()) - find_group(&group, ce, false, lines, pt.depth()); - } + Tb_entry_formatter const *fmt = Tb_entry_formatter::get_fmt(ce); - for (unsigned i = 0; i < group.size(); ++i) - { - Entry_group::Item const &item = group[i]; - Jdb::cursor(item.y - _absy + Tbuf_start_line, 3); - putstr(Jdb::esc_emph); - if (item.order.is_first()) - putstr("<++"); - else if (item.order.is_last()) - putstr("++>"); - else if (item.order.grouped()) - putstr("+++"); - putstr("\033[m"); + if (fmt) + pt = fmt->has_partner(ce); + + if (!pt.not_grouped()) + { + if (!pt.is_first()) + find_group(&group, ce, true, lines, pt.depth()); + if (!pt.is_last()) + find_group(&group, ce, false, lines, pt.depth()); + } + + for (unsigned i = 0; i < group.size(); ++i) + { + Entry_group::Item const &item = group[i]; + Jdb::cursor(item.y - _absy + Tbuf_start_line, 3); + putstr(Jdb::esc_emph); + if (item.order.is_first()) + putstr("<++"); + else if (item.order.is_last()) + putstr("++>"); + else if (item.order.grouped()) + putstr("+++"); + putstr("\033[m"); + } } } diff --git a/kernel/fiasco/src/kern/arm/bsp/imx/uart-imx.cpp b/kernel/fiasco/src/kern/arm/bsp/imx/uart-imx.cpp index 67d7041d..7f6e572f 100644 --- a/kernel/fiasco/src/kern/arm/bsp/imx/uart-imx.cpp +++ b/kernel/fiasco/src/kern/arm/bsp/imx/uart-imx.cpp @@ -41,7 +41,7 @@ IMPLEMENTATION [imx6]: #include "uart_imx.h" -IMPLEMENT int Uart::irq() const { return 90; } +IMPLEMENT int Uart::irq() const { return 59; } IMPLEMENT L4::Uart *Uart::uart() { diff --git a/kernel/fiasco/src/kern/arm/bsp/integrator/uart-arm-integrator.cpp b/kernel/fiasco/src/kern/arm/bsp/integrator/uart-arm-integrator.cpp index 78a837bd..dbef46c8 100644 --- a/kernel/fiasco/src/kern/arm/bsp/integrator/uart-arm-integrator.cpp +++ b/kernel/fiasco/src/kern/arm/bsp/integrator/uart-arm-integrator.cpp @@ -9,6 +9,6 @@ IMPLEMENT int Uart::irq() const { return 1; } IMPLEMENT L4::Uart *Uart::uart() { - static L4::Uart_pl011 uart; + static L4::Uart_pl011 uart(24019200); return &uart; } diff --git a/kernel/fiasco/src/kern/arm/bsp/realview/mem_layout-arm-realview.cpp b/kernel/fiasco/src/kern/arm/bsp/realview/mem_layout-arm-realview.cpp index b7af3315..d33d2244 100644 --- a/kernel/fiasco/src/kern/arm/bsp/realview/mem_layout-arm-realview.cpp +++ b/kernel/fiasco/src/kern/arm/bsp/realview/mem_layout-arm-realview.cpp @@ -79,7 +79,7 @@ public: }; enum Phys_layout_realview_mp : Address { - Devices1_phys_base = 0x1f000000, + Devices1_phys_base = 0x10100000, Devices2_phys_base = Invalid_address, }; }; diff --git a/kernel/fiasco/src/kern/arm/bsp/realview/uart-arm-realview.cpp b/kernel/fiasco/src/kern/arm/bsp/realview/uart-arm-realview.cpp index 9572d744..bd85d564 100644 --- a/kernel/fiasco/src/kern/arm/bsp/realview/uart-arm-realview.cpp +++ b/kernel/fiasco/src/kern/arm/bsp/realview/uart-arm-realview.cpp @@ -19,6 +19,6 @@ IMPLEMENT Address Uart::base() const { return Mem_layout::Uart_base; } IMPLEMENT L4::Uart *Uart::uart() { - static L4::Uart_pl011 uart; + static L4::Uart_pl011 uart(24019200); return &uart; } diff --git a/kernel/fiasco/src/kern/arm/fpu-arm.cpp b/kernel/fiasco/src/kern/arm/fpu-arm.cpp index 70ffc63b..b221b76c 100644 --- a/kernel/fiasco/src/kern/arm/fpu-arm.cpp +++ b/kernel/fiasco/src/kern/arm/fpu-arm.cpp @@ -77,7 +77,7 @@ Fpu::copro_enable() "orr %0, %0, %1 \n" "mcr p15, 0, %0, c1, c0, 2\n" : : "r" (0), "I" (0x00f00000)); - Mem::dsb(); + Mem::isb(); } // ------------------------------------------------------------------------ diff --git a/kernel/fiasco/src/kern/arm/mem_op.cpp b/kernel/fiasco/src/kern/arm/mem_op.cpp index 62df3c2b..b483216c 100644 --- a/kernel/fiasco/src/kern/arm/mem_op.cpp +++ b/kernel/fiasco/src/kern/arm/mem_op.cpp @@ -53,7 +53,8 @@ Mem_op::l1_inv_dcache(Address start, Address end) end &= ~Mem_unit::Cache_line_mask; } - Mem_unit::inv_dcache((void *)start, (void *)end); + if (start < end) + Mem_unit::inv_dcache((void *)start, (void *)end); } PRIVATE static void @@ -217,8 +218,10 @@ PRIVATE static void Mem_op::outer_cache_op(int op, Address start, Address end) { - Mem_space::Vaddr v = Virt_addr(Address(start)); - Mem_space::Vaddr e = Virt_addr(Address(end)); + + Virt_addr s = Virt_addr(start); + Virt_addr v = Virt_addr(start); + Virt_addr e = Virt_addr(end); Context *c = current(); @@ -227,30 +230,36 @@ Mem_op::outer_cache_op(int op, Address start, Address end) Mem_space::Size phys_size; Mem_space::Phys_addr phys_addr; unsigned attrs; + bool mapped = c->mem_space()->v_lookup(Mem_space::Vaddr(v), &phys_addr, &phys_size, &attrs) + && (attrs & Mem_space::Page_user_accessible); - if ( c->mem_space()->v_lookup(v, &phys_addr, &phys_size, &attrs) - && (attrs & Mem_space::Page_user_accessible)) + Virt_size sz = Virt_size(phys_size); + Virt_size offs = Virt_size(Virt_addr(v).value() & (Mem_space::Size(phys_size).value() - 1)); + sz -= offs; + if (e - v < sz) + sz = e - v; + + if (mapped) { - unsigned long sz = Virt_size(phys_size).value(); - if (Address(end) - Address(start) < sz) - sz = Address(end) - Address(start); + Virt_addr vstart = Virt_addr(phys_addr) | offs; + Virt_addr vend = vstart + sz; switch (op) { case Op_cache_l2_clean: - Outer_cache::clean(Virt_addr(phys_addr).value(), - Virt_addr(phys_addr).value() + sz, false); + Outer_cache::clean(Virt_addr(vstart).value(), + Virt_addr(vend).value(), false); break; case Op_cache_l2_flush: - Outer_cache::flush(Virt_addr(phys_addr).value(), - Virt_addr(phys_addr).value() + sz, false); + Outer_cache::flush(Virt_addr(vstart).value(), + Virt_addr(vend).value(), false); break; case Op_cache_l2_inv: - Outer_cache::invalidate(Virt_addr(phys_addr).value(), - Virt_addr(phys_addr).value() + sz, false); + Outer_cache::invalidate(Virt_addr(vstart).value(), + Virt_addr(vend).value(), false); break; } } - v += phys_size; + v += sz; } Outer_cache::sync(); } diff --git a/kernel/fiasco/src/kern/arm/timer-arm.cpp b/kernel/fiasco/src/kern/arm/timer-arm.cpp index 685038d4..9a03120d 100644 --- a/kernel/fiasco/src/kern/arm/timer-arm.cpp +++ b/kernel/fiasco/src/kern/arm/timer-arm.cpp @@ -9,6 +9,26 @@ private: static inline void update_one_shot(Unsigned64 wakeup); }; +// ------------------------------------------------------------------------ +IMPLEMENTATION [arm && vcache]: + +#include "mem_unit.h" + +PRIVATE static inline NEEDS["mem_unit.h"] +void +Timer::kipclock_cache() +{ + Mem_unit::clean_dcache((void *)&Kip::k()->clock); +} + +// ------------------------------------------------------------------------ +IMPLEMENTATION [arm && !vcache]: + +PRIVATE static inline +void +Timer::kipclock_cache() +{} + // ------------------------------------------------------------------------ IMPLEMENTATION [arm]: @@ -24,13 +44,14 @@ Timer::init_system_clock() Kip::k()->clock = 0; } -IMPLEMENT inline NEEDS["config.h", "globals.h", "kip.h", "watchdog.h"] +IMPLEMENT inline NEEDS["config.h", "globals.h", "kip.h", "watchdog.h", Timer::kipclock_cache] void Timer::update_system_clock(unsigned cpu) { if (cpu == 0) { Kip::k()->clock += Config::Scheduler_granularity; + kipclock_cache(); Watchdog::touch(); } } diff --git a/kernel/fiasco/src/kern/config.cpp b/kernel/fiasco/src/kern/config.cpp index 9d0d17d9..15d125c5 100644 --- a/kernel/fiasco/src/kern/config.cpp +++ b/kernel/fiasco/src/kern/config.cpp @@ -142,7 +142,7 @@ INTERFACE: #define CONFIG_KERNEL_VERSION_STRING \ GREETING_COLOR_ANSI_TITLE "Welcome to Fiasco.OC (" CONFIG_XARCH ")!\\n" \ GREETING_COLOR_ANSI_INFO "L4/Fiasco.OC " ARCH_NAME " " \ - "microkernel (C) 1998-2012 TU Dresden\\n" \ + "microkernel (C) 1998-2013 TU Dresden\\n" \ "Rev: " CODE_VERSION " compiled with gcc " COMPILER \ " for " TARGET_NAME " [" CONFIG_LABEL "]\\n" \ "Build: #" BUILD_NR " " BUILD_DATE "\\n" \ diff --git a/kernel/fiasco/src/kern/context.cpp b/kernel/fiasco/src/kern/context.cpp index a364e66a..d78c1bc3 100644 --- a/kernel/fiasco/src/kern/context.cpp +++ b/kernel/fiasco/src/kern/context.cpp @@ -317,11 +317,13 @@ protected: Migration *_migration; bool _need_to_finish_migration; +public: void arch_load_vcpu_kern_state(Vcpu_state *vcpu, bool do_load); + +protected: void arch_load_vcpu_user_state(Vcpu_state *vcpu, bool do_load); void arch_update_vcpu_state(Vcpu_state *vcpu); -protected: // XXX Timeout for both, sender and receiver! In normal case we would have // to define own timeouts in Receiver and Sender but because only one // timeout can be set at one time we use the same timeout. The timeout diff --git a/kernel/fiasco/src/kern/ia32/apic-ia32-mp.cpp b/kernel/fiasco/src/kern/ia32/apic-ia32-mp.cpp index 42ca49cb..ddfcb98a 100644 --- a/kernel/fiasco/src/kern/ia32/apic-ia32-mp.cpp +++ b/kernel/fiasco/src/kern/ia32/apic-ia32-mp.cpp @@ -61,6 +61,15 @@ Apic::mp_ipi_idle_timeout(Cpu const *c, Unsigned32 wait) return mp_ipi_idle(); } +PRIVATE static inline +void +Apic::delay(Cpu const *c, Unsigned32 wait) +{ + Unsigned64 wait_till = c->time_us() + wait; + while (c->time_us() < wait_till) + Proc::pause(); +} + PUBLIC static inline NEEDS [] void Apic::mp_send_ipi(Unsigned32 dest, Unsigned32 vect, @@ -133,6 +142,8 @@ Apic::mp_startup(Cpu const *current_cpu, Unsigned32 dest, Address tramp_page) // Send INIT IPI mp_send_ipi(dest, 0, APIC_IPI_INIT); + delay(current_cpu, 200); + // delay for 10ms (=10,000us) if (!mp_ipi_idle_timeout(current_cpu, 10000)) return; diff --git a/kernel/fiasco/src/kern/ia32/irq_chip_ia32.cpp b/kernel/fiasco/src/kern/ia32/irq_chip_ia32.cpp index a28a9b59..70758d4f 100644 --- a/kernel/fiasco/src/kern/ia32/irq_chip_ia32.cpp +++ b/kernel/fiasco/src/kern/ia32/irq_chip_ia32.cpp @@ -65,7 +65,10 @@ public: { return !_d.push; } void free() - { _d.push = 0; } + { + _d.push = 0; + _d.irq_adr = 0; + } unsigned char vector() const { return _d.vector; } diff --git a/kernel/fiasco/src/kern/ia32/vm_svm.cpp b/kernel/fiasco/src/kern/ia32/vm_svm.cpp index e1606651..f89770bd 100644 --- a/kernel/fiasco/src/kern/ia32/vm_svm.cpp +++ b/kernel/fiasco/src/kern/ia32/vm_svm.cpp @@ -667,7 +667,10 @@ Vm_svm::resume_vcpu(Context *ctxt, Vcpu_state *vcpu, bool user_mode) assert_kdb (user_mode); if (EXPECT_FALSE(!(ctxt->state(true) & Thread_ext_vcpu_enabled))) - return -L4_err::EInval; + { + ctxt->arch_load_vcpu_kern_state(vcpu, true); + return -L4_err::EInval; + } Vmcb *vmcb_s = reinterpret_cast(reinterpret_cast(vcpu) + 0x400); for (;;) @@ -678,6 +681,7 @@ Vm_svm::resume_vcpu(Context *ctxt, Vcpu_state *vcpu, bool user_mode) && (vcpu->sticky_flags & Vcpu_state::Sf_irq_pending)) { vmcb_s->control_area.exitcode = 0x60; + ctxt->arch_load_vcpu_kern_state(vcpu, true); return 1; // return 1 to indicate pending IRQs (IPCs) } @@ -685,7 +689,10 @@ Vm_svm::resume_vcpu(Context *ctxt, Vcpu_state *vcpu, bool user_mode) // test for error or non-IRQ exit reason if (r <= 0) - return r; + { + ctxt->arch_load_vcpu_kern_state(vcpu, true); + return r; + } // check for IRQ exits and allow to handle the IRQ if (r == 1) @@ -699,8 +706,11 @@ Vm_svm::resume_vcpu(Context *ctxt, Vcpu_state *vcpu, bool user_mode) Thread *t = nonull_static_cast(ctxt); if (t->continuation_test_and_restore()) - t->fast_return_to_user(vcpu->_entry_ip, vcpu->_entry_sp, - t->vcpu_state().usr().get()); + { + ctxt->arch_load_vcpu_kern_state(vcpu, true); + t->fast_return_to_user(vcpu->_entry_ip, vcpu->_entry_sp, + t->vcpu_state().usr().get()); + } } } diff --git a/kernel/fiasco/src/kern/ia32/vm_vmx.cpp b/kernel/fiasco/src/kern/ia32/vm_vmx.cpp index 6d8ebd6d..586a4a38 100644 --- a/kernel/fiasco/src/kern/ia32/vm_vmx.cpp +++ b/kernel/fiasco/src/kern/ia32/vm_vmx.cpp @@ -481,7 +481,10 @@ Vm_vmx::resume_vcpu(Context *ctxt, Vcpu_state *vcpu, bool user_mode) assert_kdb (user_mode); if (EXPECT_FALSE(!(ctxt->state(true) & Thread_ext_vcpu_enabled))) - return -L4_err::EInval; + { + ctxt->arch_load_vcpu_kern_state(vcpu, true); + return -L4_err::EInval; + } void *vmcs_s = reinterpret_cast(vcpu) + 0x400; @@ -494,6 +497,7 @@ Vm_vmx::resume_vcpu(Context *ctxt, Vcpu_state *vcpu, bool user_mode) { // XXX: check if this is correct, we set external irq exit as reason write(vmcs_s, Vmx::F_exit_reason, 1); + ctxt->arch_load_vcpu_kern_state(vcpu, true); return 1; // return 1 to indicate pending IRQs (IPCs) } @@ -501,7 +505,10 @@ Vm_vmx::resume_vcpu(Context *ctxt, Vcpu_state *vcpu, bool user_mode) // test for error or non-IRQ exit reason if (r <= 0) - return r; + { + ctxt->arch_load_vcpu_kern_state(vcpu, true); + return r; + } // check for IRQ exits and allow to handle the IRQ if (r == 1) @@ -514,7 +521,10 @@ Vm_vmx::resume_vcpu(Context *ctxt, Vcpu_state *vcpu, bool user_mode) // with bogus state. Thread *t = nonull_static_cast(ctxt); if (t->continuation_test_and_restore()) - t->fast_return_to_user(vcpu->_entry_ip, vcpu->_entry_sp, - t->vcpu_state().usr().get()); + { + ctxt->arch_load_vcpu_kern_state(vcpu, true); + t->fast_return_to_user(vcpu->_entry_ip, vcpu->_entry_sp, + t->vcpu_state().usr().get()); + } } } diff --git a/kernel/fiasco/src/kern/ipc_timeout.cpp b/kernel/fiasco/src/kern/ipc_timeout.cpp index 08c20701..9a382bb3 100644 --- a/kernel/fiasco/src/kern/ipc_timeout.cpp +++ b/kernel/fiasco/src/kern/ipc_timeout.cpp @@ -55,7 +55,10 @@ IPC_timeout::expired() { Receiver * const _owner = owner(); - // Set thread ready + Mword ipc_state = _owner->state() & Thread_ipc_mask; + if (!ipc_state || (ipc_state & Thread_receive_in_progress)) + return false; + _owner->state_change_dirty(~Thread_ipc_mask, Thread_ready | Thread_timeout); // Flag reschedule if owner's priority is higher than the current diff --git a/kernel/fiasco/src/kern/kernel_uart.cpp b/kernel/fiasco/src/kern/kernel_uart.cpp index ce086afb..0d573239 100644 --- a/kernel/fiasco/src/kern/kernel_uart.cpp +++ b/kernel/fiasco/src/kern/kernel_uart.cpp @@ -108,9 +108,9 @@ public: { mask_and_ack(); ui->ack(); + unmask(); if (!Vkey::check_()) kdb_ke("IRQ ENTRY"); - unmask(); } }; diff --git a/kernel/fiasco/src/kern/platform_control.cpp b/kernel/fiasco/src/kern/platform_control.cpp index 339ac82d..97801603 100644 --- a/kernel/fiasco/src/kern/platform_control.cpp +++ b/kernel/fiasco/src/kern/platform_control.cpp @@ -20,6 +20,16 @@ void Platform_control::init(unsigned) {} +IMPLEMENT inline NEEDS["l4_types.h"] +int +Platform_control::system_suspend() +{ return -L4_err::EBusy; } + +// ------------------------------------------------------------------------ +IMPLEMENTATION [!cpu_suspend || !mp]: + +#include "l4_types.h" + IMPLEMENT inline bool Platform_control::cpu_offline_available() @@ -34,8 +44,3 @@ IMPLEMENT inline NEEDS["l4_types.h"] int Platform_control::resume_cpu(unsigned) { return -L4_err::ENodev; } - -IMPLEMENT inline NEEDS["l4_types.h"] -int -Platform_control::system_suspend() -{ return -L4_err::EBusy; } diff --git a/kernel/fiasco/src/kern/thread.cpp b/kernel/fiasco/src/kern/thread.cpp index f24ca322..cf78462f 100644 --- a/kernel/fiasco/src/kern/thread.cpp +++ b/kernel/fiasco/src/kern/thread.cpp @@ -1105,7 +1105,13 @@ Thread::handle_remote_requests_irq() if (migration_q) resched |= static_cast(migration_q)->do_migration(); - if ((c->handle_drq() || resched) && !Sched_context::rq.current().schedule_in_progress) + resched |= c->handle_drq(); + if (Sched_context::rq.current().schedule_in_progress) + { + if (c->state() & Thread_ready_mask) + Sched_context::rq.current().ready_enqueue(c->sched()); + } + else if (resched) c->schedule(); } diff --git a/kernel/fiasco/src/lib/uart/uart_pl011.cc b/kernel/fiasco/src/lib/uart/uart_pl011.cc index 34174a4a..02e8500c 100644 --- a/kernel/fiasco/src/lib/uart/uart_pl011.cc +++ b/kernel/fiasco/src/lib/uart/uart_pl011.cc @@ -41,16 +41,18 @@ namespace L4 UART011_IMSC = 0x38, UART011_MIS = 0x40, UART011_ICR = 0x44, - }; + Default_baud = 115200, + }; bool Uart_pl011::startup(Io_register_block const *regs) { _regs = regs; _regs->write(UART011_CR, UART01x_CR_UARTEN | UART011_CR_TXE | UART011_CR_RXE); - _regs->write(UART011_FBRD, 2); - _regs->write(UART011_IBRD, 13); - _regs->write(UART011_LCRH, 0x60); + unsigned fi_val = _freq * 4 / Default_baud; + _regs->write(UART011_FBRD, fi_val & 0x3f); + _regs->write(UART011_IBRD, fi_val >> 6); + _regs->write(UART011_LCRH, UART01x_LCRH_WLEN_8); _regs->write(UART011_IMSC, 0); Poll_timeout_counter i(3000000); while (i.test() && _regs->read(UART01x_FR) & UART01x_FR_BUSY) @@ -80,14 +82,12 @@ namespace L4 bool Uart_pl011::change_mode(Transfer_mode, Baud_rate r) { - if (r != 115200) - return false; - unsigned long old_cr = _regs->read(UART011_CR); _regs->write(UART011_CR, 0); - _regs->write(UART011_FBRD, 2); - _regs->write(UART011_IBRD, 13); + unsigned fi_val = _freq * 4 / r; + _regs->write(UART011_FBRD, fi_val & 0x3f); + _regs->write(UART011_IBRD, fi_val >> 6); _regs->write(UART011_LCRH, UART01x_LCRH_WLEN_8 | UART01x_LCRH_FEN); _regs->write(UART011_CR, old_cr); diff --git a/kernel/fiasco/src/lib/uart/uart_pl011.h b/kernel/fiasco/src/lib/uart/uart_pl011.h index 3e9019ea..9d5322f1 100644 --- a/kernel/fiasco/src/lib/uart/uart_pl011.h +++ b/kernel/fiasco/src/lib/uart/uart_pl011.h @@ -8,6 +8,7 @@ namespace L4 class Uart_pl011 : public Uart { public: + Uart_pl011(unsigned freq) : _freq(freq) {} bool startup(Io_register_block const *); void shutdown(); bool change_mode(Transfer_mode m, Baud_rate r); @@ -16,6 +17,9 @@ namespace L4 int char_avail() const; inline void out_char(char c) const; int write(char const *s, unsigned long count) const; + + private: + unsigned _freq; }; }; diff --git a/kernel/fiasco/tool/kconfig/Makefile b/kernel/fiasco/tool/kconfig/Makefile index c565ae05..cc8a266f 100644 --- a/kernel/fiasco/tool/kconfig/Makefile +++ b/kernel/fiasco/tool/kconfig/Makefile @@ -1,8 +1,8 @@ VERSION = 3 -PATCHLEVEL = 5 +PATCHLEVEL = 7 SUBLEVEL = 0 EXTRAVERSION = -NAME = Saber-toothed Squirrel +NAME = Terrified Chipmunk # *DOCUMENTATION* # To see a list of typical targets execute "make help" @@ -350,12 +350,22 @@ AFLAGS_KERNEL = CFLAGS_GCOV = -fprofile-arcs -ftest-coverage +# Use USERINCLUDE when you must reference the UAPI directories only. +USERINCLUDE := \ + -I$(srctree)/arch/$(hdr-arch)/include/uapi \ + -Iarch/$(hdr-arch)/include/generated/uapi \ + -I$(srctree)/include/uapi \ + -Iinclude/generated/uapi \ + -include $(srctree)/include/linux/kconfig.h + # Use LINUXINCLUDE when you must reference the include/ directory. # Needed to be compatible with the O= option -LINUXINCLUDE := -I$(srctree)/arch/$(hdr-arch)/include \ - -Iarch/$(hdr-arch)/include/generated -Iinclude \ - $(if $(KBUILD_SRC), -I$(srctree)/include) \ - -include $(srctree)/include/linux/kconfig.h +LINUXINCLUDE := \ + -I$(srctree)/arch/$(hdr-arch)/include \ + -Iarch/$(hdr-arch)/include/generated \ + $(if $(KBUILD_SRC), -I$(srctree)/include) \ + -Iinclude \ + $(USERINCLUDE) KBUILD_CPPFLAGS := -D__KERNEL__ @@ -427,7 +437,9 @@ endif PHONY += asm-generic asm-generic: $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ - obj=arch/$(SRCARCH)/include/generated/asm + src=asm obj=arch/$(SRCARCH)/include/generated/asm + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ + src=uapi/asm obj=arch/$(SRCARCH)/include/generated/uapi/asm # To make sure we do not include .config for any of the *config targets # catch them early, and hand them over to scripts/kconfig/Makefile @@ -437,9 +449,11 @@ asm-generic: # Detect when mixed targets is specified, and make a second invocation # of make so .config is not included in this case either (for *config). +version_h := include/generated/uapi/linux/version.h + no-dot-config-targets := clean mrproper distclean \ cscope gtags TAGS tags help %docs check% coccicheck \ - include/linux/version.h headers_% archheaders archscripts \ + $(version_h) headers_% archheaders archscripts \ kernelversion %src-pkg config-targets := 0 @@ -535,11 +549,11 @@ PHONY += include/config/auto.conf include/config/auto.conf: $(Q)test -e include/generated/autoconf.h -a -e $@ || ( \ - echo; \ - echo " ERROR: Kernel configuration is invalid."; \ - echo " include/generated/autoconf.h or $@ are missing.";\ - echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ - echo; \ + echo >&2; \ + echo >&2 " ERROR: Kernel configuration is invalid."; \ + echo >&2 " include/generated/autoconf.h or $@ are missing.";\ + echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ + echo >&2 ; \ /bin/false) endif # KBUILD_EXTMOD @@ -609,7 +623,11 @@ KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) endif ifdef CONFIG_FUNCTION_TRACER -KBUILD_CFLAGS += -pg +ifdef CONFIG_HAVE_FENTRY +CC_USING_FENTRY := $(call cc-option, -mfentry -DCC_USING_FENTRY) +endif +KBUILD_CFLAGS += -pg $(CC_USING_FENTRY) +KBUILD_AFLAGS += $(CC_USING_FENTRY) ifdef CONFIG_DYNAMIC_FTRACE ifdef CONFIG_HAVE_C_RECORDMCOUNT BUILD_C_RECORDMCOUNT := y @@ -648,22 +666,9 @@ ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y) endif # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments -# But warn user when we do so -warn-assign = \ -$(warning "WARNING: Appending $$K$(1) ($(K$(1))) from $(origin K$(1)) to kernel $$$(1)") - -ifneq ($(KCPPFLAGS),) - $(call warn-assign,CPPFLAGS) - KBUILD_CPPFLAGS += $(KCPPFLAGS) -endif -ifneq ($(KAFLAGS),) - $(call warn-assign,AFLAGS) - KBUILD_AFLAGS += $(KAFLAGS) -endif -ifneq ($(KCFLAGS),) - $(call warn-assign,CFLAGS) - KBUILD_CFLAGS += $(KCFLAGS) -endif +KBUILD_CPPFLAGS += $(KCPPFLAGS) +KBUILD_AFLAGS += $(KAFLAGS) +KBUILD_CFLAGS += $(KCFLAGS) # Use --build-id when available. LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\ @@ -714,6 +719,17 @@ endif # INSTALL_MOD_STRIP export mod_strip_cmd +ifeq ($(CONFIG_MODULE_SIG),y) +MODSECKEY = ./signing_key.priv +MODPUBKEY = ./signing_key.x509 +export MODPUBKEY +mod_sign_cmd = perl $(srctree)/scripts/sign-file $(MODSECKEY) $(MODPUBKEY) +else +mod_sign_cmd = true +endif +export mod_sign_cmd + + ifeq ($(KBUILD_EXTMOD),) core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ @@ -796,8 +812,8 @@ prepare3: include/config/kernel.release ifneq ($(KBUILD_SRC),) @$(kecho) ' Using $(srctree) as source for kernel' $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ - echo " $(srctree) is not clean, please run 'make mrproper'"; \ - echo " in the '$(srctree)' directory.";\ + echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \ + echo >&2 " in the '$(srctree)' directory.";\ /bin/false; \ fi; endif @@ -805,7 +821,7 @@ endif # prepare2 creates a makefile if using a separate output directory prepare2: prepare3 outputmakefile asm-generic -prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \ +prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ include/config/auto.conf $(cmd_crmodverdir) @@ -838,7 +854,7 @@ define filechk_version.h echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) endef -include/linux/version.h: $(srctree)/Makefile FORCE +$(version_h): $(srctree)/Makefile FORCE $(call filechk,version.h) include/generated/utsrelease.h: include/config/kernel.release FORCE @@ -883,7 +899,7 @@ PHONY += archscripts archscripts: PHONY += __headers -__headers: include/linux/version.h scripts_basic asm-generic archheaders archscripts FORCE +__headers: $(version_h) scripts_basic asm-generic archheaders archscripts FORCE $(Q)$(MAKE) $(build)=scripts build_unifdef PHONY += headers_install_all @@ -892,10 +908,10 @@ headers_install_all: PHONY += headers_install headers_install: __headers - $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild),, \ - $(error Headers not exportable for the $(SRCARCH) architecture)) - $(Q)$(MAKE) $(hdr-inst)=include - $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst) + $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/uapi/asm/Kbuild),, \ + $(error Headers not exportable for the $(SRCARCH) architecture)) + $(Q)$(MAKE) $(hdr-inst)=include/uapi + $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst) PHONY += headers_check_all headers_check_all: headers_install_all @@ -903,8 +919,8 @@ headers_check_all: headers_install_all PHONY += headers_check headers_check: headers_install - $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1 - $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst) HDRCHECK=1 + $(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1 + $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst) HDRCHECK=1 # --------------------------------------------------------------------------- # Modules @@ -971,11 +987,11 @@ else # CONFIG_MODULES # --------------------------------------------------------------------------- modules modules_install: FORCE - @echo - @echo "The present kernel configuration has modules disabled." - @echo "Type 'make config' and enable loadable module support." - @echo "Then build a kernel with module support enabled." - @echo + @echo >&2 + @echo >&2 "The present kernel configuration has modules disabled." + @echo >&2 "Type 'make config' and enable loadable module support." + @echo >&2 "Then build a kernel with module support enabled." + @echo >&2 @exit 1 endif # CONFIG_MODULES @@ -993,9 +1009,11 @@ CLEAN_DIRS += $(MODVERDIR) # Directories & files removed with 'make mrproper' MRPROPER_DIRS += include/config usr/include include/generated \ arch/*/include/generated -MRPROPER_FILES += .config .config.old .version .old_version \ - include/linux/version.h \ - Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS +MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \ + Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \ + signing_key.priv signing_key.x509 x509.genkey \ + extra_certificates signing_key.x509.keyid \ + signing_key.x509.signer # clean - Delete most, but leave enough to build external modules # @@ -1239,6 +1257,7 @@ clean: $(clean-dirs) $(call cmd,rmfiles) @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ + -o -name '*.ko.*' \ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ -o -name '*.symtypes' -o -name 'modules.order' \ -o -name modules.builtin -o -name '.tmp_*.o.*' \ @@ -1302,10 +1321,12 @@ kernelversion: # Clear a bunch of variables before executing the submake tools/: FORCE - $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/ + $(Q)mkdir -p $(objtree)/tools + $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/ tools/%: FORCE - $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/ $* + $(Q)mkdir -p $(objtree)/tools + $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/ $* # Single targets # --------------------------------------------------------------------------- diff --git a/kernel/fiasco/tool/kconfig/README b/kernel/fiasco/tool/kconfig/README index cebd46b7..3d87ce19 100644 --- a/kernel/fiasco/tool/kconfig/README +++ b/kernel/fiasco/tool/kconfig/README @@ -1,3 +1,3 @@ -kconfig taken from vanilla Linux 3.5, and slightly patched. +kconfig taken from vanilla Linux 3.7, and slightly patched. diff --git a/kernel/fiasco/tool/kconfig/scripts/Kbuild.include b/kernel/fiasco/tool/kconfig/scripts/Kbuild.include index 6a3ee981..978416dd 100644 --- a/kernel/fiasco/tool/kconfig/scripts/Kbuild.include +++ b/kernel/fiasco/tool/kconfig/scripts/Kbuild.include @@ -98,24 +98,24 @@ try-run = $(shell set -e; \ # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) as-option = $(call try-run,\ - $(CC) $(KBUILD_CFLAGS) $(1) -c -xassembler /dev/null -o "$$TMP",$(1),$(2)) + $(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2)) # as-instr # Usage: cflags-y += $(call as-instr,instr,option1,option2) as-instr = $(call try-run,\ - printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) + printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3)) # cc-option # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) cc-option = $(call try-run,\ - $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",$(1),$(2)) + $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2)) # cc-option-yn # Usage: flag := $(call cc-option-yn,-march=winchip-c6) cc-option-yn = $(call try-run,\ - $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",y,n) + $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) # cc-option-align # Prefix align with either -falign or -malign @@ -125,7 +125,7 @@ cc-option-align = $(subst -functions=0,,\ # cc-disable-warning # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) cc-disable-warning = $(call try-run,\ - $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -xc /dev/null -o "$$TMP",-Wno-$(strip $(1))) + $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) # cc-version # Usage gcc-ver := $(call cc-version) @@ -143,7 +143,7 @@ cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3)) # cc-ldoption # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) cc-ldoption = $(call try-run,\ - $(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2)) + $(CC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) # ld-option # Usage: LDFLAGS += $(call ld-option, -X) @@ -209,7 +209,7 @@ endif # >$< substitution to preserve $ when reloading .cmd file # note: when using inline perl scripts [perl -e '...$$t=1;...'] # in $(cmd_xxx) double $$ your perl vars -make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))) +make-cmd = $(subst \\,\\\\,$(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1)))))) # Find any prerequisites that is newer than target or that does not exist. # PHONY targets skipped in both cases. diff --git a/kernel/fiasco/tool/kconfig/scripts/Makefile b/kernel/fiasco/tool/kconfig/scripts/Makefile index a55b0067..01e7adb8 100644 --- a/kernel/fiasco/tool/kconfig/scripts/Makefile +++ b/kernel/fiasco/tool/kconfig/scripts/Makefile @@ -16,8 +16,10 @@ hostprogs-$(CONFIG_VT) += conmakehash hostprogs-$(CONFIG_IKCONFIG) += bin2c hostprogs-$(BUILD_C_RECORDMCOUNT) += recordmcount hostprogs-$(CONFIG_BUILDTIME_EXTABLE_SORT) += sortextable +hostprogs-$(CONFIG_ASN1) += asn1_compiler HOSTCFLAGS_sortextable.o = -I$(srctree)/tools/include +HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include always := $(hostprogs-y) $(hostprogs-m) diff --git a/kernel/fiasco/tool/kconfig/scripts/Makefile.build b/kernel/fiasco/tool/kconfig/scripts/Makefile.build index ff1720d2..0e801c3c 100644 --- a/kernel/fiasco/tool/kconfig/scripts/Makefile.build +++ b/kernel/fiasco/tool/kconfig/scripts/Makefile.build @@ -354,6 +354,17 @@ quiet_cmd_cpp_lds_S = LDS $@ $(obj)/%.lds: $(src)/%.lds.S FORCE $(call if_changed_dep,cpp_lds_S) +# ASN.1 grammar +# --------------------------------------------------------------------------- +quiet_cmd_asn1_compiler = ASN.1 $@ + cmd_asn1_compiler = $(objtree)/scripts/asn1_compiler $< \ + $(subst .h,.c,$@) $(subst .c,.h,$@) + +.PRECIOUS: $(objtree)/$(obj)/%-asn1.c $(objtree)/$(obj)/%-asn1.h + +$(obj)/%-asn1.c $(obj)/%-asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler + $(call cmd,asn1_compiler) + # Build the compiled-in targets # --------------------------------------------------------------------------- diff --git a/kernel/fiasco/tool/kconfig/scripts/Makefile.headersinst b/kernel/fiasco/tool/kconfig/scripts/Makefile.headersinst index d3bae5e7..06ba4a70 100644 --- a/kernel/fiasco/tool/kconfig/scripts/Makefile.headersinst +++ b/kernel/fiasco/tool/kconfig/scripts/Makefile.headersinst @@ -3,13 +3,12 @@ # # header-y - list files to be installed. They are preprocessed # to remove __KERNEL__ section of the file -# objhdr-y - Same as header-y but for generated files -# genhdr-y - Same as objhdr-y but in a generated/ directory +# genhdr-y - Same as header-y but in a generated/ directory # # ========================================================================== # called may set destination dir (when installing to asm/) -_dst := $(if $(dst),$(dst),$(obj)) +_dst := $(or $(destination-y),$(dst),$(obj)) # generated header directory gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj))) @@ -17,49 +16,64 @@ gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj))) kbuild-file := $(srctree)/$(obj)/Kbuild include $(kbuild-file) -_dst := $(if $(destination-y),$(destination-y),$(_dst)) +old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild +ifneq ($(wildcard $(old-kbuild-file)),) +include $(old-kbuild-file) +endif include scripts/Kbuild.include -install := $(INSTALL_HDR_PATH)/$(_dst) +installdir := $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst)) header-y := $(sort $(header-y)) subdirs := $(patsubst %/,%,$(filter %/, $(header-y))) header-y := $(filter-out %/, $(header-y)) # files used to track state of install/check -install-file := $(install)/.install -check-file := $(install)/.check +install-file := $(installdir)/.install +check-file := $(installdir)/.check # generic-y list all files an architecture uses from asm-generic # Use this to build a list of headers which require a wrapper wrapper-files := $(filter $(header-y), $(generic-y)) +srcdir := $(srctree)/$(obj) +gendir := $(objtree)/$(gen) + +oldsrcdir := $(srctree)/$(subst /uapi,,$(obj)) + # all headers files for this dir header-y := $(filter-out $(generic-y), $(header-y)) -all-files := $(header-y) $(objhdr-y) $(genhdr-y) $(wrapper-files) -input-files := $(addprefix $(srctree)/$(obj)/,$(header-y)) \ - $(addprefix $(objtree)/$(obj)/,$(objhdr-y)) \ - $(addprefix $(objtree)/$(gen)/,$(genhdr-y)) -output-files := $(addprefix $(install)/, $(all-files)) +all-files := $(header-y) $(genhdr-y) $(wrapper-files) +output-files := $(addprefix $(installdir)/, $(all-files)) + +input-files := $(foreach hdr, $(header-y), \ + $(or \ + $(wildcard $(srcdir)/$(hdr)), \ + $(wildcard $(oldsrcdir)/$(hdr)), \ + $(error Missing UAPI file $(srcdir)/$(hdr)) \ + )) \ + $(foreach hdr, $(genhdr-y), \ + $(or \ + $(wildcard $(gendir)/$(hdr)), \ + $(error Missing generated UAPI file $(gendir)/$(hdr)) \ + )) # Work out what needs to be removed -oldheaders := $(patsubst $(install)/%,%,$(wildcard $(install)/*.h)) +oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) unwanted := $(filter-out $(all-files),$(oldheaders)) # Prefix unwanted with full paths to $(INSTALL_HDR_PATH) -unwanted-file := $(addprefix $(install)/, $(unwanted)) +unwanted-file := $(addprefix $(installdir)/, $(unwanted)) printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ file$(if $(word 2, $(all-files)),s)) cmd_install = \ - $(PERL) $< $(srctree)/$(obj) $(install) $(SRCARCH) $(header-y); \ - $(PERL) $< $(objtree)/$(obj) $(install) $(SRCARCH) $(objhdr-y); \ - $(PERL) $< $(objtree)/$(gen) $(install) $(SRCARCH) $(genhdr-y); \ + $(PERL) $< $(installdir) $(SRCARCH) $(input-files); \ for F in $(wrapper-files); do \ - echo "\#include " > $(install)/$$F; \ + echo "\#include " > $(installdir)/$$F; \ done; \ touch $@ @@ -70,7 +84,7 @@ quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files) # Headers list can be pretty long, xargs helps to avoid # the "Argument list too long" error. cmd_check = for f in $(all-files); do \ - echo "$(install)/$${f}"; done \ + echo "$(installdir)/$${f}"; done \ | xargs \ $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \ touch $@ diff --git a/kernel/fiasco/tool/kconfig/scripts/Makefile.modinst b/kernel/fiasco/tool/kconfig/scripts/Makefile.modinst index efa5d940..ecbb4479 100644 --- a/kernel/fiasco/tool/kconfig/scripts/Makefile.modinst +++ b/kernel/fiasco/tool/kconfig/scripts/Makefile.modinst @@ -9,15 +9,16 @@ include scripts/Kbuild.include # -__modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) +__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod))) modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o))) PHONY += $(modules) __modinst: $(modules) @: +# Don't stop modules_install if we can't sign external modules. quiet_cmd_modules_install = INSTALL $@ - cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) + cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) ; $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) # Modules built outside the kernel source tree go into extra by default INSTALL_MOD_DIR ?= extra diff --git a/kernel/fiasco/tool/kconfig/scripts/Makefile.modpost b/kernel/fiasco/tool/kconfig/scripts/Makefile.modpost index 08dce14f..a1cb0222 100644 --- a/kernel/fiasco/tool/kconfig/scripts/Makefile.modpost +++ b/kernel/fiasco/tool/kconfig/scripts/Makefile.modpost @@ -60,7 +60,7 @@ kernelsymfile := $(objtree)/Module.symvers modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers # Step 1), find all modules listed in $(MODVERDIR)/ -__modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) +__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod))) modules := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o))) # Stop after building .o files if NOFINAL is set. Makes compile tests quicker diff --git a/kernel/fiasco/tool/kconfig/scripts/basic/.gitignore b/kernel/fiasco/tool/kconfig/scripts/basic/.gitignore new file mode 100644 index 00000000..a776371a --- /dev/null +++ b/kernel/fiasco/tool/kconfig/scripts/basic/.gitignore @@ -0,0 +1 @@ +fixdep diff --git a/kernel/fiasco/tool/kconfig/scripts/basic/docproc.c b/kernel/fiasco/tool/kconfig/scripts/basic/docproc.c deleted file mode 100644 index 98dec879..00000000 --- a/kernel/fiasco/tool/kconfig/scripts/basic/docproc.c +++ /dev/null @@ -1,583 +0,0 @@ -/* - * docproc is a simple preprocessor for the template files - * used as placeholders for the kernel internal documentation. - * docproc is used for documentation-frontend and - * dependency-generator. - * The two usages have in common that they require - * some knowledge of the .tmpl syntax, therefore they - * are kept together. - * - * documentation-frontend - * Scans the template file and call kernel-doc for - * all occurrences of ![EIF]file - * Beforehand each referenced file is scanned for - * any symbols that are exported via these macros: - * EXPORT_SYMBOL(), EXPORT_SYMBOL_GPL(), & - * EXPORT_SYMBOL_GPL_FUTURE() - * This is used to create proper -function and - * -nofunction arguments in calls to kernel-doc. - * Usage: docproc doc file.tmpl - * - * dependency-generator: - * Scans the template file and list all files - * referenced in a format recognized by make. - * Usage: docproc depend file.tmpl - * Writes dependency information to stdout - * in the following format: - * file.tmpl src.c src2.c - * The filenames are obtained from the following constructs: - * !Efilename - * !Ifilename - * !Dfilename - * !Ffilename - * !Pfilename - * - */ - -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* exitstatus is used to keep track of any failing calls to kernel-doc, - * but execution continues. */ -int exitstatus = 0; - -typedef void DFL(char *); -DFL *defaultline; - -typedef void FILEONLY(char * file); -FILEONLY *internalfunctions; -FILEONLY *externalfunctions; -FILEONLY *symbolsonly; -FILEONLY *findall; - -typedef void FILELINE(char * file, char * line); -FILELINE * singlefunctions; -FILELINE * entity_system; -FILELINE * docsection; - -#define MAXLINESZ 2048 -#define MAXFILES 250 -#define KERNELDOCPATH "scripts/" -#define KERNELDOC "kernel-doc" -#define DOCBOOK "-docbook" -#define LIST "-list" -#define FUNCTION "-function" -#define NOFUNCTION "-nofunction" -#define NODOCSECTIONS "-no-doc-sections" - -static char *srctree, *kernsrctree; - -static char **all_list = NULL; -static int all_list_len = 0; - -static void consume_symbol(const char *sym) -{ - int i; - - for (i = 0; i < all_list_len; i++) { - if (!all_list[i]) - continue; - if (strcmp(sym, all_list[i])) - continue; - all_list[i] = NULL; - break; - } -} - -static void usage (void) -{ - fprintf(stderr, "Usage: docproc {doc|depend} file\n"); - fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n"); - fprintf(stderr, "doc: frontend when generating kernel documentation\n"); - fprintf(stderr, "depend: generate list of files referenced within file\n"); - fprintf(stderr, "Environment variable SRCTREE: absolute path to sources.\n"); - fprintf(stderr, " KBUILD_SRC: absolute path to kernel source tree.\n"); -} - -/* - * Execute kernel-doc with parameters given in svec - */ -static void exec_kernel_doc(char **svec) -{ - pid_t pid; - int ret; - char real_filename[PATH_MAX + 1]; - /* Make sure output generated so far are flushed */ - fflush(stdout); - switch (pid=fork()) { - case -1: - perror("fork"); - exit(1); - case 0: - memset(real_filename, 0, sizeof(real_filename)); - strncat(real_filename, kernsrctree, PATH_MAX); - strncat(real_filename, "/" KERNELDOCPATH KERNELDOC, - PATH_MAX - strlen(real_filename)); - execvp(real_filename, svec); - fprintf(stderr, "exec "); - perror(real_filename); - exit(1); - default: - waitpid(pid, &ret ,0); - } - if (WIFEXITED(ret)) - exitstatus |= WEXITSTATUS(ret); - else - exitstatus = 0xff; -} - -/* Types used to create list of all exported symbols in a number of files */ -struct symbols -{ - char *name; -}; - -struct symfile -{ - char *filename; - struct symbols *symbollist; - int symbolcnt; -}; - -struct symfile symfilelist[MAXFILES]; -int symfilecnt = 0; - -static void add_new_symbol(struct symfile *sym, char * symname) -{ - sym->symbollist = - realloc(sym->symbollist, (sym->symbolcnt + 1) * sizeof(char *)); - sym->symbollist[sym->symbolcnt++].name = strdup(symname); -} - -/* Add a filename to the list */ -static struct symfile * add_new_file(char * filename) -{ - symfilelist[symfilecnt++].filename = strdup(filename); - return &symfilelist[symfilecnt - 1]; -} - -/* Check if file already are present in the list */ -static struct symfile * filename_exist(char * filename) -{ - int i; - for (i=0; i < symfilecnt; i++) - if (strcmp(symfilelist[i].filename, filename) == 0) - return &symfilelist[i]; - return NULL; -} - -/* - * List all files referenced within the template file. - * Files are separated by tabs. - */ -static void adddep(char * file) { printf("\t%s", file); } -static void adddep2(char * file, char * line) { line = line; adddep(file); } -static void noaction(char * line) { line = line; } -static void noaction2(char * file, char * line) { file = file; line = line; } - -/* Echo the line without further action */ -static void printline(char * line) { printf("%s", line); } - -/* - * Find all symbols in filename that are exported with EXPORT_SYMBOL & - * EXPORT_SYMBOL_GPL (& EXPORT_SYMBOL_GPL_FUTURE implicitly). - * All symbols located are stored in symfilelist. - */ -static void find_export_symbols(char * filename) -{ - FILE * fp; - struct symfile *sym; - char line[MAXLINESZ]; - if (filename_exist(filename) == NULL) { - char real_filename[PATH_MAX + 1]; - memset(real_filename, 0, sizeof(real_filename)); - strncat(real_filename, srctree, PATH_MAX); - strncat(real_filename, "/", PATH_MAX - strlen(real_filename)); - strncat(real_filename, filename, - PATH_MAX - strlen(real_filename)); - sym = add_new_file(filename); - fp = fopen(real_filename, "r"); - if (fp == NULL) - { - fprintf(stderr, "docproc: "); - perror(real_filename); - exit(1); - } - while (fgets(line, MAXLINESZ, fp)) { - char *p; - char *e; - if (((p = strstr(line, "EXPORT_SYMBOL_GPL")) != NULL) || - ((p = strstr(line, "EXPORT_SYMBOL")) != NULL)) { - /* Skip EXPORT_SYMBOL{_GPL} */ - while (isalnum(*p) || *p == '_') - p++; - /* Remove parentheses & additional whitespace */ - while (isspace(*p)) - p++; - if (*p != '(') - continue; /* Syntax error? */ - else - p++; - while (isspace(*p)) - p++; - e = p; - while (isalnum(*e) || *e == '_') - e++; - *e = '\0'; - add_new_symbol(sym, p); - } - } - fclose(fp); - } -} - -/* - * Document all external or internal functions in a file. - * Call kernel-doc with following parameters: - * kernel-doc -docbook -nofunction function_name1 filename - * Function names are obtained from all the src files - * by find_export_symbols. - * intfunc uses -nofunction - * extfunc uses -function - */ -static void docfunctions(char * filename, char * type) -{ - int i,j; - int symcnt = 0; - int idx = 0; - char **vec; - - for (i=0; i <= symfilecnt; i++) - symcnt += symfilelist[i].symbolcnt; - vec = malloc((2 + 2 * symcnt + 3) * sizeof(char *)); - if (vec == NULL) { - perror("docproc: "); - exit(1); - } - vec[idx++] = KERNELDOC; - vec[idx++] = DOCBOOK; - vec[idx++] = NODOCSECTIONS; - for (i=0; i < symfilecnt; i++) { - struct symfile * sym = &symfilelist[i]; - for (j=0; j < sym->symbolcnt; j++) { - vec[idx++] = type; - consume_symbol(sym->symbollist[j].name); - vec[idx++] = sym->symbollist[j].name; - } - } - vec[idx++] = filename; - vec[idx] = NULL; - printf("\n", filename); - exec_kernel_doc(vec); - fflush(stdout); - free(vec); -} -static void intfunc(char * filename) { docfunctions(filename, NOFUNCTION); } -static void extfunc(char * filename) { docfunctions(filename, FUNCTION); } - -/* - * Document specific function(s) in a file. - * Call kernel-doc with the following parameters: - * kernel-doc -docbook -function function1 [-function function2] - */ -static void singfunc(char * filename, char * line) -{ - char *vec[200]; /* Enough for specific functions */ - int i, idx = 0; - int startofsym = 1; - vec[idx++] = KERNELDOC; - vec[idx++] = DOCBOOK; - - /* Split line up in individual parameters preceded by FUNCTION */ - for (i=0; line[i]; i++) { - if (isspace(line[i])) { - line[i] = '\0'; - startofsym = 1; - continue; - } - if (startofsym) { - startofsym = 0; - vec[idx++] = FUNCTION; - vec[idx++] = &line[i]; - } - } - for (i = 0; i < idx; i++) { - if (strcmp(vec[i], FUNCTION)) - continue; - consume_symbol(vec[i + 1]); - } - vec[idx++] = filename; - vec[idx] = NULL; - exec_kernel_doc(vec); -} - -/* - * Insert specific documentation section from a file. - * Call kernel-doc with the following parameters: - * kernel-doc -docbook -function "doc section" filename - */ -static void docsect(char *filename, char *line) -{ - char *vec[6]; /* kerneldoc -docbook -function "section" file NULL */ - char *s; - - for (s = line; *s; s++) - if (*s == '\n') - *s = '\0'; - - if (asprintf(&s, "DOC: %s", line) < 0) { - perror("asprintf"); - exit(1); - } - consume_symbol(s); - free(s); - - vec[0] = KERNELDOC; - vec[1] = DOCBOOK; - vec[2] = FUNCTION; - vec[3] = line; - vec[4] = filename; - vec[5] = NULL; - exec_kernel_doc(vec); -} - -static void find_all_symbols(char *filename) -{ - char *vec[4]; /* kerneldoc -list file NULL */ - pid_t pid; - int ret, i, count, start; - char real_filename[PATH_MAX + 1]; - int pipefd[2]; - char *data, *str; - size_t data_len = 0; - - vec[0] = KERNELDOC; - vec[1] = LIST; - vec[2] = filename; - vec[3] = NULL; - - if (pipe(pipefd)) { - perror("pipe"); - exit(1); - } - - switch (pid=fork()) { - case -1: - perror("fork"); - exit(1); - case 0: - close(pipefd[0]); - dup2(pipefd[1], 1); - memset(real_filename, 0, sizeof(real_filename)); - strncat(real_filename, kernsrctree, PATH_MAX); - strncat(real_filename, "/" KERNELDOCPATH KERNELDOC, - PATH_MAX - strlen(real_filename)); - execvp(real_filename, vec); - fprintf(stderr, "exec "); - perror(real_filename); - exit(1); - default: - close(pipefd[1]); - data = malloc(4096); - do { - while ((ret = read(pipefd[0], - data + data_len, - 4096)) > 0) { - data_len += ret; - data = realloc(data, data_len + 4096); - } - } while (ret == -EAGAIN); - if (ret != 0) { - perror("read"); - exit(1); - } - waitpid(pid, &ret ,0); - } - if (WIFEXITED(ret)) - exitstatus |= WEXITSTATUS(ret); - else - exitstatus = 0xff; - - count = 0; - /* poor man's strtok, but with counting */ - for (i = 0; i < data_len; i++) { - if (data[i] == '\n') { - count++; - data[i] = '\0'; - } - } - start = all_list_len; - all_list_len += count; - all_list = realloc(all_list, sizeof(char *) * all_list_len); - str = data; - for (i = 0; i < data_len && start != all_list_len; i++) { - if (data[i] == '\0') { - all_list[start] = str; - str = data + i + 1; - start++; - } - } -} - -/* - * Parse file, calling action specific functions for: - * 1) Lines containing !E - * 2) Lines containing !I - * 3) Lines containing !D - * 4) Lines containing !F - * 5) Lines containing !P - * 6) Lines containing !C - * 7) Default lines - lines not matching the above - */ -static void parse_file(FILE *infile) -{ - char line[MAXLINESZ]; - char * s; - while (fgets(line, MAXLINESZ, infile)) { - if (line[0] == '!') { - s = line + 2; - switch (line[1]) { - case 'E': - while (*s && !isspace(*s)) s++; - *s = '\0'; - externalfunctions(line+2); - break; - case 'I': - while (*s && !isspace(*s)) s++; - *s = '\0'; - internalfunctions(line+2); - break; - case 'D': - while (*s && !isspace(*s)) s++; - *s = '\0'; - symbolsonly(line+2); - break; - case 'F': - /* filename */ - while (*s && !isspace(*s)) s++; - *s++ = '\0'; - /* function names */ - while (isspace(*s)) - s++; - singlefunctions(line +2, s); - break; - case 'P': - /* filename */ - while (*s && !isspace(*s)) s++; - *s++ = '\0'; - /* DOC: section name */ - while (isspace(*s)) - s++; - docsection(line + 2, s); - break; - case 'C': - while (*s && !isspace(*s)) s++; - *s = '\0'; - if (findall) - findall(line+2); - break; - default: - defaultline(line); - } - } - else { - defaultline(line); - } - } - fflush(stdout); -} - - -int main(int argc, char *argv[]) -{ - FILE * infile; - int i; - - srctree = getenv("SRCTREE"); - if (!srctree) - srctree = getcwd(NULL, 0); - kernsrctree = getenv("KBUILD_SRC"); - if (!kernsrctree || !*kernsrctree) - kernsrctree = srctree; - if (argc != 3) { - usage(); - exit(1); - } - /* Open file, exit on error */ - infile = fopen(argv[2], "r"); - if (infile == NULL) { - fprintf(stderr, "docproc: "); - perror(argv[2]); - exit(2); - } - - if (strcmp("doc", argv[1]) == 0) - { - /* Need to do this in two passes. - * First pass is used to collect all symbols exported - * in the various files; - * Second pass generate the documentation. - * This is required because some functions are declared - * and exported in different files :-(( - */ - /* Collect symbols */ - defaultline = noaction; - internalfunctions = find_export_symbols; - externalfunctions = find_export_symbols; - symbolsonly = find_export_symbols; - singlefunctions = noaction2; - docsection = noaction2; - findall = find_all_symbols; - parse_file(infile); - - /* Rewind to start from beginning of file again */ - fseek(infile, 0, SEEK_SET); - defaultline = printline; - internalfunctions = intfunc; - externalfunctions = extfunc; - symbolsonly = printline; - singlefunctions = singfunc; - docsection = docsect; - findall = NULL; - - parse_file(infile); - - for (i = 0; i < all_list_len; i++) { - if (!all_list[i]) - continue; - fprintf(stderr, "Warning: didn't use docs for %s\n", - all_list[i]); - } - } - else if (strcmp("depend", argv[1]) == 0) - { - /* Create first part of dependency chain - * file.tmpl */ - printf("%s\t", argv[2]); - defaultline = noaction; - internalfunctions = adddep; - externalfunctions = adddep; - symbolsonly = adddep; - singlefunctions = adddep2; - docsection = adddep2; - findall = adddep; - parse_file(infile); - printf("\n"); - } - else - { - fprintf(stderr, "Unknown option: %s\n", argv[1]); - exit(1); - } - fclose(infile); - fflush(stdout); - return exitstatus; -} diff --git a/kernel/fiasco/tool/kconfig/scripts/basic/hash.c b/kernel/fiasco/tool/kconfig/scripts/basic/hash.c deleted file mode 100644 index 2ef5d3f6..00000000 --- a/kernel/fiasco/tool/kconfig/scripts/basic/hash.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2008 Red Hat, Inc., Jason Baron - * - */ - -#include -#include -#include - -#define DYNAMIC_DEBUG_HASH_BITS 6 - -static const char *program; - -static void usage(void) -{ - printf("Usage: %s \n", program); - exit(1); -} - -/* djb2 hashing algorithm by Dan Bernstein. From: - * http://www.cse.yorku.ca/~oz/hash.html - */ - -static unsigned int djb2_hash(char *str) -{ - unsigned long hash = 5381; - int c; - - c = *str; - while (c) { - hash = ((hash << 5) + hash) + c; - c = *++str; - } - return (unsigned int)(hash & ((1 << DYNAMIC_DEBUG_HASH_BITS) - 1)); -} - -static unsigned int r5_hash(char *str) -{ - unsigned long hash = 0; - int c; - - c = *str; - while (c) { - hash = (hash + (c << 4) + (c >> 4)) * 11; - c = *++str; - } - return (unsigned int)(hash & ((1 << DYNAMIC_DEBUG_HASH_BITS) - 1)); -} - -int main(int argc, char *argv[]) -{ - program = argv[0]; - - if (argc != 3) - usage(); - if (!strcmp(argv[1], "djb2")) - printf("%d\n", djb2_hash(argv[2])); - else if (!strcmp(argv[1], "r5")) - printf("%d\n", r5_hash(argv[2])); - else - usage(); - exit(0); -} - diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/.gitignore b/kernel/fiasco/tool/kconfig/scripts/kconfig/.gitignore index ee120d44..be603c4f 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/.gitignore +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/.gitignore @@ -7,7 +7,6 @@ config* *.tab.h zconf.hash.c *.moc -lkc_defs.h gconf.glade.h *.pot *.mo diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/Makefile b/kernel/fiasco/tool/kconfig/scripts/kconfig/Makefile index 79662658..3091794e 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/Makefile +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/Makefile @@ -76,11 +76,17 @@ PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf $< --$@ $(Kconfig) -PHONY += listnewconfig oldnoconfig savedefconfig defconfig +PHONY += listnewconfig olddefconfig oldnoconfig savedefconfig defconfig -listnewconfig oldnoconfig: $(obj)/conf +listnewconfig olddefconfig: $(obj)/conf $< --$@ $(Kconfig) +# oldnoconfig is an alias of olddefconfig, because people already are dependent +# on its behavior(sets new symbols to their default value but not 'n') with the +# counter-intuitive name. +oldnoconfig: $(obj)/conf + $< --olddefconfig $(Kconfig) + savedefconfig: $(obj)/conf $< --$@=defconfig $(Kconfig) @@ -114,7 +120,7 @@ help: @echo ' alldefconfig - New config with all symbols set to default' @echo ' randconfig - New config with random answer to all options' @echo ' listnewconfig - List new options' - @echo ' oldnoconfig - Same as silentoldconfig but set new symbols to n (unset)' + @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value' # lxdialog stuff check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh @@ -234,12 +240,12 @@ $(obj)/.tmp_qtcheck: if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \ done; \ if [ -z "$$dir" ]; then \ - echo "*"; \ - echo "* Unable to find any QT installation. Please make sure that"; \ - echo "* the QT4 or QT3 development package is correctly installed and"; \ - echo "* either qmake can be found or install pkg-config or set"; \ - echo "* the QTDIR environment variable to the correct location."; \ - echo "*"; \ + echo >&2 "*"; \ + echo >&2 "* Unable to find any QT installation. Please make sure that"; \ + echo >&2 "* the QT4 or QT3 development package is correctly installed and"; \ + echo >&2 "* either qmake can be found or install pkg-config or set"; \ + echo >&2 "* the QTDIR environment variable to the correct location."; \ + echo >&2 "*"; \ false; \ fi; \ libpath=$$dir/lib; lib=qt; osdir=""; \ @@ -260,8 +266,8 @@ $(obj)/.tmp_qtcheck: else \ cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \ libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \ - binpath="\$$(shell pkg-config QtCore --variable=prefix)"; \ - moc="$$binpath/bin/moc"; \ + moc="\$$(shell pkg-config QtCore --variable=moc_location)"; \ + [ -n "$$moc" ] || moc="\$$(shell pkg-config QtCore --variable=prefix)/bin/moc"; \ fi; \ echo "KC_QT_CFLAGS=$$cflags" > $@; \ echo "KC_QT_LIBS=$$libs" >> $@; \ @@ -279,17 +285,17 @@ $(obj)/.tmp_gtkcheck: if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \ touch $@; \ else \ - echo "*"; \ - echo "* GTK+ is present but version >= 2.0.0 is required."; \ - echo "*"; \ + echo >&2 "*"; \ + echo >&2 "* GTK+ is present but version >= 2.0.0 is required."; \ + echo >&2 "*"; \ false; \ fi \ else \ - echo "*"; \ - echo "* Unable to find the GTK+ installation. Please make sure that"; \ - echo "* the GTK+ 2.0 development package is correctly installed..."; \ - echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \ - echo "*"; \ + echo >&2 "*"; \ + echo >&2 "* Unable to find the GTK+ installation. Please make sure that"; \ + echo >&2 "* the GTK+ 2.0 development package is correctly installed..."; \ + echo >&2 "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \ + echo >&2 "*"; \ false; \ fi endif @@ -298,8 +304,11 @@ $(obj)/zconf.tab.o: $(obj)/zconf.lex.c $(obj)/zconf.hash.c $(obj)/qconf.o: $(obj)/qconf.moc -$(obj)/%.moc: $(src)/%.h - $(KC_QT_MOC) -i $< -o $@ +quiet_cmd_moc = MOC $@ + cmd_moc = $(KC_QT_MOC) -i $< -o $@ + +$(obj)/%.moc: $(src)/%.h $(obj)/.tmp_qtcheck + $(call cmd,moc) # Extract gconf menu items for I18N support $(obj)/gconf.glade.h: $(obj)/gconf.glade diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/check.sh b/kernel/fiasco/tool/kconfig/scripts/kconfig/check.sh index fa59cbf9..854d9c7c 100755 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/check.sh +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/check.sh @@ -1,6 +1,6 @@ #!/bin/sh # Needed for systems without gettext -$* -xc -o /dev/null - > /dev/null 2>&1 << EOF +$* -x c -o /dev/null - > /dev/null 2>&1 << EOF #include int main() { diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/conf.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/conf.c index 0dc4a2c7..4da3b4ad 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/conf.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/conf.c @@ -32,7 +32,7 @@ enum input_mode { defconfig, savedefconfig, listnewconfig, - oldnoconfig, + olddefconfig, } input_mode = oldaskconfig; static int indent = 1; @@ -365,7 +365,7 @@ static void conf(struct menu *menu) case P_MENU: if ((input_mode == silentoldconfig || input_mode == listnewconfig || - input_mode == oldnoconfig) && + input_mode == olddefconfig) && rootEntry != menu) { check_conf(menu); return; @@ -429,7 +429,7 @@ static void check_conf(struct menu *menu) if (sym->name && !sym_is_choice_value(sym)) { printf("%s%s\n", CONFIG_, sym->name); } - } else if (input_mode != oldnoconfig) { + } else if (input_mode != olddefconfig) { if (!conf_cnt++) printf(_("*\n* Restart config...\n*\n")); rootEntry = menu_get_parent_menu(menu); @@ -454,7 +454,13 @@ static struct option long_opts[] = { {"alldefconfig", no_argument, NULL, alldefconfig}, {"randconfig", no_argument, NULL, randconfig}, {"listnewconfig", no_argument, NULL, listnewconfig}, - {"oldnoconfig", no_argument, NULL, oldnoconfig}, + {"olddefconfig", no_argument, NULL, olddefconfig}, + /* + * oldnoconfig is an alias of olddefconfig, because people already + * are dependent on its behavior(sets new symbols to their default + * value but not 'n') with the counter-intuitive name. + */ + {"oldnoconfig", no_argument, NULL, olddefconfig}, {NULL, 0, NULL, 0} }; @@ -467,7 +473,8 @@ static void conf_usage(const char *progname) printf(" --oldaskconfig Start a new configuration using a line-oriented program\n"); printf(" --oldconfig Update a configuration using a provided .config as base\n"); printf(" --silentoldconfig Same as oldconfig, but quietly, additionally update deps\n"); - printf(" --oldnoconfig Same as silentoldconfig but set new symbols to no\n"); + printf(" --olddefconfig Same as silentoldconfig but sets new symbols to their default value\n"); + printf(" --oldnoconfig An alias of olddefconfig\n"); printf(" --defconfig New config with default defined in \n"); printf(" --savedefconfig Save the minimal current configuration to \n"); printf(" --allnoconfig New config where all options are answered with no\n"); @@ -520,7 +527,7 @@ int main(int ac, char **av) case allmodconfig: case alldefconfig: case listnewconfig: - case oldnoconfig: + case olddefconfig: break; case '?': conf_usage(progname); @@ -565,7 +572,7 @@ int main(int ac, char **av) case oldaskconfig: case oldconfig: case listnewconfig: - case oldnoconfig: + case olddefconfig: conf_read(NULL); break; case allnoconfig: @@ -645,7 +652,7 @@ int main(int ac, char **av) /* fall through */ case oldconfig: case listnewconfig: - case oldnoconfig: + case olddefconfig: case silentoldconfig: /* Update until a loop caused no more changes */ do { @@ -653,7 +660,7 @@ int main(int ac, char **av) check_conf(&rootmenu); } while (conf_cnt && (input_mode != listnewconfig && - input_mode != oldnoconfig)); + input_mode != olddefconfig)); break; } diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/confdata.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/confdata.c index bcc2719d..13d89e32 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/confdata.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/confdata.c @@ -182,10 +182,66 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) return 0; } +#define LINE_GROWTH 16 +static int add_byte(int c, char **lineptr, size_t slen, size_t *n) +{ + char *nline; + size_t new_size = slen + 1; + if (new_size > *n) { + new_size += LINE_GROWTH - 1; + new_size *= 2; + nline = realloc(*lineptr, new_size); + if (!nline) + return -1; + + *lineptr = nline; + *n = new_size; + } + + (*lineptr)[slen] = c; + + return 0; +} + +static ssize_t compat_getline(char **lineptr, size_t *n, FILE *stream) +{ + char *line = *lineptr; + size_t slen = 0; + + for (;;) { + int c = getc(stream); + + switch (c) { + case '\n': + if (add_byte(c, &line, slen, n) < 0) + goto e_out; + slen++; + /* fall through */ + case EOF: + if (add_byte('\0', &line, slen, n) < 0) + goto e_out; + *lineptr = line; + if (slen == 0) + return -1; + return slen; + default: + if (add_byte(c, &line, slen, n) < 0) + goto e_out; + slen++; + } + } + +e_out: + line[slen-1] = '\0'; + *lineptr = line; + return -1; +} + int conf_read_simple(const char *name, int def) { FILE *in = NULL; - char line[1024]; + char *line = NULL; + size_t line_asize = 0; char *p, *p2; struct symbol *sym; int i, def_flags; @@ -247,7 +303,7 @@ load: } } - while (fgets(line, sizeof(line), in)) { + while (compat_getline(&line, &line_asize, in) != -1) { conf_lineno++; sym = NULL; if (line[0] == '#') { @@ -335,6 +391,7 @@ setsym: cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri); } } + free(line); fclose(in); if (modules_sym) diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/expr.h b/kernel/fiasco/tool/kconfig/scripts/kconfig/expr.h index d4ecce8b..cdd48600 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/expr.h +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/expr.h @@ -12,6 +12,7 @@ extern "C" { #include #include +#include "list.h" #ifndef __cplusplus #include #endif @@ -173,6 +174,15 @@ struct menu { #define MENU_CHANGED 0x0001 #define MENU_ROOT 0x0002 +struct jump_key { + struct list_head entries; + size_t offset; + struct menu *target; + int index; +}; + +#define JUMP_NB 9 + extern struct file *file_list; extern struct file *current_file; struct file *lookup_file(const char *name); diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/list.h b/kernel/fiasco/tool/kconfig/scripts/kconfig/list.h new file mode 100644 index 00000000..0ae730be --- /dev/null +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/list.h @@ -0,0 +1,91 @@ +#ifndef LIST_H +#define LIST_H + +/* + * Copied from include/linux/... + */ + +#undef offsetof +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) + +/** + * container_of - cast a member of a structure out to the containing structure + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. + * + */ +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + + +struct list_head { + struct list_head *next, *prev; +}; + + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + container_of(ptr, type, member) + +/** + * list_for_each_entry - iterate over list of given type + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry(pos, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member)) + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static inline int list_empty(const struct list_head *head) +{ + return head->next == head; +} + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_add(struct list_head *_new, + struct list_head *prev, + struct list_head *next) +{ + next->prev = _new; + _new->next = next; + _new->prev = prev; + prev->next = _new; +} + +/** + * list_add_tail - add a new entry + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static inline void list_add_tail(struct list_head *_new, struct list_head *head) +{ + __list_add(_new, head->prev, head); +} + +#endif diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/lkc_proto.h b/kernel/fiasco/tool/kconfig/scripts/kconfig/lkc_proto.h index 47fe9c34..ef1a7381 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/lkc_proto.h +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/lkc_proto.h @@ -21,8 +21,10 @@ P(menu_get_root_menu,struct menu *,(struct menu *menu)); P(menu_get_parent_menu,struct menu *,(struct menu *menu)); P(menu_has_help,bool,(struct menu *menu)); P(menu_get_help,const char *,(struct menu *menu)); -P(get_symbol_str, void, (struct gstr *r, struct symbol *sym)); -P(get_relations_str, struct gstr, (struct symbol **sym_arr)); +P(get_symbol_str, void, (struct gstr *r, struct symbol *sym, struct list_head + *head)); +P(get_relations_str, struct gstr, (struct symbol **sym_arr, struct list_head + *head)); P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help)); /* symbol.c */ 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 82cc3a85..c8e8a715 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/check-lxdialog.sh +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/check-lxdialog.sh @@ -4,7 +4,7 @@ # What library to link ldflags() { - for ext in so a dylib ; do + for ext in so a dll.a dylib ; do for lib in ncursesw ncurses curses ; do $cc -print-file-name=lib${lib}.${ext} | grep -q / if [ $? -eq 0 ]; then @@ -19,12 +19,12 @@ ldflags() # Where is ncurses.h? ccflags() { - if [ -f /usr/include/ncurses/ncurses.h ]; then + if [ -f /usr/include/ncursesw/curses.h ]; then + echo '-I/usr/include/ncursesw -DCURSES_LOC=""' + elif [ -f /usr/include/ncurses/ncurses.h ]; then echo '-I/usr/include/ncurses -DCURSES_LOC=""' elif [ -f /usr/include/ncurses/curses.h ]; then echo '-I/usr/include/ncurses -DCURSES_LOC=""' - elif [ -f /usr/include/ncursesw/curses.h ]; then - echo '-I/usr/include/ncursesw -DCURSES_LOC=""' elif [ -f /usr/include/ncurses.h ]; then echo '-DCURSES_LOC=""' else @@ -38,7 +38,7 @@ trap "rm -f $tmp" 0 1 2 3 15 # Check if we can link to ncurses check() { - $cc -xc - -o $tmp 2>/dev/null <<'EOF' + $cc -x c - -o $tmp 2>/dev/null <<'EOF' #include CURSES_LOC main() {} EOF diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/dialog.h b/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/dialog.h index b5211fce..ee17a526 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/dialog.h +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/dialog.h @@ -144,6 +144,7 @@ struct dialog_info { */ extern struct dialog_info dlg; extern char dialog_input_result[]; +extern int saved_x, saved_y; /* Needed in signal handler in mconf.c */ /* * Function prototypes @@ -209,7 +210,13 @@ int first_alpha(const char *string, const char *exempt); int dialog_yesno(const char *title, const char *prompt, int height, int width); int dialog_msgbox(const char *title, const char *prompt, int height, int width, int pause); -int dialog_textbox(const char *title, const char *file, int height, int width); + + +typedef void (*update_text_fn)(char *buf, size_t start, size_t end, void + *_data); +int dialog_textbox(const char *title, char *tbuf, int initial_height, + int initial_width, int *keys, int *_vscroll, int *_hscroll, + update_text_fn update_text, void *data); 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, diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/textbox.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/textbox.c index 154c2dd2..a48bb93e 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/textbox.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/textbox.c @@ -22,23 +22,25 @@ #include "dialog.h" static void back_lines(int n); -static void print_page(WINDOW * win, int height, int width); -static void print_line(WINDOW * win, int row, int width); +static void print_page(WINDOW *win, int height, int width, update_text_fn + update_text, void *data); +static void print_line(WINDOW *win, int row, int width); static char *get_line(void); static void print_position(WINDOW * win); static int hscroll; static int begin_reached, end_reached, page_length; -static const char *buf; -static const char *page; +static char *buf; +static char *page; /* * refresh window content */ static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw, - int cur_y, int cur_x) + int cur_y, int cur_x, update_text_fn update_text, + void *data) { - print_page(box, boxh, boxw); + print_page(box, boxh, boxw, update_text, data); print_position(dialog); wmove(dialog, cur_y, cur_x); /* Restore cursor position */ wrefresh(dialog); @@ -47,14 +49,18 @@ static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw, /* * Display text from a file in a dialog box. + * + * keys is a null-terminated array + * update_text() may not add or remove any '\n' or '\0' in tbuf */ -int dialog_textbox(const char *title, const char *tbuf, - int initial_height, int initial_width) +int dialog_textbox(const char *title, char *tbuf, int initial_height, + int initial_width, int *keys, int *_vscroll, int *_hscroll, + update_text_fn update_text, void *data) { int i, x, y, cur_x, cur_y, key = 0; int height, width, boxh, boxw; - int passed_end; WINDOW *dialog, *box; + bool done = false; begin_reached = 1; end_reached = 0; @@ -63,6 +69,15 @@ int dialog_textbox(const char *title, const char *tbuf, buf = tbuf; page = buf; /* page is pointer to start of page to be displayed */ + if (_vscroll && *_vscroll) { + begin_reached = 0; + + for (i = 0; i < *_vscroll; i++) + get_line(); + } + if (_hscroll) + hscroll = *_hscroll; + do_resize: getmaxyx(stdscr, height, width); if (height < 8 || width < 8) @@ -120,25 +135,28 @@ do_resize: /* Print first page of text */ attr_clear(box, boxh, boxw, dlg.dialog.atr); - refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x, update_text, + data); - while ((key != KEY_ESC) && (key != '\n')) { + while (!done) { key = wgetch(dialog); switch (key) { case 'E': /* Exit */ case 'e': case 'X': case 'x': - delwin(box); - delwin(dialog); - return 0; + case 'q': + case '\n': + done = true; + break; case 'g': /* First page */ case KEY_HOME: if (!begin_reached) { begin_reached = 1; page = buf; refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x); + cur_y, cur_x, update_text, + data); } break; case 'G': /* Last page */ @@ -148,78 +166,48 @@ do_resize: /* point to last char in buf */ page = buf + strlen(buf); back_lines(boxh); - refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case 'K': /* Previous line */ case 'k': case KEY_UP: - if (!begin_reached) { - back_lines(page_length + 1); + if (begin_reached) + break; - /* We don't call print_page() here but use - * scrolling to ensure faster screen update. - * However, 'end_reached' and 'page_length' - * should still be updated, and 'page' should - * point to start of next page. This is done - * by calling get_line() in the following - * 'for' loop. */ - scrollok(box, TRUE); - wscrl(box, -1); /* Scroll box region down one line */ - scrollok(box, FALSE); - page_length = 0; - passed_end = 0; - for (i = 0; i < boxh; i++) { - if (!i) { - /* print first line of page */ - print_line(box, 0, boxw); - wnoutrefresh(box); - } else - /* Called to update 'end_reached' and 'page' */ - get_line(); - if (!passed_end) - page_length++; - if (end_reached && !passed_end) - passed_end = 1; - } - - print_position(dialog); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - } + back_lines(page_length + 1); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case 'B': /* Previous page */ case 'b': + case 'u': case KEY_PPAGE: if (begin_reached) break; back_lines(page_length + boxh); - refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case 'J': /* Next line */ case 'j': case KEY_DOWN: - if (!end_reached) { - begin_reached = 0; - scrollok(box, TRUE); - scroll(box); /* Scroll box region up one line */ - scrollok(box, FALSE); - print_line(box, boxh - 1, boxw); - wnoutrefresh(box); - print_position(dialog); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - } + if (end_reached) + break; + + back_lines(page_length - 1); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case KEY_NPAGE: /* Next page */ case ' ': + case 'd': if (end_reached) break; begin_reached = 0; - refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case '0': /* Beginning of line */ case 'H': /* Scroll left */ @@ -234,8 +222,8 @@ do_resize: hscroll--; /* Reprint current page to scroll horizontally */ back_lines(page_length); - refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case 'L': /* Scroll right */ case 'l': @@ -245,11 +233,12 @@ do_resize: hscroll++; /* Reprint current page to scroll horizontally */ back_lines(page_length); - refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case KEY_ESC: - key = on_key_esc(dialog); + if (on_key_esc(dialog) == KEY_ESC) + done = true; break; case KEY_RESIZE: back_lines(height); @@ -257,11 +246,31 @@ do_resize: delwin(dialog); on_key_resize(); goto do_resize; + default: + for (i = 0; keys[i]; i++) { + if (key == keys[i]) { + done = true; + break; + } + } } } delwin(box); delwin(dialog); - return key; /* ESC pressed */ + if (_vscroll) { + const char *s; + + s = buf; + *_vscroll = 0; + back_lines(page_length); + while (s < page && (s = strchr(s, '\n'))) { + (*_vscroll)++; + s++; + } + } + if (_hscroll) + *_hscroll = hscroll; + return key; } /* @@ -298,12 +307,23 @@ static void back_lines(int n) } /* - * Print a new page of text. Called by dialog_textbox(). + * Print a new page of text. */ -static void print_page(WINDOW * win, int height, int width) +static void print_page(WINDOW *win, int height, int width, update_text_fn + update_text, void *data) { int i, passed_end = 0; + if (update_text) { + char *end; + + for (i = 0; i < height; i++) + get_line(); + end = page; + back_lines(height); + update_text(buf, page - buf, end - buf, data); + } + page_length = 0; for (i = 0; i < height; i++) { print_line(win, i, width); @@ -316,7 +336,7 @@ static void print_page(WINDOW * win, int height, int width) } /* - * Print a new line of text. Called by dialog_textbox() and print_page(). + * Print a new line of text. */ static void print_line(WINDOW * win, int row, int width) { @@ -354,10 +374,8 @@ static char *get_line(void) end_reached = 0; while (*page != '\n') { if (*page == '\0') { - if (!end_reached) { - end_reached = 1; - break; - } + end_reached = 1; + break; } else if (i < MAX_LEN) line[i++] = *(page++); else { @@ -370,7 +388,7 @@ static char *get_line(void) if (i <= MAX_LEN) line[i] = '\0'; if (!end_reached) - page++; /* move pass '\n' */ + page++; /* move past '\n' */ return line; } diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/util.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/util.c index f2375ad7..109d5311 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/util.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/lxdialog/util.c @@ -23,6 +23,9 @@ #include "dialog.h" +/* Needed in signal handler in mconf.c */ +int saved_x, saved_y; + struct dialog_info dlg; static void set_mono_theme(void) @@ -273,6 +276,10 @@ int init_dialog(const char *backtitle) int height, width; initscr(); /* Init curses */ + + /* Get current cursor position for signal handler in mconf.c */ + getyx(stdscr, saved_y, saved_x); + getmaxyx(stdscr, height, width); if (height < 19 || width < 80) { endwin(); diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/mconf.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/mconf.c index f606738d..53975cf8 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/mconf.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/mconf.c @@ -105,10 +105,10 @@ static const char mconf_readme[] = 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 those\n" -" who are familiar with less and lynx.\n" +" keys h,j,k,l function here as do , , and for \n" +" those who are familiar with less and lynx.\n" "\n" -"o Press , , or to exit.\n" +"o Press , , , or to exit.\n" "\n" "\n" "Alternate Configuration Files\n" @@ -236,16 +236,19 @@ search_help[] = N_( "Result:\n" "-----------------------------------------------------------------\n" "Symbol: FOO [=m]\n" + "Type : tristate\n" "Prompt: Foo bus is used to drive the bar HW\n" - "Defined at drivers/pci/Kconfig:47\n" - "Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n" - "Location:\n" - " -> Bus options (PCI, PCMCIA, EISA, ISA)\n" - " -> PCI support (PCI [=y])\n" - " -> PCI access mode ( [=y])\n" - "Selects: LIBCRC32\n" - "Selected by: BAR\n" + " Defined at drivers/pci/Kconfig:47\n" + " Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n" + " Location:\n" + " -> Bus options (PCI, PCMCIA, EISA, ISA)\n" + " -> PCI support (PCI [=y])\n" + "(1) -> PCI access mode ( [=y])\n" + " Selects: LIBCRC32\n" + " Selected by: BAR\n" "-----------------------------------------------------------------\n" + "o The line 'Type:' shows the type of the configuration option for\n" + " this symbol (boolean, tristate, string, ...)\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" @@ -254,8 +257,12 @@ search_help[] = 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" + " A location followed by a [=y] indicates that this is a\n" + " selectable menu item - and the current value is displayed inside\n" + " brackets.\n" + " Press the key in the (#) prefix to jump directly to that\n" + " location. You will be returned to the current search results\n" + " after exiting this new menu.\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" @@ -273,13 +280,15 @@ static struct menu *current_menu; static int child_count; static int single_menu_mode; static int show_all_options; -static int saved_x, saved_y; -static void conf(struct menu *menu); +static void conf(struct menu *menu, struct menu *active_menu); static void conf_choice(struct menu *menu); static void conf_string(struct menu *menu); static void conf_load(void); static void conf_save(void); +static int show_textbox_ext(const char *title, char *text, int r, int c, + int *keys, int *vscroll, int *hscroll, + update_text_fn update_text, void *data); static void show_textbox(const char *title, const char *text, int r, int c); static void show_helptext(const char *title, const char *text); static void show_help(struct menu *menu); @@ -302,12 +311,47 @@ static void set_config_filename(const char *config_filename) } +struct search_data { + struct list_head *head; + struct menu **targets; + int *keys; +}; + +static void update_text(char *buf, size_t start, size_t end, void *_data) +{ + struct search_data *data = _data; + struct jump_key *pos; + int k = 0; + + list_for_each_entry(pos, data->head, entries) { + if (pos->offset >= start && pos->offset < end) { + char header[4]; + + if (k < JUMP_NB) { + int key = '0' + (pos->index % JUMP_NB) + 1; + + sprintf(header, "(%c)", key); + data->keys[k] = key; + data->targets[k] = pos->target; + k++; + } else { + sprintf(header, " "); + } + + memcpy(buf + pos->offset, header, sizeof(header) - 1); + } + } + data->keys[k] = 0; +} + static void search_conf(void) { struct symbol **sym_arr; struct gstr res; char *dialog_input; - int dres; + int dres, vscroll = 0, hscroll = 0; + bool again; + again: dialog_clear(); dres = dialog_inputbox(_("Search Configuration Parameter"), @@ -330,10 +374,30 @@ again: dialog_input += strlen(CONFIG_); sym_arr = sym_re_search(dialog_input); - res = get_relations_str(sym_arr); + do { + LIST_HEAD(head); + struct menu *targets[JUMP_NB]; + int keys[JUMP_NB + 1], i; + struct search_data data = { + .head = &head, + .targets = targets, + .keys = keys, + }; + + res = get_relations_str(sym_arr, &head); + dres = show_textbox_ext(_("Search Results"), (char *) + str_get(&res), 0, 0, keys, &vscroll, + &hscroll, &update_text, (void *) + &data); + again = false; + for (i = 0; i < JUMP_NB && keys[i]; i++) + if (dres == keys[i]) { + conf(targets[i]->parent, targets[i]); + again = true; + } + str_free(&res); + } while (again); free(sym_arr); - show_textbox(_("Search Results"), str_get(&res), 0, 0); - str_free(&res); } static void build_conf(struct menu *menu) @@ -514,12 +578,11 @@ conf_childs: indent -= doint; } -static void conf(struct menu *menu) +static void conf(struct menu *menu, struct menu *active_menu) { struct menu *submenu; const char *prompt = menu_get_prompt(menu); struct symbol *sym; - struct menu *active_menu = NULL; int res; int s_scroll = 0; @@ -562,13 +625,13 @@ static void conf(struct menu *menu) if (single_menu_mode) submenu->data = (void *) (long) !submenu->data; else - conf(submenu); + conf(submenu, NULL); break; case 't': if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) conf_choice(submenu); else if (submenu->prompt->type == P_MENU) - conf(submenu); + conf(submenu, NULL); break; case 's': conf_string(submenu); @@ -607,7 +670,7 @@ static void conf(struct menu *menu) if (item_is_tag('t')) sym_toggle_tristate_value(sym); else if (item_is_tag('m')) - conf(submenu); + conf(submenu, NULL); break; case 7: search_conf(); @@ -619,10 +682,19 @@ static void conf(struct menu *menu) } } -static void show_textbox(const char *title, const char *text, int r, int c) +static int show_textbox_ext(const char *title, char *text, int r, int c, int + *keys, int *vscroll, int *hscroll, update_text_fn + update_text, void *data) { dialog_clear(); - dialog_textbox(title, text, r, c); + return dialog_textbox(title, text, r, c, keys, vscroll, hscroll, + update_text, data); +} + +static void show_textbox(const char *title, const char *text, int r, int c) +{ + show_textbox_ext(title, (char *) text, r, c, (int []) {0}, NULL, NULL, + NULL, NULL); } static void show_helptext(const char *title, const char *text) @@ -862,9 +934,6 @@ int main(int ac, char **av) single_menu_mode = 1; } - initscr(); - - getyx(stdscr, saved_y, saved_x); if (init_dialog(NULL)) { fprintf(stderr, N_("Your display is too small to run Menuconfig!\n")); fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n")); @@ -873,7 +942,7 @@ int main(int ac, char **av) set_config_filename(conf_get_configname()); do { - conf(&rootmenu); + conf(&rootmenu, NULL); res = handle_exit(); } while (res == KEY_ESC); diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/menu.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/menu.c index 8c2a97e6..e98a05c8 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/menu.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/menu.c @@ -507,10 +507,12 @@ const char *menu_get_help(struct menu *menu) return ""; } -static void get_prompt_str(struct gstr *r, struct property *prop) +static void get_prompt_str(struct gstr *r, struct property *prop, + struct list_head *head) { int i, j; - struct menu *submenu[8], *menu; + struct menu *submenu[8], *menu, *location = NULL; + struct jump_key *jump; str_printf(r, _("Prompt: %s\n"), _(prop->text)); str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name, @@ -521,13 +523,44 @@ static void get_prompt_str(struct gstr *r, struct property *prop) str_append(r, "\n"); } menu = prop->menu->parent; - for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) + for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) { + bool accessible = menu_is_visible(menu); + submenu[i++] = menu; + if (location == NULL && accessible) + location = menu; + } + if (head && location) { + jump = malloc(sizeof(struct jump_key)); + + if (menu_is_visible(prop->menu)) { + /* + * There is not enough room to put the hint at the + * beginning of the "Prompt" line. Put the hint on the + * last "Location" line even when it would belong on + * the former. + */ + jump->target = prop->menu; + } else + jump->target = location; + + if (list_empty(head)) + jump->index = 0; + else + jump->index = list_entry(head->prev, struct jump_key, + entries)->index + 1; + + list_add_tail(&jump->entries, head); + } + if (i > 0) { str_printf(r, _(" Location:\n")); for (j = 4; --i >= 0; j += 2) { menu = submenu[i]; - str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu))); + if (head && location && menu == location) + jump->offset = r->len - 1; + str_printf(r, "%*c-> %s", j, ' ', + _(menu_get_prompt(menu))); if (menu->sym) { str_printf(r, " (%s [=%s])", menu->sym->name ? menu->sym->name : _(""), @@ -538,7 +571,11 @@ static void get_prompt_str(struct gstr *r, struct property *prop) } } -void get_symbol_str(struct gstr *r, struct symbol *sym) +/* + * head is optional and may be NULL + */ +void get_symbol_str(struct gstr *r, struct symbol *sym, + struct list_head *head) { bool hit; struct property *prop; @@ -557,7 +594,7 @@ void get_symbol_str(struct gstr *r, struct symbol *sym) } } for_all_prompts(sym, prop) - get_prompt_str(r, prop); + get_prompt_str(r, prop, head); hit = false; for_all_properties(sym, prop, P_SELECT) { if (!hit) { @@ -577,14 +614,14 @@ void get_symbol_str(struct gstr *r, struct symbol *sym) str_append(r, "\n\n"); } -struct gstr get_relations_str(struct symbol **sym_arr) +struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head) { struct symbol *sym; struct gstr res = str_new(); int i; for (i = 0; sym_arr && (sym = sym_arr[i]); i++) - get_symbol_str(&res, sym); + get_symbol_str(&res, sym, head); if (!i) str_append(&res, _("No matches found.\n")); return res; @@ -603,5 +640,5 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help) } str_printf(help, "%s\n", _(help_text)); if (sym) - get_symbol_str(help, sym); + get_symbol_str(help, sym, NULL); } diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/nconf.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/nconf.c index 8c0eb659..87d4b15d 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/nconf.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/nconf.c @@ -83,10 +83,10 @@ static const char nconf_readme[] = 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 for those\n" -" who are familiar with less and lynx.\n" +" keys h,j,k,l function here as do , and for\n" +" those who are familiar with less and lynx.\n" "\n" -"o Press , , , or to exit.\n" +"o Press , , , , or to exit.\n" "\n" "\n" "Alternate Configuration Files\n" @@ -721,7 +721,7 @@ again: dialog_input += strlen(CONFIG_); sym_arr = sym_re_search(dialog_input); - res = get_relations_str(sym_arr); + res = get_relations_str(sym_arr, NULL); free(sym_arr); show_scroll_win(main_window, _("Search Results"), str_get(&res)); @@ -1503,7 +1503,11 @@ int main(int ac, char **av) } notimeout(stdscr, FALSE); +#if NCURSES_REENTRANT + set_escdelay(1); +#else ESCDELAY = 1; +#endif /* set btns menu */ curses_menu = new_menu(curses_menu_items); diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/nconf.gui.c b/kernel/fiasco/tool/kconfig/scripts/kconfig/nconf.gui.c index 3b18dd83..379003c7 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/nconf.gui.c +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/nconf.gui.c @@ -604,9 +604,11 @@ void show_scroll_win(WINDOW *main_window, switch (res) { case KEY_NPAGE: case ' ': + case 'd': start_y += text_lines-2; break; case KEY_PPAGE: + case 'u': start_y -= text_lines+2; break; case KEY_HOME: @@ -632,10 +634,10 @@ void show_scroll_win(WINDOW *main_window, start_x++; break; } - if (res == 10 || res == 27 || res == 'q' - || res == KEY_F(F_BACK) || res == KEY_F(F_EXIT)) { + if (res == 10 || res == 27 || res == 'q' || + res == KEY_F(F_HELP) || res == KEY_F(F_BACK) || + res == KEY_F(F_EXIT)) break; - } if (start_y < 0) start_y = 0; if (start_y >= total_lines-text_lines) diff --git a/kernel/fiasco/tool/kconfig/scripts/kconfig/zconf.tab.c_shipped b/kernel/fiasco/tool/kconfig/scripts/kconfig/zconf.tab.c_shipped index d2c56f3c..f636141e 100644 --- a/kernel/fiasco/tool/kconfig/scripts/kconfig/zconf.tab.c_shipped +++ b/kernel/fiasco/tool/kconfig/scripts/kconfig/zconf.tab.c_shipped @@ -2259,7 +2259,7 @@ void conf_parse(const char *name) modules_sym = sym_lookup(NULL, 0); modules_sym->type = S_BOOLEAN; modules_sym->flags |= SYMBOL_AUTO; - rootmenu.prompt = menu_add_prompt(P_MENU, "Fiasco Kernel Configuration", NULL); + rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); if (getenv("ZCONF_DEBUG")) zconfdebug = 1; diff --git a/kernel/fiasco/tool/preprocess/src/preprocess b/kernel/fiasco/tool/preprocess/src/preprocess index 0e4d4553..7abbe61d 100755 --- a/kernel/fiasco/tool/preprocess/src/preprocess +++ b/kernel/fiasco/tool/preprocess/src/preprocess @@ -734,7 +734,8 @@ sub parse_file } # Member function definition? - if (/^([^\{\(]*?) # pretext, maybe w template decl tag +# if (/^([^\{\(]*?) # pretext, maybe w template decl tag + if (/^((?:[^\{\(]|\(\()*?) # pretext, maybe w template decl tag \b ($identifier (?: $s :: $s $identifier)*) # class name ($s $template_arg)? # optional class-template args $s :: $s @@ -745,7 +746,7 @@ sub parse_file { my ($pretext, $class, $templateargs, $name, $args, $posttext) = ($1, $2, (defined $3 ? $3 : ''), $4, $5, $6); -#print "P<$pretext> C<$class> T<$templateargs> N<$name> A<$args> P<$posttext>\n"; +#print "Member: P<$pretext> C<$class> T<$templateargs> N<$name> A<$args> P<$posttext>\n"; # Canonify operator names $name =~ s/(?<=\w)(?:$s_once)+(?=\W)//gs; $name =~ s/(?<=\W)(?:$s_once)+(?=\w)//gs; @@ -769,6 +770,7 @@ sub parse_file $s( \( $paren_expr \) [^:\{\(\)=]*) # arg list (\{.*)$/sx) # body { +#print "Free function: $2 T(" . (defined $3 ? $3 : "") . ") PRE($1) ARGS($4) POST($5)\n"; my $function = { class => '', name => $2, templateargs => (defined $3 @@ -869,7 +871,7 @@ sub read_more () # Read one more line of code. Stow away s/\003/$saved/s; } - while (s|(//(?!-\s*\n).*)$|\001$number\001|m) # Do not match magic "//-" + while (s|(//(?!-\s*\n).*\n)|\001$number\001|m) # Do not match magic "//-" { # The \001 signifies whitespace. push @comments, $1; $number++; @@ -1145,7 +1147,6 @@ sub handle_function if ($match =~ /^(?:${s}template$s<${s}>)+${s}$/s); $func->{pretext} =~ s/\Q$match//s; -# $func->{pretext} =~ s|$template[ \t]*||s; next; } diff --git a/kernel/fiasco/tool/preprocess/test/Makefile b/kernel/fiasco/tool/preprocess/test/Makefile index 652866c6..3d48137a 100644 --- a/kernel/fiasco/tool/preprocess/test/Makefile +++ b/kernel/fiasco/tool/preprocess/test/Makefile @@ -13,7 +13,7 @@ TOOL_TESTS = mapping mapping_inline random random_inline extern_c static \ parser parser_noinline \ multifile variable line line_not line_nh interface comment_in_string \ default_args drop_single1 drop_single2 drop_single3 drop_multi1 \ - drop_multi2 + drop_multi2 implement_template mapping_inline_src = mapping mapping_inline_flags = -i diff --git a/kernel/fiasco/tool/preprocess/test/implement_template.cpp b/kernel/fiasco/tool/preprocess/test/implement_template.cpp new file mode 100644 index 00000000..ae81de0d --- /dev/null +++ b/kernel/fiasco/tool/preprocess/test/implement_template.cpp @@ -0,0 +1,31 @@ +INTERFACE: + +template< typename T > +class Test +{ +public: + void test_func(); +}; + + +IMPLEMENTATION: + +IMPLEMENT +template< typename T > +// comment +void __attribute__((deprecated)) +Test::test_func() +{ +} + +PUBLIC +template< typename T > // comment 1 +template< + typename X, // comment within template args list + typename X2 // another comment in tl args +> +// comment 2 +void __attribute__((deprecated)) +Test::test_func2() +{ +} diff --git a/kernel/fiasco/tool/preprocess/test/verify/implement_template.cc b/kernel/fiasco/tool/preprocess/test/verify/implement_template.cc new file mode 100644 index 00000000..89fa57ed --- /dev/null +++ b/kernel/fiasco/tool/preprocess/test/verify/implement_template.cc @@ -0,0 +1,5 @@ +// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*- + +#include "implement_template.h" +#include "implement_template_i.h" + diff --git a/kernel/fiasco/tool/preprocess/test/verify/implement_template.h b/kernel/fiasco/tool/preprocess/test/verify/implement_template.h new file mode 100644 index 00000000..4cd44334 --- /dev/null +++ b/kernel/fiasco/tool/preprocess/test/verify/implement_template.h @@ -0,0 +1,58 @@ +// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*- + +#ifndef implement_template_h +#define implement_template_h + +// +// INTERFACE definition follows +// + +#line 2 "implement_template.cpp" + +template< typename T > +class Test +{ +public: + void test_func(); + +public: +#line 23 "implement_template.cpp" + // comment 2 + // comment 1 + template< + typename X, // comment within template args list + typename X2 // another comment in tl args + > void __attribute__((deprecated)) + test_func2(); +}; + +// +// IMPLEMENTATION of function templates +// + + +#line 12 "implement_template.cpp" + + + +// comment +template< typename T > void __attribute__((deprecated)) +Test::test_func() +{ +} + +#line 20 "implement_template.cpp" + + + +// comment 2 + // comment 1 +template< typename T > template< + typename X, // comment within template args list + typename X2 // another comment in tl args +> void __attribute__((deprecated)) +Test::test_func2() +{ +} + +#endif // implement_template_h diff --git a/kernel/fiasco/tool/preprocess/test/verify/implement_template_i.h b/kernel/fiasco/tool/preprocess/test/verify/implement_template_i.h new file mode 100644 index 00000000..da19d7d1 --- /dev/null +++ b/kernel/fiasco/tool/preprocess/test/verify/implement_template_i.h @@ -0,0 +1,6 @@ +// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*- + +#ifndef implement_template_i_h +#define implement_template_i_h + +#endif // implement_template_i_h diff --git a/kernel/fiasco/tool/preprocess/test/verify/line_nh.h b/kernel/fiasco/tool/preprocess/test/verify/line_nh.h index bbe70c07..154804e2 100644 --- a/kernel/fiasco/tool/preprocess/test/verify/line_nh.h +++ b/kernel/fiasco/tool/preprocess/test/verify/line_nh.h @@ -15,6 +15,7 @@ class Foo public: // A long, multiline comment in front of this function definition. // Also, a lot of specifiers that need to be handled. + static void func1(); }; diff --git a/kernel/fiasco/tool/preprocess/test/verify/line_not.cc b/kernel/fiasco/tool/preprocess/test/verify/line_not.cc index eb1d7ca6..ff1bbb81 100644 --- a/kernel/fiasco/tool/preprocess/test/verify/line_not.cc +++ b/kernel/fiasco/tool/preprocess/test/verify/line_not.cc @@ -8,6 +8,7 @@ // A long, multiline comment in front of this function definition. // Also, a lot of specifiers that need to be handled. + void Foo::func1() { diff --git a/kernel/fiasco/tool/preprocess/test/verify/line_not.h b/kernel/fiasco/tool/preprocess/test/verify/line_not.h index 11ab555d..f563d556 100644 --- a/kernel/fiasco/tool/preprocess/test/verify/line_not.h +++ b/kernel/fiasco/tool/preprocess/test/verify/line_not.h @@ -15,6 +15,7 @@ class Foo public: // A long, multiline comment in front of this function definition. // Also, a lot of specifiers that need to be handled. + static void func1(); }; diff --git a/kernel/fiasco/tool/preprocess/test/verify/operator.h b/kernel/fiasco/tool/preprocess/test/verify/operator.h index 1ce3cf4f..4d63c04e 100644 --- a/kernel/fiasco/tool/preprocess/test/verify/operator.h +++ b/kernel/fiasco/tool/preprocess/test/verify/operator.h @@ -17,17 +17,21 @@ public: void * operator new(size_t); // funny comment + #line 16 "operator.cpp" Foo& operator+(const Foo&); // funny comment + #line 22 "operator.cpp" Foo& operator=(const Foo&); // funny comment + #line 28 "operator.cpp" Foo& operator*(const Foo&); // funny comment + }; #line 34 "operator.cpp" diff --git a/kernel/fiasco/tool/preprocess/test/verify/template.cc b/kernel/fiasco/tool/preprocess/test/verify/template.cc index 2e60849f..f3fd7d6b 100644 --- a/kernel/fiasco/tool/preprocess/test/verify/template.cc +++ b/kernel/fiasco/tool/preprocess/test/verify/template.cc @@ -12,13 +12,3 @@ create_stack() { return new stack(); } - -#line 192 "template.cpp" - - - -template <> stack_t* -create_stack() -{ - return new stack(); -} diff --git a/kernel/fiasco/tool/preprocess/test/verify/template.h b/kernel/fiasco/tool/preprocess/test/verify/template.h index 320fceb2..79ab22e2 100644 --- a/kernel/fiasco/tool/preprocess/test/verify/template.h +++ b/kernel/fiasco/tool/preprocess/test/verify/template.h @@ -109,9 +109,24 @@ template <> stack_t* create_stack(); #line 195 "template.cpp" -template <> stack_t* +template <> inline stack_t* create_stack(); +// +// IMPLEMENTATION of inline functions (and needed classes) +// + + +#line 192 "template.cpp" + + + +template <> inline stack_t* +create_stack() +{ + return new stack(); +} + // // IMPLEMENTATION of function templates // diff --git a/l4/Makefile b/l4/Makefile index 259d6cc7..9c879b8c 100644 --- a/l4/Makefile +++ b/l4/Makefile @@ -388,13 +388,12 @@ define genimage endef define switch_ram_base_func - echo " ... Regenerating RAM_BASE settings"; \ + echo " ... Regenerating RAM_BASE settings"; set -e; \ echo "# File semi-automatically generated by 'make switch_ram_base'" > $(OBJ_BASE)/Makeconf.ram_base; \ - echo "# Currently being regenerated" >> $(OBJ_BASE)/Makeconf.ram_base; \ + echo "RAM_BASE := $(1)" >> $(OBJ_BASE)/Makeconf.ram_base; \ PWD=$(PWD)/pkg/sigma0/server/src $(MAKE) RAM_BASE=$(1) -C pkg/sigma0/server/src; \ PWD=$(PWD)/pkg/moe/server/src $(MAKE) RAM_BASE=$(1) -C pkg/moe/server/src; \ - echo "# File semi-automatically generated by 'make switch_ram_base'" > $(OBJ_BASE)/Makeconf.ram_base; \ - echo "RAM_BASE := $(1)" >> $(OBJ_BASE)/Makeconf.ram_base + echo "RAM_BASE_SWITCH_OK := yes" >> $(OBJ_BASE)/Makeconf.ram_base endef BUILDDIR_SEARCHPATH = $(OBJ_BASE)/bin/$(ARCH)_$(CPU):$(OBJ_BASE)/bin/$(ARCH)_$(CPU)/$(BUILD_ABI):$(OBJ_BASE)/lib/$(ARCH)_$(CPU):$(OBJ_BASE)/lib/$(ARCH)_$(CPU)/$(BUILD_ABI) @@ -411,7 +410,7 @@ check_and_adjust_ram_base: echo "Platform \"$(PLATFORM_TYPE)\" not known."; \ exit 1; \ fi - $(VERBOSE)if [ $$(($(RAM_BASE))) != $$(($(PLATFORM_RAM_BASE))) ]; then \ + $(VERBOSE)if [ $$(($(RAM_BASE))) != $$(($(PLATFORM_RAM_BASE))) -o -z "$(RAM_BASE)" -o -z "$(RAM_BASE_SWITCH_OK)" ]; then \ echo "=========== Updating RAM_BASE for platform $(PLATFORM_TYPE) to $(PLATFORM_RAM_BASE) =========" ; \ $(call switch_ram_base_func,$(PLATFORM_RAM_BASE)); \ fi @@ -458,7 +457,7 @@ vbox: $(if $(VBOX_ISOTARGET),$(VBOX_ISOTARGET),grub2iso) echo "Need to set name of configured VirtualBox VM im 'VBOX_VM'."; \ exit 1; \ fi - $(VERBOSE)VBoxSDL \ + $(VERBOSE)VirtualBox \ --startvm $(VBOX_VM) \ --cdrom $(IMAGES_DIR)/.current.iso \ --boot d \ diff --git a/l4/mk/defconfig/config.arm-rv b/l4/mk/defconfig/config.arm-rv index c737cd67..6ab421af 100644 --- a/l4/mk/defconfig/config.arm-rv +++ b/l4/mk/defconfig/config.arm-rv @@ -25,14 +25,17 @@ CONFIG_CPU_ARM_ARMV5TE=y # CONFIG_PLATFORM_TYPE_imx21 is not set # CONFIG_PLATFORM_TYPE_imx35 is not set # CONFIG_PLATFORM_TYPE_imx51 is not set +# CONFIG_PLATFORM_TYPE_imx6 is not set # CONFIG_PLATFORM_TYPE_integrator is not set # CONFIG_PLATFORM_TYPE_kirkwood is not set # CONFIG_PLATFORM_TYPE_omap3_am33xx is not set # CONFIG_PLATFORM_TYPE_omap3evm is not set # CONFIG_PLATFORM_TYPE_pandaboard is not set +# CONFIG_PLATFORM_TYPE_rpi_b is not set CONFIG_PLATFORM_TYPE_rv=y # CONFIG_PLATFORM_TYPE_rv_pbx is not set # CONFIG_PLATFORM_TYPE_rv_vexpress is not set +# CONFIG_PLATFORM_TYPE_rv_vexpress_a15 is not set # CONFIG_PLATFORM_TYPE_tegra2 is not set # CONFIG_PLATFORM_TYPE_custom is not set CONFIG_PLATFORM_TYPE="rv" diff --git a/l4/mk/lib.mk b/l4/mk/lib.mk index 043dbc01..3b18efa1 100644 --- a/l4/mk/lib.mk +++ b/l4/mk/lib.mk @@ -116,7 +116,7 @@ $(filter-out $(LINK_INCR) %.so %.o.a %.o.pr.a, $(TARGET)):%.a: $(OBJS) $(filter %.so, $(TARGET)):%.so: $(OBJS) $(CRTN) $(CRT0) $(CRTP) $(LIBDEPS) @$(LINK_SHARED_MESSAGE) $(VERBOSE)[ -d "$(dir $@)" ] || $(MKDIR) $(dir $@) - $(VERBOSE)$(call MAKEDEP,$(LD)) $(LD) -m $(LD_EMULATION) \ + $(VERBOSE)$(call MAKEDEP,$(LD)) $(LD) \ -o $@ $(LDFLAGS_SO) $(addprefix -T,$(LDSCRIPT)) $(CRTP) \ $(OBJS) $(REQUIRES_LIBS_LIST) $(LDFLAGS) \ $(GCCLIB_SO) $(GCCLIB_EH) $(CRTN) @@ -129,7 +129,7 @@ LINK_INCR_TARGETS = $(filter $(LINK_INCR) %.o.a %.o.pr.a, $(TARGET)) $(LINK_INCR_TARGETS):%.a: $(OBJS) $(LIBDEPS) $(foreach x,$(LINK_INCR_TARGETS),$(LINK_INCR_ONLYGLOBSYMFILE_$(x))) @$(LINK_PARTIAL_MESSAGE) $(VERBOSE)[ -d "$(dir $@)" ] || $(MKDIR) $(dir $@) - $(VERBOSE)$(call MAKEDEP,$(LD)) $(LD) -m $(LD_EMULATION) \ + $(VERBOSE)$(call MAKEDEP,$(LD)) $(LD) \ -T$(LDSCRIPT_INCR) \ -o $@ -r $(OBJS) $(LDFLAGS) $(if $(LINK_INCR_ONLYGLOBSYM_$@)$(LINK_INCR_ONLYGLOBSYMFILE_$@), \ diff --git a/l4/mk/platforms/tegra2.conf b/l4/mk/platforms/tegra2.conf index 4b857d34..0f181571 100644 --- a/l4/mk/platforms/tegra2.conf +++ b/l4/mk/platforms/tegra2.conf @@ -1,3 +1,4 @@ PLATFORM_NAME = "Nvidia Tegra 2" PLATFORM_ARCH = arm PLATFORM_RAM_BASE = 0 +PLATFORM_RAM_SIZE_MB = 1024 diff --git a/l4/pkg/Makefile b/l4/pkg/Makefile index f605807b..b035bf7d 100644 --- a/l4/pkg/Makefile +++ b/l4/pkg/Makefile @@ -87,7 +87,7 @@ $(OBJ_BASE)/pc: # deps on disappearing aliases.d-files are not handled... $(OBJ_BASE)/pkg/.Package.deps: $(L4DIR)/mk/pkgdeps \ - $(if $(filter update up,$(MAKECMDGOALS)),Makefile) \ + $(if $(filter update up,$(MAKECMDGOALS)),,Makefile) \ $(wildcard $(foreach d,$(ALIASES_DIRS),$(d)/*)) \ $(OBJ_BASE)/pc \ $(wildcard $(foreach d,$(BUILD_SUBDIRS),$(d)/Control)) diff --git a/l4/pkg/bootstrap/server/src/ARCH-arm/reboot.cc b/l4/pkg/bootstrap/server/src/ARCH-arm/reboot.cc index e0bd6f25..70e3f48d 100644 --- a/l4/pkg/bootstrap/server/src/ARCH-arm/reboot.cc +++ b/l4/pkg/bootstrap/server/src/ARCH-arm/reboot.cc @@ -6,12 +6,16 @@ * Please see the COPYING-LGPL-2.1 file for details. */ +#include "support.h" + void reboot_arch(void) __attribute__((noreturn)); void reboot_arch(void) { - for (;;) + Platform_base::platform->reboot(); + + while (1) ; } diff --git a/l4/pkg/bootstrap/server/src/Make.rules b/l4/pkg/bootstrap/server/src/Make.rules index 98658136..746e2cfa 100644 --- a/l4/pkg/bootstrap/server/src/Make.rules +++ b/l4/pkg/bootstrap/server/src/Make.rules @@ -286,7 +286,7 @@ processing-of-module-list-failed: @echo @exit 1 -mod.make.inc: $(GENERAL_D_LOC) $(shell $(call BUILD_MOD_CMD,list)) +mod.make.inc $(od)mbi_modules.bin: $(GENERAL_D_LOC) $(shell $(call BUILD_MOD_CMD,list)) @echo Building entry \""$(ENTRY)"\". $(VERBOSE)$(call BUILD_MOD_CMD,build) diff --git a/l4/pkg/bootstrap/server/src/platform/integrator.cc b/l4/pkg/bootstrap/server/src/platform/integrator.cc index 4521ed8b..d651e4aa 100644 --- a/l4/pkg/bootstrap/server/src/platform/integrator.cc +++ b/l4/pkg/bootstrap/server/src/platform/integrator.cc @@ -26,7 +26,7 @@ class Platform_arm_int : public Platform_single_region_ram void init() { static L4::Io_register_block_mmio r(0x16000000); - static L4::Uart_pl011 _uart; + static L4::Uart_pl011 _uart(24019200); _uart.startup(&r); set_stdio_uart(&_uart); } diff --git a/l4/pkg/bootstrap/server/src/platform/rv.cc b/l4/pkg/bootstrap/server/src/platform/rv.cc index ad10986b..6fcad0b6 100644 --- a/l4/pkg/bootstrap/server/src/platform/rv.cc +++ b/l4/pkg/bootstrap/server/src/platform/rv.cc @@ -27,7 +27,7 @@ class Platform_arm_rv : public Platform_single_region_ram void init() { static L4::Io_register_block_mmio r(0x10009000); - static L4::Uart_pl011 _uart; + static L4::Uart_pl011 _uart(24019200); _uart.startup(&r); set_stdio_uart(&_uart); } diff --git a/l4/pkg/bootstrap/server/src/platform/rv_vexpress.cc b/l4/pkg/bootstrap/server/src/platform/rv_vexpress.cc index 3b92289f..b6565ac5 100644 --- a/l4/pkg/bootstrap/server/src/platform/rv_vexpress.cc +++ b/l4/pkg/bootstrap/server/src/platform/rv_vexpress.cc @@ -27,7 +27,7 @@ class Platform_arm_rv_vexpress : public Platform_single_region_ram void init() { static L4::Io_register_block_mmio r(0x10009000); - static L4::Uart_pl011 _uart; + static L4::Uart_pl011 _uart(24019200); _uart.startup(&r); set_stdio_uart(&_uart); } diff --git a/l4/pkg/bootstrap/server/src/platform/tegra2.cc b/l4/pkg/bootstrap/server/src/platform/tegra2.cc index 096fee4e..8a3ff7aa 100644 --- a/l4/pkg/bootstrap/server/src/platform/tegra2.cc +++ b/l4/pkg/bootstrap/server/src/platform/tegra2.cc @@ -21,16 +21,14 @@ #include namespace { -class Platform_arm_tegra2 : public Platform_base +class Platform_arm_tegra2 : public Platform_single_region_ram { -private: void some_delay(int d) const { for (int i = 0; i < d; i++) asm volatile("":::"memory"); } -public: bool probe() { return true; } void init() @@ -69,19 +67,12 @@ public: some_delay(5000); - static L4::Uart_16550 _uart(L4::Uart_16550::Base_rate_pxa); + static L4::Uart_16550 _uart(13478400); static L4::Io_register_block_mmio r(0x70006300, 2); _uart.startup(&r); - _uart.change_mode(3, 7876); + _uart.change_mode(3, 115200); set_stdio_uart(&_uart); } - - void setup_memory_map(l4util_mb_info_t *, - Region_list *ram, Region_list *) - { - ram->add(Region::n(0x0, 448 << 20, ".ram", Region::Ram)); - ram->add(Region::n(512 << 20, 1024 << 20, ".ram", Region::Ram)); - } }; } diff --git a/l4/pkg/bootstrap/server/src/support.h b/l4/pkg/bootstrap/server/src/support.h index f89afebe..2763f755 100644 --- a/l4/pkg/bootstrap/server/src/support.h +++ b/l4/pkg/bootstrap/server/src/support.h @@ -37,6 +37,12 @@ public: Region_list *ram, Region_list *regions) = 0; virtual bool probe() = 0; + virtual void reboot() + { + while (1) + ; + } + // remember the chosen platform static Platform_base *platform; diff --git a/l4/pkg/drivers-frst/uart/include/uart_pl011.h b/l4/pkg/drivers-frst/uart/include/uart_pl011.h index 0442bcc8..e2e6af0f 100644 --- a/l4/pkg/drivers-frst/uart/include/uart_pl011.h +++ b/l4/pkg/drivers-frst/uart/include/uart_pl011.h @@ -16,6 +16,7 @@ namespace L4 class Uart_pl011 : public Uart { public: + Uart_pl011(unsigned freq) : _freq(freq) {} bool startup(Io_register_block const *); void shutdown(); bool change_mode(Transfer_mode m, Baud_rate r); @@ -24,6 +25,9 @@ namespace L4 int char_avail() const; inline void out_char(char c) const; int write(char const *s, unsigned long count) const; + + private: + unsigned _freq; }; }; diff --git a/l4/pkg/drivers-frst/uart/src/uart_pl011.cc b/l4/pkg/drivers-frst/uart/src/uart_pl011.cc index 5167a993..e0d0abf8 100644 --- a/l4/pkg/drivers-frst/uart/src/uart_pl011.cc +++ b/l4/pkg/drivers-frst/uart/src/uart_pl011.cc @@ -49,16 +49,18 @@ namespace L4 UART011_IMSC = 0x38, UART011_MIS = 0x40, UART011_ICR = 0x44, - }; + Default_baud = 115200, + }; bool Uart_pl011::startup(Io_register_block const *regs) { _regs = regs; _regs->write(UART011_CR, UART01x_CR_UARTEN | UART011_CR_TXE | UART011_CR_RXE); - _regs->write(UART011_FBRD, 2); - _regs->write(UART011_IBRD, 13); - _regs->write(UART011_LCRH, 0x60); + unsigned fi_val = _freq * 4 / Default_baud; + _regs->write(UART011_FBRD, fi_val & 0x3f); + _regs->write(UART011_IBRD, fi_val >> 6); + _regs->write(UART011_LCRH, UART01x_LCRH_WLEN_8); _regs->write(UART011_IMSC, 0); Poll_timeout_counter i(3000000); while (i.test() && _regs->read(UART01x_FR) & UART01x_FR_BUSY) @@ -88,14 +90,12 @@ namespace L4 bool Uart_pl011::change_mode(Transfer_mode, Baud_rate r) { - if (r != 115200) - return false; - unsigned long old_cr = _regs->read(UART011_CR); _regs->write(UART011_CR, 0); - _regs->write(UART011_FBRD, 2); - _regs->write(UART011_IBRD, 13); + unsigned fi_val = _freq * 4 / r; + _regs->write(UART011_FBRD, fi_val & 0x3f); + _regs->write(UART011_IBRD, fi_val >> 6); _regs->write(UART011_LCRH, UART01x_LCRH_WLEN_8 | UART01x_LCRH_FEN); _regs->write(UART011_CR, old_cr); diff --git a/l4/pkg/l4sys/include/__vm-svm.h b/l4/pkg/l4sys/include/__vm-svm.h index 5cb81da2..de81b28e 100644 --- a/l4/pkg/l4sys/include/__vm-svm.h +++ b/l4/pkg/l4sys/include/__vm-svm.h @@ -23,8 +23,7 @@ */ #pragma once -#include -#include +#include /** * \defgroup l4_vm_svm_api VM API for SVM diff --git a/l4/pkg/l4util/lib/src/Makefile b/l4/pkg/l4util/lib/src/Makefile index b39cf301..fab684b1 100644 --- a/l4/pkg/l4util/lib/src/Makefile +++ b/l4/pkg/l4util/lib/src/Makefile @@ -20,7 +20,7 @@ PRIVATE_INCDIR_ARCH-x86/perform.s.o = ARCH-x86 include $(L4DIR)/mk/lib.mk -ARCH-x86/perform.o: ARCH-x86/pmc_events.h +ARCH-x86/perform.o ARCH-x86/perform.s.o: ARCH-x86/pmc_events.h ARCH-x86/pmc_events.h: pmc_events.in @$(GEN_MESSAGE) $(VERBOSE)sort < $^ > $(OBJ_DIR)/$(^F).sorted || rm $(OBJ_DIR)/$(^F).sorted diff --git a/l4/pkg/libvcpu/include/vcpu b/l4/pkg/libvcpu/include/vcpu index 591e51c8..197e3088 100644 --- a/l4/pkg/libvcpu/include/vcpu +++ b/l4/pkg/libvcpu/include/vcpu @@ -147,17 +147,19 @@ public: { l4vcpu_irq_restore(this, s, utcb, do_event_work_cb, setup_ipc); } /** - * \brief Halt/block the vCPU. + * \brief Wait for event. * * \param utcb The UTCB to use. * \param do_event_work_cb Call-back function that is called in case an * event (such as an interrupt) is pending. * \param setup_ipc Call-back function that is called before an * IPC operation is called. + * + * Note that event delivery remains disabled after this function returns. */ - void halt(l4_utcb_t *utcb, l4vcpu_event_hndl_t do_event_work_cb, - l4vcpu_setup_ipc_t setup_ipc) throw() - { l4vcpu_halt(this, utcb, do_event_work_cb, setup_ipc); } + void wait_for_event(l4_utcb_t *utcb, l4vcpu_event_hndl_t do_event_work_cb, + l4vcpu_setup_ipc_t setup_ipc) throw() + { l4vcpu_wait_for_event(this, utcb, do_event_work_cb, setup_ipc); } /** * \brief Set the task of the vCPU. diff --git a/l4/pkg/libvcpu/include/vcpu.h b/l4/pkg/libvcpu/include/vcpu.h index 4d78d955..2311e860 100644 --- a/l4/pkg/libvcpu/include/vcpu.h +++ b/l4/pkg/libvcpu/include/vcpu.h @@ -141,7 +141,7 @@ l4vcpu_wait(l4_vcpu_state_t *vcpu, l4_utcb_t *utcb, l4vcpu_setup_ipc_t setup_ipc) L4_NOTHROW; /** - * \brief Halt the vCPU (sleep). + * \brief Wait for event. * \ingroup api_libvcpu * * \param vcpu Pointer to vCPU area. @@ -150,12 +150,14 @@ l4vcpu_wait(l4_vcpu_state_t *vcpu, l4_utcb_t *utcb, * awakes and needs to handle an event/IRQ. * \param setup_ipc Function call-back that is called right before * any IPC operation. + * + * Note that event delivery remains disabled after this function returns. */ L4_CV L4_INLINE void -l4vcpu_halt(l4_vcpu_state_t *vcpu, l4_utcb_t *utcb, - l4vcpu_event_hndl_t do_event_work_cb, - l4vcpu_setup_ipc_t setup_ipc) L4_NOTHROW; +l4vcpu_wait_for_event(l4_vcpu_state_t *vcpu, l4_utcb_t *utcb, + l4vcpu_event_hndl_t do_event_work_cb, + l4vcpu_setup_ipc_t setup_ipc) L4_NOTHROW; /** @@ -290,12 +292,11 @@ l4vcpu_irq_restore(l4_vcpu_state_t *vcpu, l4vcpu_irq_state_t s, L4_CV L4_INLINE void -l4vcpu_halt(l4_vcpu_state_t *vcpu, l4_utcb_t *utcb, - l4vcpu_event_hndl_t do_event_work_cb, - l4vcpu_setup_ipc_t setup_ipc) L4_NOTHROW +l4vcpu_wait_for_event(l4_vcpu_state_t *vcpu, l4_utcb_t *utcb, + l4vcpu_event_hndl_t do_event_work_cb, + l4vcpu_setup_ipc_t setup_ipc) L4_NOTHROW { l4vcpu_wait(vcpu, utcb, L4_IPC_NEVER, do_event_work_cb, setup_ipc); - l4vcpu_irq_enable(vcpu, utcb, do_event_work_cb, setup_ipc); } __END_DECLS diff --git a/l4/pkg/libvcpu/lib/src/ARCH-amd64/arch.cc b/l4/pkg/libvcpu/lib/src/ARCH-amd64/arch.cc index 4cc945bf..bf62efc9 100644 --- a/l4/pkg/libvcpu/lib/src/ARCH-amd64/arch.cc +++ b/l4/pkg/libvcpu/lib/src/ARCH-amd64/arch.cc @@ -22,11 +22,10 @@ void l4vcpu_print_state_arch(l4_vcpu_state_t *vcpu, const char *prefix) L4_NOTHROW { - printf("%svcpu=%p ip=%08lx sp=%08lx trapno=%08lx label=%lx\n", - prefix, vcpu, vcpu->r.ip, vcpu->r.sp, vcpu->r.trapno, vcpu->i.label); + printf("%sip=%08lx sp=%08lx trapno=%08lx\n", + prefix, vcpu->r.ip, vcpu->r.sp, vcpu->r.trapno); printf("%sax=%08lx dx=%08lx bx=%08lx cx=%08lx\n", prefix, vcpu->r.ax, vcpu->r.dx, vcpu->r.bx, vcpu->r.cx); printf("%ssi=%08lx di=%08lx bp=%08lx flags=%08lx\n", prefix, vcpu->r.si, vcpu->r.di, vcpu->r.bp, vcpu->r.flags); } - diff --git a/l4/pkg/libvcpu/lib/src/ARCH-x86/arch.cc b/l4/pkg/libvcpu/lib/src/ARCH-x86/arch.cc index cf808e9a..db2b99a0 100644 --- a/l4/pkg/libvcpu/lib/src/ARCH-x86/arch.cc +++ b/l4/pkg/libvcpu/lib/src/ARCH-x86/arch.cc @@ -31,4 +31,3 @@ void l4vcpu_print_state_arch(l4_vcpu_state_t *vcpu, printf("%sds=%08lx es=%08lx gs=%08lx fs=%08lx\n", prefix, vcpu->r.ds, vcpu->r.es, vcpu->r.gs, vcpu->r.fs); } - diff --git a/l4/pkg/libvcpu/lib/src/vcpu.cc b/l4/pkg/libvcpu/lib/src/vcpu.cc index 51bbe1be..abe6b44c 100644 --- a/l4/pkg/libvcpu/lib/src/vcpu.cc +++ b/l4/pkg/libvcpu/lib/src/vcpu.cc @@ -27,8 +27,9 @@ l4vcpu_print_state(l4_vcpu_state_t *vcpu, { printf("%svcpu=%p state=%x savedstate=%x label=%lx\n", prefix, vcpu, vcpu->state, vcpu->saved_state, vcpu->i.label); - printf("%ssticky=%x user_task=%lx\n", - prefix, vcpu->sticky_flags, vcpu->user_task << L4_CAP_SHIFT); + printf("%ssticky=%x user_task=%lx pfa=%lx\n", + prefix, vcpu->sticky_flags, vcpu->user_task << L4_CAP_SHIFT, + vcpu->r.pfa); printf("%sentry_sp=%lx entry_ip=%lx\n", prefix, vcpu->entry_sp, vcpu->entry_ip); l4vcpu_print_state_arch(vcpu, prefix); diff --git a/l4/pkg/uclibc/lib/contrib/uclibc/include/fnmatch.h b/l4/pkg/uclibc/lib/contrib/uclibc/include/fnmatch.h index 9178706f..37d3b895 100644 --- a/l4/pkg/uclibc/lib/contrib/uclibc/include/fnmatch.h +++ b/l4/pkg/uclibc/lib/contrib/uclibc/include/fnmatch.h @@ -19,6 +19,8 @@ #ifndef _FNMATCH_H #define _FNMATCH_H 1 +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/l4/pkg/uclibc/lib/libpthread/src/Makefile b/l4/pkg/uclibc/lib/libpthread/src/Makefile index d4d401ee..73f81686 100644 --- a/l4/pkg/uclibc/lib/libpthread/src/Makefile +++ b/l4/pkg/uclibc/lib/libpthread/src/Makefile @@ -18,7 +18,7 @@ DIR_sparc := sparc SRC_CC = manager.cc l4.cc SRC_C += spinlock.c mutex.c condvar.c rwlock.c errno.c specific.c \ semaphore.c attr.c barrier.c join.c pthread.c \ - cancel.c ptcleanup.c errno-loc.c \ + cancel.c ptcleanup.c errno-loc.c signals.c \ sysdeps/$(DIR_$(ARCH))/pspinlock.c SRC_C_libpthread.a += libc_pthread_init.c SRC_S = tramp-$(ARCH).S diff --git a/l4/pkg/uclibc/lib/libpthread/src/signals.c b/l4/pkg/uclibc/lib/libpthread/src/signals.c new file mode 100644 index 00000000..3ee847c0 --- /dev/null +++ b/l4/pkg/uclibc/lib/libpthread/src/signals.c @@ -0,0 +1,34 @@ +/* Handling of signals */ + +#include +#include +#include +#include + +int pthread_kill(pthread_t thread, int signo); +int pthread_kill(pthread_t thread, int signo) +{ + l4_cap_idx_t c = pthread_getl4cap(thread); + + if (signo >= _NSIG) + { + errno = EINVAL; + return -1; + } + + if (l4_is_invalid_cap(c)) + { + errno = ESRCH; + return -1; + } + + int x = l4_error(l4_thread_ex_regs(c, ~0UL, ~0UL, + L4_THREAD_EX_REGS_TRIGGER_EXCEPTION)); + if (x) + { + errno = EINVAL; + return -1; + } + + return x ? -1 : 0; +} diff --git a/l4/pkg/uclibc/lib/uclibc/ARCH-all/include/bits/sigthread.h b/l4/pkg/uclibc/lib/uclibc/ARCH-all/include/bits/sigthread.h index e69de29b..e44eadf3 100644 --- a/l4/pkg/uclibc/lib/uclibc/ARCH-all/include/bits/sigthread.h +++ b/l4/pkg/uclibc/lib/uclibc/ARCH-all/include/bits/sigthread.h @@ -0,0 +1,12 @@ + +// prototype from +// pkg/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/common/bits/sigthread.h + +#pragma once + +#if !defined _SIGNAL_H && !defined _PTHREAD_H +# error "Never include this file directly. Use instead" +#endif + +/* Send signal SIGNO to the given thread. */ +extern int pthread_kill (pthread_t __threadid, int __signo) __THROW; diff --git a/l4/pkg/uclibc/lib/uclibc/contrib_files.mk b/l4/pkg/uclibc/lib/uclibc/contrib_files.mk index 97d20c33..f1366218 100644 --- a/l4/pkg/uclibc/lib/uclibc/contrib_files.mk +++ b/l4/pkg/uclibc/lib/uclibc/contrib_files.mk @@ -18,6 +18,7 @@ define SRC_libc/sysdeps/linux_large_file endef SRC_libc/sysdeps/linux_arm += aeabi_atexit +SRC_libc/sysdeps/linux_arm += find_exidx define SRC_libc/sysdeps/linux_sparc__with_soft_fp soft-fp/q_add @@ -202,9 +203,28 @@ define SRC_libc/string endef define SRC_libc/string_wchar + wcscmp wcsnlen wcslen + wcsncpy wmemcpy + wcsstr + wcscasecmp + wcscpy + wcsncasecmp + wcstok + wcscat + wcscspn + wcspbrk + wcschr + wcsdup + wcsncat + wcsrchr + wcsxfrm + wcschrnul + wcslcpy + wcsncmp + wcsspn endef SRC_libc/string_arm := _memcpy @@ -257,6 +277,7 @@ define SRC_libc/misc locale/localeconv locale/nl_langinfo locale/setlocale + regex/regex_old search/hcreate_r search/hdestroy_r search/hsearch @@ -325,6 +346,22 @@ define SRC_libc/misc_wchar wctype/iswctype wctype/wctype wctype/_wctype + wctype/towlower + wctype/towupper + wctype/towctrans + wctype/wctrans + wctype/iswxdigit + wctype/iswupper + wctype/iswlower + wctype/iswspace + wctype/iswpunct + wctype/iswprint + wctype/iswgraph + wctype/iswdigit + wctype/iswcntrl + wctype/iswblank + wctype/iswalpha + wctype/iswalnum endef define SRC_libc/stdio diff --git a/l4/pkg/uclibc/lib/uclibc/target_headers.lst b/l4/pkg/uclibc/lib/uclibc/target_headers.lst index 0789f6c2..dc3f0fe1 100644 --- a/l4/pkg/uclibc/lib/uclibc/target_headers.lst +++ b/l4/pkg/uclibc/lib/uclibc/target_headers.lst @@ -188,6 +188,7 @@ sys/resource.h sys/select.h sys/sem.h sys/shm.h +sys/signal.h sys/socket.h sys/soundcard.h sys/statfs.h diff --git a/l4/tool/kconfig/Makefile b/l4/tool/kconfig/Makefile index c565ae05..cc8a266f 100644 --- a/l4/tool/kconfig/Makefile +++ b/l4/tool/kconfig/Makefile @@ -1,8 +1,8 @@ VERSION = 3 -PATCHLEVEL = 5 +PATCHLEVEL = 7 SUBLEVEL = 0 EXTRAVERSION = -NAME = Saber-toothed Squirrel +NAME = Terrified Chipmunk # *DOCUMENTATION* # To see a list of typical targets execute "make help" @@ -350,12 +350,22 @@ AFLAGS_KERNEL = CFLAGS_GCOV = -fprofile-arcs -ftest-coverage +# Use USERINCLUDE when you must reference the UAPI directories only. +USERINCLUDE := \ + -I$(srctree)/arch/$(hdr-arch)/include/uapi \ + -Iarch/$(hdr-arch)/include/generated/uapi \ + -I$(srctree)/include/uapi \ + -Iinclude/generated/uapi \ + -include $(srctree)/include/linux/kconfig.h + # Use LINUXINCLUDE when you must reference the include/ directory. # Needed to be compatible with the O= option -LINUXINCLUDE := -I$(srctree)/arch/$(hdr-arch)/include \ - -Iarch/$(hdr-arch)/include/generated -Iinclude \ - $(if $(KBUILD_SRC), -I$(srctree)/include) \ - -include $(srctree)/include/linux/kconfig.h +LINUXINCLUDE := \ + -I$(srctree)/arch/$(hdr-arch)/include \ + -Iarch/$(hdr-arch)/include/generated \ + $(if $(KBUILD_SRC), -I$(srctree)/include) \ + -Iinclude \ + $(USERINCLUDE) KBUILD_CPPFLAGS := -D__KERNEL__ @@ -427,7 +437,9 @@ endif PHONY += asm-generic asm-generic: $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ - obj=arch/$(SRCARCH)/include/generated/asm + src=asm obj=arch/$(SRCARCH)/include/generated/asm + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ + src=uapi/asm obj=arch/$(SRCARCH)/include/generated/uapi/asm # To make sure we do not include .config for any of the *config targets # catch them early, and hand them over to scripts/kconfig/Makefile @@ -437,9 +449,11 @@ asm-generic: # Detect when mixed targets is specified, and make a second invocation # of make so .config is not included in this case either (for *config). +version_h := include/generated/uapi/linux/version.h + no-dot-config-targets := clean mrproper distclean \ cscope gtags TAGS tags help %docs check% coccicheck \ - include/linux/version.h headers_% archheaders archscripts \ + $(version_h) headers_% archheaders archscripts \ kernelversion %src-pkg config-targets := 0 @@ -535,11 +549,11 @@ PHONY += include/config/auto.conf include/config/auto.conf: $(Q)test -e include/generated/autoconf.h -a -e $@ || ( \ - echo; \ - echo " ERROR: Kernel configuration is invalid."; \ - echo " include/generated/autoconf.h or $@ are missing.";\ - echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ - echo; \ + echo >&2; \ + echo >&2 " ERROR: Kernel configuration is invalid."; \ + echo >&2 " include/generated/autoconf.h or $@ are missing.";\ + echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ + echo >&2 ; \ /bin/false) endif # KBUILD_EXTMOD @@ -609,7 +623,11 @@ KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) endif ifdef CONFIG_FUNCTION_TRACER -KBUILD_CFLAGS += -pg +ifdef CONFIG_HAVE_FENTRY +CC_USING_FENTRY := $(call cc-option, -mfentry -DCC_USING_FENTRY) +endif +KBUILD_CFLAGS += -pg $(CC_USING_FENTRY) +KBUILD_AFLAGS += $(CC_USING_FENTRY) ifdef CONFIG_DYNAMIC_FTRACE ifdef CONFIG_HAVE_C_RECORDMCOUNT BUILD_C_RECORDMCOUNT := y @@ -648,22 +666,9 @@ ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y) endif # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments -# But warn user when we do so -warn-assign = \ -$(warning "WARNING: Appending $$K$(1) ($(K$(1))) from $(origin K$(1)) to kernel $$$(1)") - -ifneq ($(KCPPFLAGS),) - $(call warn-assign,CPPFLAGS) - KBUILD_CPPFLAGS += $(KCPPFLAGS) -endif -ifneq ($(KAFLAGS),) - $(call warn-assign,AFLAGS) - KBUILD_AFLAGS += $(KAFLAGS) -endif -ifneq ($(KCFLAGS),) - $(call warn-assign,CFLAGS) - KBUILD_CFLAGS += $(KCFLAGS) -endif +KBUILD_CPPFLAGS += $(KCPPFLAGS) +KBUILD_AFLAGS += $(KAFLAGS) +KBUILD_CFLAGS += $(KCFLAGS) # Use --build-id when available. LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\ @@ -714,6 +719,17 @@ endif # INSTALL_MOD_STRIP export mod_strip_cmd +ifeq ($(CONFIG_MODULE_SIG),y) +MODSECKEY = ./signing_key.priv +MODPUBKEY = ./signing_key.x509 +export MODPUBKEY +mod_sign_cmd = perl $(srctree)/scripts/sign-file $(MODSECKEY) $(MODPUBKEY) +else +mod_sign_cmd = true +endif +export mod_sign_cmd + + ifeq ($(KBUILD_EXTMOD),) core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ @@ -796,8 +812,8 @@ prepare3: include/config/kernel.release ifneq ($(KBUILD_SRC),) @$(kecho) ' Using $(srctree) as source for kernel' $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ - echo " $(srctree) is not clean, please run 'make mrproper'"; \ - echo " in the '$(srctree)' directory.";\ + echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \ + echo >&2 " in the '$(srctree)' directory.";\ /bin/false; \ fi; endif @@ -805,7 +821,7 @@ endif # prepare2 creates a makefile if using a separate output directory prepare2: prepare3 outputmakefile asm-generic -prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \ +prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ include/config/auto.conf $(cmd_crmodverdir) @@ -838,7 +854,7 @@ define filechk_version.h echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) endef -include/linux/version.h: $(srctree)/Makefile FORCE +$(version_h): $(srctree)/Makefile FORCE $(call filechk,version.h) include/generated/utsrelease.h: include/config/kernel.release FORCE @@ -883,7 +899,7 @@ PHONY += archscripts archscripts: PHONY += __headers -__headers: include/linux/version.h scripts_basic asm-generic archheaders archscripts FORCE +__headers: $(version_h) scripts_basic asm-generic archheaders archscripts FORCE $(Q)$(MAKE) $(build)=scripts build_unifdef PHONY += headers_install_all @@ -892,10 +908,10 @@ headers_install_all: PHONY += headers_install headers_install: __headers - $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild),, \ - $(error Headers not exportable for the $(SRCARCH) architecture)) - $(Q)$(MAKE) $(hdr-inst)=include - $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst) + $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/uapi/asm/Kbuild),, \ + $(error Headers not exportable for the $(SRCARCH) architecture)) + $(Q)$(MAKE) $(hdr-inst)=include/uapi + $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst) PHONY += headers_check_all headers_check_all: headers_install_all @@ -903,8 +919,8 @@ headers_check_all: headers_install_all PHONY += headers_check headers_check: headers_install - $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1 - $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst) HDRCHECK=1 + $(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1 + $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst) HDRCHECK=1 # --------------------------------------------------------------------------- # Modules @@ -971,11 +987,11 @@ else # CONFIG_MODULES # --------------------------------------------------------------------------- modules modules_install: FORCE - @echo - @echo "The present kernel configuration has modules disabled." - @echo "Type 'make config' and enable loadable module support." - @echo "Then build a kernel with module support enabled." - @echo + @echo >&2 + @echo >&2 "The present kernel configuration has modules disabled." + @echo >&2 "Type 'make config' and enable loadable module support." + @echo >&2 "Then build a kernel with module support enabled." + @echo >&2 @exit 1 endif # CONFIG_MODULES @@ -993,9 +1009,11 @@ CLEAN_DIRS += $(MODVERDIR) # Directories & files removed with 'make mrproper' MRPROPER_DIRS += include/config usr/include include/generated \ arch/*/include/generated -MRPROPER_FILES += .config .config.old .version .old_version \ - include/linux/version.h \ - Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS +MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \ + Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \ + signing_key.priv signing_key.x509 x509.genkey \ + extra_certificates signing_key.x509.keyid \ + signing_key.x509.signer # clean - Delete most, but leave enough to build external modules # @@ -1239,6 +1257,7 @@ clean: $(clean-dirs) $(call cmd,rmfiles) @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ + -o -name '*.ko.*' \ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ -o -name '*.symtypes' -o -name 'modules.order' \ -o -name modules.builtin -o -name '.tmp_*.o.*' \ @@ -1302,10 +1321,12 @@ kernelversion: # Clear a bunch of variables before executing the submake tools/: FORCE - $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/ + $(Q)mkdir -p $(objtree)/tools + $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/ tools/%: FORCE - $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/ $* + $(Q)mkdir -p $(objtree)/tools + $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/ $* # Single targets # --------------------------------------------------------------------------- diff --git a/l4/tool/kconfig/README b/l4/tool/kconfig/README index cebd46b7..3d87ce19 100644 --- a/l4/tool/kconfig/README +++ b/l4/tool/kconfig/README @@ -1,3 +1,3 @@ -kconfig taken from vanilla Linux 3.5, and slightly patched. +kconfig taken from vanilla Linux 3.7, and slightly patched. diff --git a/l4/tool/kconfig/scripts/Kbuild.include b/l4/tool/kconfig/scripts/Kbuild.include index 6a3ee981..978416dd 100644 --- a/l4/tool/kconfig/scripts/Kbuild.include +++ b/l4/tool/kconfig/scripts/Kbuild.include @@ -98,24 +98,24 @@ try-run = $(shell set -e; \ # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) as-option = $(call try-run,\ - $(CC) $(KBUILD_CFLAGS) $(1) -c -xassembler /dev/null -o "$$TMP",$(1),$(2)) + $(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2)) # as-instr # Usage: cflags-y += $(call as-instr,instr,option1,option2) as-instr = $(call try-run,\ - printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) + printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3)) # cc-option # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) cc-option = $(call try-run,\ - $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",$(1),$(2)) + $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2)) # cc-option-yn # Usage: flag := $(call cc-option-yn,-march=winchip-c6) cc-option-yn = $(call try-run,\ - $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",y,n) + $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) # cc-option-align # Prefix align with either -falign or -malign @@ -125,7 +125,7 @@ cc-option-align = $(subst -functions=0,,\ # cc-disable-warning # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) cc-disable-warning = $(call try-run,\ - $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -xc /dev/null -o "$$TMP",-Wno-$(strip $(1))) + $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) # cc-version # Usage gcc-ver := $(call cc-version) @@ -143,7 +143,7 @@ cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3)) # cc-ldoption # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) cc-ldoption = $(call try-run,\ - $(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2)) + $(CC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) # ld-option # Usage: LDFLAGS += $(call ld-option, -X) @@ -209,7 +209,7 @@ endif # >$< substitution to preserve $ when reloading .cmd file # note: when using inline perl scripts [perl -e '...$$t=1;...'] # in $(cmd_xxx) double $$ your perl vars -make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))) +make-cmd = $(subst \\,\\\\,$(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1)))))) # Find any prerequisites that is newer than target or that does not exist. # PHONY targets skipped in both cases. diff --git a/l4/tool/kconfig/scripts/Makefile b/l4/tool/kconfig/scripts/Makefile index a55b0067..01e7adb8 100644 --- a/l4/tool/kconfig/scripts/Makefile +++ b/l4/tool/kconfig/scripts/Makefile @@ -16,8 +16,10 @@ hostprogs-$(CONFIG_VT) += conmakehash hostprogs-$(CONFIG_IKCONFIG) += bin2c hostprogs-$(BUILD_C_RECORDMCOUNT) += recordmcount hostprogs-$(CONFIG_BUILDTIME_EXTABLE_SORT) += sortextable +hostprogs-$(CONFIG_ASN1) += asn1_compiler HOSTCFLAGS_sortextable.o = -I$(srctree)/tools/include +HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include always := $(hostprogs-y) $(hostprogs-m) diff --git a/l4/tool/kconfig/scripts/Makefile.build b/l4/tool/kconfig/scripts/Makefile.build index ff1720d2..0e801c3c 100644 --- a/l4/tool/kconfig/scripts/Makefile.build +++ b/l4/tool/kconfig/scripts/Makefile.build @@ -354,6 +354,17 @@ quiet_cmd_cpp_lds_S = LDS $@ $(obj)/%.lds: $(src)/%.lds.S FORCE $(call if_changed_dep,cpp_lds_S) +# ASN.1 grammar +# --------------------------------------------------------------------------- +quiet_cmd_asn1_compiler = ASN.1 $@ + cmd_asn1_compiler = $(objtree)/scripts/asn1_compiler $< \ + $(subst .h,.c,$@) $(subst .c,.h,$@) + +.PRECIOUS: $(objtree)/$(obj)/%-asn1.c $(objtree)/$(obj)/%-asn1.h + +$(obj)/%-asn1.c $(obj)/%-asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler + $(call cmd,asn1_compiler) + # Build the compiled-in targets # --------------------------------------------------------------------------- diff --git a/l4/tool/kconfig/scripts/Makefile.headersinst b/l4/tool/kconfig/scripts/Makefile.headersinst index d3bae5e7..06ba4a70 100644 --- a/l4/tool/kconfig/scripts/Makefile.headersinst +++ b/l4/tool/kconfig/scripts/Makefile.headersinst @@ -3,13 +3,12 @@ # # header-y - list files to be installed. They are preprocessed # to remove __KERNEL__ section of the file -# objhdr-y - Same as header-y but for generated files -# genhdr-y - Same as objhdr-y but in a generated/ directory +# genhdr-y - Same as header-y but in a generated/ directory # # ========================================================================== # called may set destination dir (when installing to asm/) -_dst := $(if $(dst),$(dst),$(obj)) +_dst := $(or $(destination-y),$(dst),$(obj)) # generated header directory gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj))) @@ -17,49 +16,64 @@ gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj))) kbuild-file := $(srctree)/$(obj)/Kbuild include $(kbuild-file) -_dst := $(if $(destination-y),$(destination-y),$(_dst)) +old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild +ifneq ($(wildcard $(old-kbuild-file)),) +include $(old-kbuild-file) +endif include scripts/Kbuild.include -install := $(INSTALL_HDR_PATH)/$(_dst) +installdir := $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst)) header-y := $(sort $(header-y)) subdirs := $(patsubst %/,%,$(filter %/, $(header-y))) header-y := $(filter-out %/, $(header-y)) # files used to track state of install/check -install-file := $(install)/.install -check-file := $(install)/.check +install-file := $(installdir)/.install +check-file := $(installdir)/.check # generic-y list all files an architecture uses from asm-generic # Use this to build a list of headers which require a wrapper wrapper-files := $(filter $(header-y), $(generic-y)) +srcdir := $(srctree)/$(obj) +gendir := $(objtree)/$(gen) + +oldsrcdir := $(srctree)/$(subst /uapi,,$(obj)) + # all headers files for this dir header-y := $(filter-out $(generic-y), $(header-y)) -all-files := $(header-y) $(objhdr-y) $(genhdr-y) $(wrapper-files) -input-files := $(addprefix $(srctree)/$(obj)/,$(header-y)) \ - $(addprefix $(objtree)/$(obj)/,$(objhdr-y)) \ - $(addprefix $(objtree)/$(gen)/,$(genhdr-y)) -output-files := $(addprefix $(install)/, $(all-files)) +all-files := $(header-y) $(genhdr-y) $(wrapper-files) +output-files := $(addprefix $(installdir)/, $(all-files)) + +input-files := $(foreach hdr, $(header-y), \ + $(or \ + $(wildcard $(srcdir)/$(hdr)), \ + $(wildcard $(oldsrcdir)/$(hdr)), \ + $(error Missing UAPI file $(srcdir)/$(hdr)) \ + )) \ + $(foreach hdr, $(genhdr-y), \ + $(or \ + $(wildcard $(gendir)/$(hdr)), \ + $(error Missing generated UAPI file $(gendir)/$(hdr)) \ + )) # Work out what needs to be removed -oldheaders := $(patsubst $(install)/%,%,$(wildcard $(install)/*.h)) +oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) unwanted := $(filter-out $(all-files),$(oldheaders)) # Prefix unwanted with full paths to $(INSTALL_HDR_PATH) -unwanted-file := $(addprefix $(install)/, $(unwanted)) +unwanted-file := $(addprefix $(installdir)/, $(unwanted)) printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ file$(if $(word 2, $(all-files)),s)) cmd_install = \ - $(PERL) $< $(srctree)/$(obj) $(install) $(SRCARCH) $(header-y); \ - $(PERL) $< $(objtree)/$(obj) $(install) $(SRCARCH) $(objhdr-y); \ - $(PERL) $< $(objtree)/$(gen) $(install) $(SRCARCH) $(genhdr-y); \ + $(PERL) $< $(installdir) $(SRCARCH) $(input-files); \ for F in $(wrapper-files); do \ - echo "\#include " > $(install)/$$F; \ + echo "\#include " > $(installdir)/$$F; \ done; \ touch $@ @@ -70,7 +84,7 @@ quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files) # Headers list can be pretty long, xargs helps to avoid # the "Argument list too long" error. cmd_check = for f in $(all-files); do \ - echo "$(install)/$${f}"; done \ + echo "$(installdir)/$${f}"; done \ | xargs \ $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \ touch $@ diff --git a/l4/tool/kconfig/scripts/Makefile.modinst b/l4/tool/kconfig/scripts/Makefile.modinst index efa5d940..ecbb4479 100644 --- a/l4/tool/kconfig/scripts/Makefile.modinst +++ b/l4/tool/kconfig/scripts/Makefile.modinst @@ -9,15 +9,16 @@ include scripts/Kbuild.include # -__modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) +__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod))) modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o))) PHONY += $(modules) __modinst: $(modules) @: +# Don't stop modules_install if we can't sign external modules. quiet_cmd_modules_install = INSTALL $@ - cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) + cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) ; $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) # Modules built outside the kernel source tree go into extra by default INSTALL_MOD_DIR ?= extra diff --git a/l4/tool/kconfig/scripts/Makefile.modpost b/l4/tool/kconfig/scripts/Makefile.modpost index 08dce14f..a1cb0222 100644 --- a/l4/tool/kconfig/scripts/Makefile.modpost +++ b/l4/tool/kconfig/scripts/Makefile.modpost @@ -60,7 +60,7 @@ kernelsymfile := $(objtree)/Module.symvers modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers # Step 1), find all modules listed in $(MODVERDIR)/ -__modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) +__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod))) modules := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o))) # Stop after building .o files if NOFINAL is set. Makes compile tests quicker diff --git a/l4/tool/kconfig/scripts/basic/docproc.c b/l4/tool/kconfig/scripts/basic/docproc.c deleted file mode 100644 index 98dec879..00000000 --- a/l4/tool/kconfig/scripts/basic/docproc.c +++ /dev/null @@ -1,583 +0,0 @@ -/* - * docproc is a simple preprocessor for the template files - * used as placeholders for the kernel internal documentation. - * docproc is used for documentation-frontend and - * dependency-generator. - * The two usages have in common that they require - * some knowledge of the .tmpl syntax, therefore they - * are kept together. - * - * documentation-frontend - * Scans the template file and call kernel-doc for - * all occurrences of ![EIF]file - * Beforehand each referenced file is scanned for - * any symbols that are exported via these macros: - * EXPORT_SYMBOL(), EXPORT_SYMBOL_GPL(), & - * EXPORT_SYMBOL_GPL_FUTURE() - * This is used to create proper -function and - * -nofunction arguments in calls to kernel-doc. - * Usage: docproc doc file.tmpl - * - * dependency-generator: - * Scans the template file and list all files - * referenced in a format recognized by make. - * Usage: docproc depend file.tmpl - * Writes dependency information to stdout - * in the following format: - * file.tmpl src.c src2.c - * The filenames are obtained from the following constructs: - * !Efilename - * !Ifilename - * !Dfilename - * !Ffilename - * !Pfilename - * - */ - -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* exitstatus is used to keep track of any failing calls to kernel-doc, - * but execution continues. */ -int exitstatus = 0; - -typedef void DFL(char *); -DFL *defaultline; - -typedef void FILEONLY(char * file); -FILEONLY *internalfunctions; -FILEONLY *externalfunctions; -FILEONLY *symbolsonly; -FILEONLY *findall; - -typedef void FILELINE(char * file, char * line); -FILELINE * singlefunctions; -FILELINE * entity_system; -FILELINE * docsection; - -#define MAXLINESZ 2048 -#define MAXFILES 250 -#define KERNELDOCPATH "scripts/" -#define KERNELDOC "kernel-doc" -#define DOCBOOK "-docbook" -#define LIST "-list" -#define FUNCTION "-function" -#define NOFUNCTION "-nofunction" -#define NODOCSECTIONS "-no-doc-sections" - -static char *srctree, *kernsrctree; - -static char **all_list = NULL; -static int all_list_len = 0; - -static void consume_symbol(const char *sym) -{ - int i; - - for (i = 0; i < all_list_len; i++) { - if (!all_list[i]) - continue; - if (strcmp(sym, all_list[i])) - continue; - all_list[i] = NULL; - break; - } -} - -static void usage (void) -{ - fprintf(stderr, "Usage: docproc {doc|depend} file\n"); - fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n"); - fprintf(stderr, "doc: frontend when generating kernel documentation\n"); - fprintf(stderr, "depend: generate list of files referenced within file\n"); - fprintf(stderr, "Environment variable SRCTREE: absolute path to sources.\n"); - fprintf(stderr, " KBUILD_SRC: absolute path to kernel source tree.\n"); -} - -/* - * Execute kernel-doc with parameters given in svec - */ -static void exec_kernel_doc(char **svec) -{ - pid_t pid; - int ret; - char real_filename[PATH_MAX + 1]; - /* Make sure output generated so far are flushed */ - fflush(stdout); - switch (pid=fork()) { - case -1: - perror("fork"); - exit(1); - case 0: - memset(real_filename, 0, sizeof(real_filename)); - strncat(real_filename, kernsrctree, PATH_MAX); - strncat(real_filename, "/" KERNELDOCPATH KERNELDOC, - PATH_MAX - strlen(real_filename)); - execvp(real_filename, svec); - fprintf(stderr, "exec "); - perror(real_filename); - exit(1); - default: - waitpid(pid, &ret ,0); - } - if (WIFEXITED(ret)) - exitstatus |= WEXITSTATUS(ret); - else - exitstatus = 0xff; -} - -/* Types used to create list of all exported symbols in a number of files */ -struct symbols -{ - char *name; -}; - -struct symfile -{ - char *filename; - struct symbols *symbollist; - int symbolcnt; -}; - -struct symfile symfilelist[MAXFILES]; -int symfilecnt = 0; - -static void add_new_symbol(struct symfile *sym, char * symname) -{ - sym->symbollist = - realloc(sym->symbollist, (sym->symbolcnt + 1) * sizeof(char *)); - sym->symbollist[sym->symbolcnt++].name = strdup(symname); -} - -/* Add a filename to the list */ -static struct symfile * add_new_file(char * filename) -{ - symfilelist[symfilecnt++].filename = strdup(filename); - return &symfilelist[symfilecnt - 1]; -} - -/* Check if file already are present in the list */ -static struct symfile * filename_exist(char * filename) -{ - int i; - for (i=0; i < symfilecnt; i++) - if (strcmp(symfilelist[i].filename, filename) == 0) - return &symfilelist[i]; - return NULL; -} - -/* - * List all files referenced within the template file. - * Files are separated by tabs. - */ -static void adddep(char * file) { printf("\t%s", file); } -static void adddep2(char * file, char * line) { line = line; adddep(file); } -static void noaction(char * line) { line = line; } -static void noaction2(char * file, char * line) { file = file; line = line; } - -/* Echo the line without further action */ -static void printline(char * line) { printf("%s", line); } - -/* - * Find all symbols in filename that are exported with EXPORT_SYMBOL & - * EXPORT_SYMBOL_GPL (& EXPORT_SYMBOL_GPL_FUTURE implicitly). - * All symbols located are stored in symfilelist. - */ -static void find_export_symbols(char * filename) -{ - FILE * fp; - struct symfile *sym; - char line[MAXLINESZ]; - if (filename_exist(filename) == NULL) { - char real_filename[PATH_MAX + 1]; - memset(real_filename, 0, sizeof(real_filename)); - strncat(real_filename, srctree, PATH_MAX); - strncat(real_filename, "/", PATH_MAX - strlen(real_filename)); - strncat(real_filename, filename, - PATH_MAX - strlen(real_filename)); - sym = add_new_file(filename); - fp = fopen(real_filename, "r"); - if (fp == NULL) - { - fprintf(stderr, "docproc: "); - perror(real_filename); - exit(1); - } - while (fgets(line, MAXLINESZ, fp)) { - char *p; - char *e; - if (((p = strstr(line, "EXPORT_SYMBOL_GPL")) != NULL) || - ((p = strstr(line, "EXPORT_SYMBOL")) != NULL)) { - /* Skip EXPORT_SYMBOL{_GPL} */ - while (isalnum(*p) || *p == '_') - p++; - /* Remove parentheses & additional whitespace */ - while (isspace(*p)) - p++; - if (*p != '(') - continue; /* Syntax error? */ - else - p++; - while (isspace(*p)) - p++; - e = p; - while (isalnum(*e) || *e == '_') - e++; - *e = '\0'; - add_new_symbol(sym, p); - } - } - fclose(fp); - } -} - -/* - * Document all external or internal functions in a file. - * Call kernel-doc with following parameters: - * kernel-doc -docbook -nofunction function_name1 filename - * Function names are obtained from all the src files - * by find_export_symbols. - * intfunc uses -nofunction - * extfunc uses -function - */ -static void docfunctions(char * filename, char * type) -{ - int i,j; - int symcnt = 0; - int idx = 0; - char **vec; - - for (i=0; i <= symfilecnt; i++) - symcnt += symfilelist[i].symbolcnt; - vec = malloc((2 + 2 * symcnt + 3) * sizeof(char *)); - if (vec == NULL) { - perror("docproc: "); - exit(1); - } - vec[idx++] = KERNELDOC; - vec[idx++] = DOCBOOK; - vec[idx++] = NODOCSECTIONS; - for (i=0; i < symfilecnt; i++) { - struct symfile * sym = &symfilelist[i]; - for (j=0; j < sym->symbolcnt; j++) { - vec[idx++] = type; - consume_symbol(sym->symbollist[j].name); - vec[idx++] = sym->symbollist[j].name; - } - } - vec[idx++] = filename; - vec[idx] = NULL; - printf("\n", filename); - exec_kernel_doc(vec); - fflush(stdout); - free(vec); -} -static void intfunc(char * filename) { docfunctions(filename, NOFUNCTION); } -static void extfunc(char * filename) { docfunctions(filename, FUNCTION); } - -/* - * Document specific function(s) in a file. - * Call kernel-doc with the following parameters: - * kernel-doc -docbook -function function1 [-function function2] - */ -static void singfunc(char * filename, char * line) -{ - char *vec[200]; /* Enough for specific functions */ - int i, idx = 0; - int startofsym = 1; - vec[idx++] = KERNELDOC; - vec[idx++] = DOCBOOK; - - /* Split line up in individual parameters preceded by FUNCTION */ - for (i=0; line[i]; i++) { - if (isspace(line[i])) { - line[i] = '\0'; - startofsym = 1; - continue; - } - if (startofsym) { - startofsym = 0; - vec[idx++] = FUNCTION; - vec[idx++] = &line[i]; - } - } - for (i = 0; i < idx; i++) { - if (strcmp(vec[i], FUNCTION)) - continue; - consume_symbol(vec[i + 1]); - } - vec[idx++] = filename; - vec[idx] = NULL; - exec_kernel_doc(vec); -} - -/* - * Insert specific documentation section from a file. - * Call kernel-doc with the following parameters: - * kernel-doc -docbook -function "doc section" filename - */ -static void docsect(char *filename, char *line) -{ - char *vec[6]; /* kerneldoc -docbook -function "section" file NULL */ - char *s; - - for (s = line; *s; s++) - if (*s == '\n') - *s = '\0'; - - if (asprintf(&s, "DOC: %s", line) < 0) { - perror("asprintf"); - exit(1); - } - consume_symbol(s); - free(s); - - vec[0] = KERNELDOC; - vec[1] = DOCBOOK; - vec[2] = FUNCTION; - vec[3] = line; - vec[4] = filename; - vec[5] = NULL; - exec_kernel_doc(vec); -} - -static void find_all_symbols(char *filename) -{ - char *vec[4]; /* kerneldoc -list file NULL */ - pid_t pid; - int ret, i, count, start; - char real_filename[PATH_MAX + 1]; - int pipefd[2]; - char *data, *str; - size_t data_len = 0; - - vec[0] = KERNELDOC; - vec[1] = LIST; - vec[2] = filename; - vec[3] = NULL; - - if (pipe(pipefd)) { - perror("pipe"); - exit(1); - } - - switch (pid=fork()) { - case -1: - perror("fork"); - exit(1); - case 0: - close(pipefd[0]); - dup2(pipefd[1], 1); - memset(real_filename, 0, sizeof(real_filename)); - strncat(real_filename, kernsrctree, PATH_MAX); - strncat(real_filename, "/" KERNELDOCPATH KERNELDOC, - PATH_MAX - strlen(real_filename)); - execvp(real_filename, vec); - fprintf(stderr, "exec "); - perror(real_filename); - exit(1); - default: - close(pipefd[1]); - data = malloc(4096); - do { - while ((ret = read(pipefd[0], - data + data_len, - 4096)) > 0) { - data_len += ret; - data = realloc(data, data_len + 4096); - } - } while (ret == -EAGAIN); - if (ret != 0) { - perror("read"); - exit(1); - } - waitpid(pid, &ret ,0); - } - if (WIFEXITED(ret)) - exitstatus |= WEXITSTATUS(ret); - else - exitstatus = 0xff; - - count = 0; - /* poor man's strtok, but with counting */ - for (i = 0; i < data_len; i++) { - if (data[i] == '\n') { - count++; - data[i] = '\0'; - } - } - start = all_list_len; - all_list_len += count; - all_list = realloc(all_list, sizeof(char *) * all_list_len); - str = data; - for (i = 0; i < data_len && start != all_list_len; i++) { - if (data[i] == '\0') { - all_list[start] = str; - str = data + i + 1; - start++; - } - } -} - -/* - * Parse file, calling action specific functions for: - * 1) Lines containing !E - * 2) Lines containing !I - * 3) Lines containing !D - * 4) Lines containing !F - * 5) Lines containing !P - * 6) Lines containing !C - * 7) Default lines - lines not matching the above - */ -static void parse_file(FILE *infile) -{ - char line[MAXLINESZ]; - char * s; - while (fgets(line, MAXLINESZ, infile)) { - if (line[0] == '!') { - s = line + 2; - switch (line[1]) { - case 'E': - while (*s && !isspace(*s)) s++; - *s = '\0'; - externalfunctions(line+2); - break; - case 'I': - while (*s && !isspace(*s)) s++; - *s = '\0'; - internalfunctions(line+2); - break; - case 'D': - while (*s && !isspace(*s)) s++; - *s = '\0'; - symbolsonly(line+2); - break; - case 'F': - /* filename */ - while (*s && !isspace(*s)) s++; - *s++ = '\0'; - /* function names */ - while (isspace(*s)) - s++; - singlefunctions(line +2, s); - break; - case 'P': - /* filename */ - while (*s && !isspace(*s)) s++; - *s++ = '\0'; - /* DOC: section name */ - while (isspace(*s)) - s++; - docsection(line + 2, s); - break; - case 'C': - while (*s && !isspace(*s)) s++; - *s = '\0'; - if (findall) - findall(line+2); - break; - default: - defaultline(line); - } - } - else { - defaultline(line); - } - } - fflush(stdout); -} - - -int main(int argc, char *argv[]) -{ - FILE * infile; - int i; - - srctree = getenv("SRCTREE"); - if (!srctree) - srctree = getcwd(NULL, 0); - kernsrctree = getenv("KBUILD_SRC"); - if (!kernsrctree || !*kernsrctree) - kernsrctree = srctree; - if (argc != 3) { - usage(); - exit(1); - } - /* Open file, exit on error */ - infile = fopen(argv[2], "r"); - if (infile == NULL) { - fprintf(stderr, "docproc: "); - perror(argv[2]); - exit(2); - } - - if (strcmp("doc", argv[1]) == 0) - { - /* Need to do this in two passes. - * First pass is used to collect all symbols exported - * in the various files; - * Second pass generate the documentation. - * This is required because some functions are declared - * and exported in different files :-(( - */ - /* Collect symbols */ - defaultline = noaction; - internalfunctions = find_export_symbols; - externalfunctions = find_export_symbols; - symbolsonly = find_export_symbols; - singlefunctions = noaction2; - docsection = noaction2; - findall = find_all_symbols; - parse_file(infile); - - /* Rewind to start from beginning of file again */ - fseek(infile, 0, SEEK_SET); - defaultline = printline; - internalfunctions = intfunc; - externalfunctions = extfunc; - symbolsonly = printline; - singlefunctions = singfunc; - docsection = docsect; - findall = NULL; - - parse_file(infile); - - for (i = 0; i < all_list_len; i++) { - if (!all_list[i]) - continue; - fprintf(stderr, "Warning: didn't use docs for %s\n", - all_list[i]); - } - } - else if (strcmp("depend", argv[1]) == 0) - { - /* Create first part of dependency chain - * file.tmpl */ - printf("%s\t", argv[2]); - defaultline = noaction; - internalfunctions = adddep; - externalfunctions = adddep; - symbolsonly = adddep; - singlefunctions = adddep2; - docsection = adddep2; - findall = adddep; - parse_file(infile); - printf("\n"); - } - else - { - fprintf(stderr, "Unknown option: %s\n", argv[1]); - exit(1); - } - fclose(infile); - fflush(stdout); - return exitstatus; -} diff --git a/l4/tool/kconfig/scripts/basic/hash.c b/l4/tool/kconfig/scripts/basic/hash.c deleted file mode 100644 index 2ef5d3f6..00000000 --- a/l4/tool/kconfig/scripts/basic/hash.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2008 Red Hat, Inc., Jason Baron - * - */ - -#include -#include -#include - -#define DYNAMIC_DEBUG_HASH_BITS 6 - -static const char *program; - -static void usage(void) -{ - printf("Usage: %s \n", program); - exit(1); -} - -/* djb2 hashing algorithm by Dan Bernstein. From: - * http://www.cse.yorku.ca/~oz/hash.html - */ - -static unsigned int djb2_hash(char *str) -{ - unsigned long hash = 5381; - int c; - - c = *str; - while (c) { - hash = ((hash << 5) + hash) + c; - c = *++str; - } - return (unsigned int)(hash & ((1 << DYNAMIC_DEBUG_HASH_BITS) - 1)); -} - -static unsigned int r5_hash(char *str) -{ - unsigned long hash = 0; - int c; - - c = *str; - while (c) { - hash = (hash + (c << 4) + (c >> 4)) * 11; - c = *++str; - } - return (unsigned int)(hash & ((1 << DYNAMIC_DEBUG_HASH_BITS) - 1)); -} - -int main(int argc, char *argv[]) -{ - program = argv[0]; - - if (argc != 3) - usage(); - if (!strcmp(argv[1], "djb2")) - printf("%d\n", djb2_hash(argv[2])); - else if (!strcmp(argv[1], "r5")) - printf("%d\n", r5_hash(argv[2])); - else - usage(); - exit(0); -} - diff --git a/l4/tool/kconfig/scripts/kconfig/.gitignore b/l4/tool/kconfig/scripts/kconfig/.gitignore index ee120d44..be603c4f 100644 --- a/l4/tool/kconfig/scripts/kconfig/.gitignore +++ b/l4/tool/kconfig/scripts/kconfig/.gitignore @@ -7,7 +7,6 @@ config* *.tab.h zconf.hash.c *.moc -lkc_defs.h gconf.glade.h *.pot *.mo diff --git a/l4/tool/kconfig/scripts/kconfig/Makefile b/l4/tool/kconfig/scripts/kconfig/Makefile index 79662658..3091794e 100644 --- a/l4/tool/kconfig/scripts/kconfig/Makefile +++ b/l4/tool/kconfig/scripts/kconfig/Makefile @@ -76,11 +76,17 @@ PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf $< --$@ $(Kconfig) -PHONY += listnewconfig oldnoconfig savedefconfig defconfig +PHONY += listnewconfig olddefconfig oldnoconfig savedefconfig defconfig -listnewconfig oldnoconfig: $(obj)/conf +listnewconfig olddefconfig: $(obj)/conf $< --$@ $(Kconfig) +# oldnoconfig is an alias of olddefconfig, because people already are dependent +# on its behavior(sets new symbols to their default value but not 'n') with the +# counter-intuitive name. +oldnoconfig: $(obj)/conf + $< --olddefconfig $(Kconfig) + savedefconfig: $(obj)/conf $< --$@=defconfig $(Kconfig) @@ -114,7 +120,7 @@ help: @echo ' alldefconfig - New config with all symbols set to default' @echo ' randconfig - New config with random answer to all options' @echo ' listnewconfig - List new options' - @echo ' oldnoconfig - Same as silentoldconfig but set new symbols to n (unset)' + @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value' # lxdialog stuff check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh @@ -234,12 +240,12 @@ $(obj)/.tmp_qtcheck: if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \ done; \ if [ -z "$$dir" ]; then \ - echo "*"; \ - echo "* Unable to find any QT installation. Please make sure that"; \ - echo "* the QT4 or QT3 development package is correctly installed and"; \ - echo "* either qmake can be found or install pkg-config or set"; \ - echo "* the QTDIR environment variable to the correct location."; \ - echo "*"; \ + echo >&2 "*"; \ + echo >&2 "* Unable to find any QT installation. Please make sure that"; \ + echo >&2 "* the QT4 or QT3 development package is correctly installed and"; \ + echo >&2 "* either qmake can be found or install pkg-config or set"; \ + echo >&2 "* the QTDIR environment variable to the correct location."; \ + echo >&2 "*"; \ false; \ fi; \ libpath=$$dir/lib; lib=qt; osdir=""; \ @@ -260,8 +266,8 @@ $(obj)/.tmp_qtcheck: else \ cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \ libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \ - binpath="\$$(shell pkg-config QtCore --variable=prefix)"; \ - moc="$$binpath/bin/moc"; \ + moc="\$$(shell pkg-config QtCore --variable=moc_location)"; \ + [ -n "$$moc" ] || moc="\$$(shell pkg-config QtCore --variable=prefix)/bin/moc"; \ fi; \ echo "KC_QT_CFLAGS=$$cflags" > $@; \ echo "KC_QT_LIBS=$$libs" >> $@; \ @@ -279,17 +285,17 @@ $(obj)/.tmp_gtkcheck: if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \ touch $@; \ else \ - echo "*"; \ - echo "* GTK+ is present but version >= 2.0.0 is required."; \ - echo "*"; \ + echo >&2 "*"; \ + echo >&2 "* GTK+ is present but version >= 2.0.0 is required."; \ + echo >&2 "*"; \ false; \ fi \ else \ - echo "*"; \ - echo "* Unable to find the GTK+ installation. Please make sure that"; \ - echo "* the GTK+ 2.0 development package is correctly installed..."; \ - echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \ - echo "*"; \ + echo >&2 "*"; \ + echo >&2 "* Unable to find the GTK+ installation. Please make sure that"; \ + echo >&2 "* the GTK+ 2.0 development package is correctly installed..."; \ + echo >&2 "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \ + echo >&2 "*"; \ false; \ fi endif @@ -298,8 +304,11 @@ $(obj)/zconf.tab.o: $(obj)/zconf.lex.c $(obj)/zconf.hash.c $(obj)/qconf.o: $(obj)/qconf.moc -$(obj)/%.moc: $(src)/%.h - $(KC_QT_MOC) -i $< -o $@ +quiet_cmd_moc = MOC $@ + cmd_moc = $(KC_QT_MOC) -i $< -o $@ + +$(obj)/%.moc: $(src)/%.h $(obj)/.tmp_qtcheck + $(call cmd,moc) # Extract gconf menu items for I18N support $(obj)/gconf.glade.h: $(obj)/gconf.glade diff --git a/l4/tool/kconfig/scripts/kconfig/check.sh b/l4/tool/kconfig/scripts/kconfig/check.sh index fa59cbf9..854d9c7c 100755 --- a/l4/tool/kconfig/scripts/kconfig/check.sh +++ b/l4/tool/kconfig/scripts/kconfig/check.sh @@ -1,6 +1,6 @@ #!/bin/sh # Needed for systems without gettext -$* -xc -o /dev/null - > /dev/null 2>&1 << EOF +$* -x c -o /dev/null - > /dev/null 2>&1 << EOF #include int main() { diff --git a/l4/tool/kconfig/scripts/kconfig/conf.c b/l4/tool/kconfig/scripts/kconfig/conf.c index 0dc4a2c7..4da3b4ad 100644 --- a/l4/tool/kconfig/scripts/kconfig/conf.c +++ b/l4/tool/kconfig/scripts/kconfig/conf.c @@ -32,7 +32,7 @@ enum input_mode { defconfig, savedefconfig, listnewconfig, - oldnoconfig, + olddefconfig, } input_mode = oldaskconfig; static int indent = 1; @@ -365,7 +365,7 @@ static void conf(struct menu *menu) case P_MENU: if ((input_mode == silentoldconfig || input_mode == listnewconfig || - input_mode == oldnoconfig) && + input_mode == olddefconfig) && rootEntry != menu) { check_conf(menu); return; @@ -429,7 +429,7 @@ static void check_conf(struct menu *menu) if (sym->name && !sym_is_choice_value(sym)) { printf("%s%s\n", CONFIG_, sym->name); } - } else if (input_mode != oldnoconfig) { + } else if (input_mode != olddefconfig) { if (!conf_cnt++) printf(_("*\n* Restart config...\n*\n")); rootEntry = menu_get_parent_menu(menu); @@ -454,7 +454,13 @@ static struct option long_opts[] = { {"alldefconfig", no_argument, NULL, alldefconfig}, {"randconfig", no_argument, NULL, randconfig}, {"listnewconfig", no_argument, NULL, listnewconfig}, - {"oldnoconfig", no_argument, NULL, oldnoconfig}, + {"olddefconfig", no_argument, NULL, olddefconfig}, + /* + * oldnoconfig is an alias of olddefconfig, because people already + * are dependent on its behavior(sets new symbols to their default + * value but not 'n') with the counter-intuitive name. + */ + {"oldnoconfig", no_argument, NULL, olddefconfig}, {NULL, 0, NULL, 0} }; @@ -467,7 +473,8 @@ static void conf_usage(const char *progname) printf(" --oldaskconfig Start a new configuration using a line-oriented program\n"); printf(" --oldconfig Update a configuration using a provided .config as base\n"); printf(" --silentoldconfig Same as oldconfig, but quietly, additionally update deps\n"); - printf(" --oldnoconfig Same as silentoldconfig but set new symbols to no\n"); + printf(" --olddefconfig Same as silentoldconfig but sets new symbols to their default value\n"); + printf(" --oldnoconfig An alias of olddefconfig\n"); printf(" --defconfig New config with default defined in \n"); printf(" --savedefconfig Save the minimal current configuration to \n"); printf(" --allnoconfig New config where all options are answered with no\n"); @@ -520,7 +527,7 @@ int main(int ac, char **av) case allmodconfig: case alldefconfig: case listnewconfig: - case oldnoconfig: + case olddefconfig: break; case '?': conf_usage(progname); @@ -565,7 +572,7 @@ int main(int ac, char **av) case oldaskconfig: case oldconfig: case listnewconfig: - case oldnoconfig: + case olddefconfig: conf_read(NULL); break; case allnoconfig: @@ -645,7 +652,7 @@ int main(int ac, char **av) /* fall through */ case oldconfig: case listnewconfig: - case oldnoconfig: + case olddefconfig: case silentoldconfig: /* Update until a loop caused no more changes */ do { @@ -653,7 +660,7 @@ int main(int ac, char **av) check_conf(&rootmenu); } while (conf_cnt && (input_mode != listnewconfig && - input_mode != oldnoconfig)); + input_mode != olddefconfig)); break; } diff --git a/l4/tool/kconfig/scripts/kconfig/confdata.c b/l4/tool/kconfig/scripts/kconfig/confdata.c index bcc2719d..13d89e32 100644 --- a/l4/tool/kconfig/scripts/kconfig/confdata.c +++ b/l4/tool/kconfig/scripts/kconfig/confdata.c @@ -182,10 +182,66 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) return 0; } +#define LINE_GROWTH 16 +static int add_byte(int c, char **lineptr, size_t slen, size_t *n) +{ + char *nline; + size_t new_size = slen + 1; + if (new_size > *n) { + new_size += LINE_GROWTH - 1; + new_size *= 2; + nline = realloc(*lineptr, new_size); + if (!nline) + return -1; + + *lineptr = nline; + *n = new_size; + } + + (*lineptr)[slen] = c; + + return 0; +} + +static ssize_t compat_getline(char **lineptr, size_t *n, FILE *stream) +{ + char *line = *lineptr; + size_t slen = 0; + + for (;;) { + int c = getc(stream); + + switch (c) { + case '\n': + if (add_byte(c, &line, slen, n) < 0) + goto e_out; + slen++; + /* fall through */ + case EOF: + if (add_byte('\0', &line, slen, n) < 0) + goto e_out; + *lineptr = line; + if (slen == 0) + return -1; + return slen; + default: + if (add_byte(c, &line, slen, n) < 0) + goto e_out; + slen++; + } + } + +e_out: + line[slen-1] = '\0'; + *lineptr = line; + return -1; +} + int conf_read_simple(const char *name, int def) { FILE *in = NULL; - char line[1024]; + char *line = NULL; + size_t line_asize = 0; char *p, *p2; struct symbol *sym; int i, def_flags; @@ -247,7 +303,7 @@ load: } } - while (fgets(line, sizeof(line), in)) { + while (compat_getline(&line, &line_asize, in) != -1) { conf_lineno++; sym = NULL; if (line[0] == '#') { @@ -335,6 +391,7 @@ setsym: cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri); } } + free(line); fclose(in); if (modules_sym) diff --git a/l4/tool/kconfig/scripts/kconfig/expr.h b/l4/tool/kconfig/scripts/kconfig/expr.h index d4ecce8b..cdd48600 100644 --- a/l4/tool/kconfig/scripts/kconfig/expr.h +++ b/l4/tool/kconfig/scripts/kconfig/expr.h @@ -12,6 +12,7 @@ extern "C" { #include #include +#include "list.h" #ifndef __cplusplus #include #endif @@ -173,6 +174,15 @@ struct menu { #define MENU_CHANGED 0x0001 #define MENU_ROOT 0x0002 +struct jump_key { + struct list_head entries; + size_t offset; + struct menu *target; + int index; +}; + +#define JUMP_NB 9 + extern struct file *file_list; extern struct file *current_file; struct file *lookup_file(const char *name); diff --git a/l4/tool/kconfig/scripts/kconfig/list.h b/l4/tool/kconfig/scripts/kconfig/list.h new file mode 100644 index 00000000..0ae730be --- /dev/null +++ b/l4/tool/kconfig/scripts/kconfig/list.h @@ -0,0 +1,91 @@ +#ifndef LIST_H +#define LIST_H + +/* + * Copied from include/linux/... + */ + +#undef offsetof +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) + +/** + * container_of - cast a member of a structure out to the containing structure + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. + * + */ +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + + +struct list_head { + struct list_head *next, *prev; +}; + + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + container_of(ptr, type, member) + +/** + * list_for_each_entry - iterate over list of given type + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry(pos, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member)) + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static inline int list_empty(const struct list_head *head) +{ + return head->next == head; +} + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_add(struct list_head *_new, + struct list_head *prev, + struct list_head *next) +{ + next->prev = _new; + _new->next = next; + _new->prev = prev; + prev->next = _new; +} + +/** + * list_add_tail - add a new entry + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static inline void list_add_tail(struct list_head *_new, struct list_head *head) +{ + __list_add(_new, head->prev, head); +} + +#endif diff --git a/l4/tool/kconfig/scripts/kconfig/lkc_proto.h b/l4/tool/kconfig/scripts/kconfig/lkc_proto.h index 47fe9c34..ef1a7381 100644 --- a/l4/tool/kconfig/scripts/kconfig/lkc_proto.h +++ b/l4/tool/kconfig/scripts/kconfig/lkc_proto.h @@ -21,8 +21,10 @@ P(menu_get_root_menu,struct menu *,(struct menu *menu)); P(menu_get_parent_menu,struct menu *,(struct menu *menu)); P(menu_has_help,bool,(struct menu *menu)); P(menu_get_help,const char *,(struct menu *menu)); -P(get_symbol_str, void, (struct gstr *r, struct symbol *sym)); -P(get_relations_str, struct gstr, (struct symbol **sym_arr)); +P(get_symbol_str, void, (struct gstr *r, struct symbol *sym, struct list_head + *head)); +P(get_relations_str, struct gstr, (struct symbol **sym_arr, struct list_head + *head)); P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help)); /* symbol.c */ diff --git a/l4/tool/kconfig/scripts/kconfig/lxdialog/check-lxdialog.sh b/l4/tool/kconfig/scripts/kconfig/lxdialog/check-lxdialog.sh index 82cc3a85..c8e8a715 100644 --- a/l4/tool/kconfig/scripts/kconfig/lxdialog/check-lxdialog.sh +++ b/l4/tool/kconfig/scripts/kconfig/lxdialog/check-lxdialog.sh @@ -4,7 +4,7 @@ # What library to link ldflags() { - for ext in so a dylib ; do + for ext in so a dll.a dylib ; do for lib in ncursesw ncurses curses ; do $cc -print-file-name=lib${lib}.${ext} | grep -q / if [ $? -eq 0 ]; then @@ -19,12 +19,12 @@ ldflags() # Where is ncurses.h? ccflags() { - if [ -f /usr/include/ncurses/ncurses.h ]; then + if [ -f /usr/include/ncursesw/curses.h ]; then + echo '-I/usr/include/ncursesw -DCURSES_LOC=""' + elif [ -f /usr/include/ncurses/ncurses.h ]; then echo '-I/usr/include/ncurses -DCURSES_LOC=""' elif [ -f /usr/include/ncurses/curses.h ]; then echo '-I/usr/include/ncurses -DCURSES_LOC=""' - elif [ -f /usr/include/ncursesw/curses.h ]; then - echo '-I/usr/include/ncursesw -DCURSES_LOC=""' elif [ -f /usr/include/ncurses.h ]; then echo '-DCURSES_LOC=""' else @@ -38,7 +38,7 @@ trap "rm -f $tmp" 0 1 2 3 15 # Check if we can link to ncurses check() { - $cc -xc - -o $tmp 2>/dev/null <<'EOF' + $cc -x c - -o $tmp 2>/dev/null <<'EOF' #include CURSES_LOC main() {} EOF diff --git a/l4/tool/kconfig/scripts/kconfig/lxdialog/dialog.h b/l4/tool/kconfig/scripts/kconfig/lxdialog/dialog.h index b5211fce..ee17a526 100644 --- a/l4/tool/kconfig/scripts/kconfig/lxdialog/dialog.h +++ b/l4/tool/kconfig/scripts/kconfig/lxdialog/dialog.h @@ -144,6 +144,7 @@ struct dialog_info { */ extern struct dialog_info dlg; extern char dialog_input_result[]; +extern int saved_x, saved_y; /* Needed in signal handler in mconf.c */ /* * Function prototypes @@ -209,7 +210,13 @@ int first_alpha(const char *string, const char *exempt); int dialog_yesno(const char *title, const char *prompt, int height, int width); int dialog_msgbox(const char *title, const char *prompt, int height, int width, int pause); -int dialog_textbox(const char *title, const char *file, int height, int width); + + +typedef void (*update_text_fn)(char *buf, size_t start, size_t end, void + *_data); +int dialog_textbox(const char *title, char *tbuf, int initial_height, + int initial_width, int *keys, int *_vscroll, int *_hscroll, + update_text_fn update_text, void *data); 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, diff --git a/l4/tool/kconfig/scripts/kconfig/lxdialog/textbox.c b/l4/tool/kconfig/scripts/kconfig/lxdialog/textbox.c index 154c2dd2..a48bb93e 100644 --- a/l4/tool/kconfig/scripts/kconfig/lxdialog/textbox.c +++ b/l4/tool/kconfig/scripts/kconfig/lxdialog/textbox.c @@ -22,23 +22,25 @@ #include "dialog.h" static void back_lines(int n); -static void print_page(WINDOW * win, int height, int width); -static void print_line(WINDOW * win, int row, int width); +static void print_page(WINDOW *win, int height, int width, update_text_fn + update_text, void *data); +static void print_line(WINDOW *win, int row, int width); static char *get_line(void); static void print_position(WINDOW * win); static int hscroll; static int begin_reached, end_reached, page_length; -static const char *buf; -static const char *page; +static char *buf; +static char *page; /* * refresh window content */ static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw, - int cur_y, int cur_x) + int cur_y, int cur_x, update_text_fn update_text, + void *data) { - print_page(box, boxh, boxw); + print_page(box, boxh, boxw, update_text, data); print_position(dialog); wmove(dialog, cur_y, cur_x); /* Restore cursor position */ wrefresh(dialog); @@ -47,14 +49,18 @@ static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw, /* * Display text from a file in a dialog box. + * + * keys is a null-terminated array + * update_text() may not add or remove any '\n' or '\0' in tbuf */ -int dialog_textbox(const char *title, const char *tbuf, - int initial_height, int initial_width) +int dialog_textbox(const char *title, char *tbuf, int initial_height, + int initial_width, int *keys, int *_vscroll, int *_hscroll, + update_text_fn update_text, void *data) { int i, x, y, cur_x, cur_y, key = 0; int height, width, boxh, boxw; - int passed_end; WINDOW *dialog, *box; + bool done = false; begin_reached = 1; end_reached = 0; @@ -63,6 +69,15 @@ int dialog_textbox(const char *title, const char *tbuf, buf = tbuf; page = buf; /* page is pointer to start of page to be displayed */ + if (_vscroll && *_vscroll) { + begin_reached = 0; + + for (i = 0; i < *_vscroll; i++) + get_line(); + } + if (_hscroll) + hscroll = *_hscroll; + do_resize: getmaxyx(stdscr, height, width); if (height < 8 || width < 8) @@ -120,25 +135,28 @@ do_resize: /* Print first page of text */ attr_clear(box, boxh, boxw, dlg.dialog.atr); - refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x, update_text, + data); - while ((key != KEY_ESC) && (key != '\n')) { + while (!done) { key = wgetch(dialog); switch (key) { case 'E': /* Exit */ case 'e': case 'X': case 'x': - delwin(box); - delwin(dialog); - return 0; + case 'q': + case '\n': + done = true; + break; case 'g': /* First page */ case KEY_HOME: if (!begin_reached) { begin_reached = 1; page = buf; refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x); + cur_y, cur_x, update_text, + data); } break; case 'G': /* Last page */ @@ -148,78 +166,48 @@ do_resize: /* point to last char in buf */ page = buf + strlen(buf); back_lines(boxh); - refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case 'K': /* Previous line */ case 'k': case KEY_UP: - if (!begin_reached) { - back_lines(page_length + 1); + if (begin_reached) + break; - /* We don't call print_page() here but use - * scrolling to ensure faster screen update. - * However, 'end_reached' and 'page_length' - * should still be updated, and 'page' should - * point to start of next page. This is done - * by calling get_line() in the following - * 'for' loop. */ - scrollok(box, TRUE); - wscrl(box, -1); /* Scroll box region down one line */ - scrollok(box, FALSE); - page_length = 0; - passed_end = 0; - for (i = 0; i < boxh; i++) { - if (!i) { - /* print first line of page */ - print_line(box, 0, boxw); - wnoutrefresh(box); - } else - /* Called to update 'end_reached' and 'page' */ - get_line(); - if (!passed_end) - page_length++; - if (end_reached && !passed_end) - passed_end = 1; - } - - print_position(dialog); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - } + back_lines(page_length + 1); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case 'B': /* Previous page */ case 'b': + case 'u': case KEY_PPAGE: if (begin_reached) break; back_lines(page_length + boxh); - refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case 'J': /* Next line */ case 'j': case KEY_DOWN: - if (!end_reached) { - begin_reached = 0; - scrollok(box, TRUE); - scroll(box); /* Scroll box region up one line */ - scrollok(box, FALSE); - print_line(box, boxh - 1, boxw); - wnoutrefresh(box); - print_position(dialog); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - } + if (end_reached) + break; + + back_lines(page_length - 1); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case KEY_NPAGE: /* Next page */ case ' ': + case 'd': if (end_reached) break; begin_reached = 0; - refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case '0': /* Beginning of line */ case 'H': /* Scroll left */ @@ -234,8 +222,8 @@ do_resize: hscroll--; /* Reprint current page to scroll horizontally */ back_lines(page_length); - refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case 'L': /* Scroll right */ case 'l': @@ -245,11 +233,12 @@ do_resize: hscroll++; /* Reprint current page to scroll horizontally */ back_lines(page_length); - refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case KEY_ESC: - key = on_key_esc(dialog); + if (on_key_esc(dialog) == KEY_ESC) + done = true; break; case KEY_RESIZE: back_lines(height); @@ -257,11 +246,31 @@ do_resize: delwin(dialog); on_key_resize(); goto do_resize; + default: + for (i = 0; keys[i]; i++) { + if (key == keys[i]) { + done = true; + break; + } + } } } delwin(box); delwin(dialog); - return key; /* ESC pressed */ + if (_vscroll) { + const char *s; + + s = buf; + *_vscroll = 0; + back_lines(page_length); + while (s < page && (s = strchr(s, '\n'))) { + (*_vscroll)++; + s++; + } + } + if (_hscroll) + *_hscroll = hscroll; + return key; } /* @@ -298,12 +307,23 @@ static void back_lines(int n) } /* - * Print a new page of text. Called by dialog_textbox(). + * Print a new page of text. */ -static void print_page(WINDOW * win, int height, int width) +static void print_page(WINDOW *win, int height, int width, update_text_fn + update_text, void *data) { int i, passed_end = 0; + if (update_text) { + char *end; + + for (i = 0; i < height; i++) + get_line(); + end = page; + back_lines(height); + update_text(buf, page - buf, end - buf, data); + } + page_length = 0; for (i = 0; i < height; i++) { print_line(win, i, width); @@ -316,7 +336,7 @@ static void print_page(WINDOW * win, int height, int width) } /* - * Print a new line of text. Called by dialog_textbox() and print_page(). + * Print a new line of text. */ static void print_line(WINDOW * win, int row, int width) { @@ -354,10 +374,8 @@ static char *get_line(void) end_reached = 0; while (*page != '\n') { if (*page == '\0') { - if (!end_reached) { - end_reached = 1; - break; - } + end_reached = 1; + break; } else if (i < MAX_LEN) line[i++] = *(page++); else { @@ -370,7 +388,7 @@ static char *get_line(void) if (i <= MAX_LEN) line[i] = '\0'; if (!end_reached) - page++; /* move pass '\n' */ + page++; /* move past '\n' */ return line; } diff --git a/l4/tool/kconfig/scripts/kconfig/lxdialog/util.c b/l4/tool/kconfig/scripts/kconfig/lxdialog/util.c index f2375ad7..109d5311 100644 --- a/l4/tool/kconfig/scripts/kconfig/lxdialog/util.c +++ b/l4/tool/kconfig/scripts/kconfig/lxdialog/util.c @@ -23,6 +23,9 @@ #include "dialog.h" +/* Needed in signal handler in mconf.c */ +int saved_x, saved_y; + struct dialog_info dlg; static void set_mono_theme(void) @@ -273,6 +276,10 @@ int init_dialog(const char *backtitle) int height, width; initscr(); /* Init curses */ + + /* Get current cursor position for signal handler in mconf.c */ + getyx(stdscr, saved_y, saved_x); + getmaxyx(stdscr, height, width); if (height < 19 || width < 80) { endwin(); diff --git a/l4/tool/kconfig/scripts/kconfig/mconf.c b/l4/tool/kconfig/scripts/kconfig/mconf.c index f606738d..53975cf8 100644 --- a/l4/tool/kconfig/scripts/kconfig/mconf.c +++ b/l4/tool/kconfig/scripts/kconfig/mconf.c @@ -105,10 +105,10 @@ static const char mconf_readme[] = 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 those\n" -" who are familiar with less and lynx.\n" +" keys h,j,k,l function here as do , , and for \n" +" those who are familiar with less and lynx.\n" "\n" -"o Press , , or to exit.\n" +"o Press , , , or to exit.\n" "\n" "\n" "Alternate Configuration Files\n" @@ -236,16 +236,19 @@ search_help[] = N_( "Result:\n" "-----------------------------------------------------------------\n" "Symbol: FOO [=m]\n" + "Type : tristate\n" "Prompt: Foo bus is used to drive the bar HW\n" - "Defined at drivers/pci/Kconfig:47\n" - "Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n" - "Location:\n" - " -> Bus options (PCI, PCMCIA, EISA, ISA)\n" - " -> PCI support (PCI [=y])\n" - " -> PCI access mode ( [=y])\n" - "Selects: LIBCRC32\n" - "Selected by: BAR\n" + " Defined at drivers/pci/Kconfig:47\n" + " Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n" + " Location:\n" + " -> Bus options (PCI, PCMCIA, EISA, ISA)\n" + " -> PCI support (PCI [=y])\n" + "(1) -> PCI access mode ( [=y])\n" + " Selects: LIBCRC32\n" + " Selected by: BAR\n" "-----------------------------------------------------------------\n" + "o The line 'Type:' shows the type of the configuration option for\n" + " this symbol (boolean, tristate, string, ...)\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" @@ -254,8 +257,12 @@ search_help[] = 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" + " A location followed by a [=y] indicates that this is a\n" + " selectable menu item - and the current value is displayed inside\n" + " brackets.\n" + " Press the key in the (#) prefix to jump directly to that\n" + " location. You will be returned to the current search results\n" + " after exiting this new menu.\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" @@ -273,13 +280,15 @@ static struct menu *current_menu; static int child_count; static int single_menu_mode; static int show_all_options; -static int saved_x, saved_y; -static void conf(struct menu *menu); +static void conf(struct menu *menu, struct menu *active_menu); static void conf_choice(struct menu *menu); static void conf_string(struct menu *menu); static void conf_load(void); static void conf_save(void); +static int show_textbox_ext(const char *title, char *text, int r, int c, + int *keys, int *vscroll, int *hscroll, + update_text_fn update_text, void *data); static void show_textbox(const char *title, const char *text, int r, int c); static void show_helptext(const char *title, const char *text); static void show_help(struct menu *menu); @@ -302,12 +311,47 @@ static void set_config_filename(const char *config_filename) } +struct search_data { + struct list_head *head; + struct menu **targets; + int *keys; +}; + +static void update_text(char *buf, size_t start, size_t end, void *_data) +{ + struct search_data *data = _data; + struct jump_key *pos; + int k = 0; + + list_for_each_entry(pos, data->head, entries) { + if (pos->offset >= start && pos->offset < end) { + char header[4]; + + if (k < JUMP_NB) { + int key = '0' + (pos->index % JUMP_NB) + 1; + + sprintf(header, "(%c)", key); + data->keys[k] = key; + data->targets[k] = pos->target; + k++; + } else { + sprintf(header, " "); + } + + memcpy(buf + pos->offset, header, sizeof(header) - 1); + } + } + data->keys[k] = 0; +} + static void search_conf(void) { struct symbol **sym_arr; struct gstr res; char *dialog_input; - int dres; + int dres, vscroll = 0, hscroll = 0; + bool again; + again: dialog_clear(); dres = dialog_inputbox(_("Search Configuration Parameter"), @@ -330,10 +374,30 @@ again: dialog_input += strlen(CONFIG_); sym_arr = sym_re_search(dialog_input); - res = get_relations_str(sym_arr); + do { + LIST_HEAD(head); + struct menu *targets[JUMP_NB]; + int keys[JUMP_NB + 1], i; + struct search_data data = { + .head = &head, + .targets = targets, + .keys = keys, + }; + + res = get_relations_str(sym_arr, &head); + dres = show_textbox_ext(_("Search Results"), (char *) + str_get(&res), 0, 0, keys, &vscroll, + &hscroll, &update_text, (void *) + &data); + again = false; + for (i = 0; i < JUMP_NB && keys[i]; i++) + if (dres == keys[i]) { + conf(targets[i]->parent, targets[i]); + again = true; + } + str_free(&res); + } while (again); free(sym_arr); - show_textbox(_("Search Results"), str_get(&res), 0, 0); - str_free(&res); } static void build_conf(struct menu *menu) @@ -514,12 +578,11 @@ conf_childs: indent -= doint; } -static void conf(struct menu *menu) +static void conf(struct menu *menu, struct menu *active_menu) { struct menu *submenu; const char *prompt = menu_get_prompt(menu); struct symbol *sym; - struct menu *active_menu = NULL; int res; int s_scroll = 0; @@ -562,13 +625,13 @@ static void conf(struct menu *menu) if (single_menu_mode) submenu->data = (void *) (long) !submenu->data; else - conf(submenu); + conf(submenu, NULL); break; case 't': if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) conf_choice(submenu); else if (submenu->prompt->type == P_MENU) - conf(submenu); + conf(submenu, NULL); break; case 's': conf_string(submenu); @@ -607,7 +670,7 @@ static void conf(struct menu *menu) if (item_is_tag('t')) sym_toggle_tristate_value(sym); else if (item_is_tag('m')) - conf(submenu); + conf(submenu, NULL); break; case 7: search_conf(); @@ -619,10 +682,19 @@ static void conf(struct menu *menu) } } -static void show_textbox(const char *title, const char *text, int r, int c) +static int show_textbox_ext(const char *title, char *text, int r, int c, int + *keys, int *vscroll, int *hscroll, update_text_fn + update_text, void *data) { dialog_clear(); - dialog_textbox(title, text, r, c); + return dialog_textbox(title, text, r, c, keys, vscroll, hscroll, + update_text, data); +} + +static void show_textbox(const char *title, const char *text, int r, int c) +{ + show_textbox_ext(title, (char *) text, r, c, (int []) {0}, NULL, NULL, + NULL, NULL); } static void show_helptext(const char *title, const char *text) @@ -862,9 +934,6 @@ int main(int ac, char **av) single_menu_mode = 1; } - initscr(); - - getyx(stdscr, saved_y, saved_x); if (init_dialog(NULL)) { fprintf(stderr, N_("Your display is too small to run Menuconfig!\n")); fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n")); @@ -873,7 +942,7 @@ int main(int ac, char **av) set_config_filename(conf_get_configname()); do { - conf(&rootmenu); + conf(&rootmenu, NULL); res = handle_exit(); } while (res == KEY_ESC); diff --git a/l4/tool/kconfig/scripts/kconfig/menu.c b/l4/tool/kconfig/scripts/kconfig/menu.c index 8c2a97e6..e98a05c8 100644 --- a/l4/tool/kconfig/scripts/kconfig/menu.c +++ b/l4/tool/kconfig/scripts/kconfig/menu.c @@ -507,10 +507,12 @@ const char *menu_get_help(struct menu *menu) return ""; } -static void get_prompt_str(struct gstr *r, struct property *prop) +static void get_prompt_str(struct gstr *r, struct property *prop, + struct list_head *head) { int i, j; - struct menu *submenu[8], *menu; + struct menu *submenu[8], *menu, *location = NULL; + struct jump_key *jump; str_printf(r, _("Prompt: %s\n"), _(prop->text)); str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name, @@ -521,13 +523,44 @@ static void get_prompt_str(struct gstr *r, struct property *prop) str_append(r, "\n"); } menu = prop->menu->parent; - for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) + for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) { + bool accessible = menu_is_visible(menu); + submenu[i++] = menu; + if (location == NULL && accessible) + location = menu; + } + if (head && location) { + jump = malloc(sizeof(struct jump_key)); + + if (menu_is_visible(prop->menu)) { + /* + * There is not enough room to put the hint at the + * beginning of the "Prompt" line. Put the hint on the + * last "Location" line even when it would belong on + * the former. + */ + jump->target = prop->menu; + } else + jump->target = location; + + if (list_empty(head)) + jump->index = 0; + else + jump->index = list_entry(head->prev, struct jump_key, + entries)->index + 1; + + list_add_tail(&jump->entries, head); + } + if (i > 0) { str_printf(r, _(" Location:\n")); for (j = 4; --i >= 0; j += 2) { menu = submenu[i]; - str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu))); + if (head && location && menu == location) + jump->offset = r->len - 1; + str_printf(r, "%*c-> %s", j, ' ', + _(menu_get_prompt(menu))); if (menu->sym) { str_printf(r, " (%s [=%s])", menu->sym->name ? menu->sym->name : _(""), @@ -538,7 +571,11 @@ static void get_prompt_str(struct gstr *r, struct property *prop) } } -void get_symbol_str(struct gstr *r, struct symbol *sym) +/* + * head is optional and may be NULL + */ +void get_symbol_str(struct gstr *r, struct symbol *sym, + struct list_head *head) { bool hit; struct property *prop; @@ -557,7 +594,7 @@ void get_symbol_str(struct gstr *r, struct symbol *sym) } } for_all_prompts(sym, prop) - get_prompt_str(r, prop); + get_prompt_str(r, prop, head); hit = false; for_all_properties(sym, prop, P_SELECT) { if (!hit) { @@ -577,14 +614,14 @@ void get_symbol_str(struct gstr *r, struct symbol *sym) str_append(r, "\n\n"); } -struct gstr get_relations_str(struct symbol **sym_arr) +struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head) { struct symbol *sym; struct gstr res = str_new(); int i; for (i = 0; sym_arr && (sym = sym_arr[i]); i++) - get_symbol_str(&res, sym); + get_symbol_str(&res, sym, head); if (!i) str_append(&res, _("No matches found.\n")); return res; @@ -603,5 +640,5 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help) } str_printf(help, "%s\n", _(help_text)); if (sym) - get_symbol_str(help, sym); + get_symbol_str(help, sym, NULL); } diff --git a/l4/tool/kconfig/scripts/kconfig/nconf.c b/l4/tool/kconfig/scripts/kconfig/nconf.c index 8c0eb659..87d4b15d 100644 --- a/l4/tool/kconfig/scripts/kconfig/nconf.c +++ b/l4/tool/kconfig/scripts/kconfig/nconf.c @@ -83,10 +83,10 @@ static const char nconf_readme[] = 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 for those\n" -" who are familiar with less and lynx.\n" +" keys h,j,k,l function here as do , and for\n" +" those who are familiar with less and lynx.\n" "\n" -"o Press , , , or to exit.\n" +"o Press , , , , or to exit.\n" "\n" "\n" "Alternate Configuration Files\n" @@ -721,7 +721,7 @@ again: dialog_input += strlen(CONFIG_); sym_arr = sym_re_search(dialog_input); - res = get_relations_str(sym_arr); + res = get_relations_str(sym_arr, NULL); free(sym_arr); show_scroll_win(main_window, _("Search Results"), str_get(&res)); @@ -1503,7 +1503,11 @@ int main(int ac, char **av) } notimeout(stdscr, FALSE); +#if NCURSES_REENTRANT + set_escdelay(1); +#else ESCDELAY = 1; +#endif /* set btns menu */ curses_menu = new_menu(curses_menu_items); diff --git a/l4/tool/kconfig/scripts/kconfig/nconf.gui.c b/l4/tool/kconfig/scripts/kconfig/nconf.gui.c index 3b18dd83..379003c7 100644 --- a/l4/tool/kconfig/scripts/kconfig/nconf.gui.c +++ b/l4/tool/kconfig/scripts/kconfig/nconf.gui.c @@ -604,9 +604,11 @@ void show_scroll_win(WINDOW *main_window, switch (res) { case KEY_NPAGE: case ' ': + case 'd': start_y += text_lines-2; break; case KEY_PPAGE: + case 'u': start_y -= text_lines+2; break; case KEY_HOME: @@ -632,10 +634,10 @@ void show_scroll_win(WINDOW *main_window, start_x++; break; } - if (res == 10 || res == 27 || res == 'q' - || res == KEY_F(F_BACK) || res == KEY_F(F_EXIT)) { + if (res == 10 || res == 27 || res == 'q' || + res == KEY_F(F_HELP) || res == KEY_F(F_BACK) || + res == KEY_F(F_EXIT)) break; - } if (start_y < 0) start_y = 0; if (start_y >= total_lines-text_lines) diff --git a/tools/preprocess/src/preprocess b/tools/preprocess/src/preprocess index 345013ac..7abbe61d 100755 --- a/tools/preprocess/src/preprocess +++ b/tools/preprocess/src/preprocess @@ -164,6 +164,7 @@ our $print_indent = 0; clear_head(); my %classes = (); +my %functions = (); my %sections = (); my %impl_parts = (); my %includes = (); @@ -733,7 +734,8 @@ sub parse_file } # Member function definition? - if (/^([^\{\(]*?) # pretext, maybe w template decl tag +# if (/^([^\{\(]*?) # pretext, maybe w template decl tag + if (/^((?:[^\{\(]|\(\()*?) # pretext, maybe w template decl tag \b ($identifier (?: $s :: $s $identifier)*) # class name ($s $template_arg)? # optional class-template args $s :: $s @@ -744,7 +746,7 @@ sub parse_file { my ($pretext, $class, $templateargs, $name, $args, $posttext) = ($1, $2, (defined $3 ? $3 : ''), $4, $5, $6); -#print "P<$pretext> C<$class> T<$templateargs> N<$name> A<$args> P<$posttext>\n"; +#print "Member: P<$pretext> C<$class> T<$templateargs> N<$name> A<$args> P<$posttext>\n"; # Canonify operator names $name =~ s/(?<=\w)(?:$s_once)+(?=\W)//gs; $name =~ s/(?<=\W)(?:$s_once)+(?=\w)//gs; @@ -768,6 +770,7 @@ sub parse_file $s( \( $paren_expr \) [^:\{\(\)=]*) # arg list (\{.*)$/sx) # body { +#print "Free function: $2 T(" . (defined $3 ? $3 : "") . ") PRE($1) ARGS($4) POST($5)\n"; my $function = { class => '', name => $2, templateargs => (defined $3 @@ -868,7 +871,7 @@ sub read_more () # Read one more line of code. Stow away s/\003/$saved/s; } - while (s|(//(?!-\s*\n).*)$|\001$number\001|m) # Do not match magic "//-" + while (s|(//(?!-\s*\n).*\n)|\001$number\001|m) # Do not match magic "//-" { # The \001 signifies whitespace. push @comments, $1; $number++; @@ -1066,6 +1069,14 @@ sub handle_function $func->{visibility} = "implementation_only"; $func->{pretext} =~ s|IMPLEMENT[ \t]*||s; } + elsif (s/^($s)IMPLEMENT_DEFAULT([\s\n])/$1$2/s) + { + # Use a visibility attribute that is never used in adding + # declarations to classes in print_classdecl. + $func->{visibility} = "implementation_only"; + $func->{default_impl} = 1; + $func->{pretext} =~ s|IMPLEMENT_DEFAULT[ \t]*||s; + } if ($func->{posttext} =~ s/$s=${s}0$s;$s$//s) { @@ -1136,7 +1147,6 @@ sub handle_function if ($match =~ /^(?:${s}template$s<${s}>)+${s}$/s); $func->{pretext} =~ s/\Q$match//s; -# $func->{pretext} =~ s|$template[ \t]*||s; next; } @@ -1211,6 +1221,18 @@ sub handle_function next; } + if (s/^($s)IMPLEMENT_DEFAULT([\s\n])/$1$2/s) + { + $func->{pretext} =~ s/IMPLEMENT_DEFAULT[ \t]*//s; + + if ($func->{class} eq '') + { + $func->{visibility} = "implementation_only"; + $func->{default_impl} = 1; + } + + next; + } if (s/^($s)explicit([\s\n])/$1$2/s) { @@ -1242,6 +1264,23 @@ sub handle_function . " in INTERFACE section;"; } + if (defined $functions{"$func->{class}::$func->{name}"}) + { + my $f = $functions{"$func->{class}::$func->{name}"}; + if (defined $f->{default_impl}) + { + $f->{printed} = 1; + } + elsif (defined $func->{default_impl}) + { + $func->{printed} = 1; + } + } + else + { + $functions{"$func->{class}::$func->{name}"} = $func; + } + push @{$classes{$func->{class}}->{funcs}}, $func; $verbose && print "FUNC: " . ($func->{class} ne '' diff --git a/tools/preprocess/test/Makefile b/tools/preprocess/test/Makefile index 652866c6..3d48137a 100644 --- a/tools/preprocess/test/Makefile +++ b/tools/preprocess/test/Makefile @@ -13,7 +13,7 @@ TOOL_TESTS = mapping mapping_inline random random_inline extern_c static \ parser parser_noinline \ multifile variable line line_not line_nh interface comment_in_string \ default_args drop_single1 drop_single2 drop_single3 drop_multi1 \ - drop_multi2 + drop_multi2 implement_template mapping_inline_src = mapping mapping_inline_flags = -i diff --git a/tools/preprocess/test/implement_template.cpp b/tools/preprocess/test/implement_template.cpp new file mode 100644 index 00000000..ae81de0d --- /dev/null +++ b/tools/preprocess/test/implement_template.cpp @@ -0,0 +1,31 @@ +INTERFACE: + +template< typename T > +class Test +{ +public: + void test_func(); +}; + + +IMPLEMENTATION: + +IMPLEMENT +template< typename T > +// comment +void __attribute__((deprecated)) +Test::test_func() +{ +} + +PUBLIC +template< typename T > // comment 1 +template< + typename X, // comment within template args list + typename X2 // another comment in tl args +> +// comment 2 +void __attribute__((deprecated)) +Test::test_func2() +{ +} diff --git a/tools/preprocess/test/verify/implement_template.cc b/tools/preprocess/test/verify/implement_template.cc new file mode 100644 index 00000000..89fa57ed --- /dev/null +++ b/tools/preprocess/test/verify/implement_template.cc @@ -0,0 +1,5 @@ +// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*- + +#include "implement_template.h" +#include "implement_template_i.h" + diff --git a/tools/preprocess/test/verify/implement_template.h b/tools/preprocess/test/verify/implement_template.h new file mode 100644 index 00000000..4cd44334 --- /dev/null +++ b/tools/preprocess/test/verify/implement_template.h @@ -0,0 +1,58 @@ +// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*- + +#ifndef implement_template_h +#define implement_template_h + +// +// INTERFACE definition follows +// + +#line 2 "implement_template.cpp" + +template< typename T > +class Test +{ +public: + void test_func(); + +public: +#line 23 "implement_template.cpp" + // comment 2 + // comment 1 + template< + typename X, // comment within template args list + typename X2 // another comment in tl args + > void __attribute__((deprecated)) + test_func2(); +}; + +// +// IMPLEMENTATION of function templates +// + + +#line 12 "implement_template.cpp" + + + +// comment +template< typename T > void __attribute__((deprecated)) +Test::test_func() +{ +} + +#line 20 "implement_template.cpp" + + + +// comment 2 + // comment 1 +template< typename T > template< + typename X, // comment within template args list + typename X2 // another comment in tl args +> void __attribute__((deprecated)) +Test::test_func2() +{ +} + +#endif // implement_template_h diff --git a/tools/preprocess/test/verify/implement_template_i.h b/tools/preprocess/test/verify/implement_template_i.h new file mode 100644 index 00000000..da19d7d1 --- /dev/null +++ b/tools/preprocess/test/verify/implement_template_i.h @@ -0,0 +1,6 @@ +// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*- + +#ifndef implement_template_i_h +#define implement_template_i_h + +#endif // implement_template_i_h diff --git a/tools/preprocess/test/verify/line_nh.h b/tools/preprocess/test/verify/line_nh.h index bbe70c07..154804e2 100644 --- a/tools/preprocess/test/verify/line_nh.h +++ b/tools/preprocess/test/verify/line_nh.h @@ -15,6 +15,7 @@ class Foo public: // A long, multiline comment in front of this function definition. // Also, a lot of specifiers that need to be handled. + static void func1(); }; diff --git a/tools/preprocess/test/verify/line_not.cc b/tools/preprocess/test/verify/line_not.cc index eb1d7ca6..ff1bbb81 100644 --- a/tools/preprocess/test/verify/line_not.cc +++ b/tools/preprocess/test/verify/line_not.cc @@ -8,6 +8,7 @@ // A long, multiline comment in front of this function definition. // Also, a lot of specifiers that need to be handled. + void Foo::func1() { diff --git a/tools/preprocess/test/verify/line_not.h b/tools/preprocess/test/verify/line_not.h index 11ab555d..f563d556 100644 --- a/tools/preprocess/test/verify/line_not.h +++ b/tools/preprocess/test/verify/line_not.h @@ -15,6 +15,7 @@ class Foo public: // A long, multiline comment in front of this function definition. // Also, a lot of specifiers that need to be handled. + static void func1(); }; diff --git a/tools/preprocess/test/verify/operator.h b/tools/preprocess/test/verify/operator.h index 1ce3cf4f..4d63c04e 100644 --- a/tools/preprocess/test/verify/operator.h +++ b/tools/preprocess/test/verify/operator.h @@ -17,17 +17,21 @@ public: void * operator new(size_t); // funny comment + #line 16 "operator.cpp" Foo& operator+(const Foo&); // funny comment + #line 22 "operator.cpp" Foo& operator=(const Foo&); // funny comment + #line 28 "operator.cpp" Foo& operator*(const Foo&); // funny comment + }; #line 34 "operator.cpp" diff --git a/tools/preprocess/test/verify/template.cc b/tools/preprocess/test/verify/template.cc index 2e60849f..f3fd7d6b 100644 --- a/tools/preprocess/test/verify/template.cc +++ b/tools/preprocess/test/verify/template.cc @@ -12,13 +12,3 @@ create_stack() { return new stack(); } - -#line 192 "template.cpp" - - - -template <> stack_t* -create_stack() -{ - return new stack(); -} diff --git a/tools/preprocess/test/verify/template.h b/tools/preprocess/test/verify/template.h index 320fceb2..79ab22e2 100644 --- a/tools/preprocess/test/verify/template.h +++ b/tools/preprocess/test/verify/template.h @@ -109,9 +109,24 @@ template <> stack_t* create_stack(); #line 195 "template.cpp" -template <> stack_t* +template <> inline stack_t* create_stack(); +// +// IMPLEMENTATION of inline functions (and needed classes) +// + + +#line 192 "template.cpp" + + + +template <> inline stack_t* +create_stack() +{ + return new stack(); +} + // // IMPLEMENTATION of function templates //