mirror of
https://github.com/ivoszbg/uniLoader.git
synced 2024-11-21 11:30:06 +00:00
arch: aarch64: Set up Stack Pointer
Introduce stack and bss memory regions, rename Start.S to start.S This commit should allow jumping out of assembly code for certain SoCs that had issues with SP like MTK and QCOM. Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
This commit is contained in:
parent
4a0977b0f6
commit
54d3d93a92
4
Makefile
4
Makefile
@ -340,8 +340,8 @@ endif # $(dot-config)
|
||||
all: arch/$(ARCH)/linker.lds uniLoader
|
||||
|
||||
# List of main executables
|
||||
main-y := main/main.o
|
||||
main-y += arch/$(ARCH)/Start.o
|
||||
main-y := arch/$(ARCH)/start.o \
|
||||
main/main.o
|
||||
|
||||
# Object directories
|
||||
objs-y := main
|
||||
|
@ -1 +1 @@
|
||||
obj-y += $(ARCH)/Start.o
|
||||
obj-y += $(ARCH)/start.o
|
||||
|
@ -1,12 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (c) 2022, Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
|
||||
*/
|
||||
|
||||
adr x0, dtb
|
||||
adr x1, kernel
|
||||
b main
|
||||
|
||||
.global load_kernel
|
||||
load_kernel:
|
||||
br x4
|
@ -13,15 +13,30 @@ INPUT(DTB_PATH)
|
||||
SECTIONS
|
||||
{
|
||||
.boot : {
|
||||
arch/aarch64/Start.o
|
||||
arch/aarch64/start.o
|
||||
}
|
||||
|
||||
.dtb ALIGN(0x1000) : {
|
||||
.text : {
|
||||
*(.text)
|
||||
}
|
||||
|
||||
.bss ALIGN(4096) : {
|
||||
_bss_start = .;
|
||||
. = . + 4096;
|
||||
_bss_end = .;
|
||||
}
|
||||
|
||||
.stack ALIGN(4096) : {
|
||||
. = . + 4096;
|
||||
_stack_end = .;
|
||||
}
|
||||
|
||||
.dtb ALIGN(4096) : {
|
||||
dtb = .;
|
||||
DTB_PATH
|
||||
}
|
||||
|
||||
.kernel ALIGN(0x1000) : {
|
||||
.kernel ALIGN(4096) : {
|
||||
kernel = .;
|
||||
KERNEL_PATH
|
||||
}
|
||||
|
15
arch/aarch64/macros.h
Normal file
15
arch/aarch64/macros.h
Normal file
@ -0,0 +1,15 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (c) 2022, Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
|
||||
*/
|
||||
|
||||
.macro ENTRY name
|
||||
.globl \name
|
||||
.type \name, %function
|
||||
.align 2
|
||||
\name:
|
||||
.endm
|
||||
|
||||
.macro ENDPROC name
|
||||
.size \name, . - \name
|
||||
.endm
|
22
arch/aarch64/start.S
Normal file
22
arch/aarch64/start.S
Normal file
@ -0,0 +1,22 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (c) 2022, Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
|
||||
*/
|
||||
.include "arch/aarch64/macros.h"
|
||||
|
||||
.section .text
|
||||
ENTRY _start
|
||||
/* Set up the base address for the stack */
|
||||
adr x0, _stack_end
|
||||
|
||||
/* Set up the stack pointer (SP) */
|
||||
mov sp, x0
|
||||
|
||||
/* Fall through */
|
||||
adr x0, dtb
|
||||
adr x1, kernel
|
||||
b main
|
||||
|
||||
ENTRY load_kernel
|
||||
br x4
|
||||
ENDPROC load_kernel
|
@ -14,7 +14,7 @@ SECTIONS
|
||||
. = __start_address;
|
||||
|
||||
.boot : {
|
||||
arch/arm/Start.o
|
||||
arch/arm/start.o
|
||||
}
|
||||
|
||||
.dtb ALIGN(0x1000) : {
|
||||
|
Loading…
Reference in New Issue
Block a user