github.com/FenixAra/go@v0.0.0-20170127160404-96ea0918e670/src/cmd/internal/obj/x86/list6.go (about)

     1  // Inferno utils/6c/list.c
     2  // https://bitbucket.org/inferno-os/inferno-os/src/default/utils/6c/list.c
     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 x86
    32  
    33  import (
    34  	"cmd/internal/obj"
    35  	"fmt"
    36  )
    37  
    38  var Register = []string{
    39  	"AL", /* [D_AL] */
    40  	"CL",
    41  	"DL",
    42  	"BL",
    43  	"SPB",
    44  	"BPB",
    45  	"SIB",
    46  	"DIB",
    47  	"R8B",
    48  	"R9B",
    49  	"R10B",
    50  	"R11B",
    51  	"R12B",
    52  	"R13B",
    53  	"R14B",
    54  	"R15B",
    55  	"AX", /* [D_AX] */
    56  	"CX",
    57  	"DX",
    58  	"BX",
    59  	"SP",
    60  	"BP",
    61  	"SI",
    62  	"DI",
    63  	"R8",
    64  	"R9",
    65  	"R10",
    66  	"R11",
    67  	"R12",
    68  	"R13",
    69  	"R14",
    70  	"R15",
    71  	"AH",
    72  	"CH",
    73  	"DH",
    74  	"BH",
    75  	"F0", /* [D_F0] */
    76  	"F1",
    77  	"F2",
    78  	"F3",
    79  	"F4",
    80  	"F5",
    81  	"F6",
    82  	"F7",
    83  	"M0",
    84  	"M1",
    85  	"M2",
    86  	"M3",
    87  	"M4",
    88  	"M5",
    89  	"M6",
    90  	"M7",
    91  	"X0",
    92  	"X1",
    93  	"X2",
    94  	"X3",
    95  	"X4",
    96  	"X5",
    97  	"X6",
    98  	"X7",
    99  	"X8",
   100  	"X9",
   101  	"X10",
   102  	"X11",
   103  	"X12",
   104  	"X13",
   105  	"X14",
   106  	"X15",
   107  	"Y0",
   108  	"Y1",
   109  	"Y2",
   110  	"Y3",
   111  	"Y4",
   112  	"Y5",
   113  	"Y6",
   114  	"Y7",
   115  	"Y8",
   116  	"Y9",
   117  	"Y10",
   118  	"Y11",
   119  	"Y12",
   120  	"Y13",
   121  	"Y14",
   122  	"Y15",
   123  	"CS", /* [D_CS] */
   124  	"SS",
   125  	"DS",
   126  	"ES",
   127  	"FS",
   128  	"GS",
   129  	"GDTR", /* [D_GDTR] */
   130  	"IDTR", /* [D_IDTR] */
   131  	"LDTR", /* [D_LDTR] */
   132  	"MSW",  /* [D_MSW] */
   133  	"TASK", /* [D_TASK] */
   134  	"CR0",  /* [D_CR] */
   135  	"CR1",
   136  	"CR2",
   137  	"CR3",
   138  	"CR4",
   139  	"CR5",
   140  	"CR6",
   141  	"CR7",
   142  	"CR8",
   143  	"CR9",
   144  	"CR10",
   145  	"CR11",
   146  	"CR12",
   147  	"CR13",
   148  	"CR14",
   149  	"CR15",
   150  	"DR0", /* [D_DR] */
   151  	"DR1",
   152  	"DR2",
   153  	"DR3",
   154  	"DR4",
   155  	"DR5",
   156  	"DR6",
   157  	"DR7",
   158  	"TR0", /* [D_TR] */
   159  	"TR1",
   160  	"TR2",
   161  	"TR3",
   162  	"TR4",
   163  	"TR5",
   164  	"TR6",
   165  	"TR7",
   166  	"TLS",    /* [D_TLS] */
   167  	"MAXREG", /* [MAXREG] */
   168  }
   169  
   170  func init() {
   171  	obj.RegisterRegister(REG_AL, REG_AL+len(Register), Rconv)
   172  	obj.RegisterOpcode(obj.ABaseAMD64, Anames)
   173  }
   174  
   175  func Rconv(r int) string {
   176  	if REG_AL <= r && r-REG_AL < len(Register) {
   177  		return Register[r-REG_AL]
   178  	}
   179  	return fmt.Sprintf("Rgok(%d)", r-obj.RBaseAMD64)
   180  }