PERFORCE change 132425 for review

John Baldwin jhb at freebsd.org
Fri Jan 4 10:17:26 PST 2008


On Thursday 03 January 2008 04:08:16 pm Warner Losh wrote:
> http://perforce.freebsd.org/chv.cgi?CH=132425
> 
> Change 132425 by imp at imp_paco-paco on 2008/01/03 21:08:04
> 
> 	Trap compiles now.  not 100% sure of the changes, so we should have
> 	many eyes look here...
> 
> Affected files ...
> 
> .. //depot/projects/mips2-jnpr/src/sys/mips/mips/trap.c#5 edit
> 
> Differences ...
> 
> ==== //depot/projects/mips2-jnpr/src/sys/mips/mips/trap.c#5 (text+ko) ====
> 
> @@ -824,7 +811,7 @@
>  		STOPEVENT(p, S_SCX, code);
>  
>  		PTRACESTOP_SC(p, td, S_PT_SCX);
> -
> +#ifdef GONE_IN_7
>  		WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning",
>  		    (code >= 0 && code < SYS_MAXSYSCALL) ?
>  		    syscallnames[code] : "???");

The witness warn should still be around in 7, but it is a bit earlier after 
the system call returns just before calling userret().

> @@ -833,7 +820,7 @@
>  		if (curthread->td_flags & (TDF_ASTPENDING|TDF_NEEDRESCHED)) {
>  			ast(trapframe);
>  		}
> -
> +#endif

ast() is also still relevant in 7 as well.  What normally happens is that you 
have the following in assembly:

trap_entry:
	setup regs
	call trap
	jmp  exittrap

syscall_entry:
	setup regs
	call syscall
	jmp  exittrap

exittrap:
	get ready to return from trap
	disable interrupts
	if returning to kernel jmp kernel
asts:
	if no ASTs are pending jmp kernel
	enable interrupts
	call ast
	disable interrupts
	jmp asts
kernel:
	restore registers
	reti

or some such.  You could do it in C if you wanted, but the idea is you want to 
only return to userland once you've verified you have no ASTs with interrupts 
disabled.  If you get any AST's while returning to userland it's due to SMP 
and you will get an IPI that will post with 'reti' finishes.

-- 
John Baldwin


More information about the p4-projects mailing list