forked from KolibriOS/kolibrios
kernel: validate PTE bits before mapping
git-svn-id: svn://kolibrios.org@5357 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
b4814c7084
commit
82d7c79bd5
@ -126,9 +126,9 @@ align 4
|
|||||||
;proc map_page stdcall,lin_addr:dword,phis_addr:dword,flags:dword
|
;proc map_page stdcall,lin_addr:dword,phis_addr:dword,flags:dword
|
||||||
map_page:
|
map_page:
|
||||||
push ebx
|
push ebx
|
||||||
mov eax, [esp+12] ; phis_addr
|
mov eax, [esp+12] ; phis_addr
|
||||||
and eax, not 0xFFF
|
|
||||||
or eax, [esp+16] ; flags
|
or eax, [esp+16] ; flags
|
||||||
|
and eax, [pte_valid_mask]
|
||||||
mov ebx, [esp+8] ; lin_addr
|
mov ebx, [esp+8] ; lin_addr
|
||||||
shr ebx, 12
|
shr ebx, 12
|
||||||
mov [page_tabs+ebx*4], eax
|
mov [page_tabs+ebx*4], eax
|
||||||
@ -191,8 +191,8 @@ proc map_io_mem stdcall, base:dword, size:dword, flags:dword
|
|||||||
mov edx, [base]
|
mov edx, [base]
|
||||||
shr eax, 12
|
shr eax, 12
|
||||||
shr ecx, 12
|
shr ecx, 12
|
||||||
and edx, -4096
|
|
||||||
or edx, [flags]
|
or edx, [flags]
|
||||||
|
and edx, [pte_valid_mask]
|
||||||
@@:
|
@@:
|
||||||
mov [page_tabs+eax*4], edx
|
mov [page_tabs+eax*4], edx
|
||||||
invlpg [ebx]
|
invlpg [ebx]
|
||||||
@ -229,6 +229,7 @@ commit_pages:
|
|||||||
pop ecx
|
pop ecx
|
||||||
pop eax
|
pop eax
|
||||||
|
|
||||||
|
and eax, [pte_valid_mask ]
|
||||||
mov edi, ebx
|
mov edi, ebx
|
||||||
shr edi, 12
|
shr edi, 12
|
||||||
lea edi, [page_tabs+edi*4]
|
lea edi, [page_tabs+edi*4]
|
||||||
|
Loading…
Reference in New Issue
Block a user