pc64: fix note handling
This commit is contained in:
parent
bfbc5ab197
commit
c065eadb53
6 changed files with 23 additions and 6 deletions
|
@ -261,7 +261,7 @@ syscall(Ureg* ureg)
|
|||
up->psstate = 0;
|
||||
|
||||
if(scallnr == NOTED)
|
||||
noted(ureg, up->s.args[0]);
|
||||
noted(ureg, *((ulong*)up->s.args));
|
||||
|
||||
splhi();
|
||||
if(scallnr != RFORK && (up->procctl || up->nnote))
|
||||
|
|
|
@ -370,7 +370,7 @@ syscall(Ureg *ureg)
|
|||
up->psstate = nil;
|
||||
|
||||
if(scall == NOTED)
|
||||
noted(ureg, up->s.args[0]);
|
||||
noted(ureg, *((ulong*)up->s.args));
|
||||
if(scall != RFORK && (up->procctl || up->nnote)){
|
||||
splhi();
|
||||
notify(ureg);
|
||||
|
|
|
@ -799,7 +799,7 @@ syscall(Ureg* ureg)
|
|||
up->psstate = 0;
|
||||
|
||||
if(scallnr == NOTED)
|
||||
noted(ureg, up->s.args[0]);
|
||||
noted(ureg, *((ulong*)up->s.args));
|
||||
|
||||
if(scallnr!=RFORK && (up->procctl || up->nnote)){
|
||||
splhi();
|
||||
|
|
|
@ -104,6 +104,7 @@ uintptr *mmuwalk(uintptr*, uintptr, int, int);
|
|||
int mtrr(uvlong, uvlong, char *);
|
||||
void mtrrclock(void);
|
||||
int mtrrprint(char *, long);
|
||||
void noteret(void);
|
||||
uchar nvramread(int);
|
||||
void nvramwrite(int, uchar);
|
||||
void outb(int, int);
|
||||
|
|
|
@ -737,6 +737,10 @@ TEXT forkret(SB), 1, $-4
|
|||
|
||||
BYTE $0x48; SYSRET /* SYSRETQ */
|
||||
|
||||
TEXT noteret(SB), 1, $-4
|
||||
CLI
|
||||
JMP _intrestore
|
||||
|
||||
/*
|
||||
* Interrupt/exception handling.
|
||||
*/
|
||||
|
@ -786,6 +790,7 @@ _intrnested:
|
|||
PUSHQ SP
|
||||
CALL trap(SB)
|
||||
|
||||
_intrestore:
|
||||
POPQ AX
|
||||
|
||||
POPQ AX
|
||||
|
|
|
@ -758,8 +758,19 @@ syscall(Ureg* ureg)
|
|||
up->insyscall = 0;
|
||||
up->psstate = 0;
|
||||
|
||||
if(scallnr == NOTED)
|
||||
noted(ureg, up->s.args[0]);
|
||||
if(scallnr == NOTED){
|
||||
noted(ureg, *((ulong*)up->s.args));
|
||||
|
||||
/*
|
||||
* normally, syscall() returns to forkret()
|
||||
* not restoring general registers when going
|
||||
* to userspace. to completely restore the
|
||||
* interrupted context, we have to return thru
|
||||
* noteret(). we override return pc to jump to
|
||||
* to it when returning form syscall()
|
||||
*/
|
||||
((void**)&ureg)[-1] = (void*)noteret;
|
||||
}
|
||||
|
||||
if(scallnr!=RFORK && (up->procctl || up->nnote)){
|
||||
splhi();
|
||||
|
@ -904,7 +915,7 @@ if(0) print("%s %lud: noted %#p %#p\n",
|
|||
pprint("suicide: trap in noted\n");
|
||||
pexit("Suicide", 0);
|
||||
}
|
||||
up->ureg = (Ureg*)(*(ulong*)(oureg-BY2WD));
|
||||
up->ureg = (Ureg*)(*(uintptr*)(oureg-BY2WD));
|
||||
qunlock(&up->debug);
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in a new issue