+2003-09-16 Erik Petrich <epetrich@ivorytower.norman.ok.us>
+
+ * src/mcs51/gen.c (genFunction, genEndFunction),
+ * src/ds390/gen.c (genFunction, genEndFunction): Moved save
+ and restore of EA so that stack offsets to parameters are
+ correct when using both critical and reentrant/stack-auto.
+ * src/z80/gen.c (aopOp): removed erroneous assertion about sloc
+ size (can be triggered in error if sloc is shared between
+ different sized objects)
+ * device/include/float.h: fixed macros to explicitly use
+ unsigned long where needed
+
2003-09-15 Bernhard Held <bernhard@bernhardheld.de>
Feature req. 799831: added code to allow nesting of critical functions
/* the following deal with IEEE single-precision numbers */
#define EXCESS 126
#define SIGNBIT ((unsigned long)0x80000000)
-#define HIDDEN (unsigned long)(1 << 23)
-#define SIGN(fp) ((fp >> (8*sizeof(fp)-1)) & 1)
-#define EXP(fp) (((fp) >> 23) & (unsigned int) 0x00FF)
+#define HIDDEN (unsigned long)(1ul << 23)
+#define SIGN(fp) (((unsigned long)(fp) >> (8*sizeof(fp)-1)) & 1)
+#define EXP(fp) (((unsigned long)(fp) >> 23) & (unsigned int) 0x00FF)
#define MANT(fp) (((fp) & (unsigned long)0x007FFFFF) | HIDDEN)
#define NORM 0xff000000
-#define PACK(s,e,m) ((s) | ((e) << 23) | (m))
+#define PACK(s,e,m) ((s) | ((unsigned long)(e) << 23) | (m))
float __uchar2fs (unsigned char);
float __schar2fs (signed char);
if (options.stack_probe)
emitcode ("lcall","__stack_probe");
- /* if critical function then turn interrupts off */
- if (IFFUNC_ISCRITICAL (ftype))
- {
- 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 */
emitcode ("add", "a,#!constbyte", ((char) sym->xstack & 0xff));
emitcode ("mov", "_spx,a");
}
+
+ /* if critical function then turn interrupts off */
+ if (IFFUNC_ISCRITICAL (ftype))
+ {
+ emitcode ("mov", "c,ea");
+ emitcode ("push", "psw"); /* save old ea via c in psw */
+ emitcode ("clr", "ea");
+ }
}
return;
}
+ if (IFFUNC_ISCRITICAL (sym->type))
+ {
+ emitcode ("pop", "psw"); /* restore ea via c in psw */
+ emitcode ("mov", "ea,c");
+ }
+
if ((IFFUNC_ISREENT (sym->type) || options.stackAuto) &&
(sym->stack || FUNC_HASSTACKPARM(sym->type))) {
if (!inExcludeList ("acc"))
emitcode ("pop", "acc");
- if (IFFUNC_ISCRITICAL (sym->type))
- {
- emitcode ("pop", "psw"); /* restore ea via c in psw */
- emitcode ("mov", "ea,c");
- }
-
/* if debug then send end of function */
if (options.debug && currFunc) {
_G.debugLine = 1;
}
else
{
- if (IFFUNC_ISCRITICAL (sym->type))
- {
- emitcode ("pop", "psw"); /* restore ea via c in psw */
- emitcode ("mov", "ea,c");
- }
-
if (IFFUNC_CALLEESAVES(sym->type))
{
int i;
return;
}
- /* if critical function then turn interrupts off */
- if (IFFUNC_ISCRITICAL (ftype))
- {
- 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 */
if (FUNC_REGBANK (ftype) != rbank)
emitcode ("add", "a,#0x%02x", ((char) sym->xstack & 0xff));
emitcode ("mov", "_spx,a");
}
-
+
+ /* if critical function then turn interrupts off */
+ if (IFFUNC_ISCRITICAL (ftype))
+ {
+ emitcode ("mov", "c,ea");
+ emitcode ("push", "psw"); /* save old ea via c in psw */
+ emitcode ("clr", "ea");
+ }
}
/*-----------------------------------------------------------------*/
emitcode(";", "naked function: no epilogue.");
return;
}
+
+ if (IFFUNC_ISCRITICAL (sym->type))
+ {
+ emitcode ("pop", "psw"); /* restore ea via c in psw */
+ emitcode ("mov", "ea,c");
+ }
if (IFFUNC_ISREENT (sym->type) || options.stackAuto)
{
if (!inExcludeList ("acc"))
emitcode ("pop", "acc");
- if (IFFUNC_ISCRITICAL (sym->type))
- {
- emitcode ("pop", "psw"); /* restore ea via c in psw */
- emitcode ("mov", "ea,c");
- }
-
/* if debug then send end of function */
if (options.debug && currFunc)
{
}
else
{
- if (IFFUNC_ISCRITICAL (sym->type))
- {
- emitcode ("pop", "psw"); /* restore ea via c in psw */
- emitcode ("mov", "ea,c");
- }
-
if (IFFUNC_CALLEESAVES(sym->type))
{
int i;
}
sym->aop = op->aop = aop =
aopForSym (ic, sym->usl.spillLoc, result, requires_a);
- wassertl (aop->size >= getSize (sym->type), "Operand doesn't fit in the spill location");
aop->size = getSize (sym->type);
return;
}