Fix MULTIPROCESSOR curlwp/curcpu handling.
This commit is contained in:
parent
9f506e4ca6
commit
2a78b12bfe
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: genassym.cf,v 1.25 2011/01/14 02:06:26 rmind Exp $
|
||||
# $NetBSD: genassym.cf,v 1.26 2011/01/22 10:57:07 skrll Exp $
|
||||
|
||||
# $OpenBSD: genassym.cf,v 1.18 2001/09/20 18:31:14 mickey Exp $
|
||||
|
||||
|
@ -33,6 +33,10 @@
|
|||
# @(#)genassym.c 8.3 (Berkeley) 1/4/94
|
||||
#
|
||||
|
||||
if defined(_KERNEL_OPT)
|
||||
include "opt_multiprocessor.h"
|
||||
endif
|
||||
|
||||
quote #define __MUTEX_PRIVATE
|
||||
quote #define __RWLOCK_PRIVATE
|
||||
|
||||
|
@ -91,8 +95,11 @@ define CI_IPENDING offsetof(struct cpu_info, ci_ipending)
|
|||
#define CI_INTR_DEPTH offsetof(struct cpu_info, ci_intr_depth)
|
||||
#define CI_SOFTLWPS offsetof(struct cpu_info, ci_softlwps)
|
||||
define CI_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count)
|
||||
#define CI_CURLWP offsetof(struct cpu_info, ci_curlwp)
|
||||
define CI_TRAPSAVE offsetof(struct cpu_info, ci_trapsave)
|
||||
ifdef MULTIPROCESSOR
|
||||
define CI_CURLWP offsetof(struct cpu_info, ci_curlwp)
|
||||
endif
|
||||
|
||||
|
||||
define MTX_IPL offsetof(struct kmutex, mtx_ipl)
|
||||
define MTX_LOCK offsetof(struct kmutex, mtx_lock)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: locore.S,v 1.49 2011/01/17 12:37:46 skrll Exp $ */
|
||||
/* $NetBSD: locore.S,v 1.50 2011/01/22 10:57:07 skrll Exp $ */
|
||||
/* $OpenBSD: locore.S,v 1.158 2008/07/28 19:08:46 miod Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -57,12 +57,14 @@
|
|||
* suitability of this software for any purpose.
|
||||
*/
|
||||
|
||||
#include "opt_multiprocessor.h"
|
||||
#include "opt_cputype.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_kgdb.h"
|
||||
|
||||
#include <sys/errno.h>
|
||||
#include <machine/param.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/asm.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/trap.h>
|
||||
|
@ -139,16 +141,6 @@
|
|||
#define MFCPU_C(r,x) .word 0x14000600 | ((r) << 21) | ((x) << 16)
|
||||
#define MFCPU_U(r,x) .word 0x140008a0 | ((r) << 21) | ((x))
|
||||
#define MTCPU_U(x,r) .word 0x14001840 | ((r) << 21) | ((x) << 16)
|
||||
#endif
|
||||
|
||||
#ifdef MULTIPROCESSOR
|
||||
#define GET_CURCPU(r) mfctl CR_CURCPU, r
|
||||
#define GET_CURLWP(r) mfctl CR_CURCPU, r ! ldw CI_CURLWP(r), r
|
||||
#define SET_CURLWP(r,s) mfctl CR_CURCPU, s ! stw r, CI_CURLWP(s)
|
||||
#else
|
||||
#define GET_CURCPU(r) mfctl CR_CURLWP, r ! ldw L_CPU(r), r
|
||||
#define GET_CURLWP(r) mfctl CR_CURLWP, r
|
||||
#define SET_CURLWP(r,s) mtctl r, CR_CURLWP
|
||||
#endif
|
||||
|
||||
.import $global$, data
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cpu.h,v 1.57 2011/01/20 19:47:40 skrll Exp $ */
|
||||
/* $NetBSD: cpu.h,v 1.58 2011/01/22 10:57:07 skrll Exp $ */
|
||||
|
||||
/* $OpenBSD: cpu.h,v 1.55 2008/07/23 17:39:35 kettenis Exp $ */
|
||||
|
||||
|
@ -187,6 +187,26 @@ extern register_t kpsw;
|
|||
#define HPPA_SPA_ENABLE 0x00000020
|
||||
#define HPPA_NMODSPBUS 64
|
||||
|
||||
#ifdef MULTIPROCESSOR
|
||||
|
||||
#define GET_CURCPU(r) mfctl CR_CURCPU, r
|
||||
#define GET_CURCPU_SPACE(s, r) GET_CURCPU(r)
|
||||
#define GET_CURLWP(r) mfctl CR_CURCPU, r ! ldw CI_CURLWP(r), r
|
||||
#define GET_CURLWP_SPACE(s, r) mfctl CR_CURCPU, r ! ldw CI_CURLWP(s, r), r
|
||||
|
||||
#define SET_CURLWP(r,t) mfctl CR_CURCPU, t ! stw r, CI_CURLWP(t)
|
||||
|
||||
#else /* MULTIPROCESSOR */
|
||||
|
||||
#define GET_CURCPU(r) mfctl CR_CURLWP, r ! ldw L_CPU(r), r
|
||||
#define GET_CURCPU_SPACE(s, r) mfctl CR_CURLWP, r ! ldw L_CPU(s, r), r
|
||||
#define GET_CURLWP(r) mfctl CR_CURLWP, r
|
||||
#define GET_CURLWP_SPACE(s, r) GET_CURLWP(r)
|
||||
|
||||
#define SET_CURLWP(r,t) mtctl r, CR_CURLWP
|
||||
|
||||
#endif /* MULTIPROCESSOR */
|
||||
|
||||
#ifndef _LOCORE
|
||||
#ifdef _KERNEL
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: trap.S,v 1.50 2010/06/06 12:13:36 skrll Exp $ */
|
||||
/* $NetBSD: trap.S,v 1.51 2011/01/22 10:57:07 skrll Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -96,6 +96,7 @@
|
|||
*/
|
||||
|
||||
#include "opt_compat_osf1.h"
|
||||
#include "opt_multiprocessor.h"
|
||||
#include "opt_cputype.h"
|
||||
|
||||
/*
|
||||
|
@ -203,7 +204,7 @@ syscall_entry:
|
|||
*/
|
||||
|
||||
/* t2 = curlwp PCB */
|
||||
GET_CURLWP(%t3)
|
||||
GET_CURLWP_SPACE(%sr1, %t3)
|
||||
ldw L_PCB(%sr1, %t3), %t2 /* XXX can use ,sl */
|
||||
|
||||
/*
|
||||
|
@ -507,12 +508,7 @@ syscall_return:
|
|||
ldw TF_CR30(%sr3, %t3), %t1
|
||||
mtctl %t1, CR_FPPADDR
|
||||
|
||||
#ifdef MULTIPROCESSOR
|
||||
mfctl CR_CURCPU, %t3
|
||||
#else
|
||||
mfctl CR_CURLWP, %t3
|
||||
ldw L_CPU(%sr3, %t3), %t3
|
||||
#endif
|
||||
GET_CURCPU_SPACE(%sr3, %t3)
|
||||
|
||||
/*
|
||||
* Clear the system mask, this puts us back into physical mode. Reload
|
||||
|
@ -1978,7 +1974,7 @@ ENTRY_NOPROFILE(TLABEL(all),0)
|
|||
comb,<> %t1, %t2, L$trap_from_kernel /* if %t1 != %t2 => kernel */
|
||||
dep %r0, 31, 6, %sp /* Assumed stack align step 2 */
|
||||
|
||||
mfctl CR_CURLWP, %t2
|
||||
GET_CURLWP(%t2)
|
||||
depi 1, T_USER_POS, 1, %r1
|
||||
depi 1, TFF_LAST_POS, 1, %r1
|
||||
ldw L_PCB(%t2), %sp
|
||||
|
|
Loading…
Reference in New Issue