Browse Source

* cleanup stack on i386 after call to fpc_psabi_begin_catch

git-svn-id: branches/debug_eh@41454 -
florian 6 years ago
parent
commit
77615cd3c0
1 changed files with 11 additions and 1 deletions
  1. 11 1
      compiler/psabiehpi.pas

+ 11 - 1
compiler/psabiehpi.pas

@@ -121,7 +121,11 @@ implementation
       parabase,paramgr,
       parabase,paramgr,
       hlcgobj,
       hlcgobj,
       pass_2,
       pass_2,
-      ncgflw;
+      ncgflw
+{$ifdef i386}
+      ,aasmcpu
+{$endif i386}
+      ;
 
 
 
 
     type
     type
@@ -616,6 +620,7 @@ implementation
             hlcg.a_load_reg_cgpara(list,voidpointertype,t.unwind_info,cgpara1);
             hlcg.a_load_reg_cgpara(list,voidpointertype,t.unwind_info,cgpara1);
             paramanager.freecgpara(list,cgpara1);
             paramanager.freecgpara(list,cgpara1);
             hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_resume',[@cgpara1],nil).resetiftemp;
             hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_resume',[@cgpara1],nil).resetiftemp;
+            { we do not have to clean up the stack, we never return }
             cgpara1.done;
             cgpara1.done;
 
 
             psabiehprocinfo.CreateNewPSABIEHCallsite(list);
             psabiehprocinfo.CreateNewPSABIEHCallsite(list);
@@ -708,6 +713,11 @@ implementation
         paramanager.getintparaloc(list, pd, 1, paraloc1);
         paramanager.getintparaloc(list, pd, 1, paraloc1);
         hlcg.a_load_reg_cgpara(list,voidpointertype,wrappedexception,paraloc1);
         hlcg.a_load_reg_cgpara(list,voidpointertype,wrappedexception,paraloc1);
         begincatchres:=hlcg.g_call_system_proc(list,pd,[@paraloc1],nil);
         begincatchres:=hlcg.g_call_system_proc(list,pd,[@paraloc1],nil);
+{$ifdef i386}
+        { fpc_psabi_begin_catch is cdecl, not sure how to do this properly }
+        current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_ADD,S_L,4,NR_ESP));
+{$endif i386}
+
         location_reset(exceptloc, LOC_REGISTER, def_cgsize(begincatchres.def));
         location_reset(exceptloc, LOC_REGISTER, def_cgsize(begincatchres.def));
         exceptloc.register:=hlcg.getaddressregister(list, begincatchres.def);
         exceptloc.register:=hlcg.getaddressregister(list, begincatchres.def);
         hlcg.gen_load_cgpara_loc(list, begincatchres.def, begincatchres, exceptloc, true);
         hlcg.gen_load_cgpara_loc(list, begincatchres.def, begincatchres, exceptloc, true);