mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
back to 32 bit for now
This commit is contained in:
parent
9b24f92c56
commit
4f0073fec2
7 changed files with 43 additions and 48 deletions
|
@ -34,8 +34,8 @@ struct PtraceRegs
|
||||||
int pid;
|
int pid;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int ptracerw(Map*, Seg*, uvlong, void*, uint, int);
|
static int ptracerw(Map*, Seg*, ulong, void*, uint, int);
|
||||||
static int ptraceregrw(Regs*, char*, uvlong*, int);
|
static int ptraceregrw(Regs*, char*, ulong*, int);
|
||||||
|
|
||||||
static int attachedpids[1000];
|
static int attachedpids[1000];
|
||||||
static int nattached;
|
static int nattached;
|
||||||
|
@ -126,17 +126,12 @@ detachproc(int pid)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ptracerw(Map *map, Seg *seg, uvlong addr, void *v, uint n, int isr)
|
ptracerw(Map *map, Seg *seg, ulong addr, void *v, uint n, int isr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
u32int u;
|
u32int u;
|
||||||
uchar buf[4];
|
uchar buf[4];
|
||||||
|
|
||||||
if(addr>>32){
|
|
||||||
werrstr("address out of range");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
addr += seg->base;
|
addr += seg->base;
|
||||||
for(i=0; i<n; i+=4){
|
for(i=0; i<n; i+=4){
|
||||||
if(isr){
|
if(isr){
|
||||||
|
@ -205,7 +200,7 @@ reg2linux(char *reg)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ptraceregrw(Regs *regs, char *name, uvlong *val, int isr)
|
ptraceregrw(Regs *regs, char *name, ulong *val, int isr)
|
||||||
{
|
{
|
||||||
int pid;
|
int pid;
|
||||||
ulong addr;
|
ulong addr;
|
||||||
|
@ -215,7 +210,7 @@ ptraceregrw(Regs *regs, char *name, uvlong *val, int isr)
|
||||||
addr = reg2linux(name);
|
addr = reg2linux(name);
|
||||||
if(~addr == 0){
|
if(~addr == 0){
|
||||||
if(isr){
|
if(isr){
|
||||||
*val = ~(uvlong)0;
|
*val = ~(ulong)0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
werrstr("register not available");
|
werrstr("register not available");
|
||||||
|
|
|
@ -13,7 +13,7 @@ struct LocRegs
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
locregrw(Regs *regs, char *name, uvlong *val, int isr)
|
locregrw(Regs *regs, char *name, ulong *val, int isr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
LocRegs *lr;
|
LocRegs *lr;
|
||||||
|
@ -36,7 +36,7 @@ stacktrace(Map *map, Regs *regs, Tracer trace)
|
||||||
{
|
{
|
||||||
char *rname;
|
char *rname;
|
||||||
int i, ipc, ret;
|
int i, ipc, ret;
|
||||||
uvlong nextpc, pc, v;
|
ulong nextpc, pc, v;
|
||||||
ulong *cur, *next;
|
ulong *cur, *next;
|
||||||
LocRegs lr;
|
LocRegs lr;
|
||||||
Symbol s, *sp;
|
Symbol s, *sp;
|
||||||
|
|
|
@ -70,7 +70,7 @@ lget1(Map *map, Regs *regs, Loc loc, uchar *a, uint n)
|
||||||
int
|
int
|
||||||
lget2(Map *map, Regs *regs, Loc loc, u16int *u)
|
lget2(Map *map, Regs *regs, Loc loc, u16int *u)
|
||||||
{
|
{
|
||||||
uvlong ul;
|
ulong ul;
|
||||||
|
|
||||||
if(locsimplify(map, regs, loc, &loc) < 0)
|
if(locsimplify(map, regs, loc, &loc) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -93,7 +93,7 @@ lget2(Map *map, Regs *regs, Loc loc, u16int *u)
|
||||||
int
|
int
|
||||||
lget4(Map *map, Regs *regs, Loc loc, u32int *u)
|
lget4(Map *map, Regs *regs, Loc loc, u32int *u)
|
||||||
{
|
{
|
||||||
uvlong ul;
|
ulong ul;
|
||||||
|
|
||||||
if(locsimplify(map, regs, loc, &loc) < 0)
|
if(locsimplify(map, regs, loc, &loc) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -116,7 +116,7 @@ lget4(Map *map, Regs *regs, Loc loc, u32int *u)
|
||||||
int
|
int
|
||||||
lget8(Map *map, Regs *regs, Loc loc, u64int *u)
|
lget8(Map *map, Regs *regs, Loc loc, u64int *u)
|
||||||
{
|
{
|
||||||
uvlong ul;
|
ulong ul;
|
||||||
|
|
||||||
if(locsimplify(map, regs, loc, &loc) < 0)
|
if(locsimplify(map, regs, loc, &loc) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -188,7 +188,7 @@ lput8(Map *map, Regs *regs, Loc loc, u64int u)
|
||||||
}
|
}
|
||||||
|
|
||||||
Loc
|
Loc
|
||||||
locaddr(uvlong addr)
|
locaddr(ulong addr)
|
||||||
{
|
{
|
||||||
Loc l;
|
Loc l;
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ locaddr(uvlong addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
Loc
|
Loc
|
||||||
locindir(char *reg, vlong offset)
|
locindir(char *reg, long offset)
|
||||||
{
|
{
|
||||||
Loc l;
|
Loc l;
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ locindir(char *reg, vlong offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
Loc
|
Loc
|
||||||
locconst(uvlong con)
|
locconst(ulong con)
|
||||||
{
|
{
|
||||||
Loc l;
|
Loc l;
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
#include <bio.h>
|
#include <bio.h>
|
||||||
#include <mach.h>
|
#include <mach.h>
|
||||||
|
|
||||||
static int fdrw(Map*, Seg*, uvlong, void*, uint, int);
|
static int fdrw(Map*, Seg*, ulong, void*, uint, int);
|
||||||
static int zerorw(Map*, Seg*, uvlong, void*, uint, int);
|
static int zerorw(Map*, Seg*, ulong, void*, uint, int);
|
||||||
static int mrw(Map*, uvlong, void*, uint, int);
|
static int mrw(Map*, ulong, void*, uint, int);
|
||||||
static int datarw(Map*, Seg*, uvlong, void*, uint, int);
|
static int datarw(Map*, Seg*, ulong, void*, uint, int);
|
||||||
|
|
||||||
Map*
|
Map*
|
||||||
allocmap(void)
|
allocmap(void)
|
||||||
|
@ -71,7 +71,7 @@ findseg(Map *map, char *name, char *file)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
addrtoseg(Map *map, uvlong addr, Seg *sp)
|
addrtoseg(Map *map, ulong addr, Seg *sp)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Seg *s;
|
Seg *s;
|
||||||
|
@ -93,7 +93,7 @@ addrtoseg(Map *map, uvlong addr, Seg *sp)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
addrtosegafter(Map *map, uvlong addr, Seg *sp)
|
addrtosegafter(Map *map, ulong addr, Seg *sp)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Seg *s, *best;
|
Seg *s, *best;
|
||||||
|
@ -142,13 +142,13 @@ removeseg(Map *map, int i)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
get1(Map *map, uvlong addr, uchar *a, uint n)
|
get1(Map *map, ulong addr, uchar *a, uint n)
|
||||||
{
|
{
|
||||||
return mrw(map, addr, a, n, 1);
|
return mrw(map, addr, a, n, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
get2(Map *map, uvlong addr, u16int *u)
|
get2(Map *map, ulong addr, u16int *u)
|
||||||
{
|
{
|
||||||
u16int v;
|
u16int v;
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ get2(Map *map, uvlong addr, u16int *u)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
get4(Map *map, uvlong addr, u32int *u)
|
get4(Map *map, ulong addr, u32int *u)
|
||||||
{
|
{
|
||||||
u32int v;
|
u32int v;
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ get4(Map *map, uvlong addr, u32int *u)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
get8(Map *map, uvlong addr, u64int *u)
|
get8(Map *map, ulong addr, u64int *u)
|
||||||
{
|
{
|
||||||
u64int v;
|
u64int v;
|
||||||
|
|
||||||
|
@ -181,37 +181,37 @@ get8(Map *map, uvlong addr, u64int *u)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
put1(Map *map, uvlong addr, uchar *a, uint n)
|
put1(Map *map, ulong addr, uchar *a, uint n)
|
||||||
{
|
{
|
||||||
return mrw(map, addr, a, n, 0);
|
return mrw(map, addr, a, n, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
put2(Map *map, uvlong addr, u16int u)
|
put2(Map *map, ulong addr, u16int u)
|
||||||
{
|
{
|
||||||
u = mach->swap2(u);
|
u = mach->swap2(u);
|
||||||
return mrw(map, addr, &u, 2, 0);
|
return mrw(map, addr, &u, 2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
put4(Map *map, uvlong addr, u32int u)
|
put4(Map *map, ulong addr, u32int u)
|
||||||
{
|
{
|
||||||
u = mach->swap4(u);
|
u = mach->swap4(u);
|
||||||
return mrw(map, addr, &u, 4, 0);
|
return mrw(map, addr, &u, 4, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
put8(Map *map, uvlong addr, u64int u)
|
put8(Map *map, ulong addr, u64int u)
|
||||||
{
|
{
|
||||||
u = mach->swap8(u);
|
u = mach->swap8(u);
|
||||||
return mrw(map, addr, &u, 8, 0);
|
return mrw(map, addr, &u, 8, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Seg*
|
static Seg*
|
||||||
reloc(Map *map, uvlong addr, uint n, uvlong *off, uint *nn)
|
reloc(Map *map, ulong addr, uint n, ulong *off, uint *nn)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
uvlong o;
|
ulong o;
|
||||||
|
|
||||||
if(map == nil){
|
if(map == nil){
|
||||||
werrstr("invalid map");
|
werrstr("invalid map");
|
||||||
|
@ -236,12 +236,12 @@ reloc(Map *map, uvlong addr, uint n, uvlong *off, uint *nn)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mrw(Map *map, uvlong addr, void *a, uint n, int r)
|
mrw(Map *map, ulong addr, void *a, uint n, int r)
|
||||||
{
|
{
|
||||||
uint nn;
|
uint nn;
|
||||||
uint tot;
|
uint tot;
|
||||||
Seg *s;
|
Seg *s;
|
||||||
uvlong off;
|
ulong off;
|
||||||
|
|
||||||
for(tot=0; tot<n; tot+=nn){
|
for(tot=0; tot<n; tot+=nn){
|
||||||
s = reloc(map, addr+tot, n-tot, &off, &nn);
|
s = reloc(map, addr+tot, n-tot, &off, &nn);
|
||||||
|
@ -254,11 +254,11 @@ mrw(Map *map, uvlong addr, void *a, uint n, int r)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fdrw(Map *map, Seg *seg, uvlong addr, void *a, uint n, int r)
|
fdrw(Map *map, Seg *seg, ulong addr, void *a, uint n, int r)
|
||||||
{
|
{
|
||||||
int nn;
|
int nn;
|
||||||
uint tot;
|
uint tot;
|
||||||
uvlong off;
|
ulong off;
|
||||||
|
|
||||||
USED(map);
|
USED(map);
|
||||||
off = seg->offset + addr;
|
off = seg->offset + addr;
|
||||||
|
@ -279,7 +279,7 @@ fdrw(Map *map, Seg *seg, uvlong addr, void *a, uint n, int r)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
zerorw(Map *map, Seg *seg, uvlong addr, void *a, uint n, int r)
|
zerorw(Map *map, Seg *seg, ulong addr, void *a, uint n, int r)
|
||||||
{
|
{
|
||||||
USED(map);
|
USED(map);
|
||||||
USED(seg);
|
USED(seg);
|
||||||
|
@ -294,7 +294,7 @@ zerorw(Map *map, Seg *seg, uvlong addr, void *a, uint n, int r)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
datarw(Map *map, Seg *seg, uvlong addr, void *a, uint n, int r)
|
datarw(Map *map, Seg *seg, ulong addr, void *a, uint n, int r)
|
||||||
{
|
{
|
||||||
USED(map);
|
USED(map);
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ OFILES=\
|
||||||
symmacho.$O\
|
symmacho.$O\
|
||||||
symstabs.$O\
|
symstabs.$O\
|
||||||
|
|
||||||
HFILES=$PLAN9/include/mach.h
|
HFILES=mach.h
|
||||||
|
|
||||||
<$PLAN9/src/mksyslib
|
<$PLAN9/src/mksyslib
|
||||||
CFLAGS=$CFLAGS -I.
|
CFLAGS=$CFLAGS -I.
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <mach.h>
|
#include <mach.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
rput(Regs *regs, char *name, uvlong u)
|
rput(Regs *regs, char *name, ulong u)
|
||||||
{
|
{
|
||||||
if(regs == nil){
|
if(regs == nil){
|
||||||
werrstr("registers not mapped");
|
werrstr("registers not mapped");
|
||||||
|
@ -13,7 +13,7 @@ rput(Regs *regs, char *name, uvlong u)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
rget(Regs *regs, char *name, uvlong *u)
|
rget(Regs *regs, char *name, ulong *u)
|
||||||
{
|
{
|
||||||
if(regs == nil){
|
if(regs == nil){
|
||||||
*u = ~(ulong)0;
|
*u = ~(ulong)0;
|
||||||
|
@ -24,7 +24,7 @@ rget(Regs *regs, char *name, uvlong *u)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
_uregrw(Regs *regs, char *name, uvlong *u, int isr)
|
_uregrw(Regs *regs, char *name, ulong *u, int isr)
|
||||||
{
|
{
|
||||||
Regdesc *r;
|
Regdesc *r;
|
||||||
uchar *ureg;
|
uchar *ureg;
|
||||||
|
@ -41,7 +41,7 @@ _uregrw(Regs *regs, char *name, uvlong *u, int isr)
|
||||||
switch(r->format){
|
switch(r->format){
|
||||||
default:
|
default:
|
||||||
case 'X':
|
case 'X':
|
||||||
*u = mach->swap4(*(ulong*)ureg);
|
*u = mach->swap4(*(u32int*)ureg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,11 +323,11 @@ dwarftosym(Fhdr *fp, Dwarf *d, DwarfSym *ds, Symbol *s, int infn)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dwarfeval(Dwarf *d, Map *map, Regs *regs, ulong cfa, int rno, DwarfExpr e, uvlong *u)
|
dwarfeval(Dwarf *d, Map *map, Regs *regs, ulong cfa, int rno, DwarfExpr e, ulong *u)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
u32int u4;
|
u32int u4;
|
||||||
uvlong uu;
|
ulong uu;
|
||||||
|
|
||||||
switch(e.type){
|
switch(e.type){
|
||||||
case RuleUndef:
|
case RuleUndef:
|
||||||
|
@ -400,7 +400,7 @@ _dwarfunwind(Fhdr *fhdr, Map *map, Regs *regs, ulong *next)
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
int i, j;
|
int i, j;
|
||||||
uvlong cfa, pc, u;
|
ulong cfa, pc, u;
|
||||||
Dwarf *d;
|
Dwarf *d;
|
||||||
DwarfExpr *e, epc, ecfa;
|
DwarfExpr *e, epc, ecfa;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue