X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=mark.h;h=2a6dbe90bf01bb049452dd183873738b2a92916e;hp=e53ae6583f373ec344bae61bf3ac310444256c6e;hb=60f204cb9e3905100da0d89f14bb40db764acd9e;hpb=1feb728a9eb579b6441daf0124d81483f600365c diff --git a/mark.h b/mark.h index e53ae65..2a6dbe9 100644 --- a/mark.h +++ b/mark.h @@ -1,7 +1,7 @@ // // RMAC - Reboot's Macro Assembler for the Atari Jaguar Console System // MARK.H - A record of things that are defined relative to any of the sections -// Copyright (C) 199x Landon Dyer, 2011 Reboot and Friends +// Copyright (C) 199x Landon Dyer, 2017 Reboot and Friends // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986 // Source utilised with the kind permission of Landon Dyer // @@ -10,20 +10,40 @@ #define __MARK_H__ #include "rmac.h" -#include "sect.h" -#define MARK_ALLOC_INCR 1024 // # bytes to alloc for more mark space -#define MIN_MARK_MEM (3 * sizeof(WORD) + 2 * sizeof(LONG)) +// A mark is of the form: +// .W section mark is relative to, and flags in upper byte +// .L location of mark in "from" section +// .W [from] new from section +// .L[L] [symbol] symbol involved in external reference (LL for 64-bit pointers) +#define MCHUNK struct _mchunk +MCHUNK { + MCHUNK * mcnext; // Next mark chunk + PTR mcptr; // Vector of marks + uint16_t mcalloc; // # marks allocted to mark block + uint16_t mcused; // # marks used in block +}; -// Globals, externals, etc. +#define MWORD 0x0000 // Marked word +#define MLONG 0x0100 // Marked long +#define MMOVEI 0x0200 // Mark RISC MOVEI instruction +#define MGLOBAL 0x0800 // Mark contains global +#define MPCREL 0x1000 // Mark is PC-relative +#define MCHEND 0x2000 // Indicates end of mark chunk +#define MSYMBOL 0x4000 // Mark includes symbol pointer +#define MCHFROM 0x8000 // Mark includes change-to-from + +// Exported variables extern MCHUNK * firstmch; // Exported functions void InitMark(void); void StopMark(void); -int rmark(uint16_t, uint32_t, uint16_t, uint16_t, SYM *); -int amark(void); -LONG bsdmarkimg(char *, LONG, LONG, int); +uint32_t MarkRelocatable(uint16_t, uint32_t, uint16_t, uint16_t, SYM *); +uint32_t AllocateMark(void); +uint32_t MarkImage(register uint8_t * mp, uint32_t siz, uint32_t tsize, int okflag); +uint32_t MarkBSDImage(uint8_t *, uint32_t, uint32_t, int); +uint32_t CreateELFRelocationRecord(uint8_t *, uint8_t *, uint16_t section); #endif // __MARK_H__