vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

commit 7e8322572a62ce5678df8b20faf5e3e508f43cb4
parent 3945e86207f2afcbc6a2e0a63e82c417ce210db9
Author: Russ Cox <rsc@swtch.com>
Date:   Mon,  8 Dec 2008 23:35:36 -0800

9vx: Linux/x86-64 works

With any luck, I've broken everyone else.

Diffstat:
src/9vx/a/a.out.h | 16++++++++--------
src/9vx/a/auth.c | 6+++---
src/9vx/a/chan.c | 2+-
src/9vx/a/dat.h | 3---
src/9vx/a/devroot.c | 6+++---
src/9vx/a/devtls.c | 10+++++-----
src/9vx/a/eipfmt.c | 4++--
src/9vx/a/fcall.h | 18+++++++++---------
src/9vx/a/libsec.h | 6+++---
src/9vx/a/memdraw.h | 46+++++++++++++++++++++++-----------------------
src/9vx/a/portdat.h | 2+-
src/9vx/a/proc.c | 4++++
src/9vx/a/segment.c | 2+-
src/9vx/a/sysfile.c | 66+++++++++++++++++++++++++++++++++---------------------------------
src/9vx/a/sysproc.c | 79++++++++++++++++++++++++++++++++++++++-----------------------------------------
src/9vx/a/systab.h | 2+-
src/9vx/a/ureg.h | 40++++++++++++++++++++--------------------
src/9vx/data2s.c | 2+-
src/9vx/devaudio.c | 4++--
src/9vx/label.S | 3+--
src/9vx/libdraw/bytesperline.c | 2+-
src/9vx/libmemdraw/alloc.c | 28++++++++++++++--------------
src/9vx/libmemdraw/defont.c | 4++--
src/9vx/libmemdraw/draw.c | 102++++++++++++++++++++++++++++++++++++++++----------------------------------------
src/9vx/libmemdraw/fillpoly.c | 4++--
src/9vx/libmemdraw/line.c | 4++--
src/9vx/libmemdraw/load.c | 10+++++-----
src/9vx/libmemdraw/unload.c | 2+-
src/9vx/libsec/des.c | 42+++++++++++++++++++++---------------------
src/9vx/libsec/md4.c | 20++++++++++----------
src/9vx/libsec/md5.c | 12++++++------
src/9vx/libsec/md5block.c | 18+++++++++---------
src/9vx/libsec/sha1.c | 10+++++-----
src/9vx/libsec/sha1block.c | 8++++----
src/9vx/main.c | 12++++++------
src/9vx/mmu.c | 18+++++++++---------
src/9vx/nogui.c | 4++--
src/9vx/stub.c | 27+++++++++++++++++++++++++--
src/9vx/trap.c | 25++++++++++++-------------
src/9vx/unix.h | 12++++++------
src/9vx/vx32.c | 8--------
src/9vx/x11/x11-draw.c | 14+++++++-------
src/9vx/x11/x11-inc.h | 26+++++++++++++-------------
src/9vx/x11/x11-init.c | 2+-
src/9vx/x11/x11-itrans.c | 2+-
src/Makefrag | 2+-
src/hash/sha2.c | 2++
src/hash/whirlpool.c | 2+-
src/libvx32/linux.c | 4++--
src/libvx32/run64.S | 1+
src/libvx32/sig.c | 4++--
51 files changed, 383 insertions(+), 369 deletions(-)

