summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu/setupc_64.S
Commit message (Collapse)AuthorAgeFilesLines
* ARM64: cpu: setupc: rewrite to be fully PICAhmad Fatoum2024-03-051-13/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code resulting from building the barebox ARM64 assembly contains relocations, which could've been position-independent just as well. Let's make them truly position independent by turning: ldr x0, =label into adr_l x0, label adr_l is position independent by virtue of being implemented using adrp, so it's usuable as-is before relocation and requires no manual addition of get_runtime_offset(). With these changes, only relocation necessary for the ARM64 generic DT 2nd stage is the one needed for get_runtime_offset() to find out whether barebox has been relocated. This is one step towards supporting mapping barebox PBL text section W^X, which precludes relocation entries emitted for code. With this change applied, there is still a data relocation entry in assembly code for get_runtime_offset(), but that doesn't bother us because it's in the data section. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240304190038.3486881-57-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM64: setupc: don't invoke KASAN before relocationAhmad Fatoum2023-04-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | Plain memset and memcpy are checked by KASAN if enabled before calling unchecked __memset and __memcpy respectively. KASAN uses a kasan_initialized variable as first condition in its memory check, but that only works after relocation. For that reason, we must take care not to invoke KASAN before then. This was done for ARM32, but was missing for ARM64. Do so now. This fixes an annoying issue where network booting a KASAN-enabled barebox twice in a row would fail: The first happened to work because the memory kasan_initialized was placed at was zero. The second would behave erratically, because BSS initialization would silently fail and barebox static storage would then be initialized with the final values of the previous run. Fixes: 932ef7a02e2f ("ARM: Add KASan support") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230415083447.3069903-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pbl: replace __piggydata_end with __image_endAhmad Fatoum2022-08-221-1/+1
| | | | | | | | | | | | | | | __piggydata_end and __image_end used to be synonyms before the addition of external firmware. Now that external firmware is located after __piggydata_end, code using it needs to be revisited. There's no reason to have code reference __piggydata_end. Either they want all the rest of the image, so they should use __image_end instead or they want just the piggy data, in which case they can read the data size embedded into the piggydata itself. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220818050447.2072932-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* arch: add SPDX-License-Identifier to all .S filesAhmad Fatoum2022-01-051-0/+2
| | | | | | | | | Record GPL-2.0-only as license for all files lacking an explicit license statement. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220103120539.1730644-10-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: Add relocate_to_adr_full()Sascha Hauer2021-06-211-3/+10
| | | | | | | | | | | | | | relocate_to_adr() currently relocates the PBL code to another address, but doesn't move the piggy data (compressed barebox image). This patch adds relocate_to_adr_full() which moves the full image including the piggy data. This is needed for upcoming Rockchip RK3568 support. Here we are started at address 0x0, but must move away from that address as this is where the ATF/OP-Tee binaries are expected to be loaded. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210615141641.31577-6-s.hauer@pengutronix.de Link: https://lore.barebox.org/20210621092802.27275-6-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: introduce sync_caches_for_executionSascha Hauer2019-05-131-3/+2
| | | | | | | | | | | | | | | | | | | We have several places in the code which which prepares just modified code for execution. This is done differently in all the places, so add a common function to be used by all. Most places called arm_early_mmu_cache_flush(). This function includes invalidating the instruction cache, so doing it again is unnecessary. Sometimes we had arm_early_mmu_cache_flush() inside #ifdef CONFIG_MMU. The ifdef seems unnecessary since we do not have it consistently, so remove the ifdef. Some early i.MX xload code had icache_invalidate() but forgot to flush the caches. Replace the instruction cache invalidation with sync_caches_for_execution(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: aarch64: Add relocation supportSascha Hauer2018-03-231-0/+60
| | | | | | | | | | This adds aarch64 support for relocating binaries linked with -pie. Support is integrated into the already exisiting relocate_to_current_adr() function which is now used for both arm32 and aarch64. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* arm: cpu: add arm64 specific codeRaphael Poggi2016-07-061-0/+18
This patch adds arm64 specific codes, which are: - exception support - cache support - rework Makefile to support arm64 Signed-off-by: Raphael Poggi <poggi.raph@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>