svn commit: r262929 - head/sys/dev/ffec

2014-03-08 Thread Hiroki Sato
Author: hrs
Date: Sat Mar  8 14:58:39 2014
New Revision: 262929
URL: http://svnweb.freebsd.org/changeset/base/262929

Log:
  Fix another bug in multicast filtering.  i.MX uses 6 bits from MSB in
  LE CRC32 for the hash value, not the lowest 6 bits in BE CRC32.
  
  Tested by:Takanori Sawada
  PR:   arm/187179

Modified:
  head/sys/dev/ffec/if_ffec.c

Modified: head/sys/dev/ffec/if_ffec.c
==
--- head/sys/dev/ffec/if_ffec.c Sat Mar  8 12:26:17 2014(r262928)
+++ head/sys/dev/ffec/if_ffec.c Sat Mar  8 14:58:39 2014(r262929)
@@ -959,9 +959,10 @@ ffec_setup_rxfilter(struct ffec_softc *s
TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
-   crc = ether_crc32_be(LLADDR((struct sockaddr_dl *)
+   /* 6 bits from MSB in LE CRC32 are used for hash. */
+   crc = ether_crc32_le(LLADDR((struct sockaddr_dl *)
ifma->ifma_addr), ETHER_ADDR_LEN);
-   ghash |= 1LLU << (crc & 0x3f);
+   ghash |= 1LLU << (((uint8_t *)&crc)[3] >> 2);
}
if_maddr_runlock(ifp);
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r262411 - head/sys/arm/arm

2014-03-08 Thread Ian Lepore
On Fri, 2014-03-07 at 17:21 +0200, Konstantin Belousov wrote:
> On Wed, Mar 05, 2014 at 06:22:47AM -0700, Ian Lepore wrote:
> > On Wed, 2014-03-05 at 13:54 +0200, Konstantin Belousov wrote:
> > > On Sun, Feb 23, 2014 at 10:52:48PM +, Ian Lepore wrote:
> > > > Author: ian
> > > > Date: Sun Feb 23 22:52:48 2014
> > > > New Revision: 262411
> > > > URL: http://svnweb.freebsd.org/changeset/base/262411
> > > > 
> > > > Log:
> > > >   If the L2 cache type is PIPT, pass a physical address for a flush.
> > > >   
> > > >   While this is technically more correct, I don't think it much matters,
> > > >   because the only thing in the tree that calls cpu_flush_dcache() is 
> > > > md(4)
> > > >   and I'm > 99% sure it's bogus that it does so; md has no ability to do
> > > >   anything that can perturb data cache coherency.
> > > 
> > > Yes, md(4) does not break data cache coherency, but I think that
> > > Marcel added the flush to ensure instruction cache coherency.  The
> > > intent was to ensure that harward-architecture machines would
> > > see up-to-date memory content when fetching instructions after
> > > read on md(4).
> > 
> > Oh.  If that's necessary on ia64, it seems like ia64/elf_machdep.c would
> > be the place to do the flush.
> 
> I am not sure about ia64, it was needed for PowerPC, I think.
> The issue is not limited to the module loads, so elf_machdep.c cannot
> solve the problem.

The part of the commit message for r192323 about ARM is just wrong.  I
don't know enough about the other platforms mentioned in there to
comment on those, but the flush call which that commit message bills as
avoiding pessimization just maximially pessimizes things on ARM.

-- Ian


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


svn commit: r262930 - head/sys/dev/ath

2014-03-08 Thread Rui Paulo
Author: rpaulo
Date: Sat Mar  8 19:35:31 2014
New Revision: 262930
URL: http://svnweb.freebsd.org/changeset/base/262930

Log:
  Call ieee80211_dump_pkt() based on IFF_DUMPPKTS().
  
  MFC after:3 days

Modified:
  head/sys/dev/ath/if_ath_tx.c

Modified: head/sys/dev/ath/if_ath_tx.c
==
--- head/sys/dev/ath/if_ath_tx.cSat Mar  8 14:58:39 2014
(r262929)
+++ head/sys/dev/ath/if_ath_tx.cSat Mar  8 19:35:31 2014
(r262930)
@@ -3769,9 +3769,10 @@ ath_tx_tid_drain_print(struct ath_softc 
 ni->ni_txseqs[tid->tid]);
 
/* XXX Dump the frame, see what it is? */
-   ieee80211_dump_pkt(ni->ni_ic,
-   mtod(bf->bf_m, const uint8_t *),
-   bf->bf_m->m_len, 0, -1);
+   if (IFF_DUMPPKTS(sc, ATH_DEBUG_XMIT))
+   ieee80211_dump_pkt(ni->ni_ic,
+   mtod(bf->bf_m, const uint8_t *),
+   bf->bf_m->m_len, 0, -1);
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r262931 - in head/bin: kill sh sh/tests/builtins

2014-03-08 Thread Jilles Tjoelker
Author: jilles
Date: Sat Mar  8 19:44:34 2014
New Revision: 262931
URL: http://svnweb.freebsd.org/changeset/base/262931

Log:
  sh: Successfully do nothing when killing a terminated job.
  
  If a job has terminated but is still known, silently do nothing when using
  the kill builtin with the job specifier. Formerly, the shell called kill()
  with the process group ID that might have been reused.

Added:
  head/bin/sh/tests/builtins/kill1.0   (contents, props changed)
Modified:
  head/bin/kill/kill.c
  head/bin/sh/jobs.c
  head/bin/sh/tests/builtins/Makefile

Modified: head/bin/kill/kill.c
==
--- head/bin/kill/kill.cSat Mar  8 19:35:31 2014(r262930)
+++ head/bin/kill/kill.cSat Mar  8 19:44:34 2014(r262931)
@@ -133,9 +133,15 @@ main(int argc, char *argv[])
 
for (errors = 0; argc; argc--, argv++) {
 #ifdef SHELL
-   if (**argv == '%')
+   if (**argv == '%') {
pid = getjobpgrp(*argv);
-   else
+   /*
+* Silently ignore terminated jobs, like the kernel
+* silently ignores zombies.
+*/
+   if (pid == 0)
+   continue;
+   } else
 #endif
{
pid = strtol(*argv, &ep, 10);

Modified: head/bin/sh/jobs.c
==
--- head/bin/sh/jobs.c  Sat Mar  8 19:35:31 2014(r262930)
+++ head/bin/sh/jobs.c  Sat Mar  8 19:44:34 2014(r262931)
@@ -645,6 +645,8 @@ getjobpgrp(char *name)
struct job *jp;
 
jp = getjob(name);
+   if (jp->state == JOBDONE)
+   return 0;
return -jp->ps[0].pid;
 }
 

Modified: head/bin/sh/tests/builtins/Makefile
==
--- head/bin/sh/tests/builtins/Makefile Sat Mar  8 19:35:31 2014
(r262930)
+++ head/bin/sh/tests/builtins/Makefile Sat Mar  8 19:44:34 2014
(r262931)
@@ -86,6 +86,7 @@ FILES+=   hash3.0 hash3.0.stdout
 FILES+=hash4.0
 FILES+=jobid1.0
 FILES+=jobid2.0
+FILES+=kill1.0
 FILES+=lineno.0 lineno.0.stdout
 FILES+=lineno2.0
 FILES+=local1.0

Added: head/bin/sh/tests/builtins/kill1.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/sh/tests/builtins/kill1.0  Sat Mar  8 19:44:34 2014
(r262931)
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+: &
+p1=$!
+: &
+p2=$!
+wait $p2
+kill %1
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r262932 - head/sys/dev/uart

2014-03-08 Thread Warner Losh
Author: imp
Date: Sat Mar  8 19:59:52 2014
New Revision: 262932
URL: http://svnweb.freebsd.org/changeset/base/262932

Log:
  Back out r262921. I don't know what I was thinking, but it is lame.

Modified:
  head/sys/dev/uart/uart_core.c

Modified: head/sys/dev/uart/uart_core.c
==
--- head/sys/dev/uart/uart_core.c   Sat Mar  8 19:44:34 2014
(r262931)
+++ head/sys/dev/uart/uart_core.c   Sat Mar  8 19:59:52 2014
(r262932)
@@ -473,7 +473,7 @@ uart_bus_attach(device_t dev)
}
 
if (sc->sc_sysdev != NULL) {
-   if (sc->sc_sysdev->baudrate != 0) {
+   if (sc->sc_sysdev->baudrate == 0) {
if (UART_IOCTL(sc, UART_IOCTL_BAUD,
(intptr_t)&sc->sc_sysdev->baudrate) != 0)
sc->sc_sysdev->baudrate = -1;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r262934 - head/usr.bin/xinstall

2014-03-08 Thread Jilles Tjoelker
Author: jilles
Date: Sat Mar  8 23:05:28 2014
New Revision: 262934
URL: http://svnweb.freebsd.org/changeset/base/262934

Log:
  install: Use posix_spawnp() for starting strip and improve error messages.

Modified:
  head/usr.bin/xinstall/xinstall.c

Modified: head/usr.bin/xinstall/xinstall.c
==
--- head/usr.bin/xinstall/xinstall.cSat Mar  8 20:31:04 2014
(r262933)
+++ head/usr.bin/xinstall/xinstall.cSat Mar  8 23:05:28 2014
(r262934)
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -102,6 +103,8 @@ static enum {
DIGEST_SHA512,
 } digesttype = DIGEST_NONE;
 
+extern char **environ;
+
 static gid_t gid;
 static uid_t uid;
 static int dobackup, docompare, dodir, dolink, dopreserve, dostrip, dounpriv,
@@ -1215,27 +1218,33 @@ static void
 strip(const char *to_name)
 {
const char *stripbin;
-   int serrno, status;
-
-   switch (fork()) {
-   case -1:
-   serrno = errno;
+   const char *args[3];
+   pid_t pid;
+   int error, status;
+
+   stripbin = getenv("STRIPBIN");
+   if (stripbin == NULL)
+   stripbin = "strip";
+   args[0] = stripbin;
+   args[1] = to_name;
+   args[2] = NULL;
+   error = posix_spawnp(&pid, stripbin, NULL, NULL,
+   __DECONST(char **, args), environ);
+   if (error != 0) {
(void)unlink(to_name);
-   errno = serrno;
-   err(EX_TEMPFAIL, "fork");
-   case 0:
-   stripbin = getenv("STRIPBIN");
-   if (stripbin == NULL)
-   stripbin = "strip";
-   execlp(stripbin, stripbin, to_name, (char *)NULL);
-   err(EX_OSERR, "exec(%s)", stripbin);
-   default:
-   if (wait(&status) == -1 || status) {
-   serrno = errno;
-   (void)unlink(to_name);
-   errc(EX_SOFTWARE, serrno, "wait");
-   /* NOTREACHED */
-   }
+   errc(error == EAGAIN || error == EPROCLIM || error == ENOMEM ?
+   EX_TEMPFAIL : EX_OSERR, error, "spawn %s", stripbin);
+   }
+   if (waitpid(pid, &status, 0) == -1) {
+   error = errno;
+   (void)unlink(to_name);
+   errc(EX_SOFTWARE, error, "wait");
+   /* NOTREACHED */
+   }
+   if (status != 0) {
+   (void)unlink(to_name);
+   errx(EX_SOFTWARE, "strip command %s failed on %s",
+   stripbin, to_name);
}
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r262935 - head/sys/arm/allwinner/a20

2014-03-08 Thread Ian Lepore
Author: ian
Date: Sun Mar  9 01:52:21 2014
New Revision: 262935
URL: http://svnweb.freebsd.org/changeset/base/262935

Log:
  Follow r262916 with one more config file that references a renamed common.c

Modified:
  head/sys/arm/allwinner/a20/files.a20

Modified: head/sys/arm/allwinner/a20/files.a20
==
--- head/sys/arm/allwinner/a20/files.a20Sat Mar  8 23:05:28 2014
(r262934)
+++ head/sys/arm/allwinner/a20/files.a20Sun Mar  9 01:52:21 2014
(r262935)
@@ -19,5 +19,5 @@ arm/allwinner/if_emac.c   optional
emac
 arm/allwinner/a10_wdog.c   standard
 arm/allwinner/timer.c  standard
 arm/arm/bus_space-v6.c standard
-arm/allwinner/common.c standard
+arm/allwinner/a10_common.c standard
 arm/allwinner/a10_machdep.cstandard
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r262936 - head/release/tools/arm

2014-03-08 Thread Glen Barber
Author: gjb
Date: Sun Mar  9 02:00:48 2014
New Revision: 262936
URL: http://svnweb.freebsd.org/changeset/base/262936

Log:
  Update board definition for WANDBOARD-QUAD to match crochet.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/tools/arm/crochet-WANDBOARD-QUAD.conf

Modified: head/release/tools/arm/crochet-WANDBOARD-QUAD.conf
==
--- head/release/tools/arm/crochet-WANDBOARD-QUAD.conf  Sun Mar  9 01:52:21 
2014(r262935)
+++ head/release/tools/arm/crochet-WANDBOARD-QUAD.conf  Sun Mar  9 02:00:48 
2014(r262936)
@@ -5,7 +5,7 @@
 # This is the configuration file for use with crochet to produce
 # FreeBSD WandboardQuad images.
 
-board_setup WandboardQuad
+board_setup Wandboard
 option ImageSize 1gb
 option AutoSize
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r262937 - head/sys/dev/bvm

2014-03-08 Thread Neel Natu
Author: neel
Date: Sun Mar  9 02:07:15 2014
New Revision: 262937
URL: http://svnweb.freebsd.org/changeset/base/262937

Log:
  Fix panic "_mtx_lock_sleep: recursed on non-recursive mutex ttymtx" caused 
when
  acquiring the tty lock in bvm_tty_close(). Instead just assert that the tty
  lock is held before calling callout_reset().

Modified:
  head/sys/dev/bvm/bvm_console.c

Modified: head/sys/dev/bvm/bvm_console.c
==
--- head/sys/dev/bvm/bvm_console.c  Sun Mar  9 02:00:48 2014
(r262936)
+++ head/sys/dev/bvm/bvm_console.c  Sun Mar  9 02:07:15 2014
(r262937)
@@ -128,9 +128,8 @@ static void
 bvm_tty_close(struct tty *tp)
 {
 
-   tty_lock(tp);
+   tty_lock_assert(tp, MA_OWNED);
callout_stop(&bvm_timer);
-   tty_unlock(tp);
 }
 
 static void
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r262940 - head/sys/arm/at91

2014-03-08 Thread Warner Losh
Author: imp
Date: Sun Mar  9 02:28:30 2014
New Revision: 262940
URL: http://svnweb.freebsd.org/changeset/base/262940

Log:
  Remove bogus define that causes compile errors.  Most of the defines
  for SAM9X are going away soonish anyway (once FDT works), but until
  then...

Modified:
  head/sys/arm/at91/at91sam9x5reg.h

Modified: head/sys/arm/at91/at91sam9x5reg.h
==
--- head/sys/arm/at91/at91sam9x5reg.h   Sun Mar  9 02:11:53 2014
(r262939)
+++ head/sys/arm/at91/at91sam9x5reg.h   Sun Mar  9 02:28:30 2014
(r262940)
@@ -221,7 +221,6 @@
 #define AT91SAM9X25_IRQ_PIOCAT91SAM9X25_IRQ_PIOCD
 #define AT91SAM9X25_IRQ_PIODAT91SAM9X25_IRQ_PIOCD
 #define AT91SAM9X25_IRQ_NAND   (-1)
-#define AT91SAM9X25_IRQ_AIC(-1)
 
 #define AT91SAM9X25_AIC_BASE   0x000
 #define AT91SAM9X25_AIC_SIZE   0x200
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r262941 - in head/sys/arm: arm include

2014-03-08 Thread Ian Lepore
Author: ian
Date: Sun Mar  9 03:00:03 2014
New Revision: 262941
URL: http://svnweb.freebsd.org/changeset/base/262941

Log:
  Rework the VFP code that handles demand-based save and restore of state.
  
  The old code was full of complexity that would only matter if the
  kernel itself used the VFP hardware.  Now that's reduced to either killing
  the userland process or panicking the kernel on an illegal VFP instruction.
  
  This removes most of the complexity from the assembler code, reducing it
  to just calling the save code if the outgoing thread used the VFP.
  
  The routine that stores the VFP state now takes a flag that indicates
  whether the hardware should be disabled after saving state.  Right now it
  always is, but this makes the code ready to be used by get/set_mcontext()
  (doing so will be addressed in a future commit).
  
  Remove the arm-specific pc_vfpcthread from struct pcpu and use the MI
  field pc_fpcurthread instead.
  
  Reviewed by:  cognet

Modified:
  head/sys/arm/arm/genassym.c
  head/sys/arm/arm/swtch.S
  head/sys/arm/arm/vfp.c
  head/sys/arm/include/pcpu.h
  head/sys/arm/include/vfp.h

Modified: head/sys/arm/arm/genassym.c
==
--- head/sys/arm/arm/genassym.c Sun Mar  9 02:28:30 2014(r262940)
+++ head/sys/arm/arm/genassym.c Sun Mar  9 03:00:03 2014(r262941)
@@ -119,9 +119,7 @@ ASSYM(ARM_RAS_END, ARM_RAS_END);
 
 #ifdef VFP
 ASSYM(PCB_VFPSTATE, offsetof(struct pcb, pcb_vfpstate));
-ASSYM(PCB_VFPCPU, offsetof(struct pcb, pcb_vfpcpu));
 
-ASSYM(PC_VFPCTHREAD, offsetof(struct pcpu, pc_vfpcthread));
 ASSYM(PC_CPU, offsetof(struct pcpu, pc_cpu));
 
 ASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap));

Modified: head/sys/arm/arm/swtch.S
==
--- head/sys/arm/arm/swtch.SSun Mar  9 02:28:30 2014(r262940)
+++ head/sys/arm/arm/swtch.SSun Mar  9 03:00:03 2014(r262941)
@@ -84,6 +84,8 @@
 #include 
 #include 
 #include 
+#include 
+
 __FBSDID("$FreeBSD$");
 
 #define DOMAIN_CLIENT  0x01
@@ -102,6 +104,10 @@ __FBSDID("$FreeBSD$");
ldr tmp, .Lcurpcpu
 #endif
 
+#ifdef VFP
+   .fpu vfp/* allow VFP instructions */
+#endif
+
 .Lcurpcpu:
 .word   _C_LABEL(__pcpu)
.word   PCPU_SIZE
@@ -121,16 +127,10 @@ ENTRY(cpu_throw)
GET_PCPU(r7, r9)
 
 #ifdef VFP
-   /*
-* vfp_discard will clear pcpu->pc_vfpcthread, and modify
-* and modify the control as needed.
-*/
-   ldr r4, [r7, #(PC_VFPCTHREAD)]  /* this thread using vfp? */
-   cmp r0, r4
-   bne 3f
-   bl  _C_LABEL(vfp_discard)   /* yes, shut down vfp */
-3:
-#endif /* VFP */
+   fmrxr0, fpexc   /* This thread is dying, if the VFP */
+   tst r0, #(VFPEXC_EN)/* is enabled, go shut it down */
+   blne_C_LABEL(vfp_discard)   /* without preserving its state. */
+#endif
 
ldr r7, [r5, #(TD_PCB)] /* r7 = new thread's PCB */
   
@@ -319,30 +319,14 @@ ENTRY(cpu_switch)
/* rem: interrupts are enabled */
 
 #ifdef VFP
-   /*
-* vfp_store will clear pcpu->pc_vfpcthread, save 
-* registers and state, and modify the control as needed.
-* a future exception will bounce the backup settings in the fp unit.
-* XXX vfp_store can't change r4
-*/
-   GET_PCPU(r7, r8)
-   ldr r8, [r7, #(PC_VFPCTHREAD)]
-   cmp r4, r8  /* old thread used vfp? */
-   bne 1f  /* no, don't save */
-   cmp r1, r4  /* same thread ? */
-   beq 1f  /* yes, skip vfp store */
-#ifdef SMP
-   ldr r8, [r7, #(PC_CPU)] /* last used on this cpu? */
-   ldr r3, [r2, #(PCB_VFPCPU)]
-   cmp r8, r3  /* last cpu to use these registers? */
-   bne 1f  /* no. these values are stale */
+   fmrxr0, fpexc   /* If the VFP is enabled */
+   tst r0, #(VFPEXC_EN)/* the current thread has */
+   movne   r1, #1  /* used it, so go save */
+   addne   r0, r2, #(PCB_VFPSTATE) /* the state into the PCB */
+   blne_C_LABEL(vfp_store) /* and disable the VFP. */
 #endif
-   add r0, r2, #(PCB_VFPSTATE)
-   bl  _C_LABEL(vfp_store)
-1:
-#endif /* VFP */
 
-   /* r1 now free! */
+   /* r0-r3 now free! */
 
/* Third phase : restore saved context */
 
@@ -520,26 +504,12 @@ ENTRY(savectx)
add r2, r0, #(PCB_R8)
stmia   r2, {r8-r13}
 #ifdef VFP
-   /*
-* vfp_store will clear pcpu->pc_vfpcthread, save 
-* registers and state, and modify the control as needed.
-* a future exception will bounce the backup settings in the fp unit.
-*/

svn commit: r262942 - in head/sys/arm: arm include

2014-03-08 Thread Ian Lepore
Author: ian
Date: Sun Mar  9 03:49:06 2014
New Revision: 262942
URL: http://svnweb.freebsd.org/changeset/base/262942

Log:
  Remove all dregs of a per-thread undefined-exception-mode stack.  This is
  a leftover from the days when a low-level debugger had hooks in the
  undefined exception vector and needed stack space to function.  These days
  it effectively isn't used because we switch immediately to the svc32 mode
  stack on exception entry.  For that, the single undef mode stack per core
  that gets set up at init time works fine.
  
  The stack wasn't necessary but it was harmful, because the space for it
  was carved out of the normal per-thread svc32 stack, in effect cutting
  that 8K stack in half.  If svc32 mode used more than 4k of stack space it
  wandered down into the undef mode stack, and then an undef exception would
  overwrite a couple words on the stack while switching to svc32 mode,
  corrupting the scv32 stack.  Having another stack abut the bottom of the
  svc32 stack also effectively mooted the guard page below the stack.
  
  This work is based on analysis and patches submitted by Juergen Weiss.

Modified:
  head/sys/arm/arm/genassym.c
  head/sys/arm/arm/machdep.c
  head/sys/arm/arm/swtch.S
  head/sys/arm/arm/vm_machdep.c
  head/sys/arm/include/param.h
  head/sys/arm/include/pcb.h

Modified: head/sys/arm/arm/genassym.c
==
--- head/sys/arm/arm/genassym.c Sun Mar  9 03:00:03 2014(r262941)
+++ head/sys/arm/arm/genassym.c Sun Mar  9 03:49:06 2014(r262942)
@@ -60,7 +60,6 @@ ASSYM(PCB_NOALIGNFLT, PCB_NOALIGNFLT);
 ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault));
 ASSYM(PCB_DACR, offsetof(struct pcb, pcb_dacr));
 ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags));
-ASSYM(PCB_UND_SP, offsetof(struct pcb, un_32.pcb32_und_sp));
 ASSYM(PCB_PAGEDIR, offsetof(struct pcb, pcb_pagedir));
 ASSYM(PCB_L1VEC, offsetof(struct pcb, pcb_l1vec));
 ASSYM(PCB_PL1VEC, offsetof(struct pcb, pcb_pl1vec));

Modified: head/sys/arm/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Sun Mar  9 03:00:03 2014(r262941)
+++ head/sys/arm/arm/machdep.c  Sun Mar  9 03:49:06 2014(r262942)
@@ -379,8 +379,6 @@ cpu_startup(void *dummy)
 
bufinit();
vm_pager_bufferinit();
-   pcb->un_32.pcb32_und_sp = (u_int)thread0.td_kstack +
-   USPACE_UNDEF_STACK_TOP;
pcb->un_32.pcb32_sp = (u_int)thread0.td_kstack +
USPACE_SVC_STACK_TOP;
vector_page_setprot(VM_PROT_READ);

Modified: head/sys/arm/arm/swtch.S
==
--- head/sys/arm/arm/swtch.SSun Mar  9 03:00:03 2014(r262941)
+++ head/sys/arm/arm/swtch.SSun Mar  9 03:49:06 2014(r262942)
@@ -303,17 +303,6 @@ ENTRY(cpu_switch)
/* Get the user structure for the new process in r9 */
ldr r9, [r1, #(TD_PCB)]
 
-mrsr3, cpsr
-   /*
-* We can do that, since
-* PSR_SVC32_MODE|PSR_UND32_MODE == MSR_UND32_MODE
-*/
-   orr r8, r3, #(PSR_UND32_MODE)
-msrcpsr_c, r8
-
-   str sp, [r2, #(PCB_UND_SP)]
-
-msrcpsr_c, r3  /* Restore the old mode */
/* rem: r2 = old PCB */
/* rem: r9 = new PCB */
/* rem: interrupts are enabled */
@@ -422,10 +411,6 @@ ENTRY(cpu_switch)
movne   r0, #0  /* We *know* vector_page's VA is 0x0 */
movne   lr, pc
ldrne   pc, [r10, #CF_TLB_FLUSHID_SE]
-   /*
-* We can do that, since
-* PSR_SVC32_MODE|PSR_UND32_MODE == MSR_UND32_MODE
-*/
 
 .Lcs_context_switched:
 
@@ -444,17 +429,6 @@ ENTRY(cpu_switch)
 
/* rem: r9 = new PCB */
 
-mrsr3, cpsr
-   /*
-* We can do that, since
-* PSR_SVC32_MODE|PSR_UND32_MODE == MSR_UND32_MODE
-*/
-   orr r2, r3, #(PSR_UND32_MODE)
-   msr cpsr_c, r2
-
-   ldr sp, [r9, #(PCB_UND_SP)]
-
-msrcpsr_c, r3  /* Restore the old mode */
/* Restore all the save registers */
 #ifndef _ARM_ARCH_5E
add r7, r9, #PCB_R8

Modified: head/sys/arm/arm/vm_machdep.c
==
--- head/sys/arm/arm/vm_machdep.c   Sun Mar  9 03:00:03 2014
(r262941)
+++ head/sys/arm/arm/vm_machdep.c   Sun Mar  9 03:49:06 2014
(r262942)
@@ -144,7 +144,6 @@ cpu_fork(register struct thread *td1, re
bcopy(td1->td_pcb, pcb2, sizeof(*pcb2));
mdp2 = &p2->p_md;
bcopy(&td1->td_proc->p_md, mdp2, sizeof(*mdp2));
-   pcb2->un_32.pcb32_und_sp = td2->td_kstack + USPACE_UNDEF_STACK_TOP;
pcb2->un_32.pcb32_sp = td2->td_kstack +
USPACE_SVC_STACK_TOP - sizeof(*pcb2);
pmap_activate(td2);
@@ -366,7 +365,6 @@ cpu_set_upcall(struc

svn commit: r262945 - head/lib/libcrypt

2014-03-08 Thread John-Mark Gurney
Author: jmg
Date: Sun Mar  9 07:45:59 2014
New Revision: 262945
URL: http://svnweb.freebsd.org/changeset/base/262945

Log:
  various formating fixes, use NUL for NUL bytes..
  
  drop out dated perf numbers (can't imagine people are still running
  Pentium MMX 166's anymore)...
  
  bump date...
  
  drop max length of salt of 8 since _PASSWORD_LEN is now large, 128..
  and state the max length of the salt depends upon the module,
  sha-{256,512} have a max salt of 16..
  
  recommend 8 characters of salt instead of just 2...
  
  MFC after:1 week

Modified:
  head/lib/libcrypt/crypt.3

Modified: head/lib/libcrypt/crypt.3
==
--- head/lib/libcrypt/crypt.3   Sun Mar  9 04:17:04 2014(r262944)
+++ head/lib/libcrypt/crypt.3   Sun Mar  9 07:45:59 2014(r262945)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 9, 2011
+.Dd March 9, 2014
 .Dt CRYPT 3
 .Os
 .Sh NAME
@@ -63,11 +63,16 @@ Currently these include the
 .Tn MD5
 hash,
 .Tn NT-Hash
-(compatible with Microsoft's NT scheme)
+.Pq compatible with Microsoft's NT scheme
 and
 .Tn Blowfish .
-The algorithm used will depend upon the format of the Salt (following
-the Modular Crypt Format (MCF)), if
+The algorithm used will depend upon the format of the Salt
+.Po
+following
+the Modular Crypt Format
+.Pq MCF
+.Pc ,
+if
 .Tn DES
 and/or
 .Tn Blowfish
@@ -77,8 +82,10 @@ has been called to change the default.
 .Pp
 The first argument to
 .Nm
-is the data to hash (usually a password), in a
-.Dv null Ns -terminated
+is the data to hash
+.Pq usually a password ,
+in a
+.Dv NUL Ns -terminated
 string.
 The second is the salt, in one of three forms:
 .Pp
@@ -96,22 +103,19 @@ If it begins with the string
 then the Modular Crypt Format is used, as outlined below.
 .It Traditional
 If neither of the above is true, it assumes the Traditional Format,
-using the entire string as the salt (or the first portion).
+using the entire string as the salt
+.Pq or the first portion .
 .El
 .Pp
 All routines are designed to be time-consuming.
-A brief test on a
-.Tn Pentium
-166/MMX shows the
-.Tn DES
-crypt to do approximately 2640 crypts
-a CPU second and MD5 to do about 62 crypts a CPU second.
 .Ss DES Extended Format:
 The
 .Ar key
-is divided into groups of 8 characters (the last group is null-padded)
-and the low-order 7 bits of each character (56 bits per group) are
-used to form the
+is divided into groups of 8 characters
+.Pq the last group is NUL-padded
+and the low-order 7 bits of each character
+.Pq 56 bits per group
+are used to form the
 .Tn DES
 key as follows:
 the first group of 56 bits becomes the initial
@@ -127,7 +131,8 @@ The salt is a 9-character array consisti
 by 4 bytes of iteration count and 4 bytes of salt.
 These are encoded as printable characters, 6 bits per character,
 least significant character first.
-The values 0 to 63 are encoded as ``./0-9A-Za-z''.
+The values 0 to 63 are encoded as
+.Dq ./0-9A-Za-z .
 This allows 24 bits for both
 .Fa count
 and
@@ -138,7 +143,8 @@ The
 introduces disorder in the
 .Tn DES
 algorithm in one of 16777216 or 4096 possible ways
-(i.e., with 24 or 12 bits: if bit
+.Po
+i.e., with 24 or 12 bits: if bit
 .Em i
 of the
 .Ar salt
@@ -148,7 +154,8 @@ and
 .Em i+24
 are swapped in the
 .Tn DES
-E-box output).
+E-box output
+.Pc .
 .Pp
 The
 .Tn DES
@@ -157,11 +164,13 @@ key is used to encrypt a 64-bit constant
 iterations of
 .Tn DES .
 The value returned is a
-.Dv null Ns -terminated
-string, 20 or 13 bytes (plus null) in length, consisting of the
+.Dv NUL Ns -terminated
+string, 20 or 13 bytes
+.Pq plus NUL
+in length, consisting of the
 .Ar salt
 followed by the encoded 64-bit encryption.
-.Ss "Modular" crypt:
+.Ss Modular crypt:
 If the salt begins with the string
 .Fa $digit$
 then the Modular Crypt Format is used.
@@ -170,11 +179,10 @@ The
 represents which algorithm is used in encryption.
 Following the token is
 the actual salt to use in the encryption.
-The length of the salt is limited
-to 8 characters--because the length of the returned output is also limited
-(_PASSWORD_LEN).
-The salt must be terminated with the end of the string
-(NULL) or a dollar sign.
+The maximum length of the salt used depends upon the module.
+The salt must be terminated with the end of the string character
+.Pq NUL
+or a dollar sign.
 Any characters after the dollar sign are ignored.
 .Pp
 Currently supported algorithms are:
@@ -199,7 +207,7 @@ An example salt would be:
 .Bl -tag -width 6n -offset indent
 .It Cm "$4$thesalt$rest"
 .El
-.Ss "Traditional" crypt:
+.Ss Traditional crypt:
 The algorithm used will depend upon whether
 .Fn crypt_set_format
 has been called and whether a global default format has been specified.
@@ -216,7 +224,7 @@ if it is available, or MD5 if not.
 .Pp
 How the salt is used will depend upon the algorithm for the hash.
 For
-best results, specify at least two characters of salt.
+best results, specify at least eight