diff options
author | rsc <devnull@localhost> | 2004-06-11 04:33:54 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-06-11 04:33:54 +0000 |
commit | 9b24f92c5611353cdafb6756ae21b405ebc695dd (patch) | |
tree | 6a81ee9775a14a09f60c2c244ada1cd805806297 | |
parent | fa009f9d7217bd577248e53ff5aba2e8b1e0c4b2 (diff) | |
download | plan9port-9b24f92c5611353cdafb6756ae21b405ebc695dd.tar.gz plan9port-9b24f92c5611353cdafb6756ae21b405ebc695dd.tar.bz2 plan9port-9b24f92c5611353cdafb6756ae21b405ebc695dd.zip |
maybe 64-bit better
-rw-r--r-- | src/libmach/Linux.c | 15 | ||||
-rw-r--r-- | src/libmach/frame.c | 4 | ||||
-rw-r--r-- | src/libmach/loc.c | 12 | ||||
-rw-r--r-- | src/libmach/map.c | 44 | ||||
-rw-r--r-- | src/libmach/mkfile | 2 | ||||
-rw-r--r-- | src/libmach/regs.c | 8 | ||||
-rw-r--r-- | src/libmach/symdwarf.c | 6 |
7 files changed, 48 insertions, 43 deletions
diff --git a/src/libmach/Linux.c b/src/libmach/Linux.c index 12b0f9b8..7128bdc4 100644 --- a/src/libmach/Linux.c +++ b/src/libmach/Linux.c @@ -34,8 +34,8 @@ struct PtraceRegs int pid; }; -static int ptracerw(Map*, Seg*, ulong, void*, uint, int); -static int ptraceregrw(Regs*, char*, ulong*, int); +static int ptracerw(Map*, Seg*, uvlong, void*, uint, int); +static int ptraceregrw(Regs*, char*, uvlong*, int); static int attachedpids[1000]; static int nattached; @@ -126,12 +126,17 @@ detachproc(int pid) } static int -ptracerw(Map *map, Seg *seg, ulong addr, void *v, uint n, int isr) +ptracerw(Map *map, Seg *seg, uvlong addr, void *v, uint n, int isr) { int i; u32int u; uchar buf[4]; + if(addr>>32){ + werrstr("address out of range"); + return -1; + } + addr += seg->base; for(i=0; i<n; i+=4){ if(isr){ @@ -200,7 +205,7 @@ reg2linux(char *reg) } static int -ptraceregrw(Regs *regs, char *name, ulong *val, int isr) +ptraceregrw(Regs *regs, char *name, uvlong *val, int isr) { int pid; ulong addr; @@ -210,7 +215,7 @@ ptraceregrw(Regs *regs, char *name, ulong *val, int isr) addr = reg2linux(name); if(~addr == 0){ if(isr){ - *val = ~(ulong)0; + *val = ~(uvlong)0; return 0; } werrstr("register not available"); diff --git a/src/libmach/frame.c b/src/libmach/frame.c index 6e448519..1d1ac40b 100644 --- a/src/libmach/frame.c +++ b/src/libmach/frame.c @@ -13,7 +13,7 @@ struct LocRegs }; static int -locregrw(Regs *regs, char *name, ulong *val, int isr) +locregrw(Regs *regs, char *name, uvlong *val, int isr) { int i; LocRegs *lr; @@ -36,7 +36,7 @@ stacktrace(Map *map, Regs *regs, Tracer trace) { char *rname; int i, ipc, ret; - ulong nextpc, pc, v; + uvlong nextpc, pc, v; ulong *cur, *next; LocRegs lr; Symbol s, *sp; diff --git a/src/libmach/loc.c b/src/libmach/loc.c index 47bcf3d9..8113168e 100644 --- a/src/libmach/loc.c +++ b/src/libmach/loc.c @@ -70,7 +70,7 @@ lget1(Map *map, Regs *regs, Loc loc, uchar *a, uint n) int lget2(Map *map, Regs *regs, Loc loc, u16int *u) { - ulong ul; + uvlong ul; if(locsimplify(map, regs, loc, &loc) < 0) return -1; @@ -93,7 +93,7 @@ lget2(Map *map, Regs *regs, Loc loc, u16int *u) int lget4(Map *map, Regs *regs, Loc loc, u32int *u) { - ulong ul; + uvlong ul; if(locsimplify(map, regs, loc, &loc) < 0) return -1; @@ -116,7 +116,7 @@ lget4(Map *map, Regs *regs, Loc loc, u32int *u) int lget8(Map *map, Regs *regs, Loc loc, u64int *u) { - ulong ul; + uvlong ul; if(locsimplify(map, regs, loc, &loc) < 0) return -1; @@ -188,7 +188,7 @@ lput8(Map *map, Regs *regs, Loc loc, u64int u) } Loc -locaddr(ulong addr) +locaddr(uvlong addr) { Loc l; @@ -198,7 +198,7 @@ locaddr(ulong addr) } Loc -locindir(char *reg, long offset) +locindir(char *reg, vlong offset) { Loc l; @@ -209,7 +209,7 @@ locindir(char *reg, long offset) } Loc -locconst(ulong con) +locconst(uvlong con) { Loc l; diff --git a/src/libmach/map.c b/src/libmach/map.c index 2745dd4c..eed205bc 100644 --- a/src/libmach/map.c +++ b/src/libmach/map.c @@ -6,10 +6,10 @@ #include <bio.h> #include <mach.h> -static int fdrw(Map*, Seg*, ulong, void*, uint, int); -static int zerorw(Map*, Seg*, ulong, void*, uint, int); -static int mrw(Map*, ulong, void*, uint, int); -static int datarw(Map*, Seg*, ulong, void*, uint, int); +static int fdrw(Map*, Seg*, uvlong, void*, uint, int); +static int zerorw(Map*, Seg*, uvlong, void*, uint, int); +static int mrw(Map*, uvlong, void*, uint, int); +static int datarw(Map*, Seg*, uvlong, void*, uint, int); Map* allocmap(void) @@ -71,7 +71,7 @@ findseg(Map *map, char *name, char *file) } int -addrtoseg(Map *map, ulong addr, Seg *sp) +addrtoseg(Map *map, uvlong addr, Seg *sp) { int i; Seg *s; @@ -93,7 +93,7 @@ addrtoseg(Map *map, ulong addr, Seg *sp) } int -addrtosegafter(Map *map, ulong addr, Seg *sp) +addrtosegafter(Map *map, uvlong addr, Seg *sp) { int i; Seg *s, *best; @@ -142,13 +142,13 @@ removeseg(Map *map, int i) } int -get1(Map *map, ulong addr, uchar *a, uint n) +get1(Map *map, uvlong addr, uchar *a, uint n) { return mrw(map, addr, a, n, 1); } int -get2(Map *map, ulong addr, u16int *u) +get2(Map *map, uvlong addr, u16int *u) { u16int v; @@ -159,7 +159,7 @@ get2(Map *map, ulong addr, u16int *u) } int -get4(Map *map, ulong addr, u32int *u) +get4(Map *map, uvlong addr, u32int *u) { u32int v; @@ -170,7 +170,7 @@ get4(Map *map, ulong addr, u32int *u) } int -get8(Map *map, ulong addr, u64int *u) +get8(Map *map, uvlong addr, u64int *u) { u64int v; @@ -181,37 +181,37 @@ get8(Map *map, ulong addr, u64int *u) } int -put1(Map *map, ulong addr, uchar *a, uint n) +put1(Map *map, uvlong addr, uchar *a, uint n) { return mrw(map, addr, a, n, 0); } int -put2(Map *map, ulong addr, u16int u) +put2(Map *map, uvlong addr, u16int u) { u = mach->swap2(u); return mrw(map, addr, &u, 2, 0); } int -put4(Map *map, ulong addr, u32int u) +put4(Map *map, uvlong addr, u32int u) { u = mach->swap4(u); return mrw(map, addr, &u, 4, 0); } int -put8(Map *map, ulong addr, u64int u) +put8(Map *map, uvlong addr, u64int u) { u = mach->swap8(u); return mrw(map, addr, &u, 8, 0); } static Seg* -reloc(Map *map, ulong addr, uint n, ulong *off, uint *nn) +reloc(Map *map, uvlong addr, uint n, uvlong *off, uint *nn) { int i; - ulong o; + uvlong o; if(map == nil){ werrstr("invalid map"); @@ -236,12 +236,12 @@ reloc(Map *map, ulong addr, uint n, ulong *off, uint *nn) } static int -mrw(Map *map, ulong addr, void *a, uint n, int r) +mrw(Map *map, uvlong addr, void *a, uint n, int r) { uint nn; uint tot; Seg *s; - ulong off; + uvlong off; for(tot=0; tot<n; tot+=nn){ s = reloc(map, addr+tot, n-tot, &off, &nn); @@ -254,11 +254,11 @@ mrw(Map *map, ulong addr, void *a, uint n, int r) } static int -fdrw(Map *map, Seg *seg, ulong addr, void *a, uint n, int r) +fdrw(Map *map, Seg *seg, uvlong addr, void *a, uint n, int r) { int nn; uint tot; - ulong off; + uvlong off; USED(map); off = seg->offset + addr; @@ -279,7 +279,7 @@ fdrw(Map *map, Seg *seg, ulong addr, void *a, uint n, int r) } static int -zerorw(Map *map, Seg *seg, ulong addr, void *a, uint n, int r) +zerorw(Map *map, Seg *seg, uvlong addr, void *a, uint n, int r) { USED(map); USED(seg); @@ -294,7 +294,7 @@ zerorw(Map *map, Seg *seg, ulong addr, void *a, uint n, int r) } static int -datarw(Map *map, Seg *seg, ulong addr, void *a, uint n, int r) +datarw(Map *map, Seg *seg, uvlong addr, void *a, uint n, int r) { USED(map); diff --git a/src/libmach/mkfile b/src/libmach/mkfile index 77426436..3ad5384d 100644 --- a/src/libmach/mkfile +++ b/src/libmach/mkfile @@ -40,7 +40,7 @@ OFILES=\ symmacho.$O\ symstabs.$O\ -HFILES=mach.h +HFILES=$PLAN9/include/mach.h <$PLAN9/src/mksyslib CFLAGS=$CFLAGS -I. diff --git a/src/libmach/regs.c b/src/libmach/regs.c index 43c04786..2ead7a33 100644 --- a/src/libmach/regs.c +++ b/src/libmach/regs.c @@ -3,7 +3,7 @@ #include <mach.h> int -rput(Regs *regs, char *name, ulong u) +rput(Regs *regs, char *name, uvlong u) { if(regs == nil){ werrstr("registers not mapped"); @@ -13,7 +13,7 @@ rput(Regs *regs, char *name, ulong u) } int -rget(Regs *regs, char *name, ulong *u) +rget(Regs *regs, char *name, uvlong *u) { if(regs == nil){ *u = ~(ulong)0; @@ -24,7 +24,7 @@ rget(Regs *regs, char *name, ulong *u) } int -_uregrw(Regs *regs, char *name, ulong *u, int isr) +_uregrw(Regs *regs, char *name, uvlong *u, int isr) { Regdesc *r; uchar *ureg; @@ -41,7 +41,7 @@ _uregrw(Regs *regs, char *name, ulong *u, int isr) switch(r->format){ default: case 'X': - *u = mach->swap4(*(u32int*)ureg); + *u = mach->swap4(*(ulong*)ureg); return 0; } } diff --git a/src/libmach/symdwarf.c b/src/libmach/symdwarf.c index eeafa8dc..c29f287f 100644 --- a/src/libmach/symdwarf.c +++ b/src/libmach/symdwarf.c @@ -323,11 +323,11 @@ dwarftosym(Fhdr *fp, Dwarf *d, DwarfSym *ds, Symbol *s, int infn) } static int -dwarfeval(Dwarf *d, Map *map, Regs *regs, ulong cfa, int rno, DwarfExpr e, ulong *u) +dwarfeval(Dwarf *d, Map *map, Regs *regs, ulong cfa, int rno, DwarfExpr e, uvlong *u) { int i; u32int u4; - ulong uu; + uvlong uu; switch(e.type){ case RuleUndef: @@ -400,7 +400,7 @@ _dwarfunwind(Fhdr *fhdr, Map *map, Regs *regs, ulong *next) { char *name; int i, j; - ulong cfa, pc, u; + uvlong cfa, pc, u; Dwarf *d; DwarfExpr *e, epc, ecfa; |