summaryrefslogtreecommitdiff
path: root/arch/arm/machine/boot.c
blob: eb054f665ef721f935010a3f2efe4f8c259bf85a (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
/*
 * 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 <kern/init.h>
#include <machine/boot.h>
#include <machine/cpu.h>
#include <machine/pmap.h>
#include <vm/vm_kmem.h>

alignas(CPU_DATA_ALIGN) char boot_stack[BOOT_STACK_SIZE] __bootdata;

static char boot_hello_msg[] __bootdata = "Hello, world!\r\n";

static void __boot
boot_hello_world(void)
{
    volatile unsigned long *uart_data_reg = (volatile unsigned long *)0x9000000;
    const char *s = boot_hello_msg;

    while (*s != '\0') {
        *uart_data_reg = *s;
        s++;
    }
}

void boot_setup_paging(void);

void __boot
boot_setup_paging(void)
{
    boot_hello_world();

    for (;;);
}

void __init
boot_log_info(void)
{
}

/*
 * 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);