+2006-10-28 Raphael Neider <rneider AT web.de>
+
+ * src/pic/gen.c (genFunction,genCall): drop "same code page"
+ assumption within interrupt handlers, fixes #1584940
+ * src/pic/glue.c (pic14_constructAbsMap): mark absolute symbols as
+ "emitted" to avoid emitting them again in udata
+
2006-10-27 Jesus Calvino-Fraga <jesusc at ece.ubc.ca>
* device/lib/_putchar.c, device/lib/_getchar.c, device/lib/inituart.c:
*/
static int max_key=0;
static int GpsuedoStkPtr=0;
+static int pic14_inISR = 0;
pCodeOp *popGetImmd(char *name, unsigned int offset, int index,int is_func);
extern char *get_op( pCodeOp *pcop,char *buff,size_t buf_size);
/* make the call */
sym = OP_SYMBOL(IC_LEFT(ic));
name = sym->rname[0] ? sym->rname : sym->name;
- isExtern = IS_EXTERN(sym->etype);
+ isExtern = IS_EXTERN(sym->etype) || pic14_inISR;
if (isExtern) {
- emitpcode(POC_PAGESEL,popGetWithString(name,1)); /* Extern functions maybe on another page - must call pagesel */
+ /* Extern functions and ISRs maybe on a different page;
+ * must call pagesel */
+ emitpcode(POC_PAGESEL,popGetWithString(name,1));
}
emitpcode(POC_CALL,popGetWithString(name,isExtern));
if (isExtern) {
- emitpcode(POC_PAGESEL,popGetWithString("$",0)); /* May have returned from another page - must call pagesel to restore PCLATH before next goto or call instruction */
+ /* May have returned from a different page;
+ * must use pagesel to restore PCLATH before next
+ * goto or call instruction */
+ emitpcode(POC_PAGESEL,popGetWithString("$",0));
}
GpsuedoStkPtr=0;
/* if we need assign a result value */
#endif
/* if this is an interrupt service routine */
+ pic14_inISR = 0;
if (IFFUNC_ISISR(sym->type)) {
+ pic14_inISR = 1;
/* already done in pic14createInterruptVect() - delete me
addpCode2pBlock(pb,newpCode(POC_GOTO,newpCodeOp("END_OF_INTERRUPT+1",PO_STR)));
emitpcodeNULLop(POC_NOP);
if (getSize(sym->type) > size) {
size = getSize(sym->type);
}
+ addSet (&symbolsEmitted, (void *) sym->name);
+ addSet (&symbolsEmitted, (void *) sym->rname);
} // for
fprintf (ofile, "\tres\t%d\n", size);
} // if