Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/arch/evbmips/conf



On Tue, Aug 08, 2017 at 12:22:21PM +0000, Maya Rashish wrote:
> This only need to be performed on kernel code, because only there we can have
> accesses not translated/limited by TLB. For user code, it is impossible to
> generate accesses to unwanted physical address. So it is safe.
> 
> Also, to prevent addresses generated by user mode code to be used by the
> kernel, we add a few empty jumps to flush the BTB upon entrance to kernel."

Currently we do not do the empty jumps. the code claims it is flushing
the BTB but it's hard to tell as the docs are in Chinese.

Linux does this:
		/*
		 * Clear BTB (branch target buffer), forbid RAS (return address
		 * stack) to workaround the Out-of-order Issue in Loongson2F
		 * via its diagnostic register.
		 */
		move	k0, ra
		jal	1f
		 nop
1:		jal	1f
		 nop
1:		jal	1f
		 nop
1:		jal	1f
		 nop
1:		move	ra, k0
		li	k0, 3
		mtc0	k0, $22

I've changed the code be effectively:
li k0, 3
mtc0 k0 $22

Also not sure if it's necessary to do on user_return...


Home | Main Index | Thread Index | Old Index