support for 5.out files

R=kaib
DELTA=1262  (1247 added, 7 deleted, 8 changed)
OCL=35907
CL=35909
This commit is contained in:
Russ Cox 2009-10-19 22:33:56 -07:00
parent 33a7bcf315
commit fcb9387089
7 changed files with 1255 additions and 15 deletions

49
include/ureg_arm.h Normal file
View file

@ -0,0 +1,49 @@
// Inferno utils/libmach/ureg5.h
// http://code.google.com/p/inferno-os/source/browse/utils/libmach/ureg5.h
//
// Copyright © 1994-1999 Lucent Technologies Inc.
// Power PC support Copyright © 1995-2004 C H Forsyth (forsyth@terzarima.net).
// Portions Copyright © 1997-1999 Vita Nuova Limited.
// Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com).
// Revisions Copyright © 2000-2004 Lucent Technologies Inc. and others.
// Portions Copyright © 2009 The Go Authors. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
struct Ureg {
uint r0;
uint r1;
uint r2;
uint r3;
uint r4;
uint r5;
uint r6;
uint r7;
uint r8;
uint r9;
uint r10;
uint r11;
uint r12;
uint r13;
uint r14;
uint link;
uint type;
uint psr;
uint pc;
};

View file

@ -671,7 +671,10 @@ putsymb(char *s, int t, int32 v, int ver)
cput(s[i]);
cput(0);
}
symsize += 4 + 1 + i + 1;
// TODO(rsc): handle go parameter
lput(0);
symsize += 4 + 1 + i + 1 + 4;
if(debug['n']) {
if(t == 'z' || t == 'Z') {

92
src/libmach/5.c Normal file
View file

@ -0,0 +1,92 @@
// Inferno libmach/5.c
// http://code.google.com/p/inferno-os/source/browse/utils/libmach/5.c
//
// Copyright © 1994-1999 Lucent Technologies Inc.
// Power PC support Copyright © 1995-2004 C H Forsyth (forsyth@terzarima.net).
// Portions Copyright © 1997-1999 Vita Nuova Limited.
// Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com).
// Revisions Copyright © 2000-2004 Lucent Technologies Inc. and others.
// Portions Copyright © 2009 The Go Authors. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
/*
* arm definition
*/
#include <u.h>
#include <libc.h>
#include <bio.h>
#include "ureg_arm.h"
#include <mach.h>
#define REGOFF(x) (ulong) (&((struct Ureg *) 0)->x)
#define SP REGOFF(r13)
#define PC REGOFF(pc)
#define REGSIZE sizeof(struct Ureg)
Reglist armreglist[] =
{
{"LINK", REGOFF(link), RINT|RRDONLY, 'X'},
{"TYPE", REGOFF(type), RINT|RRDONLY, 'X'},
{"PSR", REGOFF(psr), RINT|RRDONLY, 'X'},
{"PC", PC, RINT, 'X'},
{"SP", SP, RINT, 'X'},
{"R15", PC, RINT, 'X'},
{"R14", REGOFF(r14), RINT, 'X'},
{"R13", REGOFF(r13), RINT, 'X'},
{"R12", REGOFF(r12), RINT, 'X'},
{"R11", REGOFF(r11), RINT, 'X'},
{"R10", REGOFF(r10), RINT, 'X'},
{"R9", REGOFF(r9), RINT, 'X'},
{"R8", REGOFF(r8), RINT, 'X'},
{"R7", REGOFF(r7), RINT, 'X'},
{"R6", REGOFF(r6), RINT, 'X'},
{"R5", REGOFF(r5), RINT, 'X'},
{"R4", REGOFF(r4), RINT, 'X'},
{"R3", REGOFF(r3), RINT, 'X'},
{"R2", REGOFF(r2), RINT, 'X'},
{"R1", REGOFF(r1), RINT, 'X'},
{"R0", REGOFF(r0), RINT, 'X'},
{ 0 }
};
/* the machine description */
Mach marm =
{
"arm",
MARM, /* machine type */
armreglist, /* register set */
REGSIZE, /* register set size */
0, /* fp register set size */
"PC", /* name of PC */
"SP", /* name of SP */
"R15", /* name of link register */
"setR12", /* static base register name */
0, /* static base register value */
0x1000, /* page size */
0xC0000000, /* kernel base */
0, /* kernel text mask */
4, /* quantization of pc */
4, /* szaddr */
4, /* szreg */
4, /* szfloat */
8, /* szdouble */
};

1095
src/libmach/5db.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -39,8 +39,10 @@ OFILES=\
access.$O\
machdata.$O\
setmach.$O\
5.$O\
6.$O\
8.$O\
5db.$O\
8db.$O\
5obj.$O\
6obj.$O\

View file

@ -108,7 +108,6 @@ Mach mmips2be;
Mach msparc;
Mach msparc64;
Mach m68020;
Mach marm;
Mach mpower;
Mach mpower64;
Mach malpha;

View file

@ -1,11 +1,11 @@
// Inferno libmach/setmach.c
// http://code.google.com/p/inferno-os/source/browse/utils/libmach/setmach.c
//
// Copyright © 1994-1999 Lucent Technologies Inc.
// Power PC support Copyright © 1995-2004 C H Forsyth (forsyth@terzarima.net).
// Portions Copyright © 1997-1999 Vita Nuova Limited.
// Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com).
// Revisions Copyright © 2000-2004 Lucent Technologies Inc. and others.
// Copyright © 1994-1999 Lucent Technologies Inc.
// Power PC support Copyright © 1995-2004 C H Forsyth (forsyth@terzarima.net).
// Portions Copyright © 1997-1999 Vita Nuova Limited.
// Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com).
// Revisions Copyright © 2000-2004 Lucent Technologies Inc. and others.
// Portions Copyright © 2009 The Go Authors. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@ -50,8 +50,8 @@ extern Mach mmips, msparc, m68020, mi386, mamd64,
extern Machdata mipsmach, sparcmach, m68020mach, i386mach,
armmach, mipsmach2le, powermach, alphamach, sparc64mach;
*/
extern Mach mi386, mamd64;
extern Machdata i386mach;
extern Mach mi386, mamd64, marm;
extern Machdata i386mach, armmach;
/*
* machine selection table. machines with native disassemblers should
@ -72,6 +72,12 @@ Machtab machines[] =
AAMD64,
&mamd64,
&i386mach, },
{ "arm", /*ARM*/
FARM,
FARMB,
AARM,
&marm,
&armmach, },
#ifdef unused
{ "68020", /*68020*/
F68020,
@ -127,12 +133,6 @@ Machtab machines[] =
AI8086,
&mi386,
&i386mach, },
{ "arm", /*ARM*/
FARM,
FARMB,
AARM,
&marm,
&armmach, },
{ "power", /*PowerPC*/
FPOWER,
FPOWERB,