github.com/xushiwei/go@v0.0.0-20130601165731-2b9d83f45bc9/src/cmd/5l/5.out.h (about)

     1  // Inferno utils/5c/5.out.h
     2  // http://code.google.com/p/inferno-os/source/browse/utils/5c/5.out.h
     3  //
     4  //	Copyright © 1994-1999 Lucent Technologies Inc.  All rights reserved.
     5  //	Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
     6  //	Portions Copyright © 1997-1999 Vita Nuova Limited
     7  //	Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com)
     8  //	Portions Copyright © 2004,2006 Bruce Ellis
     9  //	Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net)
    10  //	Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others
    11  //	Portions Copyright © 2009 The Go Authors.  All rights reserved.
    12  //
    13  // Permission is hereby granted, free of charge, to any person obtaining a copy
    14  // of this software and associated documentation files (the "Software"), to deal
    15  // in the Software without restriction, including without limitation the rights
    16  // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    17  // copies of the Software, and to permit persons to whom the Software is
    18  // furnished to do so, subject to the following conditions:
    19  //
    20  // The above copyright notice and this permission notice shall be included in
    21  // all copies or substantial portions of the Software.
    22  //
    23  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    24  // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    25  // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    26  // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    27  // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    28  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    29  // THE SOFTWARE.
    30  
    31  #define	NSNAME		8
    32  #define	NSYM		50
    33  #define	NREG		16
    34  
    35  #define NOPROF		(1<<0)
    36  #define DUPOK		(1<<1)
    37  #define NOSPLIT		(1<<2)
    38  #define RODATA	(1<<3)
    39  #define NOPTR	(1<<4)
    40  
    41  #define	REGRET		0
    42  /* -1 disables use of REGARG */
    43  #define	REGARG		-1
    44  /* compiler allocates R1 up as temps */
    45  /* compiler allocates register variables R3 up */
    46  #define	REGEXT		10
    47  /* these two registers are declared in runtime.h */
    48  #define REGG        (REGEXT-0)
    49  #define REGM        (REGEXT-1)
    50  /* compiler allocates external registers R10 down */
    51  #define	REGTMP		11
    52  #define	REGSP		13
    53  #define	REGLINK		14
    54  #define	REGPC		15
    55  
    56  #define	NFREG		16
    57  #define	FREGRET		0
    58  #define	FREGEXT		7
    59  #define	FREGTMP		15
    60  /* compiler allocates register variables F0 up */
    61  /* compiler allocates external registers F7 down */
    62  
    63  enum	as
    64  {
    65  	AXXX,
    66  
    67  	AAND,
    68  	AEOR,
    69  	ASUB,
    70  	ARSB,
    71  	AADD,
    72  	AADC,
    73  	ASBC,
    74  	ARSC,
    75  	ATST,
    76  	ATEQ,
    77  	ACMP,
    78  	ACMN,
    79  	AORR,
    80  	ABIC,
    81  
    82  	AMVN,
    83  
    84  	AB,
    85  	ABL,
    86  
    87  /*
    88   * Do not reorder or fragment the conditional branch
    89   * opcodes, or the predication code will break
    90   */
    91  	ABEQ,
    92  	ABNE,
    93  	ABCS,
    94  	ABHS,
    95  	ABCC,
    96  	ABLO,
    97  	ABMI,
    98  	ABPL,
    99  	ABVS,
   100  	ABVC,
   101  	ABHI,
   102  	ABLS,
   103  	ABGE,
   104  	ABLT,
   105  	ABGT,
   106  	ABLE,
   107  
   108  	AMOVWD,
   109  	AMOVWF,
   110  	AMOVDW,
   111  	AMOVFW,
   112  	AMOVFD,
   113  	AMOVDF,
   114  	AMOVF,
   115  	AMOVD,
   116  
   117  	ACMPF,
   118  	ACMPD,
   119  	AADDF,
   120  	AADDD,
   121  	ASUBF,
   122  	ASUBD,
   123  	AMULF,
   124  	AMULD,
   125  	ADIVF,
   126  	ADIVD,
   127  	ASQRTF,
   128  	ASQRTD,
   129  	AABSF,
   130  	AABSD,
   131  
   132  	ASRL,
   133  	ASRA,
   134  	ASLL,
   135  	AMULU,
   136  	ADIVU,
   137  	AMUL,
   138  	ADIV,
   139  	AMOD,
   140  	AMODU,
   141  
   142  	AMOVB,
   143  	AMOVBU,
   144  	AMOVH,
   145  	AMOVHU,
   146  	AMOVW,
   147  	AMOVM,
   148  	ASWPBU,
   149  	ASWPW,
   150  
   151  	ANOP,
   152  	ARFE,
   153  	ASWI,
   154  	AMULA,
   155  
   156  	ADATA,
   157  	AGLOBL,
   158  	AGOK,
   159  	AHISTORY,
   160  	ANAME,
   161  	ARET,
   162  	ATEXT,
   163  	AWORD,
   164  	ADYNT_,
   165  	AINIT_,
   166  	ABCASE,
   167  	ACASE,
   168  
   169  	AEND,
   170  
   171  	AMULL,
   172  	AMULAL,
   173  	AMULLU,
   174  	AMULALU,
   175  
   176  	ABX,
   177  	ABXRET,
   178  	ADWORD,
   179  
   180  	ASIGNAME,
   181  
   182  	ALDREX,
   183  	ASTREX,
   184  	
   185  	ALDREXD,
   186  	ASTREXD,
   187  
   188  	APLD,
   189  
   190  	AUNDEF,
   191  
   192  	ACLZ,
   193  
   194  	AMULWT,
   195  	AMULWB,
   196  	AMULAWT,
   197  	AMULAWB,
   198  	
   199  	AUSEFIELD,
   200  	ALOCALS,
   201  	ATYPE,
   202  
   203  	ALAST,
   204  };
   205  
   206  /* scond byte */
   207  #define	C_SCOND	((1<<4)-1)
   208  #define	C_SBIT	(1<<4)
   209  #define	C_PBIT	(1<<5)
   210  #define	C_WBIT	(1<<6)
   211  #define	C_FBIT	(1<<7)	/* psr flags-only */
   212  #define	C_UBIT	(1<<7)	/* up bit, unsigned bit */
   213  
   214  #define C_SCOND_EQ	0
   215  #define C_SCOND_NE	1
   216  #define C_SCOND_HS	2
   217  #define C_SCOND_LO	3
   218  #define C_SCOND_MI	4
   219  #define C_SCOND_PL	5
   220  #define C_SCOND_VS	6
   221  #define C_SCOND_VC	7
   222  #define C_SCOND_HI	8
   223  #define C_SCOND_LS	9
   224  #define C_SCOND_GE	10
   225  #define C_SCOND_LT	11
   226  #define C_SCOND_GT	12
   227  #define C_SCOND_LE	13
   228  #define C_SCOND_NONE	14
   229  #define C_SCOND_NV	15
   230  
   231  /* D_SHIFT type */
   232  #define SHIFT_LL		0<<5
   233  #define SHIFT_LR		1<<5
   234  #define SHIFT_AR		2<<5
   235  #define SHIFT_RR		3<<5
   236  
   237  /* type/name */
   238  #define	D_GOK	0
   239  #define	D_NONE	1
   240  
   241  /* type */
   242  #define	D_BRANCH	(D_NONE+1)
   243  #define	D_OREG		(D_NONE+2)
   244  #define	D_CONST		(D_NONE+7)
   245  #define	D_FCONST	(D_NONE+8)
   246  #define	D_SCONST	(D_NONE+9)
   247  #define	D_PSR		(D_NONE+10)
   248  #define	D_REG		(D_NONE+12)
   249  #define	D_FREG		(D_NONE+13)
   250  #define	D_FILE		(D_NONE+16)
   251  #define	D_OCONST	(D_NONE+17)
   252  #define	D_FILE1		(D_NONE+18)
   253  
   254  #define	D_SHIFT		(D_NONE+19)
   255  #define	D_FPCR		(D_NONE+20)
   256  #define	D_REGREG	(D_NONE+21) // (reg, reg)
   257  #define	D_ADDR		(D_NONE+22)
   258  
   259  #define	D_SBIG		(D_NONE+23)
   260  #define	D_CONST2	(D_NONE+24)
   261  
   262  #define	D_REGREG2	(D_NONE+25) // reg, reg
   263  
   264  /* name */
   265  #define	D_EXTERN	(D_NONE+3)
   266  #define	D_STATIC	(D_NONE+4)
   267  #define	D_AUTO		(D_NONE+5)
   268  #define	D_PARAM		(D_NONE+6)
   269  
   270  /* internal only */
   271  #define	D_SIZE		(D_NONE+40)
   272  #define	D_PCREL		(D_NONE+41)
   273  #define	D_GOTOFF	(D_NONE+42) // R_ARM_GOTOFF
   274  #define	D_PLT0		(D_NONE+43) // R_ARM_PLT32, 1st inst: add ip, pc, #0xNN00000
   275  #define	D_PLT1		(D_NONE+44) // R_ARM_PLT32, 2nd inst: add ip, ip, #0xNN000
   276  #define	D_PLT2		(D_NONE+45) // R_ARM_PLT32, 3rd inst: ldr pc, [ip, #0xNNN]!
   277  #define	D_CALL		(D_NONE+46) // R_ARM_PLT32/R_ARM_CALL/R_ARM_JUMP24, bl xxxxx or b yyyyy
   278  #define	D_TLS		(D_NONE+47)
   279  
   280  /*
   281   * this is the ranlib header
   282   */
   283  #define	SYMDEF	"__.GOSYMDEF"
   284  
   285  /*
   286   * this is the simulated IEEE floating point
   287   */
   288  typedef	struct	ieee	Ieee;
   289  struct	ieee
   290  {
   291  	int32	l;	/* contains ls-man	0xffffffff */
   292  	int32	h;	/* contains sign	0x80000000
   293  				    exp		0x7ff00000
   294  				    ms-man	0x000fffff */
   295  };