forked from KolibriOS/kolibrios
small optimization sys_sheduler
git-svn-id: svn://kolibrios.org@1344 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
d1bdc45e2f
commit
22dfbb516f
@ -3397,32 +3397,45 @@ endg
|
|||||||
;3 - rdmsr. Counter in edx. (edx:eax) [esi:edi, edx] => [edx:esi, ecx]. Ret in ebx:eax. Block. ok.
|
;3 - rdmsr. Counter in edx. (edx:eax) [esi:edi, edx] => [edx:esi, ecx]. Ret in ebx:eax. Block. ok.
|
||||||
;4 - wrmsr. Counter in edx. (edx:eax) [esi:edi, edx] => [edx:esi, ecx]. Ret in ebx:eax. Block. ok.
|
;4 - wrmsr. Counter in edx. (edx:eax) [esi:edi, edx] => [edx:esi, ecx]. Ret in ebx:eax. Block. ok.
|
||||||
;---------------------------------------------------------------------------------------------
|
;---------------------------------------------------------------------------------------------
|
||||||
|
iglobal
|
||||||
|
align 4
|
||||||
|
sheduler:
|
||||||
|
dd sys_sheduler.00
|
||||||
|
dd change_task
|
||||||
|
dd sys_sheduler.02
|
||||||
|
dd sys_sheduler.03
|
||||||
|
dd sys_sheduler.04
|
||||||
|
endg
|
||||||
sys_sheduler:
|
sys_sheduler:
|
||||||
; old sys_sheduler ;noname & halyavin
|
;rewritten by <Lrz> 29.12.2009
|
||||||
; cmp eax,0
|
jmp dword [sheduler+eax*4]
|
||||||
; je shed_counter
|
;.shed_counter:
|
||||||
; cmp eax,2
|
.00:
|
||||||
; je perf_control
|
mov eax,[context_counter]
|
||||||
; cmp eax,3
|
mov [esp+36],eax
|
||||||
; je rdmsr_instr
|
ret
|
||||||
; cmp eax,4
|
|
||||||
; je wrmsr_instr
|
|
||||||
; cmp eax,1
|
|
||||||
; jne not_supported
|
|
||||||
; call change_task ;delay,0
|
|
||||||
|
|
||||||
;rewritten by <Lrz> 15.11.2009
|
.02:
|
||||||
test eax,eax
|
;.perf_control:
|
||||||
jz .shed_counter ;eax=0
|
test ebx,ebx
|
||||||
dec eax
|
jz modify_pce ;if ecx=0
|
||||||
jz change_task ;eax=1
|
dec ebx
|
||||||
dec eax
|
jz is_cache_enabled ;if ecx=1
|
||||||
jz .perf_control ;eax=2
|
dec ebx
|
||||||
dec eax
|
jz cache_enable ;if ecx=2
|
||||||
jz .rdmsr_instr ;eax=3
|
ret
|
||||||
dec eax
|
.03:
|
||||||
jnz @f
|
;.rdmsr_instr:
|
||||||
;wrmsr_instr ;eax=4
|
;now counter in ecx
|
||||||
|
;(edx:eax) esi:edi => edx:esi
|
||||||
|
mov eax,esi
|
||||||
|
; mov ecx,edx
|
||||||
|
rdmsr
|
||||||
|
mov [esp+36],eax
|
||||||
|
mov [esp+24],edx ;ret in ebx?
|
||||||
|
ret
|
||||||
|
|
||||||
|
.04:
|
||||||
;.wrmsr_instr:
|
;.wrmsr_instr:
|
||||||
;now counter in ecx
|
;now counter in ecx
|
||||||
;(edx:eax) esi:edi => edx:esi
|
;(edx:eax) esi:edi => edx:esi
|
||||||
@ -3439,41 +3452,13 @@ sys_sheduler:
|
|||||||
je @f
|
je @f
|
||||||
|
|
||||||
mov eax,esi
|
mov eax,esi
|
||||||
|
; mov ecx,edx
|
||||||
wrmsr
|
wrmsr
|
||||||
; mov [esp + 36], eax
|
; mov [esp + 32], eax
|
||||||
; mov [esp + 24], edx ;ret in ebx?
|
; mov [esp + 20], edx ;ret in ebx?
|
||||||
@@:
|
@@:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.shed_counter:
|
|
||||||
mov eax,[context_counter]
|
|
||||||
mov [esp+36],eax
|
|
||||||
ret
|
|
||||||
.perf_control:
|
|
||||||
; inc eax ;now eax=3
|
|
||||||
add eax,3 ;restore eax=3
|
|
||||||
cmp ebx,eax
|
|
||||||
je cache_disable
|
|
||||||
dec eax
|
|
||||||
cmp ebx,eax
|
|
||||||
je cache_enable
|
|
||||||
dec eax
|
|
||||||
cmp ebx,eax
|
|
||||||
je is_cache_enabled
|
|
||||||
dec eax
|
|
||||||
cmp ebx,eax
|
|
||||||
je modify_pce
|
|
||||||
ret
|
|
||||||
|
|
||||||
.rdmsr_instr:
|
|
||||||
;now counter in ecx
|
|
||||||
;(edx:eax) esi:edi => edx:esi
|
|
||||||
mov eax,esi
|
|
||||||
rdmsr
|
|
||||||
mov [esp+36],eax
|
|
||||||
mov [esp+24],edx ;ret in ebx?
|
|
||||||
ret
|
|
||||||
|
|
||||||
cache_disable:
|
cache_disable:
|
||||||
mov eax,cr0
|
mov eax,cr0
|
||||||
or eax,01100000000000000000000000000000b
|
or eax,01100000000000000000000000000000b
|
||||||
|
Loading…
Reference in New Issue
Block a user