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;
|
up->psstate = 0;
|
||||||
|
|
||||||
if(scallnr == NOTED)
|
if(scallnr == NOTED)
|
||||||
noted(ureg, up->s.args[0]);
|
noted(ureg, *((ulong*)up->s.args));
|
||||||
|
|
||||||
splhi();
|
splhi();
|
||||||
if(scallnr != RFORK && (up->procctl || up->nnote))
|
if(scallnr != RFORK && (up->procctl || up->nnote))
|
||||||
|
|
|
@ -370,7 +370,7 @@ syscall(Ureg *ureg)
|
||||||
up->psstate = nil;
|
up->psstate = nil;
|
||||||
|
|
||||||
if(scall == NOTED)
|
if(scall == NOTED)
|
||||||
noted(ureg, up->s.args[0]);
|
noted(ureg, *((ulong*)up->s.args));
|
||||||
if(scall != RFORK && (up->procctl || up->nnote)){
|
if(scall != RFORK && (up->procctl || up->nnote)){
|
||||||
splhi();
|
splhi();
|
||||||
notify(ureg);
|
notify(ureg);
|
||||||
|
|
|
@ -799,7 +799,7 @@ syscall(Ureg* ureg)
|
||||||
up->psstate = 0;
|
up->psstate = 0;
|
||||||
|
|
||||||
if(scallnr == NOTED)
|
if(scallnr == NOTED)
|
||||||
noted(ureg, up->s.args[0]);
|
noted(ureg, *((ulong*)up->s.args));
|
||||||
|
|
||||||
if(scallnr!=RFORK && (up->procctl || up->nnote)){
|
if(scallnr!=RFORK && (up->procctl || up->nnote)){
|
||||||
splhi();
|
splhi();
|
||||||
|
|
|
@ -104,6 +104,7 @@ uintptr *mmuwalk(uintptr*, uintptr, int, int);
|
||||||
int mtrr(uvlong, uvlong, char *);
|
int mtrr(uvlong, uvlong, char *);
|
||||||
void mtrrclock(void);
|
void mtrrclock(void);
|
||||||
int mtrrprint(char *, long);
|
int mtrrprint(char *, long);
|
||||||
|
void noteret(void);
|
||||||
uchar nvramread(int);
|
uchar nvramread(int);
|
||||||
void nvramwrite(int, uchar);
|
void nvramwrite(int, uchar);
|
||||||
void outb(int, int);
|
void outb(int, int);
|
||||||
|
|
|
@ -737,6 +737,10 @@ TEXT forkret(SB), 1, $-4
|
||||||
|
|
||||||
BYTE $0x48; SYSRET /* SYSRETQ */
|
BYTE $0x48; SYSRET /* SYSRETQ */
|
||||||
|
|
||||||
|
TEXT noteret(SB), 1, $-4
|
||||||
|
CLI
|
||||||
|
JMP _intrestore
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Interrupt/exception handling.
|
* Interrupt/exception handling.
|
||||||
*/
|
*/
|
||||||
|
@ -786,6 +790,7 @@ _intrnested:
|
||||||
PUSHQ SP
|
PUSHQ SP
|
||||||
CALL trap(SB)
|
CALL trap(SB)
|
||||||
|
|
||||||
|
_intrestore:
|
||||||
POPQ AX
|
POPQ AX
|
||||||
|
|
||||||
POPQ AX
|
POPQ AX
|
||||||
|
|
|
@ -758,8 +758,19 @@ syscall(Ureg* ureg)
|
||||||
up->insyscall = 0;
|
up->insyscall = 0;
|
||||||
up->psstate = 0;
|
up->psstate = 0;
|
||||||
|
|
||||||
if(scallnr == NOTED)
|
if(scallnr == NOTED){
|
||||||
noted(ureg, up->s.args[0]);
|
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)){
|
if(scallnr!=RFORK && (up->procctl || up->nnote)){
|
||||||
splhi();
|
splhi();
|
||||||
|
@ -904,7 +915,7 @@ if(0) print("%s %lud: noted %#p %#p\n",
|
||||||
pprint("suicide: trap in noted\n");
|
pprint("suicide: trap in noted\n");
|
||||||
pexit("Suicide", 0);
|
pexit("Suicide", 0);
|
||||||
}
|
}
|
||||||
up->ureg = (Ureg*)(*(ulong*)(oureg-BY2WD));
|
up->ureg = (Ureg*)(*(uintptr*)(oureg-BY2WD));
|
||||||
qunlock(&up->debug);
|
qunlock(&up->debug);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue