Procházet zdrojové kódy

* interrupt procedures fixed for i386 targets with a fixed stack with 16 byte alignment

git-svn-id: trunk@43006 -
florian před 5 roky
rodič
revize
896e031e84
3 změnil soubory, kde provedl 6 přidání a 8 odebrání
  1. 1 3
      compiler/i386/cgcpu.pas
  2. 1 1
      compiler/i386/cpupara.pas
  3. 4 4
      compiler/x86/cgx86.pas

+ 1 - 3
compiler/i386/cgcpu.pas

@@ -331,9 +331,7 @@ unit cgcpu;
           end;
 
         { return from proc }
-        if (po_interrupt in current_procinfo.procdef.procoptions) and
-           { this messes up stack alignment }
-           (target_info.stackalign=4) then
+        if po_interrupt in current_procinfo.procdef.procoptions then
           begin
             if assigned(current_procinfo.procdef.funcretloc[calleeside].location) and
                (current_procinfo.procdef.funcretloc[calleeside].location^.loc=LOC_REGISTER) then

+ 1 - 1
compiler/i386/cpupara.pas

@@ -433,7 +433,7 @@ unit cpupara;
         { we push Flags and CS as long
           to cope with the IRETD
           and we save 6 register + 4 selectors }
-        if po_interrupt in p.procoptions then
+        if (po_interrupt in p.procoptions) and (side=calleeside) then
           inc(parasize,8+6*4+4*2);
         { Offset is calculated like:
            sub esp,12

+ 4 - 4
compiler/x86/cgx86.pas

@@ -3433,6 +3433,7 @@ unit cgx86;
 
       begin
         regsize:=0;
+        stackmisalignment:=0;
 {$ifdef i8086}
         { Win16 callback/exported proc prologue support.
           Since callbacks can be called from different modules, DS on entry may be
@@ -3533,9 +3534,7 @@ unit cgx86;
 {$endif i8086}
 {$ifdef i386}
         { interrupt support for i386 }
-        if (po_interrupt in current_procinfo.procdef.procoptions) and
-           { this messes up stack alignment }
-           not(target_info.system in [system_i386_darwin,system_i386_iphonesim,system_i386_android]) then
+        if (po_interrupt in current_procinfo.procdef.procoptions) then
           begin
             { .... also the segment registers }
             list.concat(Taicpu.Op_reg(A_PUSH,S_W,NR_GS));
@@ -3549,6 +3548,7 @@ unit cgx86;
             list.concat(Taicpu.Op_reg(A_PUSH,S_L,NR_ECX));
             list.concat(Taicpu.Op_reg(A_PUSH,S_L,NR_EBX));
             list.concat(Taicpu.Op_reg(A_PUSH,S_L,NR_EAX));
+            inc(stackmisalignment,4*2+6*8);
           end;
 {$endif i386}
 
@@ -3556,7 +3556,7 @@ unit cgx86;
         if not nostackframe then
           begin
             { return address }
-            stackmisalignment := sizeof(pint);
+            inc(stackmisalignment,sizeof(pint));
             list.concat(tai_regalloc.alloc(current_procinfo.framepointer,nil));
             if current_procinfo.framepointer=NR_STACK_POINTER_REG then
               begin