Date: Wed, 9 Jun 2004 02:35:07 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 54438 for review Message-ID: <200406090235.i592Z7bc061756@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=54438 Change 54438 by rwatson@rwatson_tislabs on 2004/06/09 02:34:14 Integrate netperf_socket: - tty abstraction work. - panic line numbers backed out. - linux_wait4 becomes MPSAFE. - amd64 vm optimization, cleanup, and related notions. - kern_kse broken out from kern_thread. - ACPI shutdown fixes. - More NDIS evil. - The normal plethora of PCI, USB IDs, etc. - Loop back of const sockaddr argument to sbappendaddr(), const sun_noname addr for unix domain sockets. - Loop back of slipped reference fix for non-blocking accept() calls that fail. Affected files ... .. //depot/projects/netperf_socket/sys/alpha/alpha/promcons.c#4 integrate .. //depot/projects/netperf_socket/sys/alpha/alpha/support.s#3 integrate .. //depot/projects/netperf_socket/sys/alpha/linux/linux_proto.h#5 integrate .. //depot/projects/netperf_socket/sys/alpha/linux/linux_syscall.h#5 integrate .. //depot/projects/netperf_socket/sys/alpha/linux/linux_sysent.c#5 integrate .. //depot/projects/netperf_socket/sys/alpha/linux/syscalls.master#5 integrate .. //depot/projects/netperf_socket/sys/alpha/tlsb/zs_tlsb.c#4 integrate .. //depot/projects/netperf_socket/sys/amd64/amd64/fpu.c#4 integrate .. //depot/projects/netperf_socket/sys/amd64/amd64/identcpu.c#6 integrate .. //depot/projects/netperf_socket/sys/amd64/amd64/initcpu.c#2 integrate .. //depot/projects/netperf_socket/sys/amd64/amd64/machdep.c#5 integrate .. //depot/projects/netperf_socket/sys/amd64/amd64/mp_machdep.c#6 integrate .. //depot/projects/netperf_socket/sys/amd64/amd64/mpboot.S#3 integrate .. //depot/projects/netperf_socket/sys/amd64/amd64/pmap.c#10 integrate .. //depot/projects/netperf_socket/sys/amd64/include/md_var.h#5 integrate .. //depot/projects/netperf_socket/sys/amd64/include/param.h#2 integrate .. //depot/projects/netperf_socket/sys/amd64/include/pmap.h#7 integrate .. //depot/projects/netperf_socket/sys/amd64/include/specialreg.h#4 integrate .. //depot/projects/netperf_socket/sys/arm/arm/exception.S#2 integrate .. //depot/projects/netperf_socket/sys/arm/arm/in_cksum_arm.S#2 integrate .. //depot/projects/netperf_socket/sys/arm/arm/locore.S#2 integrate .. //depot/projects/netperf_socket/sys/cam/cam_ccb.h#2 integrate .. //depot/projects/netperf_socket/sys/compat/ndis/kern_ndis.c#15 integrate .. //depot/projects/netperf_socket/sys/compat/ndis/subr_ndis.c#10 integrate .. //depot/projects/netperf_socket/sys/compat/ndis/subr_ntoskrnl.c#13 integrate .. //depot/projects/netperf_socket/sys/compat/pecoff/imgact_pecoff.c#2 integrate .. //depot/projects/netperf_socket/sys/conf/NOTES#18 integrate .. //depot/projects/netperf_socket/sys/conf/files#24 integrate .. //depot/projects/netperf_socket/sys/contrib/ipfilter/netinet/ip_compat.h#2 integrate .. //depot/projects/netperf_socket/sys/dev/acpica/acpi.c#20 integrate .. //depot/projects/netperf_socket/sys/dev/acpica/acpi_cpu.c#9 integrate .. //depot/projects/netperf_socket/sys/dev/acpica/acpi_pci.c#10 integrate .. //depot/projects/netperf_socket/sys/dev/acpica/acpi_pcib.c#7 integrate .. //depot/projects/netperf_socket/sys/dev/acpica/acpi_powerres.c#6 integrate .. //depot/projects/netperf_socket/sys/dev/ciss/ciss.c#9 integrate .. //depot/projects/netperf_socket/sys/dev/ciss/cissreg.h#6 integrate .. //depot/projects/netperf_socket/sys/dev/cx/if_cx.c#6 integrate .. //depot/projects/netperf_socket/sys/dev/cy/cy.c#4 integrate .. //depot/projects/netperf_socket/sys/dev/dcons/dcons.c#5 integrate .. //depot/projects/netperf_socket/sys/dev/digi/digi.c#5 integrate .. //depot/projects/netperf_socket/sys/dev/em/if_em.c#6 integrate .. //depot/projects/netperf_socket/sys/dev/if_ndis/if_ndis.c#13 integrate .. //depot/projects/netperf_socket/sys/dev/if_ndis/if_ndisvar.h#5 integrate .. //depot/projects/netperf_socket/sys/dev/nmdm/nmdm.c#7 integrate .. //depot/projects/netperf_socket/sys/dev/ofw/ofw_console.c#4 integrate .. //depot/projects/netperf_socket/sys/dev/rc/rc.c#6 integrate .. //depot/projects/netperf_socket/sys/dev/rp/rp.c#4 integrate .. //depot/projects/netperf_socket/sys/dev/sab/sab.c#5 integrate .. //depot/projects/netperf_socket/sys/dev/si/si.c#4 integrate .. //depot/projects/netperf_socket/sys/dev/sio/sio.c#8 integrate .. //depot/projects/netperf_socket/sys/dev/sio/sio_pci.c#2 integrate .. //depot/projects/netperf_socket/sys/dev/sound/pci/emu10k1.c#5 integrate .. //depot/projects/netperf_socket/sys/dev/sound/pcm/sound.c#4 integrate .. //depot/projects/netperf_socket/sys/dev/sx/sx.c#3 integrate .. //depot/projects/netperf_socket/sys/dev/syscons/syscons.c#6 integrate .. //depot/projects/netperf_socket/sys/dev/syscons/sysmouse.c#4 integrate .. //depot/projects/netperf_socket/sys/dev/uart/uart_tty.c#3 integrate .. //depot/projects/netperf_socket/sys/dev/usb/if_udav.c#4 integrate .. //depot/projects/netperf_socket/sys/dev/usb/ubser.c#4 integrate .. //depot/projects/netperf_socket/sys/dev/usb/ucom.c#5 integrate .. //depot/projects/netperf_socket/sys/dev/usb/uftdi.c#6 integrate .. //depot/projects/netperf_socket/sys/dev/usb/umass.c#6 integrate .. //depot/projects/netperf_socket/sys/dev/usb/usbdevs#12 integrate .. //depot/projects/netperf_socket/sys/dev/usb/usbdevs.h#12 integrate .. //depot/projects/netperf_socket/sys/dev/usb/usbdevs_data.h#12 integrate .. //depot/projects/netperf_socket/sys/dev/xe/if_xe.c#6 integrate .. //depot/projects/netperf_socket/sys/dev/zs/zs.c#4 integrate .. //depot/projects/netperf_socket/sys/geom/nop/g_nop.c#2 integrate .. //depot/projects/netperf_socket/sys/i386/i386/swtch.s#4 integrate .. //depot/projects/netperf_socket/sys/i386/isa/npx.c#6 integrate .. //depot/projects/netperf_socket/sys/i386/isa/pcvt/pcvt_drv.c#4 integrate .. //depot/projects/netperf_socket/sys/i386/isa/pcvt/pcvt_ext.c#3 integrate .. //depot/projects/netperf_socket/sys/i386/isa/pcvt/pcvt_hdr.h#4 integrate .. //depot/projects/netperf_socket/sys/i386/isa/pcvt/pcvt_sup.c#2 integrate .. //depot/projects/netperf_socket/sys/i386/isa/pcvt/pcvt_vtf.c#2 integrate .. //depot/projects/netperf_socket/sys/i386/linux/linux_sysvec.c#2 integrate .. //depot/projects/netperf_socket/sys/ia64/ia64/ssc.c#4 integrate .. //depot/projects/netperf_socket/sys/kern/imgact_aout.c#3 integrate .. //depot/projects/netperf_socket/sys/kern/imgact_elf.c#7 integrate .. //depot/projects/netperf_socket/sys/kern/kern_exit.c#11 integrate .. //depot/projects/netperf_socket/sys/kern/kern_intr.c#6 integrate .. //depot/projects/netperf_socket/sys/kern/kern_kse.c#1 branch .. //depot/projects/netperf_socket/sys/kern/kern_shutdown.c#4 integrate .. //depot/projects/netperf_socket/sys/kern/kern_sig.c#10 integrate .. //depot/projects/netperf_socket/sys/kern/kern_synch.c#8 integrate .. //depot/projects/netperf_socket/sys/kern/kern_thread.c#10 integrate .. //depot/projects/netperf_socket/sys/kern/subr_blist.c#2 integrate .. //depot/projects/netperf_socket/sys/kern/subr_bus.c#7 integrate .. //depot/projects/netperf_socket/sys/kern/tty.c#5 integrate .. //depot/projects/netperf_socket/sys/kern/tty_conf.c#3 integrate .. //depot/projects/netperf_socket/sys/kern/tty_pty.c#5 integrate .. //depot/projects/netperf_socket/sys/kern/uipc_socket.c#14 integrate .. //depot/projects/netperf_socket/sys/kern/uipc_socket2.c#12 integrate .. //depot/projects/netperf_socket/sys/kern/uipc_syscalls.c#14 integrate .. //depot/projects/netperf_socket/sys/kern/uipc_usrreq.c#8 integrate .. //depot/projects/netperf_socket/sys/kern/vfs_syscalls.c#8 integrate .. //depot/projects/netperf_socket/sys/kern/vfs_vnops.c#6 integrate .. //depot/projects/netperf_socket/sys/modules/ipfilter/Makefile#3 integrate .. //depot/projects/netperf_socket/sys/net/if_sl.c#4 integrate .. //depot/projects/netperf_socket/sys/netatm/atm_ioctl.h#3 integrate .. //depot/projects/netperf_socket/sys/netgraph/ng_message.h#3 integrate .. //depot/projects/netperf_socket/sys/netinet/ip_icmp.c#7 integrate .. //depot/projects/netperf_socket/sys/pc98/pc98/clock.c#5 integrate .. //depot/projects/netperf_socket/sys/pc98/pc98/mse.c#4 integrate .. //depot/projects/netperf_socket/sys/pc98/pc98/olpt.c#4 integrate .. //depot/projects/netperf_socket/sys/pc98/pc98/pc98gdc.c#3 integrate .. //depot/projects/netperf_socket/sys/pc98/pc98/ppc.c#3 integrate .. //depot/projects/netperf_socket/sys/pc98/pc98/scgdcrndr.c#2 integrate .. //depot/projects/netperf_socket/sys/pc98/pc98/scterm-sck.c#2 integrate .. //depot/projects/netperf_socket/sys/pc98/pc98/sio.c#8 integrate .. //depot/projects/netperf_socket/sys/sparc64/include/asmacros.h#3 integrate .. //depot/projects/netperf_socket/sys/sparc64/pci/psycho.c#4 integrate .. //depot/projects/netperf_socket/sys/sparc64/sbus/sbus.c#4 integrate .. //depot/projects/netperf_socket/sys/sparc64/sparc64/eeprom_ebus.c#4 integrate .. //depot/projects/netperf_socket/sys/sparc64/sparc64/eeprom_fhc.c#4 integrate .. //depot/projects/netperf_socket/sys/sparc64/sparc64/eeprom_sbus.c#4 integrate .. //depot/projects/netperf_socket/sys/sparc64/sparc64/nexus.c#4 integrate .. //depot/projects/netperf_socket/sys/sys/blist.h#2 integrate .. //depot/projects/netperf_socket/sys/sys/bus.h#4 integrate .. //depot/projects/netperf_socket/sys/sys/conf.h#6 integrate .. //depot/projects/netperf_socket/sys/sys/linedisc.h#1 branch .. //depot/projects/netperf_socket/sys/sys/param.h#10 integrate .. //depot/projects/netperf_socket/sys/sys/socketvar.h#8 integrate .. //depot/projects/netperf_socket/sys/sys/systm.h#4 integrate .. //depot/projects/netperf_socket/sys/sys/tty.h#4 integrate .. //depot/projects/netperf_socket/sys/sys/vmmeter.h#3 integrate .. //depot/projects/netperf_socket/sys/sys/vnode.h#5 integrate .. //depot/projects/netperf_socket/sys/ufs/ffs/ffs_snapshot.c#3 integrate .. //depot/projects/netperf_socket/sys/vm/vm_page.h#6 integrate .. //depot/projects/netperf_socket/sys/vm/vm_pageq.c#3 integrate Differences ... ==== //depot/projects/netperf_socket/sys/alpha/alpha/promcons.c#4 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/alpha/promcons.c,v 1.37 2004/06/01 13:49:25 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/alpha/promcons.c,v 1.38 2004/06/04 16:02:48 phk Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -124,7 +124,7 @@ splx(s); - error = (*linesw[tp->t_line].l_open)(dev, tp); + error = ttyld_open(tp, dev); if (error == 0 && setuptimeout) { polltime = hz / PROM_POLL_HZ; @@ -148,7 +148,7 @@ return ENXIO; untimeout(promtimeout, tp, promtimeouthandle); - (*linesw[tp->t_line].l_close)(tp, flag); + ttyld_close(tp, flag); ttyclose(tp); return 0; } @@ -211,7 +211,7 @@ while ((c = promcncheckc(NULL)) != -1) { if (tp->t_state & TS_ISOPEN) - (*linesw[tp->t_line].l_rint)(c, tp); + ttyld_rint(tp, c); } promtimeouthandle = timeout(promtimeout, tp, polltime); } ==== //depot/projects/netperf_socket/sys/alpha/alpha/support.s#3 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/alpha/alpha/support.s,v 1.16 2004/01/19 21:27:10 phk Exp $ + * $FreeBSD: src/sys/alpha/alpha/support.s,v 1.17 2004/06/06 21:26:47 phk Exp $ */ /* @@ -680,10 +680,8 @@ longjmp_botch: lda a0, longjmp_botchmsg - mov 0, a1 - mov 0, a2 - mov ra, a3 - CALL(__panic) + mov ra, a1 + CALL(panic) call_pal PAL_bugchk .data ==== //depot/projects/netperf_socket/sys/alpha/linux/linux_proto.h#5 (text+ko) ==== @@ -2,8 +2,8 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/alpha/linux/linux_proto.h,v 1.17 2004/03/29 02:19:43 bms Exp $ - * created from FreeBSD: src/sys/alpha/linux/syscalls.master,v 1.56 2004/03/15 22:43:48 jhb Exp + * $FreeBSD: src/sys/alpha/linux/linux_proto.h,v 1.18 2004/06/04 13:52:51 jhb Exp $ + * created from FreeBSD: src/sys/alpha/linux/syscalls.master,v 1.58 2004/06/04 13:52:23 jhb Exp */ #ifndef _LINUX_SYSPROTO_H_ ==== //depot/projects/netperf_socket/sys/alpha/linux/linux_syscall.h#5 (text+ko) ==== @@ -2,8 +2,8 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/alpha/linux/linux_syscall.h,v 1.15 2004/03/29 02:19:43 bms Exp $ - * created from FreeBSD: src/sys/alpha/linux/syscalls.master,v 1.56 2004/03/15 22:43:48 jhb Exp + * $FreeBSD: src/sys/alpha/linux/linux_syscall.h,v 1.16 2004/06/04 13:52:51 jhb Exp $ + * created from FreeBSD: src/sys/alpha/linux/syscalls.master,v 1.58 2004/06/04 13:52:23 jhb Exp */ #define LINUX_SYS_exit 1 ==== //depot/projects/netperf_socket/sys/alpha/linux/linux_sysent.c#5 (text+ko) ==== @@ -2,8 +2,8 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/alpha/linux/linux_sysent.c,v 1.15 2004/03/29 02:19:43 bms Exp $ - * created from FreeBSD: src/sys/alpha/linux/syscalls.master,v 1.56 2004/03/15 22:43:48 jhb Exp + * $FreeBSD: src/sys/alpha/linux/linux_sysent.c,v 1.16 2004/06/04 13:52:51 jhb Exp $ + * created from FreeBSD: src/sys/alpha/linux/syscalls.master,v 1.58 2004/06/04 13:52:23 jhb Exp */ #include "opt_compat.h" @@ -382,7 +382,7 @@ { SYF_MPSAFE | AS(linux_setitimer_args), (sy_call_t *)linux_setitimer }, /* 362 = linux_setitimer */ { AS(linux_utimes_args), (sy_call_t *)linux_utimes }, /* 363 = linux_utimes */ { SYF_MPSAFE | AS(getrusage_args), (sy_call_t *)getrusage }, /* 364 = getrusage */ - { AS(linux_wait4_args), (sy_call_t *)linux_wait4 }, /* 365 = linux_wait4 */ + { SYF_MPSAFE | AS(linux_wait4_args), (sy_call_t *)linux_wait4 }, /* 365 = linux_wait4 */ { 0, (sy_call_t *)linux_adjtimex }, /* 366 = linux_adjtimex */ { AS(linux_getcwd_args), (sy_call_t *)linux_getcwd }, /* 367 = linux_getcwd */ { 0, (sy_call_t *)linux_capget }, /* 368 = linux_capget */ ==== //depot/projects/netperf_socket/sys/alpha/linux/syscalls.master#5 (text+ko) ==== @@ -1,4 +1,4 @@ - $FreeBSD: src/sys/alpha/linux/syscalls.master,v 1.57 2004/03/29 02:19:43 bms Exp $ + $FreeBSD: src/sys/alpha/linux/syscalls.master,v 1.58 2004/06/04 13:52:23 jhb Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 ; System call name/number master file (or rather, slave, from LINUX). @@ -445,7 +445,7 @@ struct l_itimerval *oitv); } 363 STD { int linux_utimes(char *fname, struct l_timeval *times); } 364 MNOPROTO { int getrusage(int who, struct rusage *rusage); } -365 STD { int linux_wait4(l_pid_t pid, l_uint *status, l_int options, \ +365 MSTD { int linux_wait4(l_pid_t pid, l_uint *status, l_int options, \ struct l_rusage *rusage); } 366 STD { int linux_adjtimex(void); } 367 STD { int linux_getcwd(char *buf, l_ulong bufsize); } ==== //depot/projects/netperf_socket/sys/alpha/tlsb/zs_tlsb.c#4 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/tlsb/zs_tlsb.c,v 1.43 2004/06/01 13:49:26 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/tlsb/zs_tlsb.c,v 1.44 2004/06/04 16:02:48 phk Exp $"); #include "opt_ddb.h" @@ -291,7 +291,7 @@ splx(s); - error = (*linesw[tp->t_line].l_open)(dev, tp); + error = ttyld_open(tp, dev); if (error == 0 && setuptimeout) { zspolltime = hz / 50; @@ -318,7 +318,7 @@ s = spltty(); untimeout(zs_poll_intr, sc, sc->zst); - (*linesw[tp->t_line].l_close)(tp, flag); + ttyld_close(tp, flag); ttyclose(tp); splx(s); @@ -502,7 +502,7 @@ Debugger("manual escape to debugger"); #endif if (tp && (tp->t_state & TS_ISOPEN)) - (*linesw[tp->t_line].l_rint)(c, tp); + ttyld_rint(tp, c); DELAY(5); } } @@ -517,7 +517,7 @@ Debugger("manual escape to debugger"); #endif if (tp && (tp->t_state & TS_ISOPEN)) - (*linesw[tp->t_line].l_rint)(c, tp); + ttyld_rint(tp, c); DELAY(5); } } ==== //depot/projects/netperf_socket/sys/amd64/amd64/fpu.c#4 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/fpu.c,v 1.149 2004/04/05 21:25:51 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/fpu.c,v 1.153 2004/06/08 01:35:48 peter Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -73,6 +73,7 @@ #define fnstsw(addr) __asm __volatile("fnstsw %0" : "=m" (*(addr))) #define fxrstor(addr) __asm("fxrstor %0" : : "m" (*(addr))) #define fxsave(addr) __asm __volatile("fxsave %0" : "=m" (*(addr))) +#define ldmxcsr(r) __asm __volatile("ldmxcsr %0" : : "m" (r)) #define start_emulating() __asm("smsw %%ax; orb %0,%%al; lmsw %%ax" \ : : "n" (CR0_TS) : "ax") #define stop_emulating() __asm("clts") @@ -111,6 +112,7 @@ fpuinit(void) { register_t savecrit; + u_int mxcsr; u_short control; savecrit = intr_disable(); @@ -119,6 +121,8 @@ fninit(); control = __INITIAL_FPUCW__; fldcw(&control); + mxcsr = __INITIAL_MXCSR__; + ldmxcsr(mxcsr); fxsave(&fpu_cleanstate); start_emulating(); fpu_cleanstate_ready = 1; ==== //depot/projects/netperf_socket/sys/amd64/amd64/identcpu.c#6 (text+ko) ==== @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/identcpu.c,v 1.132 2004/06/03 20:18:15 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/identcpu.c,v 1.134 2004/06/08 01:20:37 peter Exp $"); #include "opt_cpu.h" @@ -69,13 +69,10 @@ void earlysetcpuclass(void); void panicifcpuunsupported(void); -static void print_AMD_features(void); static void print_AMD_info(void); static void print_AMD_assoc(int i); -int cpu_feature2; /* XXX change cpu_feature to long? */ int cpu_class; -u_int cpu_exthigh; /* Highest arg to extended CPUID */ char machine[] = "amd64"; SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0, "Machine class"); @@ -109,26 +106,18 @@ strncpy(cpu_model, amd64_cpus[cpu].cpu_name, sizeof (cpu_model)); /* Check for extended CPUID information and a processor name. */ - if (cpu_high > 0 && - (strcmp(cpu_vendor, "GenuineIntel") == 0 || - strcmp(cpu_vendor, "AuthenticAMD") == 0)) { - do_cpuid(0x80000000, regs); - if (regs[0] >= 0x80000000) { - cpu_exthigh = regs[0]; - if (cpu_exthigh >= 0x80000004) { - brand = cpu_brand; - for (i = 0x80000002; i < 0x80000005; i++) { - do_cpuid(i, regs); - memcpy(brand, regs, sizeof(regs)); - brand += sizeof(regs); - } - } + if (cpu_exthigh >= 0x80000004) { + brand = cpu_brand; + for (i = 0x80000002; i < 0x80000005; i++) { + do_cpuid(i, regs); + memcpy(brand, regs, sizeof(regs)); + brand += sizeof(regs); } } if (strcmp(cpu_vendor, "GenuineIntel") == 0) { - /* Better late than never I suppose.. */ - strcat(cpu_model, "IA-32e"); + /* Please make up your mind folks! */ + strcat(cpu_model, "EM64T"); } else if (strcmp(cpu_vendor, "AuthenticAMD") == 0) { /* * Values taken from AMD Processor Recognition @@ -259,6 +248,43 @@ "\040<b31>" ); } + if (amd_feature != 0) { + printf("\n AMD Features=0x%b", amd_feature, + "\020" /* in hex */ + "\001<s0>" /* Same */ + "\002<s1>" /* Same */ + "\003<s2>" /* Same */ + "\004<s3>" /* Same */ + "\005<s4>" /* Same */ + "\006<s5>" /* Same */ + "\007<s6>" /* Same */ + "\010<s7>" /* Same */ + "\011<s8>" /* Same */ + "\012<s9>" /* Same */ + "\013<b10>" /* Undefined */ + "\014SYSCALL" /* Have SYSCALL/SYSRET */ + "\015<s12>" /* Same */ + "\016<s13>" /* Same */ + "\017<s14>" /* Same */ + "\020<s15>" /* Same */ + "\021<s16>" /* Same */ + "\022<s17>" /* Same */ + "\023<b18>" /* Reserved, unknown */ + "\024MP" /* Multiprocessor Capable */ + "\025NX" /* Has EFER.NXE, NX */ + "\026<b21>" /* Undefined */ + "\027MMX+" /* AMD MMX Extensions */ + "\030<s23>" /* Same */ + "\031<s24>" /* Same */ + "\032<b25>" /* Undefined */ + "\033<b26>" /* Undefined */ + "\034<b27>" /* Undefined */ + "\035<b28>" /* Undefined */ + "\036LM" /* 64 bit long mode */ + "\0373DNow+" /* AMD 3DNow! Extensions */ + "\0403DNow" /* AMD 3DNow! */ + ); + } /* * If this CPU supports hyperthreading then mention @@ -269,8 +295,6 @@ printf("\n Hyperthreading: %d logical CPUs", (cpu_procinfo & CPUID_HTT_CORES) >> 16); } - if (cpu_exthigh >= 0x80000001) - print_AMD_features(); } /* Avoid ugly blank lines: only print newline when we have to. */ if (*cpu_vendor || cpu_id) @@ -327,6 +351,16 @@ cpu_feature = regs[3]; cpu_feature2 = regs[2]; + if (strcmp(cpu_vendor, "GenuineIntel") == 0 || + strcmp(cpu_vendor, "AuthenticAMD") == 0) { + do_cpuid(0x80000000, regs); + cpu_exthigh = regs[0]; + } + if (cpu_exthigh >= 0x80000001) { + do_cpuid(0x80000001, regs); + amd_feature = regs[3] & ~(cpu_feature & 0x0183f3ff); + } + /* XXX */ cpu = CPU_CLAWHAMMER; } @@ -358,111 +392,64 @@ static void print_AMD_info(void) { + u_int regs[4]; - if (cpu_exthigh >= 0x80000005) { - u_int regs[4]; + if (cpu_exthigh < 0x80000005) + return; - do_cpuid(0x80000005, regs); - printf("L1 2MB data TLB: %d entries", (regs[0] >> 16) & 0xff); - print_AMD_assoc(regs[0] >> 24); + do_cpuid(0x80000005, regs); + printf("L1 2MB data TLB: %d entries", (regs[0] >> 16) & 0xff); + print_AMD_assoc(regs[0] >> 24); - printf("L1 2MB instruction TLB: %d entries", regs[0] & 0xff); - print_AMD_assoc((regs[0] >> 8) & 0xff); + printf("L1 2MB instruction TLB: %d entries", regs[0] & 0xff); + print_AMD_assoc((regs[0] >> 8) & 0xff); - printf("L1 4KB data TLB: %d entries", (regs[1] >> 16) & 0xff); - print_AMD_assoc(regs[1] >> 24); + printf("L1 4KB data TLB: %d entries", (regs[1] >> 16) & 0xff); + print_AMD_assoc(regs[1] >> 24); - printf("L1 4KB instruction TLB: %d entries", regs[1] & 0xff); - print_AMD_assoc((regs[1] >> 8) & 0xff); + printf("L1 4KB instruction TLB: %d entries", regs[1] & 0xff); + print_AMD_assoc((regs[1] >> 8) & 0xff); - printf("L1 data cache: %d kbytes", regs[2] >> 24); - printf(", %d bytes/line", regs[2] & 0xff); - printf(", %d lines/tag", (regs[2] >> 8) & 0xff); - print_AMD_assoc((regs[2] >> 16) & 0xff); + printf("L1 data cache: %d kbytes", regs[2] >> 24); + printf(", %d bytes/line", regs[2] & 0xff); + printf(", %d lines/tag", (regs[2] >> 8) & 0xff); + print_AMD_assoc((regs[2] >> 16) & 0xff); - printf("L1 instruction cache: %d kbytes", regs[3] >> 24); - printf(", %d bytes/line", regs[3] & 0xff); - printf(", %d lines/tag", (regs[3] >> 8) & 0xff); - print_AMD_assoc((regs[3] >> 16) & 0xff); + printf("L1 instruction cache: %d kbytes", regs[3] >> 24); + printf(", %d bytes/line", regs[3] & 0xff); + printf(", %d lines/tag", (regs[3] >> 8) & 0xff); + print_AMD_assoc((regs[3] >> 16) & 0xff); - if (cpu_exthigh >= 0x80000006) { - do_cpuid(0x80000006, regs); - if ((regs[0] >> 16) != 0) { - printf("L2 2MB data TLB: %d entries", - (regs[0] >> 16) & 0xfff); - print_AMD_l2_assoc(regs[0] >> 28); - printf("L2 2MB instruction TLB: %d entries", - regs[0] & 0xfff); - print_AMD_l2_assoc((regs[0] >> 28) & 0xf); - } else { - printf("L2 2MB unified TLB: %d entries", - regs[0] & 0xfff); - print_AMD_l2_assoc((regs[0] >> 28) & 0xf); - } - if ((regs[1] >> 16) != 0) { - printf("L2 4KB data TLB: %d entries", - (regs[1] >> 16) & 0xfff); - print_AMD_l2_assoc(regs[1] >> 28); + if (cpu_exthigh >= 0x80000006) { + do_cpuid(0x80000006, regs); + if ((regs[0] >> 16) != 0) { + printf("L2 2MB data TLB: %d entries", + (regs[0] >> 16) & 0xfff); + print_AMD_l2_assoc(regs[0] >> 28); + printf("L2 2MB instruction TLB: %d entries", + regs[0] & 0xfff); + print_AMD_l2_assoc((regs[0] >> 28) & 0xf); + } else { + printf("L2 2MB unified TLB: %d entries", + regs[0] & 0xfff); + print_AMD_l2_assoc((regs[0] >> 28) & 0xf); + } + if ((regs[1] >> 16) != 0) { + printf("L2 4KB data TLB: %d entries", + (regs[1] >> 16) & 0xfff); + print_AMD_l2_assoc(regs[1] >> 28); - printf("L2 4KB instruction TLB: %d entries", - (regs[1] >> 16) & 0xfff); - print_AMD_l2_assoc((regs[1] >> 28) & 0xf); - } else { - printf("L2 4KB unified TLB: %d entries", - (regs[1] >> 16) & 0xfff); - print_AMD_l2_assoc((regs[1] >> 28) & 0xf); - } - printf("L2 unified cache: %d kbytes", regs[2] >> 16); - printf(", %d bytes/line", regs[2] & 0xff); - printf(", %d lines/tag", (regs[2] >> 8) & 0x0f); - print_AMD_l2_assoc((regs[2] >> 12) & 0x0f); + printf("L2 4KB instruction TLB: %d entries", + (regs[1] >> 16) & 0xfff); + print_AMD_l2_assoc((regs[1] >> 28) & 0xf); + } else { + printf("L2 4KB unified TLB: %d entries", + (regs[1] >> 16) & 0xfff); + print_AMD_l2_assoc((regs[1] >> 28) & 0xf); } + printf("L2 unified cache: %d kbytes", regs[2] >> 16); + printf(", %d bytes/line", regs[2] & 0xff); + printf(", %d lines/tag", (regs[2] >> 8) & 0x0f); + print_AMD_l2_assoc((regs[2] >> 12) & 0x0f); } } - -static void -print_AMD_features(void) -{ - u_int regs[4]; - - /* - * Values taken from AMD Processor Recognition - * http://www.amd.com/products/cpg/athlon/techdocs/pdf/20734.pdf - */ - do_cpuid(0x80000001, regs); - printf("\n AMD Features=0x%b", regs[3] & ~(cpu_feature & 0x0183f3ff), - "\020" /* in hex */ - "\001FPU" /* Integral FPU */ - "\002VME" /* Extended VM86 mode support */ - "\003DE" /* Debug extensions */ - "\004PSE" /* 4MByte page tables */ - "\005TSC" /* Timestamp counter */ - "\006MSR" /* Machine specific registers */ - "\007PAE" /* Physical address extension */ - "\010MCE" /* Machine Check support */ - "\011CX8" /* CMPEXCH8 instruction */ - "\012APIC" /* SMP local APIC */ - "\013<b10>" - "\014SYSCALL" /* SYSENTER/SYSEXIT instructions */ - "\015MTRR" /* Memory Type Range Registers */ - "\016PGE" /* PG_G (global bit) support */ - "\017MCA" /* Machine Check Architecture */ - "\020CMOV" /* CMOV instruction */ - "\021PAT" /* Page attributes table */ - "\022PGE36" /* 36 bit address space support */ - "\023RSVD" /* Reserved, unknown */ - "\024MP" /* Multiprocessor Capable */ - "\025NX" /* Has EFER.NXE, NX (no execute pte bit) */ - "\026<b21>" - "\027MMX+" /* AMD MMX Instruction Extensions */ - "\030MMX" - "\031FXSAVE" /* FXSAVE/FXRSTOR */ - "\032<b25>" - "\033<b26>" - "\034<b27>" - "\035<b28>" - "\036LM" /* Long mode */ - "\0373DNow!+" /* AMD 3DNow! Instruction Extensions */ - "\0403DNow!" /* AMD 3DNow! Instructions */ - ); -} ==== //depot/projects/netperf_socket/sys/amd64/amd64/initcpu.c#2 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/initcpu.c,v 1.47 2003/11/21 03:01:59 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/initcpu.c,v 1.48 2004/06/08 01:02:51 peter Exp $"); #include "opt_cpu.h" @@ -41,7 +41,8 @@ #include <machine/md_var.h> #include <machine/specialreg.h> -void initializecpu(void); +#include <vm/vm.h> +#include <vm/pmap.h> static int hw_instruction_sse; SYSCTL_INT(_hw, OID_AUTO, instruction_sse, CTLFLAG_RD, @@ -49,31 +50,30 @@ int cpu; /* Are we 386, 386sx, 486, etc? */ u_int cpu_feature; /* Feature flags */ +u_int cpu_feature2; /* Feature flags */ +u_int amd_feature; /* Feature flags */ u_int cpu_high; /* Highest arg to CPUID */ +u_int cpu_exthigh; /* Highest arg to extended CPUID */ u_int cpu_id; /* Stepping ID */ u_int cpu_procinfo; /* HyperThreading Info / Brand Index / CLFUSH */ char cpu_vendor[20]; /* CPU Origin code */ u_int cpu_fxsr; /* SSE enabled */ /* - * Initialize CR4 (Control register 4) to enable SSE instructions. + * Initialize CPU control registers */ void -enable_sse(void) +initializecpu(void) { + uint64_t msr; + if ((cpu_feature & CPUID_XMM) && (cpu_feature & CPUID_FXSR)) { load_cr4(rcr4() | CR4_FXSR | CR4_XMM); cpu_fxsr = hw_instruction_sse = 1; } -} - -void -initializecpu(void) -{ - - switch (cpu) { - default: - break; + if ((amd_feature & AMDID_NX) != 0) { + msr = rdmsr(MSR_EFER) | EFER_NXE; + wrmsr(MSR_EFER, msr); + pg_nx = PG_NX; } - enable_sse(); } ==== //depot/projects/netperf_socket/sys/amd64/amd64/machdep.c#5 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.607 2004/05/19 01:23:48 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.608 2004/06/08 01:02:51 peter Exp $"); #include "opt_atalk.h" #include "opt_atpic.h" @@ -130,7 +130,6 @@ extern void printcpuinfo(void); /* XXX header file */ extern void identify_cpu(void); extern void panicifcpuunsupported(void); -extern void initializecpu(void); #define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) #define EFL_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) @@ -1108,12 +1107,6 @@ #error "have you forgotten the isa device?"; #endif -#if 0 /* Not till we test the features bit */ - /* Turn on PTE NX (no execute) bit */ - msr = rdmsr(MSR_EFER) | EFER_NXE; - wrmsr(MSR_EFER, msr); -#endif - proc0.p_uarea = (struct user *)(physfree + KERNBASE); bzero(proc0.p_uarea, UAREA_PAGES * PAGE_SIZE); physfree += UAREA_PAGES * PAGE_SIZE; ==== //depot/projects/netperf_socket/sys/amd64/amd64/mp_machdep.c#6 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.237 2004/05/16 22:11:50 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.239 2004/06/08 01:07:51 peter Exp $"); #include "opt_cpu.h" #include "opt_kstack_pages.h" @@ -429,12 +429,12 @@ /* set up CPU registers and state */ cpu_setregs(); + /* set up SSE/NX registers */ + initializecpu(); + /* set up FPU state on the AP */ fpuinit(); - /* set up SSE registers */ - enable_sse(); - /* A quick check from sanity claus */ if (PCPU_GET(apic_id) != lapic_id()) { printf("SMP: cpuid = %d\n", PCPU_GET(cpuid)); ==== //depot/projects/netperf_socket/sys/amd64/amd64/mpboot.S#3 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/amd64/amd64/mpboot.S,v 1.25 2004/02/25 23:12:39 peter Exp $ + * $FreeBSD: src/sys/amd64/amd64/mpboot.S,v 1.26 2004/06/08 01:02:52 peter Exp $ */ #include <machine/asmacros.h> /* miscellaneous asm macros */ @@ -102,11 +102,7 @@ */ movl $MSR_EFER, %ecx rdmsr -#if 0 /* not till we test the NX cpuid bits */ - orl $EFER_LME | EFER_SCE | EFER_NXE, %eax -#else orl $EFER_LME | EFER_SCE, %eax -#endif wrmsr /* ==== //depot/projects/netperf_socket/sys/amd64/amd64/pmap.c#10 (text+ko) ==== @@ -75,7 +75,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.461 2004/05/28 19:42:02 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.466 2004/06/08 02:20:40 peter Exp $"); /* * Manages physical address maps. @@ -174,6 +174,7 @@ static int ndmpdp; static vm_paddr_t dmaplimit; vm_offset_t kernel_vm_end; +pt_entry_t pg_nx; static u_int64_t KPTphys; /* phys addr of kernel level 1 */ static u_int64_t KPDphys; /* phys addr of kernel level 2 */ @@ -971,7 +972,7 @@ /* We just released a PT, unhold the matching PD */ vm_page_t pdpg; - pdpg = PHYS_TO_VM_PAGE(*pmap_pdpe(pmap, va)); + pdpg = PHYS_TO_VM_PAGE(*pmap_pdpe(pmap, va) & PG_FRAME); vm_page_unhold(pdpg); if (pdpg->hold_count == 0) _pmap_unwire_pte_hold(pmap, va, pdpg); @@ -980,7 +981,7 @@ /* We just released a PD, unhold the matching PDP */ vm_page_t pdppg; - pdppg = PHYS_TO_VM_PAGE(*pmap_pml4e(pmap, va)); + pdppg = PHYS_TO_VM_PAGE(*pmap_pml4e(pmap, va) & PG_FRAME); vm_page_unhold(pdppg); if (pdppg->hold_count == 0) _pmap_unwire_pte_hold(pmap, va, pdppg); @@ -1162,7 +1163,7 @@ } } else { /* Add reference to pdp page */ - pdppg = PHYS_TO_VM_PAGE(*pml4); + pdppg = PHYS_TO_VM_PAGE(*pml4 & PG_FRAME); pdppg->hold_count++; } pdp = (pdp_entry_t *)PHYS_TO_DMAP(*pml4 & PG_FRAME); @@ -1209,7 +1210,7 @@ } } else { /* Add reference to the pd page */ - pdpg = PHYS_TO_VM_PAGE(*pdp); + pdpg = PHYS_TO_VM_PAGE(*pdp & PG_FRAME); pdpg->hold_count++; } } @@ -1259,7 +1260,7 @@ * hold count, and activate it. */ if (pd != 0 && (*pd & PG_V) != 0) { - m = PHYS_TO_VM_PAGE(*pd); + m = PHYS_TO_VM_PAGE(*pd & PG_FRAME); m->hold_count++; } else { /* @@ -1296,7 +1297,7 @@ LIST_REMOVE(pmap, pm_list); mtx_unlock_spin(&allpmaps_lock); - m = PHYS_TO_VM_PAGE(pmap->pm_pml4[PML4PML4I]); + m = PHYS_TO_VM_PAGE(pmap->pm_pml4[PML4PML4I] & PG_FRAME); pmap->pm_pml4[KPML4I] = 0; /* KVA */ pmap->pm_pml4[DMPML4I] = 0; /* Direct Map */ @@ -1516,7 +1517,7 @@ pmap_invalidate_page(kernel_pmap, va); pmap->pm_stats.resident_count -= 1; if (oldpte & PG_MANAGED) { - m = PHYS_TO_VM_PAGE(oldpte); + m = PHYS_TO_VM_PAGE(oldpte & PG_FRAME); if (oldpte & PG_M) { #if defined(PMAP_DIAGNOSTIC) if (pmap_nw_modified((pt_entry_t) oldpte)) { @@ -1532,7 +1533,7 @@ vm_page_flag_set(m, PG_REFERENCED); return pmap_remove_entry(pmap, m, va); } else { - mpte = PHYS_TO_VM_PAGE(*pmap_pde(pmap, va)); + mpte = PHYS_TO_VM_PAGE(*pmap_pde(pmap, va) & PG_FRAME); return pmap_unuse_pt(pmap, va, mpte); } } @@ -1561,7 +1562,9 @@ void pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { - vm_offset_t pdnxt; + vm_offset_t va_next; + pml4_entry_t *pml4e; + pdp_entry_t *pdpe; pd_entry_t ptpaddr, *pde; pt_entry_t *pte; int anyvalid; @@ -1587,15 +1590,27 @@ anyvalid = 0; - for (; sva < eva; sva = pdnxt) { + for (; sva < eva; sva = va_next) { if (pmap->pm_stats.resident_count == 0) break; + pml4e = pmap_pml4e(pmap, sva); + if (pml4e == 0) { + va_next = (sva + NBPML4) & ~PML4MASK; + continue; + } + + pdpe = pmap_pdpe(pmap, sva); + if (pdpe == 0) { + va_next = (sva + NBPDP) & ~PDPMASK; + continue; + } + /* * Calculate index for next page table. */ - pdnxt = (sva + NBPDR) & ~PDRMASK; + va_next = (sva + NBPDR) & ~PDRMASK; pde = pmap_pde(pmap, sva); if (pde == 0) @@ -1624,10 +1639,10 @@ * by the current page table page, or to the end of the * range being removed. */ - if (pdnxt > eva) - pdnxt = eva; + if (va_next > eva) + va_next = eva; - for (; sva != pdnxt; sva += PAGE_SIZE) { + for (; sva != va_next; sva += PAGE_SIZE) { pte = pmap_pte(pmap, sva); if (pte == NULL || *pte == 0) continue; @@ -1713,7 +1728,9 @@ void pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) { - vm_offset_t pdnxt; + vm_offset_t va_next; + pml4_entry_t *pml4e; + pdp_entry_t *pdpe; pd_entry_t ptpaddr, *pde; int anychanged; @@ -1730,9 +1747,21 @@ anychanged = 0; - for (; sva < eva; sva = pdnxt) { + for (; sva < eva; sva = va_next) { + + pml4e = pmap_pml4e(pmap, sva); + if (pml4e == 0) { + va_next = (sva + NBPML4) & ~PML4MASK; + continue; + } + + pdpe = pmap_pdpe(pmap, sva); + if (pdpe == 0) { + va_next = (sva + NBPDP) & ~PDPMASK; + continue; + } - pdnxt = (sva + NBPDR) & ~PDRMASK; + va_next = (sva + NBPDR) & ~PDRMASK; pde = pmap_pde(pmap, sva); if (pde == NULL) @@ -1756,10 +1785,10 @@ continue; } - if (pdnxt > eva) - pdnxt = eva; + if (va_next > eva) >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406090235.i592Z7bc061756>