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
|
/*
// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org)
// Distributed under the Apache Software License, Version 2.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.apache.org/licenses/LICENSE-2.0)
// Official repository: https://github.com/nekernel-org/neboot
*/
.balign 4
.section .text
.global nb_reset_vector
nb_reset_vector:
bl .Laddr /* get current address */
.Laddr:
mflr 4 /* real address of .Laddr */
lwz 0,(.Lstk-.Laddr)(4) /* stack address location */
mr 1,0 /* use user defined stack */
addi 1,1,-4 /* make sure we don't overwrite debug mem */
lis 0,0
stw 0,0(1) /* clear back chain */
stwu 1,-64(1) /* push another stack frame */
/* Let her rip */
bl nb_init_hw
/* finally execute the firmware */
bl nb_start_exec
/* return value from main is argument to exit */
bl nb_reset_vector
trap
.global nb_start_rom
.global nb_start_context
.global nb_boot_processor_ready
.equ NB_BOOT_ADDR, 0x1030000
nb_start_rom:
lis 3, NB_BOOT_ADDR@h
addi 3, 3, NB_BOOT_ADDR@l
blr
nb_start_context:
li 4, 0
cmp 0, 0, 4, 3
blt run_context
mr 3, 31
blr
run_context:
blr /* r3 is filled here */
.Lstk:
/* .long __stack*/
.long stack_top
.data
nb_boot_processor_ready:
.word 0
|