Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/amd64/amd64 KNF and simplify Xen



details:   https://anonhg.NetBSD.org/src/rev/c056abbb4834
branches:  trunk
changeset: 348843:c056abbb4834
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Nov 11 10:40:00 2016 +0000

description:
KNF and simplify Xen

diffstat:

 sys/arch/amd64/amd64/locore.S |  52 ++++++++++++++----------------------------
 1 files changed, 18 insertions(+), 34 deletions(-)

diffs (108 lines):

diff -r 36f22e73a7a2 -r c056abbb4834 sys/arch/amd64/amd64/locore.S
--- a/sys/arch/amd64/amd64/locore.S     Fri Nov 11 09:47:18 2016 +0000
+++ b/sys/arch/amd64/amd64/locore.S     Fri Nov 11 10:40:00 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.110 2016/10/16 10:51:31 maxv Exp $        */
+/*     $NetBSD: locore.S,v 1.111 2016/11/11 10:40:00 maxv Exp $        */
 
 /*
  * Copyright-o-rama!
@@ -313,16 +313,6 @@
  */
        .data
 
-#if NLAPIC > 0
-       .align  PAGE_SIZE
-       .globl  _C_LABEL(local_apic)
-
-       .type   _C_LABEL(local_apic), @object
-LABEL(local_apic)
-       .space  PAGE_SIZE
-END(local_apic)
-#endif
-
        .globl  _C_LABEL(tablesize)
        .globl  _C_LABEL(nox_flag)
        .globl  _C_LABEL(cputype)
@@ -887,10 +877,9 @@
        /*
         * Xen info:
         * - %rsi -> start_info struct
-        * - %rsp -> stack, *theoretically* the last used page
-        *      by Xen bootstrap
+        * - %rsp -> stack, *theoretically* the last used page by Xen bootstrap
         */
-       movq    %rsi, %rbx
+       movq    %rsi,%rbx
 
        /* Clear BSS. */
        xorq    %rax,%rax
@@ -900,7 +889,7 @@
        rep
        stosb
 
-       /* Copy start_info to a safe place */
+       /* Copy start_info to a safe place. */
        movq    %rbx,%rsi
        movq    $_C_LABEL(start_info_union),%rdi
        movq    $64,%rcx
@@ -924,45 +913,40 @@
         */
 
        /*
-        * We want our own page tables, let's rebuild them
-        * We will reclaim xen space afterward INCLUDING stack
-        * so let's change it to a temporary one
+        * We want our own page tables, and will rebuild them. We will reclaim
+        * the Xen space later, INCLUDING the stack. So we need to switch to a
+        * temporary one now.
         */
-
-       movq    $tmpstk, %rax
-       subq    $8, %rax
-       movq    %rax, %rsp
+       movq    $tmpstk,%rax
+       subq    $8,%rax
+       movq    %rax,%rsp
 
        xorl    %eax,%eax
        cpuid
        movl    %eax,_C_LABEL(cpuid_level)
 
-       movq    $cpu_info_primary, %rdi
-       movq    %rdi, CPU_INFO_SELF(%rdi) /* ci->ci_self = ci */
-       movq    $1, %rsi
+       movq    $cpu_info_primary,%rdi
+       movq    %rdi,CPU_INFO_SELF(%rdi) /* ci->ci_self = ci */
+       movq    $1,%rsi
        call    cpu_init_msrs   /* cpu_init_msrs(ci, true); */
 
        call    xen_pmap_bootstrap
 
        /*
-        * First avail returned by xen_pmap_bootstrap in %rax
+        * The first VA available is returned by xen_pmap_bootstrap in %rax. We
+        * use it as the UAREA, and set up the stack here.
         */
-       movq    %rax, %rsi
+       movq    %rax,%rsi
        movq    %rsi,(_C_LABEL(lwp0)+L_PCB)     /* XXX L_PCB != uarea */
-
-       /*
-        * Set new stack and clear segments
-        */
        leaq    (USPACE-FRAMESIZE)(%rsi),%rsp
        xorq    %rbp,%rbp
 
+       /* Clear segment registers. */
        xorw    %ax,%ax
        movw    %ax,%gs
        movw    %ax,%fs
 
-       /*
-        * Set first_avail after proc0
-        */
+       /* Set first_avail after the UAREA. */
        movq    %rsi,%rdi
        addq    $USPACE,%rdi
        subq    $KERNBASE,%rdi  /* init_x86_64 wants a physical address */



Home | Main Index | Thread Index | Old Index