Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932680AbVIHPRB (ORCPT ); Thu, 8 Sep 2005 11:17:01 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932681AbVIHPRB (ORCPT ); Thu, 8 Sep 2005 11:17:01 -0400 Received: from public.id2-vpn.continvity.gns.novell.com ([195.33.99.129]:62819 "EHLO emea1-mh.id2.novell.com") by vger.kernel.org with ESMTP id S932680AbVIHPQ7 (ORCPT ); Thu, 8 Sep 2005 11:16:59 -0400 Message-Id: <4320724C020000780002447D@emea1-mh.id2.novell.com> X-Mailer: Novell GroupWise Internet Agent 7.0 Date: Thu, 08 Sep 2005 17:18:04 +0200 From: "Jan Beulich" To: Subject: [PATCH] move i386's enabling of fxsr and xmmxcpt Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part61430F3C.0__=" Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6417 Lines: 154 This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part61430F3C.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline (Note: Patch also attached because the inline version is certain to get line wrapped.) Move some code unrelated to any dealing with hardware bugs from i386's bugs.h to a more logical place. Signed-off-by: Jan Beulich diff -Npru 2.6.13/arch/i386/kernel/traps.c 2.6.13-i386-fxsr/arch/i386/kernel/traps.c --- 2.6.13/arch/i386/kernel/traps.c 2005-08-29 01:41:01.000000000 +0200 +++ 2.6.13-i386-fxsr/arch/i386/kernel/traps.c 2005-09-07 11:46:35.000000000 +0200 @@ -1098,6 +1098,24 @@ void __init trap_init(void) #endif set_trap_gate(19,&simd_coprocessor_error); + if (cpu_has_fxsr) { + /* + * Verify that the FXSAVE/FXRSTOR data will be 16-byte aligned. + */ + struct fxsrAlignAssert { + int _:!(offsetof(struct task_struct, thread.i387.fxsave) & 15); + }; + + printk(KERN_INFO "Enabling fast FPU save and restore... "); + set_in_cr4(X86_CR4_OSFXSR); + printk("done.\n"); + } + if (cpu_has_xmm) { + printk(KERN_INFO "Enabling unmasked SIMD FPU exception support... "); + set_in_cr4(X86_CR4_OSXMMEXCPT); + printk("done.\n"); + } + set_system_gate(SYSCALL_VECTOR,&system_call); /* diff -Npru 2.6.13/include/asm-i386/bugs.h 2.6.13-i386-fxsr/include/asm-i386/bugs.h --- 2.6.13/include/asm-i386/bugs.h 2005-08-29 01:41:01.000000000 +0200 +++ 2.6.13-i386-fxsr/include/asm-i386/bugs.h 2005-09-01 11:32:11.000000000 +0200 @@ -8,9 +8,6 @@ * * - Channing Corn (tests & fixes), * - Andrew D. Balsa (code cleanup). - * - * Pentium III FXSR, SSE support - * Gareth Hughes , May 2000 */ /* @@ -76,25 +73,7 @@ static void __init check_fpu(void) return; } -/* Enable FXSR and company _before_ testing for FP problems. */ - /* - * Verify that the FXSAVE/FXRSTOR data will be 16-byte aligned. - */ - if (offsetof(struct task_struct, thread.i387.fxsave) & 15) { - extern void __buggy_fxsr_alignment(void); - __buggy_fxsr_alignment(); - } - if (cpu_has_fxsr) { - printk(KERN_INFO "Enabling fast FPU save and restore... "); - set_in_cr4(X86_CR4_OSFXSR); - printk("done.\n"); - } - if (cpu_has_xmm) { - printk(KERN_INFO "Enabling unmasked SIMD FPU exception support... "); - set_in_cr4(X86_CR4_OSXMMEXCPT); - printk("done.\n"); - } - +/* trap_init() enabled FXSR and company _before_ testing for FP problems here. */ /* Test for the divl bug.. */ __asm__("fninit\n\t" "fldl %1\n\t" --=__Part61430F3C.0__= Content-Type: application/octet-stream; name="linux-2.6.13-i386-fxsr.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="linux-2.6.13-i386-fxsr.patch" KE5vdGU6IFBhdGNoIGFsc28gYXR0YWNoZWQgYmVjYXVzZSB0aGUgaW5saW5lIHZlcnNpb24gaXMg Y2VydGFpbiB0byBnZXQKbGluZSB3cmFwcGVkLikKCk1vdmU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gZm9yIEZQIHBy b2JsZW1zLiAqLwotCS8qCi0JICogVmVyaWZ5IHRoYXQgdGhlIEZYU0FWRS9GWFJTVE9SIGRhdGEg d2lsbCBiZSAxNi1ieXRlIGFsaWduZWQuCi0JICovCi0JaWYgKG9mZnNldG9mKHN0cnVjdCB0YXNr X3N0cnVjdCwgdGhyZWFkLmkzODcuZnhzYXZlKSAmIDE1KSB7Ci0JCWV4dGVybiB2b2lkIF9fYnVn Z3lfZnhzcl9hbGlnbm1lbnQodm9pZCk7Ci0JCV9fYnVnZ3lfZnhzcl9hbGlnbm1lbnQoKTsKLQl9 Ci0JaWYgKGNwdV9oYXNfZnhzcikgewotCQlwcmludGsoS0VSTl9JTkZPICJFbmFibGluZyBmYXN0 IEZQVSBzYXZlIGFuZCByZXN0b3JlLi4uICIpOwotCQlzZXRfaW5fY3I0KFg4Nl9DUjRfT1NGWFNS KTsKLQkJcHJpbnRrKCJkb25lLlxuIik7Ci0JfQotCWlmIChjcHVfaGFzX3htbSkgewotCQlwcmlu dGsoS0VSTl9JTkZPICJFbmFibGluZyB1bm1hc2tlZCBTSU1EIEZQVSBleGNlcHRpb24gc3VwcG9y dC4uLiAiKTsKLQkJc2V0X2luX2NyNChYODZfQ1I0X09TWE1NRVhDUFQpOwotCQlwcmludGsoImRv bmUuXG4iKTsKLQl9Ci0KKy8qIHRyYXBfaW5pdCgpIGVuYWJsZWQgRlhTUiBhbmQgY29tcGFueSBf YmVmb3JlXyB0ZXN0aW5nIGZvciBGUCBwcm9ibGVtcyBoZXJlLiAqLwogCS8qIFRlc3QgZm9yIHRo ZSBkaXZsIGJ1Zy4uICovCiAJX19hc21fXygiZm5pbml0XG5cdCIKIAkJImZsZGwgJTFcblx0Igo= --=__Part61430F3C.0__=-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/