PERFORCE change 64402 for review
Peter Wemm
peter at FreeBSD.org
Fri Nov 5 20:59:12 PST 2004
http://perforce.freebsd.org/chv.cgi?CH=64402
Change 64402 by peter at peter_daintree on 2004/11/06 04:59:09
IFC @64401
Affected files ...
.. //depot/projects/hammer/Makefile#27 integrate
.. //depot/projects/hammer/Makefile.inc1#74 integrate
.. //depot/projects/hammer/lib/libc/arm/Makefile.inc#1 branch
.. //depot/projects/hammer/lib/libc/arm/gen/_ctx_start.S#2 integrate
.. //depot/projects/hammer/lib/libc/arm/gen/_setjmp.S#2 integrate
.. //depot/projects/hammer/lib/libc/arm/gen/makecontext.c#2 integrate
.. //depot/projects/hammer/lib/libc/arm/gen/setjmp.S#3 integrate
.. //depot/projects/hammer/lib/libc/arm/gen/signalcontext.c#2 integrate
.. //depot/projects/hammer/lib/libc/arm/sys/Makefile.inc#2 integrate
.. //depot/projects/hammer/lib/libc/arm/sys/getcontext.S#2 delete
.. //depot/projects/hammer/lib/libc/i386/gen/_set_tp.c#4 integrate
.. //depot/projects/hammer/lib/libc/i386/sys/Makefile.inc#5 integrate
.. //depot/projects/hammer/lib/libpthread/arch/amd64/amd64/pthread_md.c#4 integrate
.. //depot/projects/hammer/lib/libpthread/arch/arm/arm/context.S#2 integrate
.. //depot/projects/hammer/lib/libpthread/arch/arm/arm/pthread_md.c#3 integrate
.. //depot/projects/hammer/lib/libpthread/arch/arm/include/atomic_ops.h#2 integrate
.. //depot/projects/hammer/lib/libpthread/arch/arm/include/pthread_md.h#5 integrate
.. //depot/projects/hammer/lib/libpthread/arch/i386/i386/pthread_md.c#4 integrate
.. //depot/projects/hammer/lib/libpthread/arch/i386/include/pthread_md.h#11 integrate
.. //depot/projects/hammer/lib/libthr/arch/i386/i386/_setcurthread.c#15 integrate
.. //depot/projects/hammer/libexec/rtld-elf/i386/reloc.c#6 integrate
.. //depot/projects/hammer/sbin/geom/class/mirror/gmirror.8#4 integrate
.. //depot/projects/hammer/sbin/geom/class/raid3/graid3.8#5 integrate
.. //depot/projects/hammer/sys/alpha/alpha/machdep.c#26 integrate
.. //depot/projects/hammer/sys/alpha/alpha/mp_machdep.c#12 integrate
.. //depot/projects/hammer/sys/alpha/include/pcpu.h#2 integrate
.. //depot/projects/hammer/sys/alpha/include/smp.h#2 integrate
.. //depot/projects/hammer/sys/amd64/amd64/busdma_machdep.c#20 integrate
.. //depot/projects/hammer/sys/amd64/amd64/mp_machdep.c#76 integrate
.. //depot/projects/hammer/sys/arm/arm/cpufunc.c#4 integrate
.. //depot/projects/hammer/sys/arm/arm/critical.c#2 integrate
.. //depot/projects/hammer/sys/arm/arm/fusu.S#3 integrate
.. //depot/projects/hammer/sys/arm/arm/identcpu.c#3 integrate
.. //depot/projects/hammer/sys/arm/arm/locore.S#5 integrate
.. //depot/projects/hammer/sys/arm/arm/support.S#4 integrate
.. //depot/projects/hammer/sys/arm/arm/swtch.S#4 integrate
.. //depot/projects/hammer/sys/arm/arm/trap.c#3 integrate
.. //depot/projects/hammer/sys/arm/include/atomic.h#3 integrate
.. //depot/projects/hammer/sys/arm/xscale/i80321/iq31244_machdep.c#2 integrate
.. //depot/projects/hammer/sys/dev/random/randomdev_soft.c#8 integrate
.. //depot/projects/hammer/sys/dev/snp/snp.c#14 integrate
.. //depot/projects/hammer/sys/i386/include/sysarch.h#7 integrate
.. //depot/projects/hammer/sys/kern/kern_intr.c#33 integrate
.. //depot/projects/hammer/sys/kern/kern_shutdown.c#31 integrate
.. //depot/projects/hammer/sys/kern/kern_thread.c#71 integrate
.. //depot/projects/hammer/sys/kern/subr_sleepqueue.c#11 integrate
.. //depot/projects/hammer/sys/vm/vm_zeroidle.c#17 integrate
Differences ...
==== //depot/projects/hammer/Makefile#27 (text+ko) ====
@@ -1,5 +1,5 @@
#
-# $FreeBSD: src/Makefile,v 1.309 2004/10/18 17:47:31 ru Exp $
+# $FreeBSD: src/Makefile,v 1.310 2004/11/06 03:14:26 peter Exp $
#
# The user-driven targets are:
#
==== //depot/projects/hammer/Makefile.inc1#74 (text+ko) ====
@@ -1,5 +1,5 @@
#
-# $FreeBSD: src/Makefile.inc1,v 1.450 2004/10/24 15:32:23 ru Exp $
+# $FreeBSD: src/Makefile.inc1,v 1.451 2004/11/06 03:14:26 peter Exp $
#
# Make command line options:
# -DNO_DYNAMICROOT do not link /bin and /sbin dynamically
==== //depot/projects/hammer/lib/libc/arm/gen/_ctx_start.S#2 (text+ko) ====
@@ -1,8 +1,9 @@
#include <machine/asm.h>
-.ident "$FreeBSD: src/lib/libc/arm/gen/_ctx_start.S,v 1.1 2004/05/14 12:04:30 cognet Exp $"
+.ident "$FreeBSD: src/lib/libc/arm/gen/_ctx_start.S,v 1.2 2004/11/05 23:53:02 cognet Exp $"
ENTRY(_ctx_start)
- mov pc, r0
- mov r0, r1
+ mov lr, pc
+ mov pc, r4
+ mov r0, r5
bl _C_LABEL(ctx_done)
bl _C_LABEL(abort)
==== //depot/projects/hammer/lib/libc/arm/gen/_setjmp.S#2 (text+ko) ====
@@ -33,8 +33,8 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD: src/lib/libc/arm/gen/_setjmp.S,v 1.1 2004/05/14 12:04:30 cognet Exp $");
-#define SOFTFLOAT /* XXX */
+__FBSDID("$FreeBSD: src/lib/libc/arm/gen/_setjmp.S,v 1.2 2004/11/05 23:53:54 cognet Exp $");
+
/*
* C library -- _setjmp, _longjmp
*
==== //depot/projects/hammer/lib/libc/arm/gen/makecontext.c#2 (text+ko) ====
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/arm/gen/makecontext.c,v 1.1 2004/05/14 12:04:30 cognet Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/arm/gen/makecontext.c,v 1.2 2004/11/05 23:53:02 cognet Exp $");
#include <stdlib.h>
#include <stddef.h>
@@ -46,7 +46,7 @@
#include <stdarg.h>
-extern void _ctx_start(ucontext_t *, int argc, ...);
+extern void _ctx_start(void);
void
ctx_done(ucontext_t *ucp)
@@ -72,7 +72,8 @@
/* Compute and align stack pointer. */
sp = (unsigned int *)
- (((uintptr_t)ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size) & ~7);
+ (((uintptr_t)ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size -
+ sizeof(double)) & ~7);
/* Allocate necessary stack space for arguments exceeding r0-3. */
if (argc > 4)
sp -= argc - 4;
@@ -80,8 +81,9 @@
/* Wipe out frame pointer. */
gr[_REG_FP] = 0;
/* Arrange for return via the trampoline code. */
- gr[_REG_LR] = (__greg_t)_ctx_start;
- gr[_REG_PC] = (__greg_t)func;
+ gr[_REG_PC] = (__greg_t)_ctx_start;
+ gr[_REG_R4] = (__greg_t)func;
+ gr[_REG_R5] = (__greg_t)ucp;
va_start(ap, argc);
/* Pass up to four arguments in r0-3. */
==== //depot/projects/hammer/lib/libc/arm/gen/setjmp.S#3 (text+ko) ====
@@ -33,7 +33,7 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD: src/lib/libc/arm/gen/setjmp.S,v 1.2 2004/09/23 23:13:46 cognet Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/arm/gen/setjmp.S,v 1.3 2004/11/05 23:53:54 cognet Exp $");
/*
* C library -- setjmp, longjmp
*
@@ -44,7 +44,6 @@
* The previous signal state is restored.
*/
-#define SOFTFLOAT /* XXX */
ENTRY(setjmp)
/* Block all signals and retrieve the old signal mask */
stmfd sp!, {r0, r14}
==== //depot/projects/hammer/lib/libc/arm/gen/signalcontext.c#2 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/arm/gen/signalcontext.c,v 1.1 2004/05/14 12:04:30 cognet Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/arm/gen/signalcontext.c,v 1.2 2004/11/05 23:53:02 cognet Exp $");
#include <sys/param.h>
#include <sys/signal.h>
@@ -51,11 +51,8 @@
struct sigframe *sfp;
__greg_t *gr = ucp->uc_mcontext.__gregs;
unsigned int *sp;
- mcontext_t *mc;
- mc = &ucp->uc_mcontext;
- sp = (unsigned int *)
- (((uintptr_t)ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size) & ~7);
+ sp = (unsigned int *)gr[_REG_SP];
sfp = (struct sigframe *)sp - 1;
@@ -63,13 +60,16 @@
bcopy(ucp, &sfp->sf_uc, sizeof(*ucp));
sfp->sf_si.si_signo = sig;
- gr[_REG_SP] = (__greg_t)sp;
+ gr[_REG_SP] = (__greg_t)sfp;
/* Wipe out frame pointer. */
gr[_REG_FP] = 0;
/* Arrange for return via the trampoline code. */
- gr[_REG_LR] = (__greg_t)_ctx_start;
- gr[_REG_PC] = (__greg_t)func;
- gr[_REG_R0] = (__greg_t)ucp;
+ gr[_REG_PC] = (__greg_t)_ctx_start;
+ gr[_REG_R4] = (__greg_t)func;
+ gr[_REG_R5] = (__greg_t)ucp;
+ gr[_REG_R0] = (__greg_t)sig;
+ gr[_REG_R1] = (__greg_t)&sfp->sf_si;
+ gr[_REG_R2] = (__greg_t)&sfp->sf_uc;
ucp->uc_link = &sfp->sf_uc;
sigdelset(&ucp->uc_sigmask, sig);
==== //depot/projects/hammer/lib/libc/arm/sys/Makefile.inc#2 (text+ko) ====
@@ -1,6 +1,6 @@
-# $FreeBSD: src/lib/libc/arm/sys/Makefile.inc,v 1.1 2004/05/14 12:04:31 cognet Exp $
+# $FreeBSD: src/lib/libc/arm/sys/Makefile.inc,v 1.2 2004/11/05 23:52:05 cognet Exp $
-MDASM= Ovfork.S brk.S cerror.S getcontext.S pipe.S ptrace.S sbrk.S shmat.S sigreturn.S syscall.S
+MDASM= Ovfork.S brk.S cerror.S pipe.S ptrace.S sbrk.S shmat.S sigreturn.S syscall.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o ftruncate.o getdomainname.o getlogin.o \
==== //depot/projects/hammer/lib/libc/i386/gen/_set_tp.c#4 (text+ko) ====
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libc/i386/gen/_set_tp.c,v 1.1 2004/08/15 16:18:03 dfr Exp $
+ * $FreeBSD: src/lib/libc/i386/gen/_set_tp.c,v 1.2 2004/11/06 03:28:26 peter Exp $
*/
#include <string.h>
==== //depot/projects/hammer/lib/libc/i386/sys/Makefile.inc#5 (text+ko) ====
@@ -1,5 +1,5 @@
# from: Makefile.inc,v 1.1 1993/09/03 19:04:23 jtc Exp
-# $FreeBSD: src/lib/libc/i386/sys/Makefile.inc,v 1.27 2003/09/04 00:20:40 peter Exp $
+# $FreeBSD: src/lib/libc/i386/sys/Makefile.inc,v 1.28 2004/11/06 03:28:26 peter Exp $
.if !defined(COMPAT_32BIT)
SRCS+= i386_clr_watch.c i386_get_ioperm.c i386_get_ldt.c i386_set_ioperm.c \
==== //depot/projects/hammer/lib/libpthread/arch/amd64/amd64/pthread_md.c#4 (text+ko) ====
@@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libpthread/arch/amd64/amd64/pthread_md.c,v 1.3 2004/08/15 16:28:04 dfr Exp $
+ * $FreeBSD: src/lib/libpthread/arch/amd64/amd64/pthread_md.c,v 1.4 2004/11/06 03:33:19 peter Exp $
*/
#include <stdlib.h>
==== //depot/projects/hammer/lib/libpthread/arch/arm/arm/context.S#2 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD: src/lib/libpthread/arch/arm/arm/context.S,v 1.1 2004/05/14 12:21:29 cognet Exp $");
+__FBSDID("$FreeBSD: src/lib/libpthread/arch/arm/arm/context.S,v 1.2 2004/11/05 23:49:21 cognet Exp $");
/*
* int thr_setcontext(mcontext_t *mcp, intptr_t val, intptr_t *loc)
@@ -43,18 +43,9 @@
cmp r0, #0
moveq r0, #-1
moveq pc, lr
- add ip, r0, #8
- ldmia ip, {r2-r12}
cmp r2, #0
- str r1, [r2]
- add ip, r0, #4
- str ip, [r1] /* Restore r1. */
- add ip, r0, #64
- msr cpsr, ip
- add ip, r0, #52
- mov r0, #0 /* Return 0. */
- ldr sp, [ip] /* Restore stack pointer. */
- mov pc, lr /* Return. */
+ strne r1, [r2]
+ ldmia r0, {r0-r15}
/* XXX: FP bits ? */
/*
@@ -72,10 +63,14 @@
moveq r0, #-1
moveq pc, lr
stmia r0, {r0-r13}
+ mov r1, #1
+ str r1, [r0] /* Return 1 from setcontext */
+ str lr, [r0, #(15 * 4)] /* PC */
+ mrs r1, cpsr
+ str r1, [r0, #(16 * 4)] /* CPSR */
mov r0, #0 /* Return 0. */
mov pc, lr
ENTRY(_arm_enter_uts)
- add r4, r2, r3 /* Stack addr + size. */
- mov lr, pc
+ add sp, r2, r3 /* Stack addr + size. */
mov pc, r1
==== //depot/projects/hammer/lib/libpthread/arch/arm/arm/pthread_md.c#3 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libpthread/arch/arm/arm/pthread_md.c,v 1.2 2004/09/24 13:02:30 cognet Exp $");
+__FBSDID("$FreeBSD: src/lib/libpthread/arch/arm/arm/pthread_md.c,v 1.3 2004/11/05 23:49:21 cognet Exp $");
#include <sys/types.h>
@@ -39,19 +39,15 @@
#include "pthread_md.h"
+struct arm_tp *_tp = NULL;
+
struct tcb *
_tcb_ctor(struct pthread *thread, int initial)
{
struct tcb *tcb;
- void *addr;
- addr = malloc(sizeof(struct tcb) + 63);
- if (addr == NULL)
- tcb = NULL;
- else {
- tcb = (struct tcb *)(((uintptr_t)(addr) + 63) & ~63);
+ if ((tcb = malloc(sizeof(struct tcb)))) {
bzero(tcb, sizeof(struct tcb));
- tcb->tcb_addr = addr;
tcb->tcb_thread = thread;
/* XXX - Allocate tdv/tls */
}
@@ -61,11 +57,8 @@
void
_tcb_dtor(struct tcb *tcb)
{
- void *addr;
- addr = tcb->tcb_addr;
- tcb->tcb_addr = NULL;
- free(addr);
+ free(tcb);
}
struct kcb *
==== //depot/projects/hammer/lib/libpthread/arch/arm/include/atomic_ops.h#2 (text+ko) ====
@@ -23,12 +23,15 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libpthread/arch/arm/include/atomic_ops.h,v 1.1 2004/05/14 12:21:29 cognet Exp $
+ * $FreeBSD: src/lib/libpthread/arch/arm/include/atomic_ops.h,v 1.2 2004/11/05 23:49:21 cognet Exp $
*/
#ifndef _ATOMIC_OPS_H_
#define _ATOMIC_OPS_H_
+#include <machine/atomic.h>
+#include "thr_private.h"
+
/*
* Atomic swap:
* Atomic (tmp = *dst, *dst = val), then *res = tmp
@@ -38,9 +41,7 @@
static inline void
atomic_swap32(intptr_t *dst, intptr_t val, intptr_t *res)
{
- __asm __volatile(
- "swp %2, %2, [%1]; mov %2, %0"
- : "=r" (*res) : "r" (dst), "r" (val) : "cc");
+ *res = __swp(val, dst);
}
#define atomic_swap_ptr(d, v, r) \
@@ -49,3 +50,19 @@
#define atomic_swap_int(d, v, r) \
atomic_swap32((intptr_t *)d, (intptr_t)v, (intptr_t *)r)
#endif
+
+static inline u_int32_t
+atomic_cmpset_32(volatile u_int32_t *p, u_int32_t cmpval, u_int32_t newval)
+{
+ kse_critical_t crit = _kse_critical_enter();
+ int ret;
+
+ if (*p == cmpval) {
+ *p = newval;
+ ret = 1;
+ } else
+ ret = 0;
+ _kse_critical_leave(crit);
+ return (ret);
+}
+
==== //depot/projects/hammer/lib/libpthread/arch/arm/include/pthread_md.h#5 (text+ko) ====
@@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libpthread/arch/arm/include/pthread_md.h,v 1.6 2004/09/24 13:02:30 cognet Exp $
+ * $FreeBSD: src/lib/libpthread/arch/arm/include/pthread_md.h,v 1.7 2004/11/05 23:49:21 cognet Exp $
*/
/*
@@ -64,19 +64,15 @@
*/
struct arm_tp {
struct tdv *tp_tdv; /* dynamic TLS */
- uint32_t _reserved_;
- long double tp_tls[0]; /* static TLS */
};
struct tcb {
struct pthread *tcb_thread;
- void *tcb_addr; /* allocated tcb address */
struct kcb *tcb_curkcb;
uint32_t tcb_isfake;
- uint32_t tcb_spare[4];
struct kse_thr_mailbox tcb_tmbx; /* needs 32-byte alignment */
struct arm_tp tcb_tp;
-} __aligned(32);
+};
struct kcb {
struct kse_mailbox kcb_kmbx;
@@ -85,7 +81,7 @@
struct kse *kcb_kse;
};
-register struct arm_tp *_tp __asm("%r6");
+extern struct arm_tp *_tp;
#define _tcb ((struct tcb*)((char*)(_tp) - offsetof(struct tcb, tcb_tp)))
@@ -97,12 +93,21 @@
struct kcb *_kcb_ctor(struct kse *kse);
void _kcb_dtor(struct kcb *);
+static __inline uint32_t
+__kcb_swp(uint32_t val, void *ptr)
+{
+
+ __asm __volatile("swp %0, %1, [%2]"
+ : "=r" (val) : "r" (val) , "r" (ptr) : "memory");
+ return (val);
+}
+
/* Called from the KSE to set its private data. */
static __inline void
_kcb_set(struct kcb *kcb)
{
/* There is no thread yet; use the fake tcb. */
- _tp = &kcb->kcb_faketcb.tcb_tp;
+ __kcb_swp((uint32_t)&kcb->kcb_faketcb.tcb_tp, &_tp);
}
/*
@@ -126,30 +131,21 @@
_kcb_critical_enter(void)
{
struct kse_thr_mailbox *crit;
- uint32_t flags;
- if (_tcb->tcb_isfake != 0) {
- /*
- * We already are in a critical region since
- * there is no current thread.
- */
- crit = NULL;
- } else {
- flags = _tcb->tcb_tmbx.tm_flags;
- _tcb->tcb_tmbx.tm_flags |= TMF_NOUPCALL;
- crit = _tcb->tcb_curkcb->kcb_kmbx.km_curthread;
- _tcb->tcb_curkcb->kcb_kmbx.km_curthread = NULL;
- _tcb->tcb_tmbx.tm_flags = flags;
- }
+ if (_tcb->tcb_isfake)
+ return (NULL);
+ crit = (struct kse_thr_mailbox *)__kcb_swp((uint32_t)NULL,
+ &_tcb->tcb_curkcb->kcb_kmbx.km_curthread);
return (crit);
}
static __inline void
_kcb_critical_leave(struct kse_thr_mailbox *crit)
{
- /* No need to do anything if this is a fake tcb. */
+
if (_tcb->tcb_isfake == 0)
- _tcb->tcb_curkcb->kcb_kmbx.km_curthread = crit;
+ __kcb_swp((uint32_t)crit,
+ &_tcb->tcb_curkcb->kcb_kmbx.km_curthread);
}
static __inline int
@@ -158,6 +154,7 @@
uint32_t flags;
int ret;
+ return (_tcb->tcb_curkcb->kcb_kmbx.km_curthread == NULL);
if (_tcb->tcb_isfake != 0) {
/*
* We are in a critical region since there is no
@@ -176,11 +173,11 @@
static __inline void
_tcb_set(struct kcb *kcb, struct tcb *tcb)
{
- if (tcb == NULL)
+ if (tcb == NULL)
tcb = &kcb->kcb_faketcb;
+ __kcb_swp((uint32_t)&tcb->tcb_tp, &_tp);
kcb->kcb_curtcb = tcb;
tcb->tcb_curkcb = kcb;
- _tp = &tcb->tcb_tp;
}
static __inline struct tcb *
@@ -206,22 +203,25 @@
return (_tcb->tcb_curkcb->kcb_kse);
}
-void _arm_enter_uts(kse_func_t uts, struct kse_mailbox *km, void *stack,
+void _arm_enter_uts(struct kse_mailbox *km, kse_func_t uts, void *stack,
size_t stacksz);
static __inline int
_thread_enter_uts(struct tcb *tcb, struct kcb *kcb)
{
- if (_thr_getcontext(&tcb->tcb_tmbx.tm_context.uc_mcontext) == 0) {
- /* Make the fake tcb the current thread. */
+ int ret;
+
+ if ((ret = _thr_getcontext(&tcb->tcb_tmbx.tm_context.uc_mcontext))
+ == 0) {
kcb->kcb_curtcb = &kcb->kcb_faketcb;
- _tp = &kcb->kcb_faketcb.tcb_tp;
- _arm_enter_uts(kcb->kcb_kmbx.km_func, &kcb->kcb_kmbx,
+ __kcb_swp((int)&kcb->kcb_faketcb.tcb_tp, &_tp);
+ _arm_enter_uts(&kcb->kcb_kmbx, kcb->kcb_kmbx.km_func,
kcb->kcb_kmbx.km_stack.ss_sp,
kcb->kcb_kmbx.km_stack.ss_size);
/* We should not reach here. */
return (-1);
- }
+ } else if (ret < 0)
+ return (-1);
return (0);
}
@@ -231,9 +231,11 @@
extern int _libkse_debug;
mcontext_t *mc;
+ if (!tcb || !kcb)
+ return (-1);
_tcb_set(kcb, tcb);
mc = &tcb->tcb_tmbx.tm_context.uc_mcontext;
- if (_libkse_debug == 0) {
+ if (0 && _libkse_debug == 0) {
tcb->tcb_tmbx.tm_lwp = kcb->kcb_kmbx.km_lwp;
if (setmbox)
_thr_setcontext(mc, (intptr_t)&tcb->tcb_tmbx,
==== //depot/projects/hammer/lib/libpthread/arch/i386/i386/pthread_md.c#4 (text+ko) ====
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libpthread/arch/i386/i386/pthread_md.c,v 1.3 2004/08/15 16:28:05 dfr Exp $");
+__FBSDID("$FreeBSD: src/lib/libpthread/arch/i386/i386/pthread_md.c,v 1.4 2004/11/06 03:35:51 peter Exp $");
#include <sys/types.h>
#include <machine/cpufunc.h>
==== //depot/projects/hammer/lib/libpthread/arch/i386/include/pthread_md.h#11 (text+ko) ====
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libpthread/arch/i386/include/pthread_md.h,v 1.12 2004/08/26 02:41:01 davidxu Exp $
+ * $FreeBSD: src/lib/libpthread/arch/i386/include/pthread_md.h,v 1.13 2004/11/06 03:35:51 peter Exp $
*/
/*
* Machine-dependent thread prototypes/definitions for the thread kernel.
==== //depot/projects/hammer/lib/libthr/arch/i386/i386/_setcurthread.c#15 (text+ko) ====
@@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libthr/arch/i386/i386/_setcurthread.c,v 1.15 2004/08/19 23:49:04 davidxu Exp $
+ * $FreeBSD: src/lib/libthr/arch/i386/i386/_setcurthread.c,v 1.16 2004/11/06 03:30:53 peter Exp $
*/
#include <sys/types.h>
==== //depot/projects/hammer/libexec/rtld-elf/i386/reloc.c#6 (text+ko) ====
@@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/libexec/rtld-elf/i386/reloc.c,v 1.13 2004/08/03 08:50:59 dfr Exp $
+ * $FreeBSD: src/libexec/rtld-elf/i386/reloc.c,v 1.14 2004/11/06 03:32:07 peter Exp $
*/
/*
==== //depot/projects/hammer/sbin/geom/class/mirror/gmirror.8#4 (text+ko) ====
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/sbin/geom/class/mirror/gmirror.8,v 1.6 2004/11/04 19:12:43 ceri Exp $
+.\" $FreeBSD: src/sbin/geom/class/mirror/gmirror.8,v 1.7 2004/11/05 22:38:14 pjd Exp $
.\"
.Dd Jul 9, 2004
.Dt GMIRROR 8
@@ -293,3 +293,5 @@
There should be a way to change a component's priority inside a running mirror.
.Pp
There should be a section with an implementation description.
+.Pp
+Documentation for sysctls kern.geom.mirror.* is missing.
==== //depot/projects/hammer/sbin/geom/class/raid3/graid3.8#5 (text+ko) ====
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/sbin/geom/class/raid3/graid3.8,v 1.9 2004/11/04 19:12:43 ceri Exp $
+.\" $FreeBSD: src/sbin/geom/class/raid3/graid3.8,v 1.10 2004/11/05 22:38:14 pjd Exp $
.\"
.Dd Aug 22, 2004
.Dt GRAID3 8
@@ -240,3 +240,5 @@
.An Pawel Jakub Dawidek Aq pjd at FreeBSD.org
.Sh BUGS
There should be a section with an implementation description.
+.Pp
+Documentation for sysctls kern.geom.raid3.* is missing.
==== //depot/projects/hammer/sys/alpha/alpha/machdep.c#26 (text+ko) ====
@@ -88,7 +88,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/alpha/alpha/machdep.c,v 1.223 2004/09/05 02:09:51 julian Exp $");
+__FBSDID("$FreeBSD: src/sys/alpha/alpha/machdep.c,v 1.224 2004/11/05 19:16:43 jhb Exp $");
#include "opt_compat.h"
#include "opt_ddb.h"
@@ -864,7 +864,8 @@
/* This is not a 'struct user' */
size_t sz = round_page(KSTACK_PAGES * PAGE_SIZE);
pcpup = (struct pcpu *) pmap_steal_memory(sz);
- pcpu_init(pcpup, alpha_pal_whami(), sz);
+ pcpu_init(pcpup, 0, sz);
+ pcpup->pc_pal_id = alpha_pal_whami();
alpha_pal_wrval((u_int64_t) pcpup);
PCPU_GET(next_asn) = 1; /* 0 used for proc0 pmap */
PCPU_SET(curthread, &thread0);
==== //depot/projects/hammer/sys/alpha/alpha/mp_machdep.c#12 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/alpha/alpha/mp_machdep.c,v 1.52 2004/01/07 23:00:20 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/alpha/alpha/mp_machdep.c,v 1.53 2004/11/05 19:16:43 jhb Exp $");
#include "opt_kstack_pages.h"
@@ -61,23 +61,23 @@
static struct mtx ap_boot_mtx;
-u_int boot_cpu_id;
+u_int64_t boot_cpu_id;
static void release_aps(void *dummy);
static int smp_cpu_enabled(struct pcs *pcsp);
extern void smp_init_secondary_glue(void);
-static int smp_send_secondary_command(const char *command, int cpuid);
-static int smp_start_secondary(int cpuid);
+static int smp_send_secondary_command(const char *command, int pal_id);
+static int smp_start_secondary(int pal_id, int cpuid);
/*
* Communicate with a console running on a secondary processor.
* Return 1 on failure.
*/
static int
-smp_send_secondary_command(const char *command, int cpuid)
+smp_send_secondary_command(const char *command, int pal_id)
{
- u_int64_t mask = 1L << cpuid;
- struct pcs *cpu = LOCATE_PCS(hwrpb, cpuid);
+ u_int64_t mask = 1L << pal_id;
+ struct pcs *cpu = LOCATE_PCS(hwrpb, pal_id);
int i, len;
/*
@@ -165,7 +165,7 @@
/*
* Set flags in our per-CPU slot in the HWRPB.
*/
- cpu = LOCATE_PCS(hwrpb, PCPU_GET(cpuid));
+ cpu = LOCATE_PCS(hwrpb, PCPU_GET(pal_id));
cpu->pcs_flags &= ~PCS_BIP;
cpu->pcs_flags |= PCS_RC;
alpha_mb();
@@ -216,9 +216,9 @@
}
static int
-smp_start_secondary(int cpuid)
+smp_start_secondary(int pal_id, int cpuid)
{
- struct pcs *cpu = LOCATE_PCS(hwrpb, cpuid);
+ struct pcs *cpu = LOCATE_PCS(hwrpb, pal_id);
struct pcs *bootcpu = LOCATE_PCS(hwrpb, boot_cpu_id);
struct alpha_pcb *pcb = (struct alpha_pcb *) cpu->pcs_hwpcb;
struct pcpu *pcpu;
@@ -226,12 +226,12 @@
size_t sz;
if ((cpu->pcs_flags & PCS_PV) == 0) {
- printf("smp_start_secondary: cpu %d PALcode invalid\n", cpuid);
+ printf("smp_start_secondary: cpu %d PALcode invalid\n", pal_id);
return 0;
}
if (bootverbose)
- printf("smp_start_secondary: starting cpu %d\n", cpuid);
+ printf("smp_start_secondary: starting cpu %d\n", pal_id);
sz = round_page((UAREA_PAGES + KSTACK_PAGES) * PAGE_SIZE);
pcpu = malloc(sz, M_TEMP, M_NOWAIT);
@@ -241,6 +241,7 @@
}
pcpu_init(pcpu, cpuid, sz);
+ pcpu->pc_pal_id = pal_id;
/*
* Copy the idle pcb and setup the address to start executing.
@@ -270,7 +271,7 @@
/*
* Fire it up and hope for the best.
*/
- if (!smp_send_secondary_command("START\r\n", cpuid)) {
+ if (!smp_send_secondary_command("START\r\n", pal_id)) {
printf("smp_start_secondary: can't send START command\n");
pcpu_destroy(pcpu);
free(pcpu, M_TEMP);
@@ -296,7 +297,7 @@
* It worked (I think).
*/
if (bootverbose)
- printf("smp_start_secondary: cpu %d started\n", cpuid);
+ printf("smp_start_secondary: cpu %d started\n", pal_id);
return 1;
}
@@ -329,16 +330,18 @@
void
cpu_mp_setmaxid(void)
{
- int i;
+ u_int64_t i;
mp_maxid = 0;
- for (i = 0; i < hwrpb->rpb_pcs_cnt && i < MAXCPU; i++) {
- if (i == PCPU_GET(cpuid))
+ for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) {
+ if (i == PCPU_GET(pal_id))
continue;
if (!smp_cpu_enabled(LOCATE_PCS(hwrpb, i)))
continue;
- mp_maxid = i;
+ mp_maxid++;
}
+ if (mp_maxid > MAXCPU)
+ mp_maxid = MAXCPU;
}
int
@@ -348,7 +351,7 @@
/* XXX: Need to check for valid platforms here. */
- boot_cpu_id = PCPU_GET(cpuid);
+ boot_cpu_id = PCPU_GET(pal_id);
KASSERT(boot_cpu_id == hwrpb->rpb_primary_cpu_id,
("cpu_mp_probe() called on non-primary CPU"));
all_cpus = PCPU_GET(cpumask);
@@ -358,12 +361,10 @@
/* Make sure we have at least one secondary CPU. */
cpus = 0;
for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) {
- if (i == PCPU_GET(cpuid))
+ if (i == PCPU_GET(pal_id))
continue;
if (!smp_cpu_enabled(LOCATE_PCS(hwrpb, i)))
continue;
- if (i > MAXCPU)
- continue;
cpus++;
}
return (cpus);
@@ -372,10 +373,11 @@
void
cpu_mp_start(void)
{
- int i;
+ int i, cpuid;
mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN);
+ cpuid = 1;
for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) {
struct pcs *pcsp;
@@ -410,22 +412,30 @@
printf("CPU %d disabled by loader.\n", i);
continue;
}
- all_cpus |= (1 << i);
- mp_ncpus++;
+ if (smp_start_secondary(i, cpuid)) {
+ all_cpus |= (1 << cpuid);
+ mp_ncpus++;
+ cpuid++;
+ }
}
PCPU_SET(other_cpus, all_cpus & ~PCPU_GET(cpumask));
-
- for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) {
- if (i == boot_cpu_id)
- continue;
- if (!CPU_ABSENT(i))
- smp_start_secondary(i);
- }
}
void
cpu_mp_announce(void)
{
+ struct pcpu *pc;
+ int i;
+
+ /* List CPUs */
+ printf(" cpu0 (BSP): PAL ID: %2lu\n", boot_cpu_id);
+ for (i = 1; i < MAXCPU; i++) {
+ if (CPU_ABSENT(i))
+ continue;
+ pc = pcpu_find(i);
+ MPASS(pc != NULL);
+ printf(" cpu%d (AP): PAL ID: %2lu\n", i, pc->pc_pal_id);
+ }
}
/*
@@ -446,8 +456,9 @@
if (pcpu) {
atomic_set_64(&pcpu->pc_pending_ipis, ipi);
alpha_mb();
- CTR1(KTR_SMP, "calling alpha_pal_wripir(%d)", cpuid);
- alpha_pal_wripir(cpuid);
+ CTR1(KTR_SMP, "calling alpha_pal_wripir(%d)",
+ pcpu->pc_pal_id);
+ alpha_pal_wripir(pcpu->pc_pal_id);
}
}
}
@@ -529,8 +540,8 @@
* requests to provide PALcode to secondaries and to start up new
* secondaries that are added to the system on the fly.
*/
- if (PCPU_GET(cpuid) == boot_cpu_id) {
- u_int cpuid;
+ if (PCPU_GET(pal_id) == boot_cpu_id) {
+ u_int pal_id;
u_int64_t txrdy;
#ifdef DIAGNOSTIC
struct pcs *cpu;
@@ -539,18 +550,18 @@
alpha_mb();
while (hwrpb->rpb_txrdy != 0) {
- cpuid = ffs(hwrpb->rpb_txrdy) - 1;
+ pal_id = ffs(hwrpb->rpb_txrdy) - 1;
#ifdef DIAGNOSTIC
- cpu = LOCATE_PCS(hwrpb, cpuid);
+ cpu = LOCATE_PCS(hwrpb, pal_id);
bcopy(&cpu->pcs_buffer.txbuf, buf,
cpu->pcs_buffer.txlen);
buf[cpu->pcs_buffer.txlen] = '\0';
- printf("SMP From CPU%d: %s\n", cpuid, buf);
+ printf("SMP From CPU%d: %s\n", pal_id, buf);
#endif
do {
txrdy = hwrpb->rpb_txrdy;
} while (atomic_cmpset_64(&hwrpb->rpb_txrdy, txrdy,
- txrdy & ~(1 << cpuid)) == 0);
+ txrdy & ~(1 << pal_id)) == 0);
}
}
}
==== //depot/projects/hammer/sys/alpha/include/pcpu.h#2 (text+ko) ====
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/alpha/include/pcpu.h,v 1.14 2001/12/11 23:33:39 jhb Exp $
+ * $FreeBSD: src/sys/alpha/include/pcpu.h,v 1.15 2004/11/05 19:16:44 jhb Exp $
*/
#ifndef _MACHINE_PCPU_H_
@@ -34,6 +34,7 @@
#define PCPU_MD_FIELDS \
struct alpha_pcb pc_idlepcb; /* pcb for idling */ \
+ u_int64_t pc_pal_id; /* physical CPU ID */ \
u_int64_t pc_idlepcbphys; /* pa of pc_idlepcb */ \
u_int64_t pc_pending_ipis; /* pending IPI's */ \
u_int32_t pc_next_asn; /* next ASN to alloc */ \
==== //depot/projects/hammer/sys/alpha/include/smp.h#2 (text+ko) ====
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $FreeBSD: src/sys/alpha/include/smp.h,v 1.6 2001/08/13 22:41:15 jhb Exp $
+ * $FreeBSD: src/sys/alpha/include/smp.h,v 1.7 2004/11/05 19:16:44 jhb Exp $
*
*/
@@ -26,7 +26,7 @@
#ifndef LOCORE
-extern u_int boot_cpu_id;
+extern u_int64_t boot_cpu_id;
void ipi_selected(u_int cpus, u_int64_t ipi);
void ipi_all(u_int64_t ipi);
==== //depot/projects/hammer/sys/amd64/amd64/busdma_machdep.c#20 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/busdma_machdep.c,v 1.58 2004/09/08 04:54:18 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/busdma_machdep.c,v 1.59 2004/11/05 18:24:01 peter Exp $");
#include <sys/param.h>
#include <sys/systm.h>
==== //depot/projects/hammer/sys/amd64/amd64/mp_machdep.c#76 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.247 2004/09/29 01:59:10 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.248 2004/11/05 18:25:22 peter Exp $");
#include "opt_cpu.h"
#include "opt_kstack_pages.h"
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list