This commit is contained in:
Russ Cox 2012-03-05 16:36:31 -05:00
commit 4a000a28d3
12 changed files with 134 additions and 18 deletions

View file

@ -182,6 +182,119 @@ Ureg(addr) {
};
sizeofUreg = 184;
aggr freebsd_amd64_siginfo
{
'X' 0 signo;
'X' 4 errno;
'X' 8 code;
'X' 12 pid;
'X' 16 uid;
'X' 20 status;
'Y' 24 addr;
'Y' 32 sigval;
's' 40 reason;
};
defn
freebsd_amd64_siginfo(addr) {
complex freebsd_amd64_siginfo addr;
print(" signo ", addr.signo, "\n");
print(" errno ", addr.errno, "\n");
print(" code ", addr.code, "\n");
print(" pid ", addr.pid, "\n");
print(" uid ", addr.uid, "\n");
print(" status ", addr.status, "\n");
print(" addr ", addr.addr, "\n");
print(" sigval ", addr.sigval, "\n");
};
aggr freebsd_amd64_ucontext
{
'X' 0 sigmask0;
'X' 4 sigmask1;
'X' 8 sigmask2;
'X' 12 sigmask3;
'Y' 16 onstack;
'Y' 24 rdi;
'Y' 32 rsi;
'Y' 40 rdx;
'Y' 48 rcx;
'Y' 56 r8;
'Y' 64 r9;
'Y' 72 rax;
'Y' 80 rbx;
'Y' 88 rbp;
'Y' 96 r10;
'Y' 104 r11;
'Y' 112 r12;
'Y' 120 r13;
'Y' 128 r14;
'Y' 136 r15;
'X' 144 trapno;
'x' 148 fs;
'x' 150 gs;
'Y' 152 addr;
'X' 160 flags;
'x' 164 es;
'x' 166 ds;
'Y' 168 err;
'Y' 176 rip;
'Y' 184 cs;
'Y' 192 rflags;
'Y' 200 rsp;
'Y' 208 ss;
'Y' 216 len;
'Y' 224 fpformat;
'Y' 232 ownedfp;
'Y' 240 fpstate0;
'Y' 752 fsbase;
'Y' 760 gsbase;
};
defn
freebsd_amd64_ucontext(addr) {
complex freebsd_amd64_ucontext addr;
print(" sigmask0 ", addr.sigmask0, "\n");
print(" sigmask1 ", addr.sigmask1, "\n");
print(" sigmask2 ", addr.sigmask2, "\n");
print(" sigmask3 ", addr.sigmask3, "\n");
print(" onstack ", addr.onstack, "\n");
print(" rdi ", addr.rdi, "\n");
print(" rsi ", addr.rsi, "\n");
print(" rdx ", addr.rdx, "\n");
print(" rcx ", addr.rcx, "\n");
print(" r8 ", addr.r8, "\n");
print(" r9 ", addr.r9, "\n");
print(" rax ", addr.rax, "\n");
print(" rbx ", addr.rbx, "\n");
print(" rbp ", addr.rbp, "\n");
print(" r10 ", addr.r10, "\n");
print(" r11 ", addr.r11, "\n");
print(" r12 ", addr.r12, "\n");
print(" r13 ", addr.r13, "\n");
print(" r14 ", addr.r14, "\n");
print(" r15 ", addr.r15, "\n");
print(" trapno ", addr.trapno, "\n");
print(" fs ", addr.fs, "\n");
print(" gs ", addr.gs, "\n");
print(" addr ", addr.addr, "\n");
print(" flags ", addr.flags, "\n");
print(" es ", addr.es, "\n");
print(" ds ", addr.ds, "\n");
print(" err ", addr.err, "\n");
print(" rip ", addr.rip, "\n");
print(" cs ", addr.cs, "\n");
print(" rflags ", addr.rflags, "\n");
print(" rsp ", addr.rsp, "\n");
print(" ss ", addr.ss, "\n");
print(" len ", addr.len, "\n");
print(" fpformat ", addr.fpformat, "\n");
print(" ownedfp ", addr.ownedfp, "\n");
print(" fpstate0 ", addr.fpstate0, "\n");
print(" fsbase ", addr.fsbase, "\n");
print(" gsbase ", addr.gsbase, "\n");
}
// aggr Linkdebug
// {
// 'X' 0 version;

View file

