svn commit: r281517 - head/usr.bin/ipcs

2015-04-13 Thread Eitan Adler
Author: eadler
Date: Tue Apr 14 04:52:52 2015
New Revision: 281517
URL: https://svnweb.freebsd.org/changeset/base/281517

Log:
  ipcs: fix builds that use gcc
gcc gets annoyed by duplicate declarations
  
  Reported by:  sbruno
  Reviewed by:  sbruno

Modified:
  head/usr.bin/ipcs/ipc.c
  head/usr.bin/ipcs/ipc.h

Modified: head/usr.bin/ipcs/ipc.c
==
--- head/usr.bin/ipcs/ipc.c Tue Apr 14 02:38:57 2015(r281516)
+++ head/usr.bin/ipcs/ipc.c Tue Apr 14 04:52:52 2015(r281517)
@@ -55,7 +55,6 @@ struct msginfomsginfo;
 struct msqid_kernel*msqids;
 struct shminfo shminfo;
 struct shmid_kernel*shmsegs;
-void   kget(int idx, void *addr, size_t size);
 
 struct nlist symbols[] = {
{ .n_name = "sema" },

Modified: head/usr.bin/ipcs/ipc.h
==
--- head/usr.bin/ipcs/ipc.h Tue Apr 14 02:38:57 2015(r281516)
+++ head/usr.bin/ipcs/ipc.h Tue Apr 14 04:52:52 2015(r281517)
@@ -64,8 +64,5 @@ extern struct nlist symbols[];
 extern kvm_t *kd;
 
 extern struct semid_kernel *sema;
-extern struct seminfo  seminfo;
-extern struct msginfo  msginfo;
 extern struct msqid_kernel *msqids;
-extern struct shminfo  shminfo;
 extern struct shmid_kernel *shmsegs;
___
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: r281511 - head/sys/kern

2015-04-13 Thread Randall Stewart
Author: rrs
Date: Tue Apr 14 00:02:39 2015
New Revision: 281511
URL: https://svnweb.freebsd.org/changeset/base/281511

Log:
  Fix my stupid restoral of old code.. must be  c_iflags now.
  
  Thanks jhb for catching my stupidity...
  MFC after:3 days

Modified:
  head/sys/kern/kern_timeout.c

Modified: head/sys/kern/kern_timeout.c
==
--- head/sys/kern/kern_timeout.cMon Apr 13 23:06:13 2015
(r281510)
+++ head/sys/kern/kern_timeout.cTue Apr 14 00:02:39 2015
(r281511)
@@ -592,7 +592,7 @@ callout_cc_add(struct callout *c, struct
c->c_iflags &= ~CALLOUT_PROCESSED;
c->c_flags |= CALLOUT_ACTIVE;
if (flags & C_DIRECT_EXEC)
-   c->c_flags |= CALLOUT_DIRECT;
+   c->c_iflags |= CALLOUT_DIRECT;
c->c_func = func;
c->c_time = sbt;
c->c_precision = precision;
___
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: r281510 - head/sys/kern

2015-04-13 Thread Randall Stewart via svn-src-head
Crud

Your right.. 


On Apr 13, 2015, at 7:23 PM, John Baldwin  wrote:

> On Monday, April 13, 2015 11:06:14 PM Randall Stewart wrote:
>> Author: rrs
>> Date: Mon Apr 13 23:06:13 2015
>> New Revision: 281510
>> URL: https://svnweb.freebsd.org/changeset/base/281510
>> 
>> Log:
>>  Restore the two lines accidentally deleted that allow CALLOUT_DIRECT to be
>>  specifed in the flags.
>> 
>>  Thanks Mark Johnston for noticing this ;-o
> 
> Shouldn't this be an internal flag?  I think CALLOUT_ACTIVE should be the only
> non-internal flag, yes?
> 
> -- 
> John Baldwin


Randall Stewart
r...@netflix.com
803-317-4952





___
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: r281510 - head/sys/kern

2015-04-13 Thread John Baldwin
On Monday, April 13, 2015 11:06:14 PM Randall Stewart wrote:
> Author: rrs
> Date: Mon Apr 13 23:06:13 2015
> New Revision: 281510
> URL: https://svnweb.freebsd.org/changeset/base/281510
> 
> Log:
>   Restore the two lines accidentally deleted that allow CALLOUT_DIRECT to be
>   specifed in the flags.
>   
>   Thanks Mark Johnston for noticing this ;-o

Shouldn't this be an internal flag?  I think CALLOUT_ACTIVE should be the only
non-internal flag, yes?

-- 
John Baldwin
___
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: r281510 - head/sys/kern

2015-04-13 Thread Randall Stewart
Author: rrs
Date: Mon Apr 13 23:06:13 2015
New Revision: 281510
URL: https://svnweb.freebsd.org/changeset/base/281510

Log:
  Restore the two lines accidentally deleted that allow CALLOUT_DIRECT to be
  specifed in the flags.
  
  Thanks Mark Johnston for noticing this ;-o
  
  MFC after:3 days

Modified:
  head/sys/kern/kern_timeout.c

Modified: head/sys/kern/kern_timeout.c
==
--- head/sys/kern/kern_timeout.cMon Apr 13 22:51:09 2015
(r281509)
+++ head/sys/kern/kern_timeout.cMon Apr 13 23:06:13 2015
(r281510)
@@ -591,6 +591,8 @@ callout_cc_add(struct callout *c, struct
c->c_iflags |= CALLOUT_PENDING;
c->c_iflags &= ~CALLOUT_PROCESSED;
c->c_flags |= CALLOUT_ACTIVE;
+   if (flags & C_DIRECT_EXEC)
+   c->c_flags |= CALLOUT_DIRECT;
c->c_func = func;
c->c_time = sbt;
c->c_precision = precision;
___
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: r281503 - head/share/mk

2015-04-13 Thread Garrett Cooper
Author: ngie
Date: Mon Apr 13 21:29:40 2015
New Revision: 281503
URL: https://svnweb.freebsd.org/changeset/base/281503

Log:
  Revert r281055 as it breaks installing test scripts in the mixed PROGS/SCRIPT
  case
  
  Repro is as follows:
  
  % sudo pkg install -y kyua
  % sudo rm -Rf /usr/tests
  % sudo make hier
  % (cd lib/libthr/tests/; make obj; make depend; make all; sudo make install)
  % (cd /usr/tests/lib/libthr; kyua list)
  
  Failure seen in Jenkins build starting here:
  https://jenkins.freebsd.org/job/FreeBSD_HEAD-tests2/927/
  
  Pointyhat to: bapt

Modified:
  head/share/mk/bsd.progs.mk

Modified: head/share/mk/bsd.progs.mk
==
--- head/share/mk/bsd.progs.mk  Mon Apr 13 20:23:46 2015(r281502)
+++ head/share/mk/bsd.progs.mk  Mon Apr 13 21:29:40 2015(r281503)
@@ -96,14 +96,14 @@ x.$p= PROG_CXX=$p
 
 $p ${p}_p: .PHONY .MAKE
(cd ${.CURDIR} && ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS= \
-   SUBDIR= SCRIPTS= PROG=$p \
+   SUBDIR= PROG=$p \
DEPENDFILE=.depend.$p .MAKE.DEPENDFILE=.depend.$p \
${x.$p})
 
 .for t in ${PROGS_TARGETS:O:u}
 $p.$t: .PHONY .MAKE
(cd ${.CURDIR} && ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS= \
-   SUBDIR= SCRIPTS= PROG=$p \
+   SUBDIR= PROG=$p \
DEPENDFILE=.depend.$p .MAKE.DEPENDFILE=.depend.$p \
${x.$p} ${@:E})
 .endfor
___
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: r281502 - head/sys/contrib/x86emu

2015-04-13 Thread Xin LI
Author: delphij
Date: Mon Apr 13 20:23:46 2015
New Revision: 281502
URL: https://svnweb.freebsd.org/changeset/base/281502

Log:
  Sync with OpenBSD: Use volatile instead of __volatile__.
  
  MFC after:2 weeks

Modified:
  head/sys/contrib/x86emu/x86emu.c

Modified: head/sys/contrib/x86emu/x86emu.c
==
--- head/sys/contrib/x86emu/x86emu.cMon Apr 13 19:58:11 2015
(r281501)
+++ head/sys/contrib/x86emu/x86emu.cMon Apr 13 20:23:46 2015
(r281502)
@@ -1,4 +1,4 @@
-/* $OpenBSD: x86emu.c,v 1.5 2010/02/17 15:09:47 pirofti Exp $  */
+/* $OpenBSD: x86emu.c,v 1.9 2014/06/15 11:04:49 pirofti Exp $  */
 /* $NetBSD: x86emu.c,v 1.7 2009/02/03 19:26:29 joerg Exp $ */
 
 /*
@@ -5250,7 +5250,7 @@ x86emuOp2_pop_FS(struct x86emu *emu)
 static void
 hw_cpuid(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d)
 {
-   __asm__ __volatile__("cpuid"
+   __asm__ volatile("cpuid"
 : "=a" (*a), "=b" (*b),
   "=c" (*c), "=d" (*d)
 : "a" (*a), "c" (*c)
___
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: r280279 - head/sys/sys

2015-04-13 Thread Jung-uk Kim
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 04/13/2015 13:36, Alan Cox wrote:
> On 03/30/2015 10:50, John Baldwin wrote:
>> On Sunday, March 22, 2015 09:41:53 AM Bruce Evans wrote:
>>> On Sat, 21 Mar 2015, John Baldwin wrote:
>>> 
 On 3/21/15 12:35 PM, Konstantin Belousov wrote:
> On Sat, Mar 21, 2015 at 12:04:41PM -0400, John Baldwin
> wrote:
>> On 3/20/15 9:02 AM, Konstantin Belousov wrote:
>>> On Fri, Mar 20, 2015 at 10:27:06AM +, John Baldwin
>>> wrote:
 Author: jhb Date: Fri Mar 20 10:27:06 2015 New
 Revision: 280279 URL:
 https://svnweb.freebsd.org/changeset/base/280279
 
 Log: Expand the bitcount* API to support 64-bit
 integers, plain ints and longs and create a "hidden"
 API that can be used in other system headers without 
 adding namespace pollution. - If the POPCNT
 instruction is enabled at compile time, use 
 __builtin_popcount*() to implement __bitcount*(),
 otherwise fall back to software implementations.
>>> Are you aware of the Haswell errata HSD146 ?  I see the
>>> described behaviour on machines back to SandyBridge,
>>> but not on Nehalems. HSD146.   POPCNT Instruction May
>>> Take Longer to Execute Than Expected Problem: POPCNT
>>> instruction execution with a 32 or 64 bit operand may
>>> be delayed until previous non-dependent instructions
>>> have executed.
>>> 
>>> Jilles noted that gcc head and 4.9.2 already provides a
>>> workaround by xoring the dst register.  I have some
>>> patch for amd64 pmap, see the end of the message.
>> No, I was not aware, but I think it's hard to fix this
>> anywhere but the compiler.  I set CPUTYPE in src.conf on
>> my Ivy Bridge desktop and clang uses POPCOUNT for this
>> function from ACPI-CA:
>> 
>> static UINT8 AcpiRsCountSetBits ( UINT16
>> BitField) { UINT8   BitsSet;
>> 
>> 
>> ACPI_FUNCTION_ENTRY ();
>> 
>> 
>> for (BitsSet = 0; BitField; BitsSet++) { /* Zero the
>> least significant bit that is set */
>> 
>> BitField &= (UINT16) (BitField - 1); }
>> 
>> return (BitsSet); }
>> 
>> (I ran into this accidentally because a kernel built on
>> my system failed to boot in older qemu because the kernel
>> paniced with an illegal instruction fault in this
>> function.)
>>> Does it do the same for the similar home made popcount in
>>> pmap?:
>> Yes:
>> 
>> 807658d4:   f6 04 25 46 e2 d6 80testb
>> $0x80,0x80d6e246 807658db:   80 
>> 807658dc:   74 32   je
>> 80765910  807658de:
>> 48 89 4d b8 mov%rcx,-0x48(%rbp) 807658e2:
>> f3 48 0f b8 4d b8   popcnt -0x48(%rbp),%rcx 807658e8:
>> 48 8b 50 20 mov0x20(%rax),%rdx 807658ec:
>> 48 89 55 b0 mov%rdx,-0x50(%rbp) 807658f0:
>> f3 48 0f b8 55 b0   popcnt -0x50(%rbp),%rdx 807658f6:
>> 01 ca   add%ecx,%edx 807658f8:
>> 48 8b 48 28 mov0x28(%rax),%rcx 807658fc:
>> 48 89 4d a8 mov%rcx,-0x58(%rbp) 80765900:
>> f3 48 0f b8 4d a8   popcnt -0x58(%rbp),%rcx 80765906:
>> eb 1b   jmp80765923
>>  80765908:   0f 1f 84
>> 00 00 00 00nopl   0x0(%rax,%rax,1) 8076590f:   00
>>  80765910:   f3 48 0f b8 c9  popcnt
>> %rcx,%rcx 80765915:   f3 48 0f b8 50 20   popcnt
>> 0x20(%rax),%rdx 8076591b:   01 ca
>> add%ecx,%edx 8076591d:   f3 48 0f b8 48 28
>> popcnt 0x28(%rax),%rcx 80765923:   01 d1
>> add%edx,%ecx
>> 
>> It also uses popcnt for this in blist_fill() and
>> blist_meta_fill():
>> 
>> 742 /* Count the number of blocks we're about to
>> allocate */ 743 bitmap = scan->u.bmu_bitmap & mask; 
>> 744 for (nblks = 0; bitmap != 0; nblks++) 745
>> bitmap &= bitmap - 1;
>> 
>>> Always using new API would lose the micro-optimizations given
>>> by the runtime decision for default CFLAGS (used by
>>> distributions for portability).  To keep them, it seems best to
>>> keep the inline asm but replace popcnt_pc_map_elem(elem) by
>>> __bitcount64(elem).  -mno-popcount can then be used to work
>>> around slowness in the software (that is actually hardware)
>>> case.
>> I'm not sure if bitcount64() is strictly better than the loop in
>> this case even though it is O(1) given the claimed nature of the
>> values in the comment.
>> 
> 
> 
> I checked.  Even with zeroes being more common than ones,
> bitcount64() is faster than the simple loop.  Using bitcount64,
> reserve_pv_entries() takes on average 4265 cycles during
> "buildworld" on my test machine.  In contrast, with the simple
> loop, it takes on average 4507 cycles.  Even though bitcount64 is a

svn commit: r281501 - head/usr.bin/ipcs

2015-04-13 Thread Eitan Adler
Author: eadler
Date: Mon Apr 13 19:58:11 2015
New Revision: 281501
URL: https://svnweb.freebsd.org/changeset/base/281501

Log:
  ipcs: fix warnings (WARNS=1 -> WARNS=6)
- fix shadow warnings
- change type from off_t to size_t which is more correct and avoids
  signed/unsigned compare
- use new initializer format to avoid "missing values" warning
  
  Reviewed by:  jhb

Modified:
  head/usr.bin/ipcs/Makefile
  head/usr.bin/ipcs/ipc.c
  head/usr.bin/ipcs/ipc.h
  head/usr.bin/ipcs/ipcs.c

Modified: head/usr.bin/ipcs/Makefile
==
--- head/usr.bin/ipcs/Makefile  Mon Apr 13 19:46:30 2015(r281500)
+++ head/usr.bin/ipcs/Makefile  Mon Apr 13 19:58:11 2015(r281501)
@@ -4,6 +4,4 @@ PROG=   ipcs
 SRCS=  ipcs.c ipc.c
 LIBADD=kvm
 
-WARNS?=1
-
 .include 

Modified: head/usr.bin/ipcs/ipc.c
==
--- head/usr.bin/ipcs/ipc.c Mon Apr 13 19:46:30 2015(r281500)
+++ head/usr.bin/ipcs/ipc.c Mon Apr 13 19:58:11 2015(r281501)
@@ -58,13 +58,13 @@ struct shmid_kernel *shmsegs;
 void   kget(int idx, void *addr, size_t size);
 
 struct nlist symbols[] = {
-   {"sema"},
-   {"seminfo"},
-   {"msginfo"},
-   {"msqids"},
-   {"shminfo"},
-   {"shmsegs"},
-   {NULL}
+   { .n_name = "sema" },
+   { .n_name = "seminfo" },
+   { .n_name = "msginfo" },
+   { .n_name = "msqids" },
+   { .n_name = "shminfo" },
+   { .n_name = "shmsegs" },
+   { .n_name = NULL }
 };
 
 #defineSHMINFO_XVECX(shmmax, sizeof(u_long))   
\
@@ -92,13 +92,13 @@ struct nlist symbols[] = {
 
 #defineX(a, b) { "kern.ipc." #a, offsetof(TYPEC, a), (b) },
 #defineTYPEC   struct shminfo
-struct scgs_vector shminfo_scgsv[] = { SHMINFO_XVEC { NULL } };
+static struct scgs_vector shminfo_scgsv[] = { SHMINFO_XVEC { .sysctl=NULL } };
 #undef TYPEC
 #defineTYPEC   struct seminfo
-struct scgs_vector seminfo_scgsv[] = { SEMINFO_XVEC { NULL } };
+static struct scgs_vector seminfo_scgsv[] = { SEMINFO_XVEC { .sysctl=NULL } };
 #undef TYPEC
 #defineTYPEC   struct msginfo
-struct scgs_vector msginfo_scgsv[] = { MSGINFO_XVEC { NULL } };
+static struct scgs_vector msginfo_scgsv[] = { MSGINFO_XVEC { .sysctl=NULL } };
 #undef TYPEC
 #undef X
 

Modified: head/usr.bin/ipcs/ipc.h
==
--- head/usr.bin/ipcs/ipc.h Mon Apr 13 19:46:30 2015(r281500)
+++ head/usr.bin/ipcs/ipc.h Mon Apr 13 19:58:11 2015(r281501)
@@ -52,7 +52,7 @@
 /* SysCtlGatherStruct structure. */
 struct scgs_vector {
const char *sysctl;
-   off_t offset;
+   size_t offset;
size_t size;
 };
 

Modified: head/usr.bin/ipcs/ipcs.c
==
--- head/usr.bin/ipcs/ipcs.cMon Apr 13 19:46:30 2015(r281500)
+++ head/usr.bin/ipcs/ipcs.cMon Apr 13 19:58:11 2015(r281501)
@@ -112,6 +112,7 @@ main(int argc, char *argv[])
char   *core = NULL, *user = NULL, *namelist = NULL;
charkvmoferr[_POSIX2_LINE_MAX];  /* Error buf for kvm_openfiles. */
int i;
+   u_long  shmidx;
uid_t   uid = 0;
 
while ((i = getopt(argc, argv, "MmQqSsabC:cN:optTu:y")) != -1)
@@ -247,13 +248,13 @@ main(int argc, char *argv[])
 
print_kshmheader(option);
 
-   for (i = 0; i < shminfo.shmmni; i += 1) {
-   if (kxshmids[i].u.shm_perm.mode & 0x0800) {
+   for (shmidx = 0; shmidx < shminfo.shmmni; shmidx += 1) {
+   if (kxshmids[shmidx].u.shm_perm.mode & 0x0800) {
if (user &&
-   uid != kxshmids[i].u.shm_perm.uid)
+   uid != 
kxshmids[shmidx].u.shm_perm.uid)
continue;
 
-   print_kshmptr(i, option, &kxshmids[i]);
+   print_kshmptr(shmidx, option, 
&kxshmids[shmidx]);
}
}
printf("\n");
@@ -309,22 +310,22 @@ main(int argc, char *argv[])
 }
 
 void
-print_kmsqtotal(struct msginfo msginfo)
+print_kmsqtotal(struct msginfo local_msginfo)
 {
 
printf("msginfo:\n");
printf("\tmsgmax: %12d\t(max characters in a message)\n",
-   msginfo.msgmax);
+   local_msginfo.msgmax);
printf("\tmsgmni: %12d\t(# of message queues)\n",
-   msginfo.msgmni);
+   local_msginfo.msgmni);
printf("\tmsgmnb: %12d\t(max characters in a message queue)\n",
-   msginfo.msgmnb);
+   local_msgin

svn commit: r281500 - head/usr.bin/gzip

2015-04-13 Thread Xin LI
Author: delphij
Date: Mon Apr 13 19:46:30 2015
New Revision: 281500
URL: https://svnweb.freebsd.org/changeset/base/281500

Log:
  Sync with NetBSD:
  
   - Mention xz(1) in gzip(1).
   - Strip away path from header name when decompressing.
  
  MFC after:2 weeks

Modified:
  head/usr.bin/gzip/gzip.1
  head/usr.bin/gzip/gzip.c

Modified: head/usr.bin/gzip/gzip.1
==
--- head/usr.bin/gzip/gzip.1Mon Apr 13 19:13:51 2015(r281499)
+++ head/usr.bin/gzip/gzip.1Mon Apr 13 19:46:30 2015(r281500)
@@ -1,4 +1,4 @@
-.\"$NetBSD: gzip.1,v 1.23 2014/03/18 18:20:45 riastradh Exp $
+.\"$NetBSD: gzip.1,v 1.25 2015/04/06 21:41:17 wiz Exp $
 .\"
 .\" Copyright (c) 1997, 2003, 2004 Matthew R. Green
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\" $FreeBSD$
-.Dd October 9, 2011
+.Dd April 6, 2015
 .Dt GZIP 1
 .Os
 .Sh NAME
@@ -105,9 +105,10 @@ options are enabled.
 This version of
 .Nm
 is also capable of decompressing files compressed using
-.Xr compress 1
+.Xr compress 1 ,
+.Xr bzip2 1 ,
 or
-.Xr bzip2 1 .
+.Xr xz 1 .
 .Sh OPTIONS
 The following options are available:
 .Bl -tag -width XXrXXXrecursiveX

Modified: head/usr.bin/gzip/gzip.c
==
--- head/usr.bin/gzip/gzip.cMon Apr 13 19:13:51 2015(r281499)
+++ head/usr.bin/gzip/gzip.cMon Apr 13 19:46:30 2015(r281500)
@@ -1,4 +1,4 @@
-/* $NetBSD: gzip.c,v 1.106 2014/10/18 08:33:30 snj Exp $   */
+/* $NetBSD: gzip.c,v 1.107 2015/01/13 02:37:20 mrg Exp $   */
 
 /*-
  * Copyright (c) 1997, 1998, 2003, 2004, 2006 Matthew R. Green
@@ -158,7 +158,7 @@ static suffixes_t suffixes[] = {
 #define NUM_SUFFIXES (sizeof suffixes / sizeof suffixes[0])
 #define SUFFIX_MAXLEN  30
 
-static const char  gzip_version[] = "FreeBSD gzip 20141022";
+static const char  gzip_version[] = "FreeBSD gzip 20150413";
 
 #ifndef SMALL
 static const char  gzip_copyright[] = \
@@ -1354,7 +1354,7 @@ file_uncompress(char *file, char *outfil
 #ifndef SMALL
ssize_t rv;
time_t timestamp = 0;
-   unsigned char name[PATH_MAX + 1];
+   char name[PATH_MAX + 1];
 #endif
 
/* gather the old name info */
@@ -1415,15 +1415,24 @@ file_uncompress(char *file, char *outfil
goto lose;
}
if (name[0] != 0) {
+   char *dp, *nf;
+
+   /* strip saved directory name */
+   nf = strrchr(name, '/');
+   if (nf == NULL)
+   nf = name;
+   else
+   nf++;
+
/* preserve original directory name */
-   char *dp = strrchr(file, '/');
+   dp = strrchr(file, '/');
if (dp == NULL)
dp = file;
else
dp++;
snprintf(outfile, outsize, "%.*s%.*s",
(int) (dp - file), 
-   file, (int) rbytes, name);
+   file, (int) rbytes, nf);
}
}
}
@@ -2110,7 +2119,7 @@ static void
 display_license(void)
 {
 
-   fprintf(stderr, "%s (based on NetBSD gzip 20141018)\n", gzip_version);
+   fprintf(stderr, "%s (based on NetBSD gzip 20150113)\n", gzip_version);
fprintf(stderr, "%s\n", gzip_copyright);
exit(0);
 }
