The Go Programming Language

Text file src/libmach/5.c

     1	// Inferno libmach/5.c
     2	// http://code.google.com/p/inferno-os/source/browse/utils/libmach/5.c
     3	//
     4	//	Copyright © 1994-1999 Lucent Technologies Inc.
     5	//	Power PC support Copyright © 1995-2004 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	//	Revisions Copyright © 2000-2004 Lucent Technologies Inc. and others.
     9	//	Portions Copyright © 2009 The Go Authors.  All rights reserved.
    10	//
    11	// Permission is hereby granted, free of charge, to any person obtaining a copy
    12	// of this software and associated documentation files (the "Software"), to deal
    13	// in the Software without restriction, including without limitation the rights
    14	// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    15	// copies of the Software, and to permit persons to whom the Software is
    16	// furnished to do so, subject to the following conditions:
    17	//
    18	// The above copyright notice and this permission notice shall be included in
    19	// all copies or substantial portions of the Software.
    20	//
    21	// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    22	// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    23	// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    24	// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    25	// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    26	// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    27	// THE SOFTWARE.
    28	
    29	/*
    30	 * arm definition
    31	 */
    32	#include <u.h>
    33	#include <libc.h>
    34	#include <bio.h>
    35	#include "ureg_arm.h"
    36	#include <mach.h>
    37	
    38	#define	REGOFF(x)	(uintptr) (&((struct Ureg *) 0)->x)
    39	
    40	#define SP		REGOFF(r13)
    41	#define PC		REGOFF(pc)
    42	
    43	#define	REGSIZE		sizeof(struct Ureg)
    44	
    45	Reglist armreglist[] =
    46	{
    47		{"LINK",	REGOFF(link),		RINT|RRDONLY, 'X'},
    48		{"TYPE",	REGOFF(type),		RINT|RRDONLY, 'X'},
    49		{"PSR",		REGOFF(psr),		RINT|RRDONLY, 'X'},
    50		{"PC",		PC,			RINT, 'X'},
    51		{"SP",		SP,			RINT, 'X'},
    52		{"R15",		PC,			RINT, 'X'},
    53		{"R14",		REGOFF(r14),		RINT, 'X'},
    54		{"R13",		REGOFF(r13),		RINT, 'X'},
    55		{"R12",		REGOFF(r12),		RINT, 'X'},
    56		{"R11",		REGOFF(r11),		RINT, 'X'},
    57		{"R10",		REGOFF(r10),		RINT, 'X'},
    58		{"R9",		REGOFF(r9),		RINT, 'X'},
    59		{"R8",		REGOFF(r8),		RINT, 'X'},
    60		{"R7",		REGOFF(r7),		RINT, 'X'},
    61		{"R6",		REGOFF(r6),		RINT, 'X'},
    62		{"R5",		REGOFF(r5),		RINT, 'X'},
    63		{"R4",		REGOFF(r4),		RINT, 'X'},
    64		{"R3",		REGOFF(r3),		RINT, 'X'},
    65		{"R2",		REGOFF(r2),		RINT, 'X'},
    66		{"R1",		REGOFF(r1),		RINT, 'X'},
    67		{"R0",		REGOFF(r0),		RINT, 'X'},
    68		{  0 }
    69	};
    70	
    71		/* the machine description */
    72	Mach marm =
    73	{
    74		"arm",
    75		MARM,		/* machine type */
    76		armreglist,	/* register set */
    77		REGSIZE,	/* register set size */
    78		0,		/* fp register set size */
    79		"PC",		/* name of PC */
    80		"SP",		/* name of SP */
    81		"R15",		/* name of link register */
    82		"setR12",	/* static base register name */
    83		0,		/* static base register value */
    84		0x1000,		/* page size */
    85		0xC0000000,	/* kernel base */
    86		0,		/* kernel text mask */
    87		4,		/* quantization of pc */
    88		4,		/* szaddr */
    89		4,		/* szreg */
    90		4,		/* szfloat */
    91		8,		/* szdouble */
    92	};

release.r60.3. Except as noted, this content is licensed under a Creative Commons Attribution 3.0 License.