forked from KolibriOS/kolibrios
kernel: minor optimizations
git-svn-id: svn://kolibrios.org@4424 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
3ed9acd41a
commit
3e99300152
@ -129,15 +129,11 @@ proc init_kernel_heap
|
|||||||
loop @B
|
loop @B
|
||||||
|
|
||||||
stdcall alloc_pages, dword 32
|
stdcall alloc_pages, dword 32
|
||||||
|
|
||||||
|
or eax, PG_SW
|
||||||
|
mov ebx, HEAP_BASE
|
||||||
mov ecx, 32
|
mov ecx, 32
|
||||||
mov edx, eax
|
call commit_pages
|
||||||
mov edi, HEAP_BASE
|
|
||||||
.l1:
|
|
||||||
stdcall map_page, edi, edx, PG_SW
|
|
||||||
add edi, 0x1000
|
|
||||||
add edx, 0x1000
|
|
||||||
dec ecx
|
|
||||||
jnz .l1
|
|
||||||
|
|
||||||
mov edi, HEAP_BASE ;descriptors
|
mov edi, HEAP_BASE ;descriptors
|
||||||
mov ebx, HEAP_BASE+sizeof.MEM_BLOCK ;free space
|
mov ebx, HEAP_BASE+sizeof.MEM_BLOCK ;free space
|
||||||
@ -480,46 +476,39 @@ proc kernel_alloc stdcall, size:dword
|
|||||||
mov [pages_count], ebx
|
mov [pages_count], ebx
|
||||||
|
|
||||||
stdcall alloc_kernel_space, eax
|
stdcall alloc_kernel_space, eax
|
||||||
|
mov [lin_addr], eax
|
||||||
|
mov ebx, [pages_count]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .err
|
jz .err
|
||||||
mov [lin_addr], eax
|
|
||||||
|
|
||||||
mov ecx, [pages_count]
|
|
||||||
mov edx, eax
|
mov edx, eax
|
||||||
mov ebx, ecx
|
|
||||||
|
|
||||||
shr ecx, 3
|
shr ebx, 3
|
||||||
jz .next
|
jz .tail
|
||||||
|
|
||||||
and ebx, not 7
|
shl ebx, 3
|
||||||
push ebx
|
|
||||||
stdcall alloc_pages, ebx
|
stdcall alloc_pages, ebx
|
||||||
pop ecx ; yes ecx!!!
|
test eax, eax
|
||||||
and eax, eax
|
|
||||||
jz .err
|
jz .err
|
||||||
|
|
||||||
mov edi, eax
|
mov ecx, ebx
|
||||||
mov edx, [lin_addr]
|
or eax, PG_SW
|
||||||
@@:
|
mov ebx, [lin_addr]
|
||||||
stdcall map_page, edx, edi, dword PG_SW
|
call commit_pages
|
||||||
add edx, 0x1000
|
|
||||||
add edi, 0x1000
|
mov edx, ebx ; this dirty hack
|
||||||
dec ecx
|
.tail:
|
||||||
jnz @B
|
mov ebx, [pages_count]
|
||||||
.next:
|
and ebx, 7
|
||||||
mov ecx, [pages_count]
|
|
||||||
and ecx, 7
|
|
||||||
jz .end
|
jz .end
|
||||||
@@:
|
@@:
|
||||||
push ecx
|
|
||||||
call alloc_page
|
call alloc_page
|
||||||
pop ecx
|
|
||||||
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_SW
|
||||||
add edx, 0x1000
|
add edx, 0x1000
|
||||||
dec ecx
|
dec ebx
|
||||||
jnz @B
|
jnz @B
|
||||||
.end:
|
.end:
|
||||||
mov eax, [lin_addr]
|
mov eax, [lin_addr]
|
||||||
|
@ -123,19 +123,19 @@ proc alloc_pages stdcall, count:dword
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
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:
|
||||||
push ebx
|
push ebx
|
||||||
mov eax, [phis_addr]
|
mov eax, [esp+12] ; phis_addr
|
||||||
and eax, not 0xFFF
|
and eax, not 0xFFF
|
||||||
or eax, [flags]
|
or eax, [esp+16] ; flags
|
||||||
mov ebx, [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
|
||||||
mov eax, [lin_addr]
|
mov eax, [esp+8] ; lin_addr
|
||||||
invlpg [eax]
|
|
||||||
pop ebx
|
pop ebx
|
||||||
ret
|
invlpg [eax]
|
||||||
endp
|
ret 12
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
map_space: ;not implemented
|
map_space: ;not implemented
|
||||||
|
@ -517,6 +517,7 @@ end if
|
|||||||
add edi, page_tabs
|
add edi, page_tabs
|
||||||
.remap:
|
.remap:
|
||||||
lodsd
|
lodsd
|
||||||
|
and eax, 0xFFFFF000
|
||||||
or eax, ebx; force user level r/w access
|
or eax, ebx; force user level r/w access
|
||||||
stosd
|
stosd
|
||||||
add edx, 0x1000
|
add edx, 0x1000
|
||||||
|
@ -523,9 +523,6 @@ mouse._.find_sys_window_under_cursor: ;////////////////////////////////////////
|
|||||||
;< esi = process slot
|
;< esi = process slot
|
||||||
;< edi = pointer to WDATA struct
|
;< edi = pointer to WDATA struct
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; mov esi, [Screen_Max_X]
|
|
||||||
; inc esi
|
|
||||||
; imul esi, [mouse.state.pos.y]
|
|
||||||
mov esi, [mouse.state.pos.y]
|
mov esi, [mouse.state.pos.y]
|
||||||
mov esi, [d_width_calc_area + esi*4]
|
mov esi, [d_width_calc_area + esi*4]
|
||||||
|
|
||||||
|
@ -1881,12 +1881,7 @@ align 4
|
|||||||
|
|
||||||
; get WinMap start
|
; get WinMap start
|
||||||
push esi
|
push esi
|
||||||
; mov edi, [Screen_Max_X]
|
mov esi, [_display.width]
|
||||||
; inc edi
|
|
||||||
; mov esi, edi
|
|
||||||
mov esi, [Screen_Max_X]
|
|
||||||
inc esi
|
|
||||||
; imul edi, ebx
|
|
||||||
mov edi, [d_width_calc_area + ebx*4]
|
mov edi, [d_width_calc_area + ebx*4]
|
||||||
|
|
||||||
add edi, eax
|
add edi, eax
|
||||||
@ -1929,9 +1924,6 @@ align 4
|
|||||||
|
|
||||||
; get WinMap start -> ebp
|
; get WinMap start -> ebp
|
||||||
push eax
|
push eax
|
||||||
; mov eax, [Screen_Max_X] ; screen_sx
|
|
||||||
; inc eax
|
|
||||||
; imul eax, ebx
|
|
||||||
mov eax, [d_width_calc_area + ebx*4]
|
mov eax, [d_width_calc_area + ebx*4]
|
||||||
|
|
||||||
add eax, [esp]
|
add eax, [esp]
|
||||||
|
Loading…
Reference in New Issue
Block a user