kolibrios-fun/contrib/sdk/sources/newlib/libc/crt/thread.S
Sergey Semyonov (Serge) 846fce0120 set default newlib dir's structure
git-svn-id: svn://kolibrios.org@4874 a494cfbc-eb01-0410-851d-a64ba20cac60
2014-04-22 09:02:02 +00:00

49 lines
1.1 KiB
ArmAsm

.global _create_thread
.global ___thread_startup
.section .text
.def _create_thread; .scl 2; .type 32; .endef
.align 4
_create_thread:
#.thr_proc equ esp+8
#.param equ esp+12
#.stack_size equ esp+16
pushl %ebx
movl $68, %eax
movl $12, %ebx
movl 16(%esp), %ecx #[.stack_size]
addl $4095, %ecx
andl $-4096, %ecx
movl %ecx, 16(%esp) #save stack size
int $0x40
testl %eax, %eax
jz 1f
leal -20(%eax,%ecx), %edx
movl 8(%esp), %ebx #[.thr_proc]
mov %ebx, 4(%edx)
movl 12(%esp), %ebx #[.param]
movl %ebx, 8(%edx)
addl %eax, %ecx
movl %eax, 12(%edx) #stack low limit
movl %ecx, 16(%edx) #stack high limit
movl $51, %eax
movl $1, %ebx
lea ___thread_startup , %ecx
int $0x40
popl %ebx
ret
1:
notl %eax
popl %ebx
ret