forked from KolibriOS/kolibrios
1) unmap_pages
2) code cleanup git-svn-id: svn://kolibrios.org@819 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
e5ba650fda
commit
ed2e35a24c
@ -388,6 +388,8 @@ endp
|
|||||||
align 4
|
align 4
|
||||||
proc reg_service stdcall, name:dword, handler:dword
|
proc reg_service stdcall, name:dword, handler:dword
|
||||||
|
|
||||||
|
push ebx
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
|
|
||||||
cmp [name], eax
|
cmp [name], eax
|
||||||
@ -396,14 +398,11 @@ proc reg_service stdcall, name:dword, handler:dword
|
|||||||
cmp [handler], eax
|
cmp [handler], eax
|
||||||
je .fail
|
je .fail
|
||||||
|
|
||||||
push ebx
|
|
||||||
mov eax, SRV_SIZE
|
mov eax, SRV_SIZE
|
||||||
call malloc ;call alloc_service
|
call malloc ;call alloc_service
|
||||||
pop ebx
|
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
|
|
||||||
push ebx
|
|
||||||
push esi
|
push esi
|
||||||
push edi
|
push edi
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
@ -429,6 +428,7 @@ proc reg_service stdcall, name:dword, handler:dword
|
|||||||
ret
|
ret
|
||||||
.fail:
|
.fail:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
|
pop ebx
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ kernel_export:
|
|||||||
dd szUserFree , user_free ;stdcall
|
dd szUserFree , user_free ;stdcall
|
||||||
dd szKmalloc , malloc
|
dd szKmalloc , malloc
|
||||||
dd szKfree , free
|
dd szKfree , free
|
||||||
dd szCreateRingBuffer, create_ring_buffer
|
dd szCreateRingBuffer, create_ring_buffer ;stdcall
|
||||||
|
|
||||||
dd szGetPid , get_pid
|
dd szGetPid , get_pid
|
||||||
dd szCreateObject , create_kernel_object
|
dd szCreateObject , create_kernel_object
|
||||||
|
@ -164,7 +164,7 @@ endp
|
|||||||
; ebx= descriptor index
|
; ebx= descriptor index
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
get_block:
|
get_small_block:
|
||||||
mov ecx, eax
|
mov ecx, eax
|
||||||
shr ecx, 12
|
shr ecx, 12
|
||||||
dec ecx
|
dec ecx
|
||||||
@ -211,7 +211,7 @@ get_block:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc alloc_mem_block
|
alloc_mem_block:
|
||||||
|
|
||||||
mov ebx, [mem_block_start]
|
mov ebx, [mem_block_start]
|
||||||
mov ecx, [mem_block_end]
|
mov ecx, [mem_block_end]
|
||||||
@ -233,9 +233,8 @@ found:
|
|||||||
add eax, [mem_block_arr]
|
add eax, [mem_block_arr]
|
||||||
dec [free_blocks]
|
dec [free_blocks]
|
||||||
ret
|
ret
|
||||||
endp
|
align 4
|
||||||
|
free_mem_block:
|
||||||
proc free_mem_block
|
|
||||||
mov dword [eax], 0
|
mov dword [eax], 0
|
||||||
mov dword [eax+4], 0
|
mov dword [eax+4], 0
|
||||||
mov dword [eax+8], 0
|
mov dword [eax+8], 0
|
||||||
@ -263,7 +262,6 @@ proc free_mem_block
|
|||||||
.err:
|
.err:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
endp
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc alloc_kernel_space stdcall, size:dword
|
proc alloc_kernel_space stdcall, size:dword
|
||||||
@ -284,7 +282,7 @@ proc alloc_kernel_space stdcall, size:dword
|
|||||||
cmp eax, [heap_free]
|
cmp eax, [heap_free]
|
||||||
ja .error
|
ja .error
|
||||||
|
|
||||||
call get_block ; eax
|
call get_small_block ; eax
|
||||||
test edi, edi
|
test edi, edi
|
||||||
jz .error
|
jz .error
|
||||||
|
|
||||||
|
@ -166,7 +166,9 @@ proc map_io_mem stdcall, base:dword, size:dword, flags:dword
|
|||||||
or edx, [flags]
|
or edx, [flags]
|
||||||
@@:
|
@@:
|
||||||
mov [page_tabs+eax*4], edx
|
mov [page_tabs+eax*4], edx
|
||||||
invlpg [ebx]
|
; push eax
|
||||||
|
; invlpg [ebx]
|
||||||
|
; pop eax
|
||||||
inc eax
|
inc eax
|
||||||
add ebx, edi
|
add ebx, edi
|
||||||
add edx, edi
|
add edx, edi
|
||||||
@ -184,7 +186,7 @@ endp
|
|||||||
|
|
||||||
; param
|
; param
|
||||||
; eax= page base + page flags
|
; eax= page base + page flags
|
||||||
; ebx= liear address
|
; ebx= linear address
|
||||||
; ecx= count
|
; ecx= count
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@ -202,7 +204,9 @@ commit_pages:
|
|||||||
shr ebx, 12
|
shr ebx, 12
|
||||||
@@:
|
@@:
|
||||||
mov [page_tabs+ebx*4], eax
|
mov [page_tabs+ebx*4], eax
|
||||||
invlpg [edi]
|
; push eax
|
||||||
|
; invlpg [edi]
|
||||||
|
; pop eax
|
||||||
add edi, edx
|
add edi, edx
|
||||||
add eax, edx
|
add eax, edx
|
||||||
inc ebx
|
inc ebx
|
||||||
@ -263,6 +267,32 @@ release_pages:
|
|||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
; param
|
||||||
|
; eax= base
|
||||||
|
; ecx= count
|
||||||
|
|
||||||
|
align 4
|
||||||
|
unmap_pages:
|
||||||
|
|
||||||
|
push edi
|
||||||
|
|
||||||
|
mov edi, eax
|
||||||
|
mov edx, eax
|
||||||
|
|
||||||
|
shr edi, 10
|
||||||
|
add edi, page_tabs
|
||||||
|
|
||||||
|
xor eax, eax
|
||||||
|
@@:
|
||||||
|
stosd
|
||||||
|
invlpg [edx]
|
||||||
|
add edx, 0x1000
|
||||||
|
loop @b
|
||||||
|
|
||||||
|
pop edi
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc map_page_table stdcall, lin_addr:dword, phis_addr:dword
|
proc map_page_table stdcall, lin_addr:dword, phis_addr:dword
|
||||||
push ebx
|
push ebx
|
||||||
@ -1085,6 +1115,27 @@ new_services:
|
|||||||
mov [esp+36], eax
|
mov [esp+36], eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
align 4
|
||||||
|
proc load_pe_driver stdcall, file:dword
|
||||||
|
|
||||||
|
stdcall load_PE, [file]
|
||||||
|
test eax, eax
|
||||||
|
jz .fail
|
||||||
|
|
||||||
|
mov esi, eax
|
||||||
|
stdcall eax, DRV_ENTRY
|
||||||
|
test eax, eax
|
||||||
|
jz .fail
|
||||||
|
|
||||||
|
mov [eax+SRV.entry], esi
|
||||||
|
ret
|
||||||
|
|
||||||
|
.fail:
|
||||||
|
xor eax, eax
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc init_mtrr
|
proc init_mtrr
|
||||||
|
|
||||||
@ -1159,8 +1210,6 @@ proc set_mtrr stdcall, reg:dword,base:dword,size:dword,mem_type:dword
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc stall stdcall, delay:dword
|
proc stall stdcall, delay:dword
|
||||||
push ecx
|
push ecx
|
||||||
@ -1228,8 +1277,6 @@ proc create_ring_buffer stdcall, size:dword, flags:dword
|
|||||||
@@:
|
@@:
|
||||||
mov [page_tabs+edi], eax
|
mov [page_tabs+edi], eax
|
||||||
mov [page_tabs+edi+edx], eax
|
mov [page_tabs+edi+edx], eax
|
||||||
invlpg [ebx]
|
|
||||||
invlpg [ebx+esi]
|
|
||||||
add eax, 0x1000
|
add eax, 0x1000
|
||||||
add ebx, 0x1000
|
add ebx, 0x1000
|
||||||
add edi, 4
|
add edi, 4
|
||||||
@ -1248,14 +1295,4 @@ proc create_ring_buffer stdcall, size:dword, flags:dword
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
if 0
|
|
||||||
push eax
|
|
||||||
push edx
|
|
||||||
mov edx, 0x400 ;bochs
|
|
||||||
mov al,0xff ;bochs
|
|
||||||
out dx, al ;bochs
|
|
||||||
pop edx
|
|
||||||
pop eax
|
|
||||||
end if
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -280,7 +280,9 @@ L40:
|
|||||||
__exports:
|
__exports:
|
||||||
export 'KERNEL', \
|
export 'KERNEL', \
|
||||||
alloc_kernel_space, 'AllocKernelSpace', \ ; stdcall
|
alloc_kernel_space, 'AllocKernelSpace', \ ; stdcall
|
||||||
|
commit_pages, 'CommitPages', \ ; eax, ebx, ecx
|
||||||
create_kernel_object, 'CreateObject', \
|
create_kernel_object, 'CreateObject', \
|
||||||
|
create_ring_buffer, 'CreateRingBuffer', \ ; stdcall
|
||||||
destroy_kernel_object, 'DestroyObject', \
|
destroy_kernel_object, 'DestroyObject', \
|
||||||
free_kernel_space, 'FreeKernelSpace', \ ; stdcall
|
free_kernel_space, 'FreeKernelSpace', \ ; stdcall
|
||||||
kernel_alloc, 'KernelAlloc', \ ; stdcall
|
kernel_alloc, 'KernelAlloc', \ ; stdcall
|
||||||
@ -288,6 +290,7 @@ __exports:
|
|||||||
malloc, 'Kmalloc', \
|
malloc, 'Kmalloc', \
|
||||||
free, 'Kfree', \
|
free, 'Kfree', \
|
||||||
map_io_mem, 'MapIoMem', \ ; stdcall
|
map_io_mem, 'MapIoMem', \ ; stdcall
|
||||||
|
get_pg_addr, 'GetPgAddr', \ ; eax
|
||||||
\
|
\
|
||||||
select_hw_cursor, 'SelectHwCursor', \ ; stdcall
|
select_hw_cursor, 'SelectHwCursor', \ ; stdcall
|
||||||
set_hw_cursor, 'SetHwCursor', \ ; stdcall
|
set_hw_cursor, 'SetHwCursor', \ ; stdcall
|
||||||
@ -303,9 +306,10 @@ __exports:
|
|||||||
pci_write16, 'PciWrite16', \ ; stdcall
|
pci_write16, 'PciWrite16', \ ; stdcall
|
||||||
pci_write32, 'PciWrite32', \ ; stdcall
|
pci_write32, 'PciWrite32', \ ; stdcall
|
||||||
\
|
\
|
||||||
reg_service, 'RegService', \
|
reg_service, 'RegService', \ ; stdcall
|
||||||
user_alloc, 'UserAlloc', \ ; stdcall
|
user_alloc, 'UserAlloc', \ ; stdcall
|
||||||
user_free, 'UserFree', \ ; stdcall
|
user_free, 'UserFree', \ ; stdcall
|
||||||
|
unmap_pages, 'UnmapPages', \ ; eax, ecx
|
||||||
sys_msg_board_str, 'SysMsgBoardStr'
|
sys_msg_board_str, 'SysMsgBoardStr'
|
||||||
|
|
||||||
|
|
||||||
|
@ -212,7 +212,6 @@ else
|
|||||||
jna @F
|
jna @F
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
; add edi, new_app_base
|
|
||||||
cld
|
cld
|
||||||
rep stosb
|
rep stosb
|
||||||
@@:
|
@@:
|
||||||
@ -453,12 +452,7 @@ proc create_app_space stdcall, app_size:dword,img_base:dword,img_size:dword
|
|||||||
|
|
||||||
if GREEDY_KERNEL
|
if GREEDY_KERNEL
|
||||||
mov eax, 0x02
|
mov eax, 0x02
|
||||||
.reserve:
|
rep stosd
|
||||||
stosd
|
|
||||||
invlpg [edx]
|
|
||||||
add edx, 4096
|
|
||||||
dec ecx
|
|
||||||
jnz .reserve
|
|
||||||
else
|
else
|
||||||
|
|
||||||
.alloc:
|
.alloc:
|
||||||
@ -507,6 +501,8 @@ proc destroy_page_table stdcall, pg_tab:dword
|
|||||||
mov eax, [esi]
|
mov eax, [esi]
|
||||||
test eax, 1
|
test eax, 1
|
||||||
jz .next
|
jz .next
|
||||||
|
test eax, 1 shl 9
|
||||||
|
jnz .next ;skip shared pages
|
||||||
call free_page
|
call free_page
|
||||||
.next:
|
.next:
|
||||||
add esi, 4
|
add esi, 4
|
||||||
@ -576,9 +572,8 @@ endp
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
get_pid:
|
get_pid:
|
||||||
;mov eax, [TASK_DATA] ; I think it's the bug. (Rus)
|
|
||||||
mov eax, [TASK_BASE]
|
mov eax, [TASK_BASE]
|
||||||
mov eax, [eax+4]
|
mov eax, [eax+TASKDATA.pid]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
pid_to_slot:
|
pid_to_slot:
|
||||||
|
@ -178,7 +178,7 @@ macro OUT_PACKET0 reg, count
|
|||||||
inc edx
|
inc edx
|
||||||
}
|
}
|
||||||
|
|
||||||
macro OUT_PACKET3 pkt, count \
|
macro OUT_PACKET3 pkt, count
|
||||||
{
|
{
|
||||||
mov eax, (RADEON_CP_PACKET3 or pkt or (count shl 16))
|
mov eax, (RADEON_CP_PACKET3 or pkt or (count shl 16))
|
||||||
mov [edi+edx*4], eax
|
mov [edi+edx*4], eax
|
||||||
|
@ -468,8 +468,6 @@ proc init_cursors
|
|||||||
.init:
|
.init:
|
||||||
mov [cur_def_interl], ebx
|
mov [cur_def_interl], ebx
|
||||||
|
|
||||||
; stdcall load_pe_driver, szAtiHW
|
|
||||||
|
|
||||||
stdcall load_driver, szHwMouse
|
stdcall load_driver, szHwMouse
|
||||||
mov [hw_cursor], eax
|
mov [hw_cursor], eax
|
||||||
test eax, eax
|
test eax, eax
|
||||||
|
Loading…
Reference in New Issue
Block a user