From: tecodev Date: Sat, 28 Oct 2006 16:01:37 +0000 (+0000) Subject: * src/pic/gen.c (genFunction,genCall): drop "same code page" X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=d04afe0d4051267636aa2afb1d781eaa8d7be511;p=fw%2Fsdcc * 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 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4440 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 9701a4e7..79846934 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-10-28 Raphael Neider + + * 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 * device/lib/_putchar.c, device/lib/_getchar.c, device/lib/inituart.c: diff --git a/src/pic/gen.c b/src/pic/gen.c index 652e8488..f76cb101 100644 --- a/src/pic/gen.c +++ b/src/pic/gen.c @@ -69,6 +69,7 @@ for the next function. */ 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); @@ -2690,13 +2691,18 @@ static void genCall (iCode *ic) /* 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 */ @@ -2932,7 +2938,9 @@ static void genFunction (iCode *ic) #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); diff --git a/src/pic/glue.c b/src/pic/glue.c index 7be245d5..a85c11b1 100644 --- a/src/pic/glue.c +++ b/src/pic/glue.c @@ -301,6 +301,8 @@ pic14_constructAbsMap (FILE *ofile) 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