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))
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);
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();
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);
BYTE $0x48; SYSRET /* SYSRETQ */
+TEXT noteret(SB), 1, $-4
+ CLI
+ JMP _intrestore
+
/*
* Interrupt/exception handling.
*/
PUSHQ SP
CALL trap(SB)
+_intrestore:
POPQ AX
POPQ AX
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();
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;