___
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: r281499 - head/sys/dev/usb/controller

2015-04-13 Thread Neel Natu
Author: neel
Date: Mon Apr 13 19:13:51 2015
New Revision: 281499
URL: https://svnweb.freebsd.org/changeset/base/281499

Log:
  Modify the return value of the uhci/ehci/xhci PCI probe routines to
  'BUS_PROBE_DEFAULT'. This allows bhyve's 'ppt' driver to claim ownership
  of the device and pass it through to the guest.
  
  In the common case where there are no competing drivers for USB controllers
  this change is a no-op.
  
  Reviewed by:  hselasky
  MFC after:2 weeks

Modified:
  head/sys/dev/usb/controller/ehci_pci.c
  head/sys/dev/usb/controller/uhci_pci.c
  head/sys/dev/usb/controller/xhci_pci.c

Modified: head/sys/dev/usb/controller/ehci_pci.c
==
--- head/sys/dev/usb/controller/ehci_pci.c  Mon Apr 13 16:43:06 2015
(r281498)
+++ head/sys/dev/usb/controller/ehci_pci.c  Mon Apr 13 19:13:51 2015
(r281499)
@@ -220,7 +220,7 @@ ehci_pci_probe(device_t self)
 
if (desc) {
device_set_desc(self, desc);
-   return (0);
+   return (BUS_PROBE_DEFAULT);
} else {
return (ENXIO);
}

