Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/vax Support save/restore of AST levels in the PCB f...
details: https://anonhg.NetBSD.org/src/rev/7cc3962fd987
branches: trunk
changeset: 372610:7cc3962fd987
user: oster <oster%NetBSD.org@localhost>
date: Sun Dec 11 18:02:40 2022 +0000
description:
Support save/restore of AST levels in the PCB for context switching.
Code written by ragge@ , tested by oster@.
diffstat:
sys/arch/vax/include/cpu.h | 25 +++++++++++++++++++------
sys/arch/vax/include/pcb.h | 6 ++++--
sys/arch/vax/vax/pmap.c | 8 ++++----
sys/arch/vax/vax/trap.c | 5 +++--
4 files changed, 30 insertions(+), 14 deletions(-)
diffs (142 lines):
diff -r 7bd0de9da16f -r 7cc3962fd987 sys/arch/vax/include/cpu.h
--- a/sys/arch/vax/include/cpu.h Sun Dec 11 17:58:42 2022 +0000
+++ b/sys/arch/vax/include/cpu.h Sun Dec 11 18:02:40 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.105 2021/08/14 17:51:19 ryo Exp $ */
+/* $NetBSD: cpu.h,v 1.106 2022/12/11 18:02:40 oster Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden
@@ -157,9 +157,11 @@
#define curlwp ((struct lwp *)mfpr(PR_SSP))
#define cpu_number() (curcpu()->ci_cpuid)
#define cpu_need_resched(ci, l, flags) \
- do { \
- __USE(flags); \
- mtpr(AST_OK,PR_ASTLVL); \
+ do { \
+ struct pcb *pcb = lwp_getpcb(curlwp); \
+ __USE(flags); \
+ pcb->P0LR = (pcb->P0LR & ~AST_MASK) | AST_ON; \
+ mtpr(AST_OK,PR_ASTLVL); \
} while (/*CONSTCOND*/ 0)
#define cpu_proc_fork(x, y) do { } while (/*CONSCOND*/0)
@@ -198,7 +200,12 @@
* process as soon as possible.
*/
-#define cpu_signotify(l) mtpr(AST_OK,PR_ASTLVL)
+#define cpu_signotify(l) \
+ do { \
+ struct pcb *pcb = lwp_getpcb(l); \
+ pcb->P0LR = (pcb->P0LR & ~AST_MASK) | AST_ON; \
+ mtpr(AST_OK,PR_ASTLVL); \
+ } while (/*CONSTCOND*/ 0)
/*
@@ -206,7 +213,13 @@
* buffer pages are invalid. On the hp300, request an ast to send us
* through trap, marking the proc as needing a profiling tick.
*/
-#define cpu_need_proftick(l) do { (l)->l_pflag |= LP_OWEUPC; mtpr(AST_OK,PR_ASTLVL); } while (/*CONSTCOND*/ 0)
+#define cpu_need_proftick(l) \
+ do { \
+ struct pcb *pcb = lwp_getpcb(l); \
+ (l)->l_pflag |= LP_OWEUPC; \
+ pcb->P0LR = (pcb->P0LR & ~AST_MASK) | AST_ON; \
+ mtpr(AST_OK,PR_ASTLVL); \
+ } while (/*CONSTCOND*/ 0)
/*
* This defines the I/O device register space size in pages.
diff -r 7bd0de9da16f -r 7cc3962fd987 sys/arch/vax/include/pcb.h
--- a/sys/arch/vax/include/pcb.h Sun Dec 11 17:58:42 2022 +0000
+++ b/sys/arch/vax/include/pcb.h Sun Dec 11 18:02:40 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pcb.h,v 1.15 2017/05/22 17:12:11 ragge Exp $ */
+/* $NetBSD: pcb.h,v 1.16 2022/12/11 18:02:40 oster Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -49,6 +49,7 @@
long P0LR; /* Page 0 Length Register */
struct pte *P1BR; /* Page 1 Base Register */
long P1LR; /* Page 1 Length Register */
+ long ASN; /* Address space number */
/* Software registers, only used by kernel software */
void *pcb_onfault; /* Tells whether fault copy */
@@ -58,7 +59,8 @@
};
#define AST_MASK 0x07000000
-#define AST_PCB 0x04000000
+#define AST_PCB 0x04000000 /* disable AST */
+#define AST_ON 0x03000000 /* request AST */
/* machine-specific core dump; save trapframe */
struct md_coredump {
diff -r 7bd0de9da16f -r 7cc3962fd987 sys/arch/vax/vax/pmap.c
--- a/sys/arch/vax/vax/pmap.c Sun Dec 11 17:58:42 2022 +0000
+++ b/sys/arch/vax/vax/pmap.c Sun Dec 11 18:02:40 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.194 2022/02/11 17:26:55 riastradh Exp $ */
+/* $NetBSD: pmap.c,v 1.195 2022/12/11 18:02:40 oster Exp $ */
/*
* Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.194 2022/02/11 17:26:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.195 2022/12/11 18:02:40 oster Exp $");
#include "opt_ddb.h"
#include "opt_cputype.h"
@@ -552,7 +552,7 @@
for (pcb = pm->pm_pcbs; pcb != NULL; pcb = pcb->pcb_pmnext) {
KASSERT(pcb->pcb_pm == pm);
pcb->P0BR = pm->pm_p0br;
- pcb->P0LR = pm->pm_p0lr|AST_PCB;
+ pcb->P0LR = pm->pm_p0lr | (pcb->P0LR & AST_MASK);
pcb->P1BR = pm->pm_p1br;
pcb->P1LR = pm->pm_p1lr;
@@ -561,7 +561,7 @@
/* If curlwp uses this pmap update the regs too */
if (pm == curproc->p_vmspace->vm_map.pmap) {
mtpr((uintptr_t)pm->pm_p0br, PR_P0BR);
- mtpr(pm->pm_p0lr|AST_PCB, PR_P0LR);
+ mtpr(pm->pm_p0lr, PR_P0LR);
mtpr((uintptr_t)pm->pm_p1br, PR_P1BR);
mtpr(pm->pm_p1lr, PR_P1LR);
}
diff -r 7bd0de9da16f -r 7cc3962fd987 sys/arch/vax/vax/trap.c
--- a/sys/arch/vax/vax/trap.c Sun Dec 11 17:58:42 2022 +0000
+++ b/sys/arch/vax/vax/trap.c Sun Dec 11 18:02:40 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.136 2019/11/21 19:24:02 ad Exp $ */
+/* $NetBSD: trap.c,v 1.137 2022/12/11 18:02:40 oster Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -28,7 +28,7 @@
/* All bugs are subject to removal without further notice */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.136 2019/11/21 19:24:02 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.137 2022/12/11 18:02:40 oster Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@@ -315,6 +315,7 @@
break;
case T_ASTFLT|T_USER:
+ pcb->P0LR = (pcb->P0LR & ~AST_MASK) | AST_PCB;
mtpr(AST_NO,PR_ASTLVL);
trapsig = false;
break;
Home |
Main Index |
Thread Index |
Old Index