Skip to content

Commit

Permalink
[Kernel] Enable SSE in AP bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
codyd51 committed Jan 24, 2023
1 parent 1acab66 commit 90ce1c1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ap_bootstrap.s.x86_64.arch_specific
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,23 @@ ap_entry:
mov ax, 0x2b
ltr ax

; Enable SSE
mov rax, cr0
; Disable FPU emulation by clearing the EM bit
and ax, 0xFFFB
; Enable coprocessor monitoring by setting the MP bit
; AMD SDM §3.1.1:
; > Software typically should set MP to 1 if the processor implementation supports x87 instructions.
or ax, 0x2
mov cr0, rax
; Inform the CPU that we can handle SIMD floating point exceptions by setting the OSXMMEXCPT enable bit
mov rax, cr4
or ax, 1 << 10
mov cr4, rax
; Finally, set the OSFXSR bit which will enable SSE
or ax, 1 << 9
mov cr4, rax

; Jump to the C entry point
; Load the entry point (and double-dereference the parameter that was passed in by the BSP)
xor rax, rax
Expand Down

0 comments on commit 90ce1c1

Please sign in to comment.