pc64: fix note handling

This commit is contained in:
cinap_lenrek 2014-02-06 22:43:33 +01:00
parent bfbc5ab197
commit c065eadb53
6 changed files with 23 additions and 6 deletions

View file

@ -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))

View file

@ -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);

View file

@ -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();

View file

@ -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);

View file

@ -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

View file

@ -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;