From: bernhardheld Date: Mon, 15 Sep 2003 09:50:16 +0000 (+0000) Subject: Feature request 799831: added code to allow nesting of critical functions X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=213736533bc2650af0ffbf544fafefe1aaa45ad4;p=fw%2Fsdcc Feature request 799831: added code to allow nesting of critical functions * src/mcs51/gen.c (genFunction, genEndFunction) * src/ds390/gen.c (genFunction, genEndFunction) git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2890 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 3795a8d8..95d26821 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-09-15 Bernhard Held + + Feature req. 799831: added code to allow nesting of critical functions + * src/mcs51/gen.c (genFunction, genEndFunction) + * src/ds390/gen.c (genFunction, genEndFunction) + 2003-09-14 Erik Petrich * src/SDCCsymt.c (sclsFromPtr), diff --git a/src/ds390/gen.c b/src/ds390/gen.c index 411e019f..c8cb2895 100644 --- a/src/ds390/gen.c +++ b/src/ds390/gen.c @@ -2899,7 +2899,11 @@ genFunction (iCode * ic) emitcode ("lcall","__stack_probe"); /* if critical function then turn interrupts off */ if (IFFUNC_ISCRITICAL (ftype)) - emitcode ("clr", "ea"); + { + emitcode ("mov", "c,ea"); + emitcode ("push", "psw"); /* save old ea via c in psw */ + emitcode ("clr", "ea"); + } /* here we need to generate the equates for the register bank if required */ @@ -3342,7 +3346,10 @@ genEndFunction (iCode * ic) emitcode ("pop", "acc"); if (IFFUNC_ISCRITICAL (sym->type)) - emitcode ("setb", "ea"); + { + emitcode ("pop", "psw"); /* restore ea via c in psw */ + emitcode ("mov", "ea,c"); + } /* if debug then send end of function */ if (options.debug && currFunc) { @@ -3362,7 +3369,10 @@ genEndFunction (iCode * ic) else { if (IFFUNC_ISCRITICAL (sym->type)) - emitcode ("setb", "ea"); + { + emitcode ("pop", "psw"); /* restore ea via c in psw */ + emitcode ("mov", "ea,c"); + } if (IFFUNC_CALLEESAVES(sym->type)) { diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index 531a7589..cb33e3ef 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -2293,7 +2293,11 @@ genFunction (iCode * ic) /* if critical function then turn interrupts off */ if (IFFUNC_ISCRITICAL (ftype)) - emitcode ("clr", "ea"); + { + emitcode ("mov", "c,ea"); + emitcode ("push", "psw"); /* save old ea via c in psw */ + emitcode ("clr", "ea"); + } /* here we need to generate the equates for the register bank if required */ @@ -2712,7 +2716,10 @@ genEndFunction (iCode * ic) emitcode ("pop", "acc"); if (IFFUNC_ISCRITICAL (sym->type)) - emitcode ("setb", "ea"); + { + emitcode ("pop", "psw"); /* restore ea via c in psw */ + emitcode ("mov", "ea,c"); + } /* if debug then send end of function */ if (options.debug && currFunc) @@ -2733,7 +2740,10 @@ genEndFunction (iCode * ic) else { if (IFFUNC_ISCRITICAL (sym->type)) - emitcode ("setb", "ea"); + { + emitcode ("pop", "psw"); /* restore ea via c in psw */ + emitcode ("mov", "ea,c"); + } if (IFFUNC_CALLEESAVES(sym->type)) {