mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-09 00:00:03 +01:00
some code cleanups
This commit is contained in:
parent
fed1d028a2
commit
8362e7bb1b
6 changed files with 24 additions and 20 deletions
|
@ -82,10 +82,14 @@ typedef struct {
|
|||
uint64_t reserved[6];
|
||||
} xsave_header_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t ymmh_space[64];
|
||||
} ymmh_t;
|
||||
|
||||
typedef struct {
|
||||
i387_fxsave_t fxsave;
|
||||
xsave_header_t hdr;
|
||||
uint32_t ymmh[64];
|
||||
ymmh_t ymmh;
|
||||
} xsave_t __attribute__ ((aligned (64)));
|
||||
|
||||
union fpu_state {
|
||||
|
|
|
@ -407,7 +407,7 @@ gdt_flush:
|
|||
; NASM macro which pushs also an pseudo error code
|
||||
%macro isrstub_pseudo_error 1
|
||||
global isr%1
|
||||
align 8
|
||||
align 16
|
||||
isr%1:
|
||||
push byte 0 ; pseudo error code
|
||||
push byte %1
|
||||
|
@ -419,7 +419,7 @@ gdt_flush:
|
|||
; on the stack.
|
||||
%macro isrstub 1
|
||||
global isr%1
|
||||
align 8
|
||||
align 16
|
||||
isr%1:
|
||||
push byte %1
|
||||
jmp common_stub
|
||||
|
@ -472,7 +472,7 @@ isrstub_pseudo_error 9
|
|||
; NASM macro for asynchronous interrupts (no exceptions)
|
||||
%macro irqstub 1
|
||||
global irq%1
|
||||
align 8
|
||||
align 16
|
||||
irq%1:
|
||||
push byte 0 ; pseudo error code
|
||||
push byte 32+%1
|
||||
|
@ -487,35 +487,35 @@ isrstub_pseudo_error 9
|
|||
%endrep
|
||||
|
||||
global apic_timer
|
||||
align 8
|
||||
align 16
|
||||
apic_timer:
|
||||
push byte 0 ; pseudo error code
|
||||
push byte 123
|
||||
jmp common_stub
|
||||
|
||||
global apic_lint0
|
||||
align 8
|
||||
align 16
|
||||
apic_lint0:
|
||||
push byte 0 ; pseudo error code
|
||||
push byte 124
|
||||
jmp common_stub
|
||||
|
||||
global apic_lint1
|
||||
align 8
|
||||
align 16
|
||||
apic_lint1:
|
||||
push byte 0 ; pseudo error code
|
||||
push byte 125
|
||||
jmp common_stub
|
||||
|
||||
global apic_error
|
||||
align 8
|
||||
align 16
|
||||
apic_error:
|
||||
push byte 0 ; pseudo error code
|
||||
push byte 126
|
||||
jmp common_stub
|
||||
|
||||
global apic_svr
|
||||
align 8
|
||||
align 16
|
||||
apic_svr:
|
||||
push byte 0 ; pseudo error code
|
||||
push byte 127
|
||||
|
@ -528,7 +528,7 @@ extern syscall_handler
|
|||
extern kernel_stack
|
||||
|
||||
global isrsyscall
|
||||
align 8
|
||||
align 16
|
||||
; used to realize system calls
|
||||
isrsyscall:
|
||||
; IF flag is already cleared
|
||||
|
@ -586,7 +586,7 @@ isrsyscall:
|
|||
o64 sysret
|
||||
|
||||
global switch_context
|
||||
align 8
|
||||
align 16
|
||||
switch_context:
|
||||
; create on the stack a pseudo interrupt
|
||||
; afterwards, we switch to the task with iret
|
||||
|
@ -618,11 +618,11 @@ switch_context:
|
|||
|
||||
jmp common_switch
|
||||
|
||||
align 8
|
||||
align 16
|
||||
rollback:
|
||||
ret
|
||||
|
||||
align 8
|
||||
align 16
|
||||
common_stub:
|
||||
; do we interrupt user-level code?
|
||||
cmp QWORD [rsp+24], 0x08
|
||||
|
@ -695,7 +695,7 @@ kernel_space2:
|
|||
SECTION .data
|
||||
|
||||
global mb_info:
|
||||
align 8
|
||||
align 16
|
||||
mb_info:
|
||||
DQ 0
|
||||
|
||||
|
|
|
@ -114,11 +114,11 @@ static void restore_fpu_state_xsave(union fpu_state* state)
|
|||
|
||||
static void fpu_init_xsave(union fpu_state* fpu)
|
||||
{
|
||||
i387_fsave_t* fp = &fpu->fsave;
|
||||
xsave_t* xs = &fpu->xsave;
|
||||
|
||||
memset(xs, 0x00, sizeof(xsave_t));
|
||||
fp->twd = 0xffffu;
|
||||
//xs->fxsave.twd = 0xffffu;
|
||||
xs->fxsave.mxcsr = 0x1f80;
|
||||
}
|
||||
|
||||
uint32_t detect_cpu_frequency(void)
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include <asm/page.h>
|
||||
#include <asm/tss.h>
|
||||
|
||||
extern tss_t task_state_segments[MAX_CORES] __attribute__ ((aligned (PAGE_SIZE)));
|
||||
extern tss_t task_state_segments[MAX_CORES];
|
||||
|
||||
size_t* get_current_stack(void)
|
||||
{
|
||||
|
|
|
@ -17,8 +17,8 @@ ifeq ($V,0)
|
|||
endif
|
||||
|
||||
default: $(ARCH)
|
||||
$Q$(MAKE) ARCH=$(ARCH) TARGET=$(TARGET) CFLAGS+="-ffreestanding -O3 -Wall -I$(NEWLIB)/include -I../../include -I../../arch/$(ARCH)/include" LDFLAGS+="-nostdlib -L$(NEWLIB)/lib" -C examples depend
|
||||
$Q$(MAKE) ARCH=$(ARCH) TARGET=$(TARGET) CFLAGS+="-ffreestanding -O3 -Wall -I$(NEWLIB)/include -I../../include -I../../arch/$(ARCH)/include" LDFLAGS+="-nostdlib -L$(NEWLIB)/lib" -C examples
|
||||
$Q$(MAKE) ARCH=$(ARCH) TARGET=$(TARGET) CFLAGS+="-DSTREAM_ARRAY_SIZE=100000 -ffreestanding -O3 -Wall -I$(NEWLIB)/include -I../../include -I../../arch/$(ARCH)/include" LDFLAGS+="-nostdlib -L$(NEWLIB)/lib" -C examples depend
|
||||
$Q$(MAKE) ARCH=$(ARCH) TARGET=$(TARGET) CFLAGS+="-DSTREAM_ARRAY_SIZE=100000 -ffreestanding -O3 -Wall -I$(NEWLIB)/include -I../../include -I../../arch/$(ARCH)/include" LDFLAGS+="-nostdlib -L$(NEWLIB)/lib" -C examples
|
||||
|
||||
$(ARCH):
|
||||
@echo Build newlib
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <errno.h>
|
||||
|
||||
#define MATRIX_SIZE 128
|
||||
#define MAXVALUE 1337
|
||||
#define MAXVALUE 17
|
||||
#define PAGE_SIZE 4096
|
||||
#define CACHE_SIZE (256*1024)
|
||||
#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
|
||||
|
|
Loading…
Add table
Reference in a new issue