Przeglądaj źródła

* gprof fixes

git-svn-id: trunk@2322 -
peter 19 lat temu
rodzic
commit
50dc3390e8
1 zmienionych plików z 29 dodań i 6 usunięć
  1. 29 6
      rtl/win32/gprt0.as

+ 29 - 6
rtl/win32/gprt0.as

@@ -20,18 +20,37 @@ _start:
 _cmain:
 _cmain:
      subl   $0x8,%esp
      subl   $0x8,%esp
      andl   $0xfffffff0,%esp
      andl   $0xfffffff0,%esp
-     pushl  etext
-     pushl  __image_base__
-     call   _monstartup
+
+     call    __gmon_start__
      call   ___main
      call   ___main
+
+     movl   %esp,__stkptr
      call   _FPC_EXE_Entry
      call   _FPC_EXE_Entry
      ret
      ret
 
 
+        .globl  __gmon_start__
+__gmon_start__:
+        pushl   %ebp
+        movl    __monstarted,%eax
+        leal    0x1(%eax),%edx
+        movl    %esp,%ebp
+        movl    %edx,__monstarted
+        testl   %eax,%eax
+        jnz     .Lnomonstart
+        pushl   $etext                  /* Initialize gmon */
+        pushl   $_cmain
+        call    _monstartup
+        addl    $8,%esp
+.Lnomonstart:
+        movl   %ebp,%esp
+        popl   %ebp
+        ret
+
      .globl asm_exit
      .globl asm_exit
 asm_exit:
 asm_exit:
-    pushl  %eax
-    call   __mcleanup
-    popl   %eax
+    pushl   %eax
+    call    __mcleanup
+    popl    %eax
     pushl   %eax
     pushl   %eax
     call    exitprocess
     call    exitprocess
 
 
@@ -73,3 +92,7 @@ exitprocess:
 .section .idata$7
 .section .idata$7
 .L6:
 .L6:
 	.ascii	"kernel32.dll\000"
 	.ascii	"kernel32.dll\000"
+
+.bss
+    .lcomm __monstarted,4
+    .comm   __stkptr,4