github.com/Rookout/GoSDK@v0.1.48/pkg/services/assembler/internal/obj/arm/a.out.go (about)

     1  // Inferno utils/5c/5.out.h
     2  // https://bitbucket.org/inferno-os/inferno-os/src/master/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  package arm
    32  
    33  import "github.com/Rookout/GoSDK/pkg/services/assembler/internal/obj"
    34  
    35  //go:generate go run ../stringer.go -i $GOFILE -o anames.go -p arm
    36  
    37  const (
    38  	NSNAME = 8
    39  	NSYM   = 50
    40  	NREG   = 16
    41  )
    42  
    43  
    44  const (
    45  	REGARG = -1
    46  )
    47  
    48  const (
    49  	REG_R0 = obj.RBaseARM + iota 
    50  	REG_R1
    51  	REG_R2
    52  	REG_R3
    53  	REG_R4
    54  	REG_R5
    55  	REG_R6
    56  	REG_R7
    57  	REG_R8
    58  	REG_R9
    59  	REG_R10
    60  	REG_R11
    61  	REG_R12
    62  	REG_R13
    63  	REG_R14
    64  	REG_R15
    65  
    66  	REG_F0 
    67  	REG_F1
    68  	REG_F2
    69  	REG_F3
    70  	REG_F4
    71  	REG_F5
    72  	REG_F6
    73  	REG_F7
    74  	REG_F8
    75  	REG_F9
    76  	REG_F10
    77  	REG_F11
    78  	REG_F12
    79  	REG_F13
    80  	REG_F14
    81  	REG_F15
    82  
    83  	REG_FPSR 
    84  	REG_FPCR
    85  
    86  	REG_CPSR 
    87  	REG_SPSR
    88  
    89  	REGRET = REG_R0
    90  	
    91  	
    92  	
    93  	REGEXT = REG_R10
    94  	
    95  	REGG = REGEXT - 0
    96  	REGM = REGEXT - 1
    97  
    98  	REGCTXT = REG_R7
    99  	REGTMP  = REG_R11
   100  	REGSP   = REG_R13
   101  	REGLINK = REG_R14
   102  	REGPC   = REG_R15
   103  
   104  	NFREG = 16
   105  	
   106  	
   107  	FREGRET = REG_F0
   108  	FREGEXT = REG_F7
   109  	FREGTMP = REG_F15
   110  )
   111  
   112  
   113  var ARMDWARFRegisters = map[int16]int16{}
   114  
   115  func init() {
   116  	
   117  	f := func(from, to, base, step int16) {
   118  		for r := int16(from); r <= to; r++ {
   119  			ARMDWARFRegisters[r] = step*(r-from) + base
   120  		}
   121  	}
   122  	f(REG_R0, REG_R15, 0, 1)
   123  	f(REG_F0, REG_F15, 64, 2) 
   124  }
   125  
   126  
   127  
   128  const (
   129  	REG_SPECIAL = obj.RBaseARM + 1<<9 + iota
   130  	REG_MB_SY
   131  	REG_MB_ST
   132  	REG_MB_ISH
   133  	REG_MB_ISHST
   134  	REG_MB_NSH
   135  	REG_MB_NSHST
   136  	REG_MB_OSH
   137  	REG_MB_OSHST
   138  
   139  	MAXREG
   140  )
   141  
   142  const (
   143  	C_NONE = iota
   144  	C_REG
   145  	C_REGREG
   146  	C_REGREG2
   147  	C_REGLIST
   148  	C_SHIFT     
   149  	C_SHIFTADDR 
   150  	C_FREG
   151  	C_PSR
   152  	C_FCR
   153  	C_SPR 
   154  
   155  	C_RCON   
   156  	C_NCON   
   157  	C_RCON2A 
   158  	C_RCON2S 
   159  	C_SCON   
   160  	C_LCON
   161  	C_LCONADDR
   162  	C_ZFCON
   163  	C_SFCON
   164  	C_LFCON
   165  
   166  	C_RACON 
   167  	C_LACON 
   168  
   169  	C_SBRA
   170  	C_LBRA
   171  
   172  	C_HAUTO  
   173  	C_FAUTO  
   174  	C_HFAUTO 
   175  	C_SAUTO  
   176  	C_LAUTO
   177  
   178  	C_HOREG
   179  	C_FOREG
   180  	C_HFOREG
   181  	C_SOREG
   182  	C_ROREG
   183  	C_SROREG 
   184  	C_LOREG
   185  
   186  	C_PC
   187  	C_SP
   188  	C_HREG
   189  
   190  	C_ADDR 
   191  
   192  	
   193  	
   194  	C_TLS_LE
   195  
   196  	
   197  	
   198  	
   199  	C_TLS_IE
   200  
   201  	C_TEXTSIZE
   202  
   203  	C_GOK
   204  
   205  	C_NCLASS 
   206  )
   207  
   208  const (
   209  	AAND = obj.ABaseARM + obj.A_ARCHSPECIFIC + iota
   210  	AEOR
   211  	ASUB
   212  	ARSB
   213  	AADD
   214  	AADC
   215  	ASBC
   216  	ARSC
   217  	ATST
   218  	ATEQ
   219  	ACMP
   220  	ACMN
   221  	AORR
   222  	ABIC
   223  
   224  	AMVN
   225  
   226  	
   227  	ABEQ
   228  	ABNE
   229  	ABCS
   230  	ABHS
   231  	ABCC
   232  	ABLO
   233  	ABMI
   234  	ABPL
   235  	ABVS
   236  	ABVC
   237  	ABHI
   238  	ABLS
   239  	ABGE
   240  	ABLT
   241  	ABGT
   242  	ABLE
   243  
   244  	AMOVWD
   245  	AMOVWF
   246  	AMOVDW
   247  	AMOVFW
   248  	AMOVFD
   249  	AMOVDF
   250  	AMOVF
   251  	AMOVD
   252  
   253  	ACMPF
   254  	ACMPD
   255  	AADDF
   256  	AADDD
   257  	ASUBF
   258  	ASUBD
   259  	AMULF
   260  	AMULD
   261  	ANMULF
   262  	ANMULD
   263  	AMULAF
   264  	AMULAD
   265  	ANMULAF
   266  	ANMULAD
   267  	AMULSF
   268  	AMULSD
   269  	ANMULSF
   270  	ANMULSD
   271  	AFMULAF
   272  	AFMULAD
   273  	AFNMULAF
   274  	AFNMULAD
   275  	AFMULSF
   276  	AFMULSD
   277  	AFNMULSF
   278  	AFNMULSD
   279  	ADIVF
   280  	ADIVD
   281  	ASQRTF
   282  	ASQRTD
   283  	AABSF
   284  	AABSD
   285  	ANEGF
   286  	ANEGD
   287  
   288  	ASRL
   289  	ASRA
   290  	ASLL
   291  	AMULU
   292  	ADIVU
   293  	AMUL
   294  	AMMUL
   295  	ADIV
   296  	AMOD
   297  	AMODU
   298  	ADIVHW
   299  	ADIVUHW
   300  
   301  	AMOVB
   302  	AMOVBS
   303  	AMOVBU
   304  	AMOVH
   305  	AMOVHS
   306  	AMOVHU
   307  	AMOVW
   308  	AMOVM
   309  	ASWPBU
   310  	ASWPW
   311  
   312  	ARFE
   313  	ASWI
   314  	AMULA
   315  	AMULS
   316  	AMMULA
   317  	AMMULS
   318  
   319  	AWORD
   320  
   321  	AMULL
   322  	AMULAL
   323  	AMULLU
   324  	AMULALU
   325  
   326  	ABX
   327  	ABXRET
   328  	ADWORD
   329  
   330  	ALDREX
   331  	ASTREX
   332  	ALDREXD
   333  	ASTREXD
   334  
   335  	ADMB
   336  
   337  	APLD
   338  
   339  	ACLZ
   340  	AREV
   341  	AREV16
   342  	AREVSH
   343  	ARBIT
   344  
   345  	AXTAB
   346  	AXTAH
   347  	AXTABU
   348  	AXTAHU
   349  
   350  	ABFX
   351  	ABFXU
   352  	ABFC
   353  	ABFI
   354  
   355  	AMULWT
   356  	AMULWB
   357  	AMULBB
   358  	AMULAWT
   359  	AMULAWB
   360  	AMULABB
   361  
   362  	AMRC 
   363  
   364  	ALAST
   365  
   366  	
   367  	AB  = obj.AJMP
   368  	ABL = obj.ACALL
   369  )
   370  
   371  
   372  const (
   373  	C_SCOND = (1 << 4) - 1
   374  	C_SBIT  = 1 << 4
   375  	C_PBIT  = 1 << 5
   376  	C_WBIT  = 1 << 6
   377  	C_FBIT  = 1 << 7 
   378  	C_UBIT  = 1 << 7 
   379  
   380  	
   381  	
   382  	
   383  	C_SCOND_XOR = 14
   384  
   385  	C_SCOND_EQ   = 0 ^ C_SCOND_XOR
   386  	C_SCOND_NE   = 1 ^ C_SCOND_XOR
   387  	C_SCOND_HS   = 2 ^ C_SCOND_XOR
   388  	C_SCOND_LO   = 3 ^ C_SCOND_XOR
   389  	C_SCOND_MI   = 4 ^ C_SCOND_XOR
   390  	C_SCOND_PL   = 5 ^ C_SCOND_XOR
   391  	C_SCOND_VS   = 6 ^ C_SCOND_XOR
   392  	C_SCOND_VC   = 7 ^ C_SCOND_XOR
   393  	C_SCOND_HI   = 8 ^ C_SCOND_XOR
   394  	C_SCOND_LS   = 9 ^ C_SCOND_XOR
   395  	C_SCOND_GE   = 10 ^ C_SCOND_XOR
   396  	C_SCOND_LT   = 11 ^ C_SCOND_XOR
   397  	C_SCOND_GT   = 12 ^ C_SCOND_XOR
   398  	C_SCOND_LE   = 13 ^ C_SCOND_XOR
   399  	C_SCOND_NONE = 14 ^ C_SCOND_XOR
   400  	C_SCOND_NV   = 15 ^ C_SCOND_XOR
   401  
   402  	
   403  	SHIFT_LL = 0 << 5
   404  	SHIFT_LR = 1 << 5
   405  	SHIFT_AR = 2 << 5
   406  	SHIFT_RR = 3 << 5
   407  )