summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3052b5e)
raw | patch | inline | side by side (parent: 3052b5e)
author | Raghu Nambiath <rnambiath@ti.com> | |
Fri, 5 Nov 2010 19:15:23 +0000 (15:15 -0400) | ||
committer | Sandeep Paulraj <s-paulraj@ti.com> | |
Fri, 5 Nov 2010 22:28:32 +0000 (18:28 -0400) |
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
src/driver/nand/nflashlay.h.old | [deleted file] | patch | blob | history |
src/driver/stream/stream_orig.c | [deleted file] | patch | blob | history |
src/hw/macs/cpmac/cpmacdrv.orig.c | [deleted file] | patch | blob | history |
src/interp/coff/cload.mike.c | [deleted file] | patch | blob | history |
src/interp/coff/cload.mike.h | [deleted file] | patch | blob | history |
src/interp/coff/coff.mike.h | [deleted file] | patch | blob | history |
src/interp/coff/coff_trg.mike.h | [deleted file] | patch | blob | history |
src/interp/coff/coffdefs.mike.h | [deleted file] | patch | blob | history |
src/make/ibl_c6455/ibl_c6455.out.ept | [deleted file] | patch | blob | history |
diff --git a/src/driver/nand/nflashlay.h.old b/src/driver/nand/nflashlay.h.old
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _NAND_FLASH_LAYOUT_H
-#define _NAND_FLASH_LAYOUT_H
-/*******************************************************************************************
- * FILE PURPOSE: Define values associated with the nand flash layout
- *******************************************************************************************
- * FILE NAME: nflashlay.h
- *
- * DESCRIPTION: The nand flash layout is defined
- *
- * @file nflashlay.h
- *
- * @brief
- * The nand flash layout is defined
- *
- ********************************************************************************************/
-
-#define APP_MAGIC_NUM 0xa1aced11
-#define BAD_BLOCK_MAGIC_NUM 0xa1aced00
-
-
-
-#endif /* _NAND_FLASH_LAYOUT_H */
-
-
-
-
-
diff --git a/src/driver/stream/stream_orig.c b/src/driver/stream/stream_orig.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/**
- * @file stream.c
- *
- * @brief
- * The file implements the STREAM module.
- *
- * \par
- * NOTE:
- * (C) Copyright 2008, Texas Instruments, Inc.
- *
- * \par
- */
-
-
-/**********************************************************************
- ************************** Local Structures **************************
- **********************************************************************/
-#include "types.h"
-#include "iblcfg.h"
-#include <string.h>
-
-/**
- * @brief
- * The structure describes the Stream Master Control block.
- *
- * @details
- * The structure stores information about the stream module
- * internal buffers and state information.
- */
-typedef struct STREAM_MCB
-{
- /**
- * @brief Flag which indicates if the stream buffer is open or not?
- */
- Bool is_open;
-
- /**
- * @brief This is the *internal* stream buffer.
- */
- Uint8 buffer[MAX_SIZE_STREAM_BUFFER];
-
- /**
- * @brief This is the read index from where data is read.
- */
- Int32 read_idx;
-
- /**
- * @brief This is the write index to which data is written.
- */
- Int32 write_idx;
-
- /**
- * @brief This is the free size available in the internal buffer.
- */
- Int32 free_size;
-}STREAM_MCB;
-
-/**********************************************************************
- ************************** Global Variables **************************
- **********************************************************************/
-
-/**
- * @brief This is the STREAM Master control block which keeps track
- * of all the stream module information.
- */
-STREAM_MCB stream_mcb;
-
-/**********************************************************************
- ************************** Stream Functions **************************
- **********************************************************************/
-
-/**
- * @b Description
- * @n
- * The function is called to open the stream module
- *
- * @param[in] chunk_size
- * Maximum amount of data that can be received at any
- * instant by the boot module.
- *
- * @retval
- * Success - 0
- * @retval
- * Error - <0
- */
-Int32 stream_open (Uint32 chunk_size)
-{
- /* Basic Validations: Ensure that the chunk size is not greater
- * than the internal buffer size. */
- if (chunk_size > MAX_SIZE_STREAM_BUFFER)
- return -1;
-
- /* Initialize the Master control block. */
- stream_mcb.is_open = TRUE;
- stream_mcb.read_idx = 0;
- stream_mcb.write_idx = 0;
- stream_mcb.free_size = MAX_SIZE_STREAM_BUFFER;
-
- /* Module has been initialized. */
- return 0;
-}
-
-/**
- * @b Description
- * @n
- * The function is called to read data from the stream module.
- *
- * @param[in] ptr_data
- * Pointer to the data buffer where the data will be copied to.
- * @param[in] num_bytes
- * Number of bytes to be read.
- *
- * @retval
- * Success - Number of bytes actually read
- * @retval
- * Error - <0
- */
-Int32 stream_read (Uint8* ptr_data, Int32 num_bytes)
-{
- Int32 index;
- Int32 num_bytes_to_read;
-
- /* Determine the number of bytes which can be read. */
- if (num_bytes > (MAX_SIZE_STREAM_BUFFER - stream_mcb.free_size))
- {
- /* User has requested more data than what is available. In this case we
- * can return only what we have. */
- num_bytes_to_read = (MAX_SIZE_STREAM_BUFFER - stream_mcb.free_size);
- }
- else
- {
- /* User has requested less data than what is available. In this case we
- * return only what the user wants. */
- num_bytes_to_read = num_bytes;
- }
-
- /* There is data available copy it from the internal to the user supplied buffer. */
- for (index = 0; index < num_bytes_to_read; index++)
- {
- /* Copy the data to the "write" index. */
- *(ptr_data + index) = *(stream_mcb.buffer + stream_mcb.read_idx);
-
- /* Increment the read index. */
- stream_mcb.read_idx = (stream_mcb.read_idx + 1) % MAX_SIZE_STREAM_BUFFER;
- }
-
- /* Once data has been copied; increment the free size accordingly */
- stream_mcb.free_size = stream_mcb.free_size + num_bytes_to_read;
-
- /* Return the number of bytes read. */
- return num_bytes_to_read;
-}
-
-/**
- * @b Description
- * @n
- * The function is called to write data to the stream
- * module.
- *
- * @param[in] ptr_data
- * Pointer to the data buffer which contains the data to be copied.
- * @param[in] num_bytes
- * Number of bytes being written
- *
- * @retval
- * Success - 0
- * @retval
- * Error - <0
- */
-Int32 stream_write (Uint8* ptr_data, Int32 num_bytes)
-{
- Int32 index;
-
- /* Basic Validations: Ensure there is sufficient space to copy the data. */
- if (num_bytes > stream_mcb.free_size)
- return -1;
-
- /* Basic Validations: Make sure the pointers are valid. */
- if (ptr_data == NULL)
- return -1;
-
- /* There was sufficient space to copy the data lets do so but we copy byte by byte
- * since the internal buffer is circular and we can wrap around... */
- for (index = 0; index < num_bytes; index++)
- {
- /* Copy the data to the "write" index. */
- *(stream_mcb.buffer + stream_mcb.write_idx) = *(ptr_data + index);
-
- /* Increment the write index. */
- stream_mcb.write_idx = (stream_mcb.write_idx + 1) % MAX_SIZE_STREAM_BUFFER;
- }
-
- /* Once data has been copied; decrement the free size accordingly */
- stream_mcb.free_size = stream_mcb.free_size - num_bytes;
- return 0;
-}
-
-/**
- * @b Description
- * @n
- * The function is used to check if the stream buffers are empty or
- * not?
- *
- * @retval
- * Empty - TRUE
- * @retval
- * Not Empty - FALSE
- */
-Bool stream_isempty (void)
-{
- /* Check the number of free bytes available? */
- if (stream_mcb.free_size == MAX_SIZE_STREAM_BUFFER)
- return TRUE;
-
- /* There is data in the stream buffer; so its not empty. */
- return FALSE;
-}
-
-/**
- * @b Description
- * @n
- * The function closes the stream module.
- *
- * @retval
- * Not Applicable.
- */
-void stream_close (void)
-{
- /* The stream module is no longer open... */
- stream_mcb.is_open = FALSE;
- return;
-}
-
-/**
- * @b Description
- * @n
- * The function initializes the stream module.
- *
- * @retval
- * Not Applicable.
- */
-void stream_init (void)
-{
- /* Reset the memory contents. */
- memset ((void *)&stream_mcb, 0, sizeof(STREAM_MCB));
-
- /* Make sure we initialize the free size correctly. */
- stream_mcb.free_size = MAX_SIZE_STREAM_BUFFER;
- return;
-}
-
diff --git a/src/hw/macs/cpmac/cpmacdrv.orig.c b/src/hw/macs/cpmac/cpmacdrv.orig.c
+++ /dev/null
@@ -1,392 +0,0 @@
-/**
- * @file cpmacdrv.c
- *
- * @brief
- * The driver is written for the CPMAC Ethernet controller. It follows
- * the Network Boot Module Ethernet Driver Specifications.
- *
- * If there are modifications to this driver required for it to work
- * on the specific device then device authors are recommended to
- * create a copy of this file in the RBL directory and do the
- * necessary modifications. Please pass on the appropriate information
- * to the ROM Boot Loader Framework Development Team.
- *
- * \par
- * NOTE:
- * (C) Copyright 2008, Texas Instruments, Inc.
- * \par
- */
-#include "types.h"
-#include "iblloc.h"
-#include "device.h"
-#include "net.h"
-#include "cpmac_regs.h"
-#include <string.h>
-
-
-/**********************************************************************
- ************************** Local Definitions *************************
- **********************************************************************/
-
-// Packet Flags for TX and RX
-#define EMAC_DSC_FLAG_SOP 0x80000000u
-#define EMAC_DSC_FLAG_EOP 0x40000000u
-#define EMAC_DSC_FLAG_OWNER 0x20000000u
-#define EMAC_DSC_FLAG_EOQ 0x10000000u
-#define EMAC_DSC_FLAG_TDOWNCMPLT 0x08000000u
-#define EMAC_DSC_FLAG_PASSCRC 0x04000000u
-
-// The following flags are RX only
-#define EMAC_DSC_FLAG_JABBER 0x02000000u
-#define EMAC_DSC_FLAG_OVERSIZE 0x01000000u
-#define EMAC_DSC_FLAG_FRAGMENT 0x00800000u
-#define EMAC_DSC_FLAG_UNDERSIZED 0x00400000u
-#define EMAC_DSC_FLAG_CONTROL 0x00200000u
-#define EMAC_DSC_FLAG_OVERRUN 0x00100000u
-#define EMAC_DSC_FLAG_CODEERROR 0x00080000u
-#define EMAC_DSC_FLAG_ALIGNERROR 0x00040000u
-#define EMAC_DSC_FLAG_CRCERROR 0x00020000u
-#define EMAC_DSC_FLAG_NOMATCH 0x00010000u
-
-/**********************************************************************
- ************************** Local Structures **************************
- **********************************************************************/
-
-/**
- * @brief
- * The structure describes the EMAC Descriptor.
- *
- * @details
- * Ethernet drivers receives and transmits data through the descriptor
- * object described here.
- */
-typedef struct _EMAC_Desc
-{
- /**
- * @brief Pointer to next descriptor in chain
- */
- struct _EMAC_Desc* pNext;
-
- /**
- * @brief Pointer to the data buffer.
- */
- Uint8* pBuffer;
-
- /**
- * @brief Buffer Offset(MSW) and Length(LSW)
- */
- Uint32 BufOffLen;
-
- /**
- * @brief Packet Flags(MSW) and Length(LSW)
- */
- volatile Uint32 PktFlgLen;
-}EMAC_Desc;
-
-/**
- * @brief
- * The structure describes the EMAC Master Control Block.
- *
- * @details
- * The structure stores information required by the EMAC Driver;
- * which includes the Receive and Transmit Buffer Descriptors.
- */
-typedef struct EMAC_MCB
-{
- /**
- * @brief Pointer to the Receive Buffer Descriptor
- */
- EMAC_Desc* rx_bd;
-
- /**
- * @brief Pointer to the Transmit Buffer Descriptor
- */
- EMAC_Desc* tx_bd;
-
- /**
- * @brief Buffer for receiving data linked with the receive
- * buffer descriptor.
- */
- Uint8 rx_buffer[NET_MAX_MTU];
-}EMAC_MCB;
-
-/**********************************************************************
- ************************** Global Variables **************************
- **********************************************************************/
-
-/**
- * @brief Global Driver structure which keeps track of all the Ethernet
- * Driver related information.
- */
-EMAC_MCB emacMCB;
-
-/**
- * @brief EMAC Registers.
- */
-CPMAC_REGS* ptr_EMACRegs = (CPMAC_REGS *)EMAC_BASE_ADDRESS;
-
-/**********************************************************************
- ************************** ETHDRV Functions **************************
- **********************************************************************/
-
-/**
- * @b Description
- * @n
- * This is the Network Open API which is registered with the
- * NET Boot module to initialize the Ethernet device.
- *
- * @param[in] ptr_device
- * Pointer to the NET Device structure which is being opened.
- *
- * @retval
- * Success - 0
- * @retval
- * Error - <0
- */
-Int32 cpmac_drv_start (NET_DRV_DEVICE* ptr_device)
-{
- Uint32 tmpval;
- volatile Uint32* pRegAddr;
- Int32 index;
- EMAC_Desc* pDesc;
-
- /* Reset EMAC */
- ptr_EMACRegs->SOFTRESET = 0x1;
- while (ptr_EMACRegs->SOFTRESET != 0x0);
-
- /* Reset MAC Control */
- ptr_EMACRegs->MACCONTROL = 0;
-
- /* Must manually init HDPs to NULL */
- pRegAddr = &ptr_EMACRegs->TX0HDP;
- for( index=0; index<8; index++ )
- *pRegAddr++ = 0;
- pRegAddr = &ptr_EMACRegs->RX0HDP;
- for( index=0; index<8; index++ )
- *pRegAddr++ = 0;
-
- /* Initialize the RAM locations */
- for (index = 0; index < 32; index++)
- {
- ptr_EMACRegs->MACINDEX = index;
- ptr_EMACRegs->MACADDRHI = 0;
- ptr_EMACRegs->MACADDRLO = 0;
- }
-
- /* Setup device MAC address */
- ptr_EMACRegs->MACINDEX = 0x0;
-
- /* Configure the MAC Address into the EMAC Controller. */
- tmpval = 0;
- for( index=3; index>=0; index-- )
- tmpval = (tmpval<<8) | *(ptr_device->mac_address+index);
- ptr_EMACRegs->MACADDRHI = tmpval;
- tmpval = *(ptr_device->mac_address+5);
- ptr_EMACRegs->MACADDRLO = CPMAC_MACADDRLO_VALID | CPMAC_MACADDRLO_MATCHFILT |
- (tmpval<<8) | *(ptr_device->mac_address+4);
-
- /* For us buffer offset will always be zero */
- ptr_EMACRegs->RXBUFFEROFFSET = 0;
-
- /* Reset RX (M)ulticast (B)roadcast (P)romiscuous Enable register */
- ptr_EMACRegs->RXMBPENABLE = 0;
- ptr_EMACRegs->MACHASH1 = 0;
- ptr_EMACRegs->MACHASH2 = 0;
-
- /* Clear Unicast RX on channel 0-7 */
- ptr_EMACRegs->RXUNICASTCLEAR = 0xFF;
-
- /* Make sure there are none of the interrupts are enabled. */
- ptr_EMACRegs->RXINTMASKCLEAR = 0xFF;
- ptr_EMACRegs->TXINTMASKCLEAR = 0xFF;
- ptr_EMACRegs->MACINTMASKCLEAR = 0x0;
-
- /* Setup the receive buffer descriptors. */
- pDesc = (EMAC_Desc *)_EMAC_DSC_BASE_ADDR;
-
- /* Initialize the receive buffer descriptor. */
- pDesc->pNext = 0;
- pDesc->pBuffer = &emacMCB.rx_buffer[0];
- pDesc->BufOffLen = NET_MAX_MTU;
- pDesc->PktFlgLen = EMAC_DSC_FLAG_OWNER;
-
- /* Store this buffer descriptor in the global EMAC MCB */
- emacMCB.rx_bd = pDesc;
-
- /* Get the transmit buffer descriptor; it comes right after the receive BD. */
- pDesc = pDesc + 1;
-
- /* Initialize the transmit buffer descriptor. */
- pDesc->pNext = 0;
- pDesc->pBuffer = 0;
- pDesc->BufOffLen = 0;
- pDesc->PktFlgLen = 0;
-
- /* Store this buffer descriptor in the global EMAC MCB */
- emacMCB.tx_bd = pDesc;
-
-#ifdef EMAC_CACHE_SUPPORT
- /* Writeback the EMAC MCB Information to the PHYSICAL Memory.
- * This is required because the buffer in the cache will always be
- * invalidated on the RECEIVE; if the buffer is not aligned on the
- * CACHE Line then it will result in the RX & TX BD in the structure
- * to also get invalidated to what resides in the PHYSICAL memory.
- * But if we have written back the structure here then the PHYSICAL
- * and CACHE are one and the same as far as the BD's are concerned. */
- Cache_wbL2((void *)&emacMCB, sizeof(emacMCB));
-#endif
-
- /* Enable the receive and transmit. */
- ptr_EMACRegs->TXCONTROL = 0x1;
- ptr_EMACRegs->RXCONTROL = 0x1;
-
- /* Initialize the MAC Control: We set the Receive Ownership Bit and the Receive
- * Offset Length Word and enable the MII. */
- ptr_EMACRegs->MACCONTROL = CPMAC_MACCONTROL_RXOWNERSHIP |
- CPMAC_MACCONTROL_RXOFFLENBLOCK |
- CPMAC_MACCONTROL_MIIEN;
-
- /* Startup RX */
- ptr_EMACRegs->RX0HDP = (Uint32)emacMCB.rx_bd;
-
- /* Enable receive filters for channel 1 and all broadcast packets. */
- ptr_EMACRegs->RXUNICASTSET = 1;
- ptr_EMACRegs->RXMBPENABLE = CPMAC_RXMBPENABLE_RXBROADEN;
-
- /* Initialize the Device MDIO layer: The function returns only when
- * the LINK is UP and RUNNING. */
- if (dev_mdio_open () < 0)
- return -1;
-
- /* Debug Message: */
- mprintf ("DEBUG: Ethernet Link is UP \n");
-
- /* Hardware is up and running. */
- return 0;
-}
-
-/**
- * @b Description
- * @n
- * This is the Network Send API which is registered with the NET boot module
- * to send out packets.
- *
- * @param[in] ptr_device
- * Pointer to the network interface descriptor object.
- * @param[in] buffer
- * Pointer to the packet which is to be transmitted.
- * @param[in] num_bytes
- * Length of the packet which is transmitted.
- *
- * @retval
- * Success - Number of bytes transmitted.
- * @retval
- * Error - <0
- */
-Int32 cpmac_drv_send (NET_DRV_DEVICE* ptr_device, Uint8* buffer, int num_bytes)
-{
- volatile EMAC_Desc* pDesc;
-
- /* Ensure the minimum ethernet size is sent out. */
- if (num_bytes < 64)
- num_bytes = 64;
-
-#ifdef EMAC_CACHE_SUPPORT
- /* Clean the cache for external addesses */
- Cache_wbL2((void *)buffer, num_bytes);
-#endif
-
- /* Get the pointer to the transmit buffer descriptor. */
- pDesc = emacMCB.tx_bd;
-
- /* Fill out the transmit buffer descriptor */
- pDesc->pNext = 0;
- pDesc->pBuffer = buffer;
- pDesc->BufOffLen = num_bytes;
- pDesc->PktFlgLen = EMAC_DSC_FLAG_SOP | EMAC_DSC_FLAG_EOP | num_bytes | EMAC_DSC_FLAG_OWNER;
-
- /* Send the packet out. */
- ptr_EMACRegs->TX0HDP = (Uint32)pDesc;
-
- /* Loop around till the transmission is complete. */
- pDesc = (EMAC_Desc *)ptr_EMACRegs->TX0CP;
- while (pDesc->PktFlgLen & EMAC_DSC_FLAG_OWNER);
-
- /* The packet has been successfully transmitted. */
- return num_bytes;
-}
-
-/**
- * @b Description
- * @n
- * This is the Network Receive API which is registered with the NET boot module
- * to receive packets.
- *
- * @param[in] ptr_device
- * Pointer to the network interface descriptor object.
- * @param[out] buffer
- * Pointer to the packet which is populated with the received data
- *
- * @retval
- * Success - Number of bytes received.
- * @retval
- * Error - <0
- */
-Int32 cpmac_drv_receive (NET_DRV_DEVICE* ptr_device, Uint8* buffer)
-{
- Int32 bytes_received = 0;
- EMAC_Desc* pDesc;
-
- /* Initialize the number of bytes received. */
- bytes_received = 0;
-
- /* Read the completion register. We know for sure if the SOP flag is set then
- * a packet has been received and needs to be picked up from the controller. */
- pDesc = (EMAC_Desc *)ptr_EMACRegs->RX0CP;
- if (pDesc->PktFlgLen & EMAC_DSC_FLAG_SOP)
- {
- /* Acknowledge that the descriptor has been processed. */
- ptr_EMACRegs->RX0CP = (Uint32)pDesc;
-
-#ifdef EMAC_CACHE_SUPPORT
- /* External Memory Support: Invalidate the cache. */
- Cache_invL2((void *)(pDesc->pBuffer), NET_MAX_MTU);
-#endif
- /* Remember the number of bytes received. */
- bytes_received = (pDesc->PktFlgLen & 0xFFFF);
-
- /* The descriptor is now free to receive more data. Set the status accordingly. */
- pDesc->BufOffLen = NET_MAX_MTU;
- pDesc->PktFlgLen = EMAC_DSC_FLAG_OWNER;
-
- /* Copy the data from the descriptor buffer to the supplied buffer. */
- memcpy((void *)buffer, (void *)pDesc->pBuffer, bytes_received);
-
- /* Put this descriptor back to the HDP. */
- ptr_EMACRegs->RX0HDP = (Uint32)pDesc;
- }
-
- /* Return the number of bytes received. */
- return bytes_received;
-}
-
-/**
- * @b Description
- * @n
- * This is the Network Close API which is registered with the NET boot module
- * to close and shutdown the Ethernet controller.
- *
- * @param[in] ptr_device
- * Pointer to the network interface descriptor object.
- *
- * @retval
- * Success - 0
- * @retval
- * Error - <0
- */
-Int32 cpmac_drv_stop (NET_DRV_DEVICE* ptr_device)
-{
- return 0;
-}
-
-
diff --git a/src/interp/coff/cload.mike.c b/src/interp/coff/cload.mike.c
+++ /dev/null
@@ -1,2122 +0,0 @@
-/***************************************************************************
-* FILENAME: cload.c
-* VERSION: 2.6 5/2/96 13:11:03
-* SCCS ID: "@(#)cload.c 2.6 5/2/96"
-***************************************************************************/
-/******************************************************************************/
-/* CLOAD.C - Generic COFF Loader Version 6.00 4/96 */
-/******************************************************************************/
-/* */
-/* This module contains functions to read in and load a COFF object file. */
-/* The following routines are defined here: */
-/* */
-/* cload() - Main driver for COFF loader. */
-/* cload_headers() - Read in the various headers of the COFF file. */
-/* cload_data() - Read in the raw data and load it into memory. */
-/* cload_sect_data() - Read, relocate, and write out one section. */
-/* cload_cinit() - Process one buffer of C initialization records. */
-/* cload_symbols() - Read in the symbol table. */
-/* cload_strings() - Read in the string table. */
-/* str_free() - Free a string table. */
-/* sym_read() - Read and relocate a symbol and its aux entry. */
-/* sym_name() - Return a pointer to the name of a symbol. */
-/* sym_add_name() - Add a symbol name to the string table. */
-/* reloc_add() - Add a symbol to the relocation symbol table. */
-/* relocate() - Perform a single relocation. */
-/* reloc_read() - Read in and swap one relocation entry. */
-/* reloc_size() - Return the field size of a relocation type. */
-/* reloc_offset() - Return the field offset of a relocation type. */
-/* reloc_stop() - Return the number of bits to read for a reloc type. */
-/* sym_reloc_amount()- Return relocation amount for a relocation entry. */
-/* unpack() - Extract a relocation field from object bytes. */
-/* repack() - Encode a relocated field into object bytes. */
-/* cload_lineno() - Read in & swap line number entries. */
-/* swap4byte() - Swap the order of bytes in a int. */
-/* swap2byte() - Swap the order of bytes in a short. */
-/* */
-/* The loader calls the following external functions to perform application */
-/* specific tasks: */
-/* */
-/* set_reloc_amount() - Define relocation amounts for each section. */
-/* mem_write() - Load a buffer of data into memory. */
-/* lookup_sym() - Look up a symbol in an external symbol table. */
-/* load_syms() - Build the symbol table for the application. */
-/* load_msg() - Write diagnostic messages during loading. */
-/* */
-/******************************************************************************/
-#include "types.h"
-#include "ibl.h"
-#include "iblloc.h"
-#include "iblcfg.h"
-#include "coff.h"
-#include "coff_trg.h"
-#include "cload.h"
-#include <string.h>
-
-#if (FILE_BASED)
-#include <stdio.h>
-#endif
-/*----------------------------------------------------------------------------*/
-/* CONSTANTS, MACROS, VARIABLES, AND STRUCTURES FOR THE LOADER. */
-/*----------------------------------------------------------------------------*/
-#define MIN(a,b) ((a)<(b)?(a):(b))
-#define MAX(a,b) ((a)>(b)?(a):(b))
-
-#define TRUE 1
-#define FALSE 0
-#define WORDSZ sizeof(T_DATA) /* SIZE OF DATA UNITS IN OBJ FILE */
-
-#ifdef TMS320C60
- extern int target_coff (unsigned short flags);
-#endif
-
-/*----------------------------------------------------------------------------*/
-/* APPLICATION VARIABLES */
-/*----------------------------------------------------------------------------*/
-#if (FILE_BASED)
-FILE *fin; /* INPUT FILE */
-#else
-/* extern unsigned char gRxBuffer[0x400040]; */
-extern unsigned char gRxBuffer[0x10];
-#endif
-
-unsigned char gRxBuffer[0x10];
-
-
-int need_data = TRUE; /* APPLICATION NEEDS RAW DATA */
-int need_symbols = FALSE; /* APPLICATION NEEDS SYMBOL TABLE */
-int clear_bss = FALSE; /* CLEAR BSS SECTION */
-
-
-/*----------------------------------------------------------------------------*/
-/* FILL VALUES TO BE USED BY LOADERS */
-/*----------------------------------------------------------------------------*/
-#if defined(OTIS)
-extern int fill_bss;
-extern int fill_bss_value;
-#else
-#define fill_bss 0
-#define fill_bss_value 0
-#endif
-
-/*----------------------------------------------------------------------------*/
-/* LOADER VARIABLES */
-/*----------------------------------------------------------------------------*/
-FILHDR file_hdr; /* FILE HEADER STRUCTURE */
-int coff_version; /* COFF VERSION USED IN FILE */
-AOUTHDR o_filehdr; /* OPTIONAL (A.OUT) FILE HEADER */
-T_ADDR entry_point; /* ENTRY POINT OF MODULE */
-T_ADDR *reloc_amount = NULL; /* AMOUNT OF RELOCATION PER SECTION */
-int n_sections; /* NUMBER OF SECTIONS IN THE FILE */
-int big_e_target; /* TARGET DATA IN BIG-ENDIAN FORMAT */
-int byte_swapped; /* BYTE ORDERING OPPOSITE OF HOST */
-int curr_sect; /* SECTION NUMBER CURRENTLY LOADING */
-int load_err; /* ERROR CODE RETURNED IF LOADER FAILS*/
-struct strtab *str_head = NULL; /* LIST OF STRING TABLE BUFFERS */
-
-static T_SIZE init_size = 0; /* CURRENT SIZE OF C INITIALIZATION */
-static int need_reloc; /* RELOCATION REQUIRED */
-
-
-int n_array_sections; /* The number of sections in sect_hdrs */
-
-SCNHDR sect_hdrs[MAX_COFF_SECTION_HEADERS]; /* Array of loadable sections */
-O_SCNHDR o_sect_hdrs; /* A single old section header */
-
-unsigned int paBuf[LOADBUFSIZE]; /* Temp buffer for packet load */
-
-int stream_offset; /* The current stream offset */
-
-
-#if TMS320C60
-int big_e_config = TRG_DEF_BIG_E; /* ENDIANNESS CONFIGURATION */
-#else
-int big_e_config = DONTCARE; /* ENDIANNESS CONFIGURATION */
-#endif
-
-/*----------------------------------------------------------------------------*/
-/* THIS STRUCTURE IS USED TO STORE THE RELOCATION AMOUNTS FOR SYMBOLS. */
-/* EACH RELOCATABLE SYMBOL HAS A CORRESPONDING ENTRY IN THIS TABLE. */
-/* THE TABLE IS SORTED BY SYMBOL INDEX; LOOKUP USES A BINARY SEARCH. */
-/*----------------------------------------------------------------------------*/
-typedef struct
-{
- int rt_index; /* INDEX OF SYMBOL IN SYMBOL TABLE */
- int rt_disp; /* AMOUNT OF RELOCATION */
-} RELOC_TAB;
-
-/*----------------------------------------------------------------------------*/
-/* THE RELOCATION SYMBOL TABLE IS ALLOCATED DYNAMICALLY, AND REALLOCATED */
-/* AS MORE SPACE IS NEEDED. */
-/*----------------------------------------------------------------------------*/
-#define RELOC_TAB_START 128 /* STARTING SIZE OF TABLE */
-#define RELOC_GROW_SIZE 128 /* REALLOC AMOUNT FOR TABLE */
-
-static RELOC_TAB *reloc_tab = NULL; /* RELOCATION SYMBOL TABLE */
-
-static int reloc_tab_size; /* CURRENT ALLOCATED AMOUNT */
-static int reloc_sym_index; /* CURRENT SIZE OF TABLE */
-
-/*----------------------------------------------------------------------------*/
-/* RUN-TIME RELOCATION (AS OPPOSED TO LOAD-TIME) RELOCATION IS DETERMINED */
-/* AS FOLLOWS: IF THE SECTION'S RUNTIME ADDRESS == LOADTIME ADDRESS, USE */
-/* LOADTIME RELOCATION. OTHERWISE, ASSUME LOADTIME RELOC ONLY (RUNTIME RELOC */
-/* == 0). */
-/*----------------------------------------------------------------------------*/
-#define RUN_RELOC_AMOUNT(i) ((SECT_HDR(i)->s_paddr == SECT_HDR(i)->s_vaddr) ? \
- reloc_amount[i] : 0)
-
-/*----------------------------------------------------------------------------*/
-/* DEFINE A STRUCTURE FOR STRING TABLE BUFFERS. THESE BUFFERS ARE STORED */
-/* AS A LINKED LIST OF MEMORY PACKETS, EACH CONTAINING UP TO 64K OF THE */
-/* STRING TABLE. */
-/*----------------------------------------------------------------------------*/
-typedef struct strtab
-{
- unsigned int size; /* SIZE OF THIS PACKET */
- unsigned int offset; /* STARTING OFFSET OF THIS PACKET */
- unsigned int index; /* AMOUNT CURRENTLY FILLED */
- struct strtab *next; /* NEXT BUFFER */
- char buf[1]; /* STRING DATA (EXPAND AS ALLOCATED) */
-} STRTAB;
-
-#define MAX_STRING_ALLOC (unsigned int)(0xffff-sizeof(STRTAB)+1)
- /* MAX STRING BUFFER: 64K (SMALL HOSTS)*/
-#define MIN_STRING_ALLOC 0x0400 /* MIN STRING BUFFER: 1K */
-
-unsigned int unpack();
-
-/* extern void mem_copy(unsigned char* dst, unsigned char* src, int nbytes); */
-#define mem_copy(dest,src,nbytes) memcpy((void *)(dest),(void *)(src),nbytes)
-#define mem_write(buf, nbytes, addr, page) memcpy((void *)(addr),(void *)(buf),nbytes)
-#define str_comp strcmp
-/******************************************************************************/
-/* */
-/* CLOAD() - Main driver for COFF loader. */
-/* */
-/******************************************************************************/
-int cload(BOOT_MODULE_FXN_TABLE *bootFxn, Uint32 *ientry_point)
-{
- int result;
-
- load_err = 0;
- stream_offset = 0;
- result = cload_headers(bootFxn, ientry_point) && cload_data(bootFxn);
-
- if (reloc_tab) free(reloc_tab);
- reloc_tab = NULL;
-
- if(result == TRUE)
- return 0;
- else {
- *ientry_point = 0;
- return -1;
- }
-}
-
-\f
-/******************************************************************************/
-/* */
-/* CLOAD_HEADERS() - Read in the various headers of the COFF file. */
-/* */
-/******************************************************************************/
-int cload_headers(BOOT_MODULE_FXN_TABLE *bootFxn, Uint32 *ientry_point)
-{
- int i;
-
- byte_swapped = FALSE;
- need_reloc = FALSE;
-
- *ientry_point = NULL; /* Error return value */
-
- if ((*bootFxn->read)((Uint8 *)&file_hdr, FILHSZ) < 0)
- return (FALSE);
- stream_offset += FILHSZ;
-
-
- /*-------------------------------------------------------------------------*/
- /* MAKE SURE THIS IS REALLY A COFF FILE. CHECK FOR SWAPPED FILES. */
- /* DETERMINE BYTE ORDERING OF OBJECT DATA. */
- /*-------------------------------------------------------------------------*/
- if (!ISCOFF(file_hdr.f_magic))
- {
- swap2byte(&file_hdr.f_magic);
-
- if (!ISCOFF(file_hdr.f_magic)) { load_err = E_MAGIC; return FALSE; }
-
- byte_swapped = TRUE;
-
- swap2byte(&file_hdr.f_nscns); swap4byte(&file_hdr.f_timdat);
- swap4byte(&file_hdr.f_symptr); swap4byte(&file_hdr.f_nsyms);
- swap2byte(&file_hdr.f_opthdr); swap2byte(&file_hdr.f_flags);
-#if COFF_VERSION_1 || COFF_VERSION_2
- swap2byte(&file_hdr.f_target_id);
-#endif
- }
-
- /*-------------------------------------------------------------------------*/
- /* DETERMINE THE ENDIANNESS OF THE COFF FILE, AND ENSURE THE ENDIANNESS OF */
- /* THE FILE IS THE SAME AS THE TARGET, IF THERE IS A TARGET. */
- /*-------------------------------------------------------------------------*/
- big_e_target = ((file_hdr.f_flags & F_BIG) != 0);
- if (big_e_config != DONTCARE && big_e_target != big_e_config)
- { load_err = E_ENDIAN; return FALSE; }
-
- /*-------------------------------------------------------------------------*/
- /* DETERMINE VERSION OF COFF BEING USED, CHECK TARGET ID IF NEEDED. */
- /*-------------------------------------------------------------------------*/
- if (ISCOFF_1(file_hdr.f_magic) || ISCOFF_2(file_hdr.f_magic))
- {
- if (!ISMAGIC(file_hdr.f_target_id)) { load_err = E_MAGIC; return FALSE; }
- coff_version = file_hdr.f_magic;
- }
- else coff_version = COFF_MAGIC_0;
-
-#ifdef TMS320C60
- /*-------------------------------------------------------------------------*/
- /* DETERMINE WHETHER THE RIGHT COFF IS BEING LOADED */
- /*-------------------------------------------------------------------------*/
- if ( !target_coff( file_hdr.f_flags) )
- { load_err = E_FILE; return FALSE; }
-#endif
-
- /*-------------------------------------------------------------------------*/
- /* READ IN OPTIONAL HEADER, IF THERE IS ONE, AND SWAP IF NEEDED. */
- /*-------------------------------------------------------------------------*/
- if (file_hdr.f_opthdr == AOUTSZ)
- {
-
- if ((*bootFxn->read)((Uint8 *)&o_filehdr, file_hdr.f_opthdr) < 0)
- return (FALSE);
- stream_offset += file_hdr.f_opthdr;
-
- if (byte_swapped)
- {
- swap2byte(&o_filehdr.magic); swap2byte(&o_filehdr.vstamp);
- swap4byte(&o_filehdr.tsize); swap4byte(&o_filehdr.dsize);
- swap4byte(&o_filehdr.bsize); swap4byte(&o_filehdr.entrypt);
- swap4byte(&o_filehdr.text_start); swap4byte(&o_filehdr.data_start);
- }
-
- entry_point = o_filehdr.entrypt;
- *ientry_point = entry_point;
- }
-
- /*-------------------------------------------------------------------------*/
- /* Read in string table so that we can see long section names, if needed. */
- /* This used tobe read right before the symbol table was read, but now the */
- /* section headers use "flexname" method to specify section names and so */
- /* might need access to a string table entry. */
- /*-------------------------------------------------------------------------*/
- //if (!cload_strings()) return FALSE;
-
- /*-------------------------------------------------------------------------*/
- /* READ IN SECTION HEADERS. */
- /*-------------------------------------------------------------------------*/
-
- n_array_sections = 0;
- for (i = 0; i < file_hdr.f_nscns; i++) {
-
- SCNHDR *sptr = (SCNHDR *)§_hdrs[n_array_sections];
- O_SCNHDR *tptr = (O_SCNHDR *)&o_sect_hdrs;
-
- if (ISCOFF_2(coff_version)) {
-
- if ((*bootFxn->read)((Uint8 *)sptr, SCNHSZ_IN(coff_version)) < 0)
- return (FALSE);
- stream_offset += SCNHSZ_IN(coff_version);
-
-
- if (byte_swapped) {
-
- if (sptr->s_zeroes == 0L) swap4byte(&sptr->s_offset);
- swap4byte(&sptr->s_paddr);
- swap4byte(&sptr->s_vaddr);
- swap4byte(&sptr->s_size);
- swap4byte(&sptr->s_scnptr);
- swap4byte(&sptr->s_relptr);
- swap4byte(&sptr->s_lnnoptr);
- swap4byte(&sptr->s_nreloc);
- swap4byte(&sptr->s_nlnno);
- swap4byte(&sptr->s_flags);
- /* s_mwidth - single byte */
- /* s_reserved - single byte */
- swap2byte(&sptr->s_page);
- }
-
-
- } else {
-
- if ((*bootFxn->read)((Uint8 *)tptr, SCNHSZ_IN(coff_version)) < 0)
- return (FALSE);
- stream_offset += SCNHSZ_IN(coff_version);
-
- if (byte_swapped) {
- swap4byte(&tptr->os_paddr);
- swap4byte(&tptr->os_vaddr);
- swap4byte(&tptr->os_size);
- swap4byte(&tptr->os_scnptr);
- swap4byte(&tptr->os_relptr);
- swap4byte(&tptr->os_lnnoptr);
- swap2byte(&tptr->os_nreloc);
- swap2byte(&tptr->os_nlnno);
- swap2byte(&tptr->os_flags);
- /* os_reserved - one byte */
- /* os_page - one byte */
- }
-
- strncpy(sptr->s_name, tptr->os_name, SYMNMLEN);
- sptr->s_paddr = tptr->os_paddr;
- sptr->s_vaddr = tptr->os_vaddr;
- sptr->s_size = tptr->os_size;
- sptr->s_scnptr = tptr->os_scnptr;
- sptr->s_relptr = tptr->os_relptr;
- sptr->s_lnnoptr = tptr->os_lnnoptr;
- sptr->s_nreloc = tptr->os_nreloc;
- sptr->s_nlnno = tptr->os_nlnno;
- sptr->s_flags = tptr->os_flags;
- sptr->s_page = tptr->os_page;
- }
-
- /* Dont keep the section if it is not loaded */
-
- if ((sptr->s_scnptr || ((clear_bss || fill_bss) && IS_BSS(sptr))) &&
- (sptr->s_size) &&
- !(sptr->s_flags & (STYP_DSECT | STYP_NOLOAD)))
-
- n_array_sections += 1;
-
- }
-
-
- return TRUE;
-}
-
-\f
-/******************************************************************************/
-/* */
-/* CLOAD_DATA() - Read in the raw data and load it into memory. */
-/* */
-/******************************************************************************/
-int cload_data(BOOT_MODULE_FXN_TABLE *bootFxn)
-{
- int ok = TRUE;
-
- if (!need_data) return TRUE;
-
- /*-------------------------------------------------------------------------*/
- /* LOOP THROUGH THE SECTIONS AND LOAD THEM ONE AT A TIME. */
- /*-------------------------------------------------------------------------*/
- for (curr_sect = 0; curr_sect < n_array_sections && ok; curr_sect++)
- {
- SCNHDR *sptr = §_hdrs[curr_sect];
- char *sname = (sptr->s_zeroes == 0L) ?
- sptr->s_nptr : SNAMECPY(sptr->s_name);
-
- /*----------------------------------------------------------------------*/
- /* IF THIS IS THE TEXT SECTION, RELOCATE THE ENTRY POINT. */
- /*----------------------------------------------------------------------*/
- if ((sptr->s_flags & STYP_TEXT) && !strcmp(sname, ".text"))
- entry_point += RUN_RELOC_AMOUNT(curr_sect);
-
- /*----------------------------------------------------------------------*/
- /* IGNORE EMPTY SECTIONS OR SECTIONS WHOSE FLAGS INDICATE THE */
- /* SECTION IS NOT TO BE LOADED. IF THE CLEAR_BSS FLAG IS SET, BSS */
- /* IS "LOADED" EVEN THOUGH IT HAS NO DATA */
- /*----------------------------------------------------------------------*/
- if ((sptr->s_scnptr || ((clear_bss || fill_bss) && IS_BSS(sptr))) &&
- (sptr->s_size) &&
- !(sptr->s_flags & (STYP_DSECT | STYP_NOLOAD))) {
-
- if (!(sptr->s_flags & STYP_COPY))
- ok &= cload_sect_data(sptr, bootFxn);
- else
- ok &= cload_sect_data(sptr, bootFxn);
- }
- }
-
-
- return ok;
-}
-
-\f
-/******************************************************************************/
-/* */
-/* CLOAD_SECT_DATA() - Read, relocate, and write out the data for one section.*/
-/* */
-/******************************************************************************/
-int cload_sect_data(SCNHDR *sptr, BOOT_MODULE_FXN_TABLE *bootFxn)
-{
- T_ADDR addr = sptr->s_vaddr; /* CURRENT ADDRESS IN SECTION */
- unsigned int nbytes; /* BYTE COUNT WITHIN SECTION */
- int packet_size = 0; /* SIZE OF CURRENT DATA BUFFER */
- int excess = 0; /* BYTES LEFT FROM PREVIOUS BUFFER */
- unsigned int n_reloc = 0; /* COUNTER FOR RELOCATION ENTRIES */
- RELOC reloc; /* RELOCATION ENTRY */
- int relsz = RELSZ_IN(coff_version);
- unsigned char *packet = (unsigned char *)paBuf; /* LOAD BUFFER */
- unsigned int section_length = (unsigned int)LOCTOBYTE(sptr->s_size);
- unsigned int buffer_size = LOADBUFSIZE;
-
-#if defined (UNBUFFERED) && UNBUFFERED
- /*-------------------------------------------------------------------------*/
- /* IF UNBUFFERED, THEN SET SIZE TO SECTION LENGTH ROUNDED UP TO MULTIPLE */
- /* 32 BYTES. WE MAINTAIN A MINIMIUM OF LOADBUFSIZE IN THE EVENT SOMEONE */
- /* CONTINUES TO USE THAT MACRO AS A SIZE LIMIT. */
- /*-------------------------------------------------------------------------*/
- buffer_size = MAX(buffer_size, (section_length + 32) & ~31ul);
-#endif
-
- /*-------------------------------------------------------------------------*/
- /* ENSURE LOADBUFSIZE IS A MULTIPLE OF 2 */
- /*-------------------------------------------------------------------------*/
- if (LOADBUFSIZE % 2)
- {
- return -1;
- }
-
- /*-------------------------------------------------------------------------*/
- /* ALLOCATE THE PACKET BUFFER */
- /*-------------------------------------------------------------------------*/
- if (!packet) { load_err = E_ALLOC; return FALSE; }
-
-#ifdef OTIS
- if (IS_BSS(sptr))
- {
- TRG_MVAL filval = fill_bss_value;
-
- free (packet);
-
- if (!mem_fill(filval, LOCTOBYTE(sptr->s_size), addr, sptr->s_page))
- { load_err = E_MEMWRITE; return FALSE; }
- return TRUE;
- }
-#else
- /*-------------------------------------------------------------------------*/
- /* Always want to clear memory for cases where memsize is not a multiple */
- /* of the data size being written out. If we do not clear the array, the */
- /* last byte or so can be corrupted with data from the last buffer read. */
- /*-------------------------------------------------------------------------*/
- for (nbytes = 0; nbytes < buffer_size; ++nbytes) packet[nbytes] = 0;
-#endif
-
-
- /* Advance the stream to the start of the section */
- if (sptr->s_scnptr) {
-
- unsigned int offset;
-
- offset = sptr->s_scnptr;
-
- /* Advance the stream to the next section */
- if (offset > stream_offset) {
-
- unsigned int delta, rsize;
- int k;
-
-
- delta = sptr->s_scnptr - stream_offset;
-
- for (k = 0; k < delta; k += rsize) {
-
- rsize = MIN(delta, sizeof(paBuf));
-
- if ((*bootFxn->read)((Uint8 *)paBuf, rsize) < 0)
- return (FALSE);
- stream_offset += rsize;
-
- }
-
- }
-
- }
-
-
- /*-------------------------------------------------------------------------*/
- /* COPY ALL THE DATA IN THE SECTION. */
- /*-------------------------------------------------------------------------*/
-
- for (nbytes = 0; nbytes < section_length; nbytes += packet_size)
- {
- int j;
-
- /*----------------------------------------------------------------------*/
- /* READ IN A BUFFER OF DATA. IF THE PREVIOUS RELOCATION SPANNED */
- /* ACROSS THE END OF THE LAST BUFFER, COPY THE LEFTOVER BYTES INTO */
- /* THE BEGINNING OF THE NEW BUFFER. */
- /*----------------------------------------------------------------------*/
- for (j = 0; j < excess; ++j) packet[j] = packet[packet_size + j];
-
- packet_size = (int)MIN(LOCTOBYTE(sptr->s_size) - nbytes, buffer_size);
-
- if (sptr->s_scnptr) {
-
- if ((*bootFxn->read)((Uint8 *)((Uint8 *)packet+ excess), packet_size - excess) < 0)
- return (FALSE);
- stream_offset += (packet_size - excess);
-
- }
-
-
- excess = 0;
-
- /*----------------------------------------------------------------------*/
- /* Clear out end of packet in case we write padding. */
- /*----------------------------------------------------------------------*/
- if (excess + packet_size < buffer_size)
- for(j = excess + packet_size; j < buffer_size; j++)
- packet[j] = 0;
-
-
-#if 0 /* For some reason I have a section with STYP_COPY set, but
- * the name is not .cinit (first section). The address of
- * this section is 0, so if memcpy is called it returns 0,
- * which results in the load_err case */
-
- /*----------------------------------------------------------------------*/
- /* WRITE OUT THE RELOCATED DATA TO THE TARGET DEVICE. IF THIS IS A */
- /* CINIT SECTION, CALL A SPECIAL FUNCTION TO HANDLE IT. */
- /*----------------------------------------------------------------------*/
- if (!(IS_CINIT(sptr) ?
- cload_cinit(packet, &packet_size, &excess) :
- (int)memcpy ((void *)addr, packet, packet_size)))
- { load_err = E_MEMWRITE; free (packet); return FALSE; }
-#endif
-
-
-
- if (IS_CINIT(sptr)) {
- if (cload_cinit(packet, &packet_size, &excess)) {
- load_err = E_MEMWRITE; return (FALSE);
-
- }
-
- } else {
-
- /* If a copy section, but not cinit, ignore it */
- if (!(sptr->s_flags & STYP_COPY))
- memcpy ((void *)addr, packet, packet_size);
-
- }
-
-
- /*----------------------------------------------------------------------*/
- /* KEEP TRACK OF THE ADDRESS WITHIN THE SECTION. */
- /*----------------------------------------------------------------------*/
- addr += BYTETOLOC(packet_size);
-
- }
-
- return TRUE;
-}
-
-\f
-/******************************************************************************/
-/* */
-/* CLOAD_CINIT() - Process one buffer of C initialization records. */
-/* */
-/******************************************************************************/
-int cload_cinit(unsigned char *packet, int *packet_size, int *excess)
-{
- int i; /* BYTE COUNTER */
- int init_packet_size; /* SIZE OF CURRENT INITIALIZATION */
- static T_ADDR init_addr; /* ADDRESS OF CURRENT INITIALIZATION */
- int bss_page = 0; /* BSS SECTION PAGE NUMBER */
-
- /*-------------------------------------------------------------------------*/
- /* FIND THE BSS SECTION ASSOCIATED WITH THE THE CINIT SECTION CURRENTLY */
- /* BEING LOADED. */
- /*-------------------------------------------------------------------------*/
- for (i = 0; i < n_sections; ++i)
- if (IS_BSS(SECT_HDR(i)))
- { bss_page = SECT_HDR(i)->s_page; break; }
-
- /*-------------------------------------------------------------------------*/
- /* PROCESS ALL THE INITIALIZATION RECORDS IN THE BUFFER. */
- /*-------------------------------------------------------------------------*/
- for (i = 0; i < *packet_size; i += init_packet_size)
- {
- /*----------------------------------------------------------------------*/
- /* IF STARTING A NEW INITIALIZATION, READ THE SIZE AND ADDRESS FROM */
- /* THE TABLE. */
- /*----------------------------------------------------------------------*/
- if (init_size == 0)
- {
- T_SIZE temp;
- int align;
-
- /*-------------------------------------------------------------------*/
- /* POSITION THE BYTE INDEX ON THE NEXT INIT RECORD. */
- /*-------------------------------------------------------------------*/
- if (align = (i % INIT_ALIGN)) i += (INIT_ALIGN - align);
-
- /*-------------------------------------------------------------------*/
- /* IF THE SIZE AND ADDRESS ARE NOT FULLY CONTAINED IN THIS BUFFER, */
- /* STOP HERE. SET THE 'EXCESS' COUNTER TO THE NUMBER OF UNPROCESSED */
- /* BYTES - THESE WILL BE COPIED TO THE HEAD OF THE NEXT BUFFER. */
- /*-------------------------------------------------------------------*/
- if ((int)(i + sizeof(T_SIZE)) > *packet_size)
- { *excess += *packet_size - i; *packet_size = i; break; }
-
- /*-------------------------------------------------------------------*/
- /* IF THE NEXT SIZE FIELD IS ZERO, BREAK. */
- /*-------------------------------------------------------------------*/
- temp = unpack(packet + i, sizeof(T_SIZE)*8, sizeof(T_SIZE)*8, 0);
- if (temp == 0) break;
-
- /*-------------------------------------------------------------------*/
- /* READ THE ADDRESS FIELD ,IF IT'S ALL HERE. */
- /*-------------------------------------------------------------------*/
- if ((int)(i + sizeof(T_SIZE) + sizeof(T_IADDR)) > *packet_size)
- { *excess += *packet_size - i; *packet_size = i; break; }
-
- i += sizeof(T_SIZE);
- init_size = temp;
- init_addr = unpack(packet+i,sizeof(T_IADDR)*8,sizeof(T_IADDR)*8,0);
- i += sizeof(T_IADDR);
- }
-
- /*----------------------------------------------------------------------*/
- /* WRITE OUT THE CURRENT PACKET, UP TO THE END OF THE BUFFER. */
- /*----------------------------------------------------------------------*/
- if (init_packet_size = MIN(*packet_size-i, (int)(init_size * INIT_WSIZE)))
- {
-
- if (!mem_write(packet + i, init_packet_size, init_addr, bss_page))
- return FALSE;
-
- init_addr += BYTETOLOC(init_packet_size);
- init_size -= init_packet_size / INIT_WSIZE;
- }
- }
- return TRUE;
-}
-
-#if 0
-/******************************************************************************/
-/* */
-/* CLOAD_SYMBOLS() - Read in the symbol table. */
-/* */
-/******************************************************************************/
-int cload_symbols()
-{
- SYMENT sym;
- AUXENT aux;
- int first, next;
-
- if (file_hdr.f_nsyms == 0 || (!need_symbols && !need_reloc)) return TRUE;
-
- /*------------------------------------------------------------------------*/
- /* ALLOCATE THE RELOCATION SYMBOL TABLE. */
- /*------------------------------------------------------------------------*/
- if (need_reloc)
- {
- reloc_sym_index = 0;
- reloc_tab_size = MIN(RELOC_TAB_START, (int)file_hdr.f_nsyms);
-
- if (!(reloc_tab = (RELOC_TAB *)malloc(reloc_tab_size*sizeof(RELOC_TAB))))
- { load_err = E_ALLOC; return FALSE; }
- }
-
- /*------------------------------------------------------------------------*/
- /* IF THE APPLICATION NEEDS THE SYMBOL TABLE, LET IT READ IT IN. */
- /* PASS NEED_RELOC TO THE APPLICATION SO THAT IT CAN CALL RELOC_ADD(). */
- /*------------------------------------------------------------------------*/
- if (need_symbols)
- {
- if (load_syms(need_reloc)) return TRUE;
- else { load_err = E_SYM; return FALSE; }
- }
-
- /*------------------------------------------------------------------------*/
- /* READ THE SYMBOL TABLE AND BUILD THE RELOCATION SYMBOL TABLE */
- /* FOR SYMBOLS THAT CAN BE USED IN RELCOATION, STORE THEM IN A */
- /* SPECIAL SYMBOL TABLE THAT CAN BE SEARCHED QUICKLY DURING */
- /* RELOCATION. */
- /*------------------------------------------------------------------------*/
- for (first = 0; first < file_hdr.f_nsyms; first = next)
- {
- if (!(next = sym_read(first, &sym, &aux)))
- { load_err = E_FILE; return FALSE; }
-
- if (sym.n_sclass == C_EXT || sym.n_sclass == C_EXTREF ||
- sym.n_sclass == C_STAT || sym.n_sclass == C_LABEL ||
- sym.n_sclass == C_SYSTEM || sym.n_sclass == C_BLOCK ||
- sym.n_sclass == C_FCN || sym.n_sclass == C_STATLAB ||
- sym.n_sclass == C_EXTLAB)
- if (!reloc_add(first, &sym)) return FALSE;
- }
- return TRUE;
-}
-
-
-/******************************************************************************/
-/* */
-/* CLOAD_STRINGS() - Read in the string table. */
-/* */
-/******************************************************************************/
-int cload_strings()
-{
- unsigned int str_size; /* SIZE OF STRING TABLE */
- unsigned int bufsize; /* SIZE OF CURRENT BUFFER */
- unsigned int ntoread; /* AMOUNT TO READ FROM FILE */
- int excess; /* AMOUNT LEFT OVER FROM LAST BUFFER */
- STRTAB *packet; /* STRING TABLE BUFFER PACKET */
- unsigned int i = 0;
-
- /*----------------------------------------------------------------------*/
- /* Do not load if not loading/saving the symbol tables. */
- /* This is because the string table is an extension of the symbol table */
- /* and if you free and rebuild it, the symbol table's str_head will be */
- /* incorrect. */
- /*----------------------------------------------------------------------*/
- if (!need_symbols) return TRUE;
-
- /*------------------------------------------------------------------------*/
- /* FREE ANY PREVIOUS STRING BUFFERS */
- /*------------------------------------------------------------------------*/
- str_free(str_head); str_head = NULL;
-
- /*------------------------------------------------------------------------*/
- /* SEEK TO THE END OF THE SYMBOL TABLE AND READ IN THE SIZE OF THE STRING */
- /* TABLE. */
- /*------------------------------------------------------------------------*/
-#if FILE_BASED
- if ((file_hdr.f_nsyms == 0) ||
- fseek(fin, file_hdr.f_symptr + (file_hdr.f_nsyms * SYMESZ), 0) != 0 ||
- fread(&str_size, sizeof(int), 1, fin) != 1)
- return TRUE;
-#else
- mem_copy(&str_size, &gRxBuffer[file_hdr.f_symptr + (file_hdr.f_nsyms * SYMESZ)], sizeof(int));
- if ((file_hdr.f_nsyms == 0))
- return TRUE;
-#endif
- if (byte_swapped) swap4byte(&str_size);
-
- /*------------------------------------------------------------------------*/
- /* THE STRING TABLE IS READ IN AS A LINKED LIST OF BUFFERS. TO */
- /* PREVENT NAMES FROM BEING SPLIT ACROSS MULTIPLE BUFFERS, ANY PARTIAL */
- /* NAME AT THE END OF A BUFFER IS COPIED INTO THE BEGINNING OF THE */
- /* NEXT BUFFER. THE VARIABLE 'EXCESS' KEEPS TRACK OF HOW MUCH NEEDS */
- /* TO BE COPIED FROM THE PREVIOUS BUFFER. */
- /*------------------------------------------------------------------------*/
- str_size -= 4; /* SUBTRACT OFF 4 BYTES ALREADY READ */
- excess = 0; /* INITIALIZE LAST-BUFFER OVERFLOW */
-
-
- /*------------------------------------------------------------------------*/
- /* READ STRING BUFFERS UNTIL THE WHOLE STRING TABLE IS READ. */
- /*------------------------------------------------------------------------*/
- while (str_size)
- {
- /*---------------------------------------------------------------------*/
- /* ALLOCATE A NEW BUFFER. ON 16-BIT MACHINES, RESTRICT THE */
- /* BUFFER SIZE TO THE MAXIMUM THAT CAN BE ALLOCATED AT ONCE. */
- /*---------------------------------------------------------------------*/
- bufsize = str_size + excess;
-
- if (sizeof(int) < 4 && bufsize > MAX_STRING_ALLOC)
- bufsize = MAX_STRING_ALLOC;
-
- if (!(packet = (struct strtab *)malloc(sizeof(STRTAB) +
- (unsigned int)bufsize - 1)))
- { load_err = E_ALLOC; return FALSE; }
-
- /*---------------------------------------------------------------------*/
- /* COPY ANY PARTIAL STRING FROM THE LAST BUFFER INTO THIS ONE. */
- /* THEN FILL THE REST OF THE BUFFER BY READING FROM THE FILE. */
- /*---------------------------------------------------------------------*/
- if (excess)
- strn_copy(packet->buf, str_head->buf + str_head->size, excess);
-
- ntoread = (unsigned int)(bufsize - excess);
-#if FILE_BASED
- if (fread(packet->buf + excess, ntoread, 1, fin) != 1)
- { load_err = E_FILE; return FALSE; }
-#else
- mem_copy(packet->buf + excess, &gRxBuffer[file_hdr.f_symptr + (file_hdr.f_nsyms * SYMESZ) +sizeof(int)+ i++*ntoread], ntoread);
-#endif
- str_size -= ntoread;
-
- /*---------------------------------------------------------------------*/
- /* IF THE BUFFER ENDS IN A PARTIAL STRING (DOESN'T END IN NULL), */
- /* KEEP TRACK OF HOW MANY CHARACTERS ARE IN THE PARTIAL STRING */
- /* SO THEY CAN BE COPIED INTO THE NEXT BUFFER. */
- /*---------------------------------------------------------------------*/
- for (excess = 0; packet->buf[bufsize - 1]; --bufsize, ++excess) ;
-
- /*---------------------------------------------------------------------*/
- /* LINK THE NEW BUFFER INTO THE HEAD OF THE LIST. */
- /*---------------------------------------------------------------------*/
- packet->size =
- packet->index = bufsize;
- packet->next = str_head;
- packet->offset = str_head ? (str_head->offset + str_head->size) : 4;
- str_head = packet;
- }
- return TRUE;
-}
-
-\f
-/******************************************************************************/
-/* */
-/* STR_FREE() - Free the list of string table buffers. */
-/* */
-/******************************************************************************/
-void str_free(STRTAB *head)
-{
- STRTAB *this_one, *next;
- for (this_one = head; this_one; this_one = next)
- {
- next = this_one->next;
- free(this_one);
- }
-}
-
-
-
-/******************************************************************************/
-/* */
-/* SYM_READ() - Read and relocate a symbol and its aux entry. Return the */
-/* index of the next symbol. */
-/* */
-/******************************************************************************/
-int sym_read(int index, SYMENT *sym, AUXENT *aux)
-{
- /*------------------------------------------------------------------------*/
- /* READ IN A SYMBOL AND ITS AUX ENTRY. */
- /*------------------------------------------------------------------------*/
-#if FILE_BASED
- if (fseek(fin, file_hdr.f_symptr + (index * SYMESZ), 0) != 0 ||
- fread(sym, SYMESZ, 1, fin) != 1 ||
- (sym->n_numaux && fread(aux, SYMESZ, 1, fin) != 1))
- { load_err = E_FILE; return FALSE; }
-#else
- mem_copy((void*)sym, (void*)&gRxBuffer[file_hdr.f_symptr + (index * SYMESZ)], SYMESZ);
- if (sym->n_numaux)
- {
- mem_copy((void*)aux, (void*)&gRxBuffer[file_hdr.f_symptr + ( (index+1) * SYMESZ)], SYMESZ);
- load_err = E_FILE;
- return FALSE;
- }
-#endif
- if (byte_swapped)
- {
- /*--------------------------------------------------------------------*/
- /* SWAP THE SYMBOL TABLE ENTRY. */
- /*--------------------------------------------------------------------*/
- if (sym->n_zeroes == 0) swap4byte(&sym->n_offset);
- swap4byte(&sym->n_value);
- swap2byte(&sym->n_scnum);
- swap2byte(&sym->n_type);
-
- /*--------------------------------------------------------------------*/
- /* SWAP THE AUX ENTRY, BASED ON THE STORAGE CLASS. */
- /*--------------------------------------------------------------------*/
- if (sym->n_numaux) switch(sym->n_sclass)
- {
- case C_FILE : break;
-
- case C_STRTAG :
- case C_UNTAG :
- case C_ENTAG : swap4byte(&aux->x_tag.x_fsize);
- swap4byte(&aux->x_tag.x_endndx);
- break;
-
- case C_FCN : if (!str_comp(sym->n_name, ".bf"))
- {
- swap2byte(&aux->x_block.x_lcnt);
- swap4byte(&aux->x_block.x_regmask);
- swap4byte(&aux->x_block.x_framesize);
- }
-
- case C_BLOCK : swap2byte(&aux->x_block.x_lnno);
- swap4byte(&aux->x_block.x_endndx);
- break;
-
- case C_EOS : swap4byte(&aux->x_eos.x_fsize);
- swap4byte(&aux->x_eos.x_tagndx);
- break;
-
- default : /*-------------------------------------------------*/
- /* HANDLE FUNCTION DEFINITION SYMBOL */
- /*-------------------------------------------------*/
- if (((sym->n_type >> 4) & 3) == DCT_FCN)
- {
- swap4byte(&aux->x_func.x_tagndx);
- swap4byte(&aux->x_func.x_fsize);
- swap4byte(&aux->x_func.x_lnnoptr);
- swap4byte(&aux->x_func.x_endndx);
- }
-
- /*-------------------------------------------------*/
- /* HANDLE ARRAYS. */
- /*-------------------------------------------------*/
- else if (((sym->n_type >> 4) & 3) == DCT_ARY)
- {
- swap4byte(&aux->x_array.x_tagndx);
- swap4byte(&aux->x_array.x_fsize);
- swap2byte(&aux->x_array.x_dimen[0]);
- swap2byte(&aux->x_array.x_dimen[1]);
- swap2byte(&aux->x_array.x_dimen[2]);
- swap2byte(&aux->x_array.x_dimen[3]);
- }
-
- /*-------------------------------------------------*/
- /* HANDLE SECTION DEFINITIONS */
- /*-------------------------------------------------*/
- else if (sym->n_type == 0)
- {
- swap4byte(&aux->x_scn.x_scnlen);
- swap2byte(&aux->x_scn.x_nreloc);
- swap2byte(&aux->x_scn.x_nlinno);
- }
-
- /*-------------------------------------------------*/
- /* HANDLE MISC SYMBOL RECORD */
- /*-------------------------------------------------*/
- else
- {
- swap4byte(&aux->x_sym.x_fsize);
- swap4byte(&aux->x_sym.x_tagndx);
- }
- }
- }
-
- /*------------------------------------------------------------------------*/
- /* RELOCATE THE SYMBOL, BASED ON ITS STORAGE CLASS. */
- /*------------------------------------------------------------------------*/
- switch(sym->n_sclass)
- {
- case C_SYSTEM :
- case C_EXT :
- case C_EXTREF :
- case C_STAT :
- case C_LABEL :
- case C_BLOCK :
- case C_FCN :
- case C_STATLAB :
- case C_EXTLAB :
- /*------------------------------------------------------------------*/
- /* IF THE SYMBOL IS UNDEFINED, CALL AN APPLICATION ROUTINE TO LOOK */
- /* IT UP IN AN EXTERNAL SYMBOL TABLE. IF THE SYMBOL IS DEFINED, */
- /* RELOCATE IT ACCORDING TO THE SECTION IT IS DEFINED IN. */
- /*------------------------------------------------------------------*/
- if (sym->n_scnum == 0)
- lookup_sym((short)index, sym, aux);
- else if (sym->n_scnum > 0)
- {
- if (sym->n_sclass == C_STATLAB || sym->n_sclass == C_EXTLAB)
- sym->n_value += reloc_amount[sym->n_scnum - 1];
- else sym->n_value += RUN_RELOC_AMOUNT(sym->n_scnum - 1);
- }
- }
-
- return (index + sym->n_numaux + 1);
-}
-
-\f
-/******************************************************************************/
-/* */
-/* SYM_NAME() - Return a pointer to the name of a symbol in either the symbol */
-/* entry or the string table. */
-/* */
-/******************************************************************************/
-char *sym_name(SYMENT *symptr)
-{
- static char temp[9];
-
- if (symptr->n_zeroes == 0)
- {
- STRTAB *packet = str_head;
-
- /*---------------------------------------------------------------------*/
- /* Return the empty string if this symbol has no name (offset == 0) */
- /*---------------------------------------------------------------------*/
- if (symptr->n_offset < 4) /* Anything below 4 isn't valid */
- {
- temp[0] = 0;
- return temp;
- }
-
- /*---------------------------------------------------------------------*/
- /* Otherwise, return the string in the string table. */
- /*---------------------------------------------------------------------*/
- while (packet && symptr->n_offset < (int)packet->offset)
- packet = packet->next;
-
- /*---------------------------------------------------------------------*/
- /* Return the empty string if packet NULL (invalid offset) */
- /*---------------------------------------------------------------------*/
- if (!packet)
- {
- temp[0] = 0;
- return temp;
- }
-
- return packet->buf + (symptr->n_offset - packet->offset);
- }
-
- strn_copy(temp, symptr->n_name, 8);
- temp[8] = 0;
- return temp;
-}
-
-
-/******************************************************************************/
-/* */
-/* SYM_ADD_NAME() - Given a symbol table entry, return a pointer to the */
-/* symbol's name in the string table. Add the name to the */
-/* table if it's not already there. */
-/* */
-/******************************************************************************/
-char *sym_add_name(SYMENT *symptr)
-{
- char *dest;
- char *result;
- int i;
-
- /*------------------------------------------------------------------------*/
- /* IF THE SYMBOL'S NAME WAS IN THE COFF STRING TABLE, LOOK THROUGH THE */
- /* LIST OF STRING TABLE BUFFERS UNTIL FINDING THE ONE THE NAME IS IN, */
- /* AND SIMPLY POINT INTO THE BUFFER. */
- /*------------------------------------------------------------------------*/
- if (symptr->n_zeroes == 0)
- return sym_name(symptr);
-
- /*------------------------------------------------------------------------*/
- /* OTHERWISE ADD THE STRING TO THE STRING TABLE. */
- /* ALLOCATE AND LINK IN A NEW PACKET IF NECESSARY. NEW PACKETS ARE */
- /* LINKED TO THE HEAD OF THE LIST TO EASE ADDING NEW SYMBOLS. */
- /*------------------------------------------------------------------------*/
- if (!str_head || str_head->index + SYMNMLEN + 1 > str_head->size)
- {
- STRTAB *packet;
-
- if (!(packet = (STRTAB *)malloc(sizeof(STRTAB) + MIN_STRING_ALLOC - 1)))
- { load_err = E_ALLOC; return NULL; }
-
- packet->size = MIN_STRING_ALLOC;
- packet->index = 0;
- packet->next = str_head;
- packet->offset = str_head ? (str_head->offset + str_head->size) : 4;
- str_head = packet;
- }
-
- /*------------------------------------------------------------------------*/
- /* COPY THE NAME INTO THE STRING TABLE. */
- /*------------------------------------------------------------------------*/
- result = dest = str_head->buf + str_head->index;
- for (i = 0; *dest++ = symptr->n_name[i++]; )
- if (i == SYMNMLEN) { *dest++ = '\0'; ++i; break; }
-
- symptr->n_zeroes = 0;
- symptr->n_offset = str_head->offset + str_head->index;
- str_head->index += i;
- return result;
-}
-#endif
-
-/******************************************************************************/
-/* */
-/* RELOC_ADD() - Add an entry to the relocation symbol table. This table */
-/* stores relocation information for each relocatable symbol. */
-/* */
-/******************************************************************************/
-int reloc_add(int index, SYMENT *sym)
-{
- int disp; /* RELOCATION AMOUNT FOR THIS SYMBOL */
-
- if (!need_reloc) return TRUE;
-
- /*-------------------------------------------------------------------------*/
- /* USE THE SYMBOL VALUE TO CALCULATE THE RELOCATION AMOUNT: */
- /* 1) IF THE SYMBOL WAS UNDEFINED (DEFINED IN SECTION 0), USE THE */
- /* SYMBOL'S VALUE. */
- /* 2) IF THE SYMBOL HAS A POSITIVE SECTION NUMBER, USE THE RELOCATION */
- /* AMOUNT FOR THE SECTION IN WHICH THE SYMBOL IS DEFINED. */
- /* 3) OTHERWISE, THE SYMBOL IS ABSOLUTE, SO THE RELOCATION AMOUNT IS 0. */
- /*-------------------------------------------------------------------------*/
- if (sym->n_scnum == 0)
- disp = sym->n_value;
- else if (sym->n_scnum > 0)
- {
- if (sym->n_sclass == C_STATLAB || sym->n_sclass == C_EXTLAB)
- disp = reloc_amount[sym->n_scnum - 1];
- else disp = RUN_RELOC_AMOUNT(sym->n_scnum - 1);
- }
- else disp = 0;
-
- /*-------------------------------------------------------------------------*/
- /* IF THERE IS A NON-ZERO RELOCATION AMOUNT, ADD THE SYMBOL TO THE TABLE. */
- /*-------------------------------------------------------------------------*/
- if (disp == 0) return TRUE;
-
- if (reloc_sym_index >= reloc_tab_size)
- {
- reloc_tab_size += RELOC_GROW_SIZE;
- reloc_tab = (RELOC_TAB *)realloc((char *)reloc_tab,
- reloc_tab_size*sizeof(RELOC_TAB));
-
- if (!reloc_tab) { load_err = E_ALLOC; return FALSE; }
- }
- reloc_tab[reloc_sym_index ].rt_index = index;
- reloc_tab[reloc_sym_index++].rt_disp = disp;
-
- return TRUE;
-}
-
-/******************************************************************************/
-/* */
-/* RELOCATE() - Perform a single relocation by patching the raw data. */
-/* */
-/******************************************************************************/
-int relocate(RELOC *rp, unsigned char *data, int s)
-{
-/* RELOC *rp; RELOCATION ENTRY */
-/* unsigned char *data; DATA BUFFER */
-/* int s; INDEX OF CURRENT SECTION */
- int fieldsz = reloc_size(rp->r_type); /* SIZE OF ACTUAL PATCH VALUE */
- int offset = reloc_offset(rp->r_type); /* OFFSET OF ACTUAL PATCH VALUE */
- int wordsz = MAX(fieldsz, reloc_stop(rp->r_type)); /* SIZE CONTAINING FLD */
- int objval; /* FIELD TO BE PATCHED */
- int reloc_amt; /* AMOUNT OF RELOCATION */
-
- int pp_shift_cnt = 0;
- int pp_local = FALSE;
-
- if (rp->r_type == R_ABS) return TRUE; /* NOTHING TO DO */
-
- /*-------------------------------------------------------------------------*/
- /* DETERMINE THE RELOCATION AMOUNT FROM THE RELOCATION SYMBOL TABLE. */
- /*-------------------------------------------------------------------------*/
- reloc_amt = (rp->r_symndx == -1) ? RUN_RELOC_AMOUNT(s)
- : sym_reloc_amount(rp);
-
- /*-------------------------------------------------------------------------*/
- /* EXTRACT THE RELOCATABLE FIELD FROM THE OBJECT DATA. */
- /*-------------------------------------------------------------------------*/
- objval = unpack(data, fieldsz, wordsz, offset + BIT_OFFSET(rp->r_vaddr));
-
- /*-------------------------------------------------------------------------*/
- /* MODIFY THE FIELD BASED ON THE RELOCATION TYPE. */
- /*-------------------------------------------------------------------------*/
- switch (rp->r_type)
- {
- /*----------------------------------------------------------------------*/
- /* NORMAL RELOCATIONS: ADD IN THE RELOCATION AMOUNT. */
- /*----------------------------------------------------------------------*/
- case R_RELBYTE:
- case R_RELWORD:
- case R_REL24:
- case R_RELLONG:
- case R_DIR32:
- case R_PARTLS16:
- objval += reloc_amt;
- break;
-
- /*--------------------------------------------------------------------*/
- /* ADD IN THE RELOCATION AMOUNT, BUT MAKE SURE WE'RE STILL IN THE */
- /* 370'S REGISTER FILE. */
- /*--------------------------------------------------------------------*/
- case R_RRNREG:
- case R_RRRELREG:
- if (rp->r_type == R_RRNREG)
- objval = ((char)objval + reloc_amt);
- else objval += reloc_amt;
-
- if (objval & ((-1L >> 8*fieldsz) << 8*fieldsz))
- {
- /* ERROR */
- }
-
- break;
-
- /*--------------------------------------------------------------------*/
- /* PP UNSCALED 15-BIT OFFSET RELOCATION. */
- /*--------------------------------------------------------------------*/
- case R_PP15 :
- case R_PPL15 :
- case R_PPN15 :
- case R_PPLN15 :
- {
- int bit;
- char *sname = (SECT_HDR(s)->s_zeroes == 0L) ?
- SECT_HDR(s)->s_nptr : SNAMECPY(SECT_HDR(s)->s_name);
-
- pp_local = (rp->r_type == R_PPL15) || (rp->r_type == R_PPLN15);
-
- /*--------------------------------------------------------------*/
- /* IF NEGATIVE RELOC TYPE, THEN TREAT CONST OFFSET AS A NEGATIVE*/
- /*--------------------------------------------------------------*/
- if (rp->r_type == R_PPN15 || rp->r_type == R_PPLN15)
- {
- objval = -objval;
- rp->r_type -= 010; /* CHANGE TYPE TO NON NEG. */
- }
-
- objval += reloc_amt;
-
- /*--------------------------------------------------------------*/
- /* IF THE ADDRESS STILL FALLS WITHIN AN APPROPRIATE RANGE */
- /*--------------------------------------------------------------*/
- if ((objval >= 0x00000000 && objval <= 0x00007fff) ||
- (objval >= 0x01000000 && objval <= 0x010007ff) )
- break;
-
- /*--------------------------------------------------------------*/
- /* IF THE ADDRESS FALLS OUTSIDE AN APPROPRIATE RANGE, BUT CAN */
- /* BE SCALED BY SIZE TO GET BACK INTO RANGE, THEN READ THE UPPER*/
- /* BIT OF THE SIZE FIELD. IF IT IS A 1, THEN WE CAN SCALE THIS */
- /* OFFSET BY 4, IF IT IS 0, THEN WE CAN SCALE THIS OFFSET BY 2. */
- /*--------------------------------------------------------------*/
- bit = unpack(data, 1, 64, pp_local ? 30 : 8);
-
- /*--------------------------------------------------------------*/
- /* DETERMINE IF THE OFFSET IS ALIGNED FOR SCALING. IF SO, */
- /* THEN PACK THE SCALED OFFSET INTO INSTRUCTION, CHANGE THE */
- /* RELOC TYPE TO SCALED, AND TURN ON SCALE BIT IN INSTRUCT. */
- /*--------------------------------------------------------------*/
- if (!(objval & ((2<<bit)-1)) &&
- (objval >>= (bit+1)) >= 0 && objval <= 0x7fff)
- {
- rp->r_type = pp_local ? (bit ? R_PPL15W : R_PPL15H) :
- (bit ? R_PP15W : R_PP15H);
- repack(1, data, 1, 64, pp_local ? 28 : 6);
- break;
- }
-
- /*--------------------------------------------------------------*/
- /* ERROR, THE OFFSET WILL NOT FIT SCALED OR UNSCALED. */
- /*--------------------------------------------------------------*/
-
- load_err = E_RELOCENT;
- return FALSE;
- }
-
- /*--------------------------------------------------------------------*/
- /* PP SCALED 15-BIT OFFSET RELOCATION. FOR R_PP15W THE RELOC_AMT IS */
- /* DIVIDED BY 4. FOR R_PP15H THE RELOC_AMT IS DIVIDED BY 2. */
- /*--------------------------------------------------------------------*/
- case R_PP15W :
- case R_PPL15W :
- case R_PPN15W :
- case R_PPLN15W : pp_shift_cnt++; /* FALL THROUGH */
-
- case R_PP15H :
- case R_PPL15H :
- case R_PPN15H :
- case R_PPLN15H : pp_shift_cnt++; /* FALL THROUGH */
- {
- int obj_addr_x;
- char *sname = (SECT_HDR(s)->s_zeroes == 0) ?
- SECT_HDR(s)->s_nptr : SNAMECPY(SECT_HDR(s)->s_name);
-
- /*--------------------------------------------------------------*/
- /* NOTE THAT THIS IS DEPENDENT ON THE NUMBERING OF THESE RELOC */
- /* VALUES. */
- /*--------------------------------------------------------------*/
- pp_local = (rp->r_type & 4);
-
- /*--------------------------------------------------------------*/
- /* IF NEGATIVE RELOC TYPE, THEN TREAT CONST OFFSET AS NEGATIVE */
- /*--------------------------------------------------------------*/
- if (rp->r_type >= R_PPN15)
- {
- objval = -objval;
- rp->r_type -= 010; /* CHANGE TYPE TO NON NEG. */
- }
-
- obj_addr_x = (objval << pp_shift_cnt) + reloc_amt;
-
- /*--------------------------------------------------------------*/
- /* LINK TIME ADDRESS VIOLATES THE SCALING FACTOR WE ARE USING */
- /* FOR THIS OPERAND. UNSCALE THE VALUE IF IT WILL FIT IN 15 BITS*/
- /* BY CHANGING RELOC TYPE TO UNSCALED, AND CHANGING SCALE BIT */
- /* IN THE INSTRUCTION. */
- /*--------------------------------------------------------------*/
- if (pp_shift_cnt && (reloc_amt & ((1<<pp_shift_cnt)-1)))
- {
- objval = obj_addr_x;
- rp->r_type = (pp_local ? R_PPL15 : R_PP15);
- repack(0, data, 1, 64, pp_local ? 28 : 6);
- }
- else objval = obj_addr_x >> pp_shift_cnt;
-
- /*--------------------------------------------------------------*/
- /* IF THE ADDRESS STILL FALLS WITHIN AN APPROPRIATE RANGE */
- /*--------------------------------------------------------------*/
- if ((objval >= 0x00000000 && objval <= 0x00007fff) ||
- (obj_addr_x >= 0x01000000 && obj_addr_x <= 0x010007ff) )
- break;
-
- /*--------------------------------------------------------------*/
- /* ERROR, THE OFFSET WILL NOT FIT SCALED OR UNSCALED. */
- /*--------------------------------------------------------------*/
-
- load_err = E_RELOCENT;
- return FALSE;
- }
-
- /*--------------------------------------------------------------------*/
- /* PP 16-bit byte offset relocation. For R_PP16B the lower 15-bits */
- /* are handled just like R_PP15, and the upper bit is placed in the */
- /* scale indicator bit of the field. */
- /*--------------------------------------------------------------------*/
- case R_PP16B :
- case R_PPL16B :
- case R_PPN16B :
- case R_PPLN16B :
- {
- char *sname = (SECT_HDR(s)->s_zeroes == 0) ?
- SECT_HDR(s)->s_nptr : SNAMECPY(SECT_HDR(s)->s_name);
-
- pp_local = (rp->r_type == R_PPL16B) || (rp->r_type == R_PPLN16B);
-
- /*--------------------------------------------------------------*/
- /* READ THE SCALE BIT (16th BIT) AND CREATE 16 BIT CONSTANT OFF */
- /*--------------------------------------------------------------*/
- objval |= (unpack(data, 1, 64, pp_local ? 28 : 6) << 15);
-
- /*--------------------------------------------------------------*/
- /* IF NEGATIVE RELOC TYPE, THEN TREAT CONST OFFSET AS NEGATIVE */
- /*--------------------------------------------------------------*/
- if (rp->r_type == R_PPN16B || rp->r_type == R_PPLN16B)
- {
- objval = - objval;
- rp->r_type -= 010; /* CHANGE THE TYPE TO A NON NEG TYPE. */
- }
-
- objval += reloc_amt;
-
- /*--------------------------------------------------------------*/
- /* IF THE ADDRESS STILL FALLS WITHIN AN APPROPRIATE RANGE */
- /*--------------------------------------------------------------*/
- if ((objval >= 0x00000000 && objval <= 0x0000ffff) ||
- (objval >= 0x01000000 && objval <= 0x010007ff) )
- {
- /*-----------------------------------------------------------*/
- /* RELOCATE THE 16TH BIT OF THE ADDRESS. */
- /*-----------------------------------------------------------*/
- repack(((objval&0x8000) >> 15), data, 1, 64, pp_local ? 28 : 6);
- break;
- }
-
- /*--------------------------------------------------------------*/
- /* ADDRESS IS OUT OF RANGE. */
- /*--------------------------------------------------------------*/
-
- load_err = E_RELOCENT;
- return FALSE;
- }
-
- /*--------------------------------------------------------------------*/
- /* PP BASE ADDRESS RELOCATION. BIT 0 IS 0 IF IN DATA RAM, 1 IF IN */
- /* PARAMETER RAM. THIS CODE ASSUMES THAT WE DO NOT RELOCATE FROM */
- /* PRAM TO DRAM OR FROM DRAM TO PRAM AT LOAD TIME. */
- /*--------------------------------------------------------------------*/
- case R_PPLBASE: pp_local = TRUE;
- case R_PPBASE:
- {
- /*---------------------------------------------------------------*/
- /* IF WAS DRAM AND RELOC_AMT IS GREAT ENOUGH TO MOVE INTO PRAM, */
- /* CHANGE TO PRAM */
- /*---------------------------------------------------------------*/
- if (!objval && reloc_amt > (int)(0x01000000 - 0xC000)) objval = 1;
-
- /*---------------------------------------------------------------*/
- /* IF WAS PRAM AND RELOC_AMT IS NEGATIVE AND CAN MOVE INTO DRAM, */
- /* CHANGE TO DRAM */
- /*---------------------------------------------------------------*/
- else if (objval && (-reloc_amt) > (int)(0x01000000 - 0xC000))
- objval = 0;
-
- break;
- }
-
- /*----------------------------------------------------------------------*/
- /* 34010 ONE'S COMPLEMENT RELOCATION. SUBTRACT INSTEAD OF ADD. */
- /*----------------------------------------------------------------------*/
- case R_OCRLONG:
- objval -= reloc_amt;
- break;
-
- /*----------------------------------------------------------------------*/
- /* 34020 WORD-SWAPPED RELOCATION. SWAP BEFORE RELOCATING. */
- /*----------------------------------------------------------------------*/
- case R_GSPOPR32:
- case R_OCBD32:
- objval = ((objval >> 16) & 0xFFFF) | (objval << 16);
- objval += (rp->r_type == R_GSPOPR32) ? reloc_amt : -reloc_amt;
- objval = ((objval >> 16) & 0xFFFF) | (objval << 16);
- break;
-
- /*----------------------------------------------------------------------*/
- /* PC-RELATIVE RELOCATIONS. IN THIS CASE THE RELOCATION AMOUNT */
- /* IS ADJUSTED BY THE PC DIFFERENCE. IF THIS IS AN INTERNAL */
- /* RELOCATION TO THE CURRENT SECTION, NO ADJUSTMENT IS NEEDED. */
- /*----------------------------------------------------------------------*/
- case R_PCRBYTE:
- case R_PCRWORD:
- case R_GSPPCR16:
- case R_GSPPCA16:
- case R_PCRLONG:
- case R_PCR24:
- case R_ANKPCR16:
- case R_ANKPCR8:
- {
- int shift = 8 * (4 - fieldsz);
- unsigned int pcdif = RUN_RELOC_AMOUNT(s);
-
- /*----------------------------------------------------------------*/
- /* HANDLE SPECIAL CASES OF JUMPING FROM ABSOLUTE SECTIONS (SPECIAL*/
- /* RELOC TYPE) OR TO ABSOLUTE DESTINATION (SYMNDX == -1). IN */
- /* EITHER CASE, SET THE APPROPRIATE RELOCATION AMOUNT TO 0. */
- /*----------------------------------------------------------------*/
- if( rp->r_symndx == -1 ) reloc_amt = 0;
- if( rp->r_type == R_GSPPCA16) pcdif = 0;
-
- /*----------------------------------------------------------------*/
- /* Handle ankoor's offset where upper 14 (PCR8) and upper 6(PCR16)*/
- /* bits of 22 bit address is held in r_disp field of reloc entry */
- /*----------------------------------------------------------------*/
- if(rp->r_type == R_ANKPCR8 || rp->r_type == R_ANKPCR16)
- {
- shift = 10;
- objval |= rp->r_disp << ((rp->r_type == R_ANKPCR8) ? 8 : 16);
- }
-
- reloc_amt -= pcdif;
-
- if (rp->r_type == R_GSPPCR16 || rp->r_type == R_GSPPCA16)
- reloc_amt >>= 4; /* BITS TO WORDS */
-
- objval = (int)(objval << shift) >> shift; /* SIGN EXTEND */
- objval += reloc_amt;
- break;
- }
-
- /*--------------------------------------------------------------------*/
- /* Ankoor page-addressing. Calculate address from the 22-bit */
- /* value in the relocation field plus the relocation amount. Shift */
- /* out the lower 16 bits. */
- /*--------------------------------------------------------------------*/
- case R_PARTMS6:
- objval = (objval & 0xC0) |
- (((rp->r_disp += reloc_amt) >> 16) & 0x3F);
- break;
-
- /*----------------------------------------------------------------------*/
- /* 320C30 PAGE-ADDRESSING RELOCATION. CALCULATE THE ADDRESS FROM */
- /* THE 8-BIT PAGE VALUE IN THE FIELD, THE 16-BIT OFFSET IN THE RELOC */
- /* ENTRY, AND THE RELOCATION AMOUNT. THEN, STORE THE 8-BIT PAGE */
- /* VALUE OF THE RESULT BACK IN THE FIELD. */
- /*----------------------------------------------------------------------*/
- case R_PARTMS8:
- objval = (int)((objval << 16) + rp->r_disp + reloc_amt) >> 16;
- break;
-
- /*----------------------------------------------------------------------*/
- /* DSP(320) PAGE-ADDRESSING. CALCULATE ADDRESS FROM THE 16-BIT */
- /* VALUE IN THE RELOCATION FIELD PLUS THE RELOCATION AMOUNT. OR THE */
- /* TOP 9 BITS OF THIS RESULT INTO THE RELOCATION FIELD. */
- /*----------------------------------------------------------------------*/
- case R_PARTMS9:
- objval = (objval & 0xFE00) |
- (((int)(rp->r_disp + reloc_amt) >> 7) & 0x1FF);
- break;
-
- /*----------------------------------------------------------------------*/
- /* DSP(320) PAGE-ADDRESSING. CALCULATE ADDRESS AS ABOVE, AND OR THE */
- /* 7-BIT DISPLACEMENT INTO THE FIELD. */
- /*----------------------------------------------------------------------*/
- case R_PARTLS7:
- objval = (objval & 0x80) | ((rp->r_disp + reloc_amt) & 0x7F);
- break;
-
- /*--------------------------------------------------------------------*/
- /* Ankoor page-addressing. Calculate address from the 22-bit */
- /* value in the relocation field plus the relocation amount. Mask off */
- /* bits [21:16] and [5:0] to extract a data page within a 64K page */
- /*--------------------------------------------------------------------*/
- case R_PARTMID10:
- objval = (objval & 0xFC00) |
- (((rp->r_disp += reloc_amt) >> 6) & 0x3FF);
- break;
-
- /*--------------------------------------------------------------------*/
- /* RR(370) MSB RELOCATION. CALCULATE ADDRESS FROM THE 16-BIT VALUE */
- /* IN THE RELOCATION ENTRY PLUS THE RELOCATION AMOUNT. PATCH THE */
- /* MSB OF THE RESULT INTO THE RELOCATION FIELD. */
- /*--------------------------------------------------------------------*/
- case R_HIWORD:
- objval += (rp->r_disp += (unsigned short)reloc_amt) >> 8;
- break;
-
- /*--------------------------------------------------------------------*/
- /* C8+ High byte of 24-bit address. Calculate address from 24-bit */
- /* value in the relocation entry plus the relocation amount. Patch */
- /* the MSB of the result into the relocation field. */
- /*--------------------------------------------------------------------*/
- case R_C8PHIBYTE:
- objval = (int)((objval << 16) + rp->r_disp + reloc_amt) >> 16;
- break;
-
- /*--------------------------------------------------------------------*/
- /* C8+ Middle byte of 24-bit address. Calculate address from 24-bit */
- /* value in the relocation entry plus the relocation amount. Patch */
- /* the middle byte of the result into the relocation field. */
- /*--------------------------------------------------------------------*/
- case R_C8PMIDBYTE:
- objval = (int)((objval << 16) + rp->r_disp + reloc_amt) >> 8;
- break;
-
- /*--------------------------------------------------------------------*/
- /* C8+ Vector Address. Calculate address from 24-bit value in the */
- /* relocation entry plus the relocation amount. MSB must be 0xFF */
- /* since interrupt and trap handlers must be programmed in the top- */
- /* most segment of memory. Patch bottom 16-bits of the result into */
- /* the relocation field. */
- /*--------------------------------------------------------------------*/
- case R_C8PVECADR:
- objval += reloc_amt;
- if ((objval & 0xFF0000) != 0xFF0000)
- {
- /* ERROR */
- }
- objval &= 0xFFFF;
- break;
-
- /*----------------------------------------------------------------------*/
- /* C8+ 24-bit Address. The byte ordering for 24-bit addresses on the */
- /* C8+ is reversed (low, middle, high). Needs to be unordered, add */
- /* in reloc_amt, then re-ordered. */
- /*----------------------------------------------------------------------*/
- case R_C8PADR24:
- objval = ((objval>>16) | (objval&0xff00) | ((objval&0xff)<<16));
- objval += reloc_amt;
- objval = ((objval>>16) | (objval&0xff00) | ((objval&0xff)<<16));
- break;
-
- /*----------------------------------------------------------------------*/
- /* DSP(320) 13-BIT CONSTANT. RELOCATE ONLY THE LOWER 13 BITS OF THE */
- /* FIELD. */
- /*----------------------------------------------------------------------*/
- case R_REL13:
- objval = (objval & 0xE000) | ((objval + reloc_amt) & 0x1FFF);
- break;
-
- /*--------------------------------------------------------------------*/
- /* ANKOOR 22-bit extended address. Calculate address by masking */
- /* off the opcode and OR in the lower 16-bit constant + the */
- /* amount. */
- /*--------------------------------------------------------------------*/
- case R_REL22:
- {
- unsigned int obj_hi = unpack(data , 16, 16, 0);
- unsigned int obj_lo = unpack(data+2, 16, 16, 0);
-
- /*--------------------------------------------------------------*/
- /* BUILD THE OFFSET TO BE RELOCATED. */
- /*--------------------------------------------------------------*/
- objval = ((obj_hi & 0x003F) << 16) | (obj_lo & 0xFFFF);
-
- /*--------------------------------------------------------------*/
- /* Calculate displacement */
- /*--------------------------------------------------------------*/
- objval += reloc_amt;
-
- /*--------------------------------------------------------------*/
- /* REPACK THE RELOCATED VALUE BACK IN THE OBJECT VALUE. */
- /*--------------------------------------------------------------*/
- obj_hi = (obj_hi & 0xFFC0) | ((objval & 0x3F0000) >> 16);
- obj_lo = objval & 0xFFFF;
- repack(obj_hi, data , 16, 16, 0);
- repack(obj_lo, data+2, 16, 16, 0);
-
- return TRUE;
- }
-
- /*--------------------------------------------------------------------*/
- /* DSP, LEAD 23-bit extended address. Calculate address by masking */
- /* off the opcode and OR in the lower 16-bit constant + the */
- /* amount. */
- /*--------------------------------------------------------------------*/
- case R_REL23:
- {
- unsigned int obj_hi = unpack(data , 16, 16, 0);
- unsigned int obj_lo = unpack(data+2, 16, 16, 0);
-
- /*--------------------------------------------------------------*/
- /* BUILD THE OFFSET TO BE RELOCATED. */
- /*--------------------------------------------------------------*/
- objval = ((obj_hi & 0x007F) << 16) | (obj_lo & 0xFFFF);
-
- /*--------------------------------------------------------------*/
- /* Calculate displacement */
- /*--------------------------------------------------------------*/
- objval += reloc_amt;
-
- /*--------------------------------------------------------------*/
- /* REPACK THE RELOCATED VALUE BACK IN THE OBJECT VALUE. */
- /*--------------------------------------------------------------*/
- obj_hi = (obj_hi & 0xFF80) | ((objval & 0x7F0000) >> 16);
- obj_lo = objval & 0xFFFF;
- repack(obj_hi, data , 16, 16, 0);
- repack(obj_lo, data+2, 16, 16, 0);
-
- return TRUE;
- }
-
-
- /*----------------------------------------------------------------------*/
- /* PRISM (370/16) code label relocation. Convert word address to byte */
- /* address, add in relocation, convert back to word address. */
- /*----------------------------------------------------------------------*/
- case R_LABCOD:
- objval = ((objval << 1) + reloc_amt) >> 1;
- break;
- }
-
- /*-------------------------------------------------------------------------*/
- /* PACK THE RELOCATED FIELD BACK INTO THE OBJECT DATA. */
- /*-------------------------------------------------------------------------*/
- repack(objval, data, fieldsz, wordsz, offset + BIT_OFFSET(rp->r_vaddr));
- return TRUE;
-}
-
-
-/******************************************************************************/
-/* */
-/* RELOC_READ() - Read a single relocation entry. */
-/* */
-/******************************************************************************/
-#if FILE_BASED
-int reloc_read(RELOC *rptr)
-#else
-int reloc_read(RELOC *rptr, unsigned int offset)
-#endif
-{
-#if COFF_VERSION_1 || COFF_VERSION_2
- /*------------------------------------------------------------------------*/
- /* THE FOLLOWING UNION IS USED TO READ IN VERSION 0 OR 1 RELOC ENTRIES */
- /*------------------------------------------------------------------------*/
- /* THE FORMAT OF RELOCATION ENTRIES CHANGED BETWEEN COFF VERSIONS 0 AND 1.*/
- /* VERSION 0 HAS A 16 BIT SYMBOL INDEX, WHILE VERSION 1 HAS A 32 BIT INDX.*/
- /*------------------------------------------------------------------------*/
- union { RELOC new_c; RELOC_OLD old; } input_entry;
-#if FILE_BASED
- if (fread(&input_entry, RELSZ_IN(coff_version), 1, fin) != 1)
- { load_err = E_FILE; return FALSE; }
-#else
- mem_copy((void*)&input_entry, (void*)&gRxBuffer[offset], RELSZ_IN(coff_version));
-#endif
- /*------------------------------------------------------------------------*/
- /* IF LOADING A VERSION 0 FILE, TRANSLATE ENTRY TO VERSION 1 FORMAT. */
- /* (THIS COULD BE SIMPLER - ALL THE SWAPS EXCEPT FOR THE SYMBOL INDEX */
- /* COULD BE DONE AFTER THE TRANSLATION - BUT THIS SEEMS TO BE CLEARER) */
- /*------------------------------------------------------------------------*/
- if (ISCOFF_0(coff_version))
- {
- if (byte_swapped)
- {
- swap4byte(&input_entry.old.r_vaddr);
- swap2byte(&input_entry.old.r_type);
-
- /* if a field reloc, fields are chars, so don't swap */
- if (!isfldrel(input_entry.old.r_type))
- {
- swap2byte(&input_entry.old.r_symndx);
- swap2byte(&input_entry.old.r_disp);
- }
- }
-
- rptr->r_vaddr = input_entry.old.r_vaddr;
- rptr->r_symndx = input_entry.old.r_symndx;
- rptr->r_disp = input_entry.old.r_disp;
- rptr->r_type = input_entry.old.r_type;
- }
- else
- {
- *rptr = input_entry.new_c;
-
- if (byte_swapped)
- {
- swap4byte(&rptr->r_vaddr);
- swap2byte(&rptr->r_type);
-
- /* Again, if a field reloc, fields are chars, so don't swap */
- if (!isfldrel(rptr->r_type))
- {
- swap4byte(&rptr->r_symndx);
- swap2byte(&rptr->r_disp);
- }
- }
- }
-
-#else
- /*-------------------------------------------------------------------------*/
- /* READ IN AND BYTE SWAP AN VERSION 0 RELOC ENTRY */
- /*-------------------------------------------------------------------------*/
- if (fread(rptr, RELSZ, 1, fin) != 1) { load_err = E_FILE; return FALSE; }
-
- if (byte_swapped)
- {
- swap4byte(&rptr->r_vaddr);
- swap2byte(&rptr->r_type);
-
- /* If a field reloc, fields are chars, so don't swap */
- if (!isfldrel(rptr->r_type))
- {
- swap2byte(&rptr->r_symndx);
- swap2byte(&rptr->r_disp);
- }
- }
-#endif
-
- return TRUE;
-}
-
-
-/*************************************************************************/
-/* */
-/* RELOC_SIZE()- */
-/* Return the field size of a relocation type. */
-/* */
-/*************************************************************************/
-
-int reloc_size(int type)
-{
- switch (type)
- {
- case R_PPBASE:
- case R_PPLBASE: return 1;
-
- case R_HIWORD:
- case R_C8PHIBYTE:
- case R_C8PMIDBYTE:
- case R_RELBYTE:
- case R_PCRBYTE:
- case R_RRNREG:
- case R_RRRELREG:
- case R_ANKPCR8:
- case R_PARTLS6:
- case R_PARTMS6:
- case R_PARTLS7: return 8;
-
- case R_PP15:
- case R_PP15W:
- case R_PP15H:
- case R_PP16B:
- case R_PPN15:
- case R_PPN15W:
- case R_PPN15H:
- case R_PPN16B:
- case R_PPL15:
- case R_PPL15W:
- case R_PPL15H:
- case R_PPL16B:
- case R_PPLN15:
- case R_PPLN15W:
- case R_PPLN15H:
- case R_PPLN16B: return 15;
-
- case R_LABCOD:
- case R_RELWORD:
- case R_PCRWORD:
- case R_ANKPCR16:
- case R_GSPPCR16:
- case R_GSPPCA16:
- case R_PARTLS16:
- case R_PARTMS8:
- case R_PARTMS9:
- case R_PARTMID10:
- case R_PARTMS16:
- case R_REL22:
- case R_REL13:
- case R_C8PVECADR: return 16;
-
- case R_REL24:
- case R_PCR24:
- case R_PCR24W:
- case R_C8PADR24: return 24;
-
- case R_MPPCR:
- case R_GSPOPR32:
- case R_RELLONG:
- case R_PCRLONG:
- case R_OCBD32:
- case R_OCRLONG:
- case R_DIR32: return 32;
-
- default: return 0;
- }
-}
-
-
-/*************************************************************************/
-/* */
-/* RELOC_OFFSET()- */
-/* Return the offset of a relocation type field. The value of */
-/* offset should be the bit offset of the LSB of the field in */
-/* little-endian mode. */
-/* */
-/*************************************************************************/
-
-int reloc_offset(int type)
-{
- switch (type)
- {
- case R_PP15 :
- case R_PP15W :
- case R_PP15H :
- case R_PP16B :
- case R_PPN15 :
- case R_PPN15W :
- case R_PPN15H :
- case R_PPN16B :
- case R_PPLBASE : return 22;
-
- case R_PPL15 :
- case R_PPL15W :
- case R_PPL15H :
- case R_PPL16B :
- case R_PPLN15 :
- case R_PPLN15W :
- case R_PPLN15H :
- case R_PPLN16B :
- case R_PPBASE : return 0;
-
- default : return 0;
- }
-}
-
-
-/*************************************************************************/
-/* */
-/* RELOC_STOP() - */
-/* Return the number of bits to read for a relocation type. */
-/* */
-/*************************************************************************/
-
-int reloc_stop(int type)
-{
- switch (type)
- {
- case R_PPBASE :
- case R_PPLBASE :
-
- case R_PP15 :
- case R_PP15W :
- case R_PP15H :
- case R_PP16B :
-
- case R_PPL15 :
- case R_PPL15W :
- case R_PPL15H :
- case R_PPL16B :
-
- case R_PPN15 :
- case R_PPN15W :
- case R_PPN15H :
- case R_PPN16B :
-
- case R_PPLN15 :
- case R_PPLN15W :
- case R_PPLN15H :
- case R_PPLN16B : return 64;
-
- default : return WORDSZ * 8;
- }
-}
-
-
-/******************************************************************************/
-/* */
-/* SYM_RELOC_AMOUNT() - Determine the amount of relocation for a particular */
-/* relocation entry. Search the relocation symbol table */
-/* for the referenced symbol, and return the amount from */
-/* the table. */
-/* */
-/******************************************************************************/
-int sym_reloc_amount(RELOC *rp)
-{
- int index = rp->r_symndx;
-
- int i = 0,
- j = reloc_sym_index - 1;
-
- /*-------------------------------------------------------------------------*/
- /* THIS IS A SIMPLE BINARY SEARCH (THE RELOC TABLE IS ALWAYS SORTED). */
- /*-------------------------------------------------------------------------*/
- while (i <= j)
- {
- int m = (i + j) / 2;
- if (reloc_tab[m].rt_index < index) i = m + 1;
- else if (reloc_tab[m].rt_index > index) j = m - 1;
- else return reloc_tab[m].rt_disp; /* FOUND */
- }
-
- /*-------------------------------------------------------------------------*/
- /* IF NOT FOUND, SYMBOL WAS NOT RELOCATED. */
- /*-------------------------------------------------------------------------*/
- return 0;
-}
-
-
-/******************************************************************************/
-/* */
-/* UNPACK() - Extract a relocation field from object bytes and convert into */
-/* a int so it can be relocated. */
-/* */
-/******************************************************************************/
-unsigned int unpack(unsigned char *data, int fieldsz, int wordsz, int bit_offset)
-{
- register int i;
- unsigned int objval;
- int start; /* MS byte with reloc data */
- int stop; /* LS byte with reloc data */
- int r = bit_offset & 7; /* num unused LS bits in stop */
- int l = 8 - r; /* num used MS bits in stop */
- int tr = ((bit_offset+fieldsz-1) & 7)+1; /* # LS bits in strt*/
- int tl = 8 - tr; /* num unused MS bits in start */
-
- start = (big_e_target ? (wordsz-fieldsz-bit_offset) :
- (bit_offset+fieldsz-1)) >>3;
- stop = (big_e_target ? (wordsz-bit_offset-1) : bit_offset) >>3;
-
- if (start == stop) return (data[stop] >> r) & ((0x1 << fieldsz) - 0x1);
-
- objval = (unsigned)((data[start] << tl) & 0xFF) >> tl;
-
- if (big_e_target)
- for (i=start+1; i<stop; ++i) objval = (objval << 8) | data[i];
- else for (i=start-1; i>stop; --i) objval = (objval << 8) | data[i];
-
- return (objval << l) | (data[stop] >> r);
-}
-
-
-
-/******************************************************************************/
-/* */
-/* REPACK() - Encode a binary relocated field back into the object data. */
-/* */
-/******************************************************************************/
-void repack(unsigned int objval, unsigned char *data, int fieldsz,
- int wordsz, int bit_offset)
-{
- register int i;
- int start; /* MS byte with reloc data */
- int stop; /* LS byte with reloc data */
- int r = bit_offset & 7; /* num unused LS bits in stop */
- int l = 8 - r; /* num used MS bits in stop */
- int tr = ((bit_offset+fieldsz-1) & 7)+1; /* # LS bits in strt */
- unsigned int mask = (1ul << fieldsz) - 1ul;
-
- if (fieldsz < sizeof(objval)) objval &= mask;
-
- start = (big_e_target ? (wordsz-fieldsz-bit_offset) :
- (bit_offset+fieldsz-1)) >>3;
- stop = (big_e_target ? (wordsz-bit_offset-1) : bit_offset) >>3;
-
- if (start == stop)
- {
- data[stop] &= ~(mask << r);
- data[stop] |= (objval << r);
- return;
- }
-
- data[start] &= ~((1<<tr)-1);
- data[stop] &= ((1<< r)-1);
- data[stop] |= (objval << r);
- objval >>= l;
-
- if (big_e_target)
- for (i = stop - 1; i > start; objval >>= 8) data[i--] = objval;
- else for (i = stop + 1; i < start; objval >>= 8) data[i++] = objval;
-
- data[start] |= objval;
-}
-
-
-/******************************************************************************/
-/* */
-/* CLOAD_LINENO() - Read in, swap, and relocate line number entries. This */
-/* function is not called directly by the loader, but by the */
-/* application when it needs to read in line number entries. */
-/* */
-/******************************************************************************/
-int cload_lineno(int filptr, int count, LINENO *lptr, int scnum)
-{
-/* int filptr; WHERE TO READ FROM */
-/* int count; HOW MANY TO READ */
-/* LINENO *lptr; WHERE TO PUT THEM */
-/* int scnum; SECTION NUMBER OF THESE ENTRIES */
-
- int i;
-
- /*------------------------------------------------------------------------*/
- /* READ IN THE REQUESTED NUMBER OF LINE NUMBER ENTRIES AS A BLOCK. */
- /*------------------------------------------------------------------------*/
-#if FILE_BASED
- if (fseek(fin, filptr, 0) != 0) { load_err = E_FILE; return FALSE; }
- for (i = 0; i < count; i++)
- if (fread(lptr + i, 1, LINESZ, fin) != LINESZ)
- { load_err = E_FILE; return FALSE; }
-#else
- for (i = 0; i < count; i++)
- mem_copy((void*)(lptr+i), (void*)&gRxBuffer[filptr + i*LINESZ], LINESZ);
-#endif
- /*------------------------------------------------------------------------*/
- /* SWAP AND RELOCATE EACH ENTRY, AS NECESSARY. */
- /*------------------------------------------------------------------------*/
- if (byte_swapped || RUN_RELOC_AMOUNT(scnum - 1))
- for (i = 0; i < count; i++, lptr++)
- {
- if (byte_swapped)
- {
- swap2byte(&lptr->l_lnno);
- swap4byte(&lptr->l_addr.l_paddr);
- }
-
- if (lptr->l_lnno != 0)
- lptr->l_addr.l_paddr += RUN_RELOC_AMOUNT(scnum - 1);
- }
-
- return TRUE;
-}
-
-
-/******************************************************************************/
-/* */
-/* SWAP4BYTE() - Swap the order of bytes in a int. */
-/* */
-/******************************************************************************/
-void swap4byte(void *addr)
-{
- unsigned int *value = (unsigned int *)addr;
- unsigned int temp1, temp2, temp3, temp4;
-
- temp1 = (*value) & 0xFF;
- temp2 = (*value >> 8) & 0xFF;
- temp3 = (*value >> 16) & 0xFF;
- temp4 = (*value >> 24) & 0xFF;
-
- *value = (temp1 << 24) | (temp2 << 16) | (temp3 << 8) | temp4;
-}
-
-
-/******************************************************************************/
-/* */
-/* SWAP2BYTE() - Swap the order of bytes in a short. */
-/* */
-/******************************************************************************/
-void swap2byte(void *addr)
-{
- unsigned short *value = (unsigned short *)addr;
- unsigned short temp1,temp2;
-
- temp1 = temp2 = *value;
- *value = ((temp2 & 0xFF) << 8) | ((temp1 >> 8) & 0xFF);
-}
diff --git a/src/interp/coff/cload.mike.h b/src/interp/coff/cload.mike.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/***************************************************************************
-* FILENAME: cload.h
-* VERSION: 2.4 5/2/96 13:12:48
-* SCCS ID: "@(#)cload.h 2.4 5/2/96"
-***************************************************************************/
-/*****************************************************************************/
-/* CLOAD.H - Header file for Generic COFF Loader Version 4.00 9/92 */
-/*****************************************************************************/
-#ifndef _CLOAD_H_
-#define _CLOAD_H_
-
-typedef unsigned int T_ADDR; /* TYPE FOR TARGET ADDRESS */
-typedef unsigned int T_DATA; /* TYPE FOR TARGET DATA WORD */
-typedef unsigned int T_SIZE; /* TYPE FOR CINIT SIZE FIELD */
-typedef unsigned int T_IADDR; /* TYPE FOR CINIT ADDRESS FIELD */
-typedef unsigned int T_INSTRUCT; /* TYPE FOR INSTRUCTION OPCODE */
-
-#define FT_IEEE_FLT 1
-#define FT_IEEE_DBL 2
-#define FLT_PRECISION 4
-
-typedef struct trg_fval {
- unsigned int fval1;
- unsigned int fval2;
-} TRG_FVAL;
-
-#define MAGIC MAGIC_C60 /* C60 Magic Number */
-
-#define LOCTOBYTE(x) (x) /* C60 addresses are same as bytes */
-#define BYTETOLOC(x) (x)
-#define BIT_OFFSET(a) (0) /* BIT OFFSET OF ADDR WITHIN BYTE */
-
-#ifdef OTIS
-#define LOADBUFSIZE (TRG_MAX_MBLK/8) /* USE OTIS BUFFER SIZE */
-#else
-#define LOADBUFSIZE 0x4000 /* 16K BUFFER FOR LOADING DATA */
-//#define UNBUFFERED 1
-#endif
-
-#define LOADWORDSIZE 8 /* MINIMUM DIVISOR OF LOAD SIZE */
-#define CINIT ".cinit" /* NAME OF CINIT SECTION */
-#define INIT_ALIGN 8 /* ALIGNMENT OF CINIT RECORDS */
-#define INIT_WSIZE 4 /* SIZE IN BYTES OF INIT DATA ITEMS */
-
-
-/*---------------------------------------------------------------------------*/
-/* THIS MACRO IS USED TO FACILIATE ACCESS TO THE SECTION HEADERS */
-/*---------------------------------------------------------------------------*/
-#define SECT_HDR(i) ((SCNHDR *)(sect_hdrs + (i) * SCNHSZ))
-
-/*---------------------------------------------------------------------------*/
-/* THIS MACRO IS USED TO FACILITATE BACKWARDS COMPATIBILITY FOR COFF- */
-/* DEPENDENT TOOLS THAT SUPPORT COFF VERSION 2. */
-/*---------------------------------------------------------------------------*/
-#define O_SECT_HDR(i) ((O_SCNHDR *)(o_sect_hdrs + (i)*SCNHSZ_IN(coff_version)))
-
-/*----------------------------------------------------------------------------*/
-/* STATIC COPY OF 8 CHARACTER SECTION NAME, GUARANTEED NULL TERMINATION WHEN */
-/* USED AS A STRING. */
-/*----------------------------------------------------------------------------*/
-static char stat_nm[SYMNMLEN+1]={'\0','\0','\0','\0','\0','\0','\0','\0','\0'};
-#define SNAMECPY(s) (strncpy(stat_nm, (s), SYMNMLEN))
-
-/*---------------------------------------------------------------------------*/
-/* THESE MACROS ARE USED TO FIND CINIT AND BSS SECTIONS */
-/*---------------------------------------------------------------------------*/
-#define IS_BSS(sptr) (!str_comp(sptr->s_name, ".bss"))
-#define IS_CINIT(sptr) ((sptr->s_flags & STYP_COPY) && \
- !str_comp(sptr->s_name, CINIT) )
-
-/*---------------------------------------------------------------------------*/
-/* VARIABLES SET BY THE APPLICATION. */
-/*---------------------------------------------------------------------------*/
-#define FILE_BASED 0
-#define STRIP_RELOC 1
-#define REMOVE_MALLOC 0
-
-#if (FILE_BASED)
-FILE *fin; /* INPUT FILE */
-#else
-/* extern unsigned char gRxBuffer[0x400040]; */
-extern unsigned char gRxBuffer[0x10];
-#endif
-
-extern int need_data; /* READ IN RAW DATA */
-extern int need_symbols; /* READ IN SYMBOL TABLE */
-extern int clear_bss; /* CLEAR BSS SECTION */
-extern int big_e_config; /* ENDIANNESS CONFIGURATION OF TARGET */
-#if TMS320C60 || RTC
-extern int fill_bss_value; /* NUMBER FOR FILL VALUE */
-#endif
-
-/*---------------------------------------------------------------------------*/
-/* VARIABLES SET BY THE LOADER. */
-/*---------------------------------------------------------------------------*/
-extern FILHDR file_hdr; /* FILE HEADER STRUCTURE */
-extern int coff_version; /* VERSION OF COFF USED BY FILE */
-extern AOUTHDR o_filehdr; /* OPTIONAL (A.OUT) FILE HEADER */
-extern T_ADDR entry_point; /* ENTRY POINT OF MODULE */
-extern T_ADDR *reloc_amount; /* AMOUNT OF RELOCATION PER SECTION */
-extern SCNHDR sect_hdrs[]; /* Array of loadable sections */
-extern O_SCNHDR o_sect_hdr; /* A single old section header */
-extern int n_sections; /* NUMBER OF SECTIONS IN THE FILE */
-extern int big_e_target; /* OBJECT DATA IS STORED MSB FIRST */
-extern int byte_swapped; /* BYTE ORDERING OPPOSITE OF HOST */
-extern int curr_sect; /* INDEX OF SECTION CURRENTLY LOADING */
-extern int load_err; /* ERROR CODE RETURNED IF LOADER FAILS */
-extern struct strtab *str_head; /* HEAD OF STRING BUFFER LIST */
-
-/*--------------------------------------------------------------------------*/
-/* CLOAD.C PROTOTYPES */
-/*--------------------------------------------------------------------------*/
-extern int cload(BOOT_MODULE_FXN_TABLE *bootFxn, Uint32 *ientry_point);
-extern int cload_headers(BOOT_MODULE_FXN_TABLE *bootFxn, Uint32 *ientry_point);
-extern int cload_data(BOOT_MODULE_FXN_TABLE *bootFxn);
-extern int cload_sect_data(SCNHDR *sptr, BOOT_MODULE_FXN_TABLE *bootFxn);
-extern int cload_cinit (unsigned char *, int *, int *);
-extern int cload_symbols (void);
-extern int cload_strings (void);
-extern void str_free (struct strtab *);
-extern int sym_read (int, struct syment *, union auxent *);
-extern char *sym_name (struct syment *);
-extern char *sym_add_name (struct syment *);
-extern int reloc_add (int, struct syment *);
-extern int relocate (RELOC *, unsigned char *, int);
-extern int reloc_read (RELOC *, unsigned int offset);
-extern int reloc_size (int);
-extern int reloc_offset (int);
-extern int reloc_stop (int);
-extern int sym_reloc_amount (RELOC *);
-extern unsigned int unpack (unsigned char *, int, int, int);
-extern void repack (unsigned int, unsigned char *, int,int,int);
-extern int cload_lineno (int, int, struct lineno *, int);
-extern void swap4byte (void *);
-extern void swap2byte (void *);
-
-/*--------------------------------------------------------------------------*/
-/* PROTOTYPES FOR FUNCTIONS REQUIRED BY CLOAD.C */
-/*--------------------------------------------------------------------------*/
-extern void lookup_sym(int indx, SYMENT *sym, AUXENT *aux);
-extern int mem_write(unsigned char *, unsigned int, T_ADDR, unsigned char);
-extern void load_msg(const char *);
-extern int set_reloc_amount(void);
-extern int load_syms(int);
-
-/*---------------------------------------------------------------------------*/
-/* VALUE OF big_e_config IF THERE IS NO TARGET AND SO IT'S A DON'T CARE. */
-/*---------------------------------------------------------------------------*/
-#define DONTCARE -1
-
-/*---------------------------------------------------------------------------*/
-/* ERROR CODES */
-/*---------------------------------------------------------------------------*/
-#define E_FILE 1 /* ERROR READING COFF FILE */
-#define E_MAGIC 2 /* WRONG MAGIC NUMBER */
-#define E_RELOC 3 /* FILE IS NOT RELOCATABLE */
-#define E_SYM 4 /* LOAD_SYM RETURNED FALSE */
-#define E_ALLOC 5 /* MYALLOC OR MRALLOC RETURNED FALSE */
-#define E_SETRELOC 6 /* SET_RELOC_AMOUNT RETURNED FALSE */
-#define E_MEMWRITE 7 /* MEM_WRITE RETURNED FALSE */
-#define E_RELOCENT 8 /* RELOC ENTRY RULES VIOLATED */
-#define E_ENDIAN 9 /* OBJ ENDIANESS CONFLICTS WITH TARGET */
-
-#endif /* _CLOAD_H_ */
diff --git a/src/interp/coff/coff.mike.h b/src/interp/coff/coff.mike.h
+++ /dev/null
@@ -1,884 +0,0 @@
-/**************************************************************************/
-/* COFF.H - Definition of COFF structures and definitions. */
-/* */
-/* This file defines all standard COFF definitions, used by any program */
-/* which reads or writes COFF files. */
-/* */
-/* HISTORY */
-/* --/--/83 - Original (lost in the mists of time) */
-/* --/--/91 - Tektronics relocation entry kludge */
-/* 01/07/94 RET - Reworked file header and relocation entries, add */
-/* COFF version support. (Removed Tek kludge) */
-/* 12/24/95 TMS - Reworked section header structures for COFF 2 */
-/* */
-/**************************************************************************/
-#ifndef COFF_H
-#define COFF_H
-
-#if defined(TOOL_ASSEMBLER)
- #error The COFF submodule should no longer be used by the assembler; use TICOFF04
-#endif
-
-/*------------------------------------------------------------------------*/
-/* COFF VERSION FLAGS */
-/*------------------------------------------------------------------------*/
-#if !defined(COFF_VERSION_0) && \
- !defined(COFF_VERSION_1) && \
- !defined(COFF_VERSION_2)
-#define COFF_VERSION_0 0
-#define COFF_VERSION_1 0
-#define COFF_VERSION_2 1
-#endif
-
-#ifndef COFF_VERSION_0
-#define COFF_VERSION_0 0
-#endif
-
-#ifndef COFF_VERSION_1
-#define COFF_VERSION_1 0
-#endif
-
-#ifndef COFF_VERSION_2
-#define COFF_VERSION_2 0
-#endif
-
-/*------------------------------------------------------------------------*/
-/* COFF MAGIC NUMBERS */
-/*------------------------------------------------------------------------*/
-#define COFF_MAGIC_0 0xc0 /* ORIGINAL VERSION OF COFF */
-#define COFF_MAGIC_1 0xc1
-#define COFF_MAGIC_2 0xc2
-
-/*------------------------------------------------------------------------*/
-/* COFF TARGET ID's (FORMERLY MAGIC NUMBERS) */
-/* NOTE!!! DEFINE THE MACRO "MAGIC" TO BE ONE OF THESE MACROS. */
-/*------------------------------------------------------------------------*/
-#define MAGIC_340 0x90
-#define MAGIC_370 0x91
-#define MAGIC_DSP 0x92
-#define MAGIC_C30 0x93
-#define MAGIC_380 0x94
-#define MAGIC_MVP 0x95
-#define MAGIC_C16 0x96
-#define MAGIC_ARM 0x97
-#define MAGIC_LEAD 0x98
-#define MAGIC_C60 0x99
-#define MAGIC_C8P 0x9a
-#define MAGIC_unused1 0x9b
-#define MAGIC_LEAD3 0x9c
-#define MAGIC_ANKOOR 0x9d
-#define MAGIC_unused 0x9e
-#define MAGIC_TARANTULA 0x9f
-#define MAGIC_MSP 0xA0
-#define MAGIC_LEAD3_R35 0xA1
-
-#define MAGIC_MIN 0x90 /* MINIMUM VALID MAGIC NUMBER */
-#define MAGIC_MAX 0xA1 /* MAXIMUM VALID MAGIC NUMBER */
-
-/*------------------------------------------------------------------------*/
-/* Macros to recognize magic numbers */
-/* NOTE: ISMAGIC() is now a target-specific macro defined in coff_trg.h */
-/*------------------------------------------------------------------------*/
-#define ISCOFF(x) (ISCOFF_0(x)||ISCOFF_1(x)||ISCOFF_2(x)||ISMAGIC(x))
-#define BADMAGIC(x) (((unsigned short)(x) & 0x8080) && !ISMAGIC(x))
-
-#define ISEXE(x) ((x >> 1) & 0x0001)
-
-#if COFF_VERSION_2
-#define ISCOFF_0(x) ((unsigned short)(x) == COFF_MAGIC_0)
-#define ISCOFF_1(x) ((unsigned short)(x) == COFF_MAGIC_1)
-#define ISCOFF_2(x) ((unsigned short)(x) == COFF_MAGIC_2)
-#elif COFF_VERSION_1
-#define ISCOFF_0(x) ((unsigned short)(x) == COFF_MAGIC_0)
-#define ISCOFF_1(x) ((unsigned short)(x) == COFF_MAGIC_1)
-#define ISCOFF_2(x) FALSE
-#else
-#define ISCOFF_0(x) FALSE
-#define ISCOFF_1(x) FALSE
-#define ISCOFF_2(x) FALSE
-#endif
-
-#define ISMAGIC_ANY(x) (((unsigned short)(x)) >= MAGIC_MIN && \
- ((unsigned short)(x)) <= MAGIC_MAX)
-#define ISCOFF_ANY(x) (ISCOFF_0(x) || ISCOFF_1(x) || \
- ISCOFF_2(x) || ISMAGIC_ANY(x))
-
-#include "coffdefs.h"
-
-/*------------------------------------------------------------------------*/
-/* COFF FILE HEADER */
-/*------------------------------------------------------------------------*/
-struct filehdr
-{
- unsigned short f_magic; /* magic number */
- unsigned short f_nscns; /* number of sections */
- unsigned int f_timdat; /* time & date stamp */
- unsigned int f_symptr; /* file pointer to symtab */
- unsigned int f_nsyms; /* number of symtab entries */
- unsigned short f_opthdr; /* sizeof(optional hdr) */
- unsigned short f_flags; /* flags */
- unsigned short f_target_id; /* target architecture id */
-};
-
-#define FILHDR struct filehdr
-#define FILHSZ (COFF_VERSION_0 ? 20 : 22)
-#define FILHSZ_IN(version) (version >= COFF_MAGIC_1 ? 22 : 20)
-
-/*------------------------------------------------------------------------*/
-/* File header flags */
-/*------------------------------------------------------------------------*/
-#define F_RELFLG 0x01 /* relocation info stripped from file */
-#define F_EXEC 0x02 /* file is executable (no unresolved refs) */
-#define F_LNNO 0x04 /* line nunbers stripped from file */
-#define F_LSYMS 0x08 /* local symbols stripped from file */
-
- /*------------------------------------------------------------------------*/
-/* Target device identification flags (bits 4-7 in file header flags) */
-/*------------------------------------------------------------------------*/
-#define F_VERS0 0x0 /* 0th generation CPU */
-#define F_VERS1 0x10 /* 1st generation CPU */
-#define F_VERS2 0x20 /* 2nd generation CPU */
-#define F_VERS3 0x40 /* 3rd generation CPU */
-#define F_VERS4 0x80 /* 4th generation CPU */
-#define F_VERSION (F_VERS1 | F_VERS2 | F_VERS3 | F_VERS4)
-
-/*------------------------------------------------------------------------*/
-/* Target device raw data byte ordering flags (bits 8-9) */
-/*------------------------------------------------------------------------*/
-#define F_LITTLE 0x100 /* object code is LSB first */
-#define F_BIG 0x200 /* object code is MSB first */
-#define F_BYTE_ORDER (F_LITTLE | F_BIG)
-
-#define F_SYMMERGE 0x1000 /* Tags, etc were merged - no duplicates */
-
-#define F_ICODE 0x2000 /* This file contains embedded I-Code */
-
-\f
-/*------------------------------------------------------------------------*/
-/* OPTIONAL FILE HEADER */
-/*------------------------------------------------------------------------*/
-typedef struct aouthdr
-{
- short magic; /* optional file header magic number */
- short vstamp; /* version stamp */
- int tsize; /* text size in bytes, padded to FW bdry*/
- int dsize; /* initialized data " " */
- int bsize; /* uninitialized data " " */
- int entrypt; /* entry pt. */
- int text_start; /* base of text used for this file */
- int data_start; /* base of data used for this file */
-} AOUTHDR;
-
-#define AOUTSZ sizeof(AOUTHDR)
-#define AOUT1MAGIC 0x108
-
-\f
-/*------------------------------------------------------------------------*/
-/* COMMON ARCHIVE FILE STRUCTURES */
-/* */
-/* ARCHIVE File Organization: */
-/* +---------------------------------------------+ */
-/* | ARCHIVE_MAGIC_STRING | */
-/* +---------------------------------------------+ */
-/* | ARCHIVE_FILE_MEMBER_1 | */
-/* +- - - - - - - - - - - - - - - - - - - - - - -+ */
-/* | Archive File Header "ar_hdr" | */
-/* | Contents (Ext symbol direct, text file) | */
-/* +---------------------------------------------+ */
-/* | ARCHIVE_FILE_MEMBER_2 | */
-/* +- - - - - - - - - - - - - - - - - - - - - - -+ */
-/* | Archive File Header "ar_hdr" | */
-/* | Contents (long file member name table) | */
-/* +---------------------------------------------+ */
-/* | ARCHIVE_FILE_MEMBER_3 | */
-/* +- - - - - - - - - - - - - - - - - - - - - - -+ */
-/* | Archive File Header "ar_hdr" | */
-/* | Contents (.o or text file) | */
-/* +---------------------------------------------+ */
-/* | . . . | */
-/* | . . . | */
-/* | . . . | */
-/* +---------------------------------------------+ */
-/* | ARCHIVE_FILE_MEMBER_n | */
-/* +- - - - - - - - - - - - - - - - - - - - - - -+ */
-/* | Archive File Header "ar_hdr" | */
-/* | Contents (.o or text file) | */
-/* +---------------------------------------------+ */
-/* */
-/*------------------------------------------------------------------------*/
-
-#define ARMAG "!<arch>\n"
-#define SARMAG 8
-#define ARFMAG "`\n"
-#define ARFMAG_SIZE 2
-
-struct ar_hdr /* archive file member header - printable ascii */
-{
- char ar_name[16]; /* file member name - `/' terminated */
- char ar_date[12]; /* file member date - decimal */
- char ar_offset[6]; /* file member offset - decimal */
- char ar_gid[6]; /* file member group id - decimal */
- char ar_mode[8]; /* file member mode - octal */
- char ar_size[10]; /* file member size - decimal */
- char ar_fmag[2]; /* ARFMAG - string to end header */
-};
-
-#define ARHDR struct ar_hdr
-#define ARHSZ sizeof(ARHDR)
-#define AR_HDR_SZ sizeof(ARHDR)
-#define AR_FNAME_SIZE 16
-#define MAGIC_LONGFILENAME 1
-#define LONGFILENAME "<filenames>"
-#define SYMDIRNAME "/ "
-
-\f
-/*------------------------------------------------------------------------*/
-/* SECTION HEADER */
-/*------------------------------------------------------------------------*/
-#define SYMNMLEN 8 /* Number of characters in a symbol name */
-
-/*------------------------------------------------------------------------*/
-/* THE OLD COFF VERSION TYPE DEFINITION FOR SECTION HEADERS TO PROVIDE */
-/* BACKWARDS COMPATIBILITY FOR COFF-DEPENDENT TOOLS THAT SUPPORT COFF 2. */
-/*------------------------------------------------------------------------*/
-struct o_scnhdr
-{
- char os_name[8]; /* section name */
- int os_paddr; /* physical address */
- int os_vaddr; /* virtual address */
- int os_size; /* section size */
- int os_scnptr; /* file ptr to raw data for scn */
- int os_relptr; /* file ptr to relocation */
- int os_lnnoptr; /* file ptr to line numbers */
- unsigned short os_nreloc; /* number of relocation entries */
- unsigned short os_nlnno; /* number of line number entries */
- unsigned short os_flags; /* flags */
- char os_reserved; /* reserved byte */
- unsigned char os_page; /* memory page id */
-};
-
-/*------------------------------------------------------------------------*/
-/* THE NEW COFF VERSION TYPE DEFINITION FOR SECTION HEADERS. THIS */
-/* REVISION ALLOWS FOR UNRESTRICTED SECTION NAME LENGTH. */
-/*------------------------------------------------------------------------*/
-struct scnhdr
-{
- union
- {
- char _s_name[SYMNMLEN]; /* old COFF version name fld */
- struct
- {
- int _s_zeroes; /* new == 0 */
- int _s_offset; /* offset into string table */
- } _s_s;
- char *_s_nptr[2]; /* allows for overlaying */
- } _s;
-
- int s_paddr; /* physical address */
- int s_vaddr; /* virtual address */
- int s_size; /* section size */
- int s_scnptr; /* file ptr to raw data for section */
- int s_relptr; /* file ptr to relocation */
- int s_lnnoptr; /* file ptr to line numbers */
- unsigned int s_nreloc; /* number of relocation entries */
- unsigned int s_nlnno; /* number of line number entries */
- unsigned int s_flags; /* flags */
- unsigned char s_mwidth; /* memory width in bits */
- /* (0 == target memory width) */
- unsigned char s_reserved; /* reserved byte */
- unsigned short s_page; /* memory page id */
-};
-
-#define s_name _s._s_name
-#define s_nptr _s._s_nptr[1]
-#define s_zeroes _s._s_s._s_zeroes
-#define s_offset _s._s_s._s_offset
-
-#define O_SCNHDR struct o_scnhdr
-#define SCNHDR struct scnhdr
-#define O_SCNHSZ sizeof(O_SCNHDR)
-#define SCNHSZ sizeof(SCNHDR)
-#define SCNHSZ_IN(version) (version == COFF_MAGIC_2 ? SCNHSZ : O_SCNHSZ)
-
-/*------------------------------------------------------------------------*/
-/* Define constants for names of "special" sections */
-/*------------------------------------------------------------------------*/
-#define _TEXT ".text"
-#define _DATA ".data"
-#define _BSS ".bss"
-#define _REG ".reg"
-#define _BINIT ".binit"
-#define _CINIT ".cinit"
-#define _PINIT ".pinit"
-#define _ICODE ".icode"
-
-#define _OVLY_PREFIX ".ovly:"
-
-#define IS_DWARF_SECTION(name) (!strncmp(name, ".debug_", 7))
-
-/*------------------------------------------------------------------------*/
-/* Bits 0-8 of s_flags are used as a section "type" */
-/*------------------------------------------------------------------------*/
-#define STYP_REG 0x00 /* "regular" : allocated, relocated, loaded */
-#define STYP_DSECT 0x01 /* "dummy" : !allocated, relocated, !loaded */
-#define STYP_NOLOAD 0x02 /* "noload" : allocated, relocated, !loaded */
-#define STYP_XXX1 0x04 /* not used - was STYP_GROUP */
-#define STYP_XXX2 0x08 /* not used - was STYP_PAD */
-#define STYP_COPY 0x10 /* "copy" : used for C init tables -
- not allocated, relocated,
- loaded; reloc & lineno
- entries processed normally */
-#define STYP_TEXT 0x20 /* section contains text only */
-#define STYP_DATA 0x40 /* section contains data only */
-#define STYP_BSS 0x80 /* section contains bss only */
-
-/*------------------------------------------------------------------------*/
-/* Bits 8-11 specify an alignment. The alignment is (2 ** x), where x is */
-/* is the encoded value */
-/*------------------------------------------------------------------------*/
-#define ALIGN_MASK 0xF00 /* mask for alignment factor */
-#define ALIGN_SIZE(s_flag) (1 << (((unsigned)s_flag & ALIGN_MASK) >> 8))
-#define ALIGN_GET(header) (((header).s_flags & ALIGN_MASK) >> 8)
-#define ALIGN_SET(header,amt) (header).s_flags = \
- (((header).s_flags & ~ALIGN_MASK) | ((amt << 8) & ALIGN_MASK))
-
-/*------------------------------------------------------------------------*/
-/* bit 12-31 */
-/*------------------------------------------------------------------------*/
-#define STYP_BLOCK 0x01000 /* use alignment as blocking factor */
-#define STYP_PASS 0x02000 /* Pass section through unchanged */
-#define STYP_CLINK 0x04000 /* Conditionally link section */
-
-#define STYP_VECTOR 0x08000 /* section contains vector table */
- /* (Used in addition to STYP_TEXT) */
-
-#define STYP_PADDED 0x10000 /* section HAS BEEN padded. Do not pad */
- /* again if partial linking. */
-#define STYP_ICODE 0x20000 /* section has ICODE associated with it */
-
-#define STYP_LGT 0x40000 /* linker generated table section */
-#define STYP_COMMON 0x80000 /* comdat section - remove duplicates */
-
-#define STYP_BASIC_MASK 0xFF /* basic section types */
-#define STYP_TIEXT_MASK 0xFF000 /* TI section type extensions */
-
-/*------------------------------------------------------------------------*/
-/* A mask for all the flags we support - anything else is garbage. */
-/*------------------------------------------------------------------------*/
-#define STYP_KNOWN_MASK (ALIGN_MASK | STYP_BASIC_MASK | STYP_TIEXT_MASK)
-
-\f
-/*------------------------------------------------------------------------*/
-/* RELOCATION ENTRIES */
-/* WE SUPPORT TWO TYPES OF RELOCATION ENTRIES: */
-/* 1) OLD STYLE, WITH 16 BIT SYMBOL TABLE INDEX. */
-/* 2) NEW STYLE, WITH 32 BIT SYMBOL TABLE INDEX. */
-/* FOR ANY GIVEN INPUT FILE, THE FILE HEADER FLAG "F_RELOC_12" INDICATES */
-/* THE TYPE OF RELOCATION ENTRY IN THE FILE. */
-/* THE TARGET-SPECIFIC FLAG RELOC_ENTRY_12 DETERMINES WHETHER THE NEW */
-/* STYLE IS SUPPORTED ON A GIVEN TARGET. */
-/*------------------------------------------------------------------------*/
-typedef struct reloc_old
-{
- int r_vaddr; /* (virtual) address of reference */
-
- union {
- struct {
- unsigned char _offset; /* bit offset of rel fld */
- unsigned char _fieldsz; /* size of rel fld */
- unsigned char _wordsz; /* # bytes containing rel fld */
- unsigned char _dum1;
-
- unsigned short _type;
- } _r_field;
-
- struct {
- unsigned int _spc; /* section relative PC */
- unsigned short _type; /* relocation type */
- } _r_spc;
-
- struct {
- unsigned int _uval; /* constant value */
- unsigned short _type; /* relocation type */
- } _r_uval;
-
- struct {
- short _symndx; /* 32-bit sym tbl index */
- unsigned short _disp; /* extra addr encode data */
- unsigned short _type; /* relocation type */
- } _r_sym;
- } _u_reloc;
-} RELOC_OLD;
-
-/*------------------------------------------------------------------------*/
-/* MAKE SURE THE RELOCATION STRUCTURE IS TIGHTLY PACKED TO AVOID HOST */
-/* ALIGNMENT MECHANISMS. */
-/*------------------------------------------------------------------------*/
-typedef struct reloc
-{
- int r_vaddr; /* (virtual) address of reference */
-
- union {
- struct {
- unsigned char _offset; /* bit offset of rel fld */
- unsigned char _fieldsz; /* size of rel fld */
- unsigned char _wordsz; /* # bytes containing rel fld */
- unsigned char _dum1;
- unsigned short _dum2;
-
- unsigned short _type;
- } _r_field;
-
- struct {
- unsigned int _spc; /* section relative PC */
- unsigned short _dum;
- unsigned short _type; /* relocation type */
- } _r_spc;
-
- struct {
- unsigned int _uval; /* constant value */
- unsigned short _dum;
- unsigned short _type; /* relocation type */
- } _r_uval;
-
- struct {
- int _symndx; /* 32-bit sym tbl index */
- unsigned short _disp; /* extra addr encode data */
- unsigned short _type; /* relocation type */
- } _r_sym;
- } _u_reloc;
-} RELOC;
-
-#define RELSZ (COFF_VERSION_0 ? 10 : 12)
-#define RELSZ_IN(version) ((version >= COFF_MAGIC_1) ? 12 : 10)
-
-/*------------------------------------------------------------------------*/
-/* Macros for accessing fields in relocation entry data structure. */
-/*------------------------------------------------------------------------*/
-#define r_offset _u_reloc._r_field._offset
-#define r_fieldsz _u_reloc._r_field._fieldsz
-#define r_wordsz _u_reloc._r_field._wordsz
-
-#define r_spc _u_reloc._r_spc._spc
-#define r_uval _u_reloc._r_uval._uval
-
-#define r_symndx _u_reloc._r_sym._symndx
-#define r_disp _u_reloc._r_sym._disp
-#define r_type _u_reloc._r_sym._type
-
-/*------------------------------------------------------------------------*/
-/* define all relocation types */
-/*------------------------------------------------------------------------*/
-#define R_ABS 0x0 /* absolute address - no relocation */
-#define R_DIR16 0x1 /* UNUSED */
-#define R_REL16 0x2 /* UNUSED */
-#define R_DIR24 0x4 /* UNUSED */
-#define R_REL24 0x5 /* 24 bits, direct */
-#define R_DIR32 0x6 /* UNUSED */
-#define R_RRRELREG 0xe /* RR: 8 bit relocatable register */
-
-#define R_RELBYTE 0xf /* 8 bits, direct */
-#define R_RELWORD 0x10 /* 16 bits, direct */
-#define R_RELLONG 0x11 /* 32 bits, direct */
-#define R_PCRBYTE 0x12 /* 8 bits, PC-relative */
-#define R_PCRWORD 0x13 /* 16 bits, PC-relative */
-#define R_PCRLONG 0x14 /* 32 bits, PC-relative */
- /* (See unsigned (LD3) versions below.) */
-#define R_PCR24 0x15 /* 24 bits, PC-relative */
-#define R_PCR23H 0x16 /* 23 bits, PC-rel in halfwords(x>>1) */
-#define R_PCR24W 0x17 /* 24 bits, PC-rel in words (x >> 2) */
-#define R_OCRLONG 0x18 /* GSP: 32 bits, one's compl direct */
-#define R_GSPPCR16 0x19 /* GSP: 16 bits, PC relative (in words) */
-#define R_GSPOPR32 0x1a /* GSP: 32 bits, direct big-endian */
-#define R_GSPPCA16 0x1b /* GSP: same as GSPPCR16, but PC const */
-#define R_OCBD32 0x1c /* GSP: 32 bits, 1's compl,big-endian */
-#define R_RRNREG 0x1d /* RR: 8 bit reloc. reg. w/ neg off */
-#define R_PARTLS16 0x20 /* Brahma: 16 bit offset of 24 bit addr */
-#define R_PARTMS8 0x21 /* Brahma: 8 bit page of 24 bit addr */
-#define R_PARTLS7 0x28 /* DSP: 7 bit offset of 16 bit addr */
-#define R_PARTMS9 0x29 /* DSP: 9 bit page of 16 bit addr */
-#define R_REL13 0x2a /* DSP: 13 bits, direct */
-#define R_REL23 0x2b /* DSP,C54X: 23 bits, direct (ext addr) */
-#define R_RELXPC 0x2c /* DSP,C54X: 16 bits, relative to XPC */
-#define R_HIEXT 0x2d /* C54X: Hi word of extended prog addr */
-#define R_HIWORD 0x31 /* RR: 8 bit reloc. hi byte of word */
-#define R_LABCOD 0x32 /* C16 16-bit code address relocation */
-
-#define R_PPBASE 0x34 /* PP: Global Base address type */
-#define R_PPLBASE 0x35 /* PP: Local Base address type */
-#define R_PP15 0x38 /* PP: Global 15 bit offset */
-#define R_PP15W 0x39 /* PP: Global 15 bit offset / 4 */
-#define R_PP15H 0x3a /* PP: Global 15 bit offset / 2 */
-#define R_PP16B 0x3b /* PP: Global 16 bit offset for bytes */
-#define R_PPL15 0x3c /* PP: Local 15 bit offset */
-#define R_PPL15W 0x3d /* PP: Local 15 bit offset divided by 4 */
-#define R_PPL15H 0x3e /* PP: Local 15 bit offset divided by 2 */
-#define R_PPL16B 0x3f /* PP: Local 16 bit offset for bytes */
-#define R_PPN15 0x40 /* PP: Global 15 bit neg offset */
-#define R_PPN15W 0x41 /* PP: Global 15 bit neg offset / 4 */
-#define R_PPN15H 0x42 /* PP: Global 15 bit neg offset / 2 */
-#define R_PPN16B 0x43 /* PP: Global 16 bit neg byte offset */
-#define R_PPLN15 0x44 /* PP: Local 15 bit neg offset */
-#define R_PPLN15W 0x45 /* PP: Local 15 bit neg offset / 4 */
-#define R_PPLN15H 0x46 /* PP: Local 15 bit neg offset / 2 */
-#define R_PPLN16B 0x47 /* PP: Local 16 bit neg byte offset */
-
-#define R_MPPCR 0x4f /* MP: 32-bit PC-relative / 4 */
-
-#define R_C60BASE 0x50 /* C60: Data Page Pointer Based Offset */
-#define R_C60DIR15 0x51 /* C60: LD/ST long Displacement */
-#define R_C60PCR21 0x52 /* C60: 21-bit PC Relative */
-#define R_C60PCR10 0x53 /* C60: 10-bit PC Relative */
-#define R_C60LO16 0x54 /* C60: MVK Low Half Register */
-#define R_C60HI16 0x55 /* C60: MVKH/MVKLH High Half Register */
-#define R_C60SECT 0x56 /* C60: Section-Based Offset */
-#define R_C60S16 0x57 /* C60: Signed 16-bit */
-#define R_C60PCR7 0x70 /* C60: 7-bit PC Relative */
-#define R_C60PCR12 0x71 /* C60: 12-bit PC Relative */
-#define R_C60PCR12H 0x72 /* C60: 12-bit PC Relative (Half) */
-#define R_C60PCR7J 0x73 /* C60: 7-bit PC Relative (-BNOP) */
-#define R_C60PCR8J 0x74 /* C60: 8-bit PC Relative (-BNOP) */
-#define R_C60PCR10J 0x75 /* C60: 10-bit PC Relative (-CALLP) */
-#define R_C60ALIGN 0x76 /* C60: Alignment info for compressor */
-#define R_C60FPHEAD 0x77 /* C60: Explicit assembly directive */
-#define R_C60NOCMP 0x100 /* C60: Don't compress this code scn */
-
-#define R_C8PHIBYTE 0x58 /* C8+: High byte of 24-bit address. */
-#define R_C8PMIDBYTE 0x59 /* C8+: Middle byte of 24-bit address. */
-#define R_C8PVECADR 0x5a /* C8+: Vector address (0xFFnnnn) */
-#define R_C8PADR24 0x5b /* C8+: 24-bit address (rev byte order) */
-
-#define R_PARTLS6 0x5d /* ANKOOR: 6 bit offset of 22 bit addr */
-#define R_PARTMID10 0x5e /* ANKOOR: Middle 10 bits of 22 bit addr*/
-#define R_REL22 0x5f /* ANKOOR: 22 bits, direct */
-#define R_PARTMS6 0x60 /* ANKOOR: Upper 6 bits of 22 bit addr */
-#define R_PARTMS16 0x61 /* ANKOOR: Upper 16 bits of 22 bit addr */
-#define R_ANKPCR16 0x62 /* ANKOOR: PC relative 16 bit */
-#define R_ANKPCR8 0x63 /* ANKOOR: PC relatvie 8 bit */
-#define R_ANKPTR 0x64 /* ANKOOR: 22 bit pointer */
-#define R_ANKHI16 0x65 /* ANKOOR: HI 16 bits of address + data */
-#define R_ANKLOPTR 0x66 /* ANKOOR: Pointer to low 64K */
-#define R_ANKNWORD 0x67 /* ANKOOR: 16 bit negated relocation */
-#define R_ANKNBYTE 0x68 /* ANKOOR: 8 bit negated relocation */
-#define R_ANKHIBYTE 0x69 /* ANKOOR: High byte of a word */
-#define R_REL13_SE16 0x6a /* MANTRA: 13 bit sign extend to 16 bit */
-
-#define R_LD3_DMA 0x78 /* LEAD3: 7 most sig bits of a byte, */
- /* unsigned value; used in DMA address */
- /* */
- /* 5432109876543210 */
- /* xxxxxxxxFFFFFFFx */
-
-#define R_LD3_MDP 0x7a /* LEAD3: 7 bits spanning two bytes, */
- /* unsigned value; used as MDP reg value*/
- /* */
- /* 321098765432109876543210 */
- /* xxxxxxxxxxxxxFFFFFFFxxxx */
-
-#define R_LD3_PDP 0x7b /* LEAD3: 9 bits spanning two bytes, */
- /* unsigned value; used as PDP reg value*/
- /* */
- /* 321098765432109876543210 */
- /* xxxxxxxxxxxFFFFFFFFFxxxx */
-
-#define R_LD3_REL23 0x7c /* LEAD3: 23 bit unsigned value in a */
- /* 24-bit-wide field */
-
-
-#define R_TARBASE 0x80 /* TARANTULA: Data Page Pointer Based Off */
-#define R_TARDIR12 0x81 /* TARANTULA: LD/ST long Displacement */
-#define R_TARLO16 0x82 /* TARANTULA: MVK Low Half Register */
-#define R_TARHI16 0x83 /* TARANTULA: MVKH/MVKLH High Half Reg */
-#define R_TARSECT 0x84 /* TARANTULA: Section-based offset */
-
-#define R_LD3_k8 0x88 /* LD3: Unsigned 8 bit, direct */
-#define R_LD3_k16 0x89 /* LD3: Unsigned 16 bit, direct */
-#define R_LD3_K8 0x8a /* LD3: Signed 8 bit, direct */
-#define R_LD3_K16 0x8b /* LD3: Signed 16 bit, direct */
-
-#define R_LD3_l8 0x8c /* LD3: Unsigned 8 bit, PC-relative */
-#define R_LD3_l16 0x8d /* LD3: Unsigned 16 bit, PC-relative */
-#define R_LD3_L8 0x8e /* LD3: Signed 8 bit, PC-relative */
-#define R_LD3_L16 0x8f /* LD3: Signed 16 bit, PC-relative */
-
-#define R_LD3_k4 0x90 /* LD3: Unsigned 4 bit shift immediate */
-#define R_LD3_k5 0x91 /* LD3: Unsigned 5 bit shift immediate */
-#define R_LD3_K5 0x92 /* LD3: Signed 5 bit shift immediate */
-#define R_LD3_k6 0x93 /* LD3: Unsigned 6 bit immediate */
-#define R_LD3_k12 0x94 /* LD3: Unsigned 12 bit immediate */
-#define R_LD3_ABS16 0x95 /* LD3: abs16(addr) truncated k16 */
-
-#define R_NONE 0x96 /* Encode dependencies between sections */
-
-#define R_MSP_PCR20_SRC 0x97 /* MSP: PC-rel 20-bit src ext encoding */
-#define R_MSP_PCR20_DST 0x98 /* MSP: PC-rel 20-bit dst ext encoding */
-#define R_MSP_PCR20_ODST 0x99 /* MSP: PC-rel 20-bit offset dst ext enc */
-#define R_MSP_EXT20_SRC 0x9A /* MSP: Relative 20-bit src ext encoding */
-#define R_MSP_EXT20_DST 0x9B /* MSP: Relative 20-bit dst ext encoding */
-#define R_MSP_EXT20_ODST 0x9C /* MSP: Rel 20-bit offset dst ext encoding */
-#define R_MSP_REL20_SRC 0x9D /* MSP: Relative 20-bit src opnd */
-#define R_MSP_REL20_DST 0x9E /* MSP: Relative 20-bit dst opnd */
-#define R_MSP_PCR16 0x9F /* MSP: PC-rel 16-bit encoding */
-#define R_MSP_PCR20_CALL 0xA0 /* MSP: PC-rel 20-bit call operand */
-#define R_MSP_REL16 0xA1 /* MSP: Relative 16-bit (20bit MSPx device)*/
-
-#define R_T2_PCR24H 0xA2 /* THUMB2: 24 bits, PC-rel in halfwords(x>>1) */
-#define R_T2_PCR20H 0xA3 /* THUMB2: 20 bits, PC-rel in halfwords(x>>1) */
-
-#define R_LD3_ABS24 0xA4 /* C55x+: LD_R_ABS, ST_R_ABS -- *(#k24) */
-#define R_LD3_SP_K9 0xA5 /* C55x+: SP += K9 w/ K9 encoded as (K9 >> 1) */
-\f
-/*---------------------------------------------------------------------------*/
-/* GENERIC relocation types for complex relocation expressions. */
-/* *** NOTE: This range of relocation types exists above 0x4000 *** */
-/* *** NOTE: Top bit of relocation type field used as SEGVALUE flag *** */
-/*---------------------------------------------------------------------------*/
-#define RE_ADD 0x4000 /* Operator Instructions: + */
-#define RE_SUB 0x4001 /* - */
-#define RE_NEG 0x4002 /* unary - */
-#define RE_MPY 0x4003 /* * */
-#define RE_DIV 0x4004 /* / */
-#define RE_MOD 0x4005 /* % */
-
-#define RE_SR 0x4006 /* >>u */
-#define RE_ASR 0x4007 /* >>s */
-#define RE_SL 0x4008 /* << */
-
-#define RE_AND 0x4009 /* & */
-#define RE_OR 0x400a /* | */
-#define RE_XOR 0x400b /* ^ */
-#define RE_NOTB 0x400c /* ~ */
-
-#define RE_ULDFLD 0x400d /* unsigned relocation field load */
-#define RE_SLDFLD 0x400e /* signed relocation field load */
-#define RE_USTFLD 0x400f /* unsigned relocation field store */
-#define RE_SSTFLD 0x4010 /* signed relocation field store */
-#define RE_XSTFLD 0x4016 /* signedness is irrelevant */
-
-#define RE_PUSH 0x4011 /* push symbol on the stack */
-#define RE_PUSHSV 0xc011 /* push symbol: SEGVALUE flag set */
-#define RE_PUSHSK 0x4012 /* push signed constant on the stack */
-#define RE_PUSHUK 0x4013 /* push unsigned constant on the stack */
-#define RE_PUSHPC 0x4014 /* push current section PC on the stack */
-#define RE_DUP 0x4015 /* duplicate tos and push copy */
-
-/*---------------------------------------------------------------------------*/
-/* Other useful generic relocation types */
-/*---------------------------------------------------------------------------*/
-#define RM_FIRST_MARKER 0x5000 /* First non-relocatable type marker */
-#define RM_RANGE 0x5000 /* Raw data marker - no relocation */
-#define RM_OBJ 0x5001 /* Raw data marker - no relocation */
-#define RM_DWARF_LENGTH 0x5002 /* Raw data marker - no relocation */
-#define RM_LAST_MARKER 0x5002 /* Last non-relocatable type marker */
-
-/*---------------------------------------------------------------------------*/
-/* Macro to determine whether relocation entry has a symbol on the section's */
-/* symbol list. Operator relocation types do not. */
-/*---------------------------------------------------------------------------*/
-#define isunary(x) ((x) == RE_NEG || (x) == RE_NOTB)
-#define isbinary(x) (ismathrel(x) && !isunary(x))
-#define issymrel(x) ((x) == RM_OBJ || (x) == RE_PUSH || \
- (x) == RE_PUSHSV || (x) < 0x4000)
-#define ismathrel(x) ((x) >= RE_ADD && (x) <= RE_NOTB)
-#define ispushrel(x) (((x) >= RE_PUSH && (x) <= RE_PUSHPC) || ((x) == RE_DUP))
-#define isldfldrel(x) ((x) == RE_ULDFLD || (x) == RE_SLDFLD)
-#define isstfldrel(x) ((x) == RE_USTFLD || (x) == RE_SSTFLD || (x) == RE_XSTFLD )
-#define ismarker(x) ((x) >= RM_FIRST_MARKER && (x) <= RM_LAST_MARKER)
-
-/*---------------------------------------------------------------------------*/
-/* Macro to determine if current relocation entry is a field instruction. */
-/*---------------------------------------------------------------------------*/
-#define isfldrel(x) (((x) >= RE_ULDFLD && (x) <= RE_SSTFLD) || ((x) == RE_XSTFLD))
-
-\f
-/*------------------------------------------------------------------------*/
-/* LINE NUMBER ENTRIES */
-/*------------------------------------------------------------------------*/
-struct lineno
-{
- union
- {
- int l_symndx; /* sym index of fcn name iff l_lnno == 0 */
- int l_paddr; /* (physical) address of line number */
- } l_addr;
- unsigned short l_lnno; /* line number */
-};
-
-#define LINENO struct lineno
-#define LINESZ 6 /* sizeof(LINENO) */
-
-\f
-/*------------------------------------------------------------------------*/
-/* SYMBOL TABLE ENTRIES */
-/*------------------------------------------------------------------------*/
-
-#define FILNMLEN 14 /* Number of characters in a file name */
-#define DIMNUM 4 /* Number of array dimensions in aux entry */
-
-typedef unsigned short DSTYPE;
-
-struct syment
-{
- union
- {
- char _n_name[SYMNMLEN]; /* old COFF version */
- struct
- {
- int _n_zeroes; /* new == 0 */
- int _n_offset; /* offset into string table */
- } _n_n;
- const char *_n_nptr[2]; /* allows for overlaying */
- } _n;
-
- int n_value; /* value of symbol */
- short n_scnum; /* section number */
- DSTYPE n_type; /* type and derived type */
- char n_sclass; /* storage class */
- char n_numaux; /* number of aux. entries */
-};
-
-#define n_name _n._n_name
-#define n_nptr _n._n_nptr[1]
-#define n_zeroes _n._n_n._n_zeroes
-#define n_offset _n._n_n._n_offset
-
-/*------------------------------------------------------------------------*/
-/* Relocatable symbols have a section number of the */
-/* section in which they are defined. Otherwise, section */
-/* numbers have the following meanings: */
-/*------------------------------------------------------------------------*/
-#define N_UNDEF 0 /* undefined symbol */
-#define N_ABS -1 /* value of symbol is absolute */
-#define N_DEBUG -2 /* special debugging symbol */
-
-\f
-/*------------------------------------------------------------------------*/
-/* AUXILIARY SYMBOL ENTRY */
-/*------------------------------------------------------------------------*/
-#define SPACE(len, name) char name[len]
-
-union auxent
-{
- struct
- {
- SPACE(4, _0_3);
- int x_fsize; /* size of struct in bits. */
- SPACE(4, _8_11);
- int x_endndx; /* ptr to next sym beyond .eos */
- SPACE(2, _16_17);
- } x_tag;
-
- struct
- {
- int x_tagndx; /* ptr to beginning of struct */
- int x_fsize; /* size of struct in bits. */
- SPACE(10, _8_17);
- } x_eos;
-
- struct
- {
- int x_tagndx; /* ptr to tag for function */
- int x_fsize; /* size of function in bytes */
- int x_lnnoptr; /* file ptr to fcn line # */
- int x_endndx; /* ptr to next sym beyond .ef */
- SPACE(2, _16_17);
- } x_func;
-
- struct
- {
- int x_regmask; /* Mask of regs use by func */
- unsigned short x_lnno; /* line number of block begin */
- unsigned short x_lcnt; /* # line number entries in func */
- int x_framesize; /* size of func local vars */
- int x_endndx; /* ptr to next sym beyond .eb */
- SPACE(2, _16_17);
- } x_block;
-
- struct
- {
- int x_tagndx; /* ptr to tag for array type */
- int x_fsize; /* Size of array in bits. */
- unsigned short x_dimen[DIMNUM];
- SPACE(2, _16_17);
- } x_array;
-
- struct
- {
- int x_tagndx; /* str, un, or enum tag indx */
- int x_fsize; /* Size of symbol */
- SPACE(10, _10_17);
- } x_sym;
-
- struct
- {
- char x_fname[FILNMLEN];
- } x_file;
-
- struct
- {
- int x_scnlen; /* section length */
- unsigned short x_nreloc; /* number of reloc entries */
- unsigned short x_nlinno; /* number of line numbers */
- SPACE(8, _10_17);
- } x_scn;
-};
-
-#define SYMENT struct syment
-#define SYMESZ 18 /* sizeof(SYMENT) */
-
-#define AUXENT union auxent
-#define AUXESZ 18 /* sizeof(AUXENT) */
-
-/*------------------------------------------------------------------------*/
-/* NAMES OF "SPECIAL" SYMBOLS */
-/*------------------------------------------------------------------------*/
-#define _BF ".bf"
-#define _EF ".ef"
-#define _STEXT ".text"
-#define _ETEXT "etext"
-#define _SDATA ".data"
-#define _EDATA "edata"
-#define _SBSS ".bss"
-#define _END "end"
-#define _C_ARGS ".args"
-#define _BINITPTR "binit"
-#define _CINITPTR "cinit"
-#define _PINITPTR "pinit"
-#define _ASM_SRC_NAME "$ASM$" /* SPECIAL SYMBOL FOR ASSY SRC DEBUG */
-
-/*------------------------------------------------------------------------*/
-/* HIGH LEVEL LANGUAGE ACCESSIBLE VERSIONS OF THE ABOVE SPECIAL SYMBOLS. */
-/*------------------------------------------------------------------------*/
-#define _STEXT_HLL "___text__"
-#define _ETEXT_HLL "___etext__"
-#define _SDATA_HLL "___data__"
-#define _EDATA_HLL "___edata__"
-#define _SBSS_HLL "___bss__"
-#define _END_HLL "___end__"
-#define _C_ARGSPTR_HLL "___c_args__"
-#define _BINITPTR_HLL "___binit__"
-#define _CINITPTR_HLL "___cinit__"
-#define _PINITPTR_HLL "___pinit__"
-
-/*------------------------------------------------------------------------*/
-/* ENTRY POINT SYMBOLS */
-/*------------------------------------------------------------------------*/
-#define _START "_start"
-#define _MAIN "_main"
-
-/*------------------------------------------------------------------------*/
-/* SYMBOLS USED FOR C++ LOWERING */
-/*------------------------------------------------------------------------*/
-#define _TYPEINFO_ID_PREFIX "__TID_" /* Unique type id for RTTI */
-#define _TEMPLATE_MANGLED_ROOT "__tm__" /* mangled name root for */
- /* template symbols. */
-#define _TEMPLATE_SIGNATURES "__pt__" /* when distinct_template_ */
- /* signatures is FALSE, */
- /* template name is mangled*/
- /* with this string. */
-#define _PARTIAL_SPEC "__ps__" /* for the first argument */
- /* list of a partial */
- /* specialization, this */
- /* string is used to mangle*/
- /* the name. */
-#endif
diff --git a/src/interp/coff/coff_trg.mike.h b/src/interp/coff/coff_trg.mike.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/****************************************************************************/
-/* COFF_TRG.H */
-/* This file contains target dependent parameters for COFF files. */
-/****************************************************************************/
-#ifndef COFF_TRG_H
-#define COFF_TRG_H
-
-#if defined(TOOL_ASSEMBLER)
- #error The COFF submodule should no longer be used by the assembler; use TICOFF04
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* TMS340 (GSP) Target Specific Parameters (bit-addressable) */
-/*--------------------------------------------------------------------------*/
-#if TMS340
-#define MAGIC MAGIC_340 /* Magic number for GSP */
-#define TRG_MEM_WIDTH 1 /* Bit address */
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* TMS370/C8 Target Specific Parameters (byte-addressable) */
-/*--------------------------------------------------------------------------*/
-#if TMS370
-#define MAGIC MAGIC_370 /* 370 Magic number */
-#define TRG_MEM_WIDTH 8 /* Byte address */
-#endif
-
-#if TMS370C8
-#define MAGIC MAGIC_370 /* C8 Magic number */
-#define TRG_MEM_WIDTH 8 /* Byte address */
-#endif
-
-#if TMS370C8P
-#define MAGIC MAGIC_C8P /* C8 Magic number */
-#define TRG_MEM_WIDTH 8 /* Byte address */
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* TMS37016 (C16) Target Specific Parameters (byte-addressable) */
-/*--------------------------------------------------------------------------*/
-#if TMS37016
-#define MAGIC MAGIC_C16 /* 370/16 Magic number */
-#define TRG_MEM_WIDTH 8 /* Byte address */
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* TMS32030 (C30) Target Specific Parameters (32-bit word-addressable) */
-/*--------------------------------------------------------------------------*/
-#if TMS32030
-#define MAGIC MAGIC_C30 /* Magic number for C30 */
-#define TRG_MEM_WIDTH 32 /* 32-bit address */
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* TMS32025 (DSP) Target Specific Parameters (16-bit word-addressable) */
-/*--------------------------------------------------------------------------*/
-#if TMS32025
-#define MAGIC MAGIC_DSP /* Magic number for C1x/2x/5x */
-#define TRG_MEM_WIDTH 16 /* 16-bit address */
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* TMS380 (EGL) Target Specific Parameters (byte-addressable) */
-/*--------------------------------------------------------------------------*/
-#if TMS380
-#define MAGIC MAGIC_380 /* Magic number for TMS380 */
-#define TRG_MEM_WIDTH 8 /* Byte address */
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* TMS320C8x (MVP MP/PP) Target Specific Parameters (byte-addressable) */
-/*--------------------------------------------------------------------------*/
-#if MVP_PP || MVP_MP
-#define MAGIC MAGIC_MVP /* Magic number for PP */
-#define TRG_MEM_WIDTH 8 /* Byte address */
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* TMS320C54x (LEAD) Target Specific Parameters (16-bit word-addressable) */
-/*--------------------------------------------------------------------------*/
-#if LEAD
-#define MAGIC MAGIC_LEAD /* Magic number for C5xx */
-#define TRG_MEM_WIDTH 16 /* 16-bit address */
-#define TRG_INST_ALIGN 16 /* Instruction alignment */
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* TMS470 (ARM) Target Specific Parameters (byte-addressable) */
-/*--------------------------------------------------------------------------*/
-#if ARM
-#define MAGIC MAGIC_ARM /* Magic number for ARM */
-#define TRG_MEM_WIDTH 8 /* Byte address */
-#define TRG_ARM_MODE 0 /* ARM setting for curr_objmode */
-#define TRG_THUMB_MODE 1 /* Thumb setting for curr_objmode */
-#ifndef TRG_INST_ALIGN_THUMB
-#define TRG_INST_ALIGN_THUMB 16
-#endif
-
-#ifndef TRG_INST_ALIGN_ARM
-#define TRG_INST_ALIGN_ARM 32
-#endif
-
-#ifndef TRG_INST_ALIGN
-#define TRG_INST_ALIGN (curr_objmode == TRG_ARM_MODE ? \
- TRG_INST_ALIGN_ARM \
- : TRG_INST_ALIGN_THUMB)
-#endif
-extern unsigned char curr_objmode;
-
-/*------------------------------------------------------------------------*/
-/* Target device identification flags (bits 4-7 in file header flags) */
-/*------------------------------------------------------------------------*/
-#define F_ARM9ABI 0x10 /* 0x10 = ARM9ABI, 0x00 = TIABI */
-#define F_ARCH4 0x20 /* ARCH4 = ARM7 */
-#define F_ARCH5E 0x40 /* ARCH5E = ARM9 */
-#define F_ARCH6 0x60 /* ARCH6 = ARM11 */
-#define F_DMODE 0x80 /* DUAL MODE */
-#define ARCH_MASK 0x60
-
-#define ARCH5E_FLAGS(flg) ((flg & ARCH_MASK) == F_ARCH5E)
-#define ARCH6_FLAGS(flg) ((flg & ARCH_MASK) == F_ARCH6)
-#define ARCH4_FLAGS(flg) ((flg & ARCH_MASK) == F_ARCH4)
-
-#undef F_VERSION
-#define F_VERSION ( F_ARM9ABI | F_ARCH4 | \
- F_ARCH5E | F_DMODE )
-#endif
-
-
-/*--------------------------------------------------------------------------*/
-/* TMS320C6x Target Specific Parameters (byte-addressable) */
-/*--------------------------------------------------------------------------*/
-#if TMS32060
-#define MAGIC MAGIC_C60 /* Magic number for C60 */
-#define TRG_MEM_WIDTH 8 /* Byte address */
-#define TRG_INST_ALIGN 32 /* Instruction alignment */
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* TARANTULA Target Specific Parameters (byte-addressable) */
-/*--------------------------------------------------------------------------*/
-#if TARANTULA
-#define MAGIC MAGIC_TARANTULA /* Magic number for TARANTULA */
-#define TRG_MEM_WIDTH 8 /* Byte address */
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* TMS320C2xxx (Ankoor) Target Specific Parameters (16-bit word-addressable)*/
-/*--------------------------------------------------------------------------*/
-#if RTC
-#define MAGIC MAGIC_ANKOOR /* Magic number for Ankoor */
-#define TRG_MEM_WIDTH 16 /* 16-bit address */
-#define TRG_INST_ALIGN 16 /* Instruction alignment */
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* TMS320C55xx (LEAD3) Target Specific Parameters (byte-addressable code) */
-/* (16-bit word-addressable data) */
-/*--------------------------------------------------------------------------*/
-#if LEAD3
-/*--------------------------------------------------------------------------*/
-/* The C55x object consumers can accept either Laijin or Ryujin object */
-/* files, so ISMAGIC() becomes a target-specific macro, and MAGIC is not */
-/* defined. */
-/*--------------------------------------------------------------------------*/
-#define ISMAGIC(x) (((unsigned short)(x)) == MAGIC_LEAD3 || \
- ((unsigned short)(x)) == MAGIC_LEAD3_R35)
-
-#define TRG_MEM_WIDTH 8 /* Byte address */
-#define TRG_INST_ALIGN 8 /* Instruction alignment */
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* MSP430 Target Specific Parameters (byte-addressable) */
-/*--------------------------------------------------------------------------*/
-#if MSP
-#define MAGIC MAGIC_MSP /* Magic number for MSP */
-#define TRG_MEM_WIDTH 8 /* Byte address */
-#define TRG_INST_ALIGN 16
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* IF WE DIDN'T DEFINE ANY TARGET, DEFINE THEM TO SOMETHING... */
-/*--------------------------------------------------------------------------*/
-#ifndef TRG_MEM_WIDTH
-#define TRG_MEM_WIDTH 8 /* ARBITRARY... */
-#endif
-
-#ifndef TRG_INST_ALIGN
-#define TRG_INST_ALIGN 32 /* Instruction alignment */
-#endif
-
-#ifndef MAGIC
-#define MAGIC 0 /* ARBITRARY... */
-#endif
-
-#ifndef ISMAGIC
-#define ISMAGIC(x) (((unsigned short)(x)) == MAGIC)
-#endif
-
-#endif /* COFF_TRG_H */
diff --git a/src/interp/coff/coffdefs.mike.h b/src/interp/coff/coffdefs.mike.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/**************************************************************************/
-/* COFFDEFS.H */
-/* Definitions of COFF symbol type and storage class fields. */
-/**************************************************************************/
-#ifndef COFFDEFS_H
-#define COFFDEFS_H
-
-#if defined(TOOL_ASSEMBLER)
- #error The COFF submodule should no longer be used by the assembler; use TICOFF04
-#endif
-
-/*------------------------------------------------------------------------*/
-/* STORAGE CLASSES */
-/*------------------------------------------------------------------------*/
-#define C_NULL 0
-#define C_AUTO 1 /* AUTOMATIC VARIABLE */
-#define C_EXT 2 /* EXTERNAL SYMBOL */
-#define C_STAT 3 /* STATIC */
-#define C_REG 4 /* REGISTER VARIABLE */
-#define C_EXTREF 5 /* EXTERNAL DEFINITION */
-#define C_LABEL 6 /* LABEL */
-#define C_ULABEL 7 /* UNDEFINED LABEL */
-#define C_MOS 8 /* MEMBER OF STRUCTURE */
-#define C_ARG 9 /* FUNCTION ARGUMENT */
-#define C_STRTAG 10 /* STRUCTURE TAG */
-#define C_MOU 11 /* MEMBER OF UNION */
-#define C_UNTAG 12 /* UNION TAG */
-#define C_TPDEF 13 /* TYPE DEFINITION */
-#define C_USTATIC 14 /* UNDEFINED STATIC */
-#define C_ENTAG 15 /* ENUMERATION TAG */
-#define C_MOE 16 /* MEMBER OF ENUMERATION */
-#define C_REGPARM 17 /* REGISTER PARAMETER */
-#define C_FIELD 18 /* BIT FIELD */
-#define C_UEXT 19 /* TENTATIVE EXTERNAL DEFINITION */
-#define C_STATLAB 20 /* STATIC LOAD-TIME LABEL */
-#define C_EXTLAB 21 /* EXTERNAL LOAD-TIME LABEL */
-#define C_VREG 22 /* VIRTUAL REGISTER VARIABLE */
-#define C_SYSTEM 23 /* SYSTEM-WIDE SYMBOL */
-#define C_STATREG 24 /* STATIC REGISTER VARIABLE */
-#define C_EXTREG 25 /* EXTERNAL REGISTER VARIABLE */
-#define C_EXTREFREG 26 /* EXTERNAL REGISTER VARIABLE REFERENCE */
-#define C_VARARG 27 /* LAST DECLARED PARAMETER OF VARARG FN */
-#define C_EXTDEF 28 /* C_EXT DEFINED IN DIFFERENT FILE */
-#define C_USTATREG 29 /* UNDEFINED STATIC REGISTER VARIABLE */
-
-#define C_BLOCK 100 /* ".BB" OR ".EB" */
-#define C_FCN 101 /* ".BF" OR ".EF" */
-#define C_EOS 102 /* END OF STRUCTURE */
-#define C_FILE 103 /* FILE NAME */
-#define C_LINE 104 /* DUMMY SCLASS FOR LINE NUMBER ENTRY */
-#define C_ALIAS 105 /* DUPLICATE TAG */
-#define C_PREF 106 /* DUMMY SCLASS FOR REF PRAGMA TABLE ENTRY */
-
-#define C_GRPTAG 107 /* TAG FOR GROUPED GLOBAL VARIABLES */
-#define C_SMOG 108 /* STATIC MEMBER OF GROUP */
-#define C_EMOG 109 /* EXTERN MEMBER OF GROUP */
-#define C_EOG 110 /* END OF GROUP */
-
-/*------------------------------------------------------------------------*/
-/* STORAGE CLASS QUALIFIERS */
-/*------------------------------------------------------------------------*/
-#define CQ_NEAR 0x0001
-#define CQ_FAR 0x0002
-#define CQ_INLINE 0x0004 /* INLINE THIS FUNCTION DEFINITION */
-#define CQ_SUPPRESS 0x0008 /* INLINE AND EMIT NO ICODE OUTPUT */
-#define CQ_CONTROL 0x0010 /* SYMBOL IS A "CONTROL REGISTER" */
-#define CQ_INTERRUPT 0x0020 /* INTERRUPT FUNCTION */
-#define CQ_TRAP 0x0040 /* (MVP CODE GENERATOR) */
-#define CQ_GREGISTER 0x0080 /* GLOBAL REGISTER SYMBOL */
-#define CQ_PORT 0x0100 /* 370 PORT VARIABLE */
-#define CQ_SYSTEM 0x0200 /* MVP SHARED SYMBOL (MP AND PPs) */
-#define CQ_SYSTEMPP 0x0400 /* MVP SHARED SYMBOL (PPs only) */
-#define CQ_REENTRANT 0x0800 /* FUNCTION IS REENTRANT/NEEDS STACK */
-#define CQ_NMI_INTERRUPT 0x1000 /* NMI INTERRUPT FUNCTION */
-
-#define CQ_ALIASED 0x2000 /* ADDRESS OF SYMBOL TAKEN SOMEWHERE */
-#define CQ_WRITTEN 0x4000 /* VARIABLE IS MODIFIED BY CODE */
-#define CQ_TOUCHED 0x8000 /* VARIABLE IS REFERENCED BY CODE */
-
-#define CQ_ICODE ( CQ_NEAR | CQ_INLINE | CQ_CONTROL | CQ_TRAP \
- | CQ_FAR | CQ_SUPPRESS | CQ_INTERRUPT | CQ_GREGISTER \
- | CQ_PORT | CQ_SYSTEM | CQ_SYSTEMPP | CQ_REENTRANT \
- | CQ_NMI_INTERRUPT)
-
-/*------------------------------------------------------------------------*/
-/* STORAGE CLASS MACROS */
-/*------------------------------------------------------------------------*/
-#define ISLOCAL(c) ((c) == C_AUTO || (c) == C_REG || (c) == C_VREG)
-#define ISPARM(c) ((c) == C_ARG || (c) == C_REGPARM || (c) == C_VARARG)
-#define ISAUTO(c) ((c) == C_AUTO || (c) == C_ARG || (c) == C_VARARG)
-#define ISREG(c) ((c) == C_REG || (c) == C_REGPARM || (c) == C_VREG || \
- (c) == C_EXTREG || (c) == C_STATREG || (c) == C_EXTREFREG)
-#define ISTAG(c) ((c) == C_STRTAG || (c) == C_UNTAG || (c) == C_ENTAG)
-#define ISGROUP(c) ((c) == C_GRPTAG)
-
-#define ISMOS(c) ((c) == C_MOS || (c) == C_MOU || \
- (c) == C_MOE || (c) == C_FIELD)
-
-#define ISXDEF(c) ((c) == C_STAT || (c) == C_STATREG || \
- (c) == C_EXT || (c) == C_EXTDEF || (c) == C_EXTREG)
-
-#define ISEXT(c) ((c) == C_USTATIC || (c) == C_STAT || (c) == C_STATREG ||\
- (c) == C_EXTREF || (c) == C_UEXT || (c) == C_EXTREFREG||\
- (c) == C_EXT || (c) == C_EXTDEF || (c) == C_EXTREG ||\
- (c) == C_EXTLAB || (c) == C_SYSTEM)
-
-#define ISGLOB(c) ((c) == C_EXTREF || (c) == C_UEXT || (c) == C_EXTREFREG||\
- (c) == C_EXT || (c) == C_EXTDEF || (c) == C_EXTREG ||\
- (c) == C_EXTLAB || (c) == C_SYSTEM)
-
-#define ISNEAR(cq) (((cq) & CQ_NEAR) != 0)
-#define ISFAR(cq) (((cq) & CQ_FAR) != 0)
-#define ISCONTROL(cq) (((cq) & CQ_CONTROL) != 0)
-#define ISGREGISTER(cq) (((cq) & CQ_GREGISTER) != 0)
-#define ISPORT(cq) (((cq) & CQ_PORT) != 0)
-#define ISINTERRUPT(cq) (((cq) & CQ_INTERRUPT) != 0)
-#define ISNMIINTERRUPT(cq) (((cq) & CQ_NMI_INTERRUPT) != 0)
-#define ISREENTRANT(cq) (((cq) & CQ_REENTRANT) != 0)
-#define ISTRAP(cq) (((cq) & CQ_TRAP) != 0)
-#define ISINT_OR_TRAP(cq) (((cq) & (CQ_TRAP | CQ_INTERRUPT)) != 0)
-
-/*-------------------------------------------------------------------------*/
-/* COFF BASIC TYPES - PACKED INTO THE LOWER 4 BITS OF THE TYPE FIELD */
-/*-------------------------------------------------------------------------*/
-#define CT_NULL 0x80 /* UNDEFINED OR ERROR TYPE (NO TYPE INFO) */
-#define CT_VOID 0 /* VOID TYPE */
-#define CT_SCHAR 1 /* CHARACTER (EXPLICITLY "signed") */
-#define CT_CHAR 2 /* CHARACTER (IMPLICITLY SIGNED) */
-#define CT_SHORT 3 /* SHORT INTEGER */
-#define CT_INT 4 /* INTEGER */
-#define CT_LONG 5 /* LONG INTEGER */
-#define CT_FLOAT 6 /* SINGLE PRECISION FLOATING POINT */
-#define CT_DOUBLE 7 /* DOUBLE PRECISION FLOATING POINT */
-#define CT_STRUCT 8 /* STRUCTURE */
-#define CT_UNION 9 /* UNION */
-#define CT_ENUM 10 /* ENUMERATION */
-#define CT_LDOUBLE 11 /* LONG DOUBLE FLOATING POINT */
-#define CT_UCHAR 12 /* UNSIGNED CHARACTER */
-#define CT_USHORT 13 /* UNSIGNED SHORT */
-#define CT_UINT 14 /* UNSIGNED INTEGER */
-#define CT_ULONG 15 /* UNSIGNED LONG */
-
-/*-------------------------------------------------------------------------*/
-/* COFF DERIVED TYPES: 2 BITS EACH */
-/*-------------------------------------------------------------------------*/
-#define DCT_NON 0x0 /* NO DERIVED TYPE */
-#define DCT_PTR 0x1 /* POINTER */
-#define DCT_FCN 0x2 /* FUNCTION */
-#define DCT_ARY 0x3 /* ARRAY */
-
-/*-------------------------------------------------------------------------*/
-/* COFF TYPE FIELD MASKS AND SIZES */
-/*-------------------------------------------------------------------------*/
-#define N_BCTMASK 0xF /* MASK FOR BASIC TYPE */
-#define N_CTMASK 0x30 /* MASK FOR FIRST DERIVED TYPE */
-#define N_DCTMAX 12 /* MAXIMUM DERIVED TYPES */
-#define N_BCTSHFT 4 /* SHIFT AMOUNT (WIDTH) FOR BASIC TYPE */
-#define N_CTSHIFT 2 /* SHIFT AMOUNT (WIDTH) FOR DERIVED TYPES */
-
-/*-------------------------------------------------------------------------*/
-/* COFF TYPE MANIPULATION MACROS */
-/* */
-/* BCTYPE(t) - Return basic type from t */
-/* DCTYPE(t) - Return all derived types from t */
-/* DCTYPE1(t) - Return 1st derived type from t */
-/* CTQUAL(t,q) - Return qualification of type */
-/* CTUNQUAL(t,q)- Return unqualified version of type */
-/* */
-/* MKCTYPE() - Build a type from basic and several derived types */
-/* CDERIVE(d,t) - Build a type from basic and one derived type */
-/* CINCREF(t) - Convert 't' into pointer to 't' */
-/* CDECREF(t) - Remove first derviation from t */
-/* */
-/* ISCINT(t) - TRUE if t is an integral type */
-/* ISCSGN(t) - TRUE if t is a signed type */
-/* ISCUNS(t) - TRUE if t is an unsigned type */
-/* ISCFLT(t) - TRUE if t is a floating point type */
-/* ISCDBL(t) - TRUE if t is a double or long double type */
-/* ISCPTR(t) - TRUE if t is a pointer */
-/* ISCFCN(t) - TRUE if t is a function */
-/* ISCARY(t) - TRUE if t is an array */
-/* ISCSTR(t) - TRUE if t is a struct, union, or enum type */
-/* ISCAGG(t) - TRUE if t is an array, struct, or union */
-/* */
-/* CITOU(t) - convert signed type to unsigned equivalent */
-/* CUTOI(t) - convert unsigned type to signed equivalent */
-/* CNOSIGN(t) - convert signed or unsigned type to "plain" equivalent */
-/*-------------------------------------------------------------------------*/
-#define BCTYPE(t) ((int)((t) & N_BCTMASK))
-#define DCTYPE(t) ((t) & ~N_BCTMASK)
-#define DCTYPE1(t) (((t) & N_CTMASK) >> N_BCTSHFT)
-
-#define CTQUAL(t,q) ((int)(DCTYPE(t) ? DCTYPE1(q) : BCTYPE(q)))
-#define CTUNQUAL(t,q) (ISCPTR(t) ? ((q) & ~N_CTMASK) : ((q) & ~N_BCTMASK))
-
-#define MKCTYPE(basic, d1,d2,d3,d4,d5,d6) \
- ((basic) | ((d1) << 4) | ((d2) << 6) | ((d3) << 8) |\
- ((d4) << 10) | ((d5) << 12) | ((d6) << 14))
-#define CDERIVE(d,t) ((DCTYPE(t) << N_CTSHIFT) | ((d) << N_BCTSHFT) | BCTYPE(t))
-#define CINCREF(t) ((DCTYPE(t) << N_CTSHIFT) | (DCT_PTR<<N_BCTSHFT)|BCTYPE(t))
-#define CDECREF(t) (DCTYPE((t) >> N_CTSHIFT) | BCTYPE(t))
-
-#define ISCSGN(t) (((t) >= CT_SCHAR && (t) <= CT_LONG) || (t) == CT_ENUM)
-#define ISCUNS(t) ((t) >= CT_UCHAR && (t) <= CT_ULONG)
-#define ISCINT(t) (((t) >= CT_SCHAR && (t) <= CT_LONG) || (t) == CT_ENUM ||\
- ((t) >= CT_UCHAR && (t) <= CT_ULONG))
-#define ISCFLT(t) ((t) == CT_FLOAT || (t) == CT_DOUBLE || (t) == CT_LDOUBLE)
-#define ISCDBL(t) ((t) == CT_DOUBLE || (t) == CT_LDOUBLE)
-#define ISCPTR(t) (((t) & N_CTMASK) == (DCT_PTR << N_BCTSHFT))
-#define ISCFCN(t) (((t) & N_CTMASK) == (DCT_FCN << N_BCTSHFT))
-#define ISCARY(t) (((t) & N_CTMASK) == (DCT_ARY << N_BCTSHFT))
-#define ISCSTR(t) ((t) == CT_STRUCT || (t) == CT_UNION || (t) == CT_ENUM)
-#define ISCAGG(t) (ISCARY(t) || (t) == CT_STRUCT || (t) == CT_UNION)
-#define ISCCHAR(t) ((t) == CT_CHAR || (t) == CT_SCHAR || (t) == CT_UCHAR)
-#define ISCSHORT(t) ((t) == CT_SHORT || (t) == CT_USHORT)
-#define ISCLONG(t) ((t) == CT_LONG || (t) == CT_ULONG)
-
-#define CITOU(t) ((t) + (CT_UCHAR - ((t) == CT_SCHAR ? CT_SCHAR : CT_CHAR)))
-#define CUTOI(t) ((t) - (CT_UCHAR - CT_CHAR))
-#define CNOSIGN(t) (ISCUNS(t) ? CUTOI(t) : (t) == CT_SCHAR ? CT_CHAR : (t))
-
-/*------------------------------------------------------------------------*/
-/* ILLEGAL COFF TYPES USED TO MARK SPECIAL OBJECTS. */
-/* */
-/* CT_VENEER - DENOTES A VENEER OF A FUNCTION. */
-/*------------------------------------------------------------------------*/
-#define CT_VENEER (MKCTYPE(CT_VOID, DCT_FCN, DCT_FCN, 0, 0, 0, 0))
-#define ISCVENEER(t) ((t) == CT_VENEER)
-
-#endif /* COFFDEFS_H */
-
diff --git a/src/make/ibl_c6455/ibl_c6455.out.ept b/src/make/ibl_c6455/ibl_c6455.out.ept
+++ /dev/null
@@ -1 +0,0 @@
-\ 3
\ No newline at end of file