nf->arg0 = &nf->ureg;
nf->ip = 0;
cur->sp = PTR2UINT(nf);
+ cur->r0 = PTR2UINT(nf->arg0);
break;
default:
- pprint("unknown noted arg %#p\n", arg0);
up->lastnote.flag = NDebug;
/*FALLTHROUGH*/
case NDFLT:
- if(up->lastnote.flag == NDebug){
- qunlock(&up->debug);
+ qunlock(&up->debug);
+ if(up->lastnote.flag == NDebug)
pprint("suicide: %s\n", up->lastnote.msg);
- }
- else
- qunlock(&up->debug);
pexit(up->lastnote.msg, up->lastnote.flag != NDebug);
}
}
NFrame *nf;
if(up->procctl)
- procctl(up);
+ procctl();
if(up->nnote == 0)
return 0;
}
if(n->flag != NUser && (up->notified || up->notify == 0)){
+ qunlock(&up->debug);
if(n->flag == NDebug)
pprint("suicide: %s\n", n->msg);
- qunlock(&up->debug);
pexit(n->msg, n->flag != NDebug);
}
pexit(n->msg, n->flag != NDebug);
}
if(!okaddr(PTR2UINT(up->notify), 1, 0)){
- pprint("suicide: notify function address %#p\n", up->notify);
qunlock(&up->debug);
+ pprint("suicide: notify function address %#p\n", up->notify);
pexit("Suicide", 0);
}
ureg->sp = sp;
ureg->pc = PTR2UINT(up->notify);
+ ureg->r0 = PTR2UINT(nf->arg0);
+
up->notified = 1;
up->nnote--;
memmove(&up->lastnote, &up->note[0], sizeof(Note));
scallnr = ureg->r0;
up->scallnr = scallnr;
- if(scallnr == RFORK)
- fpusysrfork(ureg);
spllo();
sp = ureg->sp;
- if(up->procctl == Proc_tracesyscall){
- /*
- * Redundant validaddr. Do we care?
- * Tracing syscalls is not exactly a fast path...
- * Beware, validaddr currently does a pexit rather
- * than an error if there's a problem; that might
- * change in the future.
- */
- if(sp < (USTKTOP-BY2PG) || sp > (USTKTOP-sizeof(Sargs)-BY2WD))
- validaddr(sp, sizeof(Sargs)+BY2WD, 0);
-
- syscallfmt(scallnr, ureg->pc, (va_list)(sp+BY2WD));
- up->procctl = Proc_stopme;
- procctl(up);
- if (up->syscalltrace)
- free(up->syscalltrace);
- up->syscalltrace = nil;
- }
-
up->nerrlab = 0;
ret = -1;
- startns = todget(nil);
if(!waserror()){
+ if(sp < (USTKTOP-BY2PG) || sp > (USTKTOP-sizeof(Sargs)-BY2WD))
+ validaddr(sp, sizeof(Sargs)+BY2WD, 0);
+ up->s = *((Sargs*)(sp+BY2WD));
+ if(up->procctl == Proc_tracesyscall){
+ syscallfmt(scallnr, ureg->pc, (va_list)up->s.args);
+ s = splhi();
+ up->procctl = Proc_stopme;
+ procctl();
+ splx(s);
+ startns = todget(nil);
+ }
if(scallnr >= nsyscall){
pprint("bad sys call number %d pc %#lux\n",
scallnr, ureg->pc);
postnote(up, 1, "sys: bad sys call", NDebug);
error(Ebadarg);
}
-
- if(sp < (USTKTOP-BY2PG) || sp > (USTKTOP-sizeof(Sargs)-BY2WD))
- validaddr(sp, sizeof(Sargs)+BY2WD, 0);
-
- up->s = *((Sargs*)(sp+BY2WD));
up->psstate = sysctab[scallnr];
/* iprint("%s: syscall %s\n", up->text, sysctab[scallnr]?sysctab[scallnr]:"huh?"); */
- ret = systab[scallnr](up->s.args);
+ ret = systab[scallnr]((va_list)up->s.args);
poperror();
}else{
/* failure: save the error buffer for errstr */
if(up->procctl == Proc_tracesyscall){
stopns = todget(nil);
- up->procctl = Proc_stopme;
- sysretfmt(scallnr, (va_list)(sp+BY2WD), ret, startns, stopns);
+ sysretfmt(scallnr, (va_list)up->s.args, ret, startns, stopns);
s = splhi();
- procctl(up);
+ up->procctl = Proc_stopme;
+ procctl();
splx(s);
- if(up->syscalltrace)
- free(up->syscalltrace);
- up->syscalltrace = nil;
}
up->insyscall = 0;
up->psstate = 0;
if(scallnr == NOTED)
- noted(ureg, *(ulong*)(sp+BY2WD));
+ noted(ureg, *((ulong*)up->s.args));
splhi();
if(scallnr != RFORK && (up->procctl || up->nnote))
kexit(ureg);
}
-long
-execregs(ulong entry, ulong ssize, ulong nargs)
+uintptr
+execregs(uintptr entry, ulong ssize, ulong nargs)
{
ulong *sp;
Ureg *ureg;
/* Things from bottom of syscall which were never executed */
p->psstate = 0;
p->insyscall = 0;
-
- fpusysrforkchild(p, cureg, up);
}