From owner-freebsd-current Fri May 24 7:26:28 2002 Delivered-To: freebsd-current@freebsd.org Received: from mail.speakeasy.net (mail11.speakeasy.net [216.254.0.211]) by hub.freebsd.org (Postfix) with ESMTP id 0DC7337B404 for ; Fri, 24 May 2002 07:26:16 -0700 (PDT) Received: (qmail 983 invoked from network); 24 May 2002 14:26:14 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail11.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 24 May 2002 14:26:14 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.11.6/8.11.6) with ESMTP id g4OEQDF08156 for ; Fri, 24 May 2002 10:26:13 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="_=XFMail.1.5.2.FreeBSD:20020524102530:485=_" Date: Fri, 24 May 2002 10:25:53 -0400 (EDT) From: John Baldwin To: current@FreeBSD.org Subject: Please test PAUSE on non-Intel processors Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This message is in MIME format --_=XFMail.1.5.2.FreeBSD:20020524102530:485=_ Content-Type: text/plain; charset=us-ascii Hey gang, although Intel's document seems to claim that they tested proper operation of pause I'd like people with non-Intel processors to verify that it actually works. Please compile the attached test program and run it. The output should look like this: > ./pt Testing PAUSE instruction: Register esp changed: 0xbfbff9fc -> 0xbfbff9c0 If you get a signal or any of the other registers change their value, please let me know. I've tested this on a Pentium III mobile, a K6-II, and an Athlon. The program cmopiles ok on both stable and current. -----FW: <200205212226.g4LMQaV68801@freefall.freebsd.org>----- Date: Tue, 21 May 2002 15:26:36 -0700 (PDT) Sender: owner-cvs-committers@FreeBSD.org From: John Baldwin To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/kern kern_mutex.c jhb 2002/05/21 15:26:36 PDT Modified files: sys/kern kern_mutex.c Log: Add appropriate IA32 "pause" instructions to improve performanec on Pentium 4's and newer IA32 processors. The "pause" instruction has been verified by Intel to be a NOP on all currently existing IA32 processors prior to the Pentium 4. Revision Changes Path 1.95 +17 -1 src/sys/kern/kern_mutex.c --------------End of forwarded message------------------------- -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ --_=XFMail.1.5.2.FreeBSD:20020524102530:485=_ Content-Disposition: attachment; filename="pausetest.c" Content-Transfer-Encoding: 7bit Content-Description: pausetest.c Content-Type: text/plain; charset=us-ascii; name=pausetest.c; SizeOnDisk=1607 /* * Simple program to see if the new IA32 PAUSE instruction works properly. * We test two different things: 1) that we don't get an illegal instruction * fault, and 2) that no registers change state. */ #include #include #define NUM_SEGREGS 6 #define NUM_REGS 15 #define PUSH_REGS \ " pushf ;\n" \ " pusha ;\n" \ " push %cs ;\n" \ " push %ds ;\n" \ " push %es ;\n" \ " push %fs ;\n" \ " push %gs ;\n" \ " push %ss ;\n" const char *register_names[NUM_REGS] = { "ss", "gs", "fs", "es", "ds", "cs", "edi", "esi", "ebp", "esp", "ebx", "edx", "ecx", "eax", "eflags" }; struct register_set { register_t r_regs[NUM_REGS]; /* register_t r_ss; register_t r_gs; register_t r_fs; register_t r_es; register_t r_ds; register_t r_cs; register_t r_edi; register_t r_esi; register_t r_ebp; register_t r_isp; register_t r_ebx; register_t r_edx; register_t r_ecx; register_t r_eax; register_t r_eflags; */ }; void compare_registers(struct register_set after, struct register_set before) { int i; for (i = 0; i < NUM_SEGREGS; i++) { before.r_regs[i] &= 0xffff; after.r_regs[i] &= 0xffff; } for (i = 0; i < NUM_REGS; i++) if (before.r_regs[i] != after.r_regs[i]) printf("Register %s changed: %#x -> %#x\n", register_names[i], before.r_regs[i], after.r_regs[i]); } void test_pause(void) { __asm __volatile( " mov $10,%ecx ;\n" PUSH_REGS " pause ;\n" PUSH_REGS " call compare_registers ;\n" " addl $0x78,%esp ;\n"); } int main(int ac, char **av) { printf("Testing PAUSE instruction:\n"); test_pause(); return (0); } --_=XFMail.1.5.2.FreeBSD:20020524102530:485=_-- End of MIME message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message