X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=mark.c;h=ed76b4effc9116a5762d65bcbd4f9c73aab9d3bd;hp=0ca98f0f033c2e8b6773a3dc3497b0b6507a6bf1;hb=d0c28c349ddfb8393568037f68bddbe8979ce0df;hpb=9fb8931331db981c04e062a3ad36c0d79acb30ae diff --git a/mark.c b/mark.c index 0ca98f0..ed76b4e 100644 --- a/mark.c +++ b/mark.c @@ -3,13 +3,13 @@ // MARK.C - A record of things that are defined relative to any of the sections // Copyright (C) 199x Landon Dyer, 2011-2012 Reboot and Friends // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986 -// Source Utilised with the Kind Permission of Landon Dyer +// Source utilised with the kind permission of Landon Dyer // #include "mark.h" #include "error.h" #include "object.h" -#include "risca.h" +#include "riscasm.h" MCHUNK * firstmch; // First mark chunk @@ -17,16 +17,16 @@ MCHUNK * curmch; // Current mark chunk PTR markptr; // Deposit point in current mark chunk LONG mcalloc; // #bytes alloc'd to current mark chunk LONG mcused; // #bytes used in current mark chunk -uint16_t curfrom; // Current "from" section +uint16_t curfrom; // Current "from" section //#define DEBUG_IMAGE_MARKING // -// Initialize Marker +// Initialize marker // -void init_mark(void) +void InitMark(void) { firstmch = curmch = NULL; mcalloc = mcused = 0; @@ -37,7 +37,7 @@ void init_mark(void) // // Wrap up marker (called after final mark is made) // -void stopmark(void) +void StopMark(void) { if (curmch) { @@ -54,8 +54,9 @@ int rmark(uint16_t from, uint32_t loc, uint16_t to, uint16_t size, SYM * symbol) { #ifdef DEBUG_IMAGE_MARKING printf("rmark: from=%i, loc=$%X, to=$%X, size=$%x, symbol=$%X\n", from, loc, to, size, symbol); +if (symbol) + printf(" symbol->stype=$%02X, sattr=$%04X, sattre=$%08X, svalue=%i, sname=%s\n", symbol->stype, symbol->sattr, symbol->sattre, symbol->svalue, symbol->sname); #endif -// uint16_t w; if ((mcalloc - mcused) < MIN_MARK_MEM) amark(); @@ -212,8 +213,12 @@ printf(" validsegment: raddr = $%08X\n", raddr); else rflag = 0x00000040; // Absolute fixup +// This flag tells the linker to WORD swap the LONG when doing the fixup. if (w & MMOVEI) +//{ +//printf("bsdmarkimg: ORing $01 to rflag (MMOVEI) [symbol=%s]...\n", symbol->sname); rflag |= 0x00000001; +//} } // Compute mark position in relocation information; @@ -231,8 +236,14 @@ printf(" validsegment: raddr = $%08X\n", raddr); rflag |= 0x00000010; // Set external reloc flag bit rflag |= (symbol->senv << 8); // Put symbol index in flags +// Looks like this is completely unnecessary (considering it does the wrong thing!) +#if 0 if (symbol->sattre & RISCSYM) +{ +printf("bsdmarkimg: ORing $01 to rflag (RISCSYM) [symbol=%s]...\n", symbol->sname); rflag |= 0x00000001; +} +#endif if (validsegment) { @@ -275,7 +286,7 @@ printf(" validsegment(3): rflag = $%08X\n", rflag); { if (w & (DATA|BSS)) { - dp = objimage + BSDHDRSIZE + loc; + dp = objImage + BSDHDRSIZE + loc; diff = ((LONG)(*dp++ & 0xFF)) << 24; diff |= ((LONG)(*dp++ & 0xFF)) << 16; diff |= ((LONG)(*dp++ & 0xFF)) << 8; @@ -296,7 +307,7 @@ printf(" validsegment(4): diff = $%08X --> ", diff); if (rflag & 0x01) diff = ((diff >> 16) & 0x0000FFFF) | ((diff << 16) & 0xFFFF0000); - dp = objimage + BSDHDRSIZE + loc; + dp = objImage + BSDHDRSIZE + loc; *dp++ = (char)(diff >> 24); *dp++ = (char)(diff >> 16); *dp++ = (char)(diff >> 8);