Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1.  
  2. .section .init
  3.  
  4. .global __start
  5.  
  6. #tls:0  pid process id
  7. #tls:4  tid reserved for thread slot
  8. #tls:8  thread's stack low limit
  9. #tls:12 thread's stack high limit
  10. #tls:16 reseved for libc
  11.  
  12. .align 4
  13. __start:
  14.            movl  $68, %eax
  15.            movl  $12, %ebx
  16.            lea  __size_of_stack_reserve__, %ecx
  17.            addl  $4095, %ecx       #load stack size
  18.            andl  $-4096, %ecx      #align to page granularity
  19.            int   $0x40             #and allocate
  20.            testl %eax, %eax
  21.            jz    1f
  22.  
  23.            addl %eax, %ecx
  24.            movl %eax, %fs:8
  25.            movl %ecx, %fs:12       #save stack base - low limit
  26.                                    #save stack top  - high limit
  27.            movl %ecx, %esp         #reload stack
  28.  
  29.            subl $1024, %esp
  30.  
  31.            movl $9, %eax
  32.            movl %esp, %ebx
  33.            movl $-1, %ecx
  34.            int $0x40
  35.  
  36.            movl 30(%ebx), %eax
  37.            movl %eax, %fs:0        #save pid
  38.  
  39.            addl $1024, %esp
  40.  
  41.            jmp  ___crt_startup
  42. 1:
  43.            int3                    #trap to debugger
  44.  
  45.            .ascii "No enough memory for stack allocation"
  46.  
  47.