Rev 187 | Rev 381 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 187 | Rev 379 | ||
---|---|---|---|
Line 65... | Line 65... | ||
65 | ; \begin{Mario79} |
65 | ; \begin{Mario79} |
66 | cmp [dma_task_switched], 1 |
66 | cmp [dma_task_switched], 1 |
67 | jne .find_next_task |
67 | jne .find_next_task |
68 | mov [dma_task_switched], 0 |
68 | mov [dma_task_switched], 0 |
69 | mov ebx, [dma_process] |
69 | mov ebx, [dma_process] |
70 | cmp [0x3000], ebx |
70 | cmp [CURRENT_TASK], ebx |
71 | je .return |
71 | je .return |
72 | mov edi, [dma_slot_ptr] |
72 | mov edi, [dma_slot_ptr] |
73 | mov [0x3000], ebx |
73 | mov [CURRENT_TASK], ebx |
74 | mov [0x3010], edi |
74 | mov [TASK_BASE], edi |
75 | jmp @f |
75 | jmp @f |
76 | .find_next_task: |
76 | .find_next_task: |
77 | ; \end{Mario79} |
77 | ; \end{Mario79} |
78 | call find_next_task |
78 | call find_next_task |
79 | test eax, eax ; the same task -> skip switch |
79 | test eax, eax ; the same task -> skip switch |
Line 101... | Line 101... | ||
101 | event_sched dd ? |
101 | event_sched dd ? |
102 | endg |
102 | endg |
Line 103... | Line 103... | ||
103 | 103 | ||
104 | 104 | ||
105 | update_counters: |
105 | update_counters: |
106 | mov edi, [0x3010] |
106 | mov edi, [TASK_BASE] |
107 | mov ebx, [edi+TASKDATA.counter_add] ; time stamp counter add |
107 | mov ebx, [edi+TASKDATA.counter_add] ; time stamp counter add |
108 | call _rdtsc |
108 | call _rdtsc |
109 | sub eax, ebx |
109 | sub eax, ebx |
Line 117... | Line 117... | ||
117 | ; eax = 1 if the task is the same |
117 | ; eax = 1 if the task is the same |
118 | ; edi = address of the data for the task in ebx |
118 | ; edi = address of the data for the task in ebx |
119 | ; [0x3000] = ebx and [0x3010] = edi |
119 | ; [0x3000] = ebx and [0x3010] = edi |
120 | ; corrupts other regs |
120 | ; corrupts other regs |
121 | find_next_task: |
121 | find_next_task: |
122 | mov ebx, [0x3000] |
122 | mov ebx, [CURRENT_TASK] |
123 | mov edi, [0x3010] |
123 | mov edi, [TASK_BASE] |
124 | mov [prev_slot], ebx |
124 | mov [prev_slot], ebx |
Line 125... | Line 125... | ||
125 | 125 | ||
126 | .waiting_for_termination: |
126 | .waiting_for_termination: |
127 | .waiting_for_reuse: |
127 | .waiting_for_reuse: |
128 | .waiting_for_event: |
128 | .waiting_for_event: |
129 | .suspended: |
129 | .suspended: |
130 | cmp ebx, [0x3004] |
130 | cmp ebx, [TASK_COUNT] |
131 | jb @f |
131 | jb @f |
132 | mov edi, 0x3000 |
132 | mov edi, CURRENT_TASK |
133 | xor ebx, ebx |
133 | xor ebx, ebx |
Line 134... | Line 134... | ||
134 | @@: |
134 | @@: |
135 | 135 | ||
Line 148... | Line 148... | ||
148 | cmp al, 4 |
148 | cmp al, 4 |
149 | je .waiting_for_termination |
149 | je .waiting_for_termination |
150 | cmp al, 9 |
150 | cmp al, 9 |
151 | je .waiting_for_reuse |
151 | je .waiting_for_reuse |
Line 152... | Line 152... | ||
152 | 152 | ||
153 | mov [0x3000],ebx |
153 | mov [CURRENT_TASK],ebx |
Line 154... | Line 154... | ||
154 | mov [0x3010],edi |
154 | mov [TASK_BASE],edi |
155 | 155 | ||
156 | cmp al, 5 |
156 | cmp al, 5 |
157 | jne .noevents |
157 | jne .noevents |
158 | call get_event_for_app |
158 | call get_event_for_app |
159 | test eax, eax |
159 | test eax, eax |
160 | jz .waiting_for_event |
160 | jz .waiting_for_event |
161 | mov [event_sched], eax |
161 | mov [event_sched], eax |
162 | mov [edi+TASKDATA.state], byte 0 |
162 | mov [edi+TASKDATA.state], byte 0 |
163 | .noevents: |
163 | .noevents: |
164 | .found: |
164 | .found: |
165 | mov [0x3000],ebx |
165 | mov [CURRENT_TASK],ebx |
166 | mov [0x3010],edi |
166 | mov [TASK_BASE],edi |
Line 167... | Line 167... | ||
167 | call _rdtsc |
167 | call _rdtsc |
168 | mov [edi+TASKDATA.counter_add],eax |
168 | mov [edi+TASKDATA.counter_add],eax |
Line 189... | Line 189... | ||
189 | updatecputimes: |
189 | updatecputimes: |
Line 190... | Line 190... | ||
190 | 190 | ||
191 | mov eax,[idleuse] |
191 | mov eax,[idleuse] |
192 | mov [idleusesec],eax |
192 | mov [idleusesec],eax |
193 | mov [idleuse],dword 0 |
193 | mov [idleuse],dword 0 |
194 | mov ecx, [0x3004] |
194 | mov ecx, [TASK_COUNT] |
195 | mov edi, 0x3020 |
195 | mov edi, TASK_DATA |
196 | .newupdate: |
196 | .newupdate: |
197 | mov ebx,[edi+TASKDATA.counter_sum] |
197 | mov ebx,[edi+TASKDATA.counter_sum] |
198 | mov [edi+TASKDATA.cpu_usage],ebx |
198 | mov [edi+TASKDATA.cpu_usage],ebx |
199 | mov [edi+TASKDATA.counter_sum],dword 0 |
199 | mov [edi+TASKDATA.counter_sum],dword 0 |