mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-09 12:31:06 -04:00
Activate SSE support
This commit is contained in:
parent
22efab8644
commit
ab5369b15a
@ -5,7 +5,7 @@ AS=x86_64-elf-as
|
||||
|
||||
THOR_FLAGS=-DCONFIG_HISTORY=y
|
||||
WARNING_FLAGS=-Wall -Wextra -pedantic -Wold-style-cast -Wshadow
|
||||
CPP_FLAGS=-masm=intel -Iinclude/ -nostdlib -Os -std=c++11 -fno-exceptions -fno-rtti -ffreestanding -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow $(WARNING_FLAGS)
|
||||
CPP_FLAGS=-masm=intel -Iinclude/ -nostdlib -Os -std=c++11 -fno-exceptions -fno-rtti -ffreestanding -mno-red-zone -mno-3dnow -mno-mmx -mno-sse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2 $(WARNING_FLAGS)
|
||||
KERNEL_FLAGS=$(CPP_FLAGS) $(THOR_FLAGS)
|
||||
KERNEL_LINK_FLAGS=-lgcc -T linker.ld $(CPP_FLAGS)
|
||||
|
||||
|
@ -172,12 +172,37 @@ lm_start:
|
||||
; Install custom syscalls
|
||||
call install_syscalls
|
||||
|
||||
call enable_sse
|
||||
|
||||
sti
|
||||
|
||||
call 0x5000
|
||||
|
||||
jmp $
|
||||
|
||||
; Functions
|
||||
|
||||
enable_sse:
|
||||
; Test if SSE is supported by the processor
|
||||
mov eax, 0x1
|
||||
cpuid
|
||||
test edx, 1<<25
|
||||
jz .no_sse
|
||||
|
||||
; Enable SSE support
|
||||
xor rax, rax
|
||||
mov rax, cr0
|
||||
and ax, 0xFFFB ;clear coprocessor emulation CR0.EM
|
||||
or ax, 0x2 ;set coprocessor monitoring CR0.MP
|
||||
mov cr0, rax
|
||||
mov rax, cr4
|
||||
or ax, 3 << 9 ;set CR4.OSFXSR and CR4.OSXMMEXCPT
|
||||
mov cr4, rax
|
||||
|
||||
.no_sse:
|
||||
|
||||
ret
|
||||
|
||||
; Includes
|
||||
|
||||
%include "utils/macros.asm"
|
||||
|
Loading…
x
Reference in New Issue
Block a user