* src/pic/gen.c (genFunction,genCall): drop "same code page"
authortecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 28 Oct 2006 16:01:37 +0000 (16:01 +0000)
committertecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 28 Oct 2006 16:01:37 +0000 (16:01 +0000)
  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

ChangeLog
src/pic/gen.c
src/pic/glue.c

index 9701a4e7e1d3cfd290dbe604fbba70eff3e802ca..79846934f9d9d6cd9063cd4e097599a1429edc8a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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:
index 652e84880a26e1e5d655a1fc54aa4ee85928f5fb..f76cb10159fc948066db853caf8f09f59b1235d8 100644 (file)
@@ -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);
index 7be245d5492cf0a6d10a2cc6dc2e8479c6a81576..a85c11b1695333b561da4318f73113543f269b1d 100644 (file)
@@ -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