Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Jan 2008 13:14:36 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Warner Losh <imp@freebsd.org>
Cc:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   Re: PERFORCE change 132425 for review
Message-ID:  <200801041314.36713.jhb@freebsd.org>
In-Reply-To: <200801032108.m03L8GQA029462@repoman.freebsd.org>
References:  <200801032108.m03L8GQA029462@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 03 January 2008 04:08:16 pm Warner Losh wrote:
> http://perforce.freebsd.org/chv.cgi?CH=132425
> 
> Change 132425 by imp@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801041314.36713.jhb>