From a29543c6edc00919a99ada17109852f92ff85378 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Thu, 12 Jun 2008 14:50:25 -0700 Subject: Add 6db SVN=122505 --- include/bootexec.h | 169 +++++++++++++++++++++ include/mach_amd64.h | 403 +++++++++++++++++++++++++++++++++++++++++++++++++++ include/ureg_amd64.h | 58 ++++++++ include/ureg_x86.h | 53 +++++++ 4 files changed, 683 insertions(+) create mode 100644 include/bootexec.h create mode 100644 include/mach_amd64.h create mode 100644 include/ureg_amd64.h create mode 100644 include/ureg_x86.h (limited to 'include') diff --git a/include/bootexec.h b/include/bootexec.h new file mode 100644 index 000000000..744273386 --- /dev/null +++ b/include/bootexec.h @@ -0,0 +1,169 @@ +// Inferno libmach/bootexec.h +// http://code.google.com/p/inferno-os/source/browse/utils/libmach/bootexec.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 coffsect +{ + char name[8]; + ulong phys; + ulong virt; + ulong size; + ulong fptr; + ulong fptrreloc; + ulong fptrlineno; + ulong nrelocnlineno; + ulong flags; +}; + +/* + * proprietary exec headers, needed to bootstrap various machines + */ +struct mipsexec +{ + short mmagic; /* (0x160) mips magic number */ + short nscns; /* (unused) number of sections */ + long timdat; /* (unused) time & date stamp */ + long symptr; /* offset to symbol table */ + long nsyms; /* size of symbol table */ + short opthdr; /* (0x38) sizeof(optional hdr) */ + short pcszs; /* flags */ + short amagic; /* see above */ + short vstamp; /* version stamp */ + long tsize; /* text size in bytes */ + long dsize; /* initialized data */ + long bsize; /* uninitialized data */ + long mentry; /* entry pt. */ + long text_start; /* base of text used for this file */ + long data_start; /* base of data used for this file */ + long bss_start; /* base of bss used for this file */ + long gprmask; /* general purpose register mask */ +union{ + long cprmask[4]; /* co-processor register masks */ + long pcsize; +}; + long gp_value; /* the gp value used for this object */ +}; + +struct mips4kexec +{ + struct mipsexec h; + struct coffsect itexts; + struct coffsect idatas; + struct coffsect ibsss; +}; + +struct sparcexec +{ + short sjunk; /* dynamic bit and version number */ + short smagic; /* 0407 */ + ulong stext; + ulong sdata; + ulong sbss; + ulong ssyms; + ulong sentry; + ulong strsize; + ulong sdrsize; +}; + +struct nextexec +{ +/* UNUSED + struct nexthdr{ + ulong nmagic; + ulong ncputype; + ulong ncpusubtype; + ulong nfiletype; + ulong ncmds; + ulong nsizeofcmds; + ulong nflags; + }; + + struct nextcmd{ + ulong cmd; + ulong cmdsize; + uchar segname[16]; + ulong vmaddr; + ulong vmsize; + ulong fileoff; + ulong filesize; + ulong maxprot; + ulong initprot; + ulong nsects; + ulong flags; + }textc; + struct nextsect{ + char sectname[16]; + char segname[16]; + ulong addr; + ulong size; + ulong offset; + ulong align; + ulong reloff; + ulong nreloc; + ulong flags; + ulong reserved1; + ulong reserved2; + }texts; + struct nextcmd datac; + struct nextsect datas; + struct nextsect bsss; + struct nextsym{ + ulong cmd; + ulong cmdsize; + ulong symoff; + ulong nsyms; + ulong spoff; + ulong pcoff; + }symc; +*/ +}; + +struct i386exec +{ +/* UNUSED + struct i386coff{ + ulong isectmagic; + ulong itime; + ulong isyms; + ulong insyms; + ulong iflags; + }; + struct i386hdr{ + ulong imagic; + ulong itextsize; + ulong idatasize; + ulong ibsssize; + ulong ientry; + ulong itextstart; + ulong idatastart; + }; + struct coffsect itexts; + struct coffsect idatas; + struct coffsect ibsss; + struct coffsect icomments; +*/ +}; diff --git a/include/mach_amd64.h b/include/mach_amd64.h new file mode 100644 index 000000000..eb046d8cf --- /dev/null +++ b/include/mach_amd64.h @@ -0,0 +1,403 @@ +// Inferno libmach/a.out.h and libmach/mach.h +// http://code.google.com/p/inferno-os/source/browse/utils/libmach/a.out.h +// http://code.google.com/p/inferno-os/source/browse/utils/libmach/mach.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. + +/* + * Architecture-dependent application data + * This is just Plan 9's mach.h, tweaked to support only amd64 for now. + */ +/* + * Start of Plan 9 a.out.h + * Don't use system a.out; instead just lay in the Plan 9 one for now. + */ +/* +#include "a.out.h" +*/ + +typedef struct Exec Exec; +struct Exec +{ + long magic; /* magic number */ + long text; /* size of text segment */ + long data; /* size of initialized data */ + long bss; /* size of uninitialized data */ + long syms; /* size of symbol table */ + long entry; /* entry point */ + long spsz; /* size of pc/sp offset table */ + long pcsz; /* size of pc/line number table */ +}; + +#define HDR_MAGIC 0x00008000 /* header expansion */ + +#define _MAGIC(f, b) ((f)|((((4*(b))+0)*(b))+7)) +#define A_MAGIC _MAGIC(0, 8) /* 68020 */ +#define I_MAGIC _MAGIC(0, 11) /* intel 386 */ +#define J_MAGIC _MAGIC(0, 12) /* intel 960 (retired) */ +#define K_MAGIC _MAGIC(0, 13) /* sparc */ +#define V_MAGIC _MAGIC(0, 16) /* mips 3000 BE */ +#define X_MAGIC _MAGIC(0, 17) /* att dsp 3210 (retired) */ +#define M_MAGIC _MAGIC(0, 18) /* mips 4000 BE */ +#define D_MAGIC _MAGIC(0, 19) /* amd 29000 (retired) */ +#define E_MAGIC _MAGIC(0, 20) /* arm */ +#define Q_MAGIC _MAGIC(0, 21) /* powerpc */ +#define N_MAGIC _MAGIC(0, 22) /* mips 4000 LE */ +#define L_MAGIC _MAGIC(0, 23) /* dec alpha */ +#define P_MAGIC _MAGIC(0, 24) /* mips 3000 LE */ +#define U_MAGIC _MAGIC(0, 25) /* sparc64 */ +#define S_MAGIC _MAGIC(HDR_MAGIC, 26) /* amd64 */ +#define T_MAGIC _MAGIC(HDR_MAGIC, 27) /* powerpc64 */ + +#define MIN_MAGIC 8 +#define MAX_MAGIC 27 /* <= 90 */ + +#define DYN_MAGIC 0x80000000 /* dlm */ + +typedef struct Sym Sym; +struct Sym +{ + vlong value; + uint sig; + char type; + char *name; +}; +/* + * End of Plan 9 a.out.h + * Don't use system a.out; instead just lay in the Plan 9 one for now. + */ + + +/* + * Supported architectures: + * mips, + * 68020, + * i386, + * amd64, + * sparc, + * sparc64, + * mips2 (R4000) + * arm + * powerpc, + * powerpc64 + * alpha + */ +enum +{ + MMIPS, /* machine types */ + MSPARC, + M68020, + MI386, + MI960, /* retired */ + M3210, /* retired */ + MMIPS2, + NMIPS2, + M29000, /* retired */ + MARM, + MPOWER, + MALPHA, + NMIPS, + MSPARC64, + MAMD64, + MPOWER64, + /* types of executables */ + FNONE = 0, /* unidentified */ + FMIPS, /* v.out */ + FMIPSB, /* mips bootable */ + FSPARC, /* k.out */ + FSPARCB, /* Sparc bootable */ + F68020, /* 2.out */ + F68020B, /* 68020 bootable */ + FNEXTB, /* Next bootable */ + FI386, /* 8.out */ + FI386B, /* I386 bootable */ + FI960, /* retired */ + FI960B, /* retired */ + F3210, /* retired */ + FMIPS2BE, /* 4.out */ + F29000, /* retired */ + FARM, /* 5.out */ + FARMB, /* ARM bootable */ + FPOWER, /* q.out */ + FPOWERB, /* power pc bootable */ + FMIPS2LE, /* 0.out */ + FALPHA, /* 7.out */ + FALPHAB, /* DEC Alpha bootable */ + FMIPSLE, /* 3k little endian */ + FSPARC64, /* u.out */ + FAMD64, /* 6.out */ + FAMD64B, /* 6.out bootable */ + FPOWER64, /* 9.out */ + FPOWER64B, /* 9.out bootable */ + + ANONE = 0, /* dissembler types */ + AMIPS, + AMIPSCO, /* native mips */ + ASPARC, + ASUNSPARC, /* native sun */ + A68020, + AI386, + AI8086, /* oh god */ + AI960, /* retired */ + A29000, /* retired */ + AARM, + APOWER, + AALPHA, + ASPARC64, + AAMD64, + APOWER64, + /* object file types */ + Obj68020 = 0, /* .2 */ + ObjSparc, /* .k */ + ObjMips, /* .v */ + Obj386, /* .8 */ + Obj960, /* retired */ + Obj3210, /* retired */ + ObjMips2, /* .4 */ + Obj29000, /* retired */ + ObjArm, /* .5 */ + ObjPower, /* .q */ + ObjMips2le, /* .0 */ + ObjAlpha, /* .7 */ + ObjSparc64, /* .u */ + ObjAmd64, /* .6 */ + ObjSpim, /* .0 */ + ObjPower64, /* .9 */ + Maxobjtype, + + CNONE = 0, /* symbol table classes */ + CAUTO, + CPARAM, + CSTAB, + CTEXT, + CDATA, + CANY, /* to look for any class */ +}; + +typedef struct Map Map; +typedef struct Symbol Symbol; +typedef struct Reglist Reglist; +typedef struct Mach Mach; +typedef struct Machdata Machdata; + +/* + * Structure to map a segment to a position in a file + */ +struct Map { + int nsegs; /* number of segments */ + struct segment { /* per-segment map */ + char *name; /* the segment name */ + int fd; /* file descriptor */ + int inuse; /* in use - not in use */ + int cache; /* should cache reads? */ + uvlong b; /* base */ + uvlong e; /* end */ + vlong f; /* offset within file */ + } seg[1]; /* actually n of these */ +}; + +/* + * Internal structure describing a symbol table entry + */ +struct Symbol { + void *handle; /* used internally - owning func */ + struct { + char *name; + vlong value; /* address or stack offset */ + char type; /* as in a.out.h */ + char class; /* as above */ + int index; /* in findlocal, globalsym, textsym */ + }; +}; + +/* + * machine register description + */ +struct Reglist { + char *rname; /* register name */ + short roffs; /* offset in u-block */ + char rflags; /* INTEGER/FLOAT, WRITABLE */ + char rformat; /* print format: 'x', 'X', 'f', '8', '3', 'Y', 'W' */ +}; + +enum { /* bits in rflags field */ + RINT = (0<<0), + RFLT = (1<<0), + RRDONLY = (1<<1), +}; + +/* + * Machine-dependent data is stored in two structures: + * Mach - miscellaneous general parameters + * Machdata - jump vector of service functions used by debuggers + * + * Mach is defined in ?.c and set in executable.c + * + * Machdata is defined in ?db.c + * and set in the debugger startup. + */ +struct Mach{ + char *name; + int mtype; /* machine type code */ + Reglist *reglist; /* register set */ + long regsize; /* sizeof registers in bytes */ + long fpregsize; /* sizeof fp registers in bytes */ + char *pc; /* pc name */ + char *sp; /* sp name */ + char *link; /* link register name */ + char *sbreg; /* static base register name */ + uvlong sb; /* static base register value */ + int pgsize; /* page size */ + uvlong kbase; /* kernel base address */ + uvlong ktmask; /* ktzero = kbase & ~ktmask */ + uvlong utop; /* user stack top */ + int pcquant; /* quantization of pc */ + int szaddr; /* sizeof(void*) */ + int szreg; /* sizeof(register) */ + int szfloat; /* sizeof(float) */ + int szdouble; /* sizeof(double) */ +}; + +extern Mach *mach; /* Current machine */ + +typedef uvlong (*Rgetter)(Map*, char*); +typedef void (*Tracer)(Map*, uvlong, uvlong, Symbol*); + +struct Machdata { /* Machine-dependent debugger support */ + uchar bpinst[4]; /* break point instr. */ + short bpsize; /* size of break point instr. */ + + ushort (*swab)(ushort); /* ushort to local byte order */ + ulong (*swal)(ulong); /* ulong to local byte order */ + uvlong (*swav)(uvlong); /* uvlong to local byte order */ + int (*ctrace)(Map*, uvlong, uvlong, uvlong, Tracer); /* C traceback */ + uvlong (*findframe)(Map*, uvlong, uvlong, uvlong, uvlong);/* frame finder */ + char* (*excep)(Map*, Rgetter); /* last exception */ + ulong (*bpfix)(uvlong); /* breakpoint fixup */ + int (*sftos)(char*, int, void*); /* single precision float */ + int (*dftos)(char*, int, void*); /* double precision float */ + int (*foll)(Map*, uvlong, Rgetter, uvlong*);/* follow set */ + int (*das)(Map*, uvlong, char, char*, int); /* symbolic disassembly */ + int (*hexinst)(Map*, uvlong, char*, int); /* hex disassembly */ + int (*instsize)(Map*, uvlong); /* instruction size */ +}; + +/* + * Common a.out header describing all architectures + */ +typedef struct Fhdr +{ + char *name; /* identifier of executable */ + uchar type; /* file type - see codes above */ + uchar hdrsz; /* header size */ + uchar _magic; /* _MAGIC() magic */ + uchar spare; + long magic; /* magic number */ + uvlong txtaddr; /* text address */ + vlong txtoff; /* start of text in file */ + uvlong dataddr; /* start of data segment */ + vlong datoff; /* offset to data seg in file */ + vlong symoff; /* offset of symbol table in file */ + uvlong entry; /* entry point */ + vlong sppcoff; /* offset of sp-pc table in file */ + vlong lnpcoff; /* offset of line number-pc table in file */ + long txtsz; /* text size */ + long datsz; /* size of data seg */ + long bsssz; /* size of bss */ + long symsz; /* size of symbol table */ + long sppcsz; /* size of sp-pc table */ + long lnpcsz; /* size of line number-pc table */ +} Fhdr; + +extern int asstype; /* dissembler type - machdata.c */ +extern Machdata *machdata; /* jump vector - machdata.c */ + +Map* attachproc(int, int, int, Fhdr*); +int beieee80ftos(char*, int, void*); +int beieeesftos(char*, int, void*); +int beieeedftos(char*, int, void*); +ushort beswab(ushort); +ulong beswal(ulong); +uvlong beswav(uvlong); +uvlong ciscframe(Map*, uvlong, uvlong, uvlong, uvlong); +int cisctrace(Map*, uvlong, uvlong, uvlong, Tracer); +int crackhdr(int fd, Fhdr*); +uvlong file2pc(char*, long); +int fileelem(Sym**, uchar *, char*, int); +long fileline(char*, int, uvlong); +int filesym(int, char*, int); +int findlocal(Symbol*, char*, Symbol*); +int findseg(Map*, char*); +int findsym(uvlong, int, Symbol *); +int fnbound(uvlong, uvlong*); +int fpformat(Map*, Reglist*, char*, int, int); +int get1(Map*, uvlong, uchar*, int); +int get2(Map*, uvlong, ushort*); +int get4(Map*, uvlong, ulong*); +int get8(Map*, uvlong, uvlong*); +int geta(Map*, uvlong, uvlong*); +int getauto(Symbol*, int, int, Symbol*); +Sym* getsym(int); +int globalsym(Symbol *, int); +char* _hexify(char*, ulong, int); +int ieeesftos(char*, int, ulong); +int ieeedftos(char*, int, ulong, ulong); +int isar(Biobuf*); +int leieee80ftos(char*, int, void*); +int leieeesftos(char*, int, void*); +int leieeedftos(char*, int, void*); +ushort leswab(ushort); +ulong leswal(ulong); +uvlong leswav(uvlong); +uvlong line2addr(long, uvlong, uvlong); +Map* loadmap(Map*, int, Fhdr*); +int localaddr(Map*, char*, char*, uvlong*, Rgetter); +int localsym(Symbol*, int); +int lookup(char*, char*, Symbol*); +void machbytype(int); +int machbyname(char*); +int nextar(Biobuf*, int, char*); +Map* newmap(Map*, int); +void objtraverse(void(*)(Sym*, void*), void*); +int objtype(Biobuf*, char**); +uvlong pc2sp(uvlong); +long pc2line(uvlong); +int put1(Map*, uvlong, uchar*, int); +int put2(Map*, uvlong, ushort); +int put4(Map*, uvlong, ulong); +int put8(Map*, uvlong, uvlong); +int puta(Map*, uvlong, uvlong); +int readar(Biobuf*, int, vlong, int); +int readobj(Biobuf*, int); +uvlong riscframe(Map*, uvlong, uvlong, uvlong, uvlong); +int risctrace(Map*, uvlong, uvlong, uvlong, Tracer); +int setmap(Map*, int, uvlong, uvlong, vlong, char*); +Sym* symbase(long*); +int syminit(int, Fhdr*); +int symoff(char*, int, uvlong, int); +void textseg(uvlong, Fhdr*); +int textsym(Symbol*, int); +void unusemap(Map*, int); diff --git a/include/ureg_amd64.h b/include/ureg_amd64.h new file mode 100644 index 000000000..2c39f17ce --- /dev/null +++ b/include/ureg_amd64.h @@ -0,0 +1,58 @@ +// Inferno utils/libmach/ureg6.h +// http://code.google.com/p/inferno-os/source/browse/utils/libmach/ureg6.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 { + u64int ax; + u64int bx; + u64int cx; + u64int dx; + u64int si; + u64int di; + u64int bp; + u64int r8; + u64int r9; + u64int r10; + u64int r11; + u64int r12; + u64int r13; + u64int r14; + u64int r15; + + u16int ds; + u16int es; + u16int fs; + u16int gs; + + u64int type; + u64int error; /* error code (or zero) */ + u64int ip; /* pc */ + u64int cs; /* old context */ + u64int flags; /* old flags */ + u64int sp; /* sp */ + u64int ss; /* old stack segment */ +}; diff --git a/include/ureg_x86.h b/include/ureg_x86.h new file mode 100644 index 000000000..84d32fccb --- /dev/null +++ b/include/ureg_x86.h @@ -0,0 +1,53 @@ +// Inferno utils/libmach/ureg8.h +// http://code.google.com/p/inferno-os/source/browse/utils/libmach/ureg8.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 +{ + ulong di; /* general registers */ + ulong si; /* ... */ + ulong bp; /* ... */ + ulong nsp; + ulong bx; /* ... */ + ulong dx; /* ... */ + ulong cx; /* ... */ + ulong ax; /* ... */ + ulong gs; /* data segments */ + ulong fs; /* ... */ + ulong es; /* ... */ + ulong ds; /* ... */ + ulong trap; /* trap type */ + ulong ecode; /* error code (or zero) */ + ulong pc; /* pc */ + ulong cs; /* old context */ + ulong flags; /* old flags */ + union { + ulong usp; + ulong sp; + }; + ulong ss; /* old stack segment */ +}; -- cgit v1.2.1