diff --git a/.bintray_descriptor.json b/.bintray_descriptor.json index 5d244a4f7..ff3e91669 100644 --- a/.bintray_descriptor.json +++ b/.bintray_descriptor.json @@ -13,7 +13,7 @@ }, "version": { - "name": "0.2.1", + "name": "0.2.2", "desc": "HermitCore's kernel as libOS", "gpgSign": false }, diff --git a/CMakeLists.txt b/CMakeLists.txt index 65cdc03cd..7383b462b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -199,7 +199,7 @@ set(CPACK_SYSTEM_NAME all) set(CPACK_PACKAGE_VERSION_MAJOR 0) set(CPACK_PACKAGE_VERSION_MINOR 2) -set(CPACK_PACKAGE_VERSION_PATCH 1) +set(CPACK_PACKAGE_VERSION_PATCH 2) set(CPACK_PACKAGE_CONTACT "Stefan Lankes ") diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c index 1192490b8..f75d7fff7 100644 --- a/arch/x86/kernel/apic.c +++ b/arch/x86/kernel/apic.c @@ -905,12 +905,7 @@ extern int set_idle_task(void); #if MAX_CORES > 1 int smp_start(void) { - x2apic_enable(); - - // reset APIC and set id - lapic_reset(); - - LOG_DEBUG("Processor %d (local id %d) is entering its idle task\n", apic_cpu_id(), atomic_int32_read(¤t_boot_id)); + LOG_DEBUG("Try to initialize processor (local id %d)\n", atomic_int32_read(¤t_boot_id)); // use the same gdt like the boot processors gdt_flush(); @@ -921,6 +916,12 @@ int smp_start(void) // enable additional cpu features cpu_detection(); + x2apic_enable(); + + // reset APIC + lapic_reset(); + + LOG_DEBUG("Processor %d (local id %d) is entering its idle task\n", apic_cpu_id(), atomic_int32_read(¤t_boot_id)); LOG_DEBUG("CR0 of core %u: 0x%x\n", atomic_int32_read(¤t_boot_id), read_cr0()); online[atomic_int32_read(¤t_boot_id)] = 1; diff --git a/arch/x86/kernel/entry.asm b/arch/x86/kernel/entry.asm index a4c68e835..6375533da 100644 --- a/arch/x86/kernel/entry.asm +++ b/arch/x86/kernel/entry.asm @@ -202,9 +202,9 @@ Lremap: add rdi, 8 ; note: the whole code segement has to fit in the first pgd cmp rcx, rsi - jnb Lno_pml4_init + jnl Lno_pml4_init cmp rcx, r11 - jb Lremap + jl Lremap Lno_pml4_init: ; Set CR3 @@ -416,7 +416,6 @@ extern irq_handler extern get_current_stack extern finish_task_switch extern syscall_handler -extern kernel_stack global getcontext align 64 diff --git a/arch/x86/kernel/tasks.c b/arch/x86/kernel/tasks.c index 81d38aeca..4a3a89045 100644 --- a/arch/x86/kernel/tasks.c +++ b/arch/x86/kernel/tasks.c @@ -126,7 +126,6 @@ size_t* get_current_stack(void) else stptr = (stptr + DEFAULT_STACK_SIZE - sizeof(size_t)) & ~0x1F; - set_per_core(kernel_stack, stptr); set_tss(stptr, (size_t) curr_task->ist_addr + KERNEL_STACK_SIZE - 0x10); return curr_task->last_stack_pointer; @@ -193,9 +192,11 @@ int create_default_frame(task_t* task, entry_point_t ep, void* arg, uint32_t cor return 0; } +#define USE_MWAIT + void wait_for_task(void) { -#if 1 +#ifndef USE_MWAIT HALT; #else if (!has_mwait()) { @@ -214,7 +215,7 @@ void wait_for_task(void) void wakeup_core(uint32_t core_id) { -#if 0 +#ifdef USE_MWAIT // if mwait is available, an IPI isn't required to wakeup the core if (has_mwait()) return; diff --git a/cmake/HermitCore-Configuration.cmake b/cmake/HermitCore-Configuration.cmake index bd5753eef..c38566f8c 100644 --- a/cmake/HermitCore-Configuration.cmake +++ b/cmake/HermitCore-Configuration.cmake @@ -1,4 +1,4 @@ -set(PACKAGE_VERSION "0.2.1" CACHE STRING +set(PACKAGE_VERSION "0.2.2" CACHE STRING "HermitCore current version") set(MAX_CORES "512" CACHE STRING diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c index c460f96f6..330c16f5c 100644 --- a/drivers/net/e1000.c +++ b/drivers/net/e1000.c @@ -45,6 +45,8 @@ #include #include +#if USE_E1000 + #define RX_BUF_LEN (2048) #define TX_BUF_LEN (1792) @@ -603,3 +605,5 @@ oom: return ERR_MEM; } + +#endif diff --git a/drivers/net/e1000.h b/drivers/net/e1000.h index 08f0d886f..49ade1225 100644 --- a/drivers/net/e1000.h +++ b/drivers/net/e1000.h @@ -32,6 +32,8 @@ #include #include +#ifdef USE_E1000 + #define NUM_RX_DESCRIPTORS 64 #define NUM_TX_DESCRIPTORS 64 @@ -324,3 +326,5 @@ typedef struct e1000if { err_t e1000if_init(struct netif* netif); #endif + +#endif diff --git a/include/hermit/stddef.h b/include/hermit/stddef.h index 5b1531cbb..818ad5fc8 100644 --- a/include/hermit/stddef.h +++ b/include/hermit/stddef.h @@ -83,9 +83,6 @@ typedef unsigned int tid_t; struct task; DECLARE_PER_CORE(struct task*, current_task); -/* allows fast access to the kernel stack */ -DECLARE_PER_CORE(char*, kernel_stack); - #if MAX_CORES > 1 /* allows fast access to the core id */ DECLARE_PER_CORE(uint32_t, __core_id); diff --git a/kernel/main.c b/kernel/main.c index d2fe61327..b5c0bf214 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -206,8 +206,10 @@ static int init_netifs(void) goto success; if ((err = netifapi_netif_add(&default_netif, ip_2_ip4(&ipaddr), ip_2_ip4(&netmask), ip_2_ip4(&gw), NULL, rtl8139if_init, ethernet_input)) == ERR_OK) goto success; +#ifdef USE_E1000 if ((err = netifapi_netif_add(&default_netif, ip_2_ip4(&ipaddr), ip_2_ip4(&netmask), ip_2_ip4(&gw), NULL, e1000if_init, ethernet_input)) == ERR_OK) goto success; +#endif LOG_ERROR("Unable to add the network interface: err = %d\n", err); diff --git a/kernel/tasks.c b/kernel/tasks.c index 47655cb0d..f886fc0a2 100644 --- a/kernel/tasks.c +++ b/kernel/tasks.c @@ -67,7 +67,6 @@ static readyqueues_t readyqueues[1] = {[0] = {task_table+0, NULL, 0, 0, 0, {[0 . #endif DEFINE_PER_CORE(task_t*, current_task, task_table+0); -DEFINE_PER_CORE(char*, kernel_stack, NULL); #if MAX_CORES > 1 DEFINE_PER_CORE(uint32_t, __core_id, 0); @@ -282,7 +281,6 @@ int multitasking_init(void) task_table[0].prio = IDLE_PRIO; task_table[0].stack = (char*) ((size_t)&boot_stack + core_id * KERNEL_STACK_SIZE); task_table[0].ist_addr = (char*)&boot_ist; - set_per_core(kernel_stack, task_table[0].stack + KERNEL_STACK_SIZE - 0x10); set_per_core(current_task, task_table+0); arch_init_task(task_table+0); @@ -307,7 +305,6 @@ int set_idle_task(void) task_table[i].last_stack_pointer = NULL; task_table[i].stack = (char*) ((size_t)&boot_stack + core_id * KERNEL_STACK_SIZE); task_table[i].ist_addr = create_stack(KERNEL_STACK_SIZE); - set_per_core(kernel_stack, task_table[i].stack + KERNEL_STACK_SIZE - 0x10); task_table[i].prio = IDLE_PRIO; task_table[i].heap = NULL; readyqueues[core_id].idle = task_table+i; diff --git a/lwip b/lwip index 51d48fe0c..c21d911aa 160000 --- a/lwip +++ b/lwip @@ -1 +1 @@ -Subproject commit 51d48fe0c67131da346c9ef280b2019c77f6e607 +Subproject commit c21d911aa4f178563dc102f595d1d97dd8471458 diff --git a/tests.sh b/tests.sh index 3cabbadbe..a4e8f0639 100755 --- a/tests.sh +++ b/tests.sh @@ -9,6 +9,8 @@ PROXY=build/local_prefix/opt/hermit/bin/proxy for f in $FILES; do echo "check $f..."; HERMIT_ISLE=qemu HERMIT_CPUS=1 HERMIT_KVM=0 HERMIT_VERBOSE=1 timeout --kill-after=5m 5m $PROXY $f || exit 1; done +for f in $FILES; do echo "check $f..."; HERMIT_ISLE=qemu HERMIT_CPUS=2 HERMIT_KVM=0 HERMIT_VERBOSE=1 timeout --kill-after=5m 5m $PROXY $f || exit 1; done + # test echo server at port 8000 HERMIT_ISLE=qemu HERMIT_CPUS=1 HERMIT_KVM=0 HERMIT_VERBOSE=1 HERMIT_APP_PORT=8000 $PROXY $TDIR/tests/server & sleep 10 diff --git a/tools/proxy.c b/tools/proxy.c index d36d01cdc..8c5adf472 100644 --- a/tools/proxy.c +++ b/tools/proxy.c @@ -522,7 +522,7 @@ static int multi_init(char *path) free(result); // wait until HermitCore is sucessfully booted - wait_hermit_available(); + //wait_hermit_available(); return 0; }