Re: svn commit: r202870 - head/sys/dev/ieee488

2010-01-23 Thread Joerg Wunsch
As Joerg Wunsch wrote:

   . Implement the special interrupt handling per the GPIB-PCIIA
 Technical Reference Manual; this was apparently not declared for the
 clone card this driver has been originally implemented for, [...]

s/declared/required/

-- 
cheers, Jorg   .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202874 - stable/8/sys/dev/cxgb

2010-01-23 Thread Navdeep Parhar
Author: np
Date: Sat Jan 23 08:37:04 2010
New Revision: 202874
URL: http://svn.freebsd.org/changeset/base/202874

Log:
  MFC r202863
  
  Don't forget to release the adapter lock for a no-op.

Modified:
  stable/8/sys/dev/cxgb/cxgb_main.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/cxgb/cxgb_main.c
==
--- stable/8/sys/dev/cxgb/cxgb_main.c   Sat Jan 23 07:57:17 2010
(r202873)
+++ stable/8/sys/dev/cxgb/cxgb_main.c   Sat Jan 23 08:37:04 2010
(r202874)
@@ -2078,6 +2078,8 @@ fail:
p-if_flags = ifp-if_flags;
} else if (ifp-if_drv_flags  IFF_DRV_RUNNING)
error = cxgb_uninit_locked(p);
+   else
+   ADAPTER_UNLOCK(sc);
 
ADAPTER_LOCK_ASSERT_NOTOWNED(sc);
break;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202875 - stable/7/sys/dev/cxgb

2010-01-23 Thread Navdeep Parhar
Author: np
Date: Sat Jan 23 08:43:11 2010
New Revision: 202875
URL: http://svn.freebsd.org/changeset/base/202875

Log:
  MFC r202863
  
  Don't forget to release the adapter lock for a no-op.

Modified:
  stable/7/sys/dev/cxgb/cxgb_main.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/cxgb/cxgb_main.c
==
--- stable/7/sys/dev/cxgb/cxgb_main.c   Sat Jan 23 08:37:04 2010
(r202874)
+++ stable/7/sys/dev/cxgb/cxgb_main.c   Sat Jan 23 08:43:11 2010
(r202875)
@@ -2061,6 +2061,8 @@ fail:
p-if_flags = ifp-if_flags;
} else if (ifp-if_drv_flags  IFF_DRV_RUNNING)
error = cxgb_uninit_locked(p);
+   else
+   ADAPTER_UNLOCK(sc);
 
ADAPTER_LOCK_ASSERT_NOTOWNED(sc);
break;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202876 - head/lib/libc/gen

2010-01-23 Thread Ed Schouten
Author: ed
Date: Sat Jan 23 08:43:21 2010
New Revision: 202876
URL: http://svn.freebsd.org/changeset/base/202876

Log:
  Just ignore the timestamps given to pututxline().
  
  I've noticed many applications do a bad job at timekeeping, for several
  reasons:
  
  - Applications like screen(1) don't update time records when restoring
the old user login record.
  - Many applications only set ut_tv.tv_sec, not ut_tv.tv_usec.
  
  This causes many problems for tools such as ac(8), which require the
  timestamps to be properly ordered. This is why I've decided to let the
  utmpx code obtain valid timestamps itself.

Modified:
  head/lib/libc/gen/getutxent.3
  head/lib/libc/gen/pututxline.c
  head/lib/libc/gen/utxdb.c

Modified: head/lib/libc/gen/getutxent.3
==
--- head/lib/libc/gen/getutxent.3   Sat Jan 23 08:43:11 2010
(r202875)
+++ head/lib/libc/gen/getutxent.3   Sat Jan 23 08:43:21 2010
(r202876)
@@ -311,13 +311,9 @@ will only be written to
 Entries of type
 .Dv USER_PROCESS
 will also be written to
-.Pa /var/run/utx.active .
-It will only be written to
-.Pa /var/log/utx.lastlogin
-if
-.Fa ut_tv
-for that user has a greater value than the existing entry or when no
-entry for the user has been found.
+.Pa /var/run/utx.active
+and
+.Pa /var/log/utx.lastlogin .
 .Pp
 Entries of type
 .Dv DEAD_PROCESS
@@ -345,6 +341,8 @@ to be discarded.
 All entries whose type has not been mentioned previously, are discarded
 by this implementation of
 .Fn pututxline .
+This implementation also ignores the value of
+.Fa ut_tv .
 .Sh RETURN VALUES
 The
 .Fn getutxent ,

Modified: head/lib/libc/gen/pututxline.c
==
--- head/lib/libc/gen/pututxline.c  Sat Jan 23 08:43:11 2010
(r202875)
+++ head/lib/libc/gen/pututxline.c  Sat Jan 23 08:43:21 2010
(r202876)
@@ -132,13 +132,6 @@ utx_active_remove(struct futx *fu)
if (memcmp(fu-fu_id, fe.fu_id, sizeof fe.fu_id) != 0)
continue;
 
-   /*
-* Prevent login sessions from having a negative
-* timespan.
-*/
-   if (be64toh(fu-fu_tv)  be64toh(fe.fu_tv))
-   fu-fu_tv = fe.fu_tv;
-
/* Terminate session. */
fseeko(fp, -(off_t)sizeof fe, SEEK_CUR);
fwrite(fu, sizeof *fu, 1, fp);
@@ -175,17 +168,12 @@ utx_lastlogin_add(const struct futx *fu)
while (fread(fe, sizeof fe, 1, fp) == 1) {
if (strncmp(fu-fu_user, fe.fu_user, sizeof fe.fu_user) != 0)
continue;
-
-   /* Prevent lowering the time value. */
-   if (be64toh(fu-fu_tv) = be64toh(fe.fu_tv))
-   goto done;

/* Found a previous lastlogin entry for this user. */
fseeko(fp, -(off_t)sizeof fe, SEEK_CUR);
break;
}
fwrite(fu, sizeof *fu, 1, fp);
-done:
fclose(fp);
 }
 

Modified: head/lib/libc/gen/utxdb.c
==
--- head/lib/libc/gen/utxdb.c   Sat Jan 23 08:43:11 2010(r202875)
+++ head/lib/libc/gen/utxdb.c   Sat Jan 23 08:43:21 2010(r202876)
@@ -30,6 +30,7 @@ __FBSDID($FreeBSD$);
 #include namespace.h
 #include sys/endian.h
 #include sys/param.h
+#include sys/time.h
 #include stdlib.h
 #include string.h
 #include utmpx.h
@@ -50,9 +51,11 @@ __FBSDID($FreeBSD$);
 #defineUTOF_TYPE(ut, fu) do { \
(fu)-fu_type = (ut)-ut_type;  \
 } while (0)
-#defineUTOF_TV(ut, fu) do { \
-   (fu)-fu_tv = htobe64((uint64_t)(ut)-ut_tv.tv_sec * 100 +  \
-   (uint64_t)(ut)-ut_tv.tv_usec); \
+#defineUTOF_TV(fu) do { \
+   struct timeval tv;  \
+   gettimeofday(tv, NULL);\
+   (fu)-fu_tv = htobe64((uint64_t)tv.tv_sec * 100 +   \
+   (uint64_t)tv.tv_usec);  \
 } while (0)
 
 void
@@ -96,7 +99,7 @@ utx_to_futx(const struct utmpx *ut, stru
}
 
UTOF_TYPE(ut, fu);
-   UTOF_TV(ut, fu);
+   UTOF_TV(fu);
 }
 
 #defineFTOU_STRING(fu, ut, field) do { \
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202880 - head/etc/rc.d

2010-01-23 Thread Konstantin Belousov
Author: kib
Date: Sat Jan 23 11:42:31 2010
New Revision: 202880
URL: http://svn.freebsd.org/changeset/base/202880

Log:
  Do not check for existence of symlink source for the link action. This
  does not work for link in subdirectory, and sometimes it is useful to
  create symlink in advance for dynamically created device node.
  
  MFC after:1 week

Modified:
  head/etc/rc.d/devfs

Modified: head/etc/rc.d/devfs
==
--- head/etc/rc.d/devfs Sat Jan 23 11:10:26 2010(r202879)
+++ head/etc/rc.d/devfs Sat Jan 23 11:42:31 2010(r202880)
@@ -44,7 +44,7 @@ read_devfs_conf()
while read action devicelist parameter; do
case ${action} in
l*) for device in ${devicelist}; do
-   if [ -c ${device} -a ! -e ${parameter} 
]; then
+   if [ ! -e ${parameter} ]; then
ln -fs ${device} ${parameter}
fi
done
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202881 - in head/sys: kern sys

2010-01-23 Thread Konstantin Belousov
Author: kib
Date: Sat Jan 23 11:43:30 2010
New Revision: 202881
URL: http://svn.freebsd.org/changeset/base/202881

Log:
  Staticise sigqueue manipulation functions used only in kern_sig.c.
  
  MFC after:1 week

