From owner-svn-src-head@FreeBSD.ORG Tue Jan 31 17:51:31 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C017106566C; Tue, 31 Jan 2012 17:51:31 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 006168FC08; Tue, 31 Jan 2012 17:51:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0VHpUDr047669; Tue, 31 Jan 2012 17:51:30 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0VHpUoB047665; Tue, 31 Jan 2012 17:51:30 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201201311751.q0VHpUoB047665@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 31 Jan 2012 17:51:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230830 - head/sys/amd64/acpica X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 17:51:31 -0000 Author: jkim Date: Tue Jan 31 17:51:30 2012 New Revision: 230830 URL: http://svn.freebsd.org/changeset/base/230830 Log: - Restore XCR0 before restoring extended FPU states. - Update my copyright dates. Reviewed by: kib Modified: head/sys/amd64/acpica/acpi_switch.S head/sys/amd64/acpica/acpi_wakecode.S head/sys/amd64/acpica/acpi_wakeup.c Modified: head/sys/amd64/acpica/acpi_switch.S ============================================================================== --- head/sys/amd64/acpica/acpi_switch.S Tue Jan 31 17:24:08 2012 (r230829) +++ head/sys/amd64/acpica/acpi_switch.S Tue Jan 31 17:51:30 2012 (r230830) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001 Takanori Watanabe * Copyright (c) 2001 Mitsuru IWASAKI - * Copyright (c) 2008-2010 Jung-uk Kim + * Copyright (c) 2008-2012 Jung-uk Kim * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -95,7 +95,6 @@ ENTRY(acpi_restorecpu) /* Restore CR0 except for FPU mode. */ movq PCB_CR0(%rdi), %rax - movq %rax, %rcx andq $~(CR0_EM | CR0_TS), %rax movq %rax, %cr0 @@ -146,21 +145,26 @@ ENTRY(acpi_restorecpu) /* Restore FPU state. */ fninit - movq WAKEUP_CTX(fpusave),%rdi - cmpl $0,use_xsave - jne 1f - fxrstor (%rdi) + movq WAKEUP_CTX(xsmask), %rax + testq %rax, %rax + jz 1f + movq %rax, %rdx + shrq $32, %rdx + movl $XCR0, %ecx +/* xsetbv */ + .byte 0x0f, 0x01, 0xd1 + movq WAKEUP_CTX(fpusave), %rcx +/* xrstor (%rcx) */ + .byte 0x0f, 0xae, 0x29 jmp 2f -1: movl xsave_mask,%eax - movl xsave_mask+4,%edx -/* xrstor (%rdi) */ - .byte 0x0f,0xae,0x2f +1: + movq WAKEUP_CTX(fpusave), %rcx + fxrstor (%rcx) 2: /* Reload CR0. */ - movq %rcx, %cr0 - - movq WAKEUP_CTX(pcb),%rdi + movq PCB_CR0(%rdi), %rax + movq %rax, %cr0 /* Restore return address. */ movq PCB_RIP(%rdi), %rax Modified: head/sys/amd64/acpica/acpi_wakecode.S ============================================================================== --- head/sys/amd64/acpica/acpi_wakecode.S Tue Jan 31 17:24:08 2012 (r230829) +++ head/sys/amd64/acpica/acpi_wakecode.S Tue Jan 31 17:51:30 2012 (r230830) @@ -2,7 +2,7 @@ * Copyright (c) 2001 Takanori Watanabe * Copyright (c) 2001 Mitsuru IWASAKI * Copyright (c) 2003 Peter Wemm - * Copyright (c) 2008-2010 Jung-uk Kim + * Copyright (c) 2008-2012 Jung-uk Kim * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -284,6 +284,8 @@ wakeup_cstar: .quad 0 wakeup_sfmask: .quad 0 +wakeup_xsmask: + .quad 0 wakeup_cpu: .long 0 dummy: Modified: head/sys/amd64/acpica/acpi_wakeup.c ============================================================================== --- head/sys/amd64/acpica/acpi_wakeup.c Tue Jan 31 17:24:08 2012 (r230829) +++ head/sys/amd64/acpica/acpi_wakeup.c Tue Jan 31 17:51:30 2012 (r230830) @@ -2,7 +2,7 @@ * Copyright (c) 2001 Takanori Watanabe * Copyright (c) 2001 Mitsuru IWASAKI * Copyright (c) 2003 Peter Wemm - * Copyright (c) 2008-2010 Jung-uk Kim + * Copyright (c) 2008-2012 Jung-uk Kim * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -386,6 +386,7 @@ acpi_install_wakeup_handler(struct acpi_ WAKECODE_FIXUP(wakeup_lstar, uint64_t, rdmsr(MSR_LSTAR)); WAKECODE_FIXUP(wakeup_cstar, uint64_t, rdmsr(MSR_CSTAR)); WAKECODE_FIXUP(wakeup_sfmask, uint64_t, rdmsr(MSR_SF_MASK)); + WAKECODE_FIXUP(wakeup_xsmask, uint64_t, xsave_mask); /* Build temporary page tables below realmode code. */ pt4 = wakeaddr;