os-k/kaleid/kernel/ke/cpuf.asm

52 lines
2.3 KiB
NASM
Raw Normal View History

2019-05-08 17:49:30 +02:00
;=----------------------------------------------------------------------------=;
2020-09-27 17:33:48 +02:00
; OS on Kaleid ;
2019-05-08 17:49:30 +02:00
; ;
; Desc: CPU management related functions ;
; ;
; ;
2021-02-18 19:54:35 +01:00
; Copyright © 2018-2021 The OS/K Team ;
2019-05-08 17:49:30 +02:00
; ;
; This file is part of OS/K. ;
; ;
; OS/K is free software: you can redistribute it and/or modify ;
; it under the terms of the GNU General Public License as published by ;
; the Free Software Foundation, either version 3 of the License, or ;
; (at your option) any later version. ;
; ;
; OS/K is distributed in the hope that it will be useful, ;
; but WITHOUT ANY WARRANTY; without even the implied warranty of ;
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;
; GNU General Public License for more details. ;
; ;
; You should have received a copy of the GNU General Public License ;
; along with OS/K. If not, see <https://www.gnu.org/licenses/>. ;
;=----------------------------------------------------------------------------=;
2019-05-09 10:18:33 +02:00
2019-05-13 18:07:45 +02:00
[BITS 64]
2019-05-18 00:03:35 +02:00
global divideByZero
2019-05-22 23:32:44 +02:00
global KeActivateSSE
2019-05-18 00:03:35 +02:00
2019-05-14 13:17:24 +02:00
%include "kaleid/kernel/ke/cpuf.inc"
2019-05-09 10:52:36 +02:00
2019-05-18 00:03:35 +02:00
;;
;; Bug test
;;
divideByZero:
ret
2019-05-22 23:32:44 +02:00
;;
;; Activating SSE
;;
KeActivateSSE:
push 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 at the same time
mov cr4, rax
pop rax
ret