Modified:
  head/sys/kern/kern_sig.c
  head/sys/sys/signalvar.h

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cSat Jan 23 11:42:31 2010(r202880)
+++ head/sys/kern/kern_sig.cSat Jan 23 11:43:30 2010(r202881)
@@ -279,7 +279,7 @@ sigqueue_init(sigqueue_t *list, struct p
  * 0   -   signal not found
  * others  -   signal number
  */ 
-int
+static int
 sigqueue_get(sigqueue_t *sq, int signo, ksiginfo_t *si)
 {
struct proc *p = sq-sq_proc;
@@ -341,7 +341,7 @@ sigqueue_take(ksiginfo_t *ksi)
SIGDELSET(sq-sq_signals, ksi-ksi_signo);
 }
 
-int
+static int
 sigqueue_add(sigqueue_t *sq, int signo, ksiginfo_t *si)
 {
struct proc *p = sq-sq_proc;
@@ -426,7 +426,7 @@ sigqueue_flush(sigqueue_t *sq)
SIGEMPTYSET(sq-sq_kill);
 }
 
-void
+static void
 sigqueue_collect_set(sigqueue_t *sq, sigset_t *set)
 {
ksiginfo_t *ksi;
@@ -438,7 +438,7 @@ sigqueue_collect_set(sigqueue_t *sq, sig
SIGSETOR(*set, sq-sq_kill);
 }
 
-void
+static void
 sigqueue_move_set(sigqueue_t *src, sigqueue_t *dst, sigset_t *setp)
 {
sigset_t tmp, set;
@@ -482,7 +482,7 @@ sigqueue_move_set(sigqueue_t *src, sigqu
sigqueue_collect_set(src, src-sq_signals);
 }
 
-void
+static void
 sigqueue_move(sigqueue_t *src, sigqueue_t *dst, int signo)
 {
sigset_t set;
@@ -492,7 +492,7 @@ sigqueue_move(sigqueue_t *src, sigqueue_
sigqueue_move_set(src, dst, set);
 }
 
-void
+static void
 sigqueue_delete_set(sigqueue_t *sq, sigset_t *set)
 {
struct proc *p = sq-sq_proc;
@@ -526,7 +526,7 @@ sigqueue_delete(sigqueue_t *sq, int sign
 }
 
 /* Remove a set of signals for a process */
-void
+static void
 sigqueue_delete_set_proc(struct proc *p, sigset_t *set)
 {
sigqueue_t worklist;
@@ -553,7 +553,7 @@ sigqueue_delete_proc(struct proc *p, int
sigqueue_delete_set_proc(p, set);
 }
 
-void
+static void
 sigqueue_delete_stopmask_proc(struct proc *p)
 {
sigset_t set;

Modified: head/sys/sys/signalvar.h
==
--- head/sys/sys/signalvar.hSat Jan 23 11:42:31 2010(r202880)
+++ head/sys/sys/signalvar.hSat Jan 23 11:43:30 2010(r202881)
@@ -355,18 +355,10 @@ void  ksiginfo_free(ksiginfo_t *);
 void   sigqueue_init(struct sigqueue *queue, struct proc *p);
 void   sigqueue_flush(struct sigqueue *queue);
 void   sigqueue_delete_proc(struct proc *p, int sig);
-void   sigqueue_delete_set(struct sigqueue *queue, sigset_t *set);
 void   sigqueue_delete(struct sigqueue *queue, int sig);
-void   sigqueue_move_set(struct sigqueue *src, sigqueue_t *dst, sigset_t *);
-intsigqueue_get(struct sigqueue *queue, int sig, ksiginfo_t *info);
-intsigqueue_add(struct sigqueue *queue, int sig, ksiginfo_t *info);
-void   sigqueue_collect_set(struct sigqueue *queue, sigset_t *set);
-void   sigqueue_move(struct sigqueue *, struct sigqueue *, int sig);
-void   sigqueue_delete_set_proc(struct proc *, sigset_t *);
-void   sigqueue_delete_stopmask_proc(struct proc *);
 void   sigqueue_take(ksiginfo_t *ksi);
 intkern_sigtimedwait(struct thread *, sigset_t,
-   ksiginfo_t *, struct timespec *);
+   ksiginfo_t *, struct timespec *);
 intkern_sigprocmask(struct thread *td, int how,
sigset_t *set, sigset_t *oset, int flags);
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202882 - in head/sys: amd64/amd64 amd64/ia32 i386/i386 kern sys

2010-01-23 Thread Konstantin Belousov
Author: kib
Date: Sat Jan 23 11:45:35 2010
New Revision: 202882
URL: http://svn.freebsd.org/changeset/base/202882

Log:
  For PT_TO_SCE stop that stops the ptraced process upon syscall entry,
  syscall arguments are collected before ptracestop() is called. As a
  consequence, debugger cannot modify syscall or its arguments.
  
  For i386, amd64 and ia32 on amd64 MD syscall(), reread syscall number
  and arguments after ptracestop(), if debugger modified anything in the
  process environment. Since procfs stopeven requires number of syscall
  arguments in p_xstat, this cannot be solved by moving stop/trace point
  before argument fetching.
  
  Move the code to read arguments into separate function
  fetch_syscall_args() to avoid code duplication. Note that ktrace point
  for modified syscall is intentionally recorded twice, once with original
  arguments, and second time with the arguments set by debugger.
  
  PT_TO_SCX stop is executed after cpu_syscall_set_retval() already.
  
  Reported by:  Ali Polatel alip exherbo org
  Briefly discussed with:   jhb
  MFC after:3 weeks

Modified:
  head/sys/amd64/amd64/trap.c
  head/sys/amd64/ia32/ia32_syscall.c
  head/sys/i386/i386/trap.c
  head/sys/kern/sys_process.c
  head/sys/sys/proc.h

Modified: head/sys/amd64/amd64/trap.c
==
--- head/sys/amd64/amd64/trap.c Sat Jan 23 11:43:30 2010(r202881)
+++ head/sys/amd64/amd64/trap.c Sat Jan 23 11:45:35 2010(r202882)
@@ -885,95 +885,131 @@ dblfault_handler(struct trapframe *frame
panic(double fault);
 }
 
-/*
- * syscall -   system call request C handler
- *
- * A system call is essentially treated as a trap.
- */
-void
-syscall(struct trapframe *frame)
-{
-   caddr_t params;
+struct syscall_args {
+   u_int code;
struct sysent *callp;
-   struct thread *td = curthread;
-   struct proc *p = td-td_proc;
-   register_t orig_tf_rflags;
-   int error;
-   int narg;
register_t args[8];
register_t *argp;
-   u_int code;
-   int reg, regcnt;
-   ksiginfo_t ksi;
-
-   PCPU_INC(cnt.v_syscall);
+   int narg;
+};
 
-#ifdef DIAGNOSTIC
-   if (ISPL(frame-tf_cs) != SEL_UPL) {
-   panic(syscall);
-   /* NOT REACHED */
-   }
-#endif
+static int
+fetch_syscall_args(struct thread *td, struct syscall_args *sa)
+{
+   struct proc *p;
+   struct trapframe *frame;
+   caddr_t params;
+   int reg, regcnt, error;
 
+   p = td-td_proc;
+   frame = td-td_frame;
reg = 0;
regcnt = 6;
-   td-td_pticks = 0;
-   td-td_frame = frame;
-   if (td-td_ucred != p-p_ucred) 
-   cred_update_thread(td);
+
params = (caddr_t)frame-tf_rsp + sizeof(register_t);
-   code = frame-tf_rax;
-   orig_tf_rflags = frame-tf_rflags;
+   sa-code = frame-tf_rax;
 
if (p-p_sysent-sv_prepsyscall) {
-   (*p-p_sysent-sv_prepsyscall)(frame, (int *)args, code, 
params);
+   (*p-p_sysent-sv_prepsyscall)(frame, (int *)sa-args,
+   sa-code, params);
} else {
-   if (code == SYS_syscall || code == SYS___syscall) {
-   code = frame-tf_rdi;
+   if (sa-code == SYS_syscall || sa-code == SYS___syscall) {
+   sa-code = frame-tf_rdi;
reg++;
regcnt--;
}
}
-
if (p-p_sysent-sv_mask)
-   code = p-p_sysent-sv_mask;
+   sa-code = p-p_sysent-sv_mask;
 
-   if (code = p-p_sysent-sv_size)
-   callp = p-p_sysent-sv_table[0];
+   if (sa-code = p-p_sysent-sv_size)
+   sa-callp = p-p_sysent-sv_table[0];
else
-   callp = p-p_sysent-sv_table[code];
+   sa-callp = p-p_sysent-sv_table[sa-code];
 
-   narg = callp-sy_narg;
-   KASSERT(narg = sizeof(args) / sizeof(args[0]),
+   sa-narg = sa-callp-sy_narg;
+   KASSERT(sa-narg = sizeof(sa-args) / sizeof(sa-args[0]),
(Too many syscall arguments!));
error = 0;
-   argp = frame-tf_rdi;
-   argp += reg;
-   bcopy(argp, args, sizeof(args[0]) * regcnt);
-   if (narg  regcnt) {
+   sa-argp = frame-tf_rdi;
+   sa-argp += reg;
+   bcopy(sa-argp, sa-args, sizeof(sa-args[0]) * regcnt);
+   if (sa-narg  regcnt) {
KASSERT(params != NULL, (copyin args with no params!));
-   error = copyin(params, args[regcnt],
-   (narg - regcnt) * sizeof(args[0]));
+   error = copyin(params, sa-args[regcnt],
+   (sa-narg - regcnt) * sizeof(sa-args[0]));
}
-   argp = args[0];
+   sa-argp = sa-args[0];
 
+   /*
+* This may result in two records if debugger modified
+* registers or memory during sleep at stop/ptrace point.
+*/
 

Re: svn commit: r202882 - in head/sys: amd64/amd64 amd64/ia32 i386/i386 kern sys

2010-01-23 Thread Kostik Belousov
On Sat, Jan 23, 2010 at 11:45:35AM +, Konstantin Belousov wrote:
 Author: kib
 Date: Sat Jan 23 11:45:35 2010
 New Revision: 202882
 URL: http://svn.freebsd.org/changeset/base/202882
 
 Log:
   For PT_TO_SCE stop that stops the ptraced process upon syscall entry,
   syscall arguments are collected before ptracestop() is called. As a
   consequence, debugger cannot modify syscall or its arguments.
   
   For i386, amd64 and ia32 on amd64 MD syscall(), reread syscall number
   and arguments after ptracestop(), if debugger modified anything in the
   process environment. Since procfs stopeven requires number of syscall
   arguments in p_xstat, this cannot be solved by moving stop/trace point
   before argument fetching.
I am willing to help architecture maintainers to implement this for
corresponding architectures, if any help is needed.


pgpVPmDRqpnJ1.pgp
Description: PGP signature


svn commit: r202883 - head/lib/libc/gen

2010-01-23 Thread Antoine Brodin
Author: antoine
Date: Sat Jan 23 12:48:46 2010
New Revision: 202883
URL: http://svn.freebsd.org/changeset/base/202883

Log:
  Reapply r201145 to lib/libc/gen/sem.c

Modified:
  head/lib/libc/gen/sem.c

Modified: head/lib/libc/gen/sem.c
==
--- head/lib/libc/gen/sem.c Sat Jan 23 11:45:35 2010(r202882)
+++ head/lib/libc/gen/sem.c Sat Jan 23 12:48:46 2010(r202883)
@@ -106,7 +106,7 @@ typedef struct sem* sem_t;
 static sem_t sem_alloc(unsigned int value, semid_t semid, int system_sem);
 static void  sem_free(sem_t sem);
 
-static LIST_HEAD(, sem) named_sems = LIST_HEAD_INITIALIZER(named_sems);
+static LIST_HEAD(, sem) named_sems = LIST_HEAD_INITIALIZER(named_sems);
 static pthread_mutex_t named_sems_mtx = PTHREAD_MUTEX_INITIALIZER;
 
 FB10_COMPAT(_libc_sem_init_compat, sem_init);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202884 - head/share/man/man3

2010-01-23 Thread Konstantin Belousov
Author: kib
Date: Sat Jan 23 13:08:47 2010
New Revision: 202884
URL: http://svn.freebsd.org/changeset/base/202884

Log:
  Document pthread_timedjoin_np.
  Note implementation-defined EOPNOTSUPP error [1].
  
  PR:   threads/143115 [1]
  MFC after:3 days

Modified:
  head/share/man/man3/pthread_join.3

Modified: head/share/man/man3/pthread_join.3
==
--- head/share/man/man3/pthread_join.3  Sat Jan 23 12:48:46 2010
(r202883)
+++ head/share/man/man3/pthread_join.3  Sat Jan 23 13:08:47 2010
(r202884)
@@ -30,11 +30,12 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd April 4, 1996
+.Dd January 23, 2010
 .Dt PTHREAD_JOIN 3
 .Os
 .Sh NAME
-.Nm pthread_join
+.Nm pthread_join ,
+.Nm pthread_timedjoin_np
 .Nd wait for thread termination
 .Sh LIBRARY
 .Lb libpthread
@@ -42,6 +43,8 @@
 .In pthread.h
 .Ft int
 .Fn pthread_join pthread_t thread void **value_ptr
+.Ft int
+.Fn pthread_timedjoin_np pthread_t thread void **value_ptr const struct 
timespec *abstime
 .Sh DESCRIPTION
 The
 .Fn pthread_join
@@ -70,18 +73,30 @@ If the thread calling
 .Fn pthread_join
 is cancelled, then the target thread is not detached.
 .Pp
+The
+.Fn pthread_timedjoin_np
+function is equivalent to the
+.Fn pthread_join
+function except it will return
+.Er ETIMEDOUT
+if target thread does not exit before specified absolute time passes.
+.Pp
 A thread that has exited but remains unjoined counts against
 [_POSIX_THREAD_THREADS_MAX].
 .Sh RETURN VALUES
 If successful, the
 .Fn pthread_join
-function will return zero.
+and
+.Fn pthread_timedjoin_np
+functions will return zero.
 Otherwise an error number will be returned to
 indicate the error.
 .Sh ERRORS
 The
 .Fn pthread_join
-function will fail if:
+and
+.Fn pthread_timedjoin_np
+functions will fail if:
 .Bl -tag -width Er
 .It Bq Er EINVAL
 The implementation has detected that the value specified by
@@ -95,6 +110,19 @@ thread ID,
 A deadlock was detected or the value of
 .Fa thread
 specifies the calling thread.
+.It Bq Er EOPNOTSUPP
+The implementation detected that another caller is already waiting on
+.Fa thread .
+.El
+.Pp
+Additionally, the
+.Fn pthread_join
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er ETIMEDOUT
+The specified absolute time passed while
+.Fn pthread_timedjoin_np
+waited for thread exit.
 .El
 .Sh SEE ALSO
 .Xr wait 2 ,
@@ -104,3 +132,9 @@ The
 .Fn pthread_join
 function conforms to
 .St -p1003.1-96 .
+The
+.Fn pthread_timedjoin_np
+is
+.Fx
+extension, first appeared in
+.Fx 6.1 .
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202885 - stable/8/share/man/man3

2010-01-23 Thread Christian Brueffer
Author: brueffer
Date: Sat Jan 23 14:12:40 2010
New Revision: 202885
URL: http://svn.freebsd.org/changeset/base/202885

Log:
  MFC: r202162
  
  Various fixes.

Modified:
  stable/8/share/man/man3/pthread_affinity_np.3
  stable/8/share/man/man3/pthread_attr_affinity_np.3
Directory Properties:
  stable/8/share/man/man3/   (props changed)

Modified: stable/8/share/man/man3/pthread_affinity_np.3
==
--- stable/8/share/man/man3/pthread_affinity_np.3   Sat Jan 23 13:08:47 
2010(r202884)
+++ stable/8/share/man/man3/pthread_affinity_np.3   Sat Jan 23 14:12:40 
2010(r202885)
@@ -25,7 +25,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd January 8, 2010
+.Dd January 12, 2010
 .Dt PTHREAD_AFFINITY_NP 3
 .Os
 .Sh NAME
@@ -44,17 +44,17 @@
 .Fn pthread_getaffinity_np
 and
 .Fn pthread_setaffinity_np
-allow the manipulation of sets of CPUs available to specified thread.
+allow the manipulation of sets of CPUs available to the specified thread.
 .Pp
 Masks of type
 .Ft cpuset_t
 are composed using the
-.Xr CPU_SET 2
+.Xr CPU_SET 3
 macros.
 The kernel tolerates large sets as long as all CPUs specified
 in the set exist.
 Sets smaller than the kernel uses generate an error on calls to
-.Fn  pthread_getaffinity_np
+.Fn pthread_getaffinity_np
 even if the result set would fit within the user supplied set.
 Calls to
 .Fn pthread_setaffinity_np
@@ -75,14 +75,13 @@ retrieves the
 mask from the thread specified by
 .Fa td ,
 and stores it in the space provided by
-.Fa cpumaskp .
+.Fa cpusetp .
 .Pp
 .Fn pthread_setaffinity_np
 attempts to set the mask for the thread specified by
 .Fa td
 to the value in
-.Fa cpumaskp .
-.Pp
+.Fa cpusetp .
 .Sh RETURN VALUES
 If successful, the
 .Fn pthread_getaffinity_np
@@ -105,7 +104,7 @@ call would leave a thread without a vali
 does not overlap with the thread's anonymous mask.
 .It Bq Er EFAULT
 The
-.Fa cpumaskp
+.Fa cpusetp
 pointer passed was invalid.
 .It Bq Er ESRCH
 The thread specified by the
@@ -127,7 +126,7 @@ operation.
 .Xr CPU_SET 3 ,
 .Xr pthread 3 ,
 .Xr pthread_attr_get_affinity_np 3 ,
-.Xr pthread_attr_set_affinity_np 3 .
+.Xr pthread_attr_set_affinity_np 3
 .Sh STANDARDS
 The
 .Nm pthread_getaffinity_np

Modified: stable/8/share/man/man3/pthread_attr_affinity_np.3
==
--- stable/8/share/man/man3/pthread_attr_affinity_np.3  Sat Jan 23 13:08:47 
2010(r202884)
+++ stable/8/share/man/man3/pthread_attr_affinity_np.3  Sat Jan 23 14:12:40 
2010(r202885)
@@ -31,7 +31,7 @@
 .Sh NAME
 .Nm pthread_attr_getaffinity_np ,
 .Nm pthread_attr_setaffinity_np
-.Nd manage CPU affinity in thread attribute object
+.Nd manage CPU affinity in thread attribute objects
 .Sh LIBRARY
 .Lb libpthread
 .Sh SYNOPSIS
@@ -41,20 +41,21 @@
 .Ft int
 .Fn pthread_attr_setaffinity_np pthread_attr_t *pattr size_t cpusetsize 
const cpuset_t *cpusetp
 .Sh DESCRIPTION
+The
 .Fn pthread_attr_getaffinity_np
 and
 .Fn pthread_attr_setaffinity_np
-allow the manipulation of sets of CPUs available to specified thread attribute 
object.
+functions allow the manipulation of sets of CPUs available to the specified 
thread attribute object.
 .Pp
 Masks of type
 .Ft cpuset_t
 are composed using the
-.Xr CPU_SET 2
+.Xr CPU_SET 3
 macros.
 The kernel tolerates large sets as long as all CPUs specified
 in the set exist.
 Sets smaller than the kernel uses generate an error on calls to
-.Fn  pthread_attr_getaffinity_np
+.Fn pthread_attr_getaffinity_np
 even if the result set would fit within the user supplied set.
 Calls to
 .Fn pthread_attr_setaffinity_np
@@ -75,14 +76,13 @@ retrieves the
 mask from the thread attribute object specified by
 .Fa pattr ,
 and stores it in the space provided by
-.Fa cpumaskp .
+.Fa cpusetp .
 .Pp
 .Fn pthread_attr_setaffinity_np
-set the mask for the thread attribute object specified by
+sets the mask for the thread attribute object specified by
 .Fa pattr
 to the value in
-.Fa cpumaskp .
-.Pp
+.Fa cpusetp .
 .Sh RETURN VALUES
 If successful, the
 .Fn pthread_attr_getaffinity_np
@@ -101,7 +101,8 @@ functions will fail if:
 .It Bq Er EINVAL
 The
 .Fa pattr
-or the attribute specified by it is NULL.
+or the attribute specified by it is
+.Dv NULL .
 .El
 .Pp
 The
@@ -111,7 +112,8 @@ function will fail if:
 .It Bq Er EINVAL
 The
 .Fa pattr
-or the attribute specified by it is NULL.
+or the attribute specified by it is
+.Dv NULL .
 .It Bq Er ENOMEM
 Insufficient memory exists to store the cpuset mask.
 .El
@@ -122,7 +124,7 @@ Insufficient memory exists to store the 
 .Xr cpuset_setid 2 ,
 .Xr CPU_SET 3 ,
 .Xr pthread_get_affinity_np 3 ,
-.Xr pthread_set_affinity_np 3 .
+.Xr pthread_set_affinity_np 3
 .Sh STANDARDS
 The
 .Nm pthread_attr_getaffinity_np
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to 

svn commit: r202886 - stable/7/share/man/man3

2010-01-23 Thread Christian Brueffer
Author: brueffer
Date: Sat Jan 23 14:13:21 2010
New Revision: 202886
URL: http://svn.freebsd.org/changeset/base/202886

Log:
  MFC: r202162
  
  Various fixes.

Modified:
  stable/7/share/man/man3/pthread_affinity_np.3
  stable/7/share/man/man3/pthread_attr_affinity_np.3
Directory Properties:
  stable/7/share/man/man3/   (props changed)

Modified: stable/7/share/man/man3/pthread_affinity_np.3
==
--- stable/7/share/man/man3/pthread_affinity_np.3   Sat Jan 23 14:12:40 
2010(r202885)
+++ stable/7/share/man/man3/pthread_affinity_np.3   Sat Jan 23 14:13:21 
2010(r202886)
@@ -25,7 +25,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd January 8, 2010
+.Dd January 12, 2010
 .Dt PTHREAD_AFFINITY_NP 3
 .Os
 .Sh NAME
@@ -44,17 +44,17 @@
 .Fn pthread_getaffinity_np
 and
 .Fn pthread_setaffinity_np
-allow the manipulation of sets of CPUs available to specified thread.
+allow the manipulation of sets of CPUs available to the specified thread.
 .Pp
 Masks of type
 .Ft cpuset_t
 are composed using the
-.Xr CPU_SET 2
+.Xr CPU_SET 3
 macros.
 The kernel tolerates large sets as long as all CPUs specified
 in the set exist.
 Sets smaller than the kernel uses generate an error on calls to
-.Fn  pthread_getaffinity_np
+.Fn pthread_getaffinity_np
 even if the result set would fit within the user supplied set.
 Calls to
 .Fn pthread_setaffinity_np
@@ -75,14 +75,13 @@ retrieves the
 mask from the thread specified by
 .Fa td ,
 and stores it in the space provided by
-.Fa cpumaskp .
+.Fa cpusetp .
 .Pp
 .Fn pthread_setaffinity_np
 attempts to set the mask for the thread specified by
 .Fa td
 to the value in
-.Fa cpumaskp .
-.Pp
+.Fa cpusetp .
 .Sh RETURN VALUES
 If successful, the
 .Fn pthread_getaffinity_np
@@ -105,7 +104,7 @@ call would leave a thread without a vali
 does not overlap with the thread's anonymous mask.
 .It Bq Er EFAULT
 The
-.Fa cpumaskp
+.Fa cpusetp
 pointer passed was invalid.
 .It Bq Er ESRCH
 The thread specified by the
@@ -127,7 +126,7 @@ operation.
 .Xr CPU_SET 3 ,
 .Xr pthread 3 ,
 .Xr pthread_attr_get_affinity_np 3 ,
-.Xr pthread_attr_set_affinity_np 3 .
+.Xr pthread_attr_set_affinity_np 3
 .Sh STANDARDS
 The
 .Nm pthread_getaffinity_np

Modified: stable/7/share/man/man3/pthread_attr_affinity_np.3
==
--- stable/7/share/man/man3/pthread_attr_affinity_np.3  Sat Jan 23 14:12:40 
2010(r202885)
+++ stable/7/share/man/man3/pthread_attr_affinity_np.3  Sat Jan 23 14:13:21 
2010(r202886)
@@ -31,7 +31,7 @@
 .Sh NAME
 .Nm pthread_attr_getaffinity_np ,
 .Nm pthread_attr_setaffinity_np
-.Nd manage CPU affinity in thread attribute object
+.Nd manage CPU affinity in thread attribute objects
 .Sh LIBRARY
 .Lb libpthread
 .Sh SYNOPSIS
@@ -41,20 +41,21 @@
 .Ft int
 .Fn pthread_attr_setaffinity_np pthread_attr_t *pattr size_t cpusetsize 
const cpuset_t *cpusetp
 .Sh DESCRIPTION
+The
 .Fn pthread_attr_getaffinity_np
 and
 .Fn pthread_attr_setaffinity_np
-allow the manipulation of sets of CPUs available to specified thread attribute 
object.
+functions allow the manipulation of sets of CPUs available to the specified 
thread attribute object.
 .Pp
 Masks of type
 .Ft cpuset_t
 are composed using the
-.Xr CPU_SET 2
+.Xr CPU_SET 3
 macros.
 The kernel tolerates large sets as long as all CPUs specified
 in the set exist.
 Sets smaller than the kernel uses generate an error on calls to
-.Fn  pthread_attr_getaffinity_np
+.Fn pthread_attr_getaffinity_np
 even if the result set would fit within the user supplied set.
 Calls to
 .Fn pthread_attr_setaffinity_np
@@ -75,14 +76,13 @@ retrieves the
 mask from the thread attribute object specified by
 .Fa pattr ,
 and stores it in the space provided by
-.Fa cpumaskp .
+.Fa cpusetp .
 .Pp
 .Fn pthread_attr_setaffinity_np
-set the mask for the thread attribute object specified by
+sets the mask for the thread attribute object specified by
 .Fa pattr
 to the value in
-.Fa cpumaskp .
-.Pp
+.Fa cpusetp .
 .Sh RETURN VALUES
 If successful, the
 .Fn pthread_attr_getaffinity_np
@@ -101,7 +101,8 @@ functions will fail if:
 .It Bq Er EINVAL
 The
 .Fa pattr
-or the attribute specified by it is NULL.
+or the attribute specified by it is
+.Dv NULL .
 .El
 .Pp
 The
@@ -111,7 +112,8 @@ function will fail if:
 .It Bq Er EINVAL
 The
 .Fa pattr
-or the attribute specified by it is NULL.
+or the attribute specified by it is
+.Dv NULL .
 .It Bq Er ENOMEM
 Insufficient memory exists to store the cpuset mask.
 .El
@@ -122,7 +124,7 @@ Insufficient memory exists to store the 
 .Xr cpuset_setid 2 ,
 .Xr CPU_SET 3 ,
 .Xr pthread_get_affinity_np 3 ,
-.Xr pthread_set_affinity_np 3 .
+.Xr pthread_set_affinity_np 3
 .Sh STANDARDS
 The
 .Nm pthread_attr_getaffinity_np
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to 

svn commit: r202887 - svnadmin/conf

2010-01-23 Thread Ken Smith
Author: kensmith
Date: Sat Jan 23 14:56:16 2010
New Revision: 202887
URL: http://svn.freebsd.org/changeset/base/202887

Log:
  Turn on approval checking for stable/7 to mark the beginning of
  Code Freeze for the 7.3-RELEASE cycle.
  
  Approved by:  core (implicit)

Modified:
  svnadmin/conf/approvers

Modified: svnadmin/conf/approvers
==
--- svnadmin/conf/approvers Sat Jan 23 14:13:21 2010(r202886)
+++ svnadmin/conf/approvers Sat Jan 23 14:56:16 2010(r202887)
@@ -18,7 +18,7 @@
 #
 #^head/re
 #^stable/8/re
-#^stable/7/re
+^stable/7/ re
 ^releng/8.0/   (security-officer|so)
 ^releng/7.[0-2]/   (security-officer|so)
 ^releng/6.[0-4]/   (security-officer|so)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202888 - stable/7/sys/conf

2010-01-23 Thread Ken Smith
Author: kensmith
Date: Sat Jan 23 15:28:18 2010
New Revision: 202888
URL: http://svn.freebsd.org/changeset/base/202888

Log:
  Adjust to indicate we've begun the 7.3-RELEASE release cycle.
  
  Approved by:  re (implicit)

Modified:
  stable/7/sys/conf/newvers.sh

Modified: stable/7/sys/conf/newvers.sh
==
--- stable/7/sys/conf/newvers.shSat Jan 23 14:56:16 2010
(r202887)
+++ stable/7/sys/conf/newvers.shSat Jan 23 15:28:18 2010
(r202888)
@@ -31,8 +31,8 @@
 # $FreeBSD$
 
 TYPE=FreeBSD
-REVISION=7.2
-BRANCH=STABLE
+REVISION=7.3
+BRANCH=PRERELEASE
 if [ X${BRANCH_OVERRIDE} != X ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202889 - head/sys/kern

2010-01-23 Thread Attilio Rao
Author: attilio
Date: Sat Jan 23 15:54:21 2010
New Revision: 202889
URL: http://svn.freebsd.org/changeset/base/202889

Log:
  - Fix a race in sched_switch() of sched_4bsd.
In the case of the thread being on a sleepqueue or a turnstile, the
sched_lock was acquired (without the aid of the td_lock interface) and
the td_lock was dropped. This was going to break locking rules on other
threads willing to access to the thread (via the td_lock interface) and
modify his flags (allowed as long as the container lock was different
by the one used in sched_switch).
In order to prevent this situation, while sched_lock is acquired there
the td_lock gets blocked. [0]
  - Merge the ULE's internal function thread_block_switch() into the global
thread_lock_block() and make the former semantic as the default for
thread_lock_block(). This means that thread_lock_block() will not
disable interrupts when called (and consequently thread_unlock_block()
will not re-enabled them when called). This should be done manually
when necessary.
Note, however, that ULE's thread_unblock_switch() is not reaped
because it does reflect a difference in semantic due in ULE (the
td_lock may not be necessarilly still blocked_lock when calling this).
While asymmetric, it does describe a remarkable difference in semantic
that is good to keep in mind.
  
  [0] Reported by:  Kohji Okuno
okuno dot kohji at jp dot panasonic dot com
  Tested by:Giovanni Trematerra
giovanni dot trematerra at gmail dot com
  MFC:  2 weeks

Modified:
  head/sys/kern/kern_mutex.c
  head/sys/kern/sched_4bsd.c
  head/sys/kern/sched_ule.c

Modified: head/sys/kern/kern_mutex.c
==
--- head/sys/kern/kern_mutex.c  Sat Jan 23 15:28:18 2010(r202888)
+++ head/sys/kern/kern_mutex.c  Sat Jan 23 15:54:21 2010(r202889)
@@ -616,7 +616,6 @@ thread_lock_block(struct thread *td)
 {
struct mtx *lock;
 
-   spinlock_enter();
THREAD_LOCK_ASSERT(td, MA_OWNED);
lock = td-td_lock;
td-td_lock = blocked_lock;
@@ -631,7 +630,6 @@ thread_lock_unblock(struct thread *td, s
mtx_assert(new, MA_OWNED);
MPASS(td-td_lock == blocked_lock);
atomic_store_rel_ptr((volatile void *)td-td_lock, (uintptr_t)new);
-   spinlock_exit();
 }
 
 void

Modified: head/sys/kern/sched_4bsd.c
==
--- head/sys/kern/sched_4bsd.c  Sat Jan 23 15:28:18 2010(r202888)
+++ head/sys/kern/sched_4bsd.c  Sat Jan 23 15:54:21 2010(r202889)
@@ -920,9 +920,11 @@ sched_sleep(struct thread *td, int pri)
 void
 sched_switch(struct thread *td, struct thread *newtd, int flags)
 {
+   struct mtx *tmtx;
struct td_sched *ts;
struct proc *p;
 
+   tmtx = NULL;
ts = td-td_sched;
p = td-td_proc;
 
@@ -931,10 +933,11 @@ sched_switch(struct thread *td, struct t
/* 
 * Switch to the sched lock to fix things up and pick
 * a new thread.
+* Block the td_lock in order to avoid breaking the critical path.
 */
if (td-td_lock != sched_lock) {
mtx_lock_spin(sched_lock);
-   thread_unlock(td);
+   tmtx = thread_lock_block(td);
}
 
if ((td-td_flags  TDF_NOLOAD) == 0)
@@ -1004,7 +1007,7 @@ sched_switch(struct thread *td, struct t
(*dtrace_vtime_switch_func)(newtd);
 #endif
 
-   cpu_switch(td, newtd, td-td_lock);
+   cpu_switch(td, newtd, tmtx != NULL ? tmtx : td-td_lock);
lock_profile_obtain_lock_success(sched_lock.lock_object,
0, 0, __FILE__, __LINE__);
/*

Modified: head/sys/kern/sched_ule.c
==
--- head/sys/kern/sched_ule.c   Sat Jan 23 15:28:18 2010(r202888)
+++ head/sys/kern/sched_ule.c   Sat Jan 23 15:54:21 2010(r202889)
@@ -301,7 +301,6 @@ static int sched_pickcpu(struct thread *
 static void sched_balance(void);
 static int sched_balance_pair(struct tdq *, struct tdq *);
 static inline struct tdq *sched_setcpu(struct thread *, int, int);
-static inline struct mtx *thread_block_switch(struct thread *);
 static inline void thread_unblock_switch(struct thread *, struct mtx *);
 static struct mtx *sched_switch_migrate(struct tdq *, struct thread *, int);
 static int sysctl_kern_sched_topology_spec(SYSCTL_HANDLER_ARGS);
@@ -1106,9 +1105,11 @@ sched_setcpu(struct thread *td, int cpu,
 * The hard case, migration, we need to block the thread first to
 * prevent order reversals with other cpus locks.
 */
+   spinlock_enter();
thread_lock_block(td);
TDQ_LOCK(tdq);
thread_lock_unblock(td, 

svn commit: r202890 - stable/8/sys/dev/agp

2010-01-23 Thread Robert Noland
Author: rnoland
Date: Sat Jan 23 16:29:04 2010
New Revision: 202890
URL: http://svn.freebsd.org/changeset/base/202890

Log:
  MFC r200764
  
  Fix a handful of issues with via agp support.
  
* Read the pci capability register to identify AGP 3 support
* Add missing smaller aperture sizes for AGP3 chips.
* Fix the aperture size calculation on AGP2 chips.
  All sizes between 32M and 256M reported as 256M.
* Add \n to error string.

Modified:
  stable/8/sys/dev/agp/agp_via.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/agp/agp_via.c
==
--- stable/8/sys/dev/agp/agp_via.c  Sat Jan 23 15:54:21 2010
(r202889)
+++ stable/8/sys/dev/agp/agp_via.c  Sat Jan 23 16:29:04 2010
(r202890)
@@ -165,39 +165,16 @@ agp_via_attach(device_t dev)
struct agp_gatt *gatt;
int error;
u_int32_t agpsel;
+   u_int32_t capid;
 
-   /* XXX: This should be keying off of whether the bridge is AGP3 capable,
-* rather than a bunch of device ids for chipsets that happen to do 8x.
-*/
-   switch (pci_get_devid(dev)) {
-   case 0x01981106:
-   case 0x02591106:
-   case 0x02691106:
-   case 0x02961106:
-   case 0x03141106:
-   case 0x03241106:
-   case 0x03271106:
-   case 0x03641106:
-   case 0x31231106:
-   case 0x31681106:
-   case 0x31891106:
-   case 0x32051106:
-   case 0x32581106:
-   case 0xb1981106:
-   /* The newer VIA chipsets will select the AGP version based on
-* what AGP versions the card supports.  We still have to
-* program it using the v2 registers if it has chosen to use
-* compatibility mode.
-*/
+   sc-regs = via_v2_regs;
+
+   /* Look at the capability register to see if we handle AGP3 */
+   capid = pci_read_config(dev, agp_find_caps(dev) + AGP_CAPID, 4);
+   if (((capid  20)  0x0f) = 3) { 
agpsel = pci_read_config(dev, AGP_VIA_AGPSEL, 1);
if ((agpsel  (1  1)) == 0)
sc-regs = via_v3_regs;
-   else
-   sc-regs = via_v2_regs;
-   break;
-   default:
-   sc-regs = via_v2_regs;
-   break;
}

error = agp_generic_attach(dev);
@@ -235,7 +212,7 @@ agp_via_attach(device_t dev)
pci_write_config(dev, sc-regs[REG_ATTBASE], gatt-ag_physical, 
4);

/* Enable the aperture. */
-   gartctrl = pci_read_config(dev, sc-regs[REG_ATTBASE], 4);
+   gartctrl = pci_read_config(dev, sc-regs[REG_GARTCTRL], 4);
pci_write_config(dev, sc-regs[REG_GARTCTRL], gartctrl | (3  
7), 4);
}
 
@@ -268,7 +245,7 @@ agp_via_get_aperture(device_t dev)
u_int32_t apsize;
 
if (sc-regs == via_v2_regs) {
-   apsize = pci_read_config(dev, sc-regs[REG_APSIZE], 1)  0x1f;
+   apsize = pci_read_config(dev, sc-regs[REG_APSIZE], 1);
 
/*
 * The size is determined by the number of low bits of
@@ -295,8 +272,14 @@ agp_via_get_aperture(device_t dev)
return 0x0400;
case 0xf38:
return 0x0200;
+   case 0xf3c:
+   return 0x0100;
+   case 0xf3e:
+   return 0x0080;
+   case 0xf3f:
+   return 0x0040;
default:
-   device_printf(dev, Invalid aperture setting 0x%x,
+   device_printf(dev, Invalid aperture setting 0x%x\n,
pci_read_config(dev, sc-regs[REG_APSIZE], 2));
return 0;
}
@@ -345,6 +328,15 @@ agp_via_set_aperture(device_t dev, u_int
case 0x0200:
key = 0xf38;
break;
+   case 0x0100:
+   key = 0xf3c;
+   break;
+   case 0x0080:
+   key = 0xf3e;
+   break;
+   case 0x0040:
+   key = 0xf3f;
+   break;
default:
device_printf(dev, Invalid aperture size (%dMb)\n,
aperture / 1024 / 1024);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to 

svn commit: r202891 - in stable/8: sys/kern sys/netinet sys/netinet6 sys/sys usr.sbin/jail

2010-01-23 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Jan 23 16:40:35 2010
New Revision: 202891
URL: http://svn.freebsd.org/changeset/base/202891

Log:
  MFC r202468:
  
Add ip4.saddrsel/ip4.nosaddrsel (and equivalent for ip6) to control
whether to use source address selection (default) or the primary
jail address for unbound outgoing connections.
  
This is intended to be used by people upgrading from single-IP
jails to multi-IP jails but not having to change firewall rules,
application ACLs, ... but to force their connections (unless
otherwise changed) to the primry jail IP they had been used for
years, as well as for people prefering to implement similar policies.
  
Note that for IPv6, if configured incorrectly, this might lead to
scope violations, which single-IPv6 jails could as well, as by the
design of jails. [1]
  
Reviewed by:jamie, hrs (ipv6 part)
Pointed out by: hrs [1]

Modified:
  stable/8/sys/kern/kern_jail.c
  stable/8/sys/netinet/in_pcb.c
  stable/8/sys/netinet6/in6_src.c
  stable/8/sys/sys/jail.h
  stable/8/usr.sbin/jail/jail.8
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/usr.sbin/jail/   (props changed)

Modified: stable/8/sys/kern/kern_jail.c
==
--- stable/8/sys/kern/kern_jail.c   Sat Jan 23 16:29:04 2010
(r202890)
+++ stable/8/sys/kern/kern_jail.c   Sat Jan 23 16:40:35 2010
(r202891)
@@ -77,6 +77,21 @@ __FBSDID($FreeBSD$);
 
 MALLOC_DEFINE(M_PRISON, prison, Prison structures);
 
+/* Keep struct prison prison0 and some code in kern_jail_set() readable. */
+#ifdef INET
+#ifdef INET6
+#define_PR_IP_SADDRSEL PR_IP4_SADDRSEL|PR_IP6_SADDRSEL
+#else
+#define_PR_IP_SADDRSEL PR_IP4_SADDRSEL
+#endif
+#else /* !INET */
+#ifdef INET6
+#define_PR_IP_SADDRSEL PR_IP6_SADDRSEL
+#else
+#define_PR_IP_SADDRSEL 0
+#endif
+#endif
+
 /* prison0 describes what is real about the system. */
 struct prison prison0 = {
.pr_id  = 0,
@@ -89,9 +104,9 @@ struct prison prison0 = {
.pr_hostuuid= DEFAULT_HOSTUUID,
.pr_children= LIST_HEAD_INITIALIZER(prison0.pr_children),
 #ifdef VIMAGE
-   .pr_flags   = PR_HOST|PR_VNET,
+   .pr_flags   = PR_HOST|PR_VNET|_PR_IP_SADDRSEL,
 #else
-   .pr_flags   = PR_HOST,
+   .pr_flags   = PR_HOST|_PR_IP_SADDRSEL,
 #endif
.pr_allow   = PR_ALLOW_ALL,
 };
@@ -129,10 +144,22 @@ static int prison_restrict_ip6(struct pr
  */
 static char *pr_flag_names[] = {
[0] = persist,
+#ifdef INET
+   [7] = ip4.saddrsel,
+#endif
+#ifdef INET6
+   [8] = ip6.saddrsel,
+#endif
 };
 
 static char *pr_flag_nonames[] = {
[0] = nopersist,
+#ifdef INET
+   [7] = ip4.nosaddrsel,
+#endif
+#ifdef INET6
+   [8] = ip6.nosaddrsel,
+#endif
 };
 
 struct jailsys_flags {
@@ -1199,6 +1226,9 @@ kern_jail_set(struct thread *td, struct 
 #endif
}
 #endif
+   /* Source address selection is always on by default. */
+   pr-pr_flags |= _PR_IP_SADDRSEL;
+
pr-pr_securelevel = ppr-pr_securelevel;
pr-pr_allow = JAIL_DEFAULT_ALLOW  ppr-pr_allow;
pr-pr_enforce_statfs = JAIL_DEFAULT_ENFORCE_STATFS;
@@ -2659,6 +2689,41 @@ prison_get_ip4(struct ucred *cred, struc
 }
 
 /*
+ * Return 1 if we should do proper source address selection or are not jailed.
+ * We will return 0 if we should bypass source address selection in favour
+ * of the primary jail IPv4 address. Only in this case *ia will be updated and
+ * returned in NBO.
+ * Return EAFNOSUPPORT, in case this jail does not allow IPv4.
+ */
+int
+prison_saddrsel_ip4(struct ucred *cred, struct in_addr *ia)
+{
+   struct prison *pr;
+   struct in_addr lia;
+   int error;
+
+   KASSERT(cred != NULL, (%s: cred is NULL, __func__));
+   KASSERT(ia != NULL, (%s: ia is NULL, __func__));
+
+   if (!jailed(cred))
+   return (1);
+
+   pr = cred-cr_prison;
+   if (pr-pr_flags  PR_IP4_SADDRSEL)
+   return (1);
+
+   lia.s_addr = INADDR_ANY;
+   error = prison_get_ip4(cred, lia);
+   if (error)
+   return (error);
+   if (lia.s_addr == INADDR_ANY)
+   return (1);
+
+   ia-s_addr = lia.s_addr;
+   return (0);
+}
+
+/*
  * Return true if pr1 and pr2 have the same IPv4 address restrictions.
  */
 int
@@ -2964,6 +3029,41 @@ prison_get_ip6(struct ucred *cred, struc
 }
 
 /*
+ * Return 1 if we should do proper source address selection or are not jailed.
+ * We will return 0 if we should bypass source address selection in favour
+ * of the primary jail IPv6 

Re: svn commit: r202870 - head/sys/dev/ieee488

2010-01-23 Thread Bjoern A. Zeeb

On Sat, 23 Jan 2010, Joerg Wunsch wrote:


Author: joerg
Date: Sat Jan 23 07:54:06 2010
New Revision: 202870
URL: http://svn.freebsd.org/changeset/base/202870

Log:
 Overhaul of the pcii driver:


...


 MFC after: 1 day


If it's not security related - we don't do that and still use a
minmium of 3 days to catch problems ... like that this seems to have
broken HEAD.

--
Bjoern A. Zeeb It will not break if you know what you are doing.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202892 - head/usr.bin

2010-01-23 Thread Antoine Brodin
Author: antoine
Date: Sat Jan 23 17:31:13 2010
New Revision: 202892
URL: http://svn.freebsd.org/changeset/base/202892

Log:
  Unbreak world WITHOUT_OPENSSL:
  the new dc(1) depends on crypto(3) and bc(1) depends on dc(1).

Modified:
  head/usr.bin/Makefile

Modified: head/usr.bin/Makefile
==
--- head/usr.bin/Makefile   Sat Jan 23 16:40:35 2010(r202891)
+++ head/usr.bin/Makefile   Sat Jan 23 17:31:13 2010(r202892)
@@ -18,7 +18,7 @@ SUBDIR=   alias \
awk \
banner \
basename \
-   bc \
+   ${_bc} \
${_biff} \
${_bluetooth} \
brandelf \
@@ -50,7 +50,7 @@ SUBDIR=   alias \
${_csup} \
${_ctags} \
cut \
-   dc \
+   ${_dc} \
${_dig} \
dirname \
du \
@@ -280,7 +280,9 @@ _hesinfo=   hesinfo
 .endif
 
 .if ${MK_OPENSSL} != no
+_bc=   bc
 _chkey=chkey
+_dc=   dc
 _newkey=   newkey
 .if ${MK_LIBTHR} != no
 _csup= csup
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202893 - head/lib/libc/gen

2010-01-23 Thread Ed Schouten
Author: ed
Date: Sat Jan 23 17:58:40 2010
New Revision: 202893
URL: http://svn.freebsd.org/changeset/base/202893

Log:
  EMPTY records don't have a timestamp.

Modified:
  head/lib/libc/gen/getutxent.3

Modified: head/lib/libc/gen/getutxent.3
==
--- head/lib/libc/gen/getutxent.3   Sat Jan 23 17:31:13 2010
(r202892)
+++ head/lib/libc/gen/getutxent.3   Sat Jan 23 17:58:40 2010
(r202893)
@@ -138,7 +138,8 @@ Other fields inside the structure are:
 .Bl -tag -width ut_user
 .It Fa ut_tv
 The time the event occured.
-This field is used for all types of entries.
+This field is used for all types of entries, except
+.Dv EMPTY .
 .It Fa ut_id
 An identifier that is used to refer to the entry.
 This identifier can be used to remove or replace a login entry by
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202894 - in head/sys/i386: i386 include

2010-01-23 Thread Alan Cox
Author: alc
Date: Sat Jan 23 18:42:28 2010
New Revision: 202894
URL: http://svn.freebsd.org/changeset/base/202894

Log:
  Handle a race between pmap_kextract() and pmap_promote_pde().  This race is
  known to cause a kernel crash in ZFS on i386 when superpage promotion is
  enabled.
  
  Tested by:netchild
  MFC after:1 week

Modified:
  head/sys/i386/i386/pmap.c
  head/sys/i386/include/pmap.h

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Sat Jan 23 17:58:40 2010(r202893)
+++ head/sys/i386/i386/pmap.c   Sat Jan 23 18:42:28 2010(r202894)
@@ -243,8 +243,9 @@ struct sysmaps {
caddr_t CADDR2;
 };
 static struct sysmaps sysmaps_pcpu[MAXCPU];
-pt_entry_t *CMAP1 = 0;
+pt_entry_t *CMAP1 = 0, *KPTmap;
 static pt_entry_t *CMAP3;
+static pd_entry_t *KPTD;
 caddr_t CADDR1 = 0, ptvmmap = 0;
 static caddr_t CADDR3;
 struct msgbuf *msgbufp = 0;
@@ -421,6 +422,21 @@ pmap_bootstrap(vm_paddr_t firstaddr)
SYSMAP(struct msgbuf *, unused, msgbufp, atop(round_page(MSGBUF_SIZE)))
 
/*
+* KPTmap is used by pmap_kextract().
+*/
+   SYSMAP(pt_entry_t *, KPTD, KPTmap, KVA_PAGES)
+
+   for (i = 0; i  NKPT; i++)
+   KPTD[i] = (KPTphys + (i  PAGE_SHIFT)) | PG_RW | PG_V;
+
+   /*
+* Adjust the start of the KPTD and KPTmap so that the implementation
+* of pmap_kextract() and pmap_growkernel() can be made simpler.
+*/
+   KPTD -= KPTDI;
+   KPTmap -= i386_btop(KPTDI  PDRSHIFT);
+
+   /*
 * ptemap is used for pmap_pte_quick
 */
SYSMAP(pt_entry_t *, PMAP1, PADDR1, 1);
@@ -1839,6 +1855,7 @@ pmap_growkernel(vm_offset_t addr)
vm_page_t nkpg;
pd_entry_t newpdir;
pt_entry_t *pde;
+   boolean_t updated_PTD;
 
mtx_assert(kernel_map-system_mtx, MA_OWNED);
if (kernel_vm_end == 0) {
@@ -1878,14 +1895,20 @@ pmap_growkernel(vm_offset_t addr)
pmap_zero_page(nkpg);
ptppaddr = VM_PAGE_TO_PHYS(nkpg);
newpdir = (pd_entry_t) (ptppaddr | PG_V | PG_RW | PG_A | PG_M);
-   pdir_pde(PTD, kernel_vm_end) = newpdir;
+   pdir_pde(KPTD, kernel_vm_end) = newpdir;
 
+   updated_PTD = FALSE;
mtx_lock_spin(allpmaps_lock);
LIST_FOREACH(pmap, allpmaps, pm_list) {
+   if ((pmap-pm_pdir[PTDPTDI]  PG_FRAME) == (PTDpde[0] 
+   PG_FRAME))
+   updated_PTD = TRUE;
pde = pmap_pde(pmap, kernel_vm_end);
pde_store(pde, newpdir);
}
mtx_unlock_spin(allpmaps_lock);
+   KASSERT(updated_PTD,
+   (pmap_growkernel: current page table is not in allpmaps));
kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG)  
~(PAGE_SIZE * NPTEPG - 1);
if (kernel_vm_end - 1 = kernel_map-max_offset) {
kernel_vm_end = kernel_map-max_offset;

Modified: head/sys/i386/include/pmap.h
==
--- head/sys/i386/include/pmap.hSat Jan 23 17:58:40 2010
(r202893)
+++ head/sys/i386/include/pmap.hSat Jan 23 18:42:28 2010
(r202894)
@@ -265,6 +265,16 @@ pte_load_store_ma(pt_entry_t *ptep, pt_e
 #definepde_store_ma(ptep, pte) pte_load_store_ma((ptep), 
(pt_entry_t)pte)
 
 #elif !defined(XEN)
+
+/*
+ * KPTmap is a linear mapping of the kernel page table.  It differs from the
+ * recursive mapping in two ways: (1) it only provides access to kernel page
+ * table pages, and not user page table pages, and (2) it provides access to
+ * a kernel page table page after the corresponding virtual addresses have
+ * been promoted to a 2/4MB page mapping.
+ */
+extern pt_entry_t *KPTmap;
+
 /*
  * Routine:pmap_kextract
  * Function:
@@ -279,10 +289,17 @@ pmap_kextract(vm_offset_t va)
if ((pa = PTD[va  PDRSHIFT])  PG_PS) {
pa = (pa  PG_PS_FRAME) | (va  PDRMASK);
} else {
-   pa = *vtopte(va);
+   /*
+* Beware of a concurrent promotion that changes the PDE at
+* this point!  For example, vtopte() must not be used to
+* access the PTE because it would use the new PDE.  It is,
+* however, safe to use the old PDE because the page table
+* page is preserved by the promotion.
+*/
+   pa = KPTmap[i386_btop(va)];
pa = (pa  PG_FRAME) | (va  PAGE_MASK);
}
-   return pa;
+   return (pa);
 }
 
 #define PT_UPDATES_FLUSH()
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to 

svn commit: r202895 - stable/7/sys/kern

2010-01-23 Thread Konstantin Belousov
Author: kib
Date: Sat Jan 23 19:01:25 2010
New Revision: 202895
URL: http://svn.freebsd.org/changeset/base/202895

Log:
  MFC r186277:
  The quotactl, statfs and fstatfs syscall implementations may dereference
  NULL pointer to struct mount if the looked up vnode is reclaimed. Also,
  these syscalls only mnt_ref() the mp, still allowing it to be unmounted;
  only struct mount memory is kept from being reused.
  
  Lock the vnode when doing name lookup, then reference its mount point,
  unlock the vnode and vfs_busy the mountpoint. This sequence shall take
  care of both races.
  
  MFC r188141 (by trasz):
  In some situations, mnt_lockref could go negative due to vfs_unbusy() being
  called without calling vfs_busy() first.  This made umount(8) hang waiting
  for mnt_lockref to become zero, which would never happen.
  
  MFC r196887:
  In fhopen, vfs_ref() the mount point while vnode is unlocked, to prevent
  vn_start_write(NULL, mp) from operating on potentially freed or reused
  struct mount *.
  
  Remove unmatched vfs_rel() in cleanup.
  
  Approved by:  re (bz)

Modified:
  stable/7/sys/kern/vfs_syscalls.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/vfs_syscalls.c
==
--- stable/7/sys/kern/vfs_syscalls.cSat Jan 23 18:42:28 2010
(r202894)
+++ stable/7/sys/kern/vfs_syscalls.cSat Jan 23 19:01:25 2010
(r202895)
@@ -200,19 +200,21 @@ quotactl(td, uap)
AUDIT_ARG(uid, uap-uid);
if (jailed(td-td_ucred)  !prison_quotas)
return (EPERM);
-   NDINIT(nd, LOOKUP, FOLLOW | MPSAFE | AUDITVNODE1,
+   NDINIT(nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE | AUDITVNODE1,
   UIO_USERSPACE, uap-path, td);
if ((error = namei(nd)) != 0)
return (error);
vfslocked = NDHASGIANT(nd);
NDFREE(nd, NDF_ONLY_PNBUF);
mp = nd.ni_vp-v_mount;
-   if ((error = vfs_busy(mp, 0, NULL, td))) {
-   vrele(nd.ni_vp);
+   vfs_ref(mp);
+   vput(nd.ni_vp);
+   error = vfs_busy(mp, 0, NULL, td);
+   vfs_rel(mp);
+   if (error) {
VFS_UNLOCK_GIANT(vfslocked);
return (error);
}
-   vrele(nd.ni_vp);
error = VFS_QUOTACTL(mp, uap-cmd, uap-uid, uap-arg, td);
vfs_unbusy(mp, td);
VFS_UNLOCK_GIANT(vfslocked);
@@ -306,6 +308,12 @@ kern_statfs(struct thread *td, char *pat
vfs_ref(mp);
NDFREE(nd, NDF_ONLY_PNBUF);
vput(nd.ni_vp);
+   error = vfs_busy(mp, 0, NULL, td);
+   vfs_rel(mp);
+   if (error) {
+   VFS_UNLOCK_GIANT(vfslocked);
+   return (error);
+   }
 #ifdef MAC
error = mac_check_mount_stat(td-td_ucred, mp);
if (error)
@@ -329,7 +337,7 @@ kern_statfs(struct thread *td, char *pat
}
*buf = *sp;
 out:
-   vfs_rel(mp);
+   vfs_unbusy(mp);
VFS_UNLOCK_GIANT(vfslocked);
if (mtx_owned(Giant))
printf(statfs(%d): %s: %d\n, vfslocked, path, error);
@@ -387,10 +395,16 @@ kern_fstatfs(struct thread *td, int fd, 
vfs_ref(mp);
VOP_UNLOCK(vp, 0, td);
fdrop(fp, td);
-   if (vp-v_iflag  VI_DOOMED) {
+   if (mp == NULL) {
error = EBADF;
goto out;
}
+   error = vfs_busy(mp, 0, NULL, td);
+   vfs_rel(mp);
+   if (error) {
+   VFS_UNLOCK_GIANT(vfslocked);
+   return (error);
+   }
 #ifdef MAC
error = mac_check_mount_stat(td-td_ucred, mp);
if (error)
@@ -415,7 +429,7 @@ kern_fstatfs(struct thread *td, int fd, 
*buf = *sp;
 out:
if (mp)
-   vfs_rel(mp);
+   vfs_unbusy(mp);
VFS_UNLOCK_GIANT(vfslocked);
return (error);
 }
@@ -4177,13 +4191,16 @@ fhopen(td, uap)
goto bad;
}
if (fmode  O_TRUNC) {
+   vfs_ref(mp);
VOP_UNLOCK(vp, 0, td);  /* XXX */
if ((error = vn_start_write(NULL, mp, V_WAIT | PCATCH)) != 0) {
vrele(vp);
+   vfs_rel(mp);
goto out;
}
VOP_LEASE(vp, td, td-td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);   /* XXX */
+   vfs_rel(mp);
 #ifdef MAC
/*
 * We don't yet have fp-f_cred, so use td-td_ucred, which
@@ -4261,7 +4278,6 @@ fhopen(td, uap)
 
VOP_UNLOCK(vp, 0, td);
fdrop(fp, td);
-   vfs_rel(mp);
VFS_UNLOCK_GIANT(vfslocked);
td-td_retval[0] = indx;
return (0);
___
svn-src-all@freebsd.org mailing 

svn commit: r202896 - head

2010-01-23 Thread Antoine Brodin
Author: antoine
Date: Sat Jan 23 19:29:42 2010
New Revision: 202896
URL: http://svn.freebsd.org/changeset/base/202896

Log:
  Unbreak world:
  - WITHOUT_OPENSSH (and WITH_KERBEROS)
  - WITHOUT_KERBEROS and WITH_GSSAPI
  
  PR:   137483
  Submitted by: bf
  MFC after:2 weeks
  
  Note: this breaks harder world WITHOUT_GSSAPI (and WITH_KERBEROS), but well

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Sat Jan 23 19:01:25 2010(r202895)
+++ head/Makefile.inc1  Sat Jan 23 19:29:42 2010(r202896)
@@ -1136,14 +1136,16 @@ _cddl_lib= cddl/lib
 _secure_lib_libcrypto= secure/lib/libcrypto
 _secure_lib_libssl= secure/lib/libssl
 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
-.if ${MK_OPENSSH} != no
-_secure_lib_libssh= secure/lib/libssh
-secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
 .if ${MK_KERBEROS} != no
 kerberos5/lib/libgssapi_krb5__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
 lib/libmd__L kerberos5/lib/libroken__L secure/lib/libcrypto__L \
 lib/libcrypt__L
+.endif
+.if ${MK_OPENSSH} != no
+_secure_lib_libssh= secure/lib/libssh
+secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
+.if ${MK_KERBEROS_SUPPORT} != no
 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libgssapi_krb5__L
 .endif
 .endif
@@ -1151,6 +1153,10 @@ secure/lib/libssh__L: lib/libgssapi__L k
 _secure_lib=   secure/lib
 .endif
 
+.if ${MK_GSSAPI} != no
+_lib_libgssapi=lib/libgssapi
+.endif
+
 .if ${MK_IPX} != no
 _lib_libipx=   lib/libipx
 .endif
@@ -1163,7 +1169,6 @@ _kerberos5_lib_libhx509= kerberos5/lib/l
 _kerberos5_lib_libroken= kerberos5/lib/libroken
 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
 _kerberos5_lib_libgssapi_krb5= kerberos5/lib/libgssapi_krb5
-_lib_libgssapi=lib/libgssapi
 .endif
 
 .if ${MK_NIS} != no
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r202842 - in stable/6/usr.sbin/pkg_install: add create delete info lib updating version

2010-01-23 Thread Doug Barton
On 01/22/10 15:19, Florent Thoumie wrote:
 Author: flz
 Date: Fri Jan 22 23:19:33 2010
 New Revision: 202842
 URL: http://svn.freebsd.org/changeset/base/202842
 
 Log:
   Synchronize pkg_install with HEAD.

I am not of the camp that believes repeating the entire commit message
(or messages) is always necessary, however a brief summary of the
changes is usually desirable.


Doug


-- 

Improve the effectiveness of your Internet presence with
a domain name makeover!http://SupersetSolutions.com/

Computers are useless. They can only give you answers.
-- Pablo Picasso

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r202892 - head/usr.bin

2010-01-23 Thread Doug Barton
On 01/23/10 09:31, Antoine Brodin wrote:
 Author: antoine
 Date: Sat Jan 23 17:31:13 2010
 New Revision: 202892
 URL: http://svn.freebsd.org/changeset/base/202892
 
 Log:
   Unbreak world WITHOUT_OPENSSL:
   the new dc(1) depends on crypto(3) and bc(1) depends on dc(1).

The dependency on crytpo(3) seems problematic. What's the nature of the
dependency and how hard would it be to work around?


Doug

-- 

Improve the effectiveness of your Internet presence with
a domain name makeover!http://SupersetSolutions.com/

Computers are useless. They can only give you answers.
-- Pablo Picasso

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202897 - head/sys/amd64/amd64

2010-01-23 Thread Alan Cox
Author: alc
Date: Sat Jan 23 20:28:37 2010
New Revision: 202897
URL: http://svn.freebsd.org/changeset/base/202897

Log:
  Simplify the mapping of the system message buffer.  Use the direct map just
  like ia64 does.

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/amd64/amd64/pmap.c

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Sat Jan 23 19:29:42 2010
(r202896)
+++ head/sys/amd64/amd64/machdep.c  Sat Jan 23 20:28:37 2010
(r202897)
@@ -157,6 +157,8 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST,
 extern vm_offset_t ksym_start, ksym_end;
 #endif
 
+struct msgbuf *msgbufp;
+
 /* Intel ICH registers */
 #define ICH_PMBASE 0x400
 #define ICH_SMI_EN ICH_PMBASE + 0x30
@@ -1275,7 +1277,7 @@ add_smap_entry(struct bios_smap *smap, v
 static void
 getmemsize(caddr_t kmdp, u_int64_t first)
 {
-   int i, off, physmap_idx, pa_indx, da_indx;
+   int i, physmap_idx, pa_indx, da_indx;
vm_paddr_t pa, physmap[PHYSMAP_SIZE];
u_long physmem_tunable;
pt_entry_t *pte;
@@ -1508,9 +1510,7 @@ do_next:
phys_avail[pa_indx] -= round_page(MSGBUF_SIZE);
 
/* Map the message buffer. */
-   for (off = 0; off  round_page(MSGBUF_SIZE); off += PAGE_SIZE)
-   pmap_kenter((vm_offset_t)msgbufp + off, phys_avail[pa_indx] +
-   off);
+   msgbufp = (struct msgbuf *)PHYS_TO_DMAP(phys_avail[pa_indx]);
 }
 
 u_int64_t

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Sat Jan 23 19:29:42 2010(r202896)
+++ head/sys/amd64/amd64/pmap.c Sat Jan 23 20:28:37 2010(r202897)
@@ -105,7 +105,6 @@ __FBSDID($FreeBSD$);
  * and to when physical maps must be made correct.
  */
 
-#include opt_msgbuf.h
 #include opt_pmap.h
 #include opt_vm.h
 
@@ -116,7 +115,6 @@ __FBSDID($FreeBSD$);
 #include sys/lock.h
 #include sys/malloc.h
 #include sys/mman.h
-#include sys/msgbuf.h
 #include sys/mutex.h
 #include sys/proc.h
 #include sys/sx.h
@@ -206,7 +204,6 @@ static int shpgperproc = PMAP_SHPGPERPRO
  */
 pt_entry_t *CMAP1 = 0;
 caddr_t CADDR1 = 0;
-struct msgbuf *msgbufp = 0;
 
 /*
  * Crashdump maps.
@@ -570,11 +567,6 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 */
SYSMAP(caddr_t, unused, crashdumpmap, MAXDUMPPGS)
 
-   /*
-* msgbufp is used to map the system message buffer.
-*/
-   SYSMAP(struct msgbuf *, unused, msgbufp, atop(round_page(MSGBUF_SIZE)))
-
virtual_avail = va;
 
*CMAP1 = 0;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202898 - head/sys/dev/ieee488

2010-01-23 Thread Joerg Wunsch
Author: joerg
Date: Sat Jan 23 21:33:33 2010
New Revision: 202898
URL: http://svn.freebsd.org/changeset/base/202898

Log:
  Fix breakage introduced to the tnt4882 driver in r202870.  This PCI
  frontend uses the same uPD7210 backend as the pcii ISA frontend, so
  the backend has to cope with both situations.
  
  Also, hide the first printf in pcii_probe (address mismatch) behind
  bootverbose as the ISA bus parent tries to probe all configured ISA
  devices against each driver, so a the console has been cluttered with
  this message for a bunch of unrelated driver probes.
  
  MFC after:3 days

Modified:
  head/sys/dev/ieee488/pcii.c
  head/sys/dev/ieee488/tnt4882.c
  head/sys/dev/ieee488/upd7210.c
  head/sys/dev/ieee488/upd7210.h

Modified: head/sys/dev/ieee488/pcii.c
==
--- head/sys/dev/ieee488/pcii.c Sat Jan 23 20:28:37 2010(r202897)
+++ head/sys/dev/ieee488/pcii.c Sat Jan 23 21:33:33 2010(r202898)
@@ -138,9 +138,10 @@ pcii_probe(device_t dev)
 * 1989 Edition, National Instruments.)
 */
if ((start  0x3ff) != 0x2e1) {
-   printf(pcii_probe: PCIIA base address 0x%lx not 
-  0x2e1/0x22e1/0x42e1/0x62e1\n,
-  start);
+   if (bootverbose)
+   printf(pcii_probe: PCIIA base address 0x%lx not 
+  0x2e1/0x22e1/0x42e1/0x62e1\n,
+  start);
return (ENXIO);
}
 
@@ -234,6 +235,7 @@ pcii_attach(device_t dev)
 
for (rid = 0; rid  8; rid++) {
sc-upd7210.reg_res[rid] = sc-res[2 + rid];
+   sc-upd7210.reg_offset[rid] = 0;
}
sc-upd7210.irq_clear_res = sc-res[10];
 

Modified: head/sys/dev/ieee488/tnt4882.c
==
--- head/sys/dev/ieee488/tnt4882.c  Sat Jan 23 20:28:37 2010
(r202897)
+++ head/sys/dev/ieee488/tnt4882.c  Sat Jan 23 21:33:33 2010
(r202898)
@@ -309,6 +309,9 @@ tnt_attach(device_t dev)
/* No DMA help */
sc-upd7210.dmachan = -1;
 
+   /* No special interrupt handling needed here. */
+   sc-upd7210.irq_clear_res = NULL;
+
upd7210attach(sc-upd7210);
 
return (0);

Modified: head/sys/dev/ieee488/upd7210.c
==
--- head/sys/dev/ieee488/upd7210.c  Sat Jan 23 20:28:37 2010
(r202897)
+++ head/sys/dev/ieee488/upd7210.c  Sat Jan 23 21:33:33 2010
(r202898)
@@ -72,7 +72,7 @@ upd7210_rd(struct upd7210 *u, enum upd72
 {
u_int r;
 
-   r = bus_read_1(u-reg_res[reg], 0);
+   r = bus_read_1(u-reg_res[reg], u-reg_offset[reg]);
u-rreg[reg] = r;
return (r);
 }
@@ -81,7 +81,7 @@ void
 upd7210_wr(struct upd7210 *u, enum upd7210_wreg reg, u_int val)
 {
 
-   bus_write_1(u-reg_res[reg], 0, val);
+   bus_write_1(u-reg_res[reg], u-reg_offset[reg], val);
u-wreg[reg] = val;
if (reg == AUXMR)
u-wreg[8 + (val  5)] = val  0x1f;
@@ -125,7 +125,8 @@ upd7210intr(void *arg)
 * Some clones apparently don't implement this
 * feature, but National Instrument cards do.
 */
-   bus_write_1(u-irq_clear_res, 0, 42);
+   if (u-irq_clear_res != NULL)
+   bus_write_1(u-irq_clear_res, 0, 42);
}
mtx_unlock(u-mutex);
 }

Modified: head/sys/dev/ieee488/upd7210.h
==
--- head/sys/dev/ieee488/upd7210.h  Sat Jan 23 20:28:37 2010
(r202897)
+++ head/sys/dev/ieee488/upd7210.h  Sat Jan 23 21:33:33 2010
(r202898)
@@ -50,6 +50,7 @@ typedef int upd7210_irq_t(struct upd7210
 struct upd7210 {
struct resource *reg_res[8];
struct resource *irq_clear_res;
+   u_int   reg_offset[8];
int dmachan;
int unit;
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r202850 - head/sys/mips/cavium

2010-01-23 Thread Peter Jeremy
On 2010-Jan-23 00:24:31 +, Warner Losh i...@freebsd.org wrote:
Author: imp
Date: Sat Jan 23 00:24:31 2010
New Revision: 202850
URL: http://svn.freebsd.org/changeset/base/202850

Log:
  Migrate from old DDB style debugger to newer KDB style.

Modified:
  head/sys/mips/cavium/octeon_machdep.c

Modified: head/sys/mips/cavium/octeon_machdep.c
==
--- head/sys/mips/cavium/octeon_machdep.c  Sat Jan 23 00:18:12 2010
(r202849)
+++ head/sys/mips/cavium/octeon_machdep.c  Sat Jan 23 00:24:31 2010
(r202850)
@@ -110,7 +110,7 @@ platform_cpu_init()
 void
 platform_reset(void)
 {
-  ((void(*)(void))(long)0x9fc0)();/* Jump to MIPS reset vector */
+  mips_generic_reset();
 }

Was this bit intended?  It doesn't tally with the log message.

-- 
Peter Jeremy


pgpgwXCIWAhy3.pgp
Description: PGP signature


Re: svn commit: r200509 - stable/8/libexec/rtld-elf

2010-01-23 Thread Robert N. M. Watson

On 14 Dec 2009, at 16:08, Bruce Evans wrote:

 On Mon, 14 Dec 2009, Robert Watson wrote:
 
 Log:
 Merge r197808 from head to stable/8:
 
   In rtld's map_object(), use pread(..., 0) rather than read() to read the
   ELF header from the front of the file.  As all other I/O on the binary
   is done using mmap(), this avoids the need for seek privileges on the
   file descriptor during run-time linking.
 
 Doesn't/shouldn't pread() require seek privileges?  It certainly uses them.

I think there are actually multiple notions of seek:

- Manipulation of the file descriptor offset, which occurs explicitly with 
lseek(2) or implicitly with read(2)/write(2)/..., but not with 
pread(2)/pwrite(2)/sendfile(2)/...
- Underlying object offset, such as the current location of the head relative 
to a tape in a tape drive, which will be manipulated implicitly as IO requests 
go down the stack regardless of the file descriptor offset changing

For the purposes of our ongoing capability project, the right to seek refers to 
changing the file descriptor offset, as in most instances we're interested in, 
the underlying object is a file rather than a special device. In particular, we 
want to be able to pass around capabilities for key libraries (the runtime 
linker itself, libc, etc) and share them between mutually untrusting processes, 
and not have the file descriptor offset allow interference between them.

Further confusing matters, we maintain file descriptor-level offsets for some 
stream-oriented objects, such as tty's, but not others, such as sockets.

Robert___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202900 - head/sys/sparc64/sparc64

2010-01-23 Thread Marius Strobl
Author: marius
Date: Sat Jan 23 22:11:18 2010
New Revision: 202900
URL: http://svn.freebsd.org/changeset/base/202900

Log:
  Merge r202882 from amd64/i386:
  
  For PT_TO_SCE stop that stops the ptraced process upon syscall entry,
  syscall arguments are collected before ptracestop() is called. As a
  consequence, debugger cannot modify syscall or its arguments.
  
  In syscall(), reread syscall number and arguments after ptracestop(),
  if debugger modified anything in the process environment. Since procfs
  stopevent requires number of syscall arguments in p_xstat, this cannot
  be solved by moving stop/trace point before argument fetching.
  
  Move the code to read arguments into separate function
  fetch_syscall_args() to avoid code duplication. Note that ktrace point
  for modified syscall is intentionally recorded twice, once with original
  arguments, and second time with the arguments set by debugger.
  
  PT_TO_SCX stop is executed after cpu_syscall_set_retval() already.
  
  Reviewed by:  kib

Modified:
  head/sys/sparc64/sparc64/trap.c

Modified: head/sys/sparc64/sparc64/trap.c
==
--- head/sys/sparc64/sparc64/trap.c Sat Jan 23 21:47:07 2010
(r202899)
+++ head/sys/sparc64/sparc64/trap.c Sat Jan 23 22:11:18 2010
(r202900)
@@ -93,9 +93,18 @@ __FBSDID($FreeBSD$);
 #include machine/tsb.h
 #include machine/watch.h
 
+struct syscall_args {
+   u_long code;
+   struct sysent *callp;
+   register_t args[8];
+   register_t *argp;
+   int narg;
+};
+
 void trap(struct trapframe *tf);
 void syscall(struct trapframe *tf);
 
+static int fetch_syscall_args(struct thread *td, struct syscall_args *sa);
 static int trap_pfault(struct thread *td, struct trapframe *tf);
 
 extern char copy_fault[];
@@ -522,137 +531,163 @@ trap_pfault(struct thread *td, struct tr
 /* Maximum number of arguments that can be passed via the out registers. */
 #defineREG_MAXARGS 6
 
-/*
- * Syscall handler. The arguments to the syscall are passed in the o registers
- * by the caller, and are saved in the trap frame. The syscall number is passed
- * in %g1 (and also saved in the trap frame).
- */
-void
-syscall(struct trapframe *tf)
+static int
+fetch_syscall_args(struct thread *td, struct syscall_args *sa)
 {
-   struct sysent *callp;
-   struct thread *td;
-   register_t args[8];
-   register_t *argp;
+   struct trapframe *tf;
struct proc *p;
-   u_long code;
int reg;
int regcnt;
-   int narg;
int error;
 
-   td = curthread;
-   KASSERT(td != NULL, (trap: curthread NULL));
-   KASSERT(td-td_proc != NULL, (trap: curproc NULL));
-
p = td-td_proc;
-
-   PCPU_INC(cnt.v_syscall);
-
-   td-td_pticks = 0;
-   td-td_frame = tf;
-   if (td-td_ucred != p-p_ucred)
-   cred_update_thread(td);
-   code = tf-tf_global[1];
-
-   /*
-* For syscalls, we don't want to retry the faulting instruction
-* (usually), instead we need to advance one instruction.
-*/
-   td-td_pcb-pcb_tpc = tf-tf_tpc;
-   TF_DONE(tf);
-
+   tf = td-td_frame;
reg = 0;
regcnt = REG_MAXARGS;
+
+   sa-code = tf-tf_global[1];
+
if (p-p_sysent-sv_prepsyscall) {
-   /*
-* The prep code is MP aware.
-*/
 #if 0
-   (*p-p_sysent-sv_prepsyscall)(tf, args, code, params);
+   (*p-p_sysent-sv_prepsyscall)(tf, sa-args, sa-code,
+   params);
 #endif
-   } else if (code == SYS_syscall || code == SYS___syscall) {
-   code = tf-tf_out[reg++];
+   } else if (sa-code == SYS_syscall || sa-code == SYS___syscall) {
+   sa-code = tf-tf_out[reg++];
regcnt--;
}
 
if (p-p_sysent-sv_mask)
-   code = p-p_sysent-sv_mask;
+   sa-code = p-p_sysent-sv_mask;
 
-   if (code = p-p_sysent-sv_size)
-   callp = p-p_sysent-sv_table[0];
+   if (sa-code = p-p_sysent-sv_size)
+   sa-callp = p-p_sysent-sv_table[0];
else
-   callp = p-p_sysent-sv_table[code];
-
-   narg = callp-sy_narg;
+   sa-callp = p-p_sysent-sv_table[sa-code];
 
-   KASSERT(narg = sizeof(args) / sizeof(args[0]),
+   sa-narg = sa-callp-sy_narg;
+   KASSERT(sa-narg = sizeof(sa-args) / sizeof(sa-args[0]),
(Too many syscall arguments!));
error = 0;
-   argp = args;
-   bcopy(tf-tf_out[reg], args, sizeof(args[0]) * regcnt);
-   if (narg  regcnt)
+   sa-argp = sa-args;
+   bcopy(tf-tf_out[reg], sa-args, sizeof(sa-args[0]) * regcnt);
+   if (sa-narg  regcnt)
error = copyin((void *)(tf-tf_out[6] + SPOFF +
-   offsetof(struct frame, fr_pad[6])),
-   args[regcnt], (narg - regcnt) * sizeof(args[0]));
-
-   

svn commit: r202903 - head/sys/fs/cd9660

2010-01-23 Thread Marius Strobl
Author: marius
Date: Sat Jan 23 22:38:01 2010
New Revision: 202903
URL: http://svn.freebsd.org/changeset/base/202903

Log:
  On LP64 struct ifid is 64-bit aligned while struct fid is 32-bit aligned
  so on architectures with strict alignment requirements we can't just simply
  cast the latter to the former but need to copy it bytewise instead.
  
  PR:   143010
  MFC after:3 days

Modified:
  head/sys/fs/cd9660/cd9660_vfsops.c
  head/sys/fs/cd9660/cd9660_vnops.c

Modified: head/sys/fs/cd9660/cd9660_vfsops.c
==
--- head/sys/fs/cd9660/cd9660_vfsops.c  Sat Jan 23 22:37:34 2010
(r202902)
+++ head/sys/fs/cd9660/cd9660_vfsops.c  Sat Jan 23 22:38:01 2010
(r202903)
@@ -589,17 +589,19 @@ cd9660_fhtovp(mp, fhp, vpp)
struct fid *fhp;
struct vnode **vpp;
 {
-   struct ifid *ifhp = (struct ifid *)fhp;
+   struct ifid ifh;
struct iso_node *ip;
struct vnode *nvp;
int error;
 
+   memcpy(ifh, fhp, sizeof(ifh));
+
 #ifdef ISOFS_DBG
printf(fhtovp: ino %d, start %ld\n,
-  ifhp-ifid_ino, ifhp-ifid_start);
+   ifh.ifid_ino, ifh.ifid_start);
 #endif
 
-   if ((error = VFS_VGET(mp, ifhp-ifid_ino, LK_EXCLUSIVE, nvp)) != 0) {
+   if ((error = VFS_VGET(mp, ifh.ifid_ino, LK_EXCLUSIVE, nvp)) != 0) {
*vpp = NULLVP;
return (error);
}

Modified: head/sys/fs/cd9660/cd9660_vnops.c
==
--- head/sys/fs/cd9660/cd9660_vnops.c   Sat Jan 23 22:37:34 2010
(r202902)
+++ head/sys/fs/cd9660/cd9660_vnops.c   Sat Jan 23 22:38:01 2010
(r202903)
@@ -819,20 +819,25 @@ cd9660_vptofh(ap)
struct fid *a_fhp;
} */ *ap;
 {
+   struct ifid ifh;
struct iso_node *ip = VTOI(ap-a_vp);
-   struct ifid *ifhp;
 
-   ifhp = (struct ifid *)ap-a_fhp;
-   ifhp-ifid_len = sizeof(struct ifid);
+   ifh.ifid_len = sizeof(struct ifid);
 
-   ifhp-ifid_ino = ip-i_number;
-   ifhp-ifid_start = ip-iso_start;
+   ifh.ifid_ino = ip-i_number;
+   ifh.ifid_start = ip-iso_start;
+   /*
+* This intentionally uses sizeof(ifh) in order to not copy stack
+* garbage on ILP32.
+*/
+   memcpy(ap-a_fhp, ifh, sizeof(ifh));
 
 #ifdef ISOFS_DBG
printf(vptofh: ino %d, start %ld\n,
-  ifhp-ifid_ino,ifhp-ifid_start);
+   ifh.ifid_ino, ifh.ifid_start);
 #endif
-   return 0;
+
+   return (0);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202904 - head/sys/ia64/ia64

2010-01-23 Thread Marcel Moolenaar
Author: marcel
Date: Sat Jan 23 23:16:50 2010
New Revision: 202904
URL: http://svn.freebsd.org/changeset/base/202904

Log:
  Remove cpu_boot() and call efi_reset_system() directly from
  cpu_reset().

Modified:
  head/sys/ia64/ia64/machdep.c

Modified: head/sys/ia64/ia64/machdep.c
==
--- head/sys/ia64/ia64/machdep.cSat Jan 23 22:38:01 2010
(r202903)
+++ head/sys/ia64/ia64/machdep.cSat Jan 23 23:16:50 2010
(r202904)
@@ -373,13 +373,6 @@ cpu_startup(void *dummy)
 SYSINIT(cpu_startup, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL);
 
 void
-cpu_boot(int howto)
-{
-
-   efi_reset_system();
-}
-
-void
 cpu_flush_dcache(void *ptr, size_t len)
 {
vm_offset_t lim, va;
@@ -434,7 +427,7 @@ void
 cpu_reset()
 {
 
-   cpu_boot(0);
+   efi_reset_system();
 }
 
 void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r202850 - head/sys/mips/cavium

2010-01-23 Thread M. Warner Losh
In message: 20100123215945.gf31...@server.vk2pj.dyndns.org
Peter Jeremy peterjer...@acm.org writes:
: On 2010-Jan-23 00:24:31 +, Warner Losh i...@freebsd.org wrote:
: Author: imp
: Date: Sat Jan 23 00:24:31 2010
: New Revision: 202850
: URL: http://svn.freebsd.org/changeset/base/202850
: 
: Log:
:   Migrate from old DDB style debugger to newer KDB style.
: 
: Modified:
:   head/sys/mips/cavium/octeon_machdep.c
: 
: Modified: head/sys/mips/cavium/octeon_machdep.c
: 
==
: --- head/sys/mips/cavium/octeon_machdep.cSat Jan 23 00:18:12 2010
(r202849)
: +++ head/sys/mips/cavium/octeon_machdep.cSat Jan 23 00:24:31 2010
(r202850)
: @@ -110,7 +110,7 @@ platform_cpu_init()
:  void
:  platform_reset(void)
:  {
: -((void(*)(void))(long)0x9fc0)();/* Jump to MIPS reset vector */
: +mips_generic_reset();
:  }
: 
: Was this bit intended?  It doesn't tally with the log message.

Well, it is a bit of leakage, but the change was intentional and
should be there.

Warner
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202905 - head/sys/mips/rmi

2010-01-23 Thread Randall Stewart
Author: rrs
Date: Sun Jan 24 01:06:02 2010
New Revision: 202905
URL: http://svn.freebsd.org/changeset/base/202905

Log:
  Changes the order of the setting the int happened (inside
  the lock).

Modified:
  head/sys/mips/rmi/xlr_machdep.c

Modified: head/sys/mips/rmi/xlr_machdep.c
==
--- head/sys/mips/rmi/xlr_machdep.c Sat Jan 23 23:16:50 2010
(r202904)
+++ head/sys/mips/rmi/xlr_machdep.c Sun Jan 24 01:06:02 2010
(r202905)
@@ -617,8 +617,8 @@ msgring_process_fast_intr(void *arg)
 * messages
 */
disable_msgring_int(NULL);
-   it-i_pending = 1;
thread_lock(td);
+   it-i_pending = 1;
if (TD_AWAITING_INTR(td)) {
CTR3(KTR_INTR, %s: schedule pid %d (%s), __func__, p-p_pid,
p-p_comm);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202908 - in head/sys/mips: include mips

2010-01-23 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Jan 24 02:59:22 2010
New Revision: 202908
URL: http://svn.freebsd.org/changeset/base/202908

Log:
  - Copy symbol-related tables (.symtab and .strtab) to the end of
  relocated kernel. We use magic number to signal kernel that
  symbol data is present.

Modified:
  head/sys/mips/include/elf.h
  head/sys/mips/mips/elf_trampoline.c

Modified: head/sys/mips/include/elf.h
==
--- head/sys/mips/include/elf.h Sun Jan 24 02:33:14 2010(r202907)
+++ head/sys/mips/include/elf.h Sun Jan 24 02:59:22 2010(r202908)
@@ -256,4 +256,9 @@ __ElfType(Auxinfo);
 
 #defineET_DYN_LOAD_ADDR 0x012
 
+/*
+ * Constant to mark start of symtab/strtab saved by trampoline
+ */
+#defineSYMTAB_MAGIC0x64656267
+
 #endif /* !_MACHINE_ELF_H_ */

Modified: head/sys/mips/mips/elf_trampoline.c
==
--- head/sys/mips/mips/elf_trampoline.c Sun Jan 24 02:33:14 2010
(r202907)
+++ head/sys/mips/mips/elf_trampoline.c Sun Jan 24 02:59:22 2010
(r202908)
@@ -96,12 +96,17 @@ load_kernel(void * kstart)
 #ifdef __mips_n64
Elf64_Ehdr *eh;
Elf64_Phdr phdr[64] /* XXX */;
+   Elf64_Phdr shdr[64] /* XXX */;
 #else
Elf32_Ehdr *eh;
Elf32_Phdr phdr[64] /* XXX */;
+   Elf32_Shdr shdr[64] /* XXX */;
 #endif
-   int i;
+   int i, j;
void *entry_point;
+   vm_offset_t lastaddr = 0;
+   int symtabindex = -1;
+   int symstrindex = -1;

 #ifdef __mips_n64
eh = (Elf64_Ehdr *)kstart;
@@ -112,6 +117,27 @@ load_kernel(void * kstart)
memcpy(phdr, (void *)(kstart + eh-e_phoff ),
eh-e_phnum * sizeof(phdr[0]));
 
+   memcpy(shdr, (void *)(kstart + eh-e_shoff),
+   sizeof(*shdr) * eh-e_shnum);
+
+   if (eh-e_shnum * eh-e_shentsize != 0  eh-e_shoff != 0) {
+   for (i = 0; i  eh-e_shnum; i++) {
+   if (shdr[i].sh_type == SHT_SYMTAB) {
+   /*
+* XXX: check if .symtab is in PT_LOAD?
+*/
+   if (shdr[i].sh_offset != 0  
+   shdr[i].sh_size != 0) {
+   symtabindex = i;
+   symstrindex = shdr[i].sh_link;
+   }
+   }
+   }
+   }
+
+   /*
+* Copy loadable segments
+*/
for (i = 0; i  eh-e_phnum; i++) {
volatile char c;
 
@@ -120,12 +146,44 @@ load_kernel(void * kstart)

memcpy((void *)(phdr[i].p_vaddr),
(void*)(kstart + phdr[i].p_offset), phdr[i].p_filesz);
+
/* Clean space from oversized segments, eg: bss. */
if (phdr[i].p_filesz  phdr[i].p_memsz)
bzero((void *)(phdr[i].p_vaddr + phdr[i].p_filesz), 
phdr[i].p_memsz - phdr[i].p_filesz);
+
+   if (lastaddr  phdr[i].p_vaddr + phdr[i].p_memsz)
+   lastaddr = phdr[i].p_vaddr + phdr[i].p_memsz;
}
 
+   /* Now grab the symbol tables. */
+   if (symtabindex = 0  symstrindex = 0) {
+   *(Elf_Size *)lastaddr = SYMTAB_MAGIC;
+   lastaddr += sizeof(Elf_Size);
+   *(Elf_Size *)lastaddr = shdr[symtabindex].sh_size +
+   shdr[symstrindex].sh_size + 2*sizeof(Elf_Size);
+   lastaddr += sizeof(Elf_Size);
+   /* .symtab size */
+   *(Elf_Size *)lastaddr = shdr[symtabindex].sh_size;
+   lastaddr += sizeof(shdr[symtabindex].sh_size);
+   /* .symtab data */
+   memcpy((void*)lastaddr,
+   shdr[symtabindex].sh_offset + kstart,
+   shdr[symtabindex].sh_size);
+   lastaddr += shdr[symtabindex].sh_size;
+
+   /* .strtab size */
+   *(Elf_Size *)lastaddr = shdr[symstrindex].sh_size;
+   lastaddr += sizeof(shdr[symstrindex].sh_size);
+
+   /* .strtab data */
+   memcpy((void*)lastaddr,
+   shdr[symstrindex].sh_offset + kstart,
+   shdr[symstrindex].sh_size);
+   } else
+   /* Do not take any chances */
+   *(Elf_Size *)lastaddr = 0;
+
return entry_point;
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202909 - in head/sys/mips: include mips

2010-01-23 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Jan 24 03:10:48 2010
New Revision: 202909
URL: http://svn.freebsd.org/changeset/base/202909

Log:
  - Introduce kernel_kseg0_end variable that marks first address in KSEG0
  available for use. All data below this address considered to be used
  by kernel. Along with kernel own data it might be symbol tables
  prepeared by trampoline code, boot loader service data passed for
  further analysis by kernel, etc... By default kernel_kseg0_end points
  to the end of loaded kernel.
  
  - Introduce mips_postboot_fixup function. It checks for symbol information
  copied by ELF trampoline and passes it to KDB

Modified:
  head/sys/mips/include/md_var.h
  head/sys/mips/mips/machdep.c

Modified: head/sys/mips/include/md_var.h
==
--- head/sys/mips/include/md_var.h  Sun Jan 24 02:59:22 2010
(r202908)
+++ head/sys/mips/include/md_var.h  Sun Jan 24 03:10:48 2010
(r202909)
@@ -44,6 +44,7 @@ externcharsigcode[];
 extern int szsigcode, szosigcode;
 
 extern vm_offset_t kstack0;
+extern vm_offset_t kernel_kseg0_end;
 
 void   MipsSaveCurFPState(struct thread *);
 void   fork_trampoline(void);
@@ -69,6 +70,7 @@ void  cpu_identify(void);
 void   mips_cpu_init(void);
 void   mips_pcpu0_init(void);
 void   mips_proc0_init(void);
+void   mips_postboot_fixup(void);
 
 /* Platform call-downs. */
 void   platform_identify(void);

Modified: head/sys/mips/mips/machdep.c
==
--- head/sys/mips/mips/machdep.cSun Jan 24 02:59:22 2010
(r202908)
+++ head/sys/mips/mips/machdep.cSun Jan 24 03:10:48 2010
(r202909)
@@ -85,6 +85,7 @@ __FBSDID($FreeBSD$);
 #include machine/clock.h
 #include machine/cpu.h
 #include machine/cpuregs.h
+#include machine/elf.h
 #include machine/hwfunc.h
 #include machine/intr_machdep.h
 #include machine/md_var.h
@@ -151,9 +152,18 @@ extern char MipsTLBMiss[], MipsTLBMissEn
 extern char MipsCache[], MipsCacheEnd[];
 
 extern char edata[], end[];
+#ifdef DDB
+extern vm_offset_t ksym_start, ksym_end;
+#endif
 
 u_int32_t bootdev;
 struct bootinfo bootinfo;
+/*
+ * First kseg0 address available for use. By default it's equal to end.
+ * But in some cases there might be additional data placed right after 
+ * _end by loader or ELF trampoline.
+ */
+vm_offset_t kernel_kseg0_end = (vm_offset_t)end;
 
 static void
 cpu_startup(void *dummy)
@@ -360,6 +370,29 @@ mips_vector_init(void)
 }
 
 /*
+ * Fix kernel_kseg0_end address in case trampoline placed debug sympols 
+ * data there
+ */
+void
+mips_postboot_fixup(void)
+{
+#ifdef DDB
+   Elf_Size *trampoline_data = (Elf_Size*)kernel_kseg0_end;
+   Elf_Size symtabsize = 0;
+
+   if (trampoline_data[0] == SYMTAB_MAGIC) {
+   symtabsize = trampoline_data[1];
+   kernel_kseg0_end += 2 * sizeof(Elf_Size);
+   /* start of .symtab */
+   ksym_start = kernel_kseg0_end;
+   kernel_kseg0_end += symtabsize;
+   /* end of .strtab */
+   ksym_end = kernel_kseg0_end;
+   }
+#endif
+}
+
+/*
  * Many SoCs have a means to reset the core itself.  Others do not, or
  * the method is unknown to us.  For those cases, we jump to the mips
  * reset vector and hope for the best.  This works well in practice.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org