Subversion Repositories Kolibri OS

Rev

Rev 4872 | Blame | Compare with Previous | Last modification | View Log | RSS feed

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