1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

Merge branch 'devel' into proxy_rs

This commit is contained in:
Stefan Lankes 2017-08-24 23:24:14 +02:00
commit 75229c06e1
17 changed files with 77 additions and 39 deletions

View file

@ -13,7 +13,7 @@
},
"version": {
"name": "0.2.1",
"name": "0.2.2",
"desc": "HermitCore's kernel as libOS",
"gpgSign": false
},

View file

@ -3,7 +3,9 @@ dist: trusty
git:
submodules: true
language: c
compiler: gcc
compiler:
- clang
- gcc
before_install:
- echo "deb https://dl.bintray.com/rwth-os/hermitcore vivid main" | sudo tee -a /etc/apt/sources.list
- travis_retry sudo apt-get -qq update
@ -24,7 +26,9 @@ notifications:
slack: hermitcore:UtcfeEXkbpx3WyIDK2Wm2beS
deploy:
on: master
on:
branch: master
condition: "$CC = gcc"
provider: bintray
file: .bintray_descriptor.json
user:

View file

@ -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 <slankes@eonerc.rwth-aachen.de>")

View file

@ -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(&current_boot_id));
LOG_DEBUG("Try to initialize processor (local id %d)\n", atomic_int32_read(&current_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(&current_boot_id));
LOG_DEBUG("CR0 of core %u: 0x%x\n", atomic_int32_read(&current_boot_id), read_cr0());
online[atomic_int32_read(&current_boot_id)] = 1;

View file

@ -121,10 +121,11 @@ SECTION .ktext
align 4
start64:
; reset registers to kill any stale realmode selectors
xor eax, eax
mov eax, 0x10
mov ds, eax
mov ss, eax
mov es, eax
xor eax, eax
mov fs, eax
mov gs, eax
@ -263,7 +264,22 @@ extern gp
; C as 'extern void gdt_flush();'
gdt_flush:
lgdt [gp]
ret
; reload the segment descriptors
mov eax, 0x10
mov ds, eax
mov es, eax
mov ss, eax
xor eax, eax
mov fs, eax
mov gs, eax
; create pseudo interrupt to set cs
push QWORD 0x10 ; SS
push rsp ; RSP
add QWORD [rsp], 0x08 ; => value of rsp before the creation of a pseudo interrupt
pushfq ; RFLAGS
push QWORD 0x08 ; CS
push QWORD rollback ; RIP
iretq
; The first 32 interrupt service routines (ISR) entries correspond to exceptions.
; Some exceptions will push an error code onto the stack which is specific to

View file

@ -153,7 +153,7 @@ void gdt_install(void)
task_state_segments[i].ist3 = (size_t) stack_table[i] + (3 /*IST number */ - 1) * KERNEL_STACK_SIZE - 0x10;
task_state_segments[i].ist4 = (size_t) stack_table[i] + (4 /*IST number */ - 1) * KERNEL_STACK_SIZE - 0x10;
gdt_set_gate(num+i*2, (unsigned long) (task_state_segments+i), sizeof(tss_t)-1,
gdt_set_gate(num+i*2, (unsigned long) (task_state_segments+i), sizeof(tss_t),
GDT_FLAG_PRESENT | GDT_FLAG_TSS | GDT_FLAG_RING0, 0);
}

View file

@ -17,14 +17,33 @@ target_include_directories(arch_x86_loader
target_compile_options(arch_x86_loader
PRIVATE -O2 -Wall -m64 -std=gnu99 -ffreestanding -mno-red-zone
-fstrength-reduce -fomit-frame-pointer -finline-functions)
-fomit-frame-pointer -fno-builtin -nostdlib -nostdinc -mno-sse -mno-avx -mno-mmx -mno-3dnow)
target_link_libraries(arch_x86_loader
arch_x86_loader_asm
"-T ${CMAKE_CURRENT_LIST_DIR}/link.ld"
"-z max-page-size=4096"
-Wl,--build-id=none # required because CMake links with gcc, not ld
-nostdlib -static)
include(CheckCCompilerFlag)
check_c_compiler_flag(-fstrength-reduce HAS_STRENGTH_REDUCE)
if (HAS_STRENGTH_REDUCE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstrength-reduce")
endif()
check_c_compiler_flag(-finline-functions HAS_INLINE_FUNCTIONS)
if (HAS_INLINE_FUNCTIONS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -finline-functions")
endif()
set(CMAKE_LINKER_NAME ld CACHE STRING "Name of the binutils linker")
mark_as_advanced(CMAKE_LINKER_NAME)
find_program(CMAKE_LINKER ${CMAKE_LINKER_NAME})
mark_as_advanced(CMAKE_LINKER)
if(NOT CMAKE_LINKER)
message(FATAL_ERROR "Could not find the GNU LD linker: ${CMAKE_LINKER_NAME}")
endif()
set(CMAKE_C_LINK_EXECUTABLE "${CMAKE_LINKER} <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -T ${CMAKE_CURRENT_LIST_DIR}/link.ld -z max-page-size=4096 --build-id=none -nostdlib -static")
target_link_libraries(arch_x86_loader arch_x86_loader_asm)
# tools/proxy looks for `ldhermit.elf`
set_target_properties(arch_x86_loader PROPERTIES

View file

@ -25,7 +25,7 @@
*/
#ifndef __CTYPE_H_
#define __CYTPE_H_
#define __CTYPE_H_
/** Returns true if the value of 'c' is an ASCII-charater */
static inline int isascii(int c)

View file

@ -56,12 +56,6 @@ static size_t * const self[PAGE_LEVELS] = {
(size_t *) 0xFFC00000,
(size_t *) 0xFFFFF000
};
/** An other self-reference for page_map_copy() */
static size_t * const other[PAGE_LEVELS] = {
(size_t *) 0xFF800000,
(size_t *) 0xFFFFE000
};
#elif defined(CONFIG_X86_64)
/** A self-reference enables direct access to all page tables */
static size_t* const self[PAGE_LEVELS] = {
@ -70,14 +64,6 @@ static size_t* const self[PAGE_LEVELS] = {
(size_t *) 0xFFFFFFFFFFE00000,
(size_t *) 0xFFFFFFFFFFFFF000
};
/** An other self-reference for page_map_copy() */
static size_t * const other[PAGE_LEVELS] = {
(size_t *) 0xFFFFFF0000000000,
(size_t *) 0xFFFFFFFF80000000,
(size_t *) 0xFFFFFFFFFFC00000,
(size_t *) 0xFFFFFFFFFFFFE000
};
#endif
/** @brief Flush a specific page entry in TLB

View file

@ -96,7 +96,7 @@ size_t uartport = 0;
static inline unsigned char read_from_uart(uint32_t off)
{
uint8_t c;
uint8_t c = 0;
if (uartport)
c = inportb(uartport + off);

View file

@ -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

View file

@ -45,6 +45,8 @@
#include <netif/etharp.h>
#include <net/e1000.h>
#if USE_E1000
#define RX_BUF_LEN (2048)
#define TX_BUF_LEN (1792)
@ -603,3 +605,5 @@ oom:
return ERR_MEM;
}
#endif

View file

@ -32,6 +32,8 @@
#include <hermit/stddef.h>
#include <hermit/spinlock.h>
#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

View file

@ -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);

2
lwip

@ -1 +1 @@
Subproject commit 51d48fe0c67131da346c9ef280b2019c77f6e607
Subproject commit c21d911aa4f178563dc102f595d1d97dd8471458

View file

@ -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

View file

@ -591,7 +591,7 @@ static void show_registers(int id, struct kvm_regs* regs, struct kvm_sregs* sreg
fprintf(stderr, "\n");
}
static int print_registers(void)
static void print_registers(void)
{
struct kvm_regs regs;
struct kvm_sregs sregs;