Rev 9969 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9969 | Rev 10002 | ||
---|---|---|---|
Line 27... | Line 27... | ||
27 | format binary as "mnt" |
27 | format binary as "mnt" |
Line 28... | Line 28... | ||
28 | 28 | ||
29 | include 'macros.inc' |
29 | include 'macros.inc' |
Line 30... | Line 30... | ||
30 | include 'struct.inc' |
30 | include 'struct.inc' |
Line 31... | Line 31... | ||
31 | 31 | ||
32 | $Revision: 9969 $ |
32 | $Revision: 10002 $ |
Line 4279... | Line 4279... | ||
4279 | popad |
4279 | popad |
4280 | ret |
4280 | ret |
4281 | ;----------------------------------------------------------------------------- |
4281 | ;----------------------------------------------------------------------------- |
Line 4282... | Line 4282... | ||
4282 | 4282 | ||
4283 | align 4 |
4283 | align 4 |
4284 | syscall_threads: ; CreateThreads |
4284 | syscall_threads: |
- | 4285 | ; eax = 51 |
|
4285 | ; |
4286 | ; if ebx = 1 CreateThreads |
4286 | ; ecx=thread entry point |
4287 | ; ecx = thread entry point |
- | 4288 | ; edx = thread stack pointer |
|
- | 4289 | ; return eax = pid |
|
- | 4290 | ||
- | 4291 | ; if ebx = 2 GetCurrentThreadId |
|
4287 | ; edx=thread stack pointer |
4292 | ; return eax = current id slot |
- | 4293 | ||
- | 4294 | ; if ebx = 3 GetThreadPriority |
|
4288 | ; |
4295 | ; ecx = -1 curr slot or id slot |
- | 4296 | ; return eax = priority |
|
- | 4297 | ||
- | 4298 | ; if ebx = 4 SetThreadPriority |
|
- | 4299 | ; ecx = -1 curr slot or id slot |
|
- | 4300 | ; edx = set priority |
|
- | 4301 | ; return eax = old priority |
|
- | 4302 | ||
- | 4303 | dec ebx |
|
- | 4304 | jz .create |
|
- | 4305 | mov eax, [current_slot_idx] |
|
- | 4306 | dec ebx |
|
- | 4307 | jz .end ;get_curr_slot |
|
- | 4308 | ||
- | 4309 | test ecx, ecx ;-1 curr slot |
|
4289 | ; on return : eax = pid |
4310 | jl .cur_slot |
- | 4311 | mov eax, ecx |
|
- | 4312 | .cur_slot: |
|
- | 4313 | shl eax, BSF sizeof.APPDATA |
|
- | 4314 | add eax, SLOT_BASE |
|
- | 4315 | ||
- | 4316 | test ecx, ecx ;-1 curr slot |
|
- | 4317 | jl .curr_slot |
|
- | 4318 | ||
- | 4319 | mov esi, .err_exit |
|
- | 4320 | mov edi, CONTROL_EXCEPTION |
|
- | 4321 | ||
- | 4322 | movzx ecx, [eax+APPDATA.state] |
|
- | 4323 | test ecx, ecx |
|
- | 4324 | jnz .check_state |
|
- | 4325 | ||
- | 4326 | cmp [eax+APPDATA.tid], ecx |
|
- | 4327 | jnz .curr_slot |
|
- | 4328 | jmp .err_exit |
|
- | 4329 | ||
- | 4330 | .check_state: |
|
- | 4331 | sub ecx, 3 ;TSTATE_ZOMBIE |
|
- | 4332 | jl .curr_slot |
|
- | 4333 | je .err_exit |
|
- | 4334 | dec ecx ; 4 TSTATE_TERMINATING |
|
- | 4335 | dec ecx ; 5 TSTATE_WAITING |
|
- | 4336 | jnz .err_exit |
|
- | 4337 | ||
- | 4338 | .curr_slot: |
|
- | 4339 | dec ebx |
|
- | 4340 | jz .get_priority |
|
- | 4341 | dec ebx |
|
- | 4342 | jz .set_priority |
|
- | 4343 | ||
- | 4344 | .err_exit: |
|
- | 4345 | push -1 |
|
- | 4346 | pop eax |
|
- | 4347 | jmp .end |
|
- | 4348 | ||
- | 4349 | .set_priority: ;;sysfn 51,4 |
|
- | 4350 | mov dh, dl |
|
- | 4351 | lock xchg word [eax+APPDATA.def_priority], dx |
|
- | 4352 | movzx eax, dl ;old priority |
|
- | 4353 | jmp .end |
|
- | 4354 | ||
- | 4355 | .get_priority: ;;sysfn 51,3 |
|
- | 4356 | movzx eax, [eax+APPDATA.def_priority] |
|
- | 4357 | jmp .end |
|
- | 4358 | ||
4290 | xor ebx, ebx |
4359 | .create: ;sysfn 51,1 |
Line -... | Line 4360... | ||
- | 4360 | call new_sys_threads |
|
4291 | call new_sys_threads |
4361 | |
4292 | 4362 | .end: |
|
Line 4293... | Line 4363... | ||
4293 | mov [esp + SYSCALL_STACK.eax], eax |
4363 | mov [esp + SYSCALL_STACK.eax], eax |
4294 | ret |
4364 | ret |