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

2012-07-06 Thread Alan Cox
Author: alc
Date: Fri Jul  6 06:42:25 2012
New Revision: 238163
URL: http://svn.freebsd.org/changeset/base/238163

Log:
  Make pmap_enter()'s management of PV entries consistent with the other pmap
  functions that manage PV entries.  Specifically, remove the PV entry from
  the containing PV list only after the corresponding PTE is destroyed.
  
  Update the pmap's wired mapping count in pmap_enter() before the PV list
  lock is acquired.

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

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Fri Jul  6 03:56:45 2012(r238162)
+++ head/sys/amd64/amd64/pmap.c Fri Jul  6 06:42:25 2012(r238163)
@@ -3517,8 +3517,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
goto validate;
} 
 
-   pv = NULL;
-
/*
 * Mapping has changed, invalidate old range and fall through to
 * handle validating new mapping.
@@ -3526,11 +3524,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
if (opa) {
if (origpte  PG_W)
pmap-pm_stats.wired_count--;
-   if (origpte  PG_MANAGED) {
+   if ((origpte  PG_MANAGED) != 0)
om = PHYS_TO_VM_PAGE(opa);
-   CHANGE_PV_LIST_LOCK_TO_VM_PAGE(lock, om);
-   pv = pmap_pvh_remove(om-md, pmap, va);
-   }
if (mpte != NULL) {
mpte-wire_count--;
KASSERT(mpte-wire_count  0,
@@ -3541,22 +3536,20 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
pmap_resident_count_inc(pmap, 1);
 
/*
+* Increment the counters.
+*/
+   if (wired)
+   pmap-pm_stats.wired_count++;
+
+   /*
 * Enter on the PV list if part of our managed memory.
 */
if ((newpte  PG_MANAGED) != 0) {
-   if (pv == NULL)
-   pv = get_pv_entry(pmap, lock);
-   CHANGE_PV_LIST_LOCK_TO_VM_PAGE(lock, m);
+   pv = get_pv_entry(pmap, lock);
pv-pv_va = va;
+   CHANGE_PV_LIST_LOCK_TO_PHYS(lock, pa);
TAILQ_INSERT_TAIL(m-md.pv_list, pv, pv_list);
-   } else if (pv != NULL)
-   free_pv_entry(pmap, pv);
-
-   /*
-* Increment counters
-*/
-   if (wired)
-   pmap-pm_stats.wired_count++;
+   }
 
 validate:
 
