Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch KNF, and reduce the diff between amd64 and i386.
details: https://anonhg.NetBSD.org/src/rev/95e4847cc89c
branches: trunk
changeset: 346635:95e4847cc89c
user: maxv <maxv%NetBSD.org@localhost>
date: Sun Jul 24 13:04:58 2016 +0000
description:
KNF, and reduce the diff between amd64 and i386.
diffstat:
sys/arch/amd64/acpi/acpi_wakecode.S | 20 +++++++++++---------
sys/arch/amd64/acpi/acpi_wakeup_low.S | 6 +++---
sys/arch/i386/acpi/acpi_wakecode.S | 17 +++++++++--------
sys/arch/i386/acpi/acpi_wakeup_low.S | 7 +++----
4 files changed, 26 insertions(+), 24 deletions(-)
diffs (214 lines):
diff -r 7e3cd71a04e5 -r 95e4847cc89c sys/arch/amd64/acpi/acpi_wakecode.S
--- a/sys/arch/amd64/acpi/acpi_wakecode.S Sat Jul 23 20:06:25 2016 +0000
+++ b/sys/arch/amd64/acpi/acpi_wakecode.S Sun Jul 24 13:04:58 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_wakecode.S,v 1.12 2014/01/15 22:24:41 joerg Exp $ */
+/* $NetBSD: acpi_wakecode.S,v 1.13 2016/07/24 13:04:58 maxv Exp $ */
/*-
* Copyright (c) 2007 Joerg Sonnenberger <joerg%netbsd.org@localhost>
@@ -31,7 +31,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-
/*
* This code is derived from FreeBSD. Original copyrights:
*
@@ -144,7 +143,7 @@
data32 addr32 lgdt tmp_gdt
#endif
- /* Enable protected mode w/o paging */
+ /* Enable protected mode without paging */
mov %cr0,%eax
orl $(CR0_PE),%eax
mov %eax,%cr0
@@ -164,10 +163,10 @@
/*
* Switched to protected mode w/o paging
*/
+ nop
- nop
/* Set up segment registers and initial stack for protected mode */
- movw $0x10, %ax
+ movw $0x10,%ax
movw %ax,%ds
movw %ax,%ss
@@ -193,7 +192,7 @@
movl WAKEUP_efer + ACPI_WAKEUP_ADDR,%ebx
movl $MSR_EFER,%ecx
rdmsr
- orl $EFER_LME, %eax
+ orl $EFER_LME,%eax
wrmsr
/* Load temporary PML4, code will switch to full PML4 later */
@@ -204,9 +203,11 @@
movl %cr0,%eax
orl $(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_MP|CR0_WP|CR0_AM),%eax
movl %eax,%cr0
- /* Flush prefetch queue */
+
+ /* Flush the prefetch queue */
jmp 1f
1:
+
/* Switch to temporary 64bit GDT */
lgdt tmp_gdt64 + ACPI_WAKEUP_ADDR
@@ -220,7 +221,7 @@
* Load the normal system value of MSR EFER. This includes
* enabling the SYSCALL extension and NXE (if supported).
*/
- movl %ebx, %eax
+ movl %ebx,%eax
movl $MSR_EFER,%ecx
wrmsr
@@ -228,6 +229,7 @@
movw $GSEL(GDATA_SEL, SEL_KPL),%ax
movw %ax,%ds
+ /* Restore registers */
movq WAKEUP_curcpu + ACPI_WAKEUP_ADDR,%r8
movq WAKEUP_restorecpu + ACPI_WAKEUP_ADDR,%rbx
@@ -270,7 +272,7 @@
.global WAKEUP_vbios_reset
WAKEUP_vbios_reset: .byte 0
.global WAKEUP_vesa_modenum
-WAKEUP_vesa_modenum: .word 0
+WAKEUP_vesa_modenum: .word 0
.global WAKEUP_beep_on_reset
WAKEUP_beep_on_reset: .byte 0
diff -r 7e3cd71a04e5 -r 95e4847cc89c sys/arch/amd64/acpi/acpi_wakeup_low.S
--- a/sys/arch/amd64/acpi/acpi_wakeup_low.S Sat Jul 23 20:06:25 2016 +0000
+++ b/sys/arch/amd64/acpi/acpi_wakeup_low.S Sun Jul 24 13:04:58 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_wakeup_low.S,v 1.4 2008/05/11 15:32:20 ad Exp $ */
+/* $NetBSD: acpi_wakeup_low.S,v 1.5 2016/07/24 13:04:58 maxv Exp $ */
/*-
* Copyright (c) 2007 Joerg Sonnenberger <joerg%netbsd.org@localhost>
@@ -80,7 +80,7 @@
movq ACPI_SUSPEND_CR0(%r8),%rax
movq %rax,%cr0
- jmp 1f
+ jmp 1f
1:
movq CPUVAR(GDT),%rax
@@ -88,7 +88,7 @@
andq $~0x0200,4(%rax,%rdx, 1)
ltr %dx
- lldt ACPI_SUSPEND_LDT(%r8)
+ lldt ACPI_SUSPEND_LDT(%r8)
lidt ACPI_SUSPEND_IDT(%r8)
movq ACPI_SUSPEND_REG+(0*8)(%r8),%rsp
diff -r 7e3cd71a04e5 -r 95e4847cc89c sys/arch/i386/acpi/acpi_wakecode.S
--- a/sys/arch/i386/acpi/acpi_wakecode.S Sat Jul 23 20:06:25 2016 +0000
+++ b/sys/arch/i386/acpi/acpi_wakecode.S Sun Jul 24 13:04:58 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_wakecode.S,v 1.16 2014/02/02 22:41:20 dsl Exp $ */
+/* $NetBSD: acpi_wakecode.S,v 1.17 2016/07/24 13:04:58 maxv Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -29,7 +29,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-
/*
* This code is derived from FreeBSD. Original copyrights:
*
@@ -136,14 +135,13 @@
/* Load GDT while non-paging */
lgdt tmp_gdt
- /* Enable protected mode */
+ /* Enable protected mode without paging */
mov %cr0,%eax
orl $(CR0_PE),%eax
mov %eax,%cr0
/* Switch to protected mode by intersegmental jump */
- ljmpl $0x8,$wakeup_32 + ACPI_WAKEUP_ADDR
-
+ ljmpl $0x8,$wakeup_32 + ACPI_WAKEUP_ADDR
.code32
.align 16
@@ -151,19 +149,21 @@
/*
* Switched to protected mode w/o paging
*/
+ nop
- nop
/* Set up segment registers for protected mode */
movw $GSEL(GDATA_SEL,SEL_KPL),%ax
movw %ax,%ds
- /* Restore PSE and other settings before enabling paging. */
+ /* Enable potentially PSE and PAE */
movl WAKEUP_r_cr4 + ACPI_WAKEUP_ADDR,%eax
movl %eax,%cr4
- /* Enable paging (assumes identical mapping) */
+ /* Load temporary page table, we will switch to full page table later */
movl WAKEUP_r_cr3 + ACPI_WAKEUP_ADDR,%eax
movl %eax,%cr3
+
+ /* Enable paging */
movl %cr0,%eax
orl $(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_MP|CR0_WP|CR0_AM),%eax
movl %eax,%cr0
@@ -179,6 +179,7 @@
movl WAKEUP_curcpu + ACPI_WAKEUP_ADDR,%edx
movl WAKEUP_restorecpu + ACPI_WAKEUP_ADDR,%ebx
+ /* Continue with wakeup in the high-level wakeup code */
jmp *%ebx
.align 8
diff -r 7e3cd71a04e5 -r 95e4847cc89c sys/arch/i386/acpi/acpi_wakeup_low.S
--- a/sys/arch/i386/acpi/acpi_wakeup_low.S Sat Jul 23 20:06:25 2016 +0000
+++ b/sys/arch/i386/acpi/acpi_wakeup_low.S Sun Jul 24 13:04:58 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_wakeup_low.S,v 1.5 2008/05/11 15:32:20 ad Exp $ */
+/* $NetBSD: acpi_wakeup_low.S,v 1.6 2016/07/24 13:04:58 maxv Exp $ */
/*-
* Copyright (c) 2007 Joerg Sonnenberger <joerg%netbsd.org@localhost>
@@ -29,7 +29,7 @@
*/
#include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup_low.S,v 1.5 2008/05/11 15:32:20 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup_low.S,v 1.6 2016/07/24 13:04:58 maxv Exp $");
#include "assym.h"
#include <machine/segments.h>
@@ -53,13 +53,12 @@
movl ACPI_SUSPEND_CR2(%edx),%eax
movl %eax,%cr2
-
movl ACPI_SUSPEND_CR4(%edx),%eax
movl %eax,%cr4
movl ACPI_SUSPEND_CR3(%edx),%eax
movl %eax,%cr3
- jmp 1f
+ jmp 1f
1:
lidt ACPI_SUSPEND_IDT(%edx)
Home |
Main Index |
Thread Index |
Old Index