summaryrefslogtreecommitdiffhomepage
path: root/src/ppc64/ppc64-boot.S
diff options
context:
space:
mode:
authorAmlal <amlal.elmahrouss@icloud.com>2025-01-21 20:32:19 +0100
committerAmlal <amlal.elmahrouss@icloud.com>2025-01-21 20:32:19 +0100
commit046d884b50c32cacd3523071541e7e38241083f3 (patch)
tree92ce6fd53e0c031c569270b04aefa8fc0aa1e074 /src/ppc64/ppc64-boot.S
ADD: CoreBoot, also comes with my reimplementation of libfdt, which is just a dumb rewrite.
Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'src/ppc64/ppc64-boot.S')
-rw-r--r--src/ppc64/ppc64-boot.S56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/ppc64/ppc64-boot.S b/src/ppc64/ppc64-boot.S
new file mode 100644
index 0000000..f28b4f3
--- /dev/null
+++ b/src/ppc64/ppc64-boot.S
@@ -0,0 +1,56 @@
+.balign 4
+.section .text
+
+.global mp_reset_vector
+
+mp_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 mp_init_hw
+ /* finally execute the firmware */
+ bl mp_start_exec
+ /* return value from main is argument to exit */
+ bl mp_reset_vector
+
+ trap
+
+.global mp_start_rom
+.global mp_start_context
+.global mp_boot_processor_ready
+
+.equ SYS_BOOT_ADDR, 0x1030000
+
+mp_start_rom:
+ lis 3, SYS_BOOT_ADDR@h
+ addi 3, 3, SYS_BOOT_ADDR@l
+
+ blr
+
+mp_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
+
+mp_boot_processor_ready:
+ .word 0