Sun Mar 1 18:02:42 2015 UTC ()
xgetbv expects XCR0 to be speficied in %ecx, don't leave %ecx undefined


(tnn)
diff -r1.3 -r1.4 src/usr.sbin/cpuctl/arch/i386-asm.S
diff -r1.4 -r1.5 src/usr.sbin/cpuctl/arch/x86_64-asm.S

cvs diff -r1.3 -r1.4 src/usr.sbin/cpuctl/arch/i386-asm.S (expand / switch to unified diff)

--- src/usr.sbin/cpuctl/arch/i386-asm.S 2013/01/07 23:20:42 1.3
+++ src/usr.sbin/cpuctl/arch/i386-asm.S 2015/03/01 18:02:42 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: i386-asm.S,v 1.3 2013/01/07 23:20:42 dsl Exp $ */ 1/* $NetBSD: i386-asm.S,v 1.4 2015/03/01 18:02:42 tnn Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998, 2000, 2004, 2006, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2000, 2004, 2006, 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -39,26 +39,27 @@ ENTRY(x86_cpuid2) @@ -39,26 +39,27 @@ ENTRY(x86_cpuid2)
39 movl 16(%esp), %ecx 39 movl 16(%esp), %ecx
40 movl 20(%esp), %edi 40 movl 20(%esp), %edi
41 cpuid 41 cpuid
42 movl %eax, 0(%edi) 42 movl %eax, 0(%edi)
43 movl %ebx, 4(%edi) 43 movl %ebx, 4(%edi)
44 movl %ecx, 8(%edi) 44 movl %ecx, 8(%edi)
45 movl %edx, 12(%edi) 45 movl %edx, 12(%edi)
46 popl %edi 46 popl %edi
47 popl %ebx 47 popl %ebx
48 ret 48 ret
49END(x86_cpuid2) 49END(x86_cpuid2)
50 50
51ENTRY(x86_xgetbv) 51ENTRY(x86_xgetbv)
 52 xorl %ecx, %ecx
52 xgetbv 53 xgetbv
53 ret 54 ret
54END(x86_xgetbv) 55END(x86_xgetbv)
55 56
56ENTRY(x86_identify) 57ENTRY(x86_identify)
57 /* Try to toggle alignment check flag; does not exist on 386. */ 58 /* Try to toggle alignment check flag; does not exist on 386. */
58 pushfl 59 pushfl
59 popl %eax 60 popl %eax
60 movl %eax,%ecx 61 movl %eax,%ecx
61 orl $PSL_AC,%eax 62 orl $PSL_AC,%eax
62 pushl %eax 63 pushl %eax
63 popfl 64 popfl
64 pushfl 65 pushfl

cvs diff -r1.4 -r1.5 src/usr.sbin/cpuctl/arch/x86_64-asm.S (expand / switch to unified diff)

--- src/usr.sbin/cpuctl/arch/x86_64-asm.S 2013/01/07 23:20:42 1.4
+++ src/usr.sbin/cpuctl/arch/x86_64-asm.S 2015/03/01 18:02:42 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: x86_64-asm.S,v 1.4 2013/01/07 23:20:42 dsl Exp $ */ 1/* $NetBSD: x86_64-asm.S,v 1.5 2015/03/01 18:02:42 tnn Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -34,19 +34,20 @@ ENTRY(x86_cpuid2) @@ -34,19 +34,20 @@ ENTRY(x86_cpuid2)
34 pushq %rbx 34 pushq %rbx
35 movq %rdi, %rax 35 movq %rdi, %rax
36 movq %rsi, %rcx 36 movq %rsi, %rcx
37 movq %rdx, %rsi 37 movq %rdx, %rsi
38 cpuid 38 cpuid
39 movl %eax, 0(%rsi) 39 movl %eax, 0(%rsi)
40 movl %ebx, 4(%rsi) 40 movl %ebx, 4(%rsi)
41 movl %ecx, 8(%rsi) 41 movl %ecx, 8(%rsi)
42 movl %edx, 12(%rsi) 42 movl %edx, 12(%rsi)
43 popq %rbx 43 popq %rbx
44 ret 44 ret
45 45
46ENTRY(x86_xgetbv) 46ENTRY(x86_xgetbv)
 47 xorl %ecx, %ecx
47 xgetbv 48 xgetbv
48 ret 49 ret
49 50
50ENTRY(x86_identify) 51ENTRY(x86_identify)
51 movl $-1,%eax 52 movl $-1,%eax
52 ret 53 ret