Modified: head/sys/dev/usb/controller/uhci_pci.c
==
--- head/sys/dev/usb/controller/uhci_pci.c  Mon Apr 13 16:43:06 2015
(r281498)
+++ head/sys/dev/usb/controller/uhci_pci.c  Mon Apr 13 19:13:51 2015
(r281499)
@@ -244,7 +244,7 @@ uhci_pci_probe(device_t self)
 
if (desc) {
device_set_desc(self, desc);
-   return (0);
+   return (BUS_PROBE_DEFAULT);
} else {
return (ENXIO);
}

Modified: head/sys/dev/usb/controller/xhci_pci.c
==
--- head/sys/dev/usb/controller/xhci_pci.c  Mon Apr 13 16:43:06 2015
(r281498)
+++ head/sys/dev/usb/controller/xhci_pci.c  Mon Apr 13 19:13:51 2015
(r281499)
@@ -131,7 +131,7 @@ xhci_pci_probe(device_t self)
 
if (desc) {
device_set_desc(self, desc);
-   return (0);
+   return (BUS_PROBE_DEFAULT);
} else {
return (ENXIO);
}
___
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: r280279 - head/sys/sys

2015-04-13 Thread Adrian Chadd
Hi,

These CPUs are supposed to have loop unwinder / streaming hardware. Is
it not unwinding/streaming this loop for us?



