Subversion Repositories Kolibri OS

Rev

Rev 1043 | Rev 1056 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1043 Rev 1055
Line 54... Line 54...
54
;;
54
;;
55
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
55
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 56... Line 56...
56
 
56
 
Line 57... Line 57...
57
include 'macros.inc'
57
include 'macros.inc'
Line 58... Line 58...
58
 
58
 
Line 59... Line 59...
59
$Revision: 1043 $
59
$Revision: 1055 $
Line 723... Line 723...
723
  ; READ TSC / SECOND
723
  ; READ TSC / SECOND
Line 724... Line 724...
724
 
724
 
725
	mov   esi,boot_tsc
725
        mov   esi,boot_tsc
726
	call  boot_log
726
        call  boot_log
727
	cli
727
        cli
728
	call  _rdtsc
728
        rdtsc ;call  _rdtsc
729
	mov   ecx,eax
729
        mov   ecx,eax
730
	mov   esi,250		    ; wait 1/4 a second
730
        mov   esi,250               ; wait 1/4 a second
731
	call  delay_ms
731
        call  delay_ms
732
	call  _rdtsc
732
        rdtsc ;call  _rdtsc
733
	sti
733
        sti
734
	sub   eax,ecx
734
        sub   eax,ecx
735
	shl   eax,2
735
        shl   eax,2
736
	mov   [CPU_FREQ],eax	      ; save tsc / sec
736
        mov   [CPU_FREQ],eax          ; save tsc / sec
Line 1011... Line 1011...
1011
;                                                                    ;
1011
;                                                                    ;
1012
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1012
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 1013... Line 1013...
1013
 
1013
 
1014
checkidle:
1014
checkidle:
1015
	pushad
-
 
1016
 
1015
        pushad
1017
	cmp  [check_idle_semaphore],0
-
 
1018
	jne  no_idle_state
-
 
1019
 
1016
        mov  ebx,[timer_ticks]
1020
	call change_task
-
 
1021
	mov  eax,[idlemem]
-
 
1022
	mov  ebx,[timer_ticks] ;[0xfdf0]
-
 
1023
	cmp  eax,ebx
1017
        call change_task
1024
	jnz  idle_exit
-
 
1025
	call _rdtsc
-
 
1026
	mov  ecx,eax
1018
        jmp  idle_loop_entry
-
 
1019
      idle_loop:
-
 
1020
        cmp  ebx,[timer_ticks]
-
 
1021
        jne  idle_exit
-
 
1022
        rdtsc ;call _rdtsc
1027
      idle_loop:
1023
        mov  ecx,eax
1028
	hlt
-
 
1029
	cmp  [check_idle_semaphore],0
-
 
1030
	jne  idle_loop_exit
-
 
1031
	mov  eax,[timer_ticks] ;[0xfdf0]
-
 
1032
	cmp  ebx,eax
-
 
1033
	jz   idle_loop
1024
        hlt
1034
      idle_loop_exit:
-
 
1035
	mov  [idlemem],eax
-
 
1036
	call _rdtsc
1025
        rdtsc ;call _rdtsc
1037
	sub  eax,ecx
-
 
1038
	mov  ebx,[idleuse]
-
 
1039
	add  ebx,eax
1026
        sub  eax,ecx
1040
	mov  [idleuse],ebx
-
 
1041
 
-
 
1042
	popad
-
 
1043
	ret
-
 
1044
 
1027
        add  [idleuse],eax
1045
      idle_exit:
-
 
1046
 
1028
      idle_loop_entry:
1047
	mov  ebx,[timer_ticks] ;[0xfdf0]
-
 
1048
	mov  [idlemem],ebx
-
 
1049
	call change_task
-
 
1050
 
-
 
1051
	popad
-
 
1052
	ret
-
 
1053
 
1029
        cmp  [check_idle_semaphore],0
1054
      no_idle_state:
-
 
1055
 
1030
        je   idle_loop
1056
	dec  [check_idle_semaphore]
-
 
1057
 
-
 
1058
	mov  ebx,[timer_ticks] ;[0xfdf0]
1031
        dec  [check_idle_semaphore]
1059
	mov  [idlemem],ebx
-
 
1060
	call change_task
-
 
1061
 
1032
      idle_exit:
1062
	popad
1033
        popad
Line 1063... Line 1034...
1063
	ret
1034
        ret
1064
 
-
 
1065
uglobal
1035
 
1066
  idlemem		dd   0x0
1036
uglobal
1067
  idleuse		dd   0x0
1037
  idleuse               dd   0x0
1068
  idleusesec		dd   0x0
1038
  idleusesec            dd   0x0
Line 1165... Line 1135...
1165
	pop   eax
1135
        pop   eax
Line 1166... Line 1136...
1166
 
1136
 
Line 1167... Line 1137...
1167
	mov   [BTN_ADDR],dword BUTTON_INFO    ; address of button list
1137
        mov   [BTN_ADDR],dword BUTTON_INFO    ; address of button list
1168
 
-
 
1169
     ;!! IP 04.02.2005:
1138
 
Line 1170... Line 1139...
1170
	mov   [next_usage_update], 100
1139
     ;!! IP 04.02.2005:
Line 1171... Line 1140...
1171
	mov   byte [DONT_SWITCH], 0 ; change task if possible
1140
        mov   byte [DONT_SWITCH], 0 ; change task if possible
Line 4667... Line 4636...
4667
 
4636
 
Line 4668... Line 4637...
4668
     cli
4637
     cli
Line 4669... Line 4638...
4669
 
4638
 
4670
     ret
4639
     ret
4671
 
4640
 
4672
 
4641
if used _rdtsc
4673
_rdtsc:
4642
_rdtsc:
4674
     bt [cpu_caps], CAPS_TSC
4643
     bt [cpu_caps], CAPS_TSC
4675
     jnc ret_rdtsc
4644
     jnc ret_rdtsc
4676
     rdtsc
4645
     rdtsc
4677
     ret
4646
     ret
4678
   ret_rdtsc:
4647
   ret_rdtsc:
-
 
4648
     mov   edx,0xffffffff
Line 4679... Line 4649...
4679
     mov   edx,0xffffffff
4649
     mov   eax,0xffffffff
Line 4680... Line 4650...
4680
     mov   eax,0xffffffff
4650
     ret
Line 5619... Line 5589...
5619
 
5589
 
Line 5620... Line 5590...
5620
__REV__ = __REV
5590
__REV__ = __REV
5621
 
5591
 
5622
uglobals_size = $ - endofcode
-