summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2008-08-03 17:25:15 -0700
committerRuss Cox <rsc@golang.org>2008-08-03 17:25:15 -0700
commit8b06420233d33b1cddc5709ecf34a106fb709882 (patch)
tree77abd882c6047963b22d61229dd95e9356208875 /include
parentb389a6f476e3a8c0432d749be945958bb2d8a0df (diff)
downloadgolang-8b06420233d33b1cddc5709ecf34a106fb709882.tar.gz
make 6a, 6c, 6g, 6l, libmach_amd64 build on 64-bit gcc.
these guys really really want long to be 32-bits, so ,s/long/int32/ (and then manual fixup). still passes all tests. (i started out looking for just those longs that needed to be int32 instead, and it was just too hard to track them down one by one.) the longs were rare enough that i don't think it will cause integration problems. R=ken OCL=13787 CL=13789
Diffstat (limited to 'include')
-rw-r--r--include/bootexec.h146
-rw-r--r--include/mach_amd64.h62
-rw-r--r--include/u.h10
-rw-r--r--include/ureg_x86.h40
4 files changed, 134 insertions, 124 deletions
diff --git a/include/bootexec.h b/include/bootexec.h
index 744273386..49721ea33 100644
--- a/include/bootexec.h
+++ b/include/bootexec.h
@@ -29,14 +29,14 @@
struct coffsect
{
char name[8];
- ulong phys;
- ulong virt;
- ulong size;
- ulong fptr;
- ulong fptrreloc;
- ulong fptrlineno;
- ulong nrelocnlineno;
- ulong flags;
+ uint32 phys;
+ uint32 virt;
+ uint32 size;
+ uint32 fptr;
+ uint32 fptrreloc;
+ uint32 fptrlineno;
+ uint32 nrelocnlineno;
+ uint32 flags;
};
/*
@@ -46,26 +46,26 @@ 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 */
+ int32 timdat; /* (unused) time & date stamp */
+ int32 symptr; /* offset to symbol table */
+ int32 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 */
+ int32 tsize; /* text size in bytes */
+ int32 dsize; /* initialized data */
+ int32 bsize; /* uninitialized data */
+ int32 mentry; /* entry pt. */
+ int32 text_start; /* base of text used for this file */
+ int32 data_start; /* base of data used for this file */
+ int32 bss_start; /* base of bss used for this file */
+ int32 gprmask; /* general purpose register mask */
union{
- long cprmask[4]; /* co-processor register masks */
- long pcsize;
+ int32 cprmask[4]; /* co-processor register masks */
+ int32 pcsize;
};
- long gp_value; /* the gp value used for this object */
+ int32 gp_value; /* the gp value used for this object */
};
struct mips4kexec
@@ -80,64 +80,64 @@ 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;
+ uint32 stext;
+ uint32 sdata;
+ uint32 sbss;
+ uint32 ssyms;
+ uint32 sentry;
+ uint32 strsize;
+ uint32 sdrsize;
};
struct nextexec
{
/* UNUSED
struct nexthdr{
- ulong nmagic;
- ulong ncputype;
- ulong ncpusubtype;
- ulong nfiletype;
- ulong ncmds;
- ulong nsizeofcmds;
- ulong nflags;
+ uint32 nmagic;
+ uint32 ncputype;
+ uint32 ncpusubtype;
+ uint32 nfiletype;
+ uint32 ncmds;
+ uint32 nsizeofcmds;
+ uint32 nflags;
};
struct nextcmd{
- ulong cmd;
- ulong cmdsize;
+ uint32 cmd;
+ uint32 cmdsize;
uchar segname[16];
- ulong vmaddr;
- ulong vmsize;
- ulong fileoff;
- ulong filesize;
- ulong maxprot;
- ulong initprot;
- ulong nsects;
- ulong flags;
+ uint32 vmaddr;
+ uint32 vmsize;
+ uint32 fileoff;
+ uint32 filesize;
+ uint32 maxprot;
+ uint32 initprot;
+ uint32 nsects;
+ uint32 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;
+ uint32 addr;
+ uint32 size;
+ uint32 offset;
+ uint32 align;
+ uint32 reloff;
+ uint32 nreloc;
+ uint32 flags;
+ uint32 reserved1;
+ uint32 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;
+ uint32 cmd;
+ uint32 cmdsize;
+ uint32 symoff;
+ uint32 nsyms;
+ uint32 spoff;
+ uint32 pcoff;
}symc;
*/
};
@@ -146,20 +146,20 @@ struct i386exec
{
/* UNUSED
struct i386coff{
- ulong isectmagic;
- ulong itime;
- ulong isyms;
- ulong insyms;
- ulong iflags;
+ uint32 isectmagic;
+ uint32 itime;
+ uint32 isyms;
+ uint32 insyms;
+ uint32 iflags;
};
struct i386hdr{
- ulong imagic;
- ulong itextsize;
- ulong idatasize;
- ulong ibsssize;
- ulong ientry;
- ulong itextstart;
- ulong idatastart;
+ uint32 imagic;
+ uint32 itextsize;
+ uint32 idatasize;
+ uint32 ibsssize;
+ uint32 ientry;
+ uint32 itextstart;
+ uint32 idatastart;
};
struct coffsect itexts;
struct coffsect idatas;
diff --git a/include/mach_amd64.h b/include/mach_amd64.h
index eb046d8cf..4a3bf20e6 100644
--- a/include/mach_amd64.h
+++ b/include/mach_amd64.h
@@ -42,14 +42,14 @@
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 */
+ int32 magic; /* magic number */
+ int32 text; /* size of text segment */
+ int32 data; /* size of initialized data */
+ int32 bss; /* size of uninitialized data */
+ int32 syms; /* size of symbol table */
+ int32 entry; /* entry point */
+ int32 spsz; /* size of pc/sp offset table */
+ int32 pcsz; /* size of pc/line number table */
};
#define HDR_MAGIC 0x00008000 /* header expansion */
@@ -263,8 +263,8 @@ 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 */
+ int32 regsize; /* sizeof registers in bytes */
+ int32 fpregsize; /* sizeof fp registers in bytes */
char *pc; /* pc name */
char *sp; /* sp name */
char *link; /* link register name */
@@ -291,12 +291,12 @@ struct Machdata { /* Machine-dependent debugger support */
short bpsize; /* size of break point instr. */
ushort (*swab)(ushort); /* ushort to local byte order */
- ulong (*swal)(ulong); /* ulong to local byte order */
+ uint32 (*swal)(uint32); /* uint32 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 */
+ uint32 (*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 */
@@ -315,7 +315,7 @@ typedef struct Fhdr
uchar hdrsz; /* header size */
uchar _magic; /* _MAGIC() magic */
uchar spare;
- long magic; /* magic number */
+ int32 magic; /* magic number */
uvlong txtaddr; /* text address */
vlong txtoff; /* start of text in file */
uvlong dataddr; /* start of data segment */
@@ -324,12 +324,12 @@ typedef struct Fhdr
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 */
+ int32 txtsz; /* text size */
+ int32 datsz; /* size of data seg */
+ int32 bsssz; /* size of bss */
+ int32 symsz; /* size of symbol table */
+ int32 sppcsz; /* size of sp-pc table */
+ int32 lnpcsz; /* size of line number-pc table */
} Fhdr;
extern int asstype; /* dissembler type - machdata.c */
@@ -340,14 +340,14 @@ int beieee80ftos(char*, int, void*);
int beieeesftos(char*, int, void*);
int beieeedftos(char*, int, void*);
ushort beswab(ushort);
-ulong beswal(ulong);
+uint32 beswal(uint32);
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);
+uvlong file2pc(char*, int32);
int fileelem(Sym**, uchar *, char*, int);
-long fileline(char*, int, uvlong);
+int32 fileline(char*, int, uvlong);
int filesym(int, char*, int);
int findlocal(Symbol*, char*, Symbol*);
int findseg(Map*, char*);
@@ -356,23 +356,23 @@ 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 get4(Map*, uvlong, uint32*);
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);
+char* _hexify(char*, uint32, int);
+int ieeesftos(char*, int, uint32);
+int ieeedftos(char*, int, uint32, uint32);
int isar(Biobuf*);
int leieee80ftos(char*, int, void*);
int leieeesftos(char*, int, void*);
int leieeedftos(char*, int, void*);
ushort leswab(ushort);
-ulong leswal(ulong);
+uint32 leswal(uint32);
uvlong leswav(uvlong);
-uvlong line2addr(long, uvlong, uvlong);
+uvlong line2addr(int32, uvlong, uvlong);
Map* loadmap(Map*, int, Fhdr*);
int localaddr(Map*, char*, char*, uvlong*, Rgetter);
int localsym(Symbol*, int);
@@ -384,10 +384,10 @@ Map* newmap(Map*, int);
void objtraverse(void(*)(Sym*, void*), void*);
int objtype(Biobuf*, char**);
uvlong pc2sp(uvlong);
-long pc2line(uvlong);
+int32 pc2line(uvlong);
int put1(Map*, uvlong, uchar*, int);
int put2(Map*, uvlong, ushort);
-int put4(Map*, uvlong, ulong);
+int put4(Map*, uvlong, uint32);
int put8(Map*, uvlong, uvlong);
int puta(Map*, uvlong, uvlong);
int readar(Biobuf*, int, vlong, int);
@@ -395,7 +395,7 @@ 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*);
+Sym* symbase(int32*);
int syminit(int, Fhdr*);
int symoff(char*, int, uvlong, int);
void textseg(uvlong, Fhdr*);
diff --git a/include/u.h b/include/u.h
index 9b7bccb1a..1b196286e 100644
--- a/include/u.h
+++ b/include/u.h
@@ -173,6 +173,16 @@ typedef intptr_t intptr;
typedef uint32_t u32int;
typedef int32_t s32int;
+typedef s8int int8;
+typedef u8int uint8;
+typedef s16int int16;
+typedef u16int uint16;
+typedef s32int int32;
+typedef u32int uint32;
+typedef s64int int64;
+typedef u64int uint64;
+
+
#undef _NEEDUCHAR
#undef _NEEDUSHORT
#undef _NEEDUINT
diff --git a/include/ureg_x86.h b/include/ureg_x86.h
index 84d32fccb..c20fe4e4c 100644
--- a/include/ureg_x86.h
+++ b/include/ureg_x86.h
@@ -28,26 +28,26 @@
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 */
+ uint32 di; /* general registers */
+ uint32 si; /* ... */
+ uint32 bp; /* ... */
+ uint32 nsp;
+ uint32 bx; /* ... */
+ uint32 dx; /* ... */
+ uint32 cx; /* ... */
+ uint32 ax; /* ... */
+ uint32 gs; /* data segments */
+ uint32 fs; /* ... */
+ uint32 es; /* ... */
+ uint32 ds; /* ... */
+ uint32 trap; /* trap type */
+ uint32 ecode; /* error code (or zero) */
+ uint32 pc; /* pc */
+ uint32 cs; /* old context */
+ uint32 flags; /* old flags */
union {
- ulong usp;
- ulong sp;
+ uint32 usp;
+ uint32 sp;
};
- ulong ss; /* old stack segment */
+ uint32 ss; /* old stack segment */
};