Subversion Repositories Kolibri OS

Rev

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

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