Module Name: src Committed By: maxv Date: Fri Nov 11 10:40:00 UTC 2016
Modified Files: src/sys/arch/amd64/amd64: locore.S Log Message: KNF and simplify Xen To generate a diff of this commit: cvs rdiff -u -r1.110 -r1.111 src/sys/arch/amd64/amd64/locore.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/amd64/amd64/locore.S diff -u src/sys/arch/amd64/amd64/locore.S:1.110 src/sys/arch/amd64/amd64/locore.S:1.111 --- src/sys/arch/amd64/amd64/locore.S:1.110 Sun Oct 16 10:51:31 2016 +++ src/sys/arch/amd64/amd64/locore.S Fri Nov 11 10:40:00 2016 @@ -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 @@ longmode_hi: /* * 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 @@ longmode_hi: 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 @@ longmode_hi: */ /* - * 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 - */ - - movq $tmpstk, %rax - subq $8, %rax - movq %rax, %rsp + * 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 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 */