diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c index d4b0a7637..dc401bcc4 100644 --- a/arch/x86/kernel/apic.c +++ b/arch/x86/kernel/apic.c @@ -918,12 +918,6 @@ int smp_start(void) // install IDT idt_install(); - /* - * we turned on paging - * => now, we are able to register our task - */ - register_task(); - // enable additional cpu features cpu_detection(); @@ -938,6 +932,12 @@ int smp_start(void) set_idle_task(); + /* + * TSS is set, pagining is enabled + * => now, we are able to register our task + */ + register_task(); + irq_enable(); atomic_int32_inc(&cpu_online); @@ -1033,24 +1033,6 @@ int apic_send_ipi(uint64_t dest, uint8_t irq) return 0; } -void wakeup_core(uint32_t core_id) -{ - // if mwait is available, an IPI isn't required to wakeup the core - if (has_mwait()) - return; - - // no self IPI required - if (core_id == CORE_ID) - return; - - // no IPI required if core is offline - if (!online[core_id]) - return; - - LOG_DEBUG("wakeup core %d\n", core_id); - apic_send_ipi(core_id, 83+32); -} - static void apic_err_handler(struct state *s) { LOG_ERROR("Got APIC error 0x%x\n", lapic_read(APIC_ESR)); @@ -1102,14 +1084,14 @@ void shutdown_system(void) } } -static void apic_shutdown(struct state * s) +static void apic_shutdown(struct state* s) { go_down = 1; LOG_DEBUG("Receive shutdown interrupt\n"); } -static void apic_wakeup_handler(struct state * s) +static void apic_wakeup(struct state* s) { LOG_DEBUG("Receive wakeup interrupt\n"); } @@ -1123,12 +1105,12 @@ int apic_init(void) return ret; // set APIC error handler + irq_install_handler(121, apic_wakeup); irq_install_handler(126, apic_err_handler); #if MAX_CORES > 1 irq_install_handler(80+32, apic_tlb_handler); #endif irq_install_handler(81+32, apic_shutdown); - irq_install_handler(83+32, apic_wakeup_handler); if (apic_processors[boot_processor]) LOG_INFO("Boot processor %u (ID %u)\n", boot_processor, apic_processors[boot_processor]->id); else diff --git a/arch/x86/kernel/isrs.c b/arch/x86/kernel/isrs.c index dd2583f27..f79cdbd0b 100644 --- a/arch/x86/kernel/isrs.c +++ b/arch/x86/kernel/isrs.c @@ -225,7 +225,7 @@ static void arch_fault_handler(struct state *s) else LOG_WARNING("Unknown exception %d", s->int_no); - LOG_ERROR(" Exception (%d) on core %d at %#x:%#lx, fs = %#lx, gs = %#lx, error code = 0x%#lx, task id = %u, rflags = %#x\n", + LOG_ERROR(" Exception (%d) on core %d at %#x:%#lx, fs = %#lx, gs = %#lx, error code = %#lx, task id = %u, rflags = %#x\n", s->int_no, CORE_ID, s->cs, s->rip, s->fs, s->gs, s->error, per_core(current_task)->id, s->rflags); LOG_ERROR("rax %#lx, rbx %#lx, rcx %#lx, rdx %#lx, rbp, %#lx, rsp %#lx rdi %#lx, rsi %#lx, r8 %#lx, r9 %#lx, r10 %#lx, r11 %#lx, r12 %#lx, r13 %#lx, r14 %#lx, r15 %#lx\n", s->rax, s->rbx, s->rcx, s->rdx, s->rbp, s->rsp, s->rdi, s->rsi, s->r8, s->r9, s->r10, s->r11, s->r12, s->r13, s->r14, s->r15); diff --git a/arch/x86/kernel/tasks.c b/arch/x86/kernel/tasks.c index 1a2155027..d063662d8 100644 --- a/arch/x86/kernel/tasks.c +++ b/arch/x86/kernel/tasks.c @@ -207,3 +207,17 @@ void wait_for_task(void) mwait(0x2 /* 0x2 = c3, 0xF = c0 */, 1 /* break on interrupt flag */); } } + +void wakeup_core(uint32_t core_id) +{ + // if mwait is available, an IPI isn't required to wakeup the core + if (has_mwait()) + return; + + // no self IPI required + if (core_id == CORE_ID) + return; + + LOG_DEBUG("wakeup core %d\n", core_id); + apic_send_ipi(core_id, 121); +} diff --git a/arch/x86/loader/main.c b/arch/x86/loader/main.c index dcb8ad899..a753f2b1a 100644 --- a/arch/x86/loader/main.c +++ b/arch/x86/loader/main.c @@ -103,7 +103,7 @@ void main(void) if (mb_info && mb_info->cmdline) { cmdline = (size_t) mb_info->cmdline; - cmdline_size = strlen(cmdline); + cmdline_size = strlen((char*)cmdline); } // enable paging diff --git a/config/bzImage b/config/bzImage index 04f570ccc..14c60fd39 100644 Binary files a/config/bzImage and b/config/bzImage differ diff --git a/config/linux_config b/config/linux_config index 5613e1f79..f52a07bd5 100644 --- a/config/linux_config +++ b/config/linux_config @@ -139,7 +139,7 @@ CONFIG_ARCH_SUPPORTS_INT128=y # CONFIG_SYSFS_DEPRECATED is not set # CONFIG_RELAY is not set CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE="../config/initrd.cpio" +CONFIG_INITRAMFS_SOURCE="/work/lankes/HermitCore/config/initrd.cpio" CONFIG_INITRAMFS_ROOT_UID=0 CONFIG_INITRAMFS_ROOT_GID=0 CONFIG_RD_GZIP=y diff --git a/drivers/net/mmnif.c b/drivers/net/mmnif.c index 3ff08aa44..29e8034cf 100644 --- a/drivers/net/mmnif.c +++ b/drivers/net/mmnif.c @@ -686,8 +686,6 @@ err_t mmnif_init(struct netif *netif) /* maximum transfer unit */ netif->mtu = 1500; - /* broadcast capability, keep all default flags */ - //netif->flags |= NETIF_FLAG_BROADCAST; /* set link up */ netif->flags |= NETIF_FLAG_LINK_UP; diff --git a/kernel/main.c b/kernel/main.c index f808ae9e7..80cef7269 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -174,11 +174,15 @@ static int init_netifs(void) LOG_INFO("TCP/IP initialized.\n"); sys_sem_free(&sem); - if (is_uhyve()) + if (is_uhyve()) { + LOG_INFO("HermitCore is running on uhyve!\n"); return -ENODEV; + } if (!is_single_kernel()) { + LOG_INFO("HermitCore is running side-by-side to Linux!\n"); + /* Set network address variables */ IP_ADDR4(&gw, 192,168,28,1); IP_ADDR4(&ipaddr, 192,168,28,isle+2); @@ -191,16 +195,11 @@ static int init_netifs(void) * - gw : the gateway wicht should be used * - mmnif_init : the initialization which has to be done in order to use our interface * - ip_input : tells him that he should use ip_input - */ -#if LWIP_TCPIP_CORE_LOCKING_INPUT - if ((err = netifapi_netif_add(&default_netif, ip_2_ip4(&ipaddr), ip_2_ip4(&netmask), ip_2_ip4(&gw), NULL, mmnif_init, ip_input)) != ERR_OK) -#else - /* + * * Note: Our drivers guarantee that the input function will be called in the context of the tcpip thread. * => Therefore, we are able to use ip_input instead of tcpip_input */ if ((err = netifapi_netif_add(&default_netif, ip_2_ip4(&ipaddr), ip_2_ip4(&netmask), ip_2_ip4(&gw), NULL, mmnif_init, ip_input)) != ERR_OK) -#endif { LOG_ERROR("Unable to add the intra network interface: err = %d\n", err); return -ENODEV;