OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_47/] [or1ksim/] [cpu/] [common/] [coff.h] - Diff between revs 513 and 1244

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 513 Rev 1244
Line 1... Line 1...
 
#if HAVE_CONFIG_H
 
#include <config.h>
 
#endif
 
 
/* This file is derived from the GAS 2.1.4 assembler control file.
/* This file is derived from the GAS 2.1.4 assembler control file.
   The GAS product is under the GNU Public License, version 2 or later.
   The GAS product is under the GNU Public License, version 2 or later.
   As such, this file is also under that license.
   As such, this file is also under that license.
 
 
   If the file format changes in the COFF object, this file should be
   If the file format changes in the COFF object, this file should be
Line 18... Line 22...
 * These defines are byte order independent. There is no alignment of fields
 * These defines are byte order independent. There is no alignment of fields
 * permitted in the structures. Therefore they are declared as characters
 * permitted in the structures. Therefore they are declared as characters
 * and the values loaded from the character positions. It also makes it
 * and the values loaded from the character positions. It also makes it
 * nice to have it "endian" independent.
 * nice to have it "endian" independent.
 */
 */
 
#if !defined(WORDS_BIGENDIAN)
/* Load a short int from the following tables with little-endian formats */
/* Load a short int from the following tables with little-endian formats */
#define COFF_SHORT_L(ps) ((short)(((unsigned short)((unsigned char)ps[1])<<8)|\
#define COFF_SHORT_L SWAP_ENDIAN_SHORT
 
/* Load a long int from the following tables with little-endian formats */
 
#define COFF_LONG_L SWAP_ENDIAN_LONG
 
/* Load a short int from the following tables with big-endian formats */
 
#define COFF_SHORT_H KEEP_ENDIAN_SHORT
 
/* Load a long int from the following tables with big-endian formats */
 
#define COFF_LONG_H KEEP_ENDIAN_LONG
 
#else
 
#define COFF_SHORT_L KEEP_ENDIAN_SHORT
 
#define COFF_LONG_L KEEP_ENDIAN_LONG
 
#define COFF_SHORT_H SWAP_ENDIAN_SHORT
 
#define COFF_LONG_H SWAP_ENDIAN_LONG
 
#endif
 
 
 
#define SWAP_ENDIAN_SHORT(ps) ((short)(((unsigned short)((unsigned char)ps[1])<<8)|\
                                  ((unsigned short)((unsigned char)ps[0]))))
                                  ((unsigned short)((unsigned char)ps[0]))))
 
 
/* Load a long int from the following tables with little-endian formats */
#define SWAP_ENDIAN_LONG(ps) (((long)(((unsigned long)((unsigned char)ps[3])<<24) |\
#define COFF_LONG_L(ps) (((long)(((unsigned long)((unsigned char)ps[3])<<24) |\
 
                                 ((unsigned long)((unsigned char)ps[2])<<16) |\
                                 ((unsigned long)((unsigned char)ps[2])<<16) |\
                                 ((unsigned long)((unsigned char)ps[1])<<8)  |\
                                 ((unsigned long)((unsigned char)ps[1])<<8)  |\
                                 ((unsigned long)((unsigned char)ps[0])))))
                                 ((unsigned long)((unsigned char)ps[0])))))
 
 
/* Load a short int from the following tables with big-endian formats */
#define KEEP_ENDIAN_SHORT(ps) ((short)(((unsigned short)((unsigned char)ps[0])<<8)|\
#define COFF_SHORT_H(ps) ((short)(((unsigned short)((unsigned char)ps[0])<<8)|\
 
                                  ((unsigned short)((unsigned char)ps[1]))))
                                  ((unsigned short)((unsigned char)ps[1]))))
 
 
/* Load a long int from the following tables with big-endian formats */
#define KEEP_ENDIAN_LONG(ps) (((long)(((unsigned long)((unsigned char)ps[0])<<24) |\
#define COFF_LONG_H(ps) (((long)(((unsigned long)((unsigned char)ps[0])<<24) |\
 
                                 ((unsigned long)((unsigned char)ps[1])<<16) |\
                                 ((unsigned long)((unsigned char)ps[1])<<16) |\
                                 ((unsigned long)((unsigned char)ps[2])<<8)  |\
                                 ((unsigned long)((unsigned char)ps[2])<<8)  |\
                                 ((unsigned long)((unsigned char)ps[3])))))
                                 ((unsigned long)((unsigned char)ps[3])))))
 
 
/* These may be overridden later by brain dead implementations which generate
/* These may be overridden later by brain dead implementations which generate

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.