Date: Sat, 7 Jul 2012 05:25:23 +0000 (UTC) From: Marcel Moolenaar <marcel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r238191 - in projects/altix2: . cddl/compat/opensolaris/misc cddl/contrib/dtracetoolkit cddl/contrib/opensolaris/lib/libdtrace/common contrib/binutils/gas/config contrib/binutils/opcode... Message-ID: <201207070525.q675PNwx016533@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marcel Date: Sat Jul 7 05:25:22 2012 New Revision: 238191 URL: http://svn.freebsd.org/changeset/base/238191 Log: Merge3 ^/head@238190 Added: projects/altix2/sys/arm/include/board.h - copied unchanged from r238190, head/sys/arm/include/board.h projects/altix2/sys/dev/ath/if_ath_rx_edma.c - copied unchanged from r238190, head/sys/dev/ath/if_ath_rx_edma.c projects/altix2/sys/dev/ath/if_ath_rx_edma.h - copied unchanged from r238190, head/sys/dev/ath/if_ath_rx_edma.h projects/altix2/sys/dev/e1000/e1000_i210.c - copied unchanged from r238190, head/sys/dev/e1000/e1000_i210.c projects/altix2/sys/dev/e1000/e1000_i210.h - copied unchanged from r238190, head/sys/dev/e1000/e1000_i210.h projects/altix2/sys/ia64/ia64/physmem.c - copied unchanged from r238190, head/sys/ia64/ia64/physmem.c projects/altix2/tools/regression/usr.bin/make/syntax/funny-targets/ - copied from r238190, head/tools/regression/usr.bin/make/syntax/funny-targets/ Modified: projects/altix2/Makefile projects/altix2/Makefile.inc1 projects/altix2/cddl/compat/opensolaris/misc/deviceid.c projects/altix2/cddl/contrib/dtracetoolkit/dtruss projects/altix2/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c projects/altix2/contrib/binutils/gas/config/tc-i386.c projects/altix2/contrib/binutils/opcodes/i386-dis.c projects/altix2/contrib/binutils/opcodes/i386-opc.h projects/altix2/contrib/binutils/opcodes/i386-opc.tbl projects/altix2/contrib/binutils/opcodes/i386-tbl.h projects/altix2/etc/rc.d/jail projects/altix2/include/printf.h projects/altix2/lib/libc/gen/arc4random.c projects/altix2/lib/libc/gen/directory.3 projects/altix2/lib/libc/locale/collate.c projects/altix2/lib/libc/locale/setrunelocale.c projects/altix2/lib/libc/stdio/xprintf.c projects/altix2/lib/libedit/chared.c projects/altix2/lib/libedit/chared.h projects/altix2/lib/libedit/editline.3 projects/altix2/lib/libedit/el.h projects/altix2/lib/libedit/read.c projects/altix2/lib/libedit/sig.c projects/altix2/lib/libedit/sig.h projects/altix2/sbin/geom/class/eli/geli.8 projects/altix2/sbin/hastd/primary.c projects/altix2/sbin/ipfw/ipfw.8 projects/altix2/share/man/man9/rtalloc.9 projects/altix2/share/misc/committers-doc.dot projects/altix2/share/misc/committers-ports.dot projects/altix2/sys/amd64/amd64/cpu_switch.S projects/altix2/sys/amd64/amd64/db_disasm.c projects/altix2/sys/amd64/amd64/fpu.c projects/altix2/sys/amd64/amd64/pmap.c projects/altix2/sys/amd64/include/cpufunc.h projects/altix2/sys/arm/at91/at91_machdep.c projects/altix2/sys/arm/at91/at91board.h projects/altix2/sys/arm/at91/board_bwct.c projects/altix2/sys/arm/at91/board_ethernut5.c projects/altix2/sys/arm/at91/board_hl200.c projects/altix2/sys/arm/at91/board_hl201.c projects/altix2/sys/arm/at91/board_kb920x.c projects/altix2/sys/arm/at91/board_qila9g20.c projects/altix2/sys/arm/at91/board_sam9g20ek.c projects/altix2/sys/arm/at91/board_sam9x25ek.c projects/altix2/sys/arm/at91/board_tsc4370.c projects/altix2/sys/arm/conf/ATMEL projects/altix2/sys/arm/mv/mv_machdep.c projects/altix2/sys/boot/arm/at91/boot0spi/main.c projects/altix2/sys/boot/arm/at91/libat91/Makefile projects/altix2/sys/boot/arm/at91/linker.cfg projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h projects/altix2/sys/cddl/dev/dtrace/amd64/dis_tables.c projects/altix2/sys/cddl/dev/dtrace/i386/dis_tables.c projects/altix2/sys/conf/files projects/altix2/sys/conf/files.ia64 projects/altix2/sys/conf/kern.post.mk projects/altix2/sys/conf/kmod.mk projects/altix2/sys/conf/options.arm projects/altix2/sys/dev/agp/agp.c projects/altix2/sys/dev/agp/agp_i810.c projects/altix2/sys/dev/ath/if_ath.c projects/altix2/sys/dev/ath/if_ath_rx.c projects/altix2/sys/dev/ath/if_ath_rx.h projects/altix2/sys/dev/ath/if_athvar.h projects/altix2/sys/dev/atkbdc/atkbdc_isa.c projects/altix2/sys/dev/cxgbe/t4_main.c projects/altix2/sys/dev/e1000/e1000_82541.c projects/altix2/sys/dev/e1000/e1000_82543.c projects/altix2/sys/dev/e1000/e1000_82571.c projects/altix2/sys/dev/e1000/e1000_82575.c projects/altix2/sys/dev/e1000/e1000_api.c projects/altix2/sys/dev/e1000/e1000_api.h projects/altix2/sys/dev/e1000/e1000_defines.h projects/altix2/sys/dev/e1000/e1000_hw.h projects/altix2/sys/dev/e1000/e1000_ich8lan.c projects/altix2/sys/dev/e1000/e1000_mac.c projects/altix2/sys/dev/e1000/e1000_mac.h projects/altix2/sys/dev/e1000/e1000_manage.c projects/altix2/sys/dev/e1000/e1000_manage.h projects/altix2/sys/dev/e1000/e1000_phy.c projects/altix2/sys/dev/e1000/e1000_phy.h projects/altix2/sys/dev/e1000/e1000_regs.h projects/altix2/sys/dev/e1000/if_em.c projects/altix2/sys/dev/e1000/if_igb.c projects/altix2/sys/dev/ixgbe/ixgbe.c projects/altix2/sys/dev/ixgbe/ixgbe_82598.c projects/altix2/sys/dev/ixgbe/ixgbe_82598.h projects/altix2/sys/dev/ixgbe/ixgbe_82599.c projects/altix2/sys/dev/ixgbe/ixgbe_api.c projects/altix2/sys/dev/ixgbe/ixgbe_api.h projects/altix2/sys/dev/ixgbe/ixgbe_common.c projects/altix2/sys/dev/ixgbe/ixgbe_common.h projects/altix2/sys/dev/ixgbe/ixgbe_osdep.h projects/altix2/sys/dev/ixgbe/ixgbe_phy.c projects/altix2/sys/dev/ixgbe/ixgbe_type.h projects/altix2/sys/dev/ixgbe/ixgbe_vf.c projects/altix2/sys/dev/ixgbe/ixgbe_x540.c projects/altix2/sys/dev/ixgbe/ixv.c projects/altix2/sys/dev/mfi/mfi.c projects/altix2/sys/dev/usb/quirk/usb_quirk.c projects/altix2/sys/dev/usb/serial/u3g.c projects/altix2/sys/dev/usb/usbdevs projects/altix2/sys/dev/virtio/balloon/virtio_balloon.h projects/altix2/sys/dev/virtio/block/virtio_blk.h projects/altix2/sys/dev/virtio/network/virtio_net.h projects/altix2/sys/dev/virtio/virtio.h projects/altix2/sys/dev/virtio/virtio_ring.h projects/altix2/sys/dev/virtio/virtqueue.h projects/altix2/sys/fs/ext2fs/ext2_vfsops.c projects/altix2/sys/geom/eli/g_eli.c projects/altix2/sys/geom/eli/g_eli.h projects/altix2/sys/geom/eli/g_eli_ctl.c projects/altix2/sys/geom/eli/g_eli_key.c projects/altix2/sys/geom/eli/g_eli_key_cache.c projects/altix2/sys/geom/gate/g_gate.c projects/altix2/sys/geom/gate/g_gate.h projects/altix2/sys/geom/geom_dev.c projects/altix2/sys/ia64/ia64/busdma_machdep.c projects/altix2/sys/ia64/ia64/machdep.c projects/altix2/sys/ia64/ia64/pmap.c projects/altix2/sys/ia64/include/md_var.h projects/altix2/sys/ia64/include/param.h projects/altix2/sys/kern/uipc_socket.c projects/altix2/sys/modules/ath/Makefile projects/altix2/sys/modules/em/Makefile projects/altix2/sys/modules/igb/Makefile projects/altix2/sys/net/flowtable.c projects/altix2/sys/net/if_tap.c projects/altix2/sys/net/route.h projects/altix2/sys/netinet/igmp.c projects/altix2/sys/netinet/ip_input.c projects/altix2/sys/netinet/ip_output.c projects/altix2/sys/netinet/ipfw/ip_dummynet.c projects/altix2/sys/netinet/sctp_input.c projects/altix2/sys/netinet/sctp_output.c projects/altix2/sys/netinet/tcp_hostcache.c projects/altix2/sys/netinet6/ip6_output.c projects/altix2/sys/netinet6/nd6_nbr.c projects/altix2/sys/powerpc/aim/mmu_oea.c projects/altix2/sys/vm/vm_pageout.c projects/altix2/tools/build/make_check/Makefile projects/altix2/tools/regression/pjdfstest/pjdfstest.c projects/altix2/tools/tools/netmap/pkt-gen.c projects/altix2/usr.bin/calendar/calendars/calendar.freebsd projects/altix2/usr.bin/mkesdb/ldef.h projects/altix2/usr.bin/procstat/procstat_rlimit.c projects/altix2/usr.bin/sort/file.c projects/altix2/usr.bin/sort/file.h projects/altix2/usr.bin/sort/radixsort.c projects/altix2/usr.bin/sort/sort.1.in projects/altix2/usr.bin/sort/sort.c projects/altix2/usr.sbin/nscd/cachelib.c projects/altix2/usr.sbin/nscd/cachelib.h projects/altix2/usr.sbin/nscd/config.c projects/altix2/usr.sbin/nscd/config.h projects/altix2/usr.sbin/nscd/nscd.conf.5 projects/altix2/usr.sbin/nscd/parser.c Directory Properties: projects/altix2/ (props changed) projects/altix2/cddl/contrib/opensolaris/ (props changed) projects/altix2/contrib/binutils/ (props changed) projects/altix2/lib/libc/ (props changed) projects/altix2/sbin/ (props changed) projects/altix2/sbin/ipfw/ (props changed) projects/altix2/sys/ (props changed) projects/altix2/sys/boot/ (props changed) projects/altix2/sys/cddl/contrib/opensolaris/ (props changed) projects/altix2/sys/conf/ (props changed) projects/altix2/usr.bin/calendar/ (props changed) projects/altix2/usr.bin/procstat/ (props changed) Modified: projects/altix2/Makefile ============================================================================== --- projects/altix2/Makefile Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/Makefile Sat Jul 7 05:25:22 2012 (r238191) @@ -92,7 +92,7 @@ TGTS= all all-man buildenv buildenvvars delete-old delete-old-dirs delete-old-files delete-old-libs \ depend distribute distributekernel distributekernel.debug \ distributeworld distrib-dirs distribution doxygen \ - everything hierarchy install installcheck installkernel \ + everything hier hierarchy install installcheck installkernel \ installkernel.debug packagekernel packageworld \ reinstallkernel reinstallkernel.debug \ installworld kernel-toolchain libraries lint maninstall \ Modified: projects/altix2/Makefile.inc1 ============================================================================== --- projects/altix2/Makefile.inc1 Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/Makefile.inc1 Sat Jul 7 05:25:22 2012 (r238191) @@ -1197,7 +1197,7 @@ cross-tools: # # hierarchy - ensure that all the needed directories are present # -hierarchy: +hierarchy hier: cd ${.CURDIR}/etc; ${MAKE} distrib-dirs # Modified: projects/altix2/cddl/compat/opensolaris/misc/deviceid.c ============================================================================== --- projects/altix2/cddl/compat/opensolaris/misc/deviceid.c Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/cddl/compat/opensolaris/misc/deviceid.c Sat Jul 7 05:25:22 2012 (r238191) @@ -45,7 +45,7 @@ devid_str_decode(char *devidstr, ddi_dev return (EINVAL); } *retminor_name = strdup(""); - if (*retminor_name == NULL); + if (*retminor_name == NULL) return (ENOMEM); return (0); } Modified: projects/altix2/cddl/contrib/dtracetoolkit/dtruss ============================================================================== --- projects/altix2/cddl/contrib/dtracetoolkit/dtruss Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/cddl/contrib/dtracetoolkit/dtruss Sat Jul 7 05:25:22 2012 (r238191) @@ -240,7 +240,7 @@ syscall:::entry */ /* print 3 args, return as hex */ -syscall::lwp_sigmask:return +syscall::sigprocmask:return /self->start/ { /* calculate elapsed time */ @@ -268,10 +268,11 @@ syscall::lwp_sigmask:return } /* print 3 args, arg0 as a string */ +syscall::access*:return, syscall::stat*:return, syscall::lstat*:return, -syscall::open*:return, -syscall::resolvepath:return +syscall::readlink*:return, +syscall::open*:return /self->start/ { /* calculate elapsed time */ @@ -329,7 +330,6 @@ syscall::*read*:return } /* print 0 arg output */ -syscall::gtime:return, syscall::*fork*:return /self->start/ { @@ -357,9 +357,6 @@ syscall::*fork*:return } /* print 1 arg output */ -syscall::brk:return, -syscall::times:return, -syscall::stime:return, syscall::close:return /self->start/ { @@ -387,7 +384,7 @@ syscall::close:return } /* print 2 arg output */ -syscall::utime:return, +syscall::utimes:return, syscall::munmap:return /self->start/ { Modified: projects/altix2/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c ============================================================================== --- projects/altix2/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c Sat Jul 7 05:25:22 2012 (r238191) @@ -796,7 +796,7 @@ dt_print_llquantize(dtrace_hdl_t *dtp, F return (0); assert(last_bin == bin); - (void) snprintf(c, sizeof (c), ">= %lld", value); + (void) snprintf(c, sizeof (c), ">= %lld", (long long)value); if (dt_printf(dtp, fp, "%16s ", c) < 0) return (-1); Modified: projects/altix2/contrib/binutils/gas/config/tc-i386.c ============================================================================== --- projects/altix2/contrib/binutils/gas/config/tc-i386.c Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/contrib/binutils/gas/config/tc-i386.c Sat Jul 7 05:25:22 2012 (r238191) @@ -517,7 +517,9 @@ static const arch_entry cpu_arch[] = {".sse4a", PROCESSOR_UNKNOWN, CpuMMX|CpuMMX2|CpuSSE|CpuSSE2|CpuSSE3|CpuSSE4a}, {".abm", PROCESSOR_UNKNOWN, - CpuABM} + CpuABM}, + {".xsave", PROCESSOR_UNKNOWN, + CpuXSAVE} }; const pseudo_typeS md_pseudo_table[] = @@ -3988,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 & 0xff000000) + { + prefix = (i.tm.base_opcode >> 24) & 0xff; + add_prefix (prefix); + } + } else if ((i.tm.base_opcode & 0xff0000) != 0) { prefix = (i.tm.base_opcode >> 16) & 0xff; @@ -4027,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: projects/altix2/contrib/binutils/opcodes/i386-dis.c ============================================================================== --- projects/altix2/contrib/binutils/opcodes/i386-dis.c Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/contrib/binutils/opcodes/i386-dis.c Sat Jul 7 05:25:22 2012 (r238191) @@ -93,6 +93,7 @@ static void OP_3DNowSuffix (int, int); static void OP_SIMD_Suffix (int, int); static void SIMD_Fixup (int, int); static void PNI_Fixup (int, int); +static void XCR_Fixup (int, int); static void SVME_Fixup (int, int); static void INVLPG_Fixup (int, int); static void BadOp (void); @@ -212,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 } @@ -539,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 } } @@ -1693,7 +1697,7 @@ static const struct dis386 grps[][8] = { { { "sgdt{Q|IQ||}", { { VMX_Fixup, 0 } } }, { "sidt{Q|IQ||}", { { PNI_Fixup, 0 } } }, - { "lgdt{Q|Q||}", { M } }, + { "lgdt{Q|Q||}", { { XCR_Fixup, 0 } } }, { "lidt{Q|Q||}", { { SVME_Fixup, 0 } } }, { "smswD", { Sv } }, { "(bad)", { XX } }, @@ -1783,9 +1787,9 @@ static const struct dis386 grps[][8] = { { "fxrstor", { Ev } }, { "ldmxcsr", { Ev } }, { "stmxcsr", { Ev } }, - { "(bad)", { XX } }, - { "lfence", { { OP_0fae, 0 } } }, - { "mfence", { { OP_0fae, 0 } } }, + { "xsave", { Ev } }, + { "xrstor", { { OP_0fae, v_mode } } }, + { "xsaveopt", { { OP_0fae, v_mode } } }, { "clflush", { { OP_0fae, 0 } } }, }, /* GRP16 */ @@ -2585,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] = { @@ -2754,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 } }, @@ -5883,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); @@ -5905,17 +5925,17 @@ OP_0fae (int bytemode, int sizeflag) { if (modrm.reg == 7) strcpy (obuf + strlen (obuf) - sizeof ("clflush") + 1, "sfence"); + else if (modrm.reg == 6) + strcpy (obuf + strlen (obuf) - sizeof ("xsaveopt") + 1, "mfence"); + else if (modrm.reg == 5) + strcpy (obuf + strlen (obuf) - sizeof ("xrstor") + 1, "lfence"); if (modrm.reg < 5 || modrm.rm != 0) { BadOp (); /* bad sfence, mfence, or lfence */ return; } - } - else if (modrm.reg != 7) - { - BadOp (); /* bad clflush */ - return; + bytemode = 0; } OP_E (bytemode, sizeflag); @@ -6170,6 +6190,43 @@ PNI_Fixup (int extrachar ATTRIBUTE_UNUSE } static void +XCR_Fixup (int extrachar ATTRIBUTE_UNUSED, int sizeflag) +{ + if (modrm.mod == 3 && modrm.reg == 2 && modrm.rm <= 1) + { + /* Override "lgdt". */ + size_t olen = strlen (obuf); + char *p = obuf + olen - 4; + + /* We might have a suffix when disassembling with -Msuffix. */ + if (*p == 'i') + --p; + + /* Remove "addr16/addr32" if we aren't in Intel mode. */ + if (!intel_syntax + && (prefixes & PREFIX_ADDR) + && olen >= (4 + 7) + && *(p - 1) == ' ' + && CONST_STRNEQ (p - 7, "addr") + && (CONST_STRNEQ (p - 3, "16") + || CONST_STRNEQ (p - 3, "32"))) + p -= 7; + + if (modrm.rm) + { + strcpy (p, "xsetbv"); + } + else + { + strcpy (p, "xgetbv"); + } + + codep++; + } + else + OP_M (0, sizeflag); +} +static void SVME_Fixup (int bytemode, int sizeflag) { const char *alt; Modified: projects/altix2/contrib/binutils/opcodes/i386-opc.h ============================================================================== --- projects/altix2/contrib/binutils/opcodes/i386-opc.h Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/contrib/binutils/opcodes/i386-opc.h Sat Jul 7 05:25:22 2012 (r238191) @@ -71,6 +71,7 @@ typedef struct template #define CpuABM 0x200000 /* ABM New Instructions required */ #define CpuSSE4_1 0x400000 /* SSE4.1 Instructions required */ #define CpuSSE4_2 0x800000 /* SSE4.2 Instructions required */ +#define CpuXSAVE 0x1000000 /* XSAVE Instructions required */ /* SSE4.1/4.2 Instructions required */ #define CpuSSE4 (CpuSSE4_1|CpuSSE4_2) @@ -83,7 +84,7 @@ typedef struct template #define CpuUnknownFlags (Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686 \ |CpuP4|CpuSledgehammer|CpuMMX|CpuMMX2|CpuSSE|CpuSSE2|CpuSSE3|CpuVMX \ |Cpu3dnow|Cpu3dnowA|CpuK6|CpuPadLock|CpuSVME|CpuSSSE3|CpuSSE4_1 \ - |CpuSSE4_2|CpuABM|CpuSSE4a) + |CpuSSE4_2|CpuABM|CpuSSE4a|CpuXSAVE) /* the bits in opcode_modifier are used to generate the final opcode from the base_opcode. These bits also are used to detect alternate forms of Modified: projects/altix2/contrib/binutils/opcodes/i386-opc.tbl ============================================================================== --- projects/altix2/contrib/binutils/opcodes/i386-opc.tbl Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/contrib/binutils/opcodes/i386-opc.tbl Sat Jul 7 05:25:22 2012 (r238191) @@ -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, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_xSuf|NoRex64, { BaseIndex|Disp8|Disp16|Disp32|Disp32S, Reg32 } +invvpid, 2, 0x660f3881, None, CpuVMX|Cpu64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_xSuf|NoRex64, { BaseIndex|Disp8|Disp16|Disp32|Disp32S, Reg64 } vmcall, 0, 0xf01, 0xc1, CpuVMX, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|ImmExt, { 0 } vmclear, 1, 0x660fc7, 0x6, CpuVMX, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|NoRex64, { BaseIndex|Disp8|Disp16|Disp32|Disp32S } vmlaunch, 0, 0xf01, 0xc2, CpuVMX, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|ImmExt, { 0 } @@ -1487,3 +1491,10 @@ xcryptcfb, 0, 0xf30fa7, 0xe0, Cpu686|Cpu xcryptofb, 0, 0xf30fa7, 0xe8, Cpu686|CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|IsString|ImmExt, { 0 } // Alias for xstore-rng. xstore, 0, 0xfa7, 0xc0, Cpu686|CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|IsString|ImmExt, { 0 } + +// XSAVE/XRSTOR related instructions +xgetbv, 0, 0xf01, 0xd0, CpuXSAVE, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|ImmExt, { 0 } +xsetbv, 0, 0xf01, 0xd1, CpuXSAVE, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|ImmExt, { 0 } +xsave, 1, 0xfae, 0x4, CpuXSAVE, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_xSuf, { BaseIndex|Disp8|Disp16|Disp32|Disp32S } +xsaveopt, 1, 0xfae, 0x6, CpuXSAVE, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_xSuf, { BaseIndex|Disp8|Disp16|Disp32|Disp32S } +xrstor, 1, 0xfae, 0x5, CpuXSAVE, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_xSuf, { BaseIndex|Disp8|Disp16|Disp32|Disp32S } Modified: projects/altix2/contrib/binutils/opcodes/i386-tbl.h ============================================================================== --- projects/altix2/contrib/binutils/opcodes/i386-tbl.h Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/contrib/binutils/opcodes/i386-tbl.h Sat Jul 7 05:25:22 2012 (r238191) @@ -3625,6 +3625,22 @@ const template i386_optab[] = No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|ImmExt|NoRex64, { Reg64, Reg64 } }, + { "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, + Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_xSuf|NoRex64, + { BaseIndex|Disp8|Disp16|Disp32|Disp32S, + Reg32 } }, + { "invvpid", 2, 0x660f3881, None, CpuVMX|Cpu64, + Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_xSuf|NoRex64, + { BaseIndex|Disp8|Disp16|Disp32|Disp32S, + Reg64 } }, { "vmcall", 0, 0xf01, 0xc1, CpuVMX, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|ImmExt, { 0 } }, @@ -4288,6 +4304,21 @@ const template i386_optab[] = { "xstore", 0, 0xfa7, 0xc0, Cpu686|CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|IsString|ImmExt, { 0 } }, + { "xgetbv", 0, 0xf01, 0xd0, CpuXSAVE, + No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|ImmExt, + { 0 } }, + { "xsetbv", 0, 0xf01, 0xd1, CpuXSAVE, + No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|ImmExt, + { 0 } }, + { "xsave", 1, 0xfae, 0x4, CpuXSAVE, + Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_xSuf, + { BaseIndex|Disp8|Disp16|Disp32|Disp32S } }, + { "xsaveopt", 1, 0xfae, 0x6, CpuXSAVE, + Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_xSuf, + { BaseIndex|Disp8|Disp16|Disp32|Disp32S } }, + { "xrstor", 1, 0xfae, 0x5, CpuXSAVE, + Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_xSuf, + { BaseIndex|Disp8|Disp16|Disp32|Disp32S } }, { NULL, 0, 0, 0, 0, 0, { 0 } } }; Modified: projects/altix2/etc/rc.d/jail ============================================================================== --- projects/altix2/etc/rc.d/jail Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/etc/rc.d/jail Sat Jul 7 05:25:22 2012 (r238191) @@ -641,7 +641,7 @@ jail_start() i=$((i + 1)) done - eval ${_setfib} jail ${_flags} -i ${_rootdir} ${_hostname} \ + eval ${_setfib} jail ${_flags} -n ${_jail} -i ${_rootdir} ${_hostname} \ \"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1 \ </dev/null Modified: projects/altix2/include/printf.h ============================================================================== --- projects/altix2/include/printf.h Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/include/printf.h Sat Jul 7 05:25:22 2012 (r238191) @@ -123,7 +123,7 @@ int register_printf_function(int spec, p /* FreeBSD */ int register_printf_render(int spec, printf_render *render, printf_arginfo_function *arginfo); -int register_printf_render_std(const unsigned char *specs); +int register_printf_render_std(const char *specs); /* vprintf_errno.c */ printf_arginfo_function __printf_arginfo_errno; Modified: projects/altix2/lib/libc/gen/arc4random.c ============================================================================== --- projects/altix2/lib/libc/gen/arc4random.c Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/lib/libc/gen/arc4random.c Sat Jul 7 05:25:22 2012 (r238191) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include <unistd.h> #include <sys/types.h> #include <sys/param.h> +#include <sys/sysctl.h> #include <sys/time.h> #include <pthread.h> @@ -78,6 +79,9 @@ static struct arc4_stream rs; static pid_t arc4_stir_pid; static int arc4_count; +extern int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, + void *newp, size_t newlen); + static inline u_int8_t arc4_getbyte(void); static void arc4_stir(void); @@ -109,6 +113,28 @@ arc4_addrandom(u_char *dat, int datlen) rs.j = rs.i; } +static size_t +arc4_sysctl(u_char *buf, size_t size) +{ + int mib[2]; + size_t len, done; + + mib[0] = CTL_KERN; + mib[1] = KERN_ARND; + done = 0; + + do { + len = size; + if (__sysctl(mib, 2, buf, &len, NULL, 0) == -1) + return (done); + done += len; + buf += len; + size -= len; + } while (size > 0); + + return (done); +} + static void arc4_stir(void) { @@ -123,12 +149,16 @@ arc4_stir(void) arc4_init(); rs_initialized = 1; } - fd = _open(RANDOMDEV, O_RDONLY, 0); done = 0; - if (fd >= 0) { - if (_read(fd, &rdat, KEYSIZE) == KEYSIZE) - done = 1; - (void)_close(fd); + if (arc4_sysctl((u_char *)&rdat, KEYSIZE) == KEYSIZE) + done = 1; + if (!done) { + fd = _open(RANDOMDEV, O_RDONLY, 0); + if (fd >= 0) { + if (_read(fd, &rdat, KEYSIZE) == KEYSIZE) + done = 1; + (void)_close(fd); + } } if (!done) { (void)gettimeofday(&rdat.tv, NULL); Modified: projects/altix2/lib/libc/gen/directory.3 ============================================================================== --- projects/altix2/lib/libc/gen/directory.3 Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/lib/libc/gen/directory.3 Sat Jul 7 05:25:22 2012 (r238191) @@ -28,7 +28,7 @@ .\" @(#)directory.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 16, 2008 +.Dd July 5, 2012 .Dt DIRECTORY 3 .Os .Sh NAME @@ -153,7 +153,7 @@ returns 0 on success or an error number The .Fn telldir function -returns the current location associated with the named +returns a token representing the current location associated with the named .Em directory stream . Values returned by .Fn telldir @@ -179,6 +179,13 @@ The new position reverts to the one asso when the .Fn telldir operation was performed. +State associated with the token returned by +.Fn telldir is freed when it is passed to +.Fn seekdir . +If you wish return to the same location again, +then you must create a new token with another +.Fn telldir +call. .Pp The .Fn rewinddir @@ -245,3 +252,9 @@ The .Fn fdopendir function appeared in .Fx 8.0 . +.Sh BUGS +The invalidation of +.Fn telldir +tokens when calling +.Fn seekdir +is non-standard. Modified: projects/altix2/lib/libc/locale/collate.c ============================================================================== --- projects/altix2/lib/libc/locale/collate.c Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/lib/libc/locale/collate.c Sat Jul 7 05:25:22 2012 (r238191) @@ -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: projects/altix2/lib/libc/locale/setrunelocale.c ============================================================================== --- projects/altix2/lib/libc/locale/setrunelocale.c Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/lib/libc/locale/setrunelocale.c Sat Jul 7 05:25:22 2012 (r238191) @@ -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) Modified: projects/altix2/lib/libc/stdio/xprintf.c ============================================================================== --- projects/altix2/lib/libc/stdio/xprintf.c Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/lib/libc/stdio/xprintf.c Sat Jul 7 05:25:22 2012 (r238191) @@ -651,7 +651,7 @@ register_printf_render(int spec, printf_ } int -register_printf_render_std(const unsigned char *specs) +register_printf_render_std(const char *specs) { for (; *specs != '\0'; specs++) { Modified: projects/altix2/lib/libedit/chared.c ============================================================================== --- projects/altix2/lib/libedit/chared.c Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/lib/libedit/chared.c Sat Jul 7 05:25:22 2012 (r238191) @@ -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: projects/altix2/lib/libedit/chared.h ============================================================================== --- projects/altix2/lib/libedit/chared.h Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/lib/libedit/chared.h Sat Jul 7 05:25:22 2012 (r238191) @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)chared.h 8.1 (Berkeley) 6/4/93 - * $NetBSD: chared.h,v 1.17 2006/03/06 21:11:56 christos Exp $ + * $NetBSD: chared.h,v 1.18 2009/02/15 21:55:23 christos Exp $ * $FreeBSD$ */ @@ -70,7 +70,7 @@ typedef struct c_macro_t { * Undo information for vi - no undo in emacs (yet) */ typedef struct c_undo_t { - int len; /* length of saved line */ + ssize_t len; /* length of saved line */ int cursor; /* position of saved cursor */ char *buf; /* full saved text */ } c_undo_t; Modified: projects/altix2/lib/libedit/editline.3 ============================================================================== --- projects/altix2/lib/libedit/editline.3 Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/lib/libedit/editline.3 Sat Jul 7 05:25:22 2012 (r238191) @@ -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: projects/altix2/lib/libedit/el.h ============================================================================== --- projects/altix2/lib/libedit/el.h Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/lib/libedit/el.h Sat Jul 7 05:25:22 2012 (r238191) @@ -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: projects/altix2/lib/libedit/read.c ============================================================================== --- projects/altix2/lib/libedit/read.c Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/lib/libedit/read.c Sat Jul 7 05:25:22 2012 (r238191) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include <stdlib.h> #include "el.h" -#define OKCMD -1 /* must be -1! */ +#define OKCMD -1 private int read__fixio(int, int); private int read_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) { idx = (cp - el->el_line.buffer); @@ -440,16 +427,12 @@ el_gets(EditLine *el, int *nread) if (cp[-1] == '\r' || cp[-1] == '\n') break; } - if (num == -1) { - if (errno == EINTR) - cp = el->el_line.buffer; - el->el_errno = errno; - } el->el_line.cursor = el->el_line.lastchar = cp; *cp = '\0'; - *nread = (int)(el->el_line.cursor - el->el_line.buffer); - goto done; + if (nread) + *nread = (int)(el->el_line.cursor - el->el_line.buffer); + return (*nread ? el->el_line.buffer : NULL); } @@ -460,8 +443,8 @@ el_gets(EditLine *el, int *nread) (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs); if (chrs == 0) { if (tty_rawmode(el) < 0) { - errno = 0; - *nread = 0; + if (nread) + *nread = 0; return (NULL); } } @@ -474,7 +457,6 @@ el_gets(EditLine *el, int *nread) if (el->el_flags & EDIT_DISABLED) { char *cp; size_t idx; - if ((el->el_flags & UNBUFFERED) == 0) cp = el->el_line.buffer; else @@ -482,7 +464,7 @@ el_gets(EditLine *el, int *nread) term__flush(el); - while ((num = (*el->el_read.read_char)(el, cp)) == 1) { + while ((*el->el_read.read_char)(el, cp) == 1) { /* make sure there is space next character */ if (cp + 1 >= el->el_line.limit) { idx = (cp - el->el_line.buffer); @@ -498,15 +480,11 @@ el_gets(EditLine *el, int *nread) break; } - if (num == -1) { - if (errno == EINTR) - cp = el->el_line.buffer; - el->el_errno = errno; - } - el->el_line.cursor = el->el_line.lastchar = cp; *cp = '\0'; - goto done; + if (nread) + *nread = (int)(el->el_line.cursor - el->el_line.buffer); + return (*nread ? el->el_line.buffer : NULL); } for (num = OKCMD; num == OKCMD;) { /* while still editing this @@ -522,12 +500,6 @@ el_gets(EditLine *el, int *nread) #endif /* DEBUG_READ */ break; } - if (el->el_errno == EINTR) { - el->el_line.buffer[0] = '\0'; - el->el_line.lastchar = - el->el_line.cursor = el->el_line.buffer; - break; - } if ((unsigned int)cmdnum >= (unsigned int)el->el_map.nfunc) { /* BUG CHECK command */ #ifdef DEBUG_EDIT (void) fprintf(el->el_errfile, @@ -645,17 +617,12 @@ el_gets(EditLine *el, int *nread) /* make sure the tty is set up correctly */ if ((el->el_flags & UNBUFFERED) == 0) { read_finish(el); - *nread = num != -1 ? num : 0; + if (nread) + *nread = num; } else { - *nread = (int)(el->el_line.lastchar - el->el_line.buffer); + if (nread) + *nread = + (int)(el->el_line.lastchar - el->el_line.buffer); } -done: - if (*nread == 0) { - if (num == -1) { - *nread = -1; - errno = el->el_errno; - } - return NULL; - } else - return el->el_line.buffer; + return (num ? el->el_line.buffer : NULL); } Modified: projects/altix2/lib/libedit/sig.c ============================================================================== --- projects/altix2/lib/libedit/sig.c Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/lib/libedit/sig.c Sat Jul 7 05:25:22 2012 (r238191) @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: sig.c,v 1.15 2009/02/19 15:20:22 christos Exp $ + * $NetBSD: sig.c,v 1.14 2009/02/18 15:04:40 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -73,8 +73,6 @@ sig_handler(int signo) (void) sigaddset(&nset, signo); (void) sigprocmask(SIG_BLOCK, &nset, &oset); - sel->el_signal->sig_no = signo; - switch (signo) { case SIGCONT: tty_rawmode(sel); @@ -160,12 +158,12 @@ sig_set(EditLine *el) struct sigaction osa, nsa; nsa.sa_handler = sig_handler; - nsa.sa_flags = 0; sigemptyset(&nsa.sa_mask); (void) sigprocmask(SIG_BLOCK, &el->el_signal->sig_set, &oset); for (i = 0; sighdl[i] != -1; i++) { + nsa.sa_flags = SIGINT ? 0 : SA_RESTART; /* This could happen if we get interrupted */ if (sigaction(sighdl[i], &nsa, &osa) != -1 && osa.sa_handler != sig_handler) Modified: projects/altix2/lib/libedit/sig.h ============================================================================== --- projects/altix2/lib/libedit/sig.h Sat Jul 7 05:17:43 2012 (r238190) +++ projects/altix2/lib/libedit/sig.h Sat Jul 7 05:25:22 2012 (r238191) @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)sig.h 8.1 (Berkeley) 6/4/93 - * $NetBSD: sig.h,v 1.5 2003/08/07 16:44:33 agc Exp $ + * $NetBSD: sig.h,v 1.7 2009/02/15 21:25:01 christos Exp $ * $FreeBSD$ */ @@ -61,7 +61,6 @@ typedef struct { struct sigaction sig_action[ALLSIGSNO]; sigset_t sig_set; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207070525.q675PNwx016533>