Activate SSE support

This commit is contained in:
Baptiste Wicht 2013-12-09 18:14:10 +01:00
parent 22efab8644
commit ab5369b15a
2 changed files with 26 additions and 1 deletions

View File

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

View File

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