zephyr/arch/arm64/core/prep_c.c
Carlo Caione 3539c2fbb3 arm/arm64: Make ARM64 a standalone architecture
Split ARM and ARM64 architectures.

Details:

- CONFIG_ARM64 is decoupled from CONFIG_ARM (not a subset anymore)
- Arch and include AArch64 files are in a dedicated directory
  (arch/arm64 and include/arch/arm64)
- AArch64 boards and SoC are moved to soc/arm64 and boards/arm64
- AArch64-specific DTS files are moved to dts/arm64
- The A72 support for the bcm_vk/viper board is moved in the
  boards/bcm_vk/viper directory

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-03-31 10:34:33 -05:00

68 lines
1.2 KiB
C

/*
* Copyright (c) 2019 Carlo Caione <ccaione@baylibre.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief Full C support initialization
*
* Initialization of full C support: zero the .bss and call z_cstart().
*
* Stack is available in this module, but not the global data/bss until their
* initialization is performed.
*/
#include <kernel_internal.h>
#include <linker/linker-defs.h>
extern FUNC_NORETURN void z_cstart(void);
#ifdef CONFIG_ARM_MMU
extern void z_arm64_mmu_init(void);
#else
static inline void z_arm64_mmu_init(void) { }
#endif
static inline void z_arm64_bss_zero(void)
{
uint64_t *p = (uint64_t *)__bss_start;
uint64_t *end = (uint64_t *)__bss_end;
while (p < end) {
*p++ = 0;
}
}
/**
*
* @brief Prepare to and run C code
*
* This routine prepares for the execution of and runs C code.
*
* @return N/A
*/
void z_arm64_prep_c(void)
{
z_arm64_bss_zero();
#ifdef CONFIG_XIP
z_data_copy();
#endif
z_arm64_mmu_init();
z_arm64_interrupt_init();
z_cstart();
CODE_UNREACHABLE;
}
#if CONFIG_MP_NUM_CPUS > 1
extern FUNC_NORETURN void z_arm64_secondary_start(void);
void z_arm64_secondary_prep_c(void)
{
z_arm64_secondary_start();
CODE_UNREACHABLE;
}
#endif