-a


On 13 April 2015 at 10:36, Alan Cox  wrote:
> On 03/30/2015 10:50, John Baldwin wrote:
>> On Sunday, March 22, 2015 09:41:53 AM Bruce Evans wrote:
>>> On Sat, 21 Mar 2015, John Baldwin wrote:
>>>
 On 3/21/15 12:35 PM, Konstantin Belousov wrote:
> On Sat, Mar 21, 2015 at 12:04:41PM -0400, John Baldwin wrote:
>> On 3/20/15 9:02 AM, Konstantin Belousov wrote:
>>> On Fri, Mar 20, 2015 at 10:27:06AM +, John Baldwin wrote:
 Author: jhb
 Date: Fri Mar 20 10:27:06 2015
 New Revision: 280279
 URL: https://svnweb.freebsd.org/changeset/base/280279

 Log:
   Expand the bitcount* API to support 64-bit integers, plain ints and 
 longs
   and create a "hidden" API that can be used in other system headers 
 without
   adding namespace pollution.
   - If the POPCNT instruction is enabled at compile time, use
 __builtin_popcount*() to implement __bitcount*(), otherwise fall 
 back
 to software implementations.
>>> Are you aware of the Haswell errata HSD146 ?  I see the described 
>>> behaviour
>>> on machines back to SandyBridge, but not on Nehalems.
>>> HSD146.   POPCNT Instruction May Take Longer to Execute Than Expected
>>> Problem: POPCNT instruction execution with a 32 or 64 bit operand may be
>>> delayed until previous non-dependent instructions have executed.
>>>
>>> Jilles noted that gcc head and 4.9.2 already provides a workaround by
>>> xoring the dst register.  I have some patch for amd64 pmap, see the end
>>> of the message.
>> No, I was not aware, but I think it's hard to fix this anywhere but the
>> compiler.  I set CPUTYPE in src.conf on my Ivy Bridge desktop and clang
>> uses POPCOUNT for this function from ACPI-CA:
>>
>> static UINT8
>> AcpiRsCountSetBits (
>> UINT16  BitField)
>> {
>> UINT8   BitsSet;
>>
>>
>> ACPI_FUNCTION_ENTRY ();
>>
>>
>> for (BitsSet = 0; BitField; BitsSet++)
>> {
>> /* Zero the least significant bit that is set */
>>
>> BitField &= (UINT16) (BitField - 1);
>> }
>>
>> return (BitsSet);
>> }
>>
>> (I ran into this accidentally because a kernel built on my system failed
>> to boot in older qemu because the kernel paniced with an illegal 
>> instruction
>> fault in this function.)
>>> Does it do the same for the similar home made popcount in pmap?:
>> Yes:
>>
>> 807658d4:   f6 04 25 46 e2 d6 80testb  
>> $0x80,0x80d6e246
>> 807658db:   80
>> 807658dc:   74 32   je 80765910 
>> 
>> 807658de:   48 89 4d b8 mov%rcx,-0x48(%rbp)
>> 807658e2:   f3 48 0f b8 4d b8   popcnt -0x48(%rbp),%rcx
>> 807658e8:   48 8b 50 20 mov0x20(%rax),%rdx
>> 807658ec:   48 89 55 b0 mov%rdx,-0x50(%rbp)
>> 807658f0:   f3 48 0f b8 55 b0   popcnt -0x50(%rbp),%rdx
>> 807658f6:   01 ca   add%ecx,%edx
>> 807658f8:   48 8b 48 28 mov0x28(%rax),%rcx
>> 807658fc:   48 89 4d a8 mov%rcx,-0x58(%rbp)
>> 80765900:   f3 48 0f b8 4d a8   popcnt -0x58(%rbp),%rcx
>> 80765906:   eb 1b   jmp80765923 
>> 
>> 80765908:   0f 1f 84 00 00 00 00nopl   0x0(%rax,%rax,1)
>> 8076590f:   00
>> 80765910:   f3 48 0f b8 c9  popcnt %rcx,%rcx
>> 80765915:   f3 48 0f b8 50 20   popcnt 0x20(%rax),%rdx
>> 8076591b:   01 ca   add%ecx,%edx
>> 8076591d:   f3 48 0f b8 48 28   popcnt 0x28(%rax),%rcx
>> 80765923:   01 d1   add%edx,%ecx
>>
>> It also uses popcnt for this in blist_fill() and blist_meta_fill():
>>
>> 742 /* Count the number of blocks we're about to allocate */
>> 743 bitmap = scan->u.bmu_bitmap & mask;
>> 744 for (nblks = 0; bitmap != 0; nblks++)
>> 745 bitmap &= bitmap - 1;
>>
>>> Always using new API would lose the micro-optimizations given by the runtime
>>> decision for default CFLAGS (used by distributions for portability).  To
>>> keep them, it seems best to keep the inline asm but replace
>>> popcnt_pc_map_elem(elem) by __bitcount64(elem).  -mno-popcount can then
>>> be used to work around slowness in the software (that is actually
>>> hardware) case.
>> I'm not sure if bitcount64() is strictly better than the loop in this case
>> even though it is O(1) given the claimed nature of the values in the comment.
>>
>
>
> I ch

Re: svn commit: r280279 - head/sys/sys

2015-04-13 Thread Konstantin Belousov
On Mon, Apr 13, 2015 at 12:36:50PM -0500, Alan Cox wrote:
> However, in the popcnt case, we are spilling the bit map to memory in
> order to popcnt it.  That's rather silly:
> 
> 3570:   48 8b 48 18 mov0x18(%rax),%rcx
> 3574:   f6 04 25 00 00 00 00testb  $0x80,0x0
> 357b:   80
> 357c:   74 42   je 35c0
> 
> 357e:   48 89 4d b8 mov%rcx,-0x48(%rbp)
> 3582:   31 c9   xor%ecx,%ecx
> 3584:   f3 48 0f b8 4d b8   popcnt -0x48(%rbp),%rcx
> 358a:   48 8b 50 20 mov0x20(%rax),%rdx
> 358e:   48 89 55 b0 mov%rdx,-0x50(%rbp)
> 3592:   31 d2   xor%edx,%edx
> 3594:   f3 48 0f b8 55 b0   popcnt -0x50(%rbp),%rdx
> 359a:   01 ca   add%ecx,%edx
> 359c:   48 8b 48 28 mov0x28(%rax),%rcx
> 35a0:   48 89 4d a8 mov%rcx,-0x58(%rbp)
> 35a4:   31 c9   xor%ecx,%ecx
> 35a6:   f3 48 0f b8 4d a8   popcnt -0x58(%rbp),%rcx
> 35ac:   01 d1   add%edx,%ecx
> 35ae:   e9 12 01 00 00  jmpq   36c5
> 
> 
> Caveat: I'm still using clang 3.5.  Maybe the newer clang doesn't spill?

3.6.0 generates similar code.
___
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: r280279 - head/sys/sys

2015-04-13 Thread Alan Cox
On 03/30/2015 10:50, John Baldwin wrote:
> On Sunday, March 22, 2015 09:41:53 AM Bruce Evans wrote:
>> On Sat, 21 Mar 2015, John Baldwin wrote:
>>
>>> On 3/21/15 12:35 PM, Konstantin Belousov wrote:
 On Sat, Mar 21, 2015 at 12:04:41PM -0400, John Baldwin wrote:
