Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. .global _create_thread
  3. .global ___thread_startup
  4.  
  5. .section .text
  6.  
  7. .align 4
  8. _create_thread:
  9. #.thr_proc    equ esp+8
  10. #.param       equ esp+12
  11. #.stack_size  equ esp+16
  12.  
  13.            pushl %ebx
  14.  
  15.            movl  $68, %eax
  16.            movl  $12, %ebx
  17.            movl  16(%esp), %ecx    #[.stack_size]
  18.            addl  $4095, %ecx
  19.            andl  $-4096, %ecx
  20.            movl  %ecx, 16(%esp)    #save stack size
  21.            int   $0x40
  22.            testl %eax, %eax
  23.            jz    1f
  24.  
  25.            leal  -20(%eax,%ecx), %edx
  26.  
  27.            movl  8(%esp), %ebx     #[.thr_proc]
  28.            mov  %ebx, 4(%edx)
  29.  
  30.            movl  12(%esp), %ebx    #[.param]
  31.            movl  %ebx, 8(%edx)
  32.  
  33.            addl  %eax, %ecx
  34.            movl  %eax, 12(%edx)    #stack low limit
  35.            movl  %ecx, 16(%edx)    #stack high limit
  36.  
  37.            movl  $51, %eax
  38.            movl  $1,  %ebx
  39.            lea   ___thread_startup , %ecx
  40.            int   $0x40
  41.            popl  %ebx
  42.            ret
  43. 1:
  44.            notl %eax
  45.            popl %ebx
  46.            ret
  47.