This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / arch / mips / kernel / head.S
index 89a8456..2e9122a 100644 (file)
 #include <asm/page.h>
 #include <asm/mipsregs.h>
 #include <asm/stackframe.h>
-#ifdef CONFIG_SGI_IP27
-#include <asm/sn/addrs.h>
-#include <asm/sn/sn0/hubni.h>
-#include <asm/sn/klkernvars.h>
-#endif
+
+#include <kernel-entry-init.h>
 
        .macro  ARC64_TWIDDLE_PC
 #if defined(CONFIG_ARC64) || defined(CONFIG_MAPPED_KERNEL)
 #endif
        .endm
 
-#ifdef CONFIG_SGI_IP27
-       /*
-        * outputs the local nasid into res.  IP27 stuff.
-        */
-       .macro GET_NASID_ASM res
-       dli     \res, LOCAL_HUB_ADDR(NI_STATUS_REV_ID)
-       ld      \res, (\res)
-       and     \res, NSRI_NODEID_MASK
-       dsrl    \res, NSRI_NODEID_SHFT
-       .endm
-#endif /* CONFIG_SGI_IP27 */
-
        /*
         * inputs are the text nasid in t1, data nasid in t2.
         */
        .endm
 
        /*
-        * For the moment set ST0_KU so the CPU will not spit fire when
-        * executing 64-bit instructions.  The full initialization of the
-        * CPU's status register is done later in per_cpu_trap_init().
+        * For the moment disable interrupts, mark the kernel mode and
+        * set ST0_KX so that the CPU does not spit fire when using
+        * 64-bit addresses.  A full initialization of the CPU's status
+        * register is done later in per_cpu_trap_init().
         */
-       .macro  setup_c0_status
-#ifdef CONFIG_MIPS64
+       .macro  setup_c0_status set clr
+       .set    push
        mfc0    t0, CP0_STATUS
-       or      t0, ST0_KX
+       or      t0, ST0_CU0|\set|0x1f|\clr
+       xor     t0, 0x1f|\clr
        mtc0    t0, CP0_STATUS
+       .set    noreorder
+       sll     zero,3                          # ehb
+       .set    pop
+       .endm
+
+       .macro  setup_c0_status_pri
+#ifdef CONFIG_64BIT
+       setup_c0_status ST0_KX 0
+#else
+       setup_c0_status 0 0
+#endif
+       .endm
+
+       .macro  setup_c0_status_sec
+#ifdef CONFIG_64BIT
+       setup_c0_status ST0_KX ST0_BEV
+#else
+       setup_c0_status 0 ST0_BEV
 #endif
        .endm
 
 EXPORT(stext)                                  # used for profiling
 EXPORT(_stext)
 
+#if defined(CONFIG_QEMU) || defined(CONFIG_MIPS_SIM)
+       /*
+        * Give us a fighting chance of running if execution beings at the
+        * kernel load address.  This is needed because this platform does
+        * not have a ELF loader yet.
+        */
+       j       kernel_entry
+#endif
        __INIT
 
 NESTED(kernel_entry, 16, sp)                   # kernel entry point
-       setup_c0_status
 
-#ifdef CONFIG_SGI_IP27
-       GET_NASID_ASM   t1
-       move    t2, t1                          # text and data are here
-       MAPPED_KERNEL_SETUP_TLB
-#endif /* IP27 */
+       kernel_entry_setup                      # cpu specific setup
 
-       ARC64_TWIDDLE_PC
+       setup_c0_status_pri
 
-       CLI                                     # disable interrupts
+       ARC64_TWIDDLE_PC
 
        PTR_LA          t0, __bss_start         # clear .bss
        LONG_S          zero, (t0)
@@ -139,36 +147,28 @@ NESTED(kernel_entry, 16, sp)                      # kernel entry point
        LONG_S          a2, fw_arg2
        LONG_S          a3, fw_arg3
 
+       MTC0            zero, CP0_CONTEXT       # clear context register
        PTR_LA          $28, init_thread_union
        PTR_ADDIU       sp, $28, _THREAD_SIZE - 32
        set_saved_sp    sp, t0, t1
        PTR_SUBU        sp, 4 * SZREG           # init stack pointer
 
-       jal             start_kernel
+       j               start_kernel
        END(kernel_entry)
 
+#ifdef CONFIG_QEMU
+       __INIT
+#endif
+
 #ifdef CONFIG_SMP
 /*
  * SMP slave cpus entry point.  Board specific code for bootstrap calls this
  * function after setting up the stack and gp registers.
  */
 NESTED(smp_bootstrap, 16, sp)
-#ifdef CONFIG_SGI_IP27
-       GET_NASID_ASM   t1
-       dli     t0, KLDIR_OFFSET + (KLI_KERN_VARS * KLDIR_ENT_SIZE) + \
-                   KLDIR_OFF_POINTER + CAC_BASE
-       dsll    t1, NASID_SHFT
-       or      t0, t0, t1
-       ld      t0, 0(t0)                       # t0 points to kern_vars struct
-       lh      t1, KV_RO_NASID_OFFSET(t0)
-       lh      t2, KV_RW_NASID_OFFSET(t0)
-       MAPPED_KERNEL_SETUP_TLB
-       ARC64_TWIDDLE_PC
-#endif /* CONFIG_SGI_IP27 */
-
-       CLI
-       setup_c0_status
-       jal     start_secondary
+       setup_c0_status_sec
+       smp_slave_setup
+       j       start_secondary
        END(smp_bootstrap)
 #endif /* CONFIG_SMP */
 
@@ -182,32 +182,16 @@ NESTED(smp_bootstrap, 16, sp)
        .comm   fw_arg2, SZREG, SZREG
        .comm   fw_arg3, SZREG, SZREG
 
-       .macro  page name, order=0
-       .globl  \name
-\name: .size   \name, (_PAGE_SIZE << \order)
-       .org    . + (_PAGE_SIZE << \order)
-       .type   \name, @object
+       .macro page name, order
+       .comm   \name, (_PAGE_SIZE << \order), (_PAGE_SIZE << \order)
        .endm
 
-       .data
-       .align  PAGE_SHIFT
-
        /*
-        * ... but on 64-bit we've got three-level pagetables with a
-        * slightly different layout ...
+        * On 64-bit we've got three-level pagetables with a slightly
+        * different layout ...
         */
        page    swapper_pg_dir, _PGD_ORDER
-#ifdef CONFIG_MIPS64
+#ifdef CONFIG_64BIT
        page    invalid_pmd_table, _PMD_ORDER
 #endif
        page    invalid_pte_table, _PTE_ORDER
-
-#ifdef CONFIG_MIPS64
-       /*
-        * 64-bit kernel mappings are really screwed up ...
-        */
-       page    kptbl, _PGD_ORDER
-       .globl  ekptbl
-       page    kpmdtbl, 0
-ekptbl:
-#endif