import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / m68k / kernel / sun3-head.S
1 #include <linux/linkage.h>
2
3 #include <asm/page.h>
4 #include <asm/contregs.h>
5 #include <asm/sun3-head.h>
6
7 PSL_HIGHIPL     = 0x2700
8 NBSG            = 0x20000
9 ICACHE_ONLY     = 0x00000009
10 CACHES_OFF      = 0x00000008    | actually a clear and disable --m
11 #define MAS_STACK INT_STACK 
12 ROOT_TABLE_SIZE = 128
13 PAGESIZE        = 8192
14 SUN3_INVALID_PMEG = 255
15 .globl SYMBOL_NAME(bootup_user_stack)
16 .globl SYMBOL_NAME(bootup_kernel_stack)
17 .globl SYMBOL_NAME(pg0)
18 .globl SYMBOL_NAME(swapper_pg_dir)
19 .globl SYMBOL_NAME(kernel_pmd_table)
20 .globl SYMBOL_NAME(availmem)
21 .global SYMBOL_NAME(m68k_pgtable_cachemode)
22 .global SYMBOL_NAME(kpt)
23 | todo: all these should be in bss!
24 SYMBOL_NAME(swapper_pg_dir):                .skip 0x2000
25 SYMBOL_NAME(pg0):                           .skip 0x2000
26 SYMBOL_NAME(kernel_pmd_table):              .skip 0x2000
27
28 .globl SYMBOL_NAME(kernel_pg_dir)
29 .equ    SYMBOL_NAME(kernel_pg_dir),SYMBOL_NAME(kernel_pmd_table)
30
31         .section .head
32 ENTRY(_stext)
33 ENTRY(_start)
34
35 /* Firstly, disable interrupts and set up function codes. */
36         movew   #PSL_HIGHIPL, %sr
37         moveq   #FC_CONTROL, %d0        
38         movec   %d0, %sfc       
39         movec   %d0, %dfc       
40
41 /* Make sure we're in context zero. */
42         moveq   #0, %d0
43         movsb   %d0, AC_CONTEXT
44
45 /* map everything the bootloader left us into high memory, clean up the
46    excess later */
47         lea     (AC_SEGMAP+0),%a0 
48         lea     (AC_SEGMAP+KERNBASE),%a1        
49 1:      
50         movsb   %a0@, %d1
51         movsb   %d1, %a1@
52         cmpib   #SUN3_INVALID_PMEG, %d1
53         beq     2f
54         addl    #NBSG,%a0
55         addl    #NBSG,%a1
56         jmp     1b
57         
58 2:                              
59         
60 /* Disable caches and jump to high code. */
61         moveq   #ICACHE_ONLY,%d0        | Cache disabled until we're ready to enable it
62         movc    %d0, %cacr      |   is this the right value? (yes --m)
63         jmp     1f:l            
64
65 /* Following code executes at high addresses (0xE000xxx). */
66 1:      lea     SYMBOL_NAME(init_task_union),%a2        | get initial thread...
67         lea     %a2@(KTHREAD_SIZE),%sp                  | ...and its stack.
68
69 /* copy bootinfo records from the loader to _end */
70         lea     SYMBOL_NAME(_end), %a1
71         lea     BI_START, %a0
72         /* number of longs to copy */
73         movel   %a0@, %d0
74 1:      addl    #4, %a0
75         movel   %a0@, %a1@
76         addl    #4, %a1
77         dbf     %d0, 1b
78         
79 /* Point MSP at an invalid page to trap if it's used. --m */
80         movl    #(PAGESIZE),%d0
81         movc    %d0,%msp
82         moveq   #-1,%d0
83         movsb   %d0,(AC_SEGMAP+0x0)
84
85         jbsr    SYMBOL_NAME(sun3_init)
86
87         jbsr    SYMBOL_NAME(base_trap_init)
88                         
89         jbsr    SYMBOL_NAME(start_kernel)
90         trap    #15                     
91
92         .data
93         .even
94 SYMBOL_NAME_LABEL(kpt)
95         .long 0
96 SYMBOL_NAME_LABEL(availmem)
97         .long 0
98 | todo: remove next two. --m
99 SYMBOL_NAME_LABEL(is_medusa)
100         .long 0
101 SYMBOL_NAME_LABEL(m68k_pgtable_cachemode)
102         .long 0
103