1 | #
|
---|
2 | # Copyright (c) 2013 Jakub Klama
|
---|
3 | # All rights reserved.
|
---|
4 | #
|
---|
5 | # Redistribution and use in source and binary forms, with or without
|
---|
6 | # modification, are permitted provided that the following conditions
|
---|
7 | # are met:
|
---|
8 | #
|
---|
9 | # - Redistributions of source code must retain the above copyright
|
---|
10 | # notice, this list of conditions and the following disclaimer.
|
---|
11 | # - Redistributions in binary form must reproduce the above copyright
|
---|
12 | # notice, this list of conditions and the following disclaimer in the
|
---|
13 | # documentation and/or other materials provided with the distribution.
|
---|
14 | # - The name of the author may not be used to endorse or promote products
|
---|
15 | # derived from this software without specific prior written permission.
|
---|
16 | #
|
---|
17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
27 | #
|
---|
28 |
|
---|
29 | .text
|
---|
30 |
|
---|
31 | .global kernel_image_start
|
---|
32 | .global early_putchar
|
---|
33 | .global kernel_sp
|
---|
34 | .global uspace_wbuf
|
---|
35 |
|
---|
36 | kernel_image_start:
|
---|
37 | # Install trap handlers
|
---|
38 | set trap_table, %g1
|
---|
39 | mov %g1, %tbr
|
---|
40 |
|
---|
41 | mov %psr, %g1 ! Initialize WIM
|
---|
42 | add %g1, 1, %g2
|
---|
43 | and %g2, 0x7, %g2
|
---|
44 | set 1, %g3
|
---|
45 | sll %g3, %g2, %g3
|
---|
46 | mov %g3, %wim
|
---|
47 |
|
---|
48 | or %g1, 0x20, %g1
|
---|
49 | or %g1, 0xf00, %g1 ! PIL
|
---|
50 | wr %g1, %psr
|
---|
51 |
|
---|
52 | set boot_stack, %sp
|
---|
53 | mov %sp, %fp
|
---|
54 | sub %sp, 96, %sp
|
---|
55 |
|
---|
56 | mov %o1, %l1
|
---|
57 | set 0xdeadbeef, %o0
|
---|
58 | set 0xdeadbeef, %o1
|
---|
59 | set 0, %o2
|
---|
60 | call write_to_invalid
|
---|
61 | nop
|
---|
62 |
|
---|
63 | mov %l1, %o1
|
---|
64 | call arch_pre_main
|
---|
65 | nop
|
---|
66 |
|
---|
67 | call main_bsp
|
---|
68 | nop
|
---|
69 |
|
---|
70 | early_putchar:
|
---|
71 | set 0x80000100, %l0
|
---|
72 | cmp %o0, '\n'
|
---|
73 | bne skip
|
---|
74 |
|
---|
75 | set '\r', %l1
|
---|
76 | sta %l1, [%l0] 0x1c
|
---|
77 |
|
---|
78 | skip:
|
---|
79 | sta %o0, [%l0] 0x1c
|
---|
80 | retl
|
---|
81 | nop
|
---|
82 |
|
---|
83 | kernel_sp:
|
---|
84 | .space 4
|
---|
85 |
|
---|
86 | uspace_wbuf:
|
---|
87 | .space 4
|
---|
88 |
|
---|
89 | .align 16
|
---|
90 | .space 4096
|
---|
91 | boot_stack:
|
---|