> On 3/20/15 9:02 AM, Konstantin Belousov wrote:
>> On Fri, Mar 20, 2015 at 10:27:06AM +, John Baldwin wrote:
>>> Author: jhb
>>> Date: Fri Mar 20 10:27:06 2015
>>> New Revision: 280279
>>> URL: https://svnweb.freebsd.org/changeset/base/280279
>>>
>>> Log:
>>>   Expand the bitcount* API to support 64-bit integers, plain ints and 
>>> longs
>>>   and create a "hidden" API that can be used in other system headers 
>>> without
>>>   adding namespace pollution.
>>>   - If the POPCNT instruction is enabled at compile time, use
>>> __builtin_popcount*() to implement __bitcount*(), otherwise fall 
>>> back
>>> to software implementations.
>> Are you aware of the Haswell errata HSD146 ?  I see the described 
>> behaviour
>> on machines back to SandyBridge, but not on Nehalems.
>> HSD146.   POPCNT Instruction May Take Longer to Execute Than Expected
>> Problem: POPCNT instruction execution with a 32 or 64 bit operand may be
>> delayed until previous non-dependent instructions have executed.
>>
>> Jilles noted that gcc head and 4.9.2 already provides a workaround by
>> xoring the dst register.  I have some patch for amd64 pmap, see the end
>> of the message.
> No, I was not aware, but I think it's hard to fix this anywhere but the
> compiler.  I set CPUTYPE in src.conf on my Ivy Bridge desktop and clang
> uses POPCOUNT for this function from ACPI-CA:
>
> static UINT8
> AcpiRsCountSetBits (
> UINT16  BitField)
> {
> UINT8   BitsSet;
>
>
> ACPI_FUNCTION_ENTRY ();
>
>
> for (BitsSet = 0; BitField; BitsSet++)
> {
> /* Zero the least significant bit that is set */
>
> BitField &= (UINT16) (BitField - 1);
> }
>
> return (BitsSet);
> }
>
> (I ran into this accidentally because a kernel built on my system failed
> to boot in older qemu because the kernel paniced with an illegal 
> instruction
> fault in this function.)
>> Does it do the same for the similar home made popcount in pmap?:
> Yes:
>
> 807658d4:   f6 04 25 46 e2 d6 80testb  
> $0x80,0x80d6e246
> 807658db:   80 
> 807658dc:   74 32   je 80765910 
> 
> 807658de:   48 89 4d b8 mov%rcx,-0x48(%rbp)
> 807658e2:   f3 48 0f b8 4d b8   popcnt -0x48(%rbp),%rcx
> 807658e8:   48 8b 50 20 mov0x20(%rax),%rdx
> 807658ec:   48 89 55 b0 mov%rdx,-0x50(%rbp)
> 807658f0:   f3 48 0f b8 55 b0   popcnt -0x50(%rbp),%rdx
> 807658f6:   01 ca   add%ecx,%edx
> 807658f8:   48 8b 48 28 mov0x28(%rax),%rcx
> 807658fc:   48 89 4d a8 mov%rcx,-0x58(%rbp)
> 80765900:   f3 48 0f b8 4d a8   popcnt -0x58(%rbp),%rcx
> 80765906:   eb 1b   jmp80765923 
> 
> 80765908:   0f 1f 84 00 00 00 00nopl   0x0(%rax,%rax,1)
> 8076590f:   00 
> 80765910:   f3 48 0f b8 c9  popcnt %rcx,%rcx
> 80765915:   f3 48 0f b8 50 20   popcnt 0x20(%rax),%rdx
> 8076591b:   01 ca   add%ecx,%edx
> 8076591d:   f3 48 0f b8 48 28   popcnt 0x28(%rax),%rcx
> 80765923:   01 d1   add%edx,%ecx
>
> It also uses popcnt for this in blist_fill() and blist_meta_fill():
>
> 742 /* Count the number of blocks we're about to allocate */
> 743 bitmap = scan->u.bmu_bitmap & mask;
> 744 for (nblks = 0; bitmap != 0; nblks++)
> 745 bitmap &= bitmap - 1;
>
>> Always using new API would lose the micro-optimizations given by the runtime
>> decision for default CFLAGS (used by distributions for portability).  To
>> keep them, it seems best to keep the inline asm but replace
>> popcnt_pc_map_elem(elem) by __bitcount64(elem).  -mno-popcount can then
>> be used to work around slowness in the software (that is actually
>> hardware) case.
> I'm not sure if bitcount64() is strictly better than the loop in this case
> even though it is O(1) given the claimed nature of the values in the comment.
>


I checked.  Even with zeroes being more common than ones, bitcount64()
is faster than the simple loop.  Using bitcount64, reserve_pv_entries()
takes on average 4265 cycles during "buildworld" on my test machine.  In
contrast, with the simple loop, it takes on average 4507 cycles.  Ev

svn commit: r281497 - in head/sys: arm64/conf conf dev/psci

2015-04-13 Thread Andrew Turner
Author: andrew
Date: Mon Apr 13 16:41:33 2015
New Revision: 281497
URL: https://svnweb.freebsd.org/changeset/base/281497

Log:
  Add psci for arm64. This is currently used when rebooting and powering off
  in qemu.
  
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/dev/psci/psci_arm64.S   (contents, props changed)
Modified:
  head/sys/arm64/conf/GENERIC
  head/sys/conf/files.arm64

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Mon Apr 13 16:00:09 2015(r281496)
+++ head/sys/arm64/conf/GENERIC Mon Apr 13 16:41:33 2015(r281497)
@@ -84,6 +84,7 @@ devicetun # Packet tunnel.
 device md  # Memory "disks"
 device gif # IPv6 and IPv4 tunneling
 device firmware# firmware assist module
+device psci# Support for ARM PSCI
 
 # The `bpf' device enables the Berkeley Packet Filter.
 # Be aware of the administrative consequences of enabling this!

Modified: head/sys/conf/files.arm64
==
--- head/sys/conf/files.arm64   Mon Apr 13 16:00:09 2015(r281496)
+++ head/sys/conf/files.arm64   Mon Apr 13 16:41:33 2015(r281497)
@@ -34,6 +34,8 @@ arm64/arm64/vfp.c standard
 arm64/arm64/vm_machdep.c   standard
 dev/fdt/fdt_arm64.coptionalfdt
 dev/ofw/ofw_cpu.c  optionalfdt
+dev/psci/psci.coptionalpsci
+dev/psci/psci_arm64.S  optionalpsci
 dev/uart/uart_cpu_fdt.coptionaluart fdt
 dev/uart/uart_dev_pl011.c  optionaluart pl011
 kern/kern_clocksource.cstandard

Added: head/sys/dev/psci/psci_arm64.S
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/psci/psci_arm64.S  Mon Apr 13 16:41:33 2015
(r281497)
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c) 2013, 2014 Robin Randhawa
+ * Copyright (c) 2015 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Andrew Turner under
+ * sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+/*
+ * uint64_t psci_hvc_despatch(uint64_t psci_fnid, uint64_t, uint64_t, uint64_t)
+ */
+ENTRY(psci_hvc_despatch)
+   hvc #0
+   ret
+END(psci_hvc_despatch)
+
+/*
+ * uint64_t psci_smc_despatch(uint64_t psci_fnid, uint64_t, uint64_t, uint64_t)
+ */
+ENTRY(psci_smc_despatch)
+   smc #0
+   ret
+END(psci_hvc_despatch)
___
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: r281396 - in head/sys: contrib/dev/acpica contrib/dev/acpica/common contrib/dev/acpica/compiler contrib/dev/acpica/components/debugger contrib/dev/acpica/components/disassembler contri

2015-04-13 Thread Jung-uk Kim
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 04/11/2015 17:16, Dimitry Andric wrote:
> On 11 Apr 2015, at 05:23, Jung-uk Kim  wrote:
>> 
>> Author: jkim Date: Sat Apr 11 03:23:41 2015 New Revision: 281396 
>> URL: https://svnweb.freebsd.org/changeset/base/281396
>> 
>> Log: Merge ACPICA 20150410.
> 
> Shall we MFC this at some point? :)

MFC after:  1 week

Jung-uk Kim
-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iQEcBAEBCAAGBQJVK/BQAAoJEHyflib82/FGAOwH/25zX6JC6uKNIIRmpt4KPmsC
gbzW8ltkR+kD7gA/kTtJuInX2l7FWRTruPDkISGLf5eYzhI1pMh0OxtqPc+jg8oB
wpHA9CxI3CEBaKejF1asupqZR9cNnvMEqhk4ItT65uWA5bzPbHF49jeClKbQ2JvK
amMkZFFxwdjvAZ94cdu9sxMbWdfFn/wVg81gap0pOfgClQ7JHyKEVNDpNTgC8siT
Z10f8wfbs3zMJ166WooTTdN+gb8cuOtxXBv3fnvhJcVzRSDKyd5ZyeejTVylCj1D
i5ypQiKo51ddJWnBo2LCiHpsSBWZNu8UTik0FWOAF/lqxVZhH5t7H2TReXz9K6s=
=ATsb
-END PGP SIGNATURE-
___
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: r281496 - in head/sys/boot/efi: boot1 loader

2015-04-13 Thread Andrew Turner
Author: andrew
Date: Mon Apr 13 16:00:09 2015
New Revision: 281496
URL: https://svnweb.freebsd.org/changeset/base/281496

