loadustp(): Optimize for the overwhelmingly common case of "not the HP MMU".

Rather than converting the level 1 table address to a page number before
calling loadustp() only to have loadustp() convert it back to an address
for the '851, '030, '040, and '060, instead pass the address and convert
to a page number only in the case of the HP MMU.

This is a wash on HP MMU machines (9000/320 and 9000/350), and saves at
least 4 instructions (2x moveq + 2x lsXl) on every context switch on
everything else.
This commit is contained in:
thorpej 2023-12-25 21:32:56 +00:00
parent 907ef1d191
commit ea86bfe41b
11 changed files with 20 additions and 34 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.161 2022/05/30 09:56:02 andvar Exp $ */
/* $NetBSD: locore.s,v 1.162 2023/12/25 21:32:56 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -1124,8 +1124,6 @@ ENTRY(probeva)
*/
ENTRY(loadustp)
movl %sp@(4),%d0 | new USTP
moveq #PGSHIFT,%d1
lsll %d1,%d0 | convert to addr
#ifdef M68060
cmpl #CPU_68060,_C_LABEL(cputype) | 68060?
jeq Lldustp060 | yes, skip

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.117 2023/01/06 10:28:27 tsutsui Exp $ */
/* $NetBSD: locore.s,v 1.118 2023/12/25 21:32:56 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -1141,8 +1141,6 @@ ENTRY(probeva)
*/
ENTRY(loadustp)
movl %sp@(4),%d0 | new USTP
moveq #PGSHIFT,%d1
lsll %d1,%d0 | convert to addr
#if defined(M68060)
cmpl #CPU_68060,_C_LABEL(cputype) | 68060?
jeq Lldustp060 | yes, skip

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.34 2022/05/30 09:56:03 andvar Exp $ */
/* $NetBSD: locore.s,v 1.35 2023/12/25 21:32:56 thorpej Exp $ */
/*
* Copyright (c) 1980, 1990, 1993
@ -805,8 +805,6 @@ ENTRY(loadustp)
tstl _C_LABEL(mmutype) | HP MMU?
jeq Lhpmmu9 | yes, skip
movl %sp@(4),%d0 | new USTP
moveq #PGSHIFT,%d1
lsll %d1,%d0 | convert to addr
#if defined(M68040)
cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
jne LmotommuC | no, skip
@ -834,7 +832,10 @@ Lhpmmu9:
andl #~MMU_CEN,%a0@(MMUCMD) | toggle cache enable
orl #MMU_CEN,%a0@(MMUCMD) | to clear data cache
1:
movl %sp@(4),%a0@(MMUUSTP) | load a new USTP
movl %sp@(4),%d0
moveq #PGSHIFT,%d1
lsrl %d1,%d0 | convert to page frame
movl %d0,%a0@(MMUUSTP) | load a new USTP
#endif
rts

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.174 2023/10/14 15:31:36 tsutsui Exp $ */
/* $NetBSD: locore.s,v 1.175 2023/12/25 21:32:57 thorpej Exp $ */
/*
* Copyright (c) 1980, 1990, 1993
@ -1087,8 +1087,6 @@ ENTRY(loadustp)
tstl _C_LABEL(mmutype) | HP MMU?
jeq Lhpmmu9 | yes, skip
movl %sp@(4),%d0 | new USTP
moveq #PGSHIFT,%d1
lsll %d1,%d0 | convert to addr
#if defined(M68040)
cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
jne LmotommuC | no, skip
@ -1116,7 +1114,10 @@ Lhpmmu9:
andl #~MMU_CEN,%a0@(MMUCMD) | toggle cache enable
orl #MMU_CEN,%a0@(MMUCMD) | to clear data cache
1:
movl %sp@(4),%a0@(MMUUSTP) | load a new USTP
movl %sp@(4),%d0
moveq #PGSHIFT,%d1
lsrl %d1,%d0 | convert to page frame
movl %d0,%a0@(MMUUSTP) | load a new USTP
#endif
rts

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.68 2022/06/10 21:42:24 tsutsui Exp $ */
/* $NetBSD: locore.s,v 1.69 2023/12/25 21:32:57 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -784,8 +784,6 @@ ENTRY(ecacheoff)
*/
ENTRY(loadustp)
movl %sp@(4),%d0 | new USTP
moveq #PGSHIFT,%d1
lsll %d1,%d0 | convert to addr
#if defined(M68040)
cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
jne LmotommuC | no, skip

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap_motorola.h,v 1.38 2023/09/26 12:46:30 tsutsui Exp $ */
/* $NetBSD: pmap_motorola.h,v 1.39 2023/12/25 21:32:57 thorpej Exp $ */
/*
* Copyright (c) 1991, 1993
@ -176,7 +176,7 @@ struct pmap {
#define PMAP_ACTIVATE(pmap, loadhw) \
{ \
if ((loadhw)) \
loadustp(m68k_btop((paddr_t)(pmap)->pm_stpa)); \
loadustp((paddr_t)(pmap)->pm_stpa); \
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.175 2022/05/30 09:56:03 andvar Exp $ */
/* $NetBSD: locore.s,v 1.176 2023/12/25 21:32:57 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -956,8 +956,6 @@ ENTRY(ecacheoff)
*/
ENTRY(loadustp)
movl %sp@(4),%d0 | new USTP
moveq #PGSHIFT,%d1
lsll %d1,%d0 | convert to addr
#if defined(M68040)
cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
jne LmotommuC | no, skip

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.118 2022/05/30 09:56:03 andvar Exp $ */
/* $NetBSD: locore.s,v 1.119 2023/12/25 21:32:57 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -1097,8 +1097,6 @@ ENTRY_NOPROFILE(getsp)
*/
ENTRY(loadustp)
movl %sp@(4),%d0 | new USTP
moveq #PGSHIFT, %d1
lsll %d1,%d0 | convert to addr
#if defined(M68040) || defined(M68060)
cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
jne LmotommuC | no, skip

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.71 2023/10/15 10:46:51 tsutsui Exp $ */
/* $NetBSD: locore.s,v 1.72 2023/12/25 21:32:57 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -896,8 +896,6 @@ Lnocache8:
*/
ENTRY(loadustp)
movl %sp@(4),%d0 | new USTP
moveq #PGSHIFT, %d1
lsll %d1,%d0 | convert to addr
pflusha | flush entire TLB
lea _C_LABEL(protorp),%a0 | CRP prototype
movl %d0,%a0@(4) | stash USTP

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.73 2023/06/16 20:01:20 andvar Exp $ */
/* $NetBSD: locore.s,v 1.74 2023/12/25 21:32:57 thorpej Exp $ */
/*
* Copyright (c) 1998 Darrin B. Jewell
@ -891,8 +891,6 @@ ENTRY(loadustp)
tstl _C_LABEL(mmutype) | HP MMU?
jeq Lhpmmu9 | yes, skip
movl %sp@(4),%d0 | new USTP
moveq #PGSHIFT,%d1
lsll %d1,%d0 | convert to addr
#if defined(M68040)
cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
jne LmotommuC | no, skip

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.122 2023/09/17 07:22:17 andvar Exp $ */
/* $NetBSD: locore.s,v 1.123 2023/12/25 21:32:58 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -833,8 +833,6 @@ ENTRY(ecacheoff)
*/
ENTRY(loadustp)
movl %sp@(4),%d0 | new USTP
moveq #PGSHIFT,%d1
lsll %d1,%d0 | convert to addr
#if defined(M68040) || defined(M68060)
cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
jne LmotommuC | no, skip