@ -204,7 +204,7 @@ void call(char*, Node*, Node*, Node*, Node*);
void catcher(void*, char*);
void checkqid(int, int);
void cmd(void);
Node* con(int);
Node* con(s64int);
List* construct(Node*);
void ctrace(int);
void decl(Node*);
@ -217,12 +217,12 @@ Lsym* enter(char*, int);
void error(char*, ...);
void execute(Node*);
void fatal(char*, ...);
ulong findframe(ulong);
u64int findframe(u64int);
void flatten(Node**, Node*);
void gc(void);
char* getstatus(int);
void* gmalloc(long);
void indir(Map*, ulong, char, Node*);
void indir(Map*, u64int, char, Node*);
void indirreg(Regs*, char*, char, Node*);
void initexpr(void);
void initprint(void);
@ -251,7 +251,7 @@ void pstr(String*);
void pushfd(int);
void pushfile(char*);
void pushstr(Node*);
ulong raddr(char*);
u64int raddr(char*);
void readtext(char*);
void readcore(void);
void restartio(void);

View file

@ -866,7 +866,7 @@ cvtatoi(Node *r, Node *args)
r->op = OCONST;
r->type = TINT;
r->store.u.ival = strtoul(res.store.u.string->string, 0, 0);
r->store.u.ival = strtoull(res.store.u.string->string, 0, 0);
r->store.fmt = 'D';
}
@ -875,7 +875,7 @@ cvtitoa(Node *r, Node *args)
{
Node res;
Node *av[Maxarg];
int ival;
s64int ival;
char buf[128], *fmt;
if(args == 0)
@ -1030,7 +1030,7 @@ flatten(Node **av, Node *n)
static struct
{
char *name;
ulong val;
u64int val;
} sregs[Maxarg/2];
static int nsregs;

View file

@ -11,7 +11,7 @@
{
Node *node;
Lsym *sym;
ulong ival;
u64int ival;
float fval;
String *string;
}

View file

@ -28,7 +28,7 @@ odot(Node *n, Node *r)
char *s;
Type *t;
Node res;
ulong addr;
u64int addr;
s = n->sym->name;
if(s == 0)

View file

@ -203,7 +203,7 @@ convflt(Node *r, char *flt)
}
void
indir(Map *m, ulong addr, char fmt, Node *r)
indir(Map *m, u64int addr, char fmt, Node *r)
{
int i;
u32int ival;

View file

@ -1114,9 +1114,8 @@ acidregsrw(Regs *r, char *name, u64int *u, int isr)
}
addr = v->store.u.ival;
/* XXX should use format to determine size */
if(get4(cormap, addr, &u32) < 0)
if(geta(cormap, addr, u) < 0)
return -1;
*u = u32;
return 0;
}
}

View file

@ -588,9 +588,9 @@ numsym(char first)
}
if(isbin)
yylval.ival = strtoul(symbol+2, 0, 2);
yylval.ival = strtoull(symbol+2, 0, 2);
else
yylval.ival = strtoul(symbol, 0, 0);
yylval.ival = strtoll(symbol, 0, 0);
return Tconst;
}

View file

@ -365,7 +365,7 @@ al(int t)
}
Node*
con(int v)
con(s64int v)
{
Node *n;

View file

@ -73,7 +73,7 @@ addvarsym(Fhdr *fp)
Symbol s;
Lsym *l;
String *file;
ulong v;
u64int v;
char buf[65536]; /* Some of those C++ names are really big */
List *list, **tail, *tl;

View file

@ -113,7 +113,8 @@ elfcorefreebsdamd64(Fhdr *fp, Elf *elf, ElfNote *note)
u->flags = l->rflags;
u->sp = l->rsp;
u->ss = l->ss;
print("core PC=%#llux SP=%#llux\n", u->ip, u->sp);
if((fp->thread = realloc(fp->thread, (1+fp->nthread)*sizeof(fp->thread[0]))) == nil){
fprint(2, "warning: out of memory saving thread info\n");
return;

View file

@ -27,7 +27,7 @@ int
rget(Regs *regs, char *name, u64int *u)
{
if(regs == nil){
*u = ~(ulong)0;
*u = ~(u64int)0;
werrstr("registers not mapped");
return -1;
}
@ -54,6 +54,9 @@ _uregrw(Regs *regs, char *name, u64int *u, int isr)
case 'X':
*u = mach->swap4(*(u32int*)ureg);
return 0;
case 'Y':
*u = mach->swap8(*(u64int*)ureg);
return 0;
}
}