Merge branches 'irq-core-for-linus' and 'core-locking-for-linus' of git://git.kernel...
[pandora-kernel.git] / arch / m68knommu / platform / 68328 / head-de2.S
1
2 #define MEM_END 0x00800000      /* Memory size 8Mb */
3
4 #undef CRT_DEBUG
5
6 .macro  PUTC CHAR
7 #ifdef CRT_DEBUG
8         moveq   #\CHAR, %d7
9         jsr     putc
10 #endif
11 .endm
12
13         .global _start
14         .global _rambase
15         .global _ramvec
16         .global _ramstart
17         .global _ramend
18         
19         .data
20
21 /*
22  *      Set up the usable of RAM stuff
23  */
24 _rambase:
25         .long   0
26 _ramvec:
27         .long   0
28 _ramstart:
29         .long   0
30 _ramend:
31         .long   0
32
33         .text
34
35 _start:
36
37 /*
38  * Setup initial stack
39  */
40         /* disable all interrupts */
41         movew   #0x2700, %sr
42         movel   #-1, 0xfffff304
43         movel   #MEM_END-4, %sp
44
45         PUTC    '\r'
46         PUTC    '\n'
47         PUTC    'A'
48         PUTC    'B'
49
50 /*
51  *      Determine end of RAM
52  */
53
54         movel   #MEM_END, %a0
55         movel   %a0, _ramend
56
57         PUTC    'C'
58
59 /*
60  *      Move ROM filesystem above bss :-)
61  */
62
63         moveal  #_sbss, %a0                     /* romfs at the start of bss */
64         moveal  #_ebss, %a1                     /* Set up destination  */
65         movel   %a0, %a2                        /* Copy of bss start */
66
67         movel   8(%a0), %d1                     /* Get size of ROMFS */
68         addql   #8, %d1                         /* Allow for rounding */
69         andl    #0xfffffffc, %d1        /* Whole words */
70
71         addl    %d1, %a0                        /* Copy from end */
72         addl    %d1, %a1                        /* Copy from end */
73         movel   %a1, _ramstart          /* Set start of ram */
74
75 1:
76         movel   -(%a0), %d0                     /* Copy dword */
77         movel   %d0, -(%a1)
78         cmpl    %a0, %a2                        /* Check if at end */
79         bne     1b
80
81         PUTC    'D'
82
83 /*
84  * Initialize BSS segment to 0
85  */
86
87         lea     _sbss, %a0
88         lea     _ebss, %a1
89
90         /* Copy 0 to %a0 until %a0 == %a1 */
91 2:      cmpal   %a0, %a1
92         beq     1f
93         clrl    (%a0)+
94         bra     2b
95 1:
96
97         PUTC    'E'
98
99 /*
100  * Load the current task pointer and stack
101  */
102
103         lea     init_thread_union, %a0
104         lea     0x2000(%a0), %sp
105
106         PUTC    'F'
107         PUTC    '\r'
108         PUTC    '\n'
109
110 /*
111  * Go
112  */
113
114         jmp     start_kernel
115
116 /*
117  * Local functions
118  */
119  
120 #ifdef CRT_DEBUG
121 putc:
122         moveb   %d7, 0xfffff907
123 1:
124         movew   0xfffff906, %d7
125         andw    #0x2000, %d7
126         beq     1b
127         rts
128 #endif