@@ -3586,9 +3579,11 @@ validate:
if ((newpte  PG_RW) == 0)
invlva = TRUE;
}
-   if ((om-aflags  PGA_WRITEABLE) != 0) {
-   CHANGE_PV_LIST_LOCK_TO_VM_PAGE(lock, om);
-   if (TAILQ_EMPTY(om-md.pv_list) 
+   if (opa != pa  (origpte  PG_MANAGED) != 0) {
+   CHANGE_PV_LIST_LOCK_TO_PHYS(lock, opa);
+   pmap_pvh_free(om-md, pmap, va);
+   if ((om-aflags  PGA_WRITEABLE) != 0 
+   TAILQ_EMPTY(om-md.pv_list) 
((om-flags  PG_FICTITIOUS) != 0 ||
TAILQ_EMPTY(pa_to_pvh(opa)-pv_list)))
vm_page_aflag_clear(om, PGA_WRITEABLE);
___
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: r238164 - head/sys/dev/atkbdc

2012-07-06 Thread John Baldwin
Author: jhb
Date: Fri Jul  6 12:13:28 2012
New Revision: 238164
URL: http://svn.freebsd.org/changeset/base/238164

Log:
  Add another PS/2 keyboard PNP ID.  This ID is listed as
  Reserved by Microsoft in the standard PNP ID table, but has been seen
  in the wild on at least one laptop.
  
  PR:   kern/169571
  Submitted by: Matthias Apitz  guru unixarea de
  MFC after:3 days

Modified:
  head/sys/dev/atkbdc/atkbdc_isa.c

Modified: head/sys/dev/atkbdc/atkbdc_isa.c
==
--- head/sys/dev/atkbdc/atkbdc_isa.cFri Jul  6 06:42:25 2012
(r238163)
+++ head/sys/dev/atkbdc/atkbdc_isa.cFri Jul  6 12:13:28 2012
(r238164)
@@ -87,6 +87,7 @@ static driver_t atkbdc_isa_driver = {
 
 static struct isa_pnp_id atkbdc_ids[] = {
{ 0x0303d041, Keyboard controller (i8042) },  /* PNP0303 */
+   { 0x0b03d041, Keyboard controller (i8042) },  /* PNP030B */
{ 0x2003d041, Keyboard controller (i8042) },  /* PNP0320 */
{ 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: r238165 - head/tools/tools/netmap

2012-07-06 Thread Ed Maste
Author: emaste
Date: Fri Jul  6 13:21:23 2012
New Revision: 238165
URL: http://svn.freebsd.org/changeset/base/238165

Log:
  Allow threads to finish up when terminated by user
  
  Set a flag and allow worker threads to finish upon ^C, instead of
  immediately cancelling them, so that final packet count and rate
  stats can be displayed.

Modified:
  head/tools/tools/netmap/pkt-gen.c

Modified: head/tools/tools/netmap/pkt-gen.c
==
--- head/tools/tools/netmap/pkt-gen.c   Fri Jul  6 12:13:28 2012
(r238164)
+++ head/tools/tools/netmap/pkt-gen.c   Fri Jul  6 13:21:23 2012
(r238165)
@@ -191,6 +191,7 @@ struct targ {
struct glob_arg *g;
int used;
int completed;
+   int cancel;
int fd;
struct nmreq nmr;
struct netmap_if *nifp;
@@ -221,15 +222,8 @@ static int global_nthreads;
 static void
 sigint_h(__unused int sig)
 {
-   for (int i = 0; i  global_nthreads; i++) {
-   /* cancel active threads. */
-   if (targs[i].used == 0)
-   continue;
-
-   D(Cancelling thread #%d\n, i);
-   pthread_cancel(targs[i].thread);
-   targs[i].used = 0;
-   }
+   for (int i = 0; i  global_nthreads; i++)
+   targs[i].cancel = 1;
 
signal(SIGINT, SIG_DFL);
 }
@@ -495,7 +489,7 @@ D(start);
void *pkt = targ-pkt;
pcap_t *p = targ-g-p;
 
-   for (i = 0; sent  n; i++) {
+   for (i = 0; sent  n  !targ-cancel; i++) {
if (pcap_inject(p, pkt, size) != -1)
sent++;
if (i  1) {
@@ -510,6 +504,8 @@ D(start);
 * wait for available room in the send queue(s)
 */
if (poll(fds, 1, 2000) = 0) {
+   if (targ-cancel)
+   break;
D(poll error/timeout on queue %d\n, targ-me);
goto quit;
}
@@ -518,7 +514,7 @@ D(start);
 */
if (sent  10  !(targ-g-options  OPT_COPY) )
options = ~OPT_COPY;
-   for (i = targ-qfirst; i  targ-qlast; i++) {
+   for (i = targ-qfirst; i  targ-qlast  !targ-cancel; i++) {
int m, limit = MIN(n - sent, targ-g-burst);
 
txring = NETMAP_TXRING(nifp, i);
@@ -529,6 +525,8 @@ D(start);
sent += m;
targ-count = sent;
}
+   if (targ-cancel)
+   break; 
}
/* flush any remaining packets */
ioctl(fds[0].fd, NIOCTXSYNC, NULL);
@@ -614,11 +612,11 @@ receiver_body(void *data)
/* main loop, exit after 1s silence */
gettimeofday(targ-tic, NULL);
 if (targ-g-use_pcap) {
-   for (;;) {
+   while (!targ-cancel) {
pcap_dispatch(targ-g-p, targ-g-burst, receive_pcap, NULL);
}
 } else {
-   while (1) {
+   while (!targ-cancel) {
/* Once we started to receive packets, wait at most 1 seconds
   before quitting. */
if (poll(fds, 1, 1 * 1000) = 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: r238166 - head/sys/amd64/amd64

2012-07-06 Thread John Baldwin
Author: jhb
Date: Fri Jul  6 14:25:59 2012
New Revision: 238166
URL: http://svn.freebsd.org/changeset/base/238166

Log:
  Several fixes to the amd64 disassembler:
  - Add generic support for opcodes that are escape bytes used for
multi-byte opcodes (such as the 0x0f prefix).  Use this to replace
the hard-coded 0x0f special case and add support for three-byte
opcodes that use the 0x0f38 prefix.
  - Decode all Intel VMX instructions.  invept and invvpid in particular are
three-byte opcodes that use the 0x0f38 escape prefix.
  - Rework how the special 'SDEP' size flag works such that the default
instruction name (i_name) is the instruction when the data size
prefix (0x66) is not specified, and the alternate name in i_extra is
used when the prefix is included.
  - Add a new 'ADEP' size flag similar to 'SDEP' except that it chooses
between i_name and i_extra based on the address size prefix (0x67).
Use this to fix the decoding for jrcxz vs jecxz which is determined
by the address size prefix, not the operand size prefix.  Also, jcxz
is not possible in 64-bit mode, but jrcxz is the default instruction
for that opcode.
  - Add support for handling instructions that have a mandatory 'rep'
prefix (this means not outputting the 'repe ' prefix until determining
if it is used as part of an opcode).  Make 'pause' less of a special
case this way.
  - Decode 'cmpxchg16b' and 'cdqe' which are variants of other instructions
but with a REX.W prefix.
  
  MFC after:1 month

Modified:
  head/sys/amd64/amd64/db_disasm.c

Modified: head/sys/amd64/amd64/db_disasm.c
==
--- head/sys/amd64/amd64/db_disasm.cFri Jul  6 13:21:23 2012
(r238165)
+++ head/sys/amd64/amd64/db_disasm.cFri Jul  6 14:25:59 2012
(r238166)
@@ -31,6 +31,7 @@ __FBSDID($FreeBSD$);
  * Instruction disassembler.
  */
 #include sys/param.h
+#include sys/libkern.h
 
 #include ddb/ddb.h
 #include ddb/db_access.h
@@ -47,7 +48,9 @@ __FBSDID($FreeBSD$);
 #defineDBLR5
 #defineEXTR6
 #defineSDEP7
-#defineNONE8
+#defineADEP8
+#defineESC 9
+#defineNONE10
 
 /*
  * REX prefix and bits
@@ -67,6 +70,7 @@ __FBSDID($FreeBSD$);
 #defineEb  4   /* address, byte size */
 #defineR   5   /* register, in 'reg' field */
 #defineRw  6   /* word register, in 'reg' 
field */
+#defineRq  39  /* quad register, in 'reg' 
field */
 #defineRi  7   /* register in instruction */
 #defineS   8   /* segment reg, in 'reg' field 
*/
 #defineSi  9   /* segment reg, in instruction 
*/
@@ -120,6 +124,45 @@ struct finst {
   (or pointer to table) */
 };
 
+static const struct inst db_inst_0f388x[] = {
+/*80*/ { ,  TRUE,  SDEP,  op2(E, Rq),  invept },
+/*81*/ { ,  TRUE,  SDEP,  op2(E, Rq),  invvpid },
+/*82*/ { ,  FALSE, NONE,  0,   0 },
+/*83*/ { ,  FALSE, NONE,  0,   0 },
+/*84*/ { ,  FALSE, NONE,  0,   0 },
+/*85*/ { ,  FALSE, NONE,  0,   0 },
+/*86*/ { ,  FALSE, NONE,  0,   0 },
+/*87*/ { ,  FALSE, NONE,  0,   0 },
+
+/*88*/ { ,  FALSE, NONE,  0,   0 },
+/*89*/ { ,  FALSE, NONE,  0,   0 },
+/*8a*/ { ,  FALSE, NONE,  0,   0 },
+/*8b*/ { ,  FALSE, NONE,  0,   0 },
+/*8c*/ { ,  FALSE, NONE,  0,   0 },
+/*8d*/ { ,  FALSE, NONE,  0,   0 },
+/*8e*/ { ,  FALSE, NONE,  0,   0 },
+/*8f*/ { ,  FALSE, NONE,  0,   0 },
+};
+
+static const struct inst * const db_inst_0f38[] = {
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   db_inst_0f388x,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0
+};
+
 static const char * const db_Grp6[] = {
sldt,
str,
@@ -160,8 +203,8 @@ static const char * const db_Grp9[] = {
,
,
,
-   ,
-   
+   vmptrld,
+   vmptrst
 };
 
 static const char * const db_Grp15[] = {
@@ -236,7 +279,7 @@ static const struct inst db_inst_0f3x[] 
 /*36*/ { ,  FALSE, NONE,  0,   0 },
 /*37*/ { getsec,FALSE, NONE,  0,   0 },
 
-/*38*/ { ,  FALSE, NONE,  0,   0 },
+/*38*/ { ,  FALSE, ESC,  0,db_inst_0f38 },
 /*39*/ { ,  FALSE, NONE,  0,   0 },
 /*3a*/ { ,  FALSE, NONE,  0,   0 },
 /*3b*/ { ,  FALSE, NONE,  0,   0 },
@@ -266,6 +309,26 @@ static const struct inst db_inst_0f4x[] 
 /*4f*/ { cmovnle,TRUE, NONE,  op2(E, R),   0 },
 };
 
+static const struct inst db_inst_0f7x[] = {
+/*70*/ { ,  FALSE, NONE,  0,   0 

svn commit: r238167 - in head/contrib/binutils: gas/config opcodes

2012-07-06 Thread John Baldwin
Author: jhb
Date: Fri Jul  6 14:28:18 2012
New Revision: 238167
URL: http://svn.freebsd.org/changeset/base/238167

Log:
  Add support for the 'invept' and 'invvpid' instructions.  Beyond simply
  adding appropriate table entries, the assembler had to be adjusted as
  these are the first non-SSE instructions to use a 3-byte opcode (and a
  mandatory prefix to boot).
  
  MFC after:1 month

Modified:
  head/contrib/binutils/gas/config/tc-i386.c
  head/contrib/binutils/opcodes/i386-dis.c
  head/contrib/binutils/opcodes/i386-opc.tbl
  head/contrib/binutils/opcodes/i386-tbl.h

Modified: head/contrib/binutils/gas/config/tc-i386.c
==
--- head/contrib/binutils/gas/config/tc-i386.c  Fri Jul  6 14:25:59 2012
(r238166)
+++ head/contrib/binutils/gas/config/tc-i386.c  Fri Jul  6 14:28:18 2012
(r238167)
@@ -3990,6 +3990,16 @@ output_insn (void)
  goto check_prefix;
}
}
+  else if (i.tm.base_opcode == 0x660f3880 || i.tm.base_opcode == 
0x660f3881)
+   {
+ /* invept and invvpid are 3 byte instructions with a
+mandatory prefix. */
+ if (i.tm.base_opcode  0xff00)
+   {
+ prefix = (i.tm.base_opcode  24)  0xff;
+ add_prefix (prefix);
+   }
+   }
   else if ((i.tm.base_opcode  0xff) != 0)
{
  prefix = (i.tm.base_opcode  16)  0xff;
@@ -4029,6 +4039,12 @@ output_insn (void)
  p = frag_more (3);
  *p++ = (i.tm.base_opcode  16)  0xff;
}
+ else if (i.tm.base_opcode == 0x660f3880 ||
+  i.tm.base_opcode == 0x660f3881)
+   {
+ p = frag_more (3);
+ *p++ = (i.tm.base_opcode  16)  0xff;
+   }
  else
p = frag_more (2);
 

Modified: head/contrib/binutils/opcodes/i386-dis.c
==
--- head/contrib/binutils/opcodes/i386-dis.cFri Jul  6 14:25:59 2012
(r238166)
+++ head/contrib/binutils/opcodes/i386-dis.cFri Jul  6 14:28:18 2012
(r238167)
@@ -213,6 +213,7 @@ fetch_data (struct disassemble_info *inf
 #define Ew { OP_E, w_mode }
 #define M { OP_M, 0 }  /* lea, lgdt, etc. */
 #define Ma { OP_M, v_mode }
+#define Mo { OP_M, o_mode }
 #define Mp { OP_M, f_mode }/* 32 or 48 bit memory operand for LDS, 
LES etc */
 #define Mq { OP_M, q_mode }
 #define Gb { OP_G, b_mode }
@@ -540,6 +541,8 @@ fetch_data (struct disassemble_info *inf
 #define PREGRP95  NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 95 } }
 #define PREGRP96  NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 96 } }
 #define PREGRP97  NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 97 } }
+#define PREGRP98  NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 98 } }
+#define PREGRP99  NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 99 } }
 
 
 #define X86_64_0  NULL, { { NULL, X86_64_SPECIAL }, { NULL, 0 } }
@@ -2586,6 +2589,22 @@ static const struct dis386 prefix_user_t
 { punpckldq,{ MX, EMq } },
 { (bad), { XX } },
   },
+
+  /* PREGRP98 */
+  {
+{ (bad), { XX } },
+{ (bad), { XX } },
+{ invept,{ Gm, Mo } },
+{ (bad), { XX } },
+  },
+
+  /* PREGRP99 */
+  {
+{ (bad), { XX } },
+{ (bad), { XX } },
+{ invvpid,{ Gm, Mo } },
+{ (bad), { XX } },
+  },
 };
 
 static const struct dis386 x86_64_table[][2] = {
@@ -2755,8 +2774,8 @@ static const struct dis386 three_byte_ta
 { (bad), { XX } },
 { (bad), { XX } },
 /* 80 */
-{ (bad), { XX } },
-{ (bad), { XX } },
+{ PREGRP98 },
+{ PREGRP99 },
 { (bad), { XX } },
 { (bad), { XX } },
 { (bad), { XX } },
@@ -5884,7 +5903,7 @@ static void
 OP_M (int bytemode, int sizeflag)
 {
   if (modrm.mod == 3)
-/* bad bound,lea,lds,les,lfs,lgs,lss,cmpxchg8b,vmptrst modrm */
+/* bad bound,lea,lds,les,lfs,lgs,lss,cmpxchg8b,vmptrst,invept,invvpid 
modrm */
 BadOp ();
   else
 OP_E (bytemode, sizeflag);

Modified: head/contrib/binutils/opcodes/i386-opc.tbl
==
--- head/contrib/binutils/opcodes/i386-opc.tbl  Fri Jul  6 14:25:59 2012
(r238166)
+++ head/contrib/binutils/opcodes/i386-opc.tbl  Fri Jul  6 14:28:18 2012
(r238167)
@@ -1289,6 +1289,10 @@ mwait, 2, 0xf01, 0xc9, CpuSSE3|CpuNo64, 
 mwait, 2, 0xf01, 0xc9, CpuSSE3|Cpu64, 
No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|ImmExt|NoRex64, { Reg64, Reg64 }
 
 // VMX instructions.
+invept, 2, 0x660f3880, None, CpuVMX|CpuNo64, 
Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_xSuf|NoRex64, { 
BaseIndex|Disp8|Disp16|Disp32|Disp32S, Reg32 }
+invept, 2, 0x660f3880, None, CpuVMX|Cpu64, 
Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_xSuf|NoRex64, { 
BaseIndex|Disp8|Disp16|Disp32|Disp32S, Reg64 }
+invvpid, 2, 0x660f3881, None, CpuVMX|CpuNo64, 

svn commit: r238168 - in head/sys/cddl/dev/dtrace: amd64 i386

2012-07-06 Thread Andriy Gapon
Author: avg
Date: Fri Jul  6 14:41:02 2012
New Revision: 238168
URL: http://svn.freebsd.org/changeset/base/238168

Log:
  r237748 continuation: segment-override prefixes are not invalid in long mode
  
  Update DTrace disassembler accordingly.  The code to treat the prefixes
  as null prefixes was already in place.
  Although in practice compilers seem to generate only cs-prefix for use
  in long NOPs, the same treatment is applied to all of cs, ds, es, ss for
  consistency.
  
  Reported by:  emaste
  Tested by:emaste
  Obtained from:Illumos commit 13442:4adbe6de60c8 (+ local changes)
  MFC after:5 days

Modified:
  head/sys/cddl/dev/dtrace/amd64/dis_tables.c
  head/sys/cddl/dev/dtrace/i386/dis_tables.c

Modified: head/sys/cddl/dev/dtrace/amd64/dis_tables.c
==
--- head/sys/cddl/dev/dtrace/amd64/dis_tables.c Fri Jul  6 14:28:18 2012
(r238167)
+++ head/sys/cddl/dev/dtrace/amd64/dis_tables.c Fri Jul  6 14:41:02 2012
(r238168)
@@ -1146,14 +1146,14 @@ const instable_t dis_distable[16][16] = 
 /* [1,C] */TNS(sbbb,IA), TS(sbb,IA),   
TSx(push,SEG),TSx(pop,SEG),
 }, {
 /* [2,0] */TNS(andb,RMw),TS(and,RMw),  
TNS(andb,MRw),TS(and,MRw),
-/* [2,4] */TNS(andb,IA), TS(and,IA),   
TNSx(%es:,OVERRIDE),  TNSx(daa,NORM),
+/* [2,4] */TNS(andb,IA), TS(and,IA),   
TNS(%es:,OVERRIDE),   TNSx(daa,NORM),
 /* [2,8] */TNS(subb,RMw),TS(sub,RMw),  
TNS(subb,MRw),TS(sub,MRw),
-/* [2,C] */TNS(subb,IA), TS(sub,IA),   
TNSx(%cs:,OVERRIDE),  TNSx(das,NORM),
+/* [2,C] */TNS(subb,IA), TS(sub,IA),   
TNS(%cs:,OVERRIDE),   TNSx(das,NORM),
 }, {
 /* [3,0] */TNS(xorb,RMw),TS(xor,RMw),  
TNS(xorb,MRw),TS(xor,MRw),
-/* [3,4] */TNS(xorb,IA), TS(xor,IA),   
TNSx(%ss:,OVERRIDE),  TNSx(aaa,NORM),
+/* [3,4] */TNS(xorb,IA), TS(xor,IA),   
TNS(%ss:,OVERRIDE),   TNSx(aaa,NORM),
 /* [3,8] */TNS(cmpb,RMw),TS(cmp,RMw),  
TNS(cmpb,MRw),TS(cmp,MRw),
-/* [3,C] */TNS(cmpb,IA), TS(cmp,IA),   
TNSx(%ds:,OVERRIDE),  TNSx(aas,NORM),
+/* [3,C] */TNS(cmpb,IA), TS(cmp,IA),   
TNS(%ds:,OVERRIDE),   TNSx(aas,NORM),
 }, {
 /* [4,0] */TSx(inc,R),   TSx(inc,R),   TSx(inc,R),   
TSx(inc,R),
 /* [4,4] */TSx(inc,R),   TSx(inc,R),   TSx(inc,R),   
TSx(inc,R),

Modified: head/sys/cddl/dev/dtrace/i386/dis_tables.c
==
--- head/sys/cddl/dev/dtrace/i386/dis_tables.c  Fri Jul  6 14:28:18 2012
(r238167)
+++ head/sys/cddl/dev/dtrace/i386/dis_tables.c  Fri Jul  6 14:41:02 2012
(r238168)
@@ -1146,14 +1146,14 @@ const instable_t dis_distable[16][16] = 
 /* [1,C] */TNS(sbbb,IA), TS(sbb,IA),   
TSx(push,SEG),TSx(pop,SEG),
 }, {
 /* [2,0] */TNS(andb,RMw),TS(and,RMw),  
TNS(andb,MRw),TS(and,MRw),
-/* [2,4] */TNS(andb,IA), TS(and,IA),   
TNSx(%es:,OVERRIDE),  TNSx(daa,NORM),
+/* [2,4] */TNS(andb,IA), TS(and,IA),   
TNS(%es:,OVERRIDE),   TNSx(daa,NORM),
 /* [2,8] */TNS(subb,RMw),TS(sub,RMw),  
TNS(subb,MRw),TS(sub,MRw),
-/* [2,C] */TNS(subb,IA), TS(sub,IA),   
TNSx(%cs:,OVERRIDE),  TNSx(das,NORM),
+/* [2,C] */TNS(subb,IA), TS(sub,IA),   
TNS(%cs:,OVERRIDE),   TNSx(das,NORM),
 }, {
 /* [3,0] */TNS(xorb,RMw),TS(xor,RMw),  
TNS(xorb,MRw),TS(xor,MRw),
-/* [3,4] */TNS(xorb,IA), TS(xor,IA),   
TNSx(%ss:,OVERRIDE),  TNSx(aaa,NORM),
+/* [3,4] */TNS(xorb,IA), TS(xor,IA),   
TNS(%ss:,OVERRIDE),   TNSx(aaa,NORM),
 /* [3,8] */TNS(cmpb,RMw),TS(cmp,RMw),  
TNS(cmpb,MRw),TS(cmp,MRw),
-/* [3,C] */TNS(cmpb,IA), TS(cmp,IA),   
TNSx(%ds:,OVERRIDE),  TNSx(aas,NORM),
+/* [3,C] */TNS(cmpb,IA), TS(cmp,IA),   
TNS(%ds:,OVERRIDE),   TNSx(aas,NORM),
 }, {
 /* [4,0] */TSx(inc,R),   TSx(inc,R),   TSx(inc,R),   
TSx(inc,R),
 /* [4,4] */TSx(inc,R),   TSx(inc,R),   TSx(inc,R),   
TSx(inc,R),
___
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: r238167 - in head/contrib/binutils: gas/config opcodes

2012-07-06 Thread John Baldwin
On Friday, July 06, 2012 10:28:18 am John Baldwin wrote:
 Author: jhb
 Date: Fri Jul  6 14:28:18 2012
 New Revision: 238167
 URL: http://svn.freebsd.org/changeset/base/238167
 
 Log:
   Add support for the 'invept' and 'invvpid' instructions.  Beyond simply
   adding appropriate table entries, the assembler had to be adjusted as
   these are the first non-SSE instructions to use a 3-byte opcode (and a
   mandatory prefix to boot).
   
   MFC after:  1 month

To my knowledge, this allows bhyve to now be built with our in-tree toolchain.

-- 
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


Re: svn commit: r238167 - in head/contrib/binutils: gas/config opcodes

2012-07-06 Thread Peter Grehan

To my knowledge, this allows bhyve to now be built with our in-tree toolchain.


 It does :) Thanks for doing this work.

 I'll IFC the bhyve branch and remove the Makefile changes that invoked 
the binutils port.


later,

Peter.

___
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: r238170 - head/tools/tools/netmap

2012-07-06 Thread Ed Maste
Author: emaste
Date: Fri Jul  6 15:36:39 2012
New Revision: 238170
URL: http://svn.freebsd.org/changeset/base/238170

Log:
  Also report tx bandwidth with Ethernet overhead

Modified:
  head/tools/tools/netmap/pkt-gen.c

Modified: head/tools/tools/netmap/pkt-gen.c
==
--- head/tools/tools/netmap/pkt-gen.c   Fri Jul  6 14:45:30 2012
(r238169)
+++ head/tools/tools/netmap/pkt-gen.c   Fri Jul  6 15:36:39 2012
(r238170)
@@ -653,27 +653,41 @@ quit:
return (NULL);
 }
 
+static char *
+scaled_val(double val)
+{
+   static char buf[64];
+   const char *units[] = {, K, M, G};
+   int i = 0;
+
+   while (val = 1000  i  3) {
+   val /= 1000;
+   i++;
+   }
+   snprintf(buf, sizeof(buf), %.2f%s, val, units[i]);
+   return (buf);
+}
+
 static void
 tx_output(uint64_t sent, int size, double delta)
 {
-   double amount = 8.0 * (1.0 * size * sent) / delta;
+   uint64_t bytes_sent = sent * size;
+   double bw = 8.0 * bytes_sent / delta;
double pps = sent / delta;
-   char units[4] = { '\0', 'K', 'M', 'G' };
-   int aunit = 0, punit = 0;
-
-   while (amount = 1000) {
-   amount /= 1000;
-   aunit += 1;
-   }
-   while (pps = 1000) {
-   pps /= 1000;
-   punit += 1;
-   }
+   /*
+* Assume Ethernet overhead of 24 bytes per packet excluding header:
+* FCS   4 bytes
+* Preamble  8 bytes
+* IFG  12 bytes
+*/
+   double bw_with_overhead = 8.0 * (bytes_sent + sent * 24) / delta;
 
printf(Sent % PRIu64  packets, %d bytes each, in %.2f seconds.\n,
   sent, size, delta);
-   printf(Speed: %.2f%cpps. Bandwidth: %.2f%cbps.\n,
-  pps, units[punit], amount, units[aunit]);
+   printf(Speed: %spps. , scaled_val(pps));
+   printf(Bandwidth: %sbps , scaled_val(bw));
+   printf((%sbps with overhead).\n, scaled_val(bw_with_overhead));
+
 }
 
 
___
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: r238171 - head/sys/geom

2012-07-06 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri Jul  6 15:46:38 2012
New Revision: 238171
URL: http://svn.freebsd.org/changeset/base/238171

Log:
  Fix typo in the comment.

Modified:
  head/sys/geom/geom_dev.c

Modified: head/sys/geom/geom_dev.c
==
--- head/sys/geom/geom_dev.cFri Jul  6 15:36:39 2012(r238170)
+++ head/sys/geom/geom_dev.cFri Jul  6 15:46:38 2012(r238171)
@@ -497,7 +497,7 @@ g_dev_strategy(struct bio *bp)
  *
  * Called from below when the provider orphaned us.
  * - Clear any dump settings.
- * - Destroy the struct cdev *to prevent any more request from coming in.  The
+ * - Destroy the struct cdev to prevent any more request from coming in.  The
  *   provider is already marked with an error, so anything which comes in
  *   in the interrim will be returned immediately.
  * - Wait for any outstanding I/O to finish.
___
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: r238172 - head/sys/dev/agp

2012-07-06 Thread Marcel Moolenaar
Author: marcel
Date: Fri Jul  6 15:57:03 2012
New Revision: 238172
URL: http://svn.freebsd.org/changeset/base/238172

Log:
  agp.c:
  Don't use Maxmem when the amount of memory is meant. Use realmem instead.
  Maxmem is not only a MD variable, it represents the highest physical memory
  address in use. On systems where memory is sparsely layed-out the highest
  memory address and the amount of memory are not interchangeable. Scaling the
  AGP aperture based on the actual amount of memory (= realmem) rather than
  the available memory (= physmem) makes sure there's consistent behaviour
  across architectures.
  
  agp_i810.c:
  While arguably the use of Maxmem can be considered correct, replace its use
  with realmem anyway. agp_i810.c is specific to amd64, i386  pc98, which
  have a dense physical memory layout. Avoiding Maxmem here is done with an
  eye on copy-n-paste behaviour in general and to avoid confusion caused by
  using realmem in agp.c and Maxmem in agp_i810.c.
  
  In both cases, remove the inclusion of md_var.h

Modified:
  head/sys/dev/agp/agp.c
  head/sys/dev/agp/agp_i810.c

Modified: head/sys/dev/agp/agp.c
==
--- head/sys/dev/agp/agp.c  Fri Jul  6 15:46:38 2012(r238171)
+++ head/sys/dev/agp/agp.c  Fri Jul  6 15:57:03 2012(r238172)
@@ -55,7 +55,6 @@ __FBSDID($FreeBSD$);
 #include vm/vm_pageout.h
 #include vm/pmap.h
 
-#include machine/md_var.h
 #include machine/bus.h
 #include machine/resource.h
 #include sys/rman.h
@@ -234,7 +233,7 @@ agp_generic_attach(device_t dev)
 * Work out an upper bound for agp memory allocation. This
 * uses a heurisitc table from the Linux driver.
 */
-   memsize = ptoa(Maxmem)  20;
+   memsize = ptoa(realmem)  20;
for (i = 0; i  agp_max_size; i++) {
if (memsize = agp_max[i][0])
break;

Modified: head/sys/dev/agp/agp_i810.c
==
--- head/sys/dev/agp/agp_i810.c Fri Jul  6 15:46:38 2012(r238171)
+++ head/sys/dev/agp/agp_i810.c Fri Jul  6 15:57:03 2012(r238172)
@@ -74,7 +74,6 @@ __FBSDID($FreeBSD$);
 
 #include machine/bus.h
 #include machine/resource.h
-#include machine/md_var.h
 #include sys/rman.h
 
 MALLOC_DECLARE(M_AGP);
@@ -1439,7 +1438,7 @@ agp_i810_attach(device_t dev)
if (error)
return (error);
 
-   if (ptoa((vm_paddr_t)Maxmem) 
+   if (ptoa((vm_paddr_t)realmem) 
(1ULL  sc-match-driver-busdma_addr_mask_sz) - 1) {
device_printf(dev, agp_i810 does not support physical 
memory above %ju.\n, (uintmax_t)(1ULL 
___
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: r238173 - head/lib/libedit

2012-07-06 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Jul  6 16:43:56 2012
New Revision: 238173
URL: http://svn.freebsd.org/changeset/base/238173

Log:
  Fix issue resizing bin/sh
  
  This partially reverts some changes from r237448 that are causing
  breakage when resizing under bin/sh .
  
  Reverted changes from NetBSD are:
  
  Mar 10 20:46:15 2009 - editline.3 read.c
  make el_gets set the count to -1 on error to distinguish between EOF and
  error.
  
  Feb 19 15:20:22 2009 - read.c sig.c sig.h
  reset and redraw on sigcont. From Anon Ymous.
  
  Feb 15 21:24:13 2009
  don't restart on EINTR, instead return NULL immediately. From Anon Ymous
  
  PR:   169603
  Reported by:  Peter Jeremy, David Shao
  MFC after:3 days

Modified:
  head/lib/libedit/editline.3
  head/lib/libedit/el.h
  head/lib/libedit/read.c
  head/lib/libedit/sig.c
  head/lib/libedit/sig.h

Modified: head/lib/libedit/editline.3
==
--- head/lib/libedit/editline.3 Fri Jul  6 15:57:03 2012(r238172)
+++ head/lib/libedit/editline.3 Fri Jul  6 16:43:56 2012(r238173)
@@ -162,11 +162,6 @@ is modified to contain the number of cha
 Returns the line read if successful, or
 .Dv NULL
 if no characters were read or if an error occurred.
-If an error occurred,
-.Fa count
-is set to \-1 and
-.Dv errno
-contains the error code that caused it.
 The return value may not remain valid across calls to
 .Fn el_gets
 and must be copied if the data is to be retained.

Modified: head/lib/libedit/el.h
==
--- head/lib/libedit/el.h   Fri Jul  6 15:57:03 2012(r238172)
+++ head/lib/libedit/el.h   Fri Jul  6 16:43:56 2012(r238173)
@@ -115,7 +115,6 @@ struct editline {
FILE *el_errfile;   /* Stdio stuff  */
int   el_infd;  /* Input file descriptor*/
int   el_flags; /* Various flags.   */
-   int   el_errno; /* Local copy of errno  */
coord_t   el_cursor;/* Cursor location  */
char**el_display;   /* Real screen image = what is there */
char**el_vdisplay;  /* Virtual screen image = what we see */

Modified: head/lib/libedit/read.c
==
--- head/lib/libedit/read.c Fri Jul  6 15:57:03 2012(r238172)
+++ head/lib/libedit/read.c Fri Jul  6 16:43:56 2012(r238173)
@@ -49,7 +49,7 @@ __FBSDID($FreeBSD$);
 #include stdlib.h
 #include el.h
 
-#defineOKCMD   -1  /* must be -1! */
+#defineOKCMD   -1
 
 private intread__fixio(int, int);
 private intread_preread(EditLine *);
@@ -170,7 +170,7 @@ read__fixio(int fd __unused, int e)
return (e ? 0 : -1);
 
case EINTR:
-   return (-1);
+   return (0);
 
default:
return (-1);
@@ -235,12 +235,9 @@ read_getcmd(EditLine *el, el_action_t *c
el_action_t cmd;
int num;
 
-   el-el_errno = 0;
do {
-   if ((num = el_getc(el, ch)) != 1) { /* if EOF or error */
-   el-el_errno = num == 0 ? 0 : errno;
+   if ((num = el_getc(el, ch)) != 1)   /* if EOF or error */
return (num);
-   }
 
 #ifdef KANJI
if ((*ch  0200)) {
@@ -292,21 +289,14 @@ read_char(EditLine *el, char *cp)
ssize_t num_read;
int tried = 0;
 
- again:
-   el-el_signal-sig_no = 0;
-   while ((num_read = read(el-el_infd, cp, 1)) == -1) {
-   if (el-el_signal-sig_no == SIGCONT) {
-   sig_set(el);
-   el_set(el, EL_REFRESH);
-   goto again;
-   }
+   while ((num_read = read(el-el_infd, cp, 1)) == -1)
if (!tried  read__fixio(el-el_infd, errno) == 0)
tried = 1;
else {
*cp = '\0';
return (-1);
}
-   }
+
return (int)num_read;
 }
 
@@ -413,20 +403,17 @@ el_gets(EditLine *el, int *nread)
int num;/* how many chars we have read at NL */
char ch;
int crlf = 0;
-   int nrb;
 #ifdef FIONREAD
c_macro_t *ma = el-el_chared.c_macro;
 #endif /* FIONREAD */
 
-   if (nread == NULL)
-   nread = nrb;
*nread = 0;
 
if (el-el_flags  NO_TTY) {
char *cp = el-el_line.buffer;
size_t idx;
 
-   while ((num = (*el-el_read.read_char)(el, cp)) == 1) {
+   while ((*el-el_read.read_char)(el, cp) == 1) {
/* make sure there is space for next character */
if (cp + 1 = el-el_line.limit) {
 

svn commit: r238175 - head/tools/tools/netmap

2012-07-06 Thread Ed Maste
Author: emaste
Date: Fri Jul  6 17:03:43 2012
New Revision: 238175
URL: http://svn.freebsd.org/changeset/base/238175

Log:
  Allow continuous packet transmission (via -t 0)
  
  Also add a missing check for the cancel flag while waiting for the first
  packet in receive mode.

Modified:
  head/tools/tools/netmap/pkt-gen.c

Modified: head/tools/tools/netmap/pkt-gen.c
==
--- head/tools/tools/netmap/pkt-gen.c   Fri Jul  6 16:54:25 2012
(r238174)
+++ head/tools/tools/netmap/pkt-gen.c   Fri Jul  6 17:03:43 2012
(r238175)
@@ -472,9 +472,14 @@ sender_body(void *data)
struct pollfd fds[1];
struct netmap_if *nifp = targ-nifp;
struct netmap_ring *txring;
-   int i, n = targ-g-npackets / targ-g-nthreads, sent = 0;
+   int i, pkts_per_td = targ-g-npackets / targ-g-nthreads, sent = 0;
+   int continuous = 0;
int options = targ-g-options | OPT_COPY;
 D(start);
+   if (pkts_per_td == 0) {
+   continuous = 1;
+   pkts_per_td = 10;
+   }
if (setaffinity(targ-thread, targ-affinity))
goto quit;
/* setup poll(2) mechanism. */
@@ -489,7 +494,7 @@ D(start);
void *pkt = targ-pkt;
pcap_t *p = targ-g-p;
 
-   for (i = 0; sent  n  !targ-cancel; i++) {
+   for (i = 0; (sent  pkts_per_td  !targ-cancel) || continuous; i++) {
if (pcap_inject(p, pkt, size) != -1)
sent++;
if (i  1) {
@@ -498,7 +503,7 @@ D(start);
}
}
 } else {
-   while (sent  n) {
+   while (sent  pkts_per_td || continuous) {
 
/*
 * wait for available room in the send queue(s)
@@ -515,7 +520,9 @@ D(start);
if (sent  10  !(targ-g-options  OPT_COPY) )
options = ~OPT_COPY;
for (i = targ-qfirst; i  targ-qlast  !targ-cancel; i++) {
-   int m, limit = MIN(n - sent, targ-g-burst);
+   int m, limit = targ-g-burst;
+   if (!continuous  pkts_per_td - sent  limit)
+   limit = pkts_per_td - sent;
 
txring = NETMAP_TXRING(nifp, i);
if (txring-avail == 0)
@@ -602,7 +609,7 @@ receiver_body(void *data)
fds[0].events = (POLLIN);
 
/* unbounded wait for the first packet. */
-   for (;;) {
+   while (!targ-cancel) {
i = poll(fds, 1, 1000);
if (i  0  !(fds[0].revents  POLLERR))
break;
@@ -716,7 +723,7 @@ usage(void)
Usage:\n
%s arguments\n
\t-i interface interface name\n
-   \t-t pkts_to_send  also forces send mode\n
+   \t-t pkts_to_send  also forces send mode, 0 = continuous\n
\t-r pkts_to_receive   also forces receive mode\n
\t-l pkts_size in bytes excluding CRC\n
\t-d dst-ipend with %%n to sweep n addresses\n
___
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: r238172 - head/sys/dev/agp

2012-07-06 Thread Konstantin Belousov
On Fri, Jul 06, 2012 at 03:57:04PM +, Marcel Moolenaar wrote:
 Author: marcel
 Date: Fri Jul  6 15:57:03 2012
 New Revision: 238172
 URL: http://svn.freebsd.org/changeset/base/238172
 
 Log:
   agp.c:
   Don't use Maxmem when the amount of memory is meant. Use realmem instead.
   Maxmem is not only a MD variable, it represents the highest physical memory
   address in use. On systems where memory is sparsely layed-out the highest
   memory address and the amount of memory are not interchangeable. Scaling the
   AGP aperture based on the actual amount of memory (= realmem) rather than
   the available memory (= physmem) makes sure there's consistent behaviour
   across architectures.
   
   agp_i810.c:
   While arguably the use of Maxmem can be considered correct, replace its use
   with realmem anyway. agp_i810.c is specific to amd64, i386  pc98, which
   have a dense physical memory layout. Avoiding Maxmem here is done with an
   eye on copy-n-paste behaviour in general and to avoid confusion caused by
   using realmem in agp.c and Maxmem in agp_i810.c.
The agp_i810.c use is to prevent attachment when largest physical address
of populated memory exceeds GPU limits established by PTE format and
chipset errata. Editing Maxmem to be spelled as realmem seems to change
nothing right now, but I do argue that this is wrong, and commit message
makes future archeology quite confusing.

   
   In both cases, remove the inclusion of md_var.h
 
 Modified:
   head/sys/dev/agp/agp.c
   head/sys/dev/agp/agp_i810.c
 
 Modified: head/sys/dev/agp/agp.c
 ==
 --- head/sys/dev/agp/agp.cFri Jul  6 15:46:38 2012(r238171)
 +++ head/sys/dev/agp/agp.cFri Jul  6 15:57:03 2012(r238172)
 @@ -55,7 +55,6 @@ __FBSDID($FreeBSD$);
  #include vm/vm_pageout.h
  #include vm/pmap.h
  
 -#include machine/md_var.h
  #include machine/bus.h
  #include machine/resource.h
  #include sys/rman.h
 @@ -234,7 +233,7 @@ agp_generic_attach(device_t dev)
* Work out an upper bound for agp memory allocation. This
* uses a heurisitc table from the Linux driver.
*/
 - memsize = ptoa(Maxmem)  20;
 + memsize = ptoa(realmem)  20;
   for (i = 0; i  agp_max_size; i++) {
   if (memsize = agp_max[i][0])
   break;
 
 Modified: head/sys/dev/agp/agp_i810.c
 ==
 --- head/sys/dev/agp/agp_i810.c   Fri Jul  6 15:46:38 2012
 (r238171)
 +++ head/sys/dev/agp/agp_i810.c   Fri Jul  6 15:57:03 2012
 (r238172)
 @@ -74,7 +74,6 @@ __FBSDID($FreeBSD$);
  
  #include machine/bus.h
  #include machine/resource.h
 -#include machine/md_var.h
  #include sys/rman.h
  
  MALLOC_DECLARE(M_AGP);
 @@ -1439,7 +1438,7 @@ agp_i810_attach(device_t dev)
   if (error)
   return (error);
  
 - if (ptoa((vm_paddr_t)Maxmem) 
 + if (ptoa((vm_paddr_t)realmem) 
   (1ULL  sc-match-driver-busdma_addr_mask_sz) - 1) {
   device_printf(dev, agp_i810 does not support physical 
   memory above %ju.\n, (uintmax_t)(1ULL 


pgpwq8P0YS0mO.pgp
Description: PGP signature


svn commit: r238178 - head/lib/libedit

2012-07-06 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Jul  6 19:30:50 2012
New Revision: 238178
URL: http://svn.freebsd.org/changeset/base/238178

Log:
  Merge a small update from NetBSD.
  
  Feb 15 21:55:23 2009 - chared.c chared.h
  pass lint on _LP64.
  
  MFC after:1 week

Modified:
  head/lib/libedit/chared.c
  head/lib/libedit/chared.h

Modified: head/lib/libedit/chared.c
==
--- head/lib/libedit/chared.c   Fri Jul  6 17:42:34 2012(r238177)
+++ head/lib/libedit/chared.c   Fri Jul  6 19:30:50 2012(r238178)
@@ -29,7 +29,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $NetBSD: chared.c,v 1.25 2005/08/08 01:41:30 christos Exp $
+ * $NetBSD: chared.c,v 1.27 2009/02/15 21:55:23 christos Exp $
  */
 
 #if !defined(lint)  !defined(SCCSID)
@@ -59,12 +59,12 @@ cv_undo(EditLine *el)
 {
c_undo_t *vu = el-el_chared.c_undo;
c_redo_t *r = el-el_chared.c_redo;
-   unsigned int size;
+   size_t size;
 
/* Save entire line for undo */
size = el-el_line.lastchar - el-el_line.buffer;
vu-len = size;
-   vu-cursor = el-el_line.cursor - el-el_line.buffer;
+   vu-cursor = (int)(el-el_line.cursor - el-el_line.buffer);
memcpy(vu-buf, el-el_line.buffer, size);
 
/* save command info for redo */
@@ -83,7 +83,7 @@ cv_yank(EditLine *el, const char *ptr, i
 {
c_kill_t *k = el-el_chared.c_kill;
 
-   memcpy(k-buf, ptr, size +0u);
+   memcpy(k-buf, ptr, (size_t)size);
k-last = k-buf + size;
 }
 
@@ -97,7 +97,7 @@ c_insert(EditLine *el, int num)
char *cp;
 
if (el-el_line.lastchar + num = el-el_line.limit) {
-   if (!ch_enlargebufs(el, num +0u))
+   if (!ch_enlargebufs(el, (size_t)num))
return; /* can't go past end of buffer */
}
 
@@ -118,7 +118,7 @@ c_delafter(EditLine *el, int num)
 {
 
if (el-el_line.cursor + num  el-el_line.lastchar)
-   num = el-el_line.lastchar - el-el_line.cursor;
+   num = (int)(el-el_line.lastchar - el-el_line.cursor);
 
if (el-el_map.current != el-el_map.emacs) {
cv_undo(el);
@@ -159,7 +159,7 @@ c_delbefore(EditLine *el, int num)
 {
 
if (el-el_line.cursor - num  el-el_line.buffer)
-   num = el-el_line.cursor - el-el_line.buffer;
+   num = (int)(el-el_line.cursor - el-el_line.buffer);
 
if (el-el_map.current != el-el_map.emacs) {
cv_undo(el);
@@ -375,7 +375,7 @@ cv_delfini(EditLine *el)
/* sanity */
return;
 
-   size = el-el_line.cursor - el-el_chared.c_vcmd.pos;
+   size = (int)(el-el_line.cursor - el-el_chared.c_vcmd.pos);
if (size == 0)
size = 1;
el-el_line.cursor = el-el_chared.c_vcmd.pos;
@@ -529,8 +529,7 @@ ch_reset(EditLine *el, int mclear)
 }
 
 private void
-ch__clearmacro(el)
-   EditLine *el;
+ch__clearmacro(EditLine *el)
 {
c_macro_t *ma = el-el_chared.c_macro;
while (ma-level = 0)
@@ -542,9 +541,7 @@ ch__clearmacro(el)
  * Returns 1 if successful, 0 if not.
  */
 protected int
-ch_enlargebufs(el, addlen)
-   EditLine *el;
-   size_t addlen;
+ch_enlargebufs(EditLine *el, size_t addlen)
 {
size_t sz, newsz;
char *newbuffer, *oldbuf, *oldkbuf;
@@ -695,12 +692,12 @@ protected int
 c_gets(EditLine *el, char *buf, const char *prompt)
 {
char ch;
-   int len;
+   ssize_t len;
char *cp = el-el_line.buffer;
 
if (prompt) {
len = strlen(prompt);
-   memcpy(cp, prompt, len + 0u);
+   memcpy(cp, prompt, (size_t)len);
cp += len;
}
len = 0;
@@ -721,7 +718,7 @@ c_gets(EditLine *el, char *buf, const ch
 
case '\010':/* Delete and backspace */
case '\177':
-   if (len = 0) {
+   if (len == 0) {
len = -1;
break;
}
@@ -749,7 +746,7 @@ c_gets(EditLine *el, char *buf, const ch
el-el_line.buffer[0] = '\0';
el-el_line.lastchar = el-el_line.buffer;
el-el_line.cursor = el-el_line.buffer;
-   return len;
+   return (int)len;
 }
 
 
@@ -771,6 +768,6 @@ c_hpos(EditLine *el)
 ptr = el-el_line.buffer  *ptr != '\n';
 ptr--)
continue;
-   return (el-el_line.cursor - ptr - 1);
+   return (int)(el-el_line.cursor - ptr - 1);
}
 }

Modified: head/lib/libedit/chared.h
==
--- head/lib/libedit/chared.h   Fri Jul  6 17:42:34 2012(r238177)
+++ head/lib/libedit/chared.h   Fri Jul  6 19:30:50 2012(r238178)
@@ -30,7 +30,7 @@
  * 

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

2012-07-06 Thread Konstantin Belousov
Author: kib
Date: Fri Jul  6 20:11:58 2012
New Revision: 238179
URL: http://svn.freebsd.org/changeset/base/238179

Log:
  Use assembler mnemonic instead of manually assembling, contination for 
r238142.
  
  Reviewed by:  jhb
  MFC after:1 month

Modified:
  head/sys/amd64/amd64/cpu_switch.S

Modified: head/sys/amd64/amd64/cpu_switch.S
==
--- head/sys/amd64/amd64/cpu_switch.S   Fri Jul  6 19:30:50 2012
(r238178)
+++ head/sys/amd64/amd64/cpu_switch.S   Fri Jul  6 20:11:58 2012
(r238179)
@@ -122,8 +122,7 @@ done_store_dr:
 1: movq%rdx,%rcx
movlxsave_mask,%eax
movlxsave_mask+4,%edx
-/* xsave   (%r8) */
-   .byte   0x41,0x0f,0xae,0x20
+   xsave   (%r8)
movq%rcx,%rdx
 2: smsw%ax
orb $CR0_TS,%al
@@ -499,10 +498,8 @@ ENTRY(resumectx)
movq%rax,%rdx
shrq$32,%rdx
movl$XCR0,%ecx
-/* xsetbv  */
-   .byte   0x0f, 0x01, 0xd1
-/* xrstor  (%rbx) */
-   .byte   0x0f, 0xae, 0x2b
+   xsetbv
+   xrstor  (%rbx)
jmp 2f
 1:
fxrstor (%rbx)
___
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: r238180 - head/sys/vm

2012-07-06 Thread Konstantin Belousov
Author: kib
Date: Fri Jul  6 20:13:16 2012
New Revision: 238180
URL: http://svn.freebsd.org/changeset/base/238180

Log:
  Style.
  
  Reviewed by:  alc (previous version)
  MFC after:1 week

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cFri Jul  6 20:11:58 2012(r238179)
+++ head/sys/vm/vm_pageout.cFri Jul  6 20:13:16 2012(r238180)
@@ -836,7 +836,7 @@ rescan0:
object = m-object;
if (!VM_OBJECT_TRYLOCK(object) 
(!vm_pageout_fallback_object_lock(m, next) ||
-   m-hold_count != 0)) {
+   m-hold_count != 0)) {
VM_OBJECT_UNLOCK(object);
vm_page_unlock(m);
addl_page_shortage++;
@@ -867,8 +867,8 @@ rescan0:
 * level VM system not knowing anything about existing 
 * references.
 */
-   } else if (((m-aflags  PGA_REFERENCED) == 0) 
-   (actcount = pmap_ts_referenced(m))) {
+   } else if ((m-aflags  PGA_REFERENCED) == 0 
+   (actcount = pmap_ts_referenced(m)) != 0) {
vm_page_activate(m);
vm_page_unlock(m);
m-act_count += actcount + ACT_ADVANCE;
___
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: r238181 - head/sys/modules/em

2012-07-06 Thread Konstantin Belousov
Author: kib
Date: Fri Jul  6 20:14:27 2012
New Revision: 238181
URL: http://svn.freebsd.org/changeset/base/238181

Log:
  Add a source file needed for module linking.
  
  MFC after:   4 days

Modified:
  head/sys/modules/em/Makefile

Modified: head/sys/modules/em/Makefile
==
--- head/sys/modules/em/MakefileFri Jul  6 20:13:16 2012
(r238180)
+++ head/sys/modules/em/MakefileFri Jul  6 20:14:27 2012
(r238181)
@@ -9,7 +9,7 @@ CORE_SRC = if_em.c e1000_osdep.c
 # undefined when using modular driver if not needed
 LEGACY_SRC+= if_lem.c
 COMMON_SHARED = e1000_api.c e1000_phy.c e1000_nvm.c e1000_mac.c \
-   e1000_manage.c e1000_vf.c e1000_mbx.c
+   e1000_manage.c e1000_vf.c e1000_mbx.c e1000_i210.c
 PCIE_SHARED = e1000_80003es2lan.c e1000_ich8lan.c e1000_82571.c e1000_82575.c
 LEGACY_SHARED = e1000_82540.c e1000_82542.c e1000_82541.c e1000_82543.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


svn commit: r238182 - head/lib/libc/locale

2012-07-06 Thread David Chisnall
Author: theraven
Date: Fri Jul  6 20:16:22 2012
New Revision: 238182
URL: http://svn.freebsd.org/changeset/base/238182

Log:
  Restore the __collate_load_error global that was accidentally removed in the
  xlocale refactoring.
  
  MFC after:1 week

Modified:
  head/lib/libc/locale/collate.c
  head/lib/libc/locale/setrunelocale.c

Modified: head/lib/libc/locale/collate.c
==
--- head/lib/libc/locale/collate.c  Fri Jul  6 20:14:27 2012
(r238181)
+++ head/lib/libc/locale/collate.c  Fri Jul  6 20:16:22 2012
(r238182)
@@ -56,11 +56,11 @@ __FBSDID($FreeBSD$);
  * We also modify the collation table test functions to search the thread-local
  * table first and the global table second.  
  */
-#define __collate_load_error (table-__collate_load_error)
 #define __collate_substitute_nontrivial 
(table-__collate_substitute_nontrivial)
 #define __collate_substitute_table_ptr (table-__collate_substitute_table_ptr)
 #define __collate_char_pri_table_ptr (table-__collate_char_pri_table_ptr)
 #define __collate_chain_pri_table (table-__collate_chain_pri_table)
+int __collate_load_error;
 
 
 struct xlocale_collate __xlocale_global_collate = {
@@ -109,7 +109,9 @@ __collate_load(const char *encoding, loc
 int
 __collate_load_tables(const char *encoding)
 {
-   return __collate_load_tables_l(encoding, __xlocale_global_collate);
+   int ret = __collate_load_tables_l(encoding, __xlocale_global_collate);
+   __collate_load_error = __xlocale_global_collate.__collate_load_error;
+   return ret;
 }
 
 int
@@ -123,7 +125,7 @@ __collate_load_tables_l(const char *enco
 
/* 'encoding' must be already checked. */
if (strcmp(encoding, C) == 0 || strcmp(encoding, POSIX) == 0) {
-   __collate_load_error = 1;
+   table-__collate_load_error = 1;
return (_LDP_CACHE);
}
 
@@ -240,7 +242,7 @@ __collate_load_tables_l(const char *enco
break;
}
}
-   __collate_load_error = 0;
+   table-__collate_load_error = 0;
 
return (_LDP_LOADED);
 }

Modified: head/lib/libc/locale/setrunelocale.c
==
--- head/lib/libc/locale/setrunelocale.cFri Jul  6 20:14:27 2012
(r238181)
+++ head/lib/libc/locale/setrunelocale.cFri Jul  6 20:16:22 2012
(r238182)
@@ -67,7 +67,6 @@ extern _RuneLocale*_Read_RuneMagi(FILE 
 
 static int __setrunelocale(struct xlocale_ctype *l, const char *);
 
-#define __collate_load_error (table-__collate_load_error)
 #define __collate_substitute_nontrivial 
(table-__collate_substitute_nontrivial)
 #define __collate_substitute_table_ptr (table-__collate_substitute_table_ptr)
 #define __collate_char_pri_table_ptr (table-__collate_char_pri_table_ptr)
___
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: r238182 - head/lib/libc/locale

2012-07-06 Thread Konstantin Belousov
On Fri, Jul 06, 2012 at 08:16:22PM +, David Chisnall wrote:
 Author: theraven
 Date: Fri Jul  6 20:16:22 2012
 New Revision: 238182
 URL: http://svn.freebsd.org/changeset/base/238182
 
 Log:
   Restore the __collate_load_error global that was accidentally removed in the
   xlocale refactoring.
   
I think this commit is wrong, or at least not complete.
You failed to restore the actual export of the symbol in locale/Symbol.map.

   MFC after:  1 week
 
 Modified:
   head/lib/libc/locale/collate.c
   head/lib/libc/locale/setrunelocale.c
 
 Modified: head/lib/libc/locale/collate.c
 ==
 --- head/lib/libc/locale/collate.cFri Jul  6 20:14:27 2012
 (r238181)
 +++ head/lib/libc/locale/collate.cFri Jul  6 20:16:22 2012
 (r238182)
 @@ -56,11 +56,11 @@ __FBSDID($FreeBSD$);
   * We also modify the collation table test functions to search the 
 thread-local
   * table first and the global table second.  
   */
 -#define __collate_load_error (table-__collate_load_error)
  #define __collate_substitute_nontrivial 
 (table-__collate_substitute_nontrivial)
  #define __collate_substitute_table_ptr 
 (table-__collate_substitute_table_ptr)
  #define __collate_char_pri_table_ptr (table-__collate_char_pri_table_ptr)
  #define __collate_chain_pri_table (table-__collate_chain_pri_table)
 +int __collate_load_error;
  
  
  struct xlocale_collate __xlocale_global_collate = {
 @@ -109,7 +109,9 @@ __collate_load(const char *encoding, loc
  int
  __collate_load_tables(const char *encoding)
  {
 - return __collate_load_tables_l(encoding, __xlocale_global_collate);
 + int ret = __collate_load_tables_l(encoding, __xlocale_global_collate);
 + __collate_load_error = __xlocale_global_collate.__collate_load_error;
 + return ret;
  }
  
  int
 @@ -123,7 +125,7 @@ __collate_load_tables_l(const char *enco
  
   /* 'encoding' must be already checked. */
   if (strcmp(encoding, C) == 0 || strcmp(encoding, POSIX) == 0) {
 - __collate_load_error = 1;
 + table-__collate_load_error = 1;
   return (_LDP_CACHE);
   }
  
 @@ -240,7 +242,7 @@ __collate_load_tables_l(const char *enco
   break;
   }
   }
 - __collate_load_error = 0;
 + table-__collate_load_error = 0;
  
   return (_LDP_LOADED);
  }
 
 Modified: head/lib/libc/locale/setrunelocale.c
 ==
 --- head/lib/libc/locale/setrunelocale.c  Fri Jul  6 20:14:27 2012
 (r238181)
 +++ head/lib/libc/locale/setrunelocale.c  Fri Jul  6 20:16:22 2012
 (r238182)
 @@ -67,7 +67,6 @@ extern _RuneLocale  *_Read_RuneMagi(FILE 
  
  static int   __setrunelocale(struct xlocale_ctype *l, const char *);
  
 -#define __collate_load_error (table-__collate_load_error)
  #define __collate_substitute_nontrivial 
 (table-__collate_substitute_nontrivial)
  #define __collate_substitute_table_ptr 
 (table-__collate_substitute_table_ptr)
  #define __collate_char_pri_table_ptr (table-__collate_char_pri_table_ptr)


pgpwrBqzeW5hJ.pgp
Description: PGP signature


Re: svn commit: r238182 - head/lib/libc/locale

2012-07-06 Thread Konstantin Belousov
On Sat, Jul 07, 2012 at 12:15:29AM +0300, Konstantin Belousov wrote:
 On Fri, Jul 06, 2012 at 08:16:22PM +, David Chisnall wrote:
  Author: theraven
  Date: Fri Jul  6 20:16:22 2012
  New Revision: 238182
  URL: http://svn.freebsd.org/changeset/base/238182
  
  Log:
Restore the __collate_load_error global that was accidentally removed in 
  the
xlocale refactoring.

 I think this commit is wrong, or at least not complete.
 You failed to restore the actual export of the symbol in locale/Symbol.map.

I stay corrected: the symbol _is_ present in the Symbol.map, sorry. But
it is located in the private version definition, which was the reason
that I did not noticed it, and which changes the status of commit from
incomplete to unneccessary. We do not guarantee anything about
private symbols.

Most likely, it is application error to link to this symbol. If application
use for it is legitimate, then the symbol shall be moved to FBSD_1.3
version.


pgpNiYkSzyWh7.pgp
Description: PGP signature


svn commit: r238183 - head/sys/net

2012-07-06 Thread Ed Maste
Author: emaste
Date: Fri Jul  6 23:17:30 2012
New Revision: 238183
URL: http://svn.freebsd.org/changeset/base/238183

Log:
  Implement SIOCGIFMEDIA for if_tap(4)
  
  Appease certain if_tap(4) consumers by providing simulated Ethernet
  media status.
  
  DragonFly commit 70d9a675bf5441cc854a843ead702d08928c37f3
  
  Obtained from:  DragonFly BSD

Modified:
  head/sys/net/if_tap.c

Modified: head/sys/net/if_tap.c
==
--- head/sys/net/if_tap.c   Fri Jul  6 20:16:22 2012(r238182)
+++ head/sys/net/if_tap.c   Fri Jul  6 23:17:30 2012(r238183)
@@ -65,6 +65,7 @@
 #include net/if.h
 #include net/if_clone.h
 #include net/if_dl.h
+#include net/if_media.h
 #include net/if_types.h
 #include net/route.h
 #include net/vnet.h
@@ -602,7 +603,8 @@ tapifioctl(struct ifnet *ifp, u_long cmd
struct tap_softc*tp = ifp-if_softc;
struct ifreq*ifr = (struct ifreq *)data;
struct ifstat   *ifs = NULL;
-   int  dummy;
+   struct ifmediareq   *ifmr = NULL;
+   int  dummy, error = 0;
 
switch (cmd) {
case SIOCSIFFLAGS: /* XXX -- just like vmnet does */
@@ -610,6 +612,22 @@ tapifioctl(struct ifnet *ifp, u_long cmd
case SIOCDELMULTI:
break;
 
+   case SIOCGIFMEDIA:
+   ifmr = (struct ifmediareq *)data;
+   dummy = ifmr-ifm_count;
+   ifmr-ifm_count = 1;
+   ifmr-ifm_status = IFM_AVALID;
+   ifmr-ifm_active = IFM_ETHER;
+   if (tp-tap_flags  TAP_OPEN)
+   ifmr-ifm_status |= IFM_ACTIVE;
+   ifmr-ifm_current = ifmr-ifm_active;
+   if (dummy = 1) {
+   int media = IFM_ETHER;
+   error = copyout(media, ifmr-ifm_ulist,
+   sizeof(int));
+   }
+   break;
+
case SIOCSIFMTU:
ifp-if_mtu = ifr-ifr_mtu;
break;
@@ -626,11 +644,11 @@ tapifioctl(struct ifnet *ifp, u_long cmd
break;
 
default:
-   return (ether_ioctl(ifp, cmd, data));
-   /* NOT REACHED */
+   error = ether_ioctl(ifp, cmd, data);
+   break;
}
 
-   return (0);
+   return (error);
 } /* tapifioctl */
 
 
___
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: r238184 - in head/sys: conf ia64/ia64 ia64/include

2012-07-06 Thread Marcel Moolenaar
Author: marcel
Date: Sat Jul  7 00:25:17 2012
New Revision: 238184
URL: http://svn.freebsd.org/changeset/base/238184

Log:
  Hide the creation of phys_avail behind an API to make it easier to do it
  correctly. We now iterate the EFI memory descriptors once and collect all
  the information in a single pass. This includes:
  1.  The I/O port base address,
  2.  The PAL memory region. Have the physmem API track this.
  3.  Memory descriptors of memory we can't use, like bad memory, runtime
  services code  data, etc. Have the physmem API track these.
  4.  memory descriptors of memory we can use or re-use, such as free
  memory, boot time services code  data, loader code  data, etc.
  These are added by the physmem API.
  
  Since the PBVM page table and pages are in memory described as loader
  data, inform the physmem API of chunks that need to be delated from the
  available physical memory.
  
  While here, remove Maxmem and replace it with the better named paddr_max.
  Maxmem was defined as physmem, which is generally wrong. Now, paddr_max
  is properly defined as the largesty physical address.
  
  The upshot of all this is that:
  1.  We properly determine realmem.
  2.  We maximize physmem by re-using memory where possible.
  3.  We remove complexity from ia64_init() in machdep.c.
  4.  Remove confusion about realmem, physmem  Maxmem.
  
  The new ia64_physmem_alloc() is to replace pmap_steal_memory() in pmap.c,
  as well as replace the handcrafted allocation of the VHPT for the BSP in
  pmap_bootstrap() in pmap.c. This is step 2 and addresses the manipulation
  of phys_avail after it is being created.

Added:
  head/sys/ia64/ia64/physmem.c   (contents, props changed)
Modified:
  head/sys/conf/files.ia64
  head/sys/ia64/ia64/busdma_machdep.c
  head/sys/ia64/ia64/machdep.c
  head/sys/ia64/include/md_var.h
  head/sys/ia64/include/param.h

Modified: head/sys/conf/files.ia64
==
--- head/sys/conf/files.ia64Fri Jul  6 23:17:30 2012(r238183)
+++ head/sys/conf/files.ia64Sat Jul  7 00:25:17 2012(r238184)
@@ -98,6 +98,7 @@ ia64/ia64/mp_machdep.coptionalsmp
 ia64/ia64/nexus.c  standard
 ia64/ia64/pal.Sstandard
 ia64/ia64/physical.S   standard
+ia64/ia64/physmem.cstandard
 ia64/ia64/pmap.c   standard
 ia64/ia64/ptrace_machdep.c standard
 ia64/ia64/sal.cstandard

Modified: head/sys/ia64/ia64/busdma_machdep.c
==
--- head/sys/ia64/ia64/busdma_machdep.c Fri Jul  6 23:17:30 2012
(r238183)
+++ head/sys/ia64/ia64/busdma_machdep.c Sat Jul  7 00:25:17 2012
(r238184)
@@ -262,7 +262,7 @@ bus_dma_tag_create(bus_dma_tag_t parent,
atomic_add_int(parent-ref_count, 1);
}
 
-   if (newtag-lowaddr  ptoa(Maxmem)  (flags  BUS_DMA_ALLOCNOW) != 0) {
+   if (newtag-lowaddr  paddr_max  (flags  BUS_DMA_ALLOCNOW) != 0) {
/* Must bounce */
 
if (ptoa(total_bpages)  maxsize) {
@@ -340,7 +340,7 @@ bus_dmamap_create(bus_dma_tag_t dmat, in
 * exclusion region, a data alignment that is stricter than 1, and/or
 * an active address boundary.
 */
-   if (dmat-lowaddr  ptoa(Maxmem)) {
+   if (dmat-lowaddr  paddr_max) {
/* Must bounce */
int maxpages;
 
@@ -356,7 +356,7 @@ bus_dmamap_create(bus_dma_tag_t dmat, in
 * Attempt to add pages to our pool on a per-instance
 * basis up to a sane limit.
 */
-   maxpages = MIN(MAX_BPAGES, Maxmem - atop(dmat-lowaddr));
+   maxpages = MIN(MAX_BPAGES, atop(paddr_max - dmat-lowaddr));
if ((dmat-flags  BUS_DMA_MIN_ALLOC_COMP) == 0
 || (dmat-map_count  0  total_bpages  maxpages)) {
int pages;
@@ -438,7 +438,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi
 */
if ((dmat-maxsize = PAGE_SIZE) 
   (dmat-alignment  dmat-maxsize) 
-   dmat-lowaddr = ptoa(Maxmem)) {
+   dmat-lowaddr = paddr_max) {
*vaddr = malloc(dmat-maxsize, M_DEVBUF, mflags);
} else {
/*
@@ -473,7 +473,7 @@ bus_dmamem_free(bus_dma_tag_t dmat, void
panic(bus_dmamem_free: Invalid map freed\n);
if ((dmat-maxsize = PAGE_SIZE) 
   (dmat-alignment  dmat-maxsize) 
-   dmat-lowaddr = ptoa(Maxmem))
+   dmat-lowaddr = paddr_max)
free(vaddr, M_DEVBUF);
else {
contigfree(vaddr, dmat-maxsize, M_DEVBUF);
@@ -506,7 +506,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm
else
pmap = NULL;
 
-   if ((dmat-lowaddr  ptoa(Maxmem) || dmat-boundary  0 ||
+   if ((dmat-lowaddr  paddr_max || dmat-boundary  0 

Re: svn commit: r238172 - head/sys/dev/agp

2012-07-06 Thread Marcel Moolenaar

On Jul 6, 2012, at 11:12 AM, Konstantin Belousov wrote:

  agp_i810.c:
  While arguably the use of Maxmem can be considered correct, replace its use
  with realmem anyway. agp_i810.c is specific to amd64, i386  pc98, which
  have a dense physical memory layout. Avoiding Maxmem here is done with an
  eye on copy-n-paste behaviour in general and to avoid confusion caused by
  using realmem in agp.c and Maxmem in agp_i810.c.
 The agp_i810.c use is to prevent attachment when largest physical address
 of populated memory exceeds GPU limits established by PTE format and
 chipset errata. Editing Maxmem to be spelled as realmem seems to change
 nothing right now, but I do argue that this is wrong, and commit message
 makes future archeology quite confusing.

The commit log states it all, including how one can arguably call the change
wrong. What exactly is confusing?

-- 
Marcel Moolenaar
mar...@xcllnt.net


___
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: r238185 - head/usr.bin/mkesdb

2012-07-06 Thread Tim Kientzle
Author: kientzle
Date: Sat Jul  7 04:14:28 2012
New Revision: 238185
URL: http://svn.freebsd.org/changeset/base/238185

Log:
  Unbreak building WITH_ICONV=yes and new yacc.

Modified:
  head/usr.bin/mkesdb/ldef.h

Modified: head/usr.bin/mkesdb/ldef.h
==
--- head/usr.bin/mkesdb/ldef.h  Sat Jul  7 00:25:17 2012(r238184)
+++ head/usr.bin/mkesdb/ldef.h  Sat Jul  7 04:14:28 2012(r238185)
@@ -30,7 +30,6 @@
 extern int  line_number;
 extern int  yyerror(const char *);
 extern int  yylex(void);
-extern int  yyparse(void);
 
 struct named_csid {
STAILQ_ENTRY(named_csid) ci_entry;
___
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: r238186 - head/sys/boot/arm/at91

2012-07-06 Thread Warner Losh
Author: imp
Date: Sat Jul  7 04:49:53 2012
New Revision: 238186
URL: http://svn.freebsd.org/changeset/base/238186

Log:
  Strip out the useless junk.  All we really care about is the text,
  data and bss sections.  All the rest is needed for normal binaries,
  but boot loaders aren't normal.

Modified:
  head/sys/boot/arm/at91/linker.cfg

Modified: head/sys/boot/arm/at91/linker.cfg
==
--- head/sys/boot/arm/at91/linker.cfg   Sat Jul  7 04:14:28 2012
(r238185)
+++ head/sys/boot/arm/at91/linker.cfg   Sat Jul  7 04:49:53 2012
(r238186)
@@ -31,258 +31,26 @@ SECTIONS
   .text  :
   {
 *(.text)
-*(.text.*)
-*(.stub)
-/* .gnu.warning sections are handled specially by elf32.em.  */
-*(.gnu.warning)
-*(.gnu.linkonce.t.*)
-*(.glue_7t) *(.glue_7)
   }
-  .interp : { *(.interp)   }
-  .hash  : { *(.hash)  }
-  .dynsym: { *(.dynsym)}
-  .dynstr: { *(.dynstr)}
-  .gnu.version   : { *(.gnu.version)   }
-  .gnu.version_d   : { *(.gnu.version_d)   }
-  .gnu.version_r   : { *(.gnu.version_r)   }
-  .rel.init  : { *(.rel.init)  }
-  .rela.init : { *(.rela.init) }
-  .rel.text  :
-{
-  *(.rel.text)
-  *(.rel.text.*)
-  *(.rel.gnu.linkonce.t.*)
-}
-  .rela.text :
-{
-  *(.rela.text)
-  *(.rela.text.*)
-  *(.rela.gnu.linkonce.t.*)
-}
-  .rel.fini  : { *(.rel.fini)  }
-  .rela.fini : { *(.rela.fini) }
-  .rel.rodata:
-{
-  *(.rel.rodata)
-  *(.rel.rodata.*)
-  *(.rel.gnu.linkonce.r.*)
-}
-  .rela.rodata   :
-{
-  *(.rela.rodata)
-  *(.rela.rodata.*)
-  *(.rela.gnu.linkonce.r.*)
-}
-  .rel.data  :
-{
-  *(.rel.data)
-  *(.rel.data.*)
-  *(.rel.gnu.linkonce.d.*)
-}
-  .rela.data :
-{
-  *(.rela.data)
-  *(.rela.data.*)
-  *(.rela.gnu.linkonce.d.*)
-}
-  .rel.ctors : { *(.rel.ctors) }
-  .rela.ctors: { *(.rela.ctors)}
-  .rel.dtors : { *(.rel.dtors) }
-  .rela.dtors: { *(.rela.dtors)}
-  .rel.got   : { *(.rel.got)   }
-  .rela.got  : { *(.rela.got)  }
-  .rel.sdata :
-{
-  *(.rel.sdata)
-  *(.rel.sdata.*)
-  *(.rel.gnu.linkonce.s.*)
-}
-  .rela.sdata :
-{
-  *(.rela.sdata)
-  *(.rela.sdata.*)
-  *(.rela.gnu.linkonce.s.*)
-}
-  .rel.sbss  :
-{ 
-  *(.rel.sbss)
-  *(.rel.sbss.*)
-  *(.rel.gnu.linkonce.sb.*)
-}
-  .rela.sbss :
-{
-  *(.rela.sbss)
-  *(.rela.sbss.*)
-  *(.rel.gnu.linkonce.sb.*)
-}
-  .rel.sdata2: 
-{ 
-  *(.rel.sdata2)
-  *(.rel.sdata2.*)
-  *(.rel.gnu.linkonce.s2.*)
-}
-  .rela.sdata2   : 
-{
-  *(.rela.sdata2)
-  *(.rela.sdata2.*)
-  *(.rela.gnu.linkonce.s2.*)
-}
-  .rel.sbss2 : 
-{ 
-  *(.rel.sbss2)
-  *(.rel.sbss2.*)
-  *(.rel.gnu.linkonce.sb2.*)
-}
-  .rela.sbss2: 
-{ 
-  *(.rela.sbss2)   
-  *(.rela.sbss2.*)
-  *(.rela.gnu.linkonce.sb2.*)
-}
-  .rel.bss   : 
-{ 
-  *(.rel.bss)
-  *(.rel.bss.*)
-  *(.rel.gnu.linkonce.b.*)
-}
-  .rela.bss  : 
-{ 
-  *(.rela.bss)
-  *(.rela.bss.*)
-  *(.rela.gnu.linkonce.b.*)
-}
-  .rel.plt   : { *(.rel.plt)   }
-  .rela.plt  : { *(.rela.plt)  }
-  .init  : 
-  { 
-KEEP (*(.init))
-  } =0
-  .plt  : { *(.plt)}
-  .fini  :
-  {
-KEEP (*(.fini))
-  } =0
   PROVIDE (__etext = .);
   PROVIDE (_etext = .);
   PROVIDE (etext = .);
-  .rodata   : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) }
-  .rodata1   : { *(.rodata1) }
-  .sdata2   : { *(.sdata2) *(.sdata2.*) *(.gnu.linkonce.s2.*) }
-  .sbss2   : { *(.sbss2) *(.sbss2.*) *(.gnu.linkonce.sb2.*) }
   .data:
   {
 __data_start = . ;
 *(.data)
-*(.data.*)
-*(.gnu.linkonce.d.*)
-SORT(CONSTRUCTORS)
-  }
-  .data1   : { *(.data1) }
-  . = 0x2120;
-  .eh_frame : { KEEP (*(.eh_frame)) }
-  .gcc_except_table : { *(.gcc_except_table) }
-  .ctors   : 
-  {
-/* gcc uses crtbegin.o to find the start of
-   the constructors, so we make sure it is
-   first.  Because this is a wildcard, it
-   doesn't matter if the user does not
-   actually link against crtbegin.o; the
-   linker won't look for a file to match a
-   wildcard.  The wildcard also means that it
-   doesn't matter which directory crtbegin.o
-   is in.  */
-KEEP (*crtbegin.o(.ctors))
-/* We don't want to include the .ctor section from
-   from the crtend.o file until after the sorted ctors.
-   The .ctor section from the crtend file contains the
-   end of ctors marker and it must be last */
-KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
-KEEP (*(SORT(.ctors.*)))
-KEEP 

svn commit: r238188 - head/sys/boot/arm/at91/boot0spi

2012-07-06 Thread Warner Losh
Author: imp
Date: Sat Jul  7 04:55:42 2012
New Revision: 238188
URL: http://svn.freebsd.org/changeset/base/238188

Log:
  Generalize this for loading the loader into the SPI. Plus trim about
  100 bytes from the binary with silly tricks.  Hope to get this small
  enough to run on the models that have 4k SRAM.  We are close compiled
  for the at91rm9200, but still need to trim for the target.

Modified:
  head/sys/boot/arm/at91/boot0spi/main.c

Modified: head/sys/boot/arm/at91/boot0spi/main.c
==
--- head/sys/boot/arm/at91/boot0spi/main.c  Sat Jul  7 04:51:59 2012
(r238187)
+++ head/sys/boot/arm/at91/boot0spi/main.c  Sat Jul  7 04:55:42 2012
(r238188)
@@ -29,31 +29,26 @@
 #include at91rm9200_lowlevel.h
 #include spi_flash.h
 
-#define LOADER_OFFSET 0
-#define FPGA_OFFSET  (15 * FLASH_PAGE_SIZE)
-#define OFFSET FPGA_OFFSET
+#define OFFSET 0
 
-int
+void
 main(void)
 {
int len, i, j, off, sec;
char *addr = (char *)SDRAM_BASE + (1  20); /* download at + 1MB */
char *addr2 = (char *)SDRAM_BASE + (2  20); /* readback to + 2MB */
-   char *addr3 = (char *)SDRAM_BASE + (3  20); /* extra copy at + 3MB */
 
SPI_InitFlash();
printf(Waiting for data\n);
while ((len = xmodem_rx(addr)) == -1)
continue;
-   // Need extra copy at addr3
-   memcpy(addr3, addr, (len + FLASH_PAGE_SIZE - 1) / FLASH_PAGE_SIZE * 
FLASH_PAGE_SIZE);
-   printf(Writing %u bytes to flash at %u\n, len, OFFSET);
+   printf(Writing %u bytes at %u\n, len, OFFSET);
for (i = 0; i  len; i+= FLASH_PAGE_SIZE) {
+   off = i + OFFSET;
for (j = 0; j  10; j++) {
-   off = i + OFFSET;
SPI_WriteFlash(off, addr + i, FLASH_PAGE_SIZE);
SPI_ReadFlash(off, addr2 + i, FLASH_PAGE_SIZE);
-   if (p_memcmp(addr3 + i, addr2 + i, FLASH_PAGE_SIZE) == 
0)
+   if (p_memcmp(addr + i, addr2 + i, FLASH_PAGE_SIZE) == 0)
break;
}
if (j = 10)
@@ -64,5 +59,4 @@ main(void)
continue;
printf(Done\n);
reset();
-   return (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: r238190 - in head/sys/ia64: ia64 include

2012-07-06 Thread Marcel Moolenaar
Author: marcel
Date: Sat Jul  7 05:17:43 2012
New Revision: 238190
URL: http://svn.freebsd.org/changeset/base/238190

Log:
  Implement ia64_physmem_alloc() and use it consistently to get memory
  before VM has been initialized. This includes:
  1.  Replacing pmap_steal_memory(),
  2.  Replace the handcrafted logic to allocate a naturally aligned VHPT,
  3.  Properly allocate the DPCPU for the BSP.
  
  Ad 3: Appending the DPCPU to kernend worked as long as we wouldn't
cross into the next PBVM page. If we were to cross into the next
page, then there wouldn't be a PTE entry on the page table for it
and we would end up with a MCA following a page fault. As such,
this commit fixes MCAs occasionally seen.

Modified:
  head/sys/ia64/ia64/machdep.c
  head/sys/ia64/ia64/physmem.c
  head/sys/ia64/ia64/pmap.c
  head/sys/ia64/include/md_var.h

Modified: head/sys/ia64/ia64/machdep.c
==
--- head/sys/ia64/ia64/machdep.cSat Jul  7 05:02:39 2012
(r238189)
+++ head/sys/ia64/ia64/machdep.cSat Jul  7 05:17:43 2012
(r238190)
@@ -675,7 +675,6 @@ ia64_init(void)
struct efi_md *md;
pt_entry_t *pbvm_pgtbl_ent, *pbvm_pgtbl_lim;
char *p;
-   vm_offset_t kernend;
vm_size_t mdlen;
int metadata_missing;
 
@@ -773,20 +772,6 @@ ia64_init(void)
bootverbose = 1;
 
/*
-* Find the end of the kernel.
-*/
-#ifdef DDB
-   ksym_start = bootinfo-bi_symtab;
-   ksym_end = bootinfo-bi_esymtab;
-   kernend = (vm_offset_t)round_page(ksym_end);
-#else
-   kernend = (vm_offset_t)round_page(_end);
-#endif
-   /* But if the bootstrap tells us otherwise, believe it! */
-   if (bootinfo-bi_kernend)
-   kernend = round_page(bootinfo-bi_kernend);
-
-   /*
 * Wire things up so we can call the firmware.
 */
map_pal_code();
@@ -805,9 +790,8 @@ ia64_init(void)
pcpup = pcpu0;
ia64_set_k4((u_int64_t)pcpup);
pcpu_init(pcpup, 0, sizeof(pcpu0));
-   dpcpu_init((void *)kernend, 0);
+   dpcpu_init(ia64_physmem_alloc(DPCPU_SIZE, PAGE_SIZE), 0);
PCPU_SET(md.lid, ia64_get_lid());
-   kernend += DPCPU_SIZE;
PCPU_SET(curthread, thread0);
 
/*
@@ -838,14 +822,15 @@ ia64_init(void)
/*
 * Initialize error message buffer (at end of core).
 */
-   msgbufp = (struct msgbuf *)pmap_steal_memory(msgbufsize);
+   msgbufp = ia64_physmem_alloc(msgbufsize, PAGE_SIZE);
msgbufinit(msgbufp, msgbufsize);
 
proc_linkup0(proc0, thread0);
/*
 * Init mapping for kernel stack for proc 0
 */
-   thread0.td_kstack = pmap_steal_memory(KSTACK_PAGES * PAGE_SIZE);
+   p = ia64_physmem_alloc(KSTACK_PAGES * PAGE_SIZE, PAGE_SIZE);
+   thread0.td_kstack = (uintptr_t)p;
thread0.td_kstack_pages = KSTACK_PAGES;
 
mutex_init();
@@ -871,6 +856,11 @@ ia64_init(void)
/*
 * Initialize debuggers, and break into them if appropriate.
 */
+#ifdef DDB
+   ksym_start = bootinfo-bi_symtab;
+   ksym_end = bootinfo-bi_esymtab;
+#endif
+
kdb_init();
 
 #ifdef KDB

Modified: head/sys/ia64/ia64/physmem.c
==
--- head/sys/ia64/ia64/physmem.cSat Jul  7 05:02:39 2012
(r238189)
+++ head/sys/ia64/ia64/physmem.cSat Jul  7 05:17:43 2012
(r238190)
@@ -187,9 +187,72 @@ ia64_physmem_track(vm_paddr_t base, vm_s
return (0);
 }
 
-vm_paddr_t
+void *
 ia64_physmem_alloc(vm_size_t len, vm_size_t align)
 {
+   vm_paddr_t base, lim, pa;
+   void *ptr;
+   u_int idx;
 
-   return (0);
+   if (phys_avail_segs == 0)
+   return (NULL);
+
+   len = round_page(len);
+
+   /*
+* Try and allocate with least effort.
+*/
+   idx = phys_avail_segs * 2;
+   while (idx  0) {
+   idx -= 2;
+   base = phys_avail[idx];
+   lim = phys_avail[idx + 1];
+
+   if (lim - base  len)
+   continue;
+
+   /* First try from the end. */
+   pa = lim - len;
+   if ((pa  (align - 1)) == 0) {
+   if (pa == base)
+   ia64_physmem_remove(idx);
+   else
+   phys_avail[idx + 1] = pa;
+   goto gotit;
+   }
+
+   /* Try from the start next. */
+   pa = base;
+   if ((pa  (align - 1)) == 0) {
+   if (pa + len == lim)
+   ia64_physmem_remove(idx);
+   else
+   phys_avail[idx] += len;
+   goto gotit;
+   }
+   }
+
+   /*
+