Log:
  Create the correct symlinks for the machine directory, and only create the
  x86 symlink on i386 and amd64. Before this incorrect symlinks were being
  created on armi and i386.
  
  Differential Revision:https://reviews.freebsd.org/D2283
  Reviewed by:  emaste, imp
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/boot/efi/boot1/Makefile
  head/sys/boot/efi/loader/Makefile

Modified: head/sys/boot/efi/boot1/Makefile
==
--- head/sys/boot/efi/boot1/MakefileMon Apr 13 15:22:45 2015
(r281495)
+++ head/sys/boot/efi/boot1/MakefileMon Apr 13 16:00:09 2015
(r281496)
@@ -90,13 +90,16 @@ CLEANFILES= boot1.efi boot1.efifat
 
 .include 
 
-.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
-beforedepend ${OBJS}: machine x86
+beforedepend ${OBJS}: machine
 
-CLEANFILES+=   machine x86
+CLEANFILES+=   machine
 
 machine:
-   ln -sf ${.CURDIR}/../../../amd64/include machine
+   ln -sf ${.CURDIR}/../../../${MACHINE}/include machine
+
+.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
+beforedepend ${OBJS}: x86
+CLEANFILES+=   x86
 
 x86:
ln -sf ${.CURDIR}/../../../x86/include x86

Modified: head/sys/boot/efi/loader/Makefile
==
--- head/sys/boot/efi/loader/Makefile   Mon Apr 13 15:22:45 2015
(r281495)
+++ head/sys/boot/efi/loader/Makefile   Mon Apr 13 16:00:09 2015
(r281496)
@@ -111,12 +111,17 @@ LDADD=${LIBFICL} ${LIBEFI} ${LIBFDT} $
 
 .include 
 
-beforedepend ${OBJS}: machine x86
+beforedepend ${OBJS}: machine
 
-CLEANFILES+=   machine x86
+CLEANFILES+=   machine
 
 machine:
-   ln -sf ${.CURDIR}/../../../amd64/include machine
+   ln -sf ${.CURDIR}/../../../${MACHINE}/include machine
+
+.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
+beforedepend ${OBJS}: x86
+CLEANFILES+=   x86
 
 x86:
ln -sf ${.CURDIR}/../../../x86/include x86
+.endif
___
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: r281495 - in head/sys: conf i386/i386 i386/include x86/acpica

2015-04-13 Thread Konstantin Belousov
On Mon, Apr 13, 2015 at 11:24:09AM -0400, Benjamin Kaduk wrote:
> On Mon, Apr 13, 2015 at 11:22 AM, Konstantin Belousov 
> wrote:
> 
> > Author: kib
> > Date: Mon Apr 13 15:22:45 2015
> > New Revision: 281495
> > URL: https://svnweb.freebsd.org/changeset/base/281495
> >
> > Log:
> >   Add config option PAE_TABLES for the i386 kernel.  It switches pmap to
> >   use PAE format for the page tables, but does not incur other
> >   consequences of the full PAE config.  In particular, vm_paddr_t and
> >   bus_addr_t are left 32bit, and max supported memory is still limited
> >   by 4GB.
> >
> >   The option allows to have nx permissions for memory mappings on i386
> >   kernel, while keeping the usual i386 KBI and avoiding the kernel data
> >   sizing problems typical for the PAE config.
> >
> >   Intel documented that the PAE format for page tables is available
> >   starting with the Pentium Pro, but it is possible that the plain
> >   Pentium CPUs have the required support (Appendix H).  The goal is to
> >   enable the option and non-exec mappings on i386 for the GENERIC
> >   kernel.  Anybody wanting a useful system on 486, have to reconfigure
> >   the modern i386 kernel anyway.
> >
> >   Discussed with:   alc, jhb
> >   Sponsored by: The FreeBSD Foundation
> >   MFC after:2 weeks
> >
> 
> relnotes: yes?

I do not see much use in the wide announcement.  Right now, this is yet
another kernel option.  If the required benchmarking and some more old
documentation spelunking is going to be done, so that the GENERIC is
indeed switched to requiring PAE, then relnotes should indeed mention
the change.  Otherwise, I do not see why this could be interesting to
a user who cannot read NOTES.
___
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: r281495 - in head/sys: conf i386/i386 i386/include x86/acpica

2015-04-13 Thread Benjamin Kaduk
On Mon, Apr 13, 2015 at 11:22 AM, Konstantin Belousov 
wrote:

> Author: kib
> Date: Mon Apr 13 15:22:45 2015
> New Revision: 281495
> URL: https://svnweb.freebsd.org/changeset/base/281495
>
> Log:
>   Add config option PAE_TABLES for the i386 kernel.  It switches pmap to
>   use PAE format for the page tables, but does not incur other
>   consequences of the full PAE config.  In particular, vm_paddr_t and
>   bus_addr_t are left 32bit, and max supported memory is still limited
>   by 4GB.
>
>   The option allows to have nx permissions for memory mappings on i386
>   kernel, while keeping the usual i386 KBI and avoiding the kernel data
>   sizing problems typical for the PAE config.
>
>   Intel documented that the PAE format for page tables is available
>   starting with the Pentium Pro, but it is possible that the plain
>   Pentium CPUs have the required support (Appendix H).  The goal is to
>   enable the option and non-exec mappings on i386 for the GENERIC
>   kernel.  Anybody wanting a useful system on 486, have to reconfigure
>   the modern i386 kernel anyway.
>
>   Discussed with:   alc, jhb
>   Sponsored by: The FreeBSD Foundation
>   MFC after:2 weeks
>

relnotes: yes?

-Ben
___
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: r281495 - in head/sys: conf i386/i386 i386/include x86/acpica

2015-04-13 Thread Konstantin Belousov
Author: kib
Date: Mon Apr 13 15:22:45 2015
New Revision: 281495
URL: https://svnweb.freebsd.org/changeset/base/281495

Log:
  Add config option PAE_TABLES for the i386 kernel.  It switches pmap to
  use PAE format for the page tables, but does not incur other
  consequences of the full PAE config.  In particular, vm_paddr_t and
  bus_addr_t are left 32bit, and max supported memory is still limited
  by 4GB.
  
  The option allows to have nx permissions for memory mappings on i386
  kernel, while keeping the usual i386 KBI and avoiding the kernel data
  sizing problems typical for the PAE config.
  
  Intel documented that the PAE format for page tables is available
  starting with the Pentium Pro, but it is possible that the plain
  Pentium CPUs have the required support (Appendix H).  The goal is to
  enable the option and non-exec mappings on i386 for the GENERIC
  kernel.  Anybody wanting a useful system on 486, have to reconfigure
  the modern i386 kernel anyway.
  
  Discussed with:   alc, jhb
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/conf/options.i386
  head/sys/i386/i386/bios.c
  head/sys/i386/i386/initcpu.c
  head/sys/i386/i386/locore.s
  head/sys/i386/i386/machdep.c
  head/sys/i386/i386/minidump_machdep.c
  head/sys/i386/i386/mpboot.s
  head/sys/i386/i386/pmap.c
  head/sys/i386/i386/swtch.s
  head/sys/i386/i386/trap.c
  head/sys/i386/i386/vm86bios.s
  head/sys/i386/i386/vm_machdep.c
  head/sys/i386/include/param.h
  head/sys/i386/include/pmap.h
  head/sys/i386/include/vmparam.h
  head/sys/x86/acpica/acpi_wakeup.c

Modified: head/sys/conf/options.i386
==
--- head/sys/conf/options.i386  Mon Apr 13 14:43:10 2015(r281494)
+++ head/sys/conf/options.i386  Mon Apr 13 15:22:45 2015(r281495)
@@ -36,6 +36,11 @@ KVA_PAGESopt_global.h
 # Physical address extensions and support for >4G ram.  As above.
 PAEopt_global.h
 
+# Use PAE page tables, but limit memory support to 4GB.
+# This keeps the i386 non-PAE KBI, in particular, drivers see
+# 32bit vm_paddr_t.
+PAE_TABLES opt_global.h
+
 TIMER_FREQ opt_clock.h
 
 CPU_ATHLON_SSE_HACKopt_cpu.h

