forked from KolibriOS/kolibrios
kernel: update PTE bits
git-svn-id: svn://kolibrios.org@5356 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
01e7a24fe6
commit
b4814c7084
@ -271,17 +271,22 @@ REG_RET equ (RING0_STACK_SIZE-56) ;irq0.return
|
|||||||
PAGE_SIZE equ 4096
|
PAGE_SIZE equ 4096
|
||||||
|
|
||||||
PG_UNMAP equ 0x000
|
PG_UNMAP equ 0x000
|
||||||
PG_MAP equ 0x001
|
PG_READ equ 0x001
|
||||||
PG_WRITE equ 0x002
|
PG_WRITE equ 0x002
|
||||||
PG_SW equ 0x003
|
PG_USER equ 0x004
|
||||||
PG_USER equ 0x005
|
PG_PCD equ 0x008
|
||||||
PG_UW equ 0x007
|
PG_PWT equ 0x010
|
||||||
PG_NOCACHE equ 0x018
|
|
||||||
PG_LARGE equ 0x080
|
|
||||||
PG_GLOBAL equ 0x100
|
|
||||||
|
|
||||||
|
PG_GLOBAL equ 0x100
|
||||||
PG_SHARED equ 0x200
|
PG_SHARED equ 0x200
|
||||||
|
|
||||||
|
PG_SWR equ 0x003 ; (PG_WRITE+PG_READ)
|
||||||
|
PG_UR equ 0x005 ; (PG_USER+PG_READ)
|
||||||
|
PG_UWR equ 0x007 ; (PG_USER+PG_WRITE+PG_READ)
|
||||||
|
PG_NOCACHE equ 0x018 ; (PG_PCD+PG_PWT)
|
||||||
|
|
||||||
|
PDE_LARGE equ 0x080
|
||||||
|
|
||||||
;;;;;;;;;;;boot time variables
|
;;;;;;;;;;;boot time variables
|
||||||
|
|
||||||
BOOT_BPP equ 0x9000 ;byte bits per pixel
|
BOOT_BPP equ 0x9000 ;byte bits per pixel
|
||||||
|
@ -63,7 +63,7 @@ APIC_init:
|
|||||||
call IRQ_mask_all
|
call IRQ_mask_all
|
||||||
|
|
||||||
; IOAPIC init
|
; IOAPIC init
|
||||||
stdcall map_io_mem, [acpi_ioapic_base], 0x20, PG_SW+PG_NOCACHE
|
stdcall map_io_mem, [acpi_ioapic_base], 0x20, PG_SWR+PG_NOCACHE
|
||||||
mov [IOAPIC_base], eax
|
mov [IOAPIC_base], eax
|
||||||
|
|
||||||
mov eax, IOAPIC_VER
|
mov eax, IOAPIC_VER
|
||||||
@ -127,7 +127,7 @@ LAPIC_init:
|
|||||||
cmp [LAPIC_BASE], 0
|
cmp [LAPIC_BASE], 0
|
||||||
jne .done
|
jne .done
|
||||||
|
|
||||||
stdcall map_io_mem, [acpi_lapic_base], 0x1000, PG_SW+PG_NOCACHE
|
stdcall map_io_mem, [acpi_lapic_base], 0x1000, PG_SWR+PG_NOCACHE
|
||||||
mov [LAPIC_BASE], eax
|
mov [LAPIC_BASE], eax
|
||||||
mov esi, eax
|
mov esi, eax
|
||||||
|
|
||||||
|
@ -603,7 +603,7 @@ proc load_file_umode stdcall, file_name:dword
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .err_3
|
jz .err_3
|
||||||
|
|
||||||
or eax, PG_UW
|
or eax, PG_UWR
|
||||||
stosd
|
stosd
|
||||||
dec edx
|
dec edx
|
||||||
jnz @B
|
jnz @B
|
||||||
@ -665,7 +665,7 @@ proc load_file_umode stdcall, file_name:dword
|
|||||||
@@:
|
@@:
|
||||||
lodsd
|
lodsd
|
||||||
and eax, 0xFFFFF000
|
and eax, 0xFFFFF000
|
||||||
or eax, PG_UW
|
or eax, PG_UWR
|
||||||
stosd
|
stosd
|
||||||
loop @B
|
loop @B
|
||||||
|
|
||||||
@ -1230,7 +1230,7 @@ proc load_library stdcall, file_name:dword
|
|||||||
.map_pages_loop:
|
.map_pages_loop:
|
||||||
mov eax, [page_tabs+ecx*4]
|
mov eax, [page_tabs+ecx*4]
|
||||||
and eax, not 0xFFF
|
and eax, not 0xFFF
|
||||||
or al, PG_USER
|
or al, PG_UR
|
||||||
xchg eax, [page_tabs+edx*4]
|
xchg eax, [page_tabs+edx*4]
|
||||||
test al, 1
|
test al, 1
|
||||||
jz @f
|
jz @f
|
||||||
|
@ -130,7 +130,7 @@ proc init_kernel_heap
|
|||||||
|
|
||||||
stdcall alloc_pages, dword 32
|
stdcall alloc_pages, dword 32
|
||||||
|
|
||||||
or eax, PG_SW
|
or eax, PG_SWR
|
||||||
mov ebx, HEAP_BASE
|
mov ebx, HEAP_BASE
|
||||||
mov ecx, 32
|
mov ecx, 32
|
||||||
call commit_pages
|
call commit_pages
|
||||||
@ -492,7 +492,7 @@ proc kernel_alloc stdcall, size:dword
|
|||||||
jz .err
|
jz .err
|
||||||
|
|
||||||
mov ecx, ebx
|
mov ecx, ebx
|
||||||
or eax, PG_SW
|
or eax, PG_SWR
|
||||||
mov ebx, [lin_addr]
|
mov ebx, [lin_addr]
|
||||||
call commit_pages
|
call commit_pages
|
||||||
|
|
||||||
@ -506,7 +506,7 @@ proc kernel_alloc stdcall, size:dword
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .err
|
jz .err
|
||||||
|
|
||||||
stdcall map_page, edx, eax, dword PG_SW
|
stdcall map_page, edx, eax, dword PG_SWR
|
||||||
add edx, 0x1000
|
add edx, 0x1000
|
||||||
dec ebx
|
dec ebx
|
||||||
jnz @B
|
jnz @B
|
||||||
@ -1451,7 +1451,7 @@ align 4
|
|||||||
mov edx, [access]
|
mov edx, [access]
|
||||||
or edx, [owner_access]
|
or edx, [owner_access]
|
||||||
shl edx, 1
|
shl edx, 1
|
||||||
or edx, PG_USER+PG_SHARED
|
or edx, PG_SHARED+PG_UR
|
||||||
@@:
|
@@:
|
||||||
lodsd
|
lodsd
|
||||||
and eax, 0xFFFFF000
|
and eax, 0xFFFFF000
|
||||||
|
@ -340,7 +340,7 @@ proc map_page_table stdcall, lin_addr:dword, phis_addr:dword
|
|||||||
shr ebx, 22
|
shr ebx, 22
|
||||||
mov eax, [phis_addr]
|
mov eax, [phis_addr]
|
||||||
and eax, not 0xFFF
|
and eax, not 0xFFF
|
||||||
or eax, PG_UW ;+PG_NOCACHE
|
or eax, PG_READ
|
||||||
mov dword [master_tab+ebx*4], eax
|
mov dword [master_tab+ebx*4], eax
|
||||||
mov eax, [lin_addr]
|
mov eax, [lin_addr]
|
||||||
shr eax, 10
|
shr eax, 10
|
||||||
@ -420,7 +420,7 @@ proc init_LFB
|
|||||||
call alloc_page
|
call alloc_page
|
||||||
stdcall map_page_table, LFB_BASE, eax
|
stdcall map_page_table, LFB_BASE, eax
|
||||||
pop eax
|
pop eax
|
||||||
or eax, PG_UW
|
or eax, PG_UWR
|
||||||
mov ebx, LFB_BASE
|
mov ebx, LFB_BASE
|
||||||
; max VGA=640*480*4=1228800 bytes
|
; max VGA=640*480*4=1228800 bytes
|
||||||
; + 32*640*4=81920 bytes for mouse pointer
|
; + 32*640*4=81920 bytes for mouse pointer
|
||||||
@ -447,7 +447,7 @@ proc init_LFB
|
|||||||
|
|
||||||
bt [cpu_caps], CAPS_PSE
|
bt [cpu_caps], CAPS_PSE
|
||||||
jnc .map_page_tables
|
jnc .map_page_tables
|
||||||
or esi, PG_LARGE+PG_UW
|
or esi, PDE_LARGE+PG_UWR
|
||||||
mov edx, sys_proc+PROC.pdt_0+(LFB_BASE shr 20)
|
mov edx, sys_proc+PROC.pdt_0+(LFB_BASE shr 20)
|
||||||
@@:
|
@@:
|
||||||
mov [edx], esi
|
mov [edx], esi
|
||||||
@ -476,7 +476,7 @@ proc init_LFB
|
|||||||
|
|
||||||
mov eax, [LFBAddress]
|
mov eax, [LFBAddress]
|
||||||
mov edi, page_tabs + (LFB_BASE shr 10)
|
mov edi, page_tabs + (LFB_BASE shr 10)
|
||||||
or eax, PG_UW
|
or eax, PG_UWR
|
||||||
mov ecx, [pg_count]
|
mov ecx, [pg_count]
|
||||||
cld
|
cld
|
||||||
@@:
|
@@:
|
||||||
@ -679,7 +679,7 @@ end if
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.user_space:
|
.user_space:
|
||||||
test eax, PG_MAP
|
test eax, PG_READ
|
||||||
jnz .err_access ;Страница присутствует
|
jnz .err_access ;Страница присутствует
|
||||||
;Ошибка доступа ?
|
;Ошибка доступа ?
|
||||||
|
|
||||||
@ -687,7 +687,7 @@ end if
|
|||||||
mov ecx, ebx
|
mov ecx, ebx
|
||||||
shr ecx, 10
|
shr ecx, 10
|
||||||
mov edx, [master_tab+ecx*4]
|
mov edx, [master_tab+ecx*4]
|
||||||
test edx, PG_MAP
|
test edx, PG_READ
|
||||||
jz .fail ;таблица страниц не создана
|
jz .fail ;таблица страниц не создана
|
||||||
;неверный адрес в программе
|
;неверный адрес в программе
|
||||||
|
|
||||||
@ -700,7 +700,7 @@ end if
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
|
|
||||||
stdcall map_page, [.err_addr], eax, PG_UW
|
stdcall map_page, [.err_addr], eax, PG_UWR
|
||||||
|
|
||||||
mov edi, [.err_addr]
|
mov edi, [.err_addr]
|
||||||
and edi, 0xFFFFF000
|
and edi, 0xFFFFF000
|
||||||
@ -737,7 +737,7 @@ end if
|
|||||||
call alloc_page
|
call alloc_page
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
stdcall map_page, ebx, eax, PG_UW
|
stdcall map_page, ebx, eax, PG_UWR
|
||||||
mov edi, ebx
|
mov edi, ebx
|
||||||
mov ecx, 1024
|
mov ecx, 1024
|
||||||
sub ebx, [esi+HDLL.base]
|
sub ebx, [esi+HDLL.base]
|
||||||
@ -748,7 +748,7 @@ end if
|
|||||||
jmp .exit
|
jmp .exit
|
||||||
|
|
||||||
.kernel_space:
|
.kernel_space:
|
||||||
test eax, PG_MAP
|
test eax, PG_READ
|
||||||
jz .fail ;страница не присутствует
|
jz .fail ;страница не присутствует
|
||||||
|
|
||||||
test eax, 12 ;U/S (+below)
|
test eax, 12 ;U/S (+below)
|
||||||
@ -774,7 +774,7 @@ end if
|
|||||||
jz .fail
|
jz .fail
|
||||||
|
|
||||||
push eax
|
push eax
|
||||||
stdcall map_page, [.err_addr], eax, dword PG_SW
|
stdcall map_page, [.err_addr], eax, dword PG_SWR
|
||||||
pop eax
|
pop eax
|
||||||
mov edi, [.err_addr]
|
mov edi, [.err_addr]
|
||||||
and edi, -4096
|
and edi, -4096
|
||||||
@ -783,7 +783,7 @@ end if
|
|||||||
mov ebx, esi
|
mov ebx, esi
|
||||||
shr ebx, 12
|
shr ebx, 12
|
||||||
mov edx, [current_slot]
|
mov edx, [current_slot]
|
||||||
or eax, PG_SW
|
or eax, PG_SWR
|
||||||
mov [edx+APPDATA.io_map+ebx*4], eax
|
mov [edx+APPDATA.io_map+ebx*4], eax
|
||||||
|
|
||||||
add esi, [default_io_map]
|
add esi, [default_io_map]
|
||||||
@ -818,7 +818,7 @@ proc map_mem_ipc stdcall, lin_addr:dword,slot:dword,\
|
|||||||
mov esi, [ipc_ptab]
|
mov esi, [ipc_ptab]
|
||||||
and eax, 0xFFFFF000
|
and eax, 0xFFFFF000
|
||||||
jz .exit
|
jz .exit
|
||||||
stdcall map_page, esi, eax, PG_SW
|
stdcall map_page, esi, eax, PG_SWR
|
||||||
@@:
|
@@:
|
||||||
mov edi, [lin_addr]
|
mov edi, [lin_addr]
|
||||||
and edi, 0xFFFFF000
|
and edi, 0xFFFFF000
|
||||||
@ -849,7 +849,7 @@ proc map_mem_ipc stdcall, lin_addr:dword,slot:dword,\
|
|||||||
and eax, 0xFFFFF000
|
and eax, 0xFFFFF000
|
||||||
jz .exit
|
jz .exit
|
||||||
|
|
||||||
stdcall map_page, esi, eax, PG_SW
|
stdcall map_page, esi, eax, PG_SWR
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
jmp .map
|
jmp .map
|
||||||
.exit:
|
.exit:
|
||||||
@ -881,7 +881,7 @@ proc map_memEx stdcall, lin_addr:dword,slot:dword,\
|
|||||||
mov esi, [proc_mem_tab]
|
mov esi, [proc_mem_tab]
|
||||||
and eax, 0xFFFFF000
|
and eax, 0xFFFFF000
|
||||||
jz .exit
|
jz .exit
|
||||||
stdcall map_page, esi, eax, PG_SW
|
stdcall map_page, esi, eax, PG_SWR
|
||||||
@@:
|
@@:
|
||||||
mov edi, [lin_addr]
|
mov edi, [lin_addr]
|
||||||
and edi, 0xFFFFF000
|
and edi, 0xFFFFF000
|
||||||
@ -912,7 +912,7 @@ proc map_memEx stdcall, lin_addr:dword,slot:dword,\
|
|||||||
and eax, 0xFFFFF000
|
and eax, 0xFFFFF000
|
||||||
jz .exit
|
jz .exit
|
||||||
|
|
||||||
stdcall map_page, esi, eax, PG_SW
|
stdcall map_page, esi, eax, PG_SWR
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
jmp .map
|
jmp .map
|
||||||
.exit:
|
.exit:
|
||||||
@ -927,7 +927,7 @@ endp
|
|||||||
; destroys: only eax
|
; destroys: only eax
|
||||||
proc safe_map_page stdcall, slot:dword, req_access:dword, ofs:dword
|
proc safe_map_page stdcall, slot:dword, req_access:dword, ofs:dword
|
||||||
mov eax, [esi+edx*4]
|
mov eax, [esi+edx*4]
|
||||||
test al, PG_MAP
|
test al, PG_READ
|
||||||
jz .not_present
|
jz .not_present
|
||||||
test al, PG_WRITE
|
test al, PG_WRITE
|
||||||
jz .resolve_readonly
|
jz .resolve_readonly
|
||||||
@ -947,7 +947,7 @@ proc safe_map_page stdcall, slot:dword, req_access:dword, ofs:dword
|
|||||||
pop ecx
|
pop ecx
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
or al, PG_UW
|
or al, PG_UWR
|
||||||
mov [esi+edx*4], eax
|
mov [esi+edx*4], eax
|
||||||
jmp .map
|
jmp .map
|
||||||
.resolve_readonly:
|
.resolve_readonly:
|
||||||
@ -989,7 +989,7 @@ proc safe_map_page stdcall, slot:dword, req_access:dword, ofs:dword
|
|||||||
call alloc_page
|
call alloc_page
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .no_hdll
|
jz .no_hdll
|
||||||
or al, PG_UW
|
or al, PG_UWR
|
||||||
mov [esi+edx*4], eax
|
mov [esi+edx*4], eax
|
||||||
stdcall map_page, edi, eax, [req_access]
|
stdcall map_page, edi, eax, [req_access]
|
||||||
push esi edi
|
push esi edi
|
||||||
@ -1090,7 +1090,7 @@ proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
|
|||||||
@@:
|
@@:
|
||||||
mov [used_buf], ecx
|
mov [used_buf], ecx
|
||||||
stdcall map_mem_ipc, ecx, [dst_slot], \
|
stdcall map_mem_ipc, ecx, [dst_slot], \
|
||||||
edi, esi, PG_SW
|
edi, esi, PG_SWR
|
||||||
|
|
||||||
mov edi, [dst_offset]
|
mov edi, [dst_offset]
|
||||||
add edi, [used_buf]
|
add edi, [used_buf]
|
||||||
|
@ -848,7 +848,7 @@ proc mtrr_validate
|
|||||||
; LFB is mapped to virtual address LFB_BASE,
|
; LFB is mapped to virtual address LFB_BASE,
|
||||||
; it uses global pages if supported by CPU.
|
; it uses global pages if supported by CPU.
|
||||||
mov ebx, [sys_proc+PROC.pdt_0+(LFB_BASE shr 20)]
|
mov ebx, [sys_proc+PROC.pdt_0+(LFB_BASE shr 20)]
|
||||||
test ebx, PG_LARGE
|
test ebx, PDE_LARGE
|
||||||
jnz @f
|
jnz @f
|
||||||
mov ebx, [page_tabs+(LFB_BASE shr 10)]
|
mov ebx, [page_tabs+(LFB_BASE shr 10)]
|
||||||
@@:
|
@@:
|
||||||
|
@ -263,7 +263,7 @@ show_error_parameters:
|
|||||||
call .check_ESP
|
call .check_ESP
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .error_ESP
|
jnz .error_ESP
|
||||||
DEBUGF 1, " [ESP+08]: %x\n",[ebx]
|
DEBUGF 1, " [ESP+08]: %x\n",[ebx]
|
||||||
add ebx, 4
|
add ebx, 4
|
||||||
call .check_ESP
|
call .check_ESP
|
||||||
test eax, eax
|
test eax, eax
|
||||||
@ -293,7 +293,7 @@ show_error_parameters:
|
|||||||
call .check_ESP
|
call .check_ESP
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .error_ESP
|
jnz .error_ESP
|
||||||
DEBUGF 1, " [ESP+32]: %x\n",[ebx]
|
DEBUGF 1, " [ESP+32]: %x\n",[ebx]
|
||||||
pop edx ecx ebx eax
|
pop edx ecx ebx eax
|
||||||
ret
|
ret
|
||||||
.error_ESP:
|
.error_ESP:
|
||||||
@ -308,18 +308,18 @@ show_error_parameters:
|
|||||||
mov ecx, ebx
|
mov ecx, ebx
|
||||||
shr ecx, 10
|
shr ecx, 10
|
||||||
mov edx, [master_tab+ecx*4]
|
mov edx, [master_tab+ecx*4]
|
||||||
test edx, PG_MAP
|
test edx, PG_READ
|
||||||
jz .fail ;page table is not created
|
jz .fail ;page table is not created
|
||||||
;incorrect address in the program
|
;incorrect address in the program
|
||||||
|
|
||||||
mov eax, [page_tabs+ebx*4]
|
mov eax, [page_tabs+ebx*4]
|
||||||
test eax, 2
|
test eax, 2
|
||||||
jz .fail ;address not reserved for use. error
|
jz .fail ;address not reserved for use. error
|
||||||
|
|
||||||
pop ebx
|
pop ebx
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
pop ebx
|
pop ebx
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
|
@ -503,7 +503,7 @@ proc create_process stdcall, app_size:dword,img_base:dword,img_size:dword
|
|||||||
rep movsd
|
rep movsd
|
||||||
|
|
||||||
mov eax, [edi-8192+PROC.pdt_0_phys]
|
mov eax, [edi-8192+PROC.pdt_0_phys]
|
||||||
or eax, PG_SW
|
or eax, PG_SWR
|
||||||
mov [edi-4096+(page_tabs shr 20)], eax
|
mov [edi-4096+(page_tabs shr 20)], eax
|
||||||
|
|
||||||
lea eax, [edi-8192]
|
lea eax, [edi-8192]
|
||||||
@ -529,7 +529,7 @@ proc create_process stdcall, app_size:dword,img_base:dword,img_size:dword
|
|||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
mov ecx, [img_pages]
|
mov ecx, [img_pages]
|
||||||
mov ebx, PG_UW
|
mov ebx, PG_UWR
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
mov esi, [img_base]
|
mov esi, [img_base]
|
||||||
shr esi, 10
|
shr esi, 10
|
||||||
@ -554,7 +554,7 @@ proc create_process stdcall, app_size:dword,img_base:dword,img_size:dword
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
|
|
||||||
stdcall map_page, edx, eax, dword PG_UW
|
stdcall map_page, edx, eax, dword PG_UWR
|
||||||
add edx, 0x1000
|
add edx, 0x1000
|
||||||
dec [app_pages]
|
dec [app_pages]
|
||||||
jnz .alloc
|
jnz .alloc
|
||||||
@ -643,7 +643,7 @@ align 4
|
|||||||
test eax, 1
|
test eax, 1
|
||||||
jz .next
|
jz .next
|
||||||
and eax, not 0xFFF
|
and eax, not 0xFFF
|
||||||
stdcall map_page, [tmp_task_ptab], eax, PG_SW
|
stdcall map_page, [tmp_task_ptab], eax, PG_SWR
|
||||||
stdcall destroy_page_table, [tmp_task_ptab]
|
stdcall destroy_page_table, [tmp_task_ptab]
|
||||||
mov eax, [esi]
|
mov eax, [esi]
|
||||||
call free_page
|
call free_page
|
||||||
@ -788,7 +788,7 @@ proc read_process_memory
|
|||||||
|
|
||||||
push ecx
|
push ecx
|
||||||
stdcall map_memEx, [proc_mem_map], \
|
stdcall map_memEx, [proc_mem_map], \
|
||||||
[slot], ebx, ecx, PG_MAP
|
[slot], ebx, ecx, PG_READ
|
||||||
pop ecx
|
pop ecx
|
||||||
|
|
||||||
mov esi, [offset]
|
mov esi, [offset]
|
||||||
@ -859,7 +859,7 @@ proc write_process_memory
|
|||||||
; add ebx, new_app_base
|
; add ebx, new_app_base
|
||||||
push ecx
|
push ecx
|
||||||
stdcall map_memEx, [proc_mem_map], \
|
stdcall map_memEx, [proc_mem_map], \
|
||||||
[slot], ebx, ecx, PG_SW
|
[slot], ebx, ecx, PG_SWR
|
||||||
pop ecx
|
pop ecx
|
||||||
|
|
||||||
mov edi, [offset]
|
mov edi, [offset]
|
||||||
|
@ -78,7 +78,7 @@ v86_create:
|
|||||||
; (I have seen one computer with EBDA segment = 0x9D80,
|
; (I have seen one computer with EBDA segment = 0x9D80,
|
||||||
; all other computers use less memory)
|
; all other computers use less memory)
|
||||||
|
|
||||||
mov eax, PG_UW
|
mov eax, PG_UWR
|
||||||
mov [page_tabs], eax
|
mov [page_tabs], eax
|
||||||
invlpg [eax]
|
invlpg [eax]
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ v86_create:
|
|||||||
mov byte [0x504], 0x10
|
mov byte [0x504], 0x10
|
||||||
mov byte [0x505], 0xF4
|
mov byte [0x505], 0xF4
|
||||||
|
|
||||||
mov eax, 0x99000+PG_UW
|
mov eax, 0x99000+PG_UWR
|
||||||
mov edi, page_tabs+0x99*4
|
mov edi, page_tabs+0x99*4
|
||||||
mov edx, 0x1000
|
mov edx, 0x1000
|
||||||
mov ecx, 7
|
mov ecx, 7
|
||||||
@ -101,7 +101,7 @@ v86_create:
|
|||||||
; addresses 0xC0000 - 0xFFFFF - BIOS code (shared between all machines!)
|
; addresses 0xC0000 - 0xFFFFF - BIOS code (shared between all machines!)
|
||||||
; physical address = 0xC0000
|
; physical address = 0xC0000
|
||||||
|
|
||||||
mov eax, 0xC0000+PG_UW
|
mov eax, 0xC0000+PG_UWR
|
||||||
mov edi, page_tabs+0xC0*4
|
mov edi, page_tabs+0xC0*4
|
||||||
mov ecx, 64
|
mov ecx, 64
|
||||||
@@:
|
@@:
|
||||||
|
@ -219,6 +219,8 @@ dll_cur_addr dd MIN_DEFAULT_DLL_ADDR
|
|||||||
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
|
pte_valid_mask dd 0xFFFFF000+PG_SHARED+PG_NOCACHE+PG_UWR
|
||||||
|
|
||||||
keyboard dd 1
|
keyboard dd 1
|
||||||
syslang dd 1
|
syslang dd 1
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ proc init_mem
|
|||||||
|
|
||||||
mov ebx, cr4
|
mov ebx, cr4
|
||||||
or ebx, CR4_PSE
|
or ebx, CR4_PSE
|
||||||
mov eax, PG_LARGE+PG_SW
|
mov eax, PDE_LARGE+PG_SWR
|
||||||
mov cr4, ebx
|
mov cr4, ebx
|
||||||
dec [pg_data.kernel_tables-OS_BASE]
|
dec [pg_data.kernel_tables-OS_BASE]
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ proc init_mem
|
|||||||
mov edi, [tmp_page_tabs]
|
mov edi, [tmp_page_tabs]
|
||||||
jmp .map_kernel_heap ; new kernel fits to the first 4Mb - nothing to do with ".map_low"
|
jmp .map_kernel_heap ; new kernel fits to the first 4Mb - nothing to do with ".map_low"
|
||||||
.no_PSE:
|
.no_PSE:
|
||||||
mov eax, PG_SW
|
mov eax, PG_SWR
|
||||||
mov ecx, [tmp_page_tabs]
|
mov ecx, [tmp_page_tabs]
|
||||||
shr ecx, 12
|
shr ecx, 12
|
||||||
.map_low:
|
.map_low:
|
||||||
@ -168,7 +168,7 @@ proc init_mem
|
|||||||
|
|
||||||
mov ecx, [pg_data.kernel_tables-OS_BASE]
|
mov ecx, [pg_data.kernel_tables-OS_BASE]
|
||||||
mov eax, [tmp_page_tabs]
|
mov eax, [tmp_page_tabs]
|
||||||
or eax, PG_SW
|
or eax, PG_SWR
|
||||||
mov edi, edx
|
mov edi, edx
|
||||||
|
|
||||||
.map_kernel_tabs:
|
.map_kernel_tabs:
|
||||||
@ -177,7 +177,7 @@ proc init_mem
|
|||||||
dec ecx
|
dec ecx
|
||||||
jnz .map_kernel_tabs
|
jnz .map_kernel_tabs
|
||||||
|
|
||||||
mov dword [sys_proc-OS_BASE+PROC.pdt_0+(page_tabs shr 20)], sys_proc+PROC.pdt_0+PG_SW-OS_BASE
|
mov dword [sys_proc-OS_BASE+PROC.pdt_0+(page_tabs shr 20)], sys_proc+PROC.pdt_0+PG_SWR-OS_BASE
|
||||||
|
|
||||||
mov edi, (sys_proc+PROC.pdt_0-OS_BASE)
|
mov edi, (sys_proc+PROC.pdt_0-OS_BASE)
|
||||||
lea esi, [edi+(OS_BASE shr 20)]
|
lea esi, [edi+(OS_BASE shr 20)]
|
||||||
|
@ -575,11 +575,11 @@ setvideomode:
|
|||||||
.noSYSCALL:
|
.noSYSCALL:
|
||||||
; -----------------------------------------
|
; -----------------------------------------
|
||||||
stdcall alloc_page
|
stdcall alloc_page
|
||||||
stdcall map_page, tss-0xF80, eax, PG_SW
|
stdcall map_page, tss-0xF80, eax, PG_SWR
|
||||||
stdcall alloc_page
|
stdcall alloc_page
|
||||||
stdcall map_page, tss+0x80, eax, PG_SW
|
stdcall map_page, tss+0x80, eax, PG_SWR
|
||||||
stdcall alloc_page
|
stdcall alloc_page
|
||||||
stdcall map_page, tss+0x1080, eax, PG_SW
|
stdcall map_page, tss+0x1080, eax, PG_SWR
|
||||||
|
|
||||||
; LOAD IDT
|
; LOAD IDT
|
||||||
|
|
||||||
@ -754,7 +754,7 @@ endg
|
|||||||
mov edi, OS_BASE + 8000h
|
mov edi, OS_BASE + 8000h
|
||||||
mov ecx, (ap_init16_size + 3) / 4
|
mov ecx, (ap_init16_size + 3) / 4
|
||||||
rep movsd
|
rep movsd
|
||||||
stdcall map_io_mem, [acpi_lapic_base], 0x1000, PG_SW+PG_NOCACHE
|
stdcall map_io_mem, [acpi_lapic_base], 0x1000, PG_SWR+PG_NOCACHE
|
||||||
mov [LAPIC_BASE], eax
|
mov [LAPIC_BASE], eax
|
||||||
lea edi, [eax+300h]
|
lea edi, [eax+300h]
|
||||||
mov esi, smpt+4
|
mov esi, smpt+4
|
||||||
@ -1059,14 +1059,14 @@ include "detect/vortex86.inc" ; Vortex86 SoC detection code
|
|||||||
;protect io permission map
|
;protect io permission map
|
||||||
|
|
||||||
mov esi, [default_io_map]
|
mov esi, [default_io_map]
|
||||||
stdcall map_page, esi, [SLOT_BASE+256+APPDATA.io_map], PG_MAP
|
stdcall map_page, esi, [SLOT_BASE+256+APPDATA.io_map], PG_READ
|
||||||
add esi, 0x1000
|
add esi, 0x1000
|
||||||
stdcall map_page, esi, [SLOT_BASE+256+APPDATA.io_map+4], PG_MAP
|
stdcall map_page, esi, [SLOT_BASE+256+APPDATA.io_map+4], PG_READ
|
||||||
|
|
||||||
stdcall map_page, tss._io_map_0, \
|
stdcall map_page, tss._io_map_0, \
|
||||||
[SLOT_BASE+256+APPDATA.io_map], PG_MAP
|
[SLOT_BASE+256+APPDATA.io_map], PG_READ
|
||||||
stdcall map_page, tss._io_map_1, \
|
stdcall map_page, tss._io_map_1, \
|
||||||
[SLOT_BASE+256+APPDATA.io_map+4], PG_MAP
|
[SLOT_BASE+256+APPDATA.io_map+4], PG_READ
|
||||||
|
|
||||||
; SET KEYBOARD PARAMETERS
|
; SET KEYBOARD PARAMETERS
|
||||||
mov al, 0xf6 ; reset keyboard, scan enabled
|
mov al, 0xf6 ; reset keyboard, scan enabled
|
||||||
@ -2802,7 +2802,7 @@ align 4
|
|||||||
align 4
|
align 4
|
||||||
@@:
|
@@:
|
||||||
mov eax, [page_tabs+esi*4]
|
mov eax, [page_tabs+esi*4]
|
||||||
or al, PG_UW
|
or al, PG_UWR
|
||||||
mov [page_tabs+ebx*4], eax
|
mov [page_tabs+ebx*4], eax
|
||||||
mov eax, ebx
|
mov eax, ebx
|
||||||
shl eax, 12
|
shl eax, 12
|
||||||
@ -5654,10 +5654,10 @@ end if
|
|||||||
.rsdp_found:
|
.rsdp_found:
|
||||||
mov esi, [eax+16] ; esi contains physical address of the RSDT
|
mov esi, [eax+16] ; esi contains physical address of the RSDT
|
||||||
mov ebp, [ipc_tmp]
|
mov ebp, [ipc_tmp]
|
||||||
stdcall map_page, ebp, esi, PG_MAP
|
stdcall map_page, ebp, esi, PG_READ
|
||||||
lea eax, [esi+1000h]
|
lea eax, [esi+1000h]
|
||||||
lea edx, [ebp+1000h]
|
lea edx, [ebp+1000h]
|
||||||
stdcall map_page, edx, eax, PG_MAP
|
stdcall map_page, edx, eax, PG_READ
|
||||||
and esi, 0xFFF
|
and esi, 0xFFF
|
||||||
add esi, ebp
|
add esi, ebp
|
||||||
cmp dword [esi], 'RSDT'
|
cmp dword [esi], 'RSDT'
|
||||||
@ -5671,10 +5671,10 @@ end if
|
|||||||
lodsd
|
lodsd
|
||||||
mov ebx, eax
|
mov ebx, eax
|
||||||
lea eax, [ebp+2000h]
|
lea eax, [ebp+2000h]
|
||||||
stdcall map_page, eax, ebx, PG_MAP
|
stdcall map_page, eax, ebx, PG_READ
|
||||||
lea eax, [ebp+3000h]
|
lea eax, [ebp+3000h]
|
||||||
add ebx, 0x1000
|
add ebx, 0x1000
|
||||||
stdcall map_page, eax, ebx, PG_MAP
|
stdcall map_page, eax, ebx, PG_READ
|
||||||
and ebx, 0xFFF
|
and ebx, 0xFFF
|
||||||
lea ebx, [ebx+ebp+2000h]
|
lea ebx, [ebx+ebp+2000h]
|
||||||
cmp dword [ebx], 'FACP'
|
cmp dword [ebx], 'FACP'
|
||||||
@ -5685,10 +5685,10 @@ end if
|
|||||||
; ebx is linear address of FADT
|
; ebx is linear address of FADT
|
||||||
mov edi, [ebx+40] ; physical address of the DSDT
|
mov edi, [ebx+40] ; physical address of the DSDT
|
||||||
lea eax, [ebp+4000h]
|
lea eax, [ebp+4000h]
|
||||||
stdcall map_page, eax, edi, PG_MAP
|
stdcall map_page, eax, edi, PG_READ
|
||||||
lea eax, [ebp+5000h]
|
lea eax, [ebp+5000h]
|
||||||
lea esi, [edi+0x1000]
|
lea esi, [edi+0x1000]
|
||||||
stdcall map_page, eax, esi, PG_MAP
|
stdcall map_page, eax, esi, PG_READ
|
||||||
and esi, 0xFFF
|
and esi, 0xFFF
|
||||||
sub edi, esi
|
sub edi, esi
|
||||||
cmp dword [esi+ebp+4000h], 'DSDT'
|
cmp dword [esi+ebp+4000h], 'DSDT'
|
||||||
@ -5736,8 +5736,8 @@ end if
|
|||||||
add edi, 0x1000
|
add edi, 0x1000
|
||||||
push eax
|
push eax
|
||||||
lea eax, [ebp+4000h]
|
lea eax, [ebp+4000h]
|
||||||
stdcall map_page, eax, edi, PG_MAP
|
stdcall map_page, eax, edi, PG_READ
|
||||||
push PG_MAP
|
push PG_READ
|
||||||
lea eax, [edi+1000h]
|
lea eax, [edi+1000h]
|
||||||
push eax
|
push eax
|
||||||
lea eax, [ebp+5000h]
|
lea eax, [ebp+5000h]
|
||||||
|
@ -1481,7 +1481,7 @@ SOCKET_ring_create:
|
|||||||
mov esi, eax
|
mov esi, eax
|
||||||
|
|
||||||
push edx
|
push edx
|
||||||
stdcall create_ring_buffer, SOCKET_MAXDATA, PG_SW
|
stdcall create_ring_buffer, SOCKET_MAXDATA, PG_SWR
|
||||||
pop edx
|
pop edx
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
@ -2407,4 +2407,4 @@ SOCKET_cant_send_more:
|
|||||||
.notconn:
|
.notconn:
|
||||||
mov dword[esp+20], ENOTCONN
|
mov dword[esp+20], ENOTCONN
|
||||||
mov dword[esp+32], -1
|
mov dword[esp+32], -1
|
||||||
ret
|
ret
|
||||||
|
Loading…
Reference in New Issue
Block a user