[KERNEL] Use PAT if supported. Otherwise MTRR

git-svn-id: svn://kolibrios.org@9950 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat 2023-12-26 18:33:21 +00:00
parent b9d43b416f
commit bbee219bab
3 changed files with 18 additions and 18 deletions

View File

@ -7,12 +7,22 @@
$Revision$
; Initializes MTRRs.
proc init_mtrr
; Initializes PAT (Page Attribute Table) and MTRRs.
proc init_pat_mtrr
cmp [BOOT.mtrr], byte 2
je .exit
bt [cpu_caps], CAPS_PAT ; if PAT is not supported, use MTRR
jnc .use_mtrr
; Change PAT_MSR for write combining memory.
mov ecx, MSR_CR_PAT
mov eax, PAT_VALUE ; UC UCM WC WB
mov edx, eax
wrmsr
ret
.use_mtrr:
bt [cpu_caps], CAPS_MTRR
jnc .exit
@ -739,17 +749,7 @@ end virtual
jmp @b
@@:
; 9i. Check PAT support and reprogram PAT_MASR for write combining memory
bt [cpu_caps], CAPS_PAT
jnc @F
mov ecx, MSR_CR_PAT
mov eax, PAT_VALUE ;UC UCM WC WB
mov edx, eax
wrmsr
@@:
; 9j. Changes are done.
; 9i. Changes are done.
call mtrr_end_change
.abort:

View File

@ -18,12 +18,12 @@ entry start
MAX_VARIABLE_MTRR = 10
start:
; Copy test inputs, run init_mtrr, compare with test outputs. Repeat.
; Copy test inputs, run init_pat_mtrr, compare with test outputs. Repeat.
mov esi, test1_in_data
mov edi, mtrrdata
mov ecx, mtrrdata_size / 4
rep movsd
call init_mtrr
call init_pat_mtrr
mov esi, test1_out_data
mov edi, mtrrdata
mov ecx, mtrrdata_size / 4
@ -33,7 +33,7 @@ start:
mov edi, mtrrdata
mov ecx, mtrrdata_size / 4
rep movsd
call init_mtrr
call init_pat_mtrr
mov esi, test2_out_data
mov edi, mtrrdata
mov ecx, mtrrdata_size / 4

View File

@ -436,7 +436,7 @@ high_code:
list_init eax
call init_video
call init_mtrr
call init_pat_mtrr
mov [LFBAddress], LFB_BASE
mov ecx, bios_fb
call set_framebuffer