瀏覽代碼

* always pop DS in huge memory models in asm routines that don't specify
'nostackframe'

git-svn-id: trunk@31520 -

nickysn 10 年之前
父節點
當前提交
a1d29b8251
共有 1 個文件被更改,包括 4 次插入6 次删除
  1. 4 6
      compiler/i8086/cgcpu.pas

+ 4 - 6
compiler/i8086/cgcpu.pas

@@ -1762,6 +1762,9 @@ unit cgcpu;
         { remove stackframe }
         { remove stackframe }
         if not nostackframe then
         if not nostackframe then
           begin
           begin
+            if (current_settings.x86memorymodel=mm_huge) and
+                not (po_interrupt in current_procinfo.procdef.procoptions) then
+              list.concat(Taicpu.Op_reg(A_POP,S_W,NR_DS));
             if (current_procinfo.framepointer=NR_STACK_POINTER_REG) then
             if (current_procinfo.framepointer=NR_STACK_POINTER_REG) then
               begin
               begin
                 stacksize:=current_procinfo.calc_stackframe_size;
                 stacksize:=current_procinfo.calc_stackframe_size;
@@ -1776,12 +1779,7 @@ unit cgcpu;
                   cg.a_op_const_reg(list,OP_ADD,OS_ADDR,stacksize,current_procinfo.framepointer);
                   cg.a_op_const_reg(list,OP_ADD,OS_ADDR,stacksize,current_procinfo.framepointer);
               end
               end
             else
             else
-              begin
-                if (current_settings.x86memorymodel=mm_huge) and
-                    not (po_interrupt in current_procinfo.procdef.procoptions) then
-                  list.concat(Taicpu.Op_reg(A_POP,S_W,NR_DS));
-                generate_leave(list);
-              end;
+              generate_leave(list);
             list.concat(tai_regalloc.dealloc(current_procinfo.framepointer,nil));
             list.concat(tai_regalloc.dealloc(current_procinfo.framepointer,nil));
           end;
           end;