Modified: head/sys/i386/i386/bios.c
==
--- head/sys/i386/i386/bios.c   Mon Apr 13 14:43:10 2015(r281494)
+++ head/sys/i386/i386/bios.c   Mon Apr 13 15:22:45 2015(r281495)
@@ -389,7 +389,7 @@ bios16(struct bios_args *args, char *fmt
 args->seg.code32.limit = 0x;   
 
 ptd = (pd_entry_t *)rcr3();
-#ifdef PAE
+#if defined(PAE) || defined(PAE_TABLES)
 if (ptd == IdlePDPT)
 #else
 if (ptd == IdlePTD)

Modified: head/sys/i386/i386/initcpu.c
==
--- head/sys/i386/i386/initcpu.cMon Apr 13 14:43:10 2015
(r281494)
+++ head/sys/i386/i386/initcpu.cMon Apr 13 15:22:45 2015
(r281495)
@@ -784,7 +784,7 @@ initializecpu(void)
init_transmeta();
break;
}
-#ifdef PAE
+#if defined(PAE) || defined(PAE_TABLES)
if ((amd_feature & AMDID_NX) != 0) {
uint64_t msr;
 

Modified: head/sys/i386/i386/locore.s
==
--- head/sys/i386/i386/locore.s Mon Apr 13 14:43:10 2015(r281494)
+++ head/sys/i386/i386/locore.s Mon Apr 13 15:22:45 2015(r281495)
@@ -99,7 +99,7 @@ physfree: .long   0   /* phys addr of next 
.globl  IdlePTD
 IdlePTD:   .long   0   /* phys addr of kernel PTD */
 
-#ifdef PAE
+#if defined(PAE) || defined(PAE_TABLES)
.globl  IdlePDPT
 IdlePDPT:  .long   0   /* phys addr of kernel PDPT */
 #endif
@@ -281,7 +281,7 @@ NON_GPROF_ENTRY(btext)
 1:
 
 /* Now enable paging */
-#ifdef PAE
+#if defined(PAE) || defined(PAE_TABLES)
movlR(IdlePDPT), %eax
movl%eax, %cr3
movl%cr4, %eax
@@ -722,7 +722,7 @@ no_kernend:
movl%esi,R(KPTmap)
 
 /* Allocate Page Table Directory */
-#ifdef PAE
+#if defined(PAE) || defined(PAE_TABLES)
/* XXX only need 32 bytes (easier for now) */
ALLOCPAGES(1)
movl%esi,R(IdlePDPT)
@@ -788,7 +788,7 @@ no_kernend:
fillkptphys($PG_RW)
 
 /* Map page directory. */
-#ifdef PAE
+#if defined(PAE) || defined(PAE_TABLES)
movlR(IdlePDPT), %eax
movl$1, %ecx
fillkptphys($PG_RW)
@@ -890,7 +890,7 @@ done_pde:
movl$NPGPTD,%ecx
fillkpt(R(IdlePTD), $PG_RW)
 
-#ifdef PAE
+#if defined(PAE) || defined(PAE_TABLES)
movlR(IdlePTD), %eax
xorl%ebx, %ebx
movl$NPGPTD, %ecx

Modified: head/sys/i386/i386/machdep.c
=

svn commit: r281494 - in head/sys: arm64/arm64 arm64/conf arm64/include conf dev/fdt sys

2015-04-13 Thread Andrew Turner
Author: andrew
Date: Mon Apr 13 14:43:10 2015
New Revision: 281494
URL: https://svnweb.freebsd.org/changeset/base/281494

Log:
  Bring in the start of the arm64 kernel.
  
  This is only the minimum set of files needed to boot in qemu. As such it is
  missing a few things.
  
  The bus_dma code is currently only stub functions with a full implementation
  from the development tree to follow.
  
  The gic driver has been copied as the interrupt framework is different. It
  is expected the two drivers will be merged by the arm intrng project,
  however this will need to be imported into the tree and support for arm64
  would need to be added.
  
  This includes code developed by myself, SemiHalf, Ed Maste, and Robin
  Randhawa from ARM. This has been funded by the FreeBSD Foundation, with
  early development by myself in my spare time with assistance from Robin.
  
  Differential Revision:https://reviews.freebsd.org/D2199
  Reviewed by:  emaste, imp
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/arm64/arm64/
  head/sys/arm64/arm64/autoconf.c   (contents, props changed)
  head/sys/arm64/arm64/bcopy.c   (contents, props changed)
  head/sys/arm64/arm64/bus_machdep.c   (contents, props changed)
  head/sys/arm64/arm64/bus_space_asm.S   (contents, props changed)
  head/sys/arm64/arm64/busdma_machdep.c   (contents, props changed)
  head/sys/arm64/arm64/clock.c   (contents, props changed)
  head/sys/arm64/arm64/copyinout.S   (contents, props changed)
  head/sys/arm64/arm64/copystr.c   (contents, props changed)
  head/sys/arm64/arm64/cpufunc_asm.S   (contents, props changed)
  head/sys/arm64/arm64/dump_machdep.c   (contents, props changed)
  head/sys/arm64/arm64/elf_machdep.c   (contents, props changed)
  head/sys/arm64/arm64/exception.S   (contents, props changed)
  head/sys/arm64/arm64/genassym.c   (contents, props changed)
  head/sys/arm64/arm64/gic.c   (contents, props changed)
  head/sys/arm64/arm64/identcpu.c   (contents, props changed)
  head/sys/arm64/arm64/in_cksum.c   (contents, props changed)
  head/sys/arm64/arm64/intr_machdep.c   (contents, props changed)
  head/sys/arm64/arm64/locore.S   (contents, props changed)
  head/sys/arm64/arm64/machdep.c   (contents, props changed)
  head/sys/arm64/arm64/mem.c   (contents, props changed)
  head/sys/arm64/arm64/minidump_machdep.c   (contents, props changed)
  head/sys/arm64/arm64/nexus.c   (contents, props changed)
  head/sys/arm64/arm64/pic_if.m   (contents, props changed)
  head/sys/arm64/arm64/pmap.c   (contents, props changed)
  head/sys/arm64/arm64/stack_machdep.c   (contents, props changed)
  head/sys/arm64/arm64/support.S   (contents, props changed)
  head/sys/arm64/arm64/swtch.S   (contents, props changed)
  head/sys/arm64/arm64/sys_machdep.c   (contents, props changed)
  head/sys/arm64/arm64/trap.c   (contents, props changed)
  head/sys/arm64/arm64/uio_machdep.c   (contents, props changed)
  head/sys/arm64/arm64/vfp.c   (contents, props changed)
  head/sys/arm64/arm64/vm_machdep.c   (contents, props changed)
  head/sys/arm64/conf/
  head/sys/arm64/conf/DEFAULTS   (contents, props changed)
  head/sys/arm64/conf/GENERIC   (contents, props changed)
  head/sys/arm64/include/_bus.h   (contents, props changed)
  head/sys/arm64/include/armreg.h   (contents, props changed)
  head/sys/arm64/include/bus.h   (contents, props changed)
  head/sys/arm64/include/bus_dma.h   (contents, props changed)
  head/sys/arm64/include/clock.h   (contents, props changed)
  head/sys/arm64/include/counter.h   (contents, props changed)
  head/sys/arm64/include/db_machdep.h   (contents, props changed)
  head/sys/arm64/include/debug_monitor.h   (contents, props changed)
  head/sys/arm64/include/devmap.h   (contents, props changed)
  head/sys/arm64/include/dump.h   (contents, props changed)
  head/sys/arm64/include/hypervisor.h   (contents, props changed)
  head/sys/arm64/include/in_cksum.h   (contents, props changed)
  head/sys/arm64/include/intr.h   (contents, props changed)
  head/sys/arm64/include/kdb.h   (contents, props changed)
  head/sys/arm64/include/machdep.h   (contents, props changed)
  head/sys/arm64/include/md_var.h   (contents, props changed)
  head/sys/arm64/include/memdev.h   (contents, props changed)
  head/sys/arm64/include/metadata.h   (contents, props changed)
  head/sys/arm64/include/ofw_machdep.h   (contents, props changed)
  head/sys/arm64/include/resource.h   (contents, props changed)
  head/sys/arm64/include/sf_buf.h   (contents, props changed)
  head/sys/arm64/include/smp.h   (contents, props changed)
  head/sys/arm64/include/stack.h   (contents, props changed)
  head/sys/arm64/include/trap.h   (contents, props changed)
  head/sys/arm64/include/vfp.h   (contents, props changed)
  head/sys/conf/Makefile.arm64   (contents, props changed)
  head/sys/conf/files.arm64   (contents, props changed)
  head/sys/conf/ldscript.arm64   (contents, props changed)
  head/sys/conf/options.arm64   (contents, props changed)
  head/sys/dev/f

svn commit: r281493 - head/sys/arm/arm

2015-04-13 Thread Andrew Turner
Author: andrew
Date: Mon Apr 13 13:21:27 2015
New Revision: 281493
URL: https://svnweb.freebsd.org/changeset/base/281493

Log:
  Update the arm devmap code to also work with arm64.
  
  There are a few differences between the two. On arm we need to provide a
  list of addresses we may be mapping before we have initialised the virtual
  memory subsystem, however on arm64 we allocate a small (2MiB for a 4k
  granule) range to be used for such purposes.
  
  Differential Revision:https://reviews.freebsd.org/D2249
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm/arm/devmap.c

Modified: head/sys/arm/arm/devmap.c
==
--- head/sys/arm/arm/devmap.c   Mon Apr 13 10:32:53 2015(r281492)
+++ head/sys/arm/arm/devmap.c   Mon Apr 13 13:21:27 2015(r281493)
@@ -29,6 +29,8 @@ __FBSDID("$FreeBSD$");
 
 /*
  * Routines for mapping device memory.
+ *
+ * This is used on both arm and arm64.
  */
 
 #include "opt_ddb.h"
@@ -40,10 +42,18 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 static const struct arm_devmap_entry *devmap_table;
 static boolean_t devmap_bootstrap_done = false;
 
+#if defined(__aarch64__)
+#defineMAX_VADDR   VM_MAX_KERNEL_ADDRESS
+#definePTE_DEVICE  VM_MEMATTR_DEVICE
+#elif defined(__arm__)
+#defineMAX_VADDR   ARM_VECTORS_HIGH
+#endif
+
 /*
  * The allocated-kva (akva) devmap table and metadata.  Platforms can call
  * arm_devmap_add_entry() to add static device mappings to this table using
@@ -53,7 +63,11 @@ static boolean_t devmap_bootstrap_done =
 #defineAKVA_DEVMAP_MAX_ENTRIES 32
 static struct arm_devmap_entry akva_devmap_entries[AKVA_DEVMAP_MAX_ENTRIES];
 static u_int   akva_devmap_idx;
-static vm_offset_t akva_devmap_vaddr = ARM_VECTORS_HIGH;
+static vm_offset_t akva_devmap_vaddr = MAX_VADDR;
+
+#ifdef __aarch64__
+extern int early_boot;
+#endif
 
 /*
  * Print the contents of the static mapping table using the provided 
printf-like
@@ -99,7 +113,7 @@ arm_devmap_lastaddr()
if (akva_devmap_idx > 0)
return (akva_devmap_vaddr);
 
-   lowaddr = ARM_VECTORS_HIGH;
+   lowaddr = MAX_VADDR;
for (pd = devmap_table; pd != NULL && pd->pd_size != 0; ++pd) {
if (lowaddr > pd->pd_va)
lowaddr = pd->pd_va;
@@ -136,9 +150,12 @@ arm_devmap_add_entry(vm_paddr_t pa, vm_s
 * align the virtual address to the next-lower 1MB boundary so that we
 * end up with a nice efficient section mapping.
 */
+#ifdef __arm__
if ((pa & 0x000f) == 0 && (sz & 0x000f) == 0) {
akva_devmap_vaddr = trunc_1mpage(akva_devmap_vaddr - sz);
-   } else {
+   } else
+#endif
+   {
akva_devmap_vaddr = trunc_page(akva_devmap_vaddr - sz);
}
m = &akva_devmap_entries[akva_devmap_idx++];
@@ -186,8 +203,12 @@ arm_devmap_bootstrap(vm_offset_t l1pt, c
return;
 
for (pd = devmap_table; pd->pd_size != 0; ++pd) {
+#if defined(__arm__)
pmap_map_chunk(l1pt, pd->pd_va, pd->pd_pa, pd->pd_size,
pd->pd_prot,pd->pd_cache);
+#elif defined(__aarch64__)
+   pmap_kenter_device(pd->pd_va, pd->pd_size, pd->pd_pa);
+#endif
}
 }
 
@@ -252,17 +273,25 @@ pmap_mapdev(vm_offset_t pa, vm_size_t si
/* First look in the static mapping table. */
if ((rva = arm_devmap_ptov(pa, size)) != NULL)
return (rva);
-   
+
offset = pa & PAGE_MASK;
pa = trunc_page(pa);
size = round_page(size + offset);
-   
-   va = kva_alloc(size);
+
+#ifdef __aarch64__
+   if (early_boot) {
+   akva_devmap_vaddr = trunc_page(akva_devmap_vaddr - size);
+   va = akva_devmap_vaddr;
+   KASSERT(va >= VM_MAX_KERNEL_ADDRESS - L2_SIZE,
+   ("Too many early devmap mappings"));
+   } else
+#endif
+   va = kva_alloc(size);
if (!va)
panic("pmap_mapdev: Couldn't alloc kernel virtual memory");
 
pmap_kenter_device(va, size, pa);
-   
+
return ((void *)(va + offset));
 }
 
___
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: r281307 - head/sys/boot/efi/boot1

2015-04-13 Thread Bruce Evans

On Mon, 13 Apr 2015, Andrew Turner wrote:


On Thu, 9 Apr 2015 21:38:02 +1000 (EST)
Bruce Evans  wrote:


On Thu, 9 Apr 2015, Andrew Turner wrote:


Log:
 Print error values with hex to make it easier to find the EFI
error type.

Modified:
 head/sys/boot/efi/boot1/boot1.c

Modified: head/sys/boot/efi/boot1/boot1.c
==
--- head/sys/boot/efi/boot1/boot1.c Thu Apr  9 10:12:58
2015(r281306) +++ head/sys/boot/efi/boot1/boot1.c
Thu Apr  9 10:15:47 2015(r281307) @@ -330,18 +330,18 @@
load(const char *fname) status =
systab->BootServices->LoadImage(TRUE, image, bootdevpath, buffer,
bufsize, &loaderhandle); if (EFI_ERROR(status))
-   printf("LoadImage failed with error %d\n", status);
+   printf("LoadImage failed with error %lx\n",
status);


How would anyone guess that a number like "10" is in hex?

Hex numbers should usually be printed using "%#..." format.  If the
boot loader doesn't have that, then use an 0x prefix.

This shouldn't compile.  'status' cannot have type int and type
unsigned long at the same time.  clang warns even without -Wformat in
CFLAGS.


It is either uint32_t on 32-bit architectures, or uint64_t on 64-bit
architectures. I know it's wrong on 32-bit, however on both
architectures we use this code a long is 32-bit.


That allows it to run, but not to compile.

It only compiles because format checking is broken.

Format checking is broken because printf() is not declared as
__printflike().  Normally, this doesn't matter, because the
compiler knows that printf() is like itself.  However,
-ffreestanding makes printf() just another function so the
compiler must not know anything special about it unless you
tell it.  The kernel is careful about this and declares printf()
as __printflike() in sys/systm.h.  Boot programs are not careful
about this.

Even  is doesn't declare printf() as like itself.  This
works provided  is not (ab)used for the -ffreestanding
case.   declares functions as __printflike() more or less
iff they were not in C90.  For example, it declares snprintf() as
__printflike() since this was necessary before C99 standardized it
and is still necessary to support -std=N where N is older than c99.

Boot programs are also not careful about __restrict.   is
careful about this.  It seems to be careful in the same way as
for __printflike(), but that means using it for old functions like
printf() too, since it was never automatic in C90.

boot1.c actually gets its buggy declaration of printf() by having
its own static function named printf() and not declaring this
as __printflike().  Similarly for all of its other printflike
functions.

Similarly in many other boot programs.  Grepping for ^printf finds
7 more instances of the bug in 7 different files.  Most seem to be
the result of using cut and paste to copy the bug from i386/boot2.
There is not a single instance of __printflike() in the 8 files. 
There are 2 instances of in the whole boot hierarchy.


Boot headers aren't so broken.   uses __printflike() but
hasn't caught up with 'restrict' yet.  libstand has a reduced
printf() but this is still too bloated to use in the small boot1 and
boot2 programs.

Bruce
___
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: r281307 - head/sys/boot/efi/boot1

2015-04-13 Thread Andrew Turner
On Thu, 9 Apr 2015 21:38:02 +1000 (EST)
Bruce Evans  wrote:

> On Thu, 9 Apr 2015, Andrew Turner wrote:
> 
> > Log:
> >  Print error values with hex to make it easier to find the EFI
> > error type.
> >
> > Modified:
> >  head/sys/boot/efi/boot1/boot1.c
> >
> > Modified: head/sys/boot/efi/boot1/boot1.c
> > ==
> > --- head/sys/boot/efi/boot1/boot1.c Thu Apr  9 10:12:58
> > 2015(r281306) +++ head/sys/boot/efi/boot1/boot1.c
> > Thu Apr  9 10:15:47 2015(r281307) @@ -330,18 +330,18 @@
> > load(const char *fname) status =
> > systab->BootServices->LoadImage(TRUE, image, bootdevpath, buffer,
> > bufsize, &loaderhandle); if (EFI_ERROR(status))
> > -   printf("LoadImage failed with error %d\n", status);
> > +   printf("LoadImage failed with error %lx\n",
> > status);
> 
> How would anyone guess that a number like "10" is in hex?
> 
> Hex numbers should usually be printed using "%#..." format.  If the
> boot loader doesn't have that, then use an 0x prefix.
> 
> This shouldn't compile.  'status' cannot have type int and type
> unsigned long at the same time.  clang warns even without -Wformat in
> CFLAGS.

It is either uint32_t on 32-bit architectures, or uint64_t on 64-bit
architectures. I know it's wrong on 32-bit, however on both
architectures we use this code a long is 32-bit.

Andrew
___
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"