diff --git a/src/9vx/a/a.out.h b/src/9vx/a/a.out.h @@ -1,14 +1,14 @@ typedef struct Exec Exec; struct Exec { - int magic; /* magic number */ - int text; /* size of text segment */ - int data; /* size of initialized data */ - int bss; /* size of uninitialized data */ - int syms; /* size of symbol table */ - int entry; /* entry point */ - int spsz; /* size of pc/sp offset table */ - int 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 point32 */ + int32 spsz; /* size of pc/sp offset table */ + int32 pcsz; /* size of pc/line number table */ }; #define HDR_MAGIC 0x00008000 /* header expansion */ diff --git a/src/9vx/a/auth.c b/src/9vx/a/auth.c @@ -20,7 +20,7 @@ iseve(void) } long -sysfversion(u32int *arg) +sysfversion(uint32 *arg) { char *vers; uint arglen, m, msize; @@ -46,7 +46,7 @@ sysfversion(u32int *arg) } long -sys_fsession(u32int *arg) +sys_fsession(uint32 *arg) { /* deprecated; backwards compatibility only */ @@ -57,7 +57,7 @@ sys_fsession(u32int *arg) } long -sysfauth(u32int *arg) +sysfauth(uint32 *arg) { Chan *c, *ac; char *aname; diff --git a/src/9vx/a/chan.c b/src/9vx/a/chan.c @@ -1314,7 +1314,7 @@ namec(char *aname, int amode, int omode, ulong perm) nexterror(); } if(tracesyscalls) - print("\tnamec %s\n", aname); + iprint("\tnamec %s\n", aname); DBG("namec %s %d %d\n", aname, amode, omode); name = aname; diff --git a/src/9vx/a/dat.h b/src/9vx/a/dat.h @@ -23,9 +23,6 @@ typedef vlong Tval; typedef struct Ureg Ureg; typedef struct Vctl Vctl; -typedef unsigned long long uint64; - - #define MAXSYSARG 5 /* for mount(fd, afd, mpt, flag, arg) */ /* diff --git a/src/9vx/a/devroot.c b/src/9vx/a/devroot.c @@ -223,9 +223,9 @@ rootread(Chan *c, void *buf, long n, vlong off) #ifdef asdf print("[%d] kaddr %.8ulx base %.8ulx offset %ld (%.8ulx), n %d %.8ux %.8ux %.8ux\n", t, buf, data, offset, offset, n, - ((u32int*)(data+offset))[0], - ((u32int*)(data+offset))[1], - ((u32int*)(data+offset))[2]); + ((uint32*)(data+offset))[0], + ((uint32*)(data+offset))[1], + ((uint32*)(data+offset))[2]); #endif memmove(buf, data+offset, n); return n; diff --git a/src/9vx/a/devtls.c b/src/9vx/a/devtls.c @@ -222,7 +222,7 @@ static DigestState*nomac(uchar *p, ulong len, uchar *key, ulong klen, uchar *dig static void sslPackMac(Secret *sec, uchar *mackey, uchar *seq, uchar *header, uchar *body, int len, uchar *mac); static void tlsPackMac(Secret *sec, uchar *mackey, uchar *seq, uchar *header, uchar *body, int len, uchar *mac); static void put64(uchar *p, vlong x); -static void put32(uchar *p, u32int); +static void put32(uchar *p, uint32); static void put24(uchar *p, int); static void put16(uchar *p, int); static int get16(uchar *p); @@ -2101,7 +2101,7 @@ tlsPackMac(Secret *sec, uchar *mackey, uchar *seq, uchar *header, uchar *body, i } static void -put32(uchar *p, u32int x) +put32(uchar *p, uint32 x) { p[0] = x>>24; p[1] = x>>16; @@ -2112,8 +2112,8 @@ put32(uchar *p, u32int x) static void put64(uchar *p, vlong x) { - put32(p, (u32int)(x >> 32)); - put32(p+4, (u32int)x); + put32(p, (uint32)(x >> 32)); + put32(p+4, (uint32)x); } static void @@ -2132,7 +2132,7 @@ put16(uchar *p, int x) } #if 0 -static u32int +static uint32 get32(uchar *p) { return (p[0]<<24)|(p[1]<<16)|(p[2]<<8)|p[3]; diff --git a/src/9vx/a/eipfmt.c b/src/9vx/a/eipfmt.c @@ -27,7 +27,7 @@ eipfmt(Fmt *f) static char *efmt = "%.2ux%.2ux%.2ux%.2ux%.2ux%.2ux"; static char *ifmt = "%d.%d.%d.%d"; uchar *p, ip[16]; - u32int *lp; + uint32 *lp; ushort s; int i, j, n, eln, eli; @@ -73,7 +73,7 @@ common: return fmtstrcpy(f, buf); case 'i': /* v6 address as 4 longs */ - lp = va_arg(f->args, u32int*); + lp = va_arg(f->args, uint32*); for(i = 0; i < 4; i++) hnputl(ip+4*i, *lp++); p = ip; diff --git a/src/9vx/a/fcall.h b/src/9vx/a/fcall.h @@ -7,11 +7,11 @@ typedef struct Fcall { uchar type; - u32int fid; + uint32 fid; ushort tag; union { struct { - u32int msize; /* Tversion, Rversion */ + uint32 msize; /* Tversion, Rversion */ char *version; /* Tversion, Rversion */ }; struct { @@ -22,23 +22,23 @@ struct Fcall }; struct { Qid qid; /* Rattach, Ropen, Rcreate */ - u32int iounit; /* Ropen, Rcreate */ + uint32 iounit; /* Ropen, Rcreate */ }; struct { Qid aqid; /* Rauth */ }; struct { - u32int afid; /* Tauth, Tattach */ + uint32 afid; /* Tauth, Tattach */ char *uname; /* Tauth, Tattach */ char *aname; /* Tauth, Tattach */ }; struct { - u32int perm; /* Tcreate */ + uint32 perm; /* Tcreate */ char *name; /* Tcreate */ uchar mode; /* Tcreate, Topen */ }; struct { - u32int newfid; /* Twalk */ + uint32 newfid; /* Twalk */ ushort nwname; /* Twalk */ char *wname[MAXWELEM]; /* Twalk */ }; @@ -48,7 +48,7 @@ struct Fcall }; struct { vlong offset; /* Tread, Twrite */ - u32int count; /* Tread, Twrite, Rread */ + uint32 count; /* Tread, Twrite, Rread */ char *data; /* Twrite, Rread */ }; struct { @@ -62,7 +62,7 @@ struct Fcall #define GBIT8(p) ((p)[0]) #define GBIT16(p) ((p)[0]|((p)[1]<<8)) #define GBIT32(p) ((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24)) -#define GBIT64(p) ((u32int)((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24)) |\ +#define GBIT64(p) ((uint32)((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24)) |\ ((vlong)((p)[4]|((p)[5]<<8)|((p)[6]<<16)|((p)[7]<<24)) << 32)) #define PBIT8(p,v) (p)[0]=(v) @@ -82,7 +82,7 @@ struct Fcall #define STATFIXLEN (BIT16SZ+QIDSZ+5*BIT16SZ+4*BIT32SZ+1*BIT64SZ) /* amount of fixed length data in a stat buffer */ #define NOTAG (ushort)~0U /* Dummy tag */ -#define NOFID (u32int)~0U /* Dummy fid */ +#define NOFID (uint32)~0U /* Dummy fid */ #define IOHDRSZ 24 /* ample room for Twrite/Rread header (iounit) */ enum diff --git a/src/9vx/a/libsec.h b/src/9vx/a/libsec.h @@ -52,8 +52,8 @@ struct BFstate uchar key[56]; uchar ivec[8]; - u32int pbox[BFrounds+2]; - u32int sbox[1024]; + uint32 pbox[BFrounds+2]; + uint32 sbox[1024]; }; void setupBFstate(BFstate *s, uchar key[], int keybytes, uchar *ivec); @@ -138,7 +138,7 @@ typedef struct DigestState DigestState; struct DigestState { uvlong len; - u32int state[5]; + uint32 state[5]; uchar buf[128]; int blen; char malloced; diff --git a/src/9vx/a/memdraw.h b/src/9vx/a/memdraw.h @@ -17,7 +17,7 @@ typedef struct Memdrawparam Memdrawparam; struct Memdata { - u32int *base; /* allocated data pointer */ + uint32 *base; /* allocated data pointer */ uchar *bdata; /* pointer to first byte of actual data; word-aligned */ int ref; /* number of Memimages using this data */ void* imref; @@ -39,14 +39,14 @@ struct Memimage Rectangle clipr; /* clipping region */ int depth; /* number of bits of storage per pixel */ int nchan; /* number of channels */ - u32int chan; /* channel descriptions */ + uint32 chan; /* channel descriptions */ Memcmap *cmap; Memdata *data; /* pointer to data; shared by windows in this image */ int zero; /* data->bdata+zero==&byte containing (0,0) */ - u32int width; /* width in words of a single scan line */ + uint32 width; /* width in words of a single scan line */ Memlayer *layer; /* nil if not a layer*/ - u32int flags; + uint32 flags; int shift[NChan]; int mask[NChan]; @@ -103,20 +103,20 @@ struct Memdrawparam Rectangle mr; int op; - u32int state; - u32int mval; /* if Simplemask, the mask pixel in mask format */ - u32int mrgba; /* mval in rgba */ - u32int sval; /* if Simplesrc, the source pixel in src format */ - u32int srgba; /* sval in rgba */ - u32int sdval; /* sval in dst format */ + uint32 state; + uint32 mval; /* if Simplemask, the mask pixel in mask format */ + uint32 mrgba; /* mval in rgba */ + uint32 sval; /* if Simplesrc, the source pixel in src format */ + uint32 srgba; /* sval in rgba */ + uint32 sdval; /* sval in dst format */ }; /* * Memimage management */ -extern Memimage* allocmemimage(Rectangle, u32int); -extern Memimage* allocmemimaged(Rectangle, u32int, Memdata*, void*); +extern Memimage* allocmemimage(Rectangle, uint32); +extern Memimage* allocmemimaged(Rectangle, uint32, Memdata*, void*); extern Memimage* readmemimage(int); extern Memimage* creadmemimage(int); extern int writememimage(int, Memimage*); @@ -124,11 +124,11 @@ extern void freememimage(Memimage*); extern int loadmemimage(Memimage*, Rectangle, uchar*, int); extern int cloadmemimage(Memimage*, Rectangle, uchar*, int); extern int unloadmemimage(Memimage*, Rectangle, uchar*, int); -extern u32int* wordaddr(Memimage*, Point); +extern uint32* wordaddr(Memimage*, Point); extern uchar* byteaddr(Memimage*, Point); extern int drawclip(Memimage*, Rectangle*, Memimage*, Point*, Memimage*, Point*, Rectangle*, Rectangle*); -extern void memfillcolor(Memimage*, u32int); -extern int memsetchan(Memimage*, u32int); +extern void memfillcolor(Memimage*, uint32); +extern int memsetchan(Memimage*, uint32); /* * Graphics @@ -185,19 +185,19 @@ extern int drawdebug; */ -extern Memimage* _allocmemimage(Rectangle, u32int); +extern Memimage* _allocmemimage(Rectangle, uint32); extern void _freememimage(Memimage*); -extern void _memfillcolor(Memimage*, u32int); +extern void _memfillcolor(Memimage*, uint32); extern int _loadmemimage(Memimage*, Rectangle, uchar*, int); extern int _cloadmemimage(Memimage*, Rectangle, uchar*, int); extern int _unloadmemimage(Memimage*, Rectangle, uchar*, int); extern void _memimageinit(void); extern Memdrawparam *_memimagedrawsetup(Memimage*, Rectangle, Memimage*, Point, Memimage*, Point, int); extern void _memimagedraw(Memdrawparam*); -extern u32int _rgbatoimg(Memimage*, u32int); -extern u32int _pixelbits(Memimage*, Point); -extern u32int _imgtorgba(Memimage*, u32int); +extern uint32 _rgbatoimg(Memimage*, uint32); +extern uint32 _pixelbits(Memimage*, Point); +extern uint32 _imgtorgba(Memimage*, uint32); -extern u32int rgbatoimg(Memimage*, u32int); -extern u32int pixelbits(Memimage*, Point); -extern u32int imgtorgba(Memimage*, u32int); +extern uint32 rgbatoimg(Memimage*, uint32); +extern uint32 pixelbits(Memimage*, Point); +extern uint32 imgtorgba(Memimage*, uint32); diff --git a/src/9vx/a/portdat.h b/src/9vx/a/portdat.h @@ -92,7 +92,7 @@ struct Alarms struct Sargs { - u32int args[MAXSYSARG]; + uint32 args[MAXSYSARG]; }; /* diff --git a/src/9vx/a/proc.c b/src/9vx/a/proc.c @@ -1340,6 +1340,10 @@ kproc(char *name, void (*func)(void *), void *arg) Proc *p; static Pgrp *kpgrp; + extern int tracekdev; + if(tracekdev) + iprint("kproc %s\n", name); + p = newproc(); p->psstate = 0; p->procmode = 0640; diff --git a/src/9vx/a/segment.c b/src/9vx/a/segment.c @@ -730,7 +730,7 @@ pteflush(Pte *pte, int s, int e) } long -syssegflush(u32int *arg) +syssegflush(uint32 *arg) { Segment *s; ulong addr, l; diff --git a/src/9vx/a/sysfile.c b/src/9vx/a/sysfile.c @@ -171,7 +171,7 @@ openmode(ulong o) } long -sysfd2path(u32int *arg) +sysfd2path(uint32 *arg) { Chan *c; char *buf; @@ -185,7 +185,7 @@ sysfd2path(u32int *arg) } long -syspipe(u32int *arg) +syspipe(uint32 *arg) { int fd[2]; Chan *c[2]; @@ -224,7 +224,7 @@ syspipe(u32int *arg) } long -sysdup(u32int *arg) +sysdup(uint32 *arg) { int fd; Chan *c, *oc; @@ -265,7 +265,7 @@ sysdup(u32int *arg) } long -sysopen(u32int *arg) +sysopen(uint32 *arg) { int fd; Chan *c = 0; @@ -315,7 +315,7 @@ fdclose(int fd, int flag) } long -sysclose(u32int *arg) +sysclose(uint32 *arg) { fdtochan(arg[0], -1, 0, 0); fdclose(arg[0], 0); @@ -628,7 +628,7 @@ mountfix(Chan *c, uchar *op, long n, long maxn) } static long -doread(u32int *arg, vlong *offp) +doread(uint32 *arg, vlong *offp) { int dir; long n, nn, nnn; @@ -696,13 +696,13 @@ doread(u32int *arg, vlong *offp) } long -sys_read(u32int *arg) +sys_read(uint32 *arg) { return doread(arg, nil); } long -syspread(u32int *arg) +syspread(uint32 *arg) { vlong v; @@ -716,7 +716,7 @@ syspread(u32int *arg) } static long -dowrite(u32int *arg, vlong *offp) +dowrite(uint32 *arg, vlong *offp) { Chan *c; long m, n; @@ -767,13 +767,13 @@ dowrite(u32int *arg, vlong *offp) } long -sys_write(u32int *arg) +sys_write(uint32 *arg) { return dowrite(arg, nil); } long -syspwrite(u32int *arg) +syspwrite(uint32 *arg) { vlong v; @@ -787,7 +787,7 @@ syspwrite(u32int *arg) } static void -sseek(vlong *ret, u32int *arg) +sseek(vlong *ret, uint32 *arg) { Chan *c; uchar buf[sizeof(Dir)+100]; @@ -796,7 +796,7 @@ sseek(vlong *ret, u32int *arg) vlong off; union { vlong v; - u32int u[2]; + uint32 u[2]; } o; c = fdtochan(arg[1], -1, 1, 1); @@ -856,20 +856,20 @@ sseek(vlong *ret, u32int *arg) } long -sysseek(u32int *arg) +sysseek(uint32 *arg) { sseek(uvalidaddr(arg[0], BY2V, 1), arg); return 0; } long -sysoseek(u32int *arg) +sysoseek(uint32 *arg) { union { vlong v; - u32int u[2]; + uint32 u[2]; } o; - u32int a[5]; + uint32 a[5]; o.v = (long)arg[1]; a[0] = 0; @@ -924,7 +924,7 @@ pathlast(Path *p) } long -sysfstat(u32int *arg) +sysfstat(uint32 *arg) { Chan *c; uint l; @@ -944,7 +944,7 @@ sysfstat(u32int *arg) } long -sysstat(u32int *arg) +sysstat(uint32 *arg) { char *name; Chan *c; @@ -970,7 +970,7 @@ sysstat(u32int *arg) } long -syschdir(u32int *arg) +syschdir(uint32 *arg) { Chan *c; char *name; @@ -1068,25 +1068,25 @@ bindmount(int ismount, int fd, int afd, char* arg0, char* arg1, ulong flag, char } long -sysbind(u32int *arg) +sysbind(uint32 *arg) { return bindmount(0, -1, -1, uvalidaddr(arg[0], 1, 0), uvalidaddr(arg[1], 1, 0), arg[2], nil); } long -sysmount(u32int *arg) +sysmount(uint32 *arg) { return bindmount(1, arg[0], arg[1], nil, uvalidaddr(arg[2], 1, 0), arg[3], uvalidaddr(arg[4], 1, 0)); } long -sys_mount(u32int *arg) +sys_mount(uint32 *arg) { return bindmount(1, arg[0], -1, nil, uvalidaddr(arg[1], 1, 0), arg[2], uvalidaddr(arg[3], 1, 0)); } long -sysunmount(u32int *arg) +sysunmount(uint32 *arg) { Chan *cmount, *cmounted; char *mount, *mounted; @@ -1128,7 +1128,7 @@ sysunmount(u32int *arg) } long -syscreate(u32int *arg) +syscreate(uint32 *arg) { int fd; Chan *c = 0; @@ -1150,7 +1150,7 @@ syscreate(u32int *arg) } long -sysremove(u32int *arg) +sysremove(uint32 *arg) { Chan *c; char *name; @@ -1207,7 +1207,7 @@ wstat(Chan *c, uchar *d, int nd) } long -syswstat(u32int *arg) +syswstat(uint32 *arg) { Chan *c; uint l; @@ -1223,7 +1223,7 @@ syswstat(u32int *arg) } long -sysfwstat(u32int *arg) +sysfwstat(uint32 *arg) { Chan *c; uint l; @@ -1271,7 +1271,7 @@ packoldstat(uchar *buf, Dir *d) } long -sys_stat(u32int *arg) +sys_stat(uint32 *arg) { Chan *c; uint l; @@ -1306,7 +1306,7 @@ sys_stat(u32int *arg) } long -sys_fstat(u32int *arg) +sys_fstat(uint32 *arg) { Chan *c; char *name; @@ -1341,14 +1341,14 @@ sys_fstat(u32int *arg) } long -sys_wstat(u32int *u) +sys_wstat(uint32 *u) { error("old wstat system call - recompile"); return -1; } long -sys_fwstat(u32int *u) +sys_fwstat(uint32 *u) { error("old fwstat system call - recompile"); return -1; @@ -1362,7 +1362,7 @@ kbind(char *new, char *old, int flag) } long -syspassfd(u32int *u) +syspassfd(uint32 *u) { error("passfd unimplemented"); return -1; diff --git a/src/9vx/a/sysproc.c b/src/9vx/a/sysproc.c @@ -15,14 +15,14 @@ extern void checkpages(void); extern void checkpagerefs(void); long -sysr1(u32int *x) +sysr1(uint32 *x) { vx32sysr1(); return 0; } long -sysrfork(u32int *arg) +sysrfork(uint32 *arg) { Proc *p; int n, i; @@ -205,8 +205,8 @@ sysrfork(u32int *arg) return pid; } -static u32int -l2be(u32int l) +static uint32 +l2be(uint32 l) { uchar *cp; @@ -217,7 +217,7 @@ l2be(u32int l) static char Echanged[] = "exec arguments changed underfoot"; long -sysexec(u32int *arg) +sysexec(uint32 *arg) { char *volatile elem, *volatile file, *ufile; Chan *volatile tc; @@ -238,12 +238,10 @@ sysexec(u32int *arg) nexterror(); } -iprint("sysexec %p %p\n", (void*)arg[0], (void*)arg[1]); ufile = uvalidaddr(arg[0], 1, 0); file = validnamedup(ufile, 1); tc = namec(file, Aopen, OEXEC, 0); kstrdup((char**)&elem, up->genbuf); -iprint("sysexec %s %p\n", file, (void*)arg[1]); /* * Read the header. If it's a #!, fill in progarg[] with info and repeat. @@ -285,7 +283,7 @@ iprint("sysexec %s %p\n", file, (void*)arg[1]); /* * #! has had its chance, now we need a real binary */ - u32int magic, entry, text, etext, data, edata, bss, ebss; + uint32 magic, entry, text, etext, data, edata, bss, ebss; magic = l2be(exec.magic); if(n != sizeof(Exec) || l2be(exec.magic) != AOUT_MAGIC) @@ -317,7 +315,7 @@ iprint("sysexec %s %p\n", file, (void*)arg[1]); * Pass 1: count number of arguments, string bytes. */ int nargv, strbytes; - u32int argp, ssize, spage; + uint32 argp, ssize, spage; strbytes = 0; for(i=0; i<nprogarg; i++) @@ -325,11 +323,10 @@ iprint("sysexec %s %p\n", file, (void*)arg[1]); argp = arg[1]; for(nargv=0;; nargv++, argp += BY2WD){ - u32int a; + uint32 a; char *str; - a = *(u32int*)uvalidaddr(argp, BY2WD, 0); -iprint("a%d = %p = %p\n", nargv, (void*)argp, (void*)a); + a = *(uint32*)uvalidaddr(argp, BY2WD, 0); if(a == 0) break; str = uvalidaddr(a, 1, 0); @@ -385,7 +382,7 @@ iprint("a%d = %p = %p\n", nargv, (void*)argp, (void*)a); uchar *uzero; uzero = up->pmmu.uzero; Tos *tos; - u32int utos; + uint32 utos; utos = USTKTOP - sizeof(Tos); tos = (Tos*)(uzero + utos + TSTKTOP - USTKTOP); tos->cyclefreq = m->cyclefreq; @@ -398,15 +395,15 @@ iprint("a%d = %p = %p\n", nargv, (void*)argp, (void*)a); * Argument pointers and strings, together. */ char *bp, *ep; - u32int *targp; - u32int ustrp, uargp; + uint32 *targp; + uint32 ustrp, uargp; ustrp = utos - ROUND(strbytes, BY2WD); uargp = ustrp - BY2WD*((nprogarg+nargv)+1); bp = (char*)(uzero + ustrp + TSTKTOP - USTKTOP); ep = bp + strbytes; p = bp; - targp = (u32int*)(uzero + uargp + TSTKTOP - USTKTOP); + targp = (uint32*)(uzero + uargp + TSTKTOP - USTKTOP); /* #! args are trusted */ for(i=0; i<nprogarg; i++){ @@ -422,10 +419,10 @@ iprint("a%d = %p = %p\n", nargv, (void*)argp, (void*)a); /* the rest are not */ argp = arg[1]; for(i=0; i<nargv; i++){ - u32int a; + uint32 a; char *str; - a = *(u32int*)uvalidaddr(argp, BY2WD, 0); + a = *(uint32*)uvalidaddr(argp, BY2WD, 0); argp += BY2WD; str = uvalidaddr(a, 1, 0); @@ -438,7 +435,7 @@ iprint("a%d = %p = %p\n", nargv, (void*)argp, (void*)a); ustrp += n; } - if(*(u32int*)uvalidaddr(argp, BY2WD, 0) != 0) + if(*(uint32*)uvalidaddr(argp, BY2WD, 0) != 0) error(Echanged); *targp = 0; @@ -606,7 +603,7 @@ return0(void *v) } long -syssleep(u32int *arg) +syssleep(uint32 *arg) { int n; @@ -623,13 +620,13 @@ syssleep(u32int *arg) } long -sysalarm(u32int *arg) +sysalarm(uint32 *arg) { return procalarm(arg[0]); } long -sysexits(u32int *arg) +sysexits(uint32 *arg) { char *status; char *inval = "invalid exit string"; @@ -654,7 +651,7 @@ sysexits(u32int *arg) } long -sys_wait(u32int *arg) +sys_wait(uint32 *arg) { int pid; Waitmsg w; @@ -678,12 +675,12 @@ sys_wait(u32int *arg) } long -sysawait(u32int *arg) +sysawait(uint32 *arg) { int i; int pid; Waitmsg w; - u32int n; + uint32 n; char *buf; n = arg[1]; @@ -713,7 +710,7 @@ werrstr(char *fmt, ...) } static long -generrstr(u32int addr, uint nbuf) +generrstr(uint32 addr, uint nbuf) { char tmp[ERRMAX]; char *buf; @@ -734,20 +731,20 @@ generrstr(u32int addr, uint nbuf) } long -syserrstr(u32int *arg) +syserrstr(uint32 *arg) { return generrstr(arg[0], arg[1]); } /* compatibility for old binaries */ long -sys_errstr(u32int *arg) +sys_errstr(uint32 *arg) { return generrstr(arg[0], 64); } long -sysnotify(u32int *arg) +sysnotify(uint32 *arg) { if(arg[0] != 0) uvalidaddr(arg[0], 1, 0); @@ -756,7 +753,7 @@ sysnotify(u32int *arg) } long -sysnoted(u32int *arg) +sysnoted(uint32 *arg) { if(arg[0]!=NRSTR && !up->notified) error(Egreg); @@ -764,10 +761,10 @@ sysnoted(u32int *arg) } long -syssegbrk(u32int *arg) +syssegbrk(uint32 *arg) { int i; - u32int addr; + uint32 addr; Segment *s; addr = arg[0]; @@ -790,16 +787,16 @@ syssegbrk(u32int *arg) } long -syssegattach(u32int *arg) +syssegattach(uint32 *arg) { return segattach(up, arg[0], uvalidaddr(arg[1], 1, 0), arg[2], arg[3]); } long -syssegdetach(u32int *arg) +syssegdetach(uint32 *arg) { int i; - u32int addr; + uint32 addr; Segment *s; qlock(&up->seglock); @@ -841,10 +838,10 @@ found: } long -syssegfree(u32int *arg) +syssegfree(uint32 *arg) { Segment *s; - u32int from, to; + uint32 from, to; from = arg[0]; s = seg(up, from, 1); @@ -867,13 +864,13 @@ syssegfree(u32int *arg) /* For binary compatibility */ long -sysbrk_(u32int *arg) +sysbrk_(uint32 *arg) { return ibrk(arg[0], BSEG); } long -sysrendezvous(u32int *arg) +sysrendezvous(uint32 *arg) { uintptr tag, val; Proc *p, **l; @@ -1106,7 +1103,7 @@ semacquire(Segment *s, long *addr, int block) } long -syssemacquire(u32int *arg) +syssemacquire(uint32 *arg) { int block; long *addr; @@ -1124,7 +1121,7 @@ syssemacquire(u32int *arg) } long -syssemrelease(u32int *arg) +syssemrelease(uint32 *arg) { long *addr, delta; Segment *s; diff --git a/src/9vx/a/systab.h b/src/9vx/a/systab.h @@ -1,6 +1,6 @@ #include "sys.h" -typedef long Syscall(u32int*); +typedef long Syscall(uint32*); Syscall sysr1; Syscall sys_errstr; diff --git a/src/9vx/a/ureg.h b/src/9vx/a/ureg.h @@ -1,25 +1,25 @@ struct Ureg { - u32int di; /* general registers */ - u32int si; /* ... */ - u32int bp; /* ... */ - u32int nsp; - u32int bx; /* ... */ - u32int dx; /* ... */ - u32int cx; /* ... */ - u32int ax; /* ... */ - u32int gs; /* data segments */ - u32int fs; /* ... */ - u32int es; /* ... */ - u32int ds; /* ... */ - u32int trap; /* trap type */ - u32int ecode; /* error code (or zero) */ - u32int pc; /* pc */ - u32int cs; /* old context */ - u32int 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 { - u32int usp; - u32int sp; + uint32 usp; + uint32 sp; }; - u32int ss; /* old stack segment */ + uint32 ss; /* old stack segment */ }; diff --git a/src/9vx/data2s.c b/src/9vx/data2s.c @@ -36,6 +36,6 @@ main(int argc, char *argv[]) printf("\n"); } printf("\n\n.p2align 2\n%s%slen:\n", prefix, argv[1]); - printf(".long %d\n", len); + printf(".long %d\n", (int)len); return 0; } diff --git a/src/9vx/devaudio.c b/src/9vx/devaudio.c @@ -351,9 +351,9 @@ audiowrite(Chan *c, void *vp, long n, vlong off) void audioswab(uchar *a, uint n) { - u32int *p, *ep, b; + uint32 *p, *ep, b; - p = (u32int*)a; + p = (uint32*)a; ep = p + (n>>2); while(p < ep) { b = *p; diff --git a/src/9vx/label.S b/src/9vx/label.S @@ -57,7 +57,6 @@ EXT(setlabel): movq %r13, 56(%rdi) movq %r14, 64(%rdi) movq %r15, 72(%rdi) - movq $0, %rax ret @@ -72,8 +71,8 @@ EXT(gotolabel): movq 56(%rdi), %r13 movq 64(%rdi), %r14 movq 72(%rdi), %r15 - movq $1, %rax + cld ret #endif diff --git a/src/9vx/libdraw/bytesperline.c b/src/9vx/libdraw/bytesperline.c @@ -24,7 +24,7 @@ unitsperline(Rectangle r, int d, int bitsperunit) int wordsperline(Rectangle r, int d) { - return unitsperline(r, d, 8*sizeof(u32int)); + return unitsperline(r, d, 8*sizeof(uint32)); } int diff --git a/src/9vx/libmemdraw/alloc.c b/src/9vx/libmemdraw/alloc.c @@ -18,14 +18,14 @@ memimagemove(void *from, void *to) md->base = to; /* if allocmemimage changes this must change too */ - md->bdata = (uchar*)md->base+sizeof(Memdata*)+sizeof(u32int); + md->bdata = (uchar*)md->base+sizeof(Memdata*)+sizeof(uint32); } Memimage* -allocmemimaged(Rectangle r, u32int chan, Memdata *md, void *X) +allocmemimaged(Rectangle r, uint32 chan, Memdata *md, void *X) { int d; - u32int l; + uint32 l; Memimage *i; if(Dx(r) <= 0 || Dy(r) <= 0){ @@ -45,7 +45,7 @@ allocmemimaged(Rectangle r, u32int chan, Memdata *md, void *X) i->data = md; i->x = X; - i->zero = sizeof(u32int)*l*r.min.y; + i->zero = sizeof(uint32)*l*r.min.y; if(r.min.x >= 0) i->zero += (r.min.x*d)/8; @@ -66,11 +66,11 @@ allocmemimaged(Rectangle r, u32int chan, Memdata *md, void *X) } Memimage* -_allocmemimage(Rectangle r, u32int chan) +_allocmemimage(Rectangle r, uint32 chan) { int d; uchar *p; - u32int l, nw; + uint32 l, nw; Memdata *md; Memimage *i; @@ -86,7 +86,7 @@ _allocmemimage(Rectangle r, u32int chan) return nil; md->ref = 1; - md->base = poolalloc(imagmem, sizeof(Memdata*)+(1+nw)*sizeof(u32int)); + md->base = poolalloc(imagmem, sizeof(Memdata*)+(1+nw)*sizeof(uint32)); if(md->base == nil){ free(md); return nil; @@ -96,8 +96,8 @@ _allocmemimage(Rectangle r, u32int chan) *(Memdata**)p = md; p += sizeof(Memdata*); - *(u32int*)p = getcallerpc(&r); - p += sizeof(u32int); + *(uint32*)p = getcallerpc(&r); + p += sizeof(uint32); /* if this changes, memimagemove must change too */ md->bdata = p; @@ -129,10 +129,10 @@ _freememimage(Memimage *i) /* * Wordaddr is deprecated. */ -u32int* +uint32* wordaddr(Memimage *i, Point p) { - return (u32int*) ((uintptr)byteaddr(i, p) & ~(sizeof(u32int)-1)); + return (uint32*) ((uintptr)byteaddr(i, p) & ~(sizeof(uint32)-1)); } uchar* @@ -140,7 +140,7 @@ byteaddr(Memimage *i, Point p) { uchar *a; - a = i->data->bdata+i->zero+sizeof(u32int)*p.y*i->width; + a = i->data->bdata+i->zero+sizeof(uint32)*p.y*i->width; if(i->depth < 8){ /* @@ -159,11 +159,11 @@ byteaddr(Memimage *i, Point p) } int -memsetchan(Memimage *i, u32int chan) +memsetchan(Memimage *i, uint32 chan) { int d; int t, j, k; - u32int cc; + uint32 cc; int bytes; if((d = chantodepth(chan)) == 0) { diff --git a/src/9vx/libmemdraw/defont.c b/src/9vx/libmemdraw/defont.c @@ -18,7 +18,7 @@ getmemdefont(void) /* * make sure data is word-aligned. this is true with Plan 9 compilers * but not in general. the byte order is right because the data is - * declared as char*, not u32int*. + * declared as char*, not uint32*. */ p = (char*)defontdata; n = (uintptr)p & 3; @@ -49,7 +49,7 @@ getmemdefont(void) return nil; } - hdr = p+Dy(r)*i->width*sizeof(u32int); + hdr = p+Dy(r)*i->width*sizeof(uint32); n = atoi(hdr); p = hdr+3*12; fc = malloc(sizeof(Fontchar)*(n+1)); diff --git a/src/9vx/libmemdraw/draw.c b/src/9vx/libmemdraw/draw.c @@ -386,7 +386,7 @@ struct Buffer { uchar *blu; uchar *alpha; uchar *grey; - u32int *rgba; + uint32 *rgba; int delta; /* number of bytes to add to pointer to get next pixel to the right */ /* used by boolcalc* for mask data */ @@ -428,7 +428,7 @@ struct Param { int replcache; /* if set, cache buffers */ Buffer bcache[MAXBCACHE]; - u32int bfilled; + uint32 bfilled; uchar *bufbase; int bufoff; int bufdelta; @@ -531,7 +531,7 @@ getparam(Param *p, Memimage *img, Rectangle r, int convgrey, int needbuf, int *n p->bytey0s = byteaddr(img, Pt(img->r.min.x, img->r.min.y)); p->bytermin = byteaddr(img, Pt(r.min.x, img->r.min.y)); p->bytey0e = byteaddr(img, Pt(img->r.max.x, img->r.min.y)); - p->bwidth = sizeof(u32int)*img->width; + p->bwidth = sizeof(uint32)*img->width; assert(p->bytey0s <= p->bytermin && p->bytermin <= p->bytey0e); @@ -809,7 +809,7 @@ alphacalc14(Buffer bdst, Buffer bsrc, Buffer bmask, int dx, int grey, int op) Buffer obdst; int fd, sadelta; int i, sa, ma, q; - u32int s, t; + uint32 s, t; obdst = bdst; sadelta = bsrc.alpha == &ones ? 0 : bsrc.delta; @@ -861,7 +861,7 @@ alphacalc2810(Buffer bdst, Buffer bsrc, Buffer bmask, int dx, int grey, int op) Buffer obdst; int fs, sadelta; int i, ma, da, q; - u32int s, t; + uint32 s, t; obdst = bdst; sadelta = bsrc.alpha == &ones ? 0 : bsrc.delta; @@ -915,7 +915,7 @@ alphacalc3679(Buffer bdst, Buffer bsrc, Buffer bmask, int dx, int grey, int op) Buffer obdst; int fs, fd, sadelta; int i, sa, ma, da, q; - u32int s, t, u, v; + uint32 s, t, u, v; obdst = bdst; sadelta = bsrc.alpha == &ones ? 0 : bsrc.delta; @@ -988,7 +988,7 @@ alphacalc11(Buffer bdst, Buffer bsrc, Buffer bmask, int dx, int grey, int op) Buffer obdst; int fd, sadelta; int i, sa, ma, q; - u32int s, t, u, v; + uint32 s, t, u, v; USED(op); obdst = bdst; @@ -1080,7 +1080,7 @@ alphacalcS(Buffer bdst, Buffer bsrc, Buffer bmask, int dx, int grey, int op) Buffer obdst; int fd; int i, ma; - u32int s, t; + uint32 s, t; USED(op); obdst = bdst; @@ -1154,7 +1154,7 @@ boolcalc236789(Buffer bdst, Buffer bsrc, Buffer bmask, int dx, int grey, int op) Buffer obdst; int fs, fd; int i, ma, da, zero; - u32int s, t; + uint32 s, t; obdst = bdst; zero = !(op&1); @@ -1289,7 +1289,7 @@ readnbit(Param *p, uchar *buf, int y) memset(&b, 0, sizeof b); // shut up gcc int i, n, sh, depth, x, dx, npack, nbits; - b.rgba = (u32int*)buf; + b.rgba = (uint32*)buf; b.grey = w = buf; b.red = b.blu = b.grn = w; b.alpha = &ones; @@ -1379,7 +1379,7 @@ static void writenbit(Param *p, uchar *w, Buffer src) { uchar *r; - u32int bits; + uint32 bits; int i, sh, depth, npack, nbits, x, ex; assert(src.grey != nil && src.delta == 1); @@ -1468,7 +1468,7 @@ readcmap(Param *p, uchar *buf, int y) } } - b.rgba = (u32int*)(buf-copyalpha); + b.rgba = (uint32*)(buf-copyalpha); if(convgrey){ b.grey = buf; @@ -1511,7 +1511,7 @@ readbyte(Param *p, uchar *buf, int y) int dx, isgrey, convgrey, alphaonly, copyalpha, i, nb; uchar *begin, *end, *r, *w, *rrepl, *grepl, *brepl, *arepl, *krepl; uchar ured, ugrn, ublu; - u32int u; + uint32 u; img = p->img; begin = p->bytey0s + y*p->bwidth; @@ -1535,7 +1535,7 @@ DBG print("copyalpha %d alphaonly %d convgrey %d isgrey %d\n", copyalpha, alphao memmove(buf, r, dx*nb); r = buf; } - b.rgba = (u32int*)r; + b.rgba = (uint32*)r; if(copyalpha) b.alpha = r+img->shift[CAlpha]/8; else @@ -1588,7 +1588,7 @@ DBG print("%x\n", w[-1]); } b.alpha = copyalpha ? buf : &ones; - b.rgba = (u32int*)buf; + b.rgba = (uint32*)buf; if(alphaonly){ b.red = b.grn = b.blu = b.grey = nil; if(!copyalpha) @@ -1617,7 +1617,7 @@ writebyte(Param *p, uchar *w, Buffer src) Memimage *img; int i, isalpha, isgrey, nb, delta, dx, adelta; uchar ff, *red, *grn, *blu, *grey, *alpha; - u32int u, mask; + uint32 u, mask; img = p->img; @@ -1722,7 +1722,7 @@ readptr(Param *p, uchar *s, int y) q = p->bytermin + y*p->bwidth; b.red = q; /* ptr to data */ b.grn = b.blu = b.grey = b.alpha = nil; - b.rgba = (u32int*)q; + b.rgba = (uint32*)q; b.delta = p->img->depth/8; return b; } @@ -1802,13 +1802,13 @@ static Buffer boolcopy32(Buffer bdst, Buffer bsrc, Buffer bmask, int dx, int i, int o) { uchar *m; - u32int *r, *w, *ew; + uint32 *r, *w, *ew; USED(i); USED(o); m = bmask.grey; - w = (u32int*)bdst.red; - r = (u32int*)bsrc.red; + w = (uint32*)bdst.red; + r = (uint32*)bsrc.red; ew = w+dx; for(; w < ew; w++,r++) if(*m++) @@ -1840,7 +1840,7 @@ genconv(Param *p, uchar *buf, int y) b.red = buf; b.blu = b.grn = b.grey = b.alpha = nil; - b.rgba = (u32int*)buf; + b.rgba = (uint32*)buf; b.delta = 0; return b; @@ -1877,11 +1877,11 @@ convfn(Memimage *dst, Param *dpar, Memimage *src, Param *spar, int *ndrawbuf) return genconv; } -u32int +uint32 _pixelbits(Memimage *i, Point pt) { uchar *p; - u32int val; + uint32 val; int off, bpp, npack; val = 0; @@ -1964,9 +1964,9 @@ memsets(void *vp, ushort val, int n) } static void -memsetl(void *vp, u32int val, int n) +memsetl(void *vp, uint32 val, int n) { - u32int *p, *ep; + uint32 *p, *ep; p = vp; ep = p+n; @@ -1975,7 +1975,7 @@ memsetl(void *vp, u32int val, int n) } static void -memset24(void *vp, u32int val, int n) +memset24(void *vp, uint32 val, int n) { uchar *p, *ep; uchar a,b,c; @@ -1992,12 +1992,12 @@ memset24(void *vp, u32int val, int n) } } -u32int -_imgtorgba(Memimage *img, u32int val) +uint32 +_imgtorgba(Memimage *img, uint32 val) { uchar r, g, b, a; int nb, ov, v; - u32int chan; + uint32 chan; uchar *p; a = 0xFF; @@ -2040,12 +2040,12 @@ _imgtorgba(Memimage *img, u32int val) return (r<<24)|(g<<16)|(b<<8)|a; } -u32int -_rgbatoimg(Memimage *img, u32int rgba) +uint32 +_rgbatoimg(Memimage *img, uint32 rgba) { - u32int chan; + uint32 chan; int d, nb; - u32int v; + uint32 v; uchar *p, r, g, b, a, m; v = 0; @@ -2090,7 +2090,7 @@ static int memoptdraw(Memdrawparam *par) { int m, y, dy, dx, op; - u32int v; + uint32 v; Memimage *src; Memimage *dst; @@ -2112,7 +2112,7 @@ DBG print("state %lux mval %lux dd %d\n", par->state, par->mval, dst->depth); uchar lm, rm; DBG print("memopt, dst %p, dst->data->bdata %p\n", dst, dst->data->bdata); - dwid = dst->width*sizeof(u32int); + dwid = dst->width*sizeof(uint32); dp = byteaddr(dst, par->r.min); v = par->sdval; DBG print("sdval %lud, depth %d\n", v, dst->depth); @@ -2195,7 +2195,7 @@ DBG print("dp=%p; dx=%d; for(y=0; y<%d; y++, dp+=%d)\nmemsets(dp, v, dx);\n", p[1] = v>>8; p[2] = v>>16; p[3] = v>>24; - v = *(u32int*)p; + v = *(uint32*)p; for(y=0; y<dy; y++, dp+=dwid) memsetl(dp, v, dx); return 1; @@ -2221,8 +2221,8 @@ DBG print("dp=%p; dx=%d; for(y=0; y<%d; y++, dp+=%d)\nmemsets(dp, v, dx);\n", else dir = 1; - swid = src->width*sizeof(u32int); - dwid = dst->width*sizeof(u32int); + swid = src->width*sizeof(uint32); + dwid = dst->width*sizeof(uint32); sp = byteaddr(src, par->sr.min); dp = byteaddr(dst, par->r.min); if(dir == -1){ @@ -2253,9 +2253,9 @@ DBG print("dp=%p; dx=%d; for(y=0; y<%d; y++, dp+=%d)\nmemsets(dp, v, dx);\n", sp = byteaddr(src, par->sr.min); dp = byteaddr(dst, par->r.min); mp = byteaddr(par->mask, par->mr.min); - swid = src->width*sizeof(u32int); - dwid = dst->width*sizeof(u32int); - mwid = par->mask->width*sizeof(u32int); + swid = src->width*sizeof(uint32); + dwid = dst->width*sizeof(uint32); + mwid = par->mask->width*sizeof(uint32); if(src->data == dst->data && byteaddr(dst, par->r.min) > byteaddr(src, par->sr.min)){ dir = -1; @@ -2344,12 +2344,12 @@ DBG print("dp=%p; dx=%d; for(y=0; y<%d; y++, dp+=%d)\nmemsets(dp, v, dx);\n", static int chardraw(Memdrawparam *par) { - u32int bits; + uint32 bits; int i, ddepth, dy, dx, x, bx, ex, y, npack, bsh, depth, op; - u32int v, maskwid, dstwid; + uint32 v, maskwid, dstwid; uchar *wp, *rp, *q, *wc; ushort *ws; - u32int *wl; + uint32 *wl; uchar sp[4]; Rectangle r, mr; Memimage *mask, *src, *dst; @@ -2373,13 +2373,13 @@ if(0) if(drawdebug) iprint("chardraw? mf %lux md %d sf %lux dxs %d dys %d dd %d //if(drawdebug) iprint("chardraw..."); depth = mask->depth; - maskwid = mask->width*sizeof(u32int); + maskwid = mask->width*sizeof(uint32); rp = byteaddr(mask, mr.min); npack = 8/depth; bsh = (mr.min.x % npack) * depth; wp = byteaddr(dst, r.min); - dstwid = dst->width*sizeof(u32int); + dstwid = dst->width*sizeof(uint32); DBG print("bsh %d\n", bsh); dy = Dy(r); dx = Dx(r); @@ -2451,8 +2451,8 @@ DBG print("bits %lux sh %d...", bits, i); } break; case 32: - wl = (u32int*)wp; - v = *(u32int*)sp; + wl = (uint32*)wp; + v = *(uint32*)sp; for(x=bx; x>ex; x--, wl++){ i = x&7; if(i == 8-1) @@ -2477,7 +2477,7 @@ DBG print("\n"); * * This code is just plain wrong for >8bpp. * -u32int +uint32 membyteval(Memimage *src) { int i, val, bpp; @@ -2497,9 +2497,9 @@ membyteval(Memimage *src) */ void -_memfillcolor(Memimage *i, u32int val) +_memfillcolor(Memimage *i, uint32 val) { - u32int bits; + uint32 bits; int d, y; if(val == DNofill) diff --git a/src/9vx/libmemdraw/fillpoly.c b/src/9vx/libmemdraw/fillpoly.c @@ -127,7 +127,7 @@ mod(long x, long y) long z; z = x%y; - if((long)(((u32int)z)^((u32int)y)) > 0 || z == 0) + if((long)(((uint32)z)^((uint32)y)) > 0 || z == 0) return z; return z + y; } @@ -135,7 +135,7 @@ mod(long x, long y) static long sdiv(long x, long y) { - if((long)(((u32int)x)^((u32int)y)) >= 0 || x == 0) + if((long)(((uint32)x)^((uint32)y)) >= 0 || x == 0) return x/y; return (x+((y>>30)|1))/y-1; diff --git a/src/9vx/libmemdraw/line.c b/src/9vx/libmemdraw/line.c @@ -50,7 +50,7 @@ horline1(Memimage *dst, Point p0, Point p1, int srcval, Rectangle clipr) deltax = p1.x - p0.x; deltay = p1.y - p0.y; - dd = dst->width*sizeof(u32int); + dd = dst->width*sizeof(uint32); dy = 1; if(deltay < 0){ dd = -dd; @@ -117,7 +117,7 @@ verline1(Memimage *dst, Point p0, Point p1, int srcval, Rectangle clipr) e += deltay; }else e += deltax; - d += dst->width*sizeof(u32int); + d += dst->width*sizeof(uint32); m >>= bpp; if(m == 0) m = m0; diff --git a/src/9vx/libmemdraw/load.c b/src/9vx/libmemdraw/load.c @@ -26,7 +26,7 @@ _loadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata) m ^= 0xFF >> rpart; for(y=r.min.y; y<r.max.y; y++){ *q ^= (*data^*q) & m; - q += i->width*sizeof(u32int); + q += i->width*sizeof(uint32); data++; } return ndata; @@ -34,7 +34,7 @@ _loadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata) if(lpart==0 && rpart==0){ /* easy case */ for(y=r.min.y; y<r.max.y; y++){ memmove(q, data, l); - q += i->width*sizeof(u32int); + q += i->width*sizeof(uint32); data += l; } return ndata; @@ -45,7 +45,7 @@ _loadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata) *q ^= (*data^*q) & m; if(l > 1) memmove(q+1, data+1, l-1); - q += i->width*sizeof(u32int); + q += i->width*sizeof(uint32); data += l; } return ndata; @@ -55,7 +55,7 @@ _loadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata) if(l > 1) memmove(q, data, l-1); q[l-1] ^= (data[l-1]^q[l-1]) & mr; - q += i->width*sizeof(u32int); + q += i->width*sizeof(uint32); data += l; } return ndata; @@ -65,7 +65,7 @@ _loadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata) if(l > 2) memmove(q+1, data+1, l-2); q[l-1] ^= (data[l-1]^q[l-1]) & mr; - q += i->width*sizeof(u32int); + q += i->width*sizeof(uint32); data += l; } return ndata; diff --git a/src/9vx/libmemdraw/unload.c b/src/9vx/libmemdraw/unload.c @@ -18,7 +18,7 @@ _unloadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata) q = byteaddr(i, r.min); for(y=r.min.y; y<r.max.y; y++){ memmove(data, q, l); - q += i->width*sizeof(u32int); + q += i->width*sizeof(uint32); data += l; } return ndata; diff --git a/src/9vx/libsec/des.c b/src/9vx/libsec/des.c @@ -4,7 +4,7 @@ /* * integrated sbox & p perm */ -static u32int spbox[] = { +static uint32 spbox[] = { 0x00808200,0x00000000,0x00008000,0x00808202,0x00808002,0x00008202,0x00000002,0x00008000, 0x00000200,0x00808200,0x00808202,0x00000200,0x00800202,0x00808002,0x00800000,0x00000002, @@ -81,7 +81,7 @@ static u32int spbox[] = { /* * for manual index calculation - * #define fetch(box, i, sh) (*((u32int*)((uchar*)spbox + (box << 8) + ((i >> (sh)) & 0xfc)))) + * #define fetch(box, i, sh) (*((uint32*)((uchar*)spbox + (box << 8) + ((i >> (sh)) & 0xfc)))) */ #define fetch(box, i, sh) ((spbox+(box << 6))[((i >> (sh + 2)) & 0x3f)]) @@ -91,14 +91,14 @@ static u32int spbox[] = { void block_cipher(ulong key[32], uchar text[8], int decrypting) { - u32int right, left, v0, v1; + uint32 right, left, v0, v1; int i, keystep; /* * initial permutation */ - v0 = text[0] | ((u32int)text[2]<<8) | ((u32int)text[4]<<16) | ((u32int)text[6]<<24); - left = text[1] | ((u32int)text[3]<<8) | ((u32int)text[5]<<16) | ((u32int)text[7]<<24); + v0 = text[0] | ((uint32)text[2]<<8) | ((uint32)text[4]<<16) | ((uint32)text[6]<<24); + left = text[1] | ((uint32)text[3]<<8) | ((uint32)text[5]<<16) | ((uint32)text[7]<<24); right = (left & 0xaaaaaaaa) | ((v0 >> 1) & 0x55555555); left = ((left << 1) & 0xaaaaaaaa) | (v0 & 0x55555555); left = ((left << 6) & 0x33003300) @@ -183,14 +183,14 @@ void triple_block_cipher(ulong expanded_key[3][32], uchar text[8], int ende) { ulong *key; - u32int right, left, v0, v1; + uint32 right, left, v0, v1; int i, j, keystep; /* * initial permutation */ - v0 = text[0] | ((u32int)text[2]<<8) | ((u32int)text[4]<<16) | ((u32int)text[6]<<24); - left = text[1] | ((u32int)text[3]<<8) | ((u32int)text[5]<<16) | ((u32int)text[7]<<24); + v0 = text[0] | ((uint32)text[2]<<8) | ((uint32)text[4]<<16) | ((uint32)text[6]<<24); + left = text[1] | ((uint32)text[3]<<8) | ((uint32)text[5]<<16) | ((uint32)text[7]<<24); right = (left & 0xaaaaaaaa) | ((v0 >> 1) & 0x55555555); left = ((left << 1) & 0xaaaaaaaa) | (v0 & 0x55555555); left = ((left << 6) & 0x33003300) @@ -281,7 +281,7 @@ triple_block_cipher(ulong expanded_key[3][32], uchar text[8], int ende) /* * key compression permutation, 4 bits at a time */ -static u32int comptab[] = { +static uint32 comptab[] = { 0x000000,0x010000,0x000008,0x010008,0x000080,0x010080,0x000088,0x010088, 0x000000,0x010000,0x000008,0x010008,0x000080,0x010080,0x000088,0x010088, @@ -332,9 +332,9 @@ static int keysh[] = }; static void -keycompperm(u32int left, u32int right, ulong *ek) +keycompperm(uint32 left, uint32 right, ulong *ek) { - u32int v0, v1; + uint32 v0, v1; int i; for(i = 0; i < 16; i++){ @@ -371,10 +371,10 @@ keycompperm(u32int left, u32int right, ulong *ek) void des_key_setup(uchar key[8], ulong *ek) { - u32int left, right, v0, v1; + uint32 left, right, v0, v1; - v0 = key[0] | ((u32int)key[2] << 8) | ((u32int)key[4] << 16) | ((u32int)key[6] << 24); - v1 = key[1] | ((u32int)key[3] << 8) | ((u32int)key[5] << 16) | ((u32int)key[7] << 24); + v0 = key[0] | ((uint32)key[2] << 8) | ((uint32)key[4] << 16) | ((uint32)key[6] << 24); + v1 = key[1] | ((uint32)key[3] << 8) | ((uint32)key[5] << 16) | ((uint32)key[7] << 24); left = ((v0 >> 1) & 0x40404040) | ((v0 >> 2) & 0x10101010) | ((v0 >> 3) & 0x04040404) @@ -433,10 +433,10 @@ static uchar parity[128] = void des56to64(uchar *k56, uchar *k64) { - u32int hi, lo; + uint32 hi, lo; - hi = ((u32int)k56[0]<<24)|((u32int)k56[1]<<16)|((u32int)k56[2]<<8)|k56[3]; - lo = ((u32int)k56[4]<<24)|((u32int)k56[5]<<16)|((u32int)k56[6]<<8); + hi = ((uint32)k56[0]<<24)|((uint32)k56[1]<<16)|((uint32)k56[2]<<8)|k56[3]; + lo = ((uint32)k56[4]<<24)|((uint32)k56[5]<<16)|((uint32)k56[6]<<8); k64[0] = parity[(hi>>25)&0x7f]; k64[1] = parity[(hi>>18)&0x7f]; @@ -454,12 +454,12 @@ des56to64(uchar *k56, uchar *k64) void des64to56(uchar *k64, uchar *k56) { - u32int hi, lo; + uint32 hi, lo; - hi = (((u32int)k64[0]&0xfe)<<24)|(((u32int)k64[1]&0xfe)<<17)|(((u32int)k64[2]&0xfe)<<10) + hi = (((uint32)k64[0]&0xfe)<<24)|(((uint32)k64[1]&0xfe)<<17)|(((uint32)k64[2]&0xfe)<<10) |((k64[3]&0xfe)<<3)|(k64[4]>>4); - lo = (((u32int)k64[4]&0xfe)<<28)|(((u32int)k64[5]&0xfe)<<21)|(((u32int)k64[6]&0xfe)<<14) - |(((u32int)k64[7]&0xfe)<<7); + lo = (((uint32)k64[4]&0xfe)<<28)|(((uint32)k64[5]&0xfe)<<21)|(((uint32)k64[6]&0xfe)<<14) + |(((uint32)k64[7]&0xfe)<<7); k56[0] = hi>>24; k56[1] = hi>>16; diff --git a/src/9vx/libsec/md4.c b/src/9vx/libsec/md4.c @@ -91,17 +91,17 @@ static MD4Table tab[] = { 15, S34}, }; -static void encode(uchar*, u32int*, ulong); -static void decode(u32int*, uchar*, ulong); +static void encode(uchar*, uint32*, ulong); +static void decode(uint32*, uchar*, ulong); static void md4block(uchar *p, ulong len, MD4state *s) { int i; - u32int a, b, c, d, tmp; + uint32 a, b, c, d, tmp; MD4Table *t; uchar *end; - u32int x[16]; + uint32 x[16]; for(end = p+len; p < end; p += 64){ a = s->state[0]; @@ -147,7 +147,7 @@ md4block(uchar *p, ulong len, MD4state *s) MD4state* md4(uchar *p, ulong len, uchar *digest, MD4state *s) { - u32int x[16]; + uint32 x[16]; uchar buf[128]; int i; uchar *e; @@ -238,13 +238,13 @@ md4(uchar *p, ulong len, uchar *digest, MD4state *s) } /* - * encodes input (u32int) into output (uchar). Assumes len is + * encodes input (uint32) into output (uchar). Assumes len is * a multiple of 4. */ static void -encode(uchar *output, u32int *input, ulong len) +encode(uchar *output, uint32 *input, ulong len) { - u32int x; + uint32 x; uchar *e; for(e = output + len; output < e;) { @@ -257,11 +257,11 @@ encode(uchar *output, u32int *input, ulong len) } /* - * decodes input (uchar) into output (u32int). Assumes len is + * decodes input (uchar) into output (uint32). Assumes len is * a multiple of 4. */ static void -decode(u32int *output, uchar *input, ulong len) +decode(uint32 *output, uchar *input, ulong len) { uchar *e; diff --git a/src/9vx/libsec/md5.c b/src/9vx/libsec/md5.c @@ -27,14 +27,14 @@ * documentation and/or software. */ -static void encode(uchar*, u32int*, ulong); +static void encode(uchar*, uint32*, ulong); -extern void _md5block(uchar*, ulong, u32int*); +extern void _md5block(uchar*, ulong, uint32*); MD5state* md5(uchar *p, ulong len, uchar *digest, MD5state *s) { - u32int x[16]; + uint32 x[16]; uchar buf[128]; int i; uchar *e; @@ -128,13 +128,13 @@ md5(uchar *p, ulong len, uchar *digest, MD5state *s) } /* - * encodes input (u32int) into output (uchar). Assumes len is + * encodes input (uint32) into output (uchar). Assumes len is * a multiple of 4. */ static void -encode(uchar *output, u32int *input, ulong len) +encode(uchar *output, uint32 *input, ulong len) { - u32int x; + uint32 x; uchar *e; for(e = output + len; output < e;) { diff --git a/src/9vx/libsec/md5block.c b/src/9vx/libsec/md5block.c @@ -53,7 +53,7 @@ enum S44= 21, }; -static u32int md5tab[] = +static uint32 md5tab[] = { /* round 1 */ /*[0]*/ 0xd76aa478, @@ -128,16 +128,16 @@ static u32int md5tab[] = 0xeb86d391, }; -static void decode(u32int*, uchar*, ulong); -extern void _md5block(uchar *p, ulong len, u32int *s); +static void decode(uint32*, uchar*, ulong); +extern void _md5block(uchar *p, ulong len, uint32 *s); void -_md5block(uchar *p, ulong len, u32int *s) +_md5block(uchar *p, ulong len, uint32 *s) { - u32int a, b, c, d, sh; - u32int *t; + uint32 a, b, c, d, sh; + uint32 *t; uchar *end; - u32int x[16]; + uint32 x[16]; for(end = p+len; p < end; p += 64){ a = s[0]; @@ -253,11 +253,11 @@ _md5block(uchar *p, ulong len, u32int *s) } /* - * decodes input (uchar) into output (u32int). Assumes len is + * decodes input (uchar) into output (uint32). Assumes len is * a multiple of 4. */ static void -decode(u32int *output, uchar *input, ulong len) +decode(uint32 *output, uchar *input, ulong len) { uchar *e; diff --git a/src/9vx/libsec/sha1.c b/src/9vx/libsec/sha1.c @@ -1,9 +1,9 @@ #include "os.h" #include "libsec.h" -static void encode(uchar*, u32int*, ulong); +static void encode(uchar*, uint32*, ulong); -extern void _sha1block(uchar*, ulong, u32int*); +extern void _sha1block(uchar*, ulong, uint32*); /* * we require len to be a multiple of 64 for all but @@ -14,7 +14,7 @@ SHA1state* sha1(uchar *p, ulong len, uchar *digest, SHA1state *s) { uchar buf[128]; - u32int x[16]; + uint32 x[16]; int i; uchar *e; @@ -112,9 +112,9 @@ sha1(uchar *p, ulong len, uchar *digest, SHA1state *s) * a multiple of 4. */ static void -encode(uchar *output, u32int *input, ulong len) +encode(uchar *output, uint32 *input, ulong len) { - u32int x; + uint32 x; uchar *e; for(e = output + len; output < e;) { diff --git a/src/9vx/libsec/sha1block.c b/src/9vx/libsec/sha1block.c @@ -1,12 +1,12 @@ #include "os.h" void -_sha1block(uchar *p, ulong len, u32int *s) +_sha1block(uchar *p, ulong len, uint32 *s) { - u32int a, b, c, d, e, x; + uint32 a, b, c, d, e, x; uchar *end; - u32int *wp, *wend; - u32int w[80]; + uint32 *wp, *wend; + uint32 w[80]; /* at this point, we have a multiple of 64 bytes */ for(end = p+len; p < end;){ diff --git a/src/9vx/main.c b/src/9vx/main.c @@ -401,7 +401,7 @@ bootargs(void *base) { int i, ac; uchar *av[32]; - u32int *lsp; + uint32 *lsp; sp = (uchar*)base + BY2PG - MAXSYSARG*BY2WD - sizeof(Tos); @@ -413,11 +413,11 @@ bootargs(void *base) sp = (uchar*)((uintptr)sp & ~3); /* build argc, argv on stack */ - sp -= (ac+2)*sizeof(u32int); - lsp = (u32int*)sp; + sp -= (ac+2)*sizeof(uint32); + lsp = (uint32*)sp; *lsp++ = ac; for(i = 0; i < ac; i++) - *lsp++ = (u32int)(uintptr)(av[i] + ((USTKTOP - BY2PG) - (ulong)base)); + *lsp++ = (uint32)(uintptr)(av[i] + ((USTKTOP - BY2PG) - (ulong)base)); *lsp = 0; sp += (USTKTOP - BY2PG) - (ulong)base; } @@ -425,7 +425,7 @@ bootargs(void *base) void showexec(ulong sp) { - u32int *a, *argv; + uint32 *a, *argv; int i, n; uchar *uzero; @@ -433,7 +433,7 @@ showexec(ulong sp) iprint("showexec %p\n", (uintptr)sp); if(sp >= USTKTOP || sp < USTKTOP-USTKSIZE) panic("showexec: bad sp"); - a = (u32int*)(uzero + sp); + a = (uint32*)(uzero + sp); n = *a++; iprint("argc=%d\n", n); argv = a; diff --git a/src/9vx/mmu.c b/src/9vx/mmu.c @@ -200,7 +200,7 @@ putmmu(ulong va, ulong pa, Page *p) Uspace *us; if(tracemmu || (pa&~(PTEWRITE|PTEVALID)) != p->pa) - print("putmmu va %lux pa %lux p->pa %lux\n", va, pa, p->pa); + iprint("putmmu va %lux pa %lux p->pa %lux\n", va, pa, p->pa); assert(p->pa < MEMSIZE && pa < MEMSIZE); assert(up); @@ -232,7 +232,7 @@ void flushmmu(void) { if(tracemmu) - print("flushmmu\n"); + iprint("flushmmu\n"); if(up){ vxproc_flush(up->pmmu.vxproc); @@ -264,7 +264,7 @@ getspace(Proc *p) us = ulist[nuspace-1]; if(us->p){ if(tracemmu) - print("^^^^^^^^^^ %ld %s [evict %d]\n", us->p->pid, us->p->text, us - uspace); + iprint("^^^^^^^^^^ %ld %s [evict %d]\n", us->p->pid, us->p->text, us - uspace); mmapflush(us); } us->p = p; @@ -283,7 +283,7 @@ takespace(Proc *p, Uspace *us) return; if(tracemmu){ if(us->p) - print("^^^^^^^^^^ %ld %s [steal %d]\n", us->p->pid, us->p->text, us - uspace); + iprint("^^^^^^^^^^ %ld %s [steal %d]\n", us->p->pid, us->p->text, us - uspace); } us->p = p; mmapflush(us); @@ -324,10 +324,10 @@ mmuswitch(Proc *p) return; if(tracemmu) - print("mmuswitch %ld %s\n", p->pid, p->text); + iprint("mmuswitch %ld %s\n", p->pid, p->text); if(p->pmmu.us && p->pmmu.us->p == p){ - if(tracemmu) print("---------- %ld %s [%d]\n", + if(tracemmu) iprint("---------- %ld %s [%d]\n", p->pid, p->text, p->pmmu.us - uspace); usespace(p->pmmu.us); if(!p->newtlb && !m->flushmmu){ @@ -343,7 +343,7 @@ mmuswitch(Proc *p) getspace(p); else takespace(p, p->pmmu.us); - if(tracemmu) print("========== %ld %s [%d]\n", + if(tracemmu) iprint("========== %ld %s [%d]\n", p->pid, p->text, p->pmmu.us - uspace); } @@ -356,12 +356,12 @@ mmurelease(Proc *p) if(p->kp) return; if(tracemmu) - print("mmurelease %ld %s\n", p->pid, p->text); + iprint("mmurelease %ld %s\n", p->pid, p->text); if(p->pmmu.vxproc) vxproc_flush(p->pmmu.vxproc); if(p->pmmu.us){ if(tracemmu) - print("^^^^^^^^^^ %ld %s [release %d]\n", p->pid, p->text, p->pmmu.us - uspace); + iprint("^^^^^^^^^^ %ld %s [release %d]\n", p->pid, p->text, p->pmmu.us - uspace); putspace(p->pmmu.us); if(m->flushmmu) mmapflush(p->pmmu.us); diff --git a/src/9vx/nogui.c b/src/9vx/nogui.c @@ -17,7 +17,7 @@ * (They've been underscored.) */ Memimage* -allocmemimage(Rectangle r, u32int chan) +allocmemimage(Rectangle r, uint32 chan) { return _allocmemimage(r, chan); } @@ -57,7 +57,7 @@ memimagedraw(Memimage *dst, Rectangle r, Memimage *src, Point sp, } void -memfillcolor(Memimage *m, u32int val) +memfillcolor(Memimage *m, uint32 val) { _memfillcolor(m, val); } diff --git a/src/9vx/stub.c b/src/9vx/stub.c @@ -147,6 +147,7 @@ fpinit(void) if(tracefp) iprint("fpinit\n"); +#ifdef i386 asm volatile( "finit\n" "fwait\n" @@ -154,12 +155,26 @@ fpinit(void) "fldcw 0(%%esp)\n" "popw %%ax\n" "fwait\n" : : : "memory"); +#else + asm volatile( + "finit\n" + "fwait\n" + "pushq $0x232\n" + "fldcw 0(%%rsp)\n" + "popq %%rax\n" + "fwait\n" : : : "memory"); +#endif + } void fpsave(FPsave *s) { +#ifdef i386 asm volatile("fnsave 0(%%eax)\n" : : "a" (s) : "memory"); +#else + asm volatile("fnsave 0(%%rax)\n" : : "a" (s) : "memory"); +#endif if(tracefp) iprint("fpsave: %#x %#x %#x %#ux\n", s->control, s->status, s->tag, s->pc); } @@ -169,7 +184,11 @@ fprestore(FPsave *s) { if(tracefp) iprint("fprestore: %#x %#x %#x %#ux\n", s->control, s->status, s->tag, s->pc); +#ifdef i386 asm volatile("frstor 0(%%eax); fwait\n" : : "a" (s) : "memory"); +#else + asm volatile("frstor 0(%%rax); fwait\n" : : "a" (s) : "memory"); +#endif } void @@ -177,7 +196,11 @@ fpenv(FPsave *s) { if(tracefp) iprint("fpenv: %#x %#x %#x %#ux\n", s->control, s->status, s->tag, s->pc); +#ifdef i386 asm volatile("fstenv 0(%%eax)\n" : : "a" (s) : "memory"); +#else + asm volatile("fstenv 0(%%rax)\n" : : "a" (s) : "memory"); +#endif } void @@ -481,7 +504,7 @@ iprint(char *fmt, ...) va_start(arg, fmt); n = vseprint(buf, buf+sizeof(buf), fmt, arg) - buf; va_end(arg); - USED(write(2, buf, n)); + write(2, buf, n); return n; } @@ -505,7 +528,7 @@ panic(char *fmt, ...) n = vseprint(buf+strlen(buf), buf+sizeof(buf), fmt, arg) - buf; va_end(arg); buf[n] = '\n'; - USED(write(2, buf, n+1)); + write(2, buf, n+1); if(doabort){ #ifdef __APPLE__ fprint(2, "sleeping, so you can attach gdb to pid %d\n", (int)getpid()); diff --git a/src/9vx/trap.c b/src/9vx/trap.c @@ -80,7 +80,7 @@ trap(Ureg *ureg) { char buf[ERRMAX]; int vno; - + vno = ureg->trap; switch(vno){ @@ -90,7 +90,7 @@ trap(Ureg *ureg) case VXTRAP_SOFT+0x40: /* int $0x40 - system call */ if(tracesyscalls){ - u32int *sp = (u32int*)(up->pmmu.uzero + ureg->usp); + uint32 *sp = (uint32*)(up->pmmu.uzero + ureg->usp); iprint("%d [%s] %s %#ux %08ux %08ux %08ux %08ux\n", up->pid, up->text, sysctab[ureg->ax], sp[0], sp[1], sp[2], sp[3]); @@ -262,7 +262,7 @@ syscall(Ureg *ureg) up->psstate = 0; if(scallnr == NOTED) - noted(ureg, *(u32int*)(up->pmmu.uzero + sp+BY2WD)); + noted(ureg, *(uint32*)(up->pmmu.uzero + sp+BY2WD)); if(scallnr!=RFORK && (up->procctl || up->nnote)){ splhi(); @@ -342,14 +342,14 @@ notify(Ureg* ureg) uzero = up->pmmu.uzero; upureg = (void*)(uzero + sp); memmove(upureg, ureg, sizeof(Ureg)); - *(u32int*)(uzero + sp-BY2WD) = up->ureg; /* word under Ureg is old up->ureg */ + *(uint32*)(uzero + sp-BY2WD) = up->ureg; /* word under Ureg is old up->ureg */ up->ureg = sp; sp -= BY2WD+ERRMAX; memmove((char*)(uzero + sp), up->note[0].msg, ERRMAX); sp -= 3*BY2WD; - *(u32int*)(uzero + sp+2*BY2WD) = sp+3*BY2WD; /* arg 2 is string */ - *(u32int*)(uzero + sp+1*BY2WD) = up->ureg; /* arg 1 is ureg* */ - *(u32int*)(uzero + sp+0*BY2WD) = 0; /* arg 0 is pc */ + *(uint32*)(uzero + sp+2*BY2WD) = sp+3*BY2WD; /* arg 2 is string */ + *(uint32*)(uzero + sp+1*BY2WD) = up->ureg; /* arg 1 is ureg* */ + *(uint32*)(uzero + sp+0*BY2WD) = 0; /* arg 0 is pc */ ureg->usp = sp; ureg->pc = up->notify; up->notified = 1; @@ -406,7 +406,7 @@ noted(Ureg* ureg, ulong arg0) pprint("suicide: trap in noted\n"); pexit("Suicide", 0); } - up->ureg = *(u32int*)(uzero+oureg-BY2WD); + up->ureg = *(uint32*)(uzero+oureg-BY2WD); qunlock(&up->debug); break; @@ -421,8 +421,8 @@ noted(Ureg* ureg, ulong arg0) sp = oureg-4*BY2WD-ERRMAX; splhi(); ureg->sp = sp; - ((u32int*)(uzero+sp))[1] = oureg; /* arg 1 0(FP) is ureg* */ - ((u32int*)(uzero+sp))[0] = 0; /* arg 0 is pc */ + ((uint32*)(uzero+sp))[1] = oureg; /* arg 1 0(FP) is ureg* */ + ((uint32*)(uzero+sp))[0] = 0; /* arg 0 is pc */ break; default: @@ -443,13 +443,13 @@ noted(Ureg* ureg, ulong arg0) long execregs(ulong entry, ulong ssize, ulong nargs) { - u32int *sp; + uint32 *sp; Ureg *ureg; up->fpstate = FPinit; fpoff(); - sp = (u32int*)(up->pmmu.uzero + USTKTOP - ssize); + sp = (uint32*)(up->pmmu.uzero + USTKTOP - ssize); *--sp = nargs; ureg = up->dbgreg; @@ -721,4 +721,3 @@ procsave(Proc *p) p->fpstate = FPinactive; } } - diff --git a/src/9vx/unix.h b/src/9vx/unix.h @@ -52,14 +52,14 @@ typedef unsigned long ulong; typedef unsigned long long uvlong; typedef long long vlong; typedef ulong uintptr; -typedef unsigned int u32int; typedef signed char schar; typedef unsigned short Rune; -// gcc 4.3.2 is too smart - it warns about unused return values -// for functions like write and fchmod, even if you cast -// the result to (void). -// #define USED(x) ((void)(x)) -#define USED(x) do{typeof(x) __tmp__ = (x); (void)__tmp__; } while(0) +typedef unsigned int uint32; +typedef unsigned long long uint64; +typedef int int32; +typedef long long int64; + +#define USED(x) ((void)(x)) diff --git a/src/9vx/vx32.c b/src/9vx/vx32.c @@ -255,7 +255,6 @@ touser(void *initsp) if(rc < 0) panic("vxproc_run: %r"); -if(rc == 0x240 && vp->cpu->reg[EAX] == 4) { xxclose(); } if(traceprocs) iprint("-vx32 %p %p %s eip=%lux esp=%lux rc=%#x\n", m, up, up->text, vp->cpu->eip, vp->cpu->reg[ESP], rc); @@ -290,16 +289,9 @@ if(rc == 0x240 && vp->cpu->reg[EAX] == 4) { xxclose(); } } } -static void -breakme(void) -{ -} - static void proc2ureg(vxproc *vp, Ureg *u) { -XXX this memset runs backward because the direction bit -is set wrong on entry! memset(u, 0, sizeof *u); u->pc = vp->cpu->eip; u->ax = vp->cpu->reg[EAX]; diff --git a/src/9vx/x11/x11-draw.c b/src/9vx/x11/x11-draw.c @@ -16,7 +16,7 @@ * Allocate a Memimage with an optional pixmap backing on the X server. */ Memimage* -_xallocmemimage(Rectangle r, u32int chan, int pixmap) +_xallocmemimage(Rectangle r, uint32 chan, int pixmap) { int d, offset; Memimage *m; @@ -72,7 +72,7 @@ _xallocmemimage(Rectangle r, u32int chan, int pixmap) */ xi = XCreateImage(_x.display, _x.vis, d, ZPixmap, 0, (char*)m->data->bdata, Dx(r), Dy(r), - 32, m->width*sizeof(u32int)); + 32, m->width*sizeof(uint32)); if(xi == nil){ iprint("XCreateImage %R %d %d failed\n", r, m->width, m->depth); freememimage(m); @@ -107,7 +107,7 @@ _xallocmemimage(Rectangle r, u32int chan, int pixmap) * (They've been underscored.) */ Memimage* -allocmemimage(Rectangle r, u32int chan) +allocmemimage(Rectangle r, uint32 chan) { return _xallocmemimage(r, chan, PMundef); } @@ -182,7 +182,7 @@ memimagedraw(Memimage *dst, Rectangle r, Memimage *src, Point sp, static int xdraw(Memdrawparam *par) { - u32int sdval; + uint32 sdval; uint m, state; Memimage *src, *dst, *mask; Point dp, mp, sp; @@ -284,7 +284,7 @@ xdraw(Memdrawparam *par) void -memfillcolor(Memimage *m, u32int val) +memfillcolor(Memimage *m, uint32 val) { _memfillcolor(m, val); if(m->x == nil) @@ -296,7 +296,7 @@ memfillcolor(Memimage *m, u32int val) } void -_xfillcolor(Memimage *m, Rectangle r, u32int v) +_xfillcolor(Memimage *m, Rectangle r, uint32 v) { Point p; Xmem *xm; @@ -454,7 +454,7 @@ unloadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata) return _unloadmemimage(i, r, data, ndata); } -u32int +uint32 pixelbits(Memimage *m, Point p) { if(m->x) diff --git a/src/9vx/x11/x11-inc.h b/src/9vx/x11/x11-inc.h @@ -45,7 +45,7 @@ struct Xmem typedef struct Xprivate Xprivate; struct Xprivate { - u32int chan; + uint32 chan; XColormap cmap; XCursor cursor; XDisplay *display; @@ -60,23 +60,23 @@ struct Xprivate { XGC gccopy; XGC gccopy0; XGC gcfill; - u32int gcfillcolor; + uint32 gcfillcolor; XGC gcfill0; - u32int gcfill0color; + uint32 gcfill0color; XGC gcreplsrc; - u32int gcreplsrctile; + uint32 gcreplsrctile; XGC gcreplsrc0; - u32int gcreplsrc0tile; + uint32 gcreplsrc0tile; XGC gcsimplesrc; - u32int gcsimplesrccolor; - u32int gcsimplesrcpixmap; + uint32 gcsimplesrccolor; + uint32 gcsimplesrcpixmap; XGC gcsimplesrc0; - u32int gcsimplesrc0color; - u32int gcsimplesrc0pixmap; + uint32 gcsimplesrc0color; + uint32 gcsimplesrc0pixmap; XGC gczero; - u32int gczeropixmap; + uint32 gczeropixmap; XGC gczero0; - u32int gczero0pixmap; + uint32 gczero0pixmap; Rectangle newscreenr; Memimage* screenimage; QLock screenlock; @@ -104,10 +104,10 @@ struct Xprivate { extern Xprivate _x; -extern Memimage *_xallocmemimage(Rectangle, u32int, int); +extern Memimage *_xallocmemimage(Rectangle, uint32, int); extern XImage *_xallocxdata(Memimage*, Rectangle); extern void _xdirtyxdata(Memimage*, Rectangle); -extern void _xfillcolor(Memimage*, Rectangle, u32int); +extern void _xfillcolor(Memimage*, Rectangle, uint32); extern void _xfreexdata(Memimage*); extern XImage *_xgetxdata(Memimage*, Rectangle); extern void _xputxdata(Memimage*, Rectangle); diff --git a/src/9vx/x11/x11-init.c b/src/9vx/x11/x11-init.c @@ -570,7 +570,7 @@ setupcmap(XWindow w) { char buf[30]; int i; - u32int p, pp; + uint32 p, pp; XColor c; if(_x.depth <= 1) diff --git a/src/9vx/x11/x11-itrans.c b/src/9vx/x11/x11-itrans.c @@ -361,7 +361,7 @@ _xgetsnarffrom(XWindow w, Atom clipboard, Atom target, int timeout0, int timeout /* get the property */ xdata = nil; - XGetWindowProperty(_x.display, _x.drawable, prop, 0, SnarfSize/sizeof(u32int), 0, + XGetWindowProperty(_x.display, _x.drawable, prop, 0, SnarfSize/sizeof(uint32), 0, AnyPropertyType, &type, &fmt, &len, &dummy, &xdata); if((type != target && type != XA_STRING && type != _x.utf8string) || len == 0){ if(xdata) diff --git a/src/Makefrag b/src/Makefrag @@ -6,7 +6,7 @@ COMMON_CFLAGS = -g -O3 -MD -std=gnu99 -I. $(CFLAGS) COMMON_LDFLAGS = -g -L. $(LDFLAGS) # Host environment compiler options -HOST_CC := $(CC) +HOST_CC := $(CC) -fno-inline HOST_LD := $(LD) HOST_AR := $(AR) HOST_LDFLAGS := $(COMMON_LDFLAGS) diff --git a/src/hash/sha2.c b/src/hash/sha2.c @@ -34,7 +34,9 @@ #include <assert.h> /* assert() */ #include "libvx32/words.h" // XXX +#ifndef BYTE_ORDER #define BYTE_ORDER LITTLE_ENDIAN // XXX +#endif #include "sha2.h" diff --git a/src/hash/whirlpool.c b/src/hash/whirlpool.c @@ -1826,7 +1826,7 @@ void testAPI(void) { } NESSIEfinalize(&w, computedDigest); if (memcmp(computedDigest, expectedDigest, DIGESTBYTES) != 0) { - fprintf(stderr, "API error @ pieceLen = %lu\n", pieceLen); + fprintf(stderr, "API error @ pieceLen = %lu\n", (long unsigned)pieceLen); display(computedDigest, DIGESTBYTES); printf("\n\n"); display(expectedDigest, DIGESTBYTES); printf("\n\n"); return; diff --git a/src/libvx32/linux.c b/src/libvx32/linux.c @@ -221,9 +221,9 @@ int vx32_sighandler(int signo, siginfo_t *si, void *v) asm("movw %"VSEGSTR",%0" : "=r" (vs)); - if(0) vxprint("vx32_sighandler signo=%d eip=%#x esp=%#x vs=%#x\n", + if(vx32_debugxlate) vxprint("vx32_sighandler signo=%d eip=%#x esp=%#x vs=%#x\n", signo, ctx->ctxeip, ctx->esp, vs); - if(0) dumpsigcontext(ctx); + if(vx32_debugxlate) dumpsigcontext(ctx); if ((vs & 15) != 15) // 8 (emu), LDT, RPL=3 return 0; diff --git a/src/libvx32/run64.S b/src/libvx32/run64.S @@ -108,6 +108,7 @@ vxrun_return: movl %edx,VXEMU_EFLAGS(%r8) // Return to caller + cld // x86-64 ABI says DF must be cleared ret diff --git a/src/libvx32/sig.c b/src/libvx32/sig.c @@ -267,12 +267,12 @@ int vx32_siginit(void) assert(!(ss.ss_flags & SS_ONSTACK)); if (ss.ss_flags & SS_DISABLE) { // Allocate an alternate signal stack. - stk = malloc(65536); + ss.ss_size = 64*1024; + stk = malloc(ss.ss_size); if (stk == NULL) return -1; ss.ss_flags = 0; ss.ss_sp = stk; - ss.ss_size = 65536; if (sigaltstack(&ss, NULL) < 0) { free(stk); return -1;