blob: 52882119b169a8f97876f08af4149cac9dec7d32 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
/*
* Copyright (c) 2017 Richard Braun.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdalign.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <kern/init.h>
#include <kern/bootmem.h>
#include <machine/boot.h>
#include <machine/cpu.h>
#include <machine/pmap.h>
#include <machine/pmem.h>
#include <vm/vm_kmem.h>
#define BOOT_UART_DATA_REG 0x9000000
alignas(CPU_DATA_ALIGN) char boot_stack[BOOT_STACK_SIZE] __bootdata;
pmap_pte_t * boot_setup_paging(void);
void boot_main(void);
void __boot
boot_panic(const char *s)
{
volatile unsigned long *uart_data_reg;
uart_data_reg = (volatile unsigned long *)BOOT_UART_DATA_REG;
while (*s != '\0') {
*uart_data_reg = *s;
s++;
}
for (;;);
}
pmap_pte_t * __boot
boot_setup_paging(void)
{
bootmem_register_zone(PMEM_ZONE_DMA, true, PMEM_RAM_START, PMEM_DMA_LIMIT);
bootmem_setup();
return pmap_setup_paging();
}
void __init
boot_log_info(void)
{
}
static void __init
boot_clear_bss(void)
{
memset(&_bss, 0, &_end - &_bss);
}
void __init
boot_main(void)
{
boot_clear_bss();
kernel_main();
/* Never reached */
}
/*
* Init operation aliases.
*/
static int __init
boot_bootstrap_console(void)
{
return 0;
}
INIT_OP_DEFINE(boot_bootstrap_console);
static int __init
boot_setup_console(void)
{
return 0;
}
INIT_OP_DEFINE(boot_setup_console);
static int __init
boot_load_vm_page_zones(void)
{
return 0;
}
INIT_OP_DEFINE(boot_load_vm_page_zones);
static int __init
boot_setup_intr(void)
{
return 0;
}
INIT_OP_DEFINE(boot_setup_intr);
static int __init
boot_setup_shutdown(void)
{
return 0;
}
INIT_OP_DEFINE(boot_setup_shutdown);
|