From 208f547f296721d3342d42de968dc804324b0cd2 Mon Sep 17 00:00:00 2001 From: Andre Richter Date: Tue, 6 Oct 2020 00:01:50 +0200 Subject: [PATCH] Remove needless extern C --- 02_runtime_init/README.md | 2 +- 02_runtime_init/src/runtime_init.rs | 2 +- 03_hacky_hello_world/src/runtime_init.rs | 2 +- 04_zero_overhead_abstraction/README.md | 9 +++------ 04_zero_overhead_abstraction/src/_arch/aarch64/cpu.rs | 2 +- 05_safe_globals/src/_arch/aarch64/cpu.rs | 2 +- 06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs | 2 +- 07_uart_chainloader/README.md | 2 +- 07_uart_chainloader/src/_arch/aarch64/cpu.rs | 2 +- 08_timestamps/README.md | 2 +- 08_timestamps/src/_arch/aarch64/cpu.rs | 2 +- 09_hw_debug_JTAG/src/_arch/aarch64/cpu.rs | 2 +- 10_privilege_level/README.md | 2 +- 10_privilege_level/src/_arch/aarch64/cpu.rs | 2 +- .../src/_arch/aarch64/cpu.rs | 2 +- 12_exceptions_part1_groundwork/src/_arch/aarch64/cpu.rs | 2 +- 13_integrated_testing/src/_arch/aarch64/cpu.rs | 2 +- .../src/_arch/aarch64/cpu.rs | 2 +- 15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu.rs | 2 +- 19 files changed, 21 insertions(+), 24 deletions(-) diff --git a/02_runtime_init/README.md b/02_runtime_init/README.md index 2b098e4e..72e5f84b 100644 --- a/02_runtime_init/README.md +++ b/02_runtime_init/README.md @@ -223,7 +223,7 @@ diff -uNr 01_wait_forever/src/runtime_init.rs 02_runtime_init/src/runtime_init.r +/// +/// - Only a single core must be active and running this function. +#[no_mangle] -+pub unsafe extern "C" fn runtime_init() -> ! { ++pub unsafe fn runtime_init() -> ! { + zero_bss(); + + crate::kernel_init() diff --git a/02_runtime_init/src/runtime_init.rs b/02_runtime_init/src/runtime_init.rs index 3e62cf08..0e3702b4 100644 --- a/02_runtime_init/src/runtime_init.rs +++ b/02_runtime_init/src/runtime_init.rs @@ -31,7 +31,7 @@ unsafe fn zero_bss() { /// /// - Only a single core must be active and running this function. #[no_mangle] -pub unsafe extern "C" fn runtime_init() -> ! { +pub unsafe fn runtime_init() -> ! { zero_bss(); crate::kernel_init() diff --git a/03_hacky_hello_world/src/runtime_init.rs b/03_hacky_hello_world/src/runtime_init.rs index 3e62cf08..0e3702b4 100644 --- a/03_hacky_hello_world/src/runtime_init.rs +++ b/03_hacky_hello_world/src/runtime_init.rs @@ -31,7 +31,7 @@ unsafe fn zero_bss() { /// /// - Only a single core must be active and running this function. #[no_mangle] -pub unsafe extern "C" fn runtime_init() -> ! { +pub unsafe fn runtime_init() -> ! { zero_bss(); crate::kernel_init() diff --git a/04_zero_overhead_abstraction/README.md b/04_zero_overhead_abstraction/README.md index 804cdf10..06f1b4f8 100644 --- a/04_zero_overhead_abstraction/README.md +++ b/04_zero_overhead_abstraction/README.md @@ -79,7 +79,7 @@ diff -uNr 03_hacky_hello_world/src/_arch/aarch64/cpu.rs 04_zero_overhead_abstrac +/// - Linker script must ensure to place this function at `0x80_000`. +#[naked] +#[no_mangle] -+pub unsafe extern "C" fn _start() -> ! { ++pub unsafe fn _start() -> ! { + use crate::runtime_init; + + // Expect the boot core to start in EL2. @@ -248,15 +248,12 @@ diff -uNr 03_hacky_hello_world/src/main.rs 04_zero_overhead_abstraction/src/main diff -uNr 03_hacky_hello_world/src/runtime_init.rs 04_zero_overhead_abstraction/src/runtime_init.rs --- 03_hacky_hello_world/src/runtime_init.rs +++ 04_zero_overhead_abstraction/src/runtime_init.rs -@@ -30,8 +30,7 @@ +@@ -30,7 +30,6 @@ /// # Safety /// /// - Only a single core must be active and running this function. -#[no_mangle] --pub unsafe extern "C" fn runtime_init() -> ! { -+pub unsafe fn runtime_init() -> ! { + pub unsafe fn runtime_init() -> ! { zero_bss(); - crate::kernel_init() - ``` diff --git a/04_zero_overhead_abstraction/src/_arch/aarch64/cpu.rs b/04_zero_overhead_abstraction/src/_arch/aarch64/cpu.rs index 28156ec8..d49c8aba 100644 --- a/04_zero_overhead_abstraction/src/_arch/aarch64/cpu.rs +++ b/04_zero_overhead_abstraction/src/_arch/aarch64/cpu.rs @@ -20,7 +20,7 @@ use cortex_a::{asm, regs::*}; /// - Linker script must ensure to place this function at `0x80_000`. #[naked] #[no_mangle] -pub unsafe extern "C" fn _start() -> ! { +pub unsafe fn _start() -> ! { use crate::runtime_init; // Expect the boot core to start in EL2. diff --git a/05_safe_globals/src/_arch/aarch64/cpu.rs b/05_safe_globals/src/_arch/aarch64/cpu.rs index 28156ec8..d49c8aba 100644 --- a/05_safe_globals/src/_arch/aarch64/cpu.rs +++ b/05_safe_globals/src/_arch/aarch64/cpu.rs @@ -20,7 +20,7 @@ use cortex_a::{asm, regs::*}; /// - Linker script must ensure to place this function at `0x80_000`. #[naked] #[no_mangle] -pub unsafe extern "C" fn _start() -> ! { +pub unsafe fn _start() -> ! { use crate::runtime_init; // Expect the boot core to start in EL2. diff --git a/06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs b/06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs index f2d96678..9b2da60d 100644 --- a/06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs +++ b/06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs @@ -20,7 +20,7 @@ use cortex_a::{asm, regs::*}; /// - Linker script must ensure to place this function at `0x80_000`. #[naked] #[no_mangle] -pub unsafe extern "C" fn _start() -> ! { +pub unsafe fn _start() -> ! { use crate::runtime_init; // Expect the boot core to start in EL2. diff --git a/07_uart_chainloader/README.md b/07_uart_chainloader/README.md index c87ea43c..5700176b 100644 --- a/07_uart_chainloader/README.md +++ b/07_uart_chainloader/README.md @@ -181,7 +181,7 @@ diff -uNr 06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs 07_uart_chainloader/src/ @@ -21,12 +21,12 @@ #[naked] #[no_mangle] - pub unsafe extern "C" fn _start() -> ! { + pub unsafe fn _start() -> ! { - use crate::runtime_init; + use crate::relocate; diff --git a/07_uart_chainloader/src/_arch/aarch64/cpu.rs b/07_uart_chainloader/src/_arch/aarch64/cpu.rs index 8eed0deb..7a4573c5 100644 --- a/07_uart_chainloader/src/_arch/aarch64/cpu.rs +++ b/07_uart_chainloader/src/_arch/aarch64/cpu.rs @@ -20,7 +20,7 @@ use cortex_a::{asm, regs::*}; /// - Linker script must ensure to place this function at `0x80_000`. #[naked] #[no_mangle] -pub unsafe extern "C" fn _start() -> ! { +pub unsafe fn _start() -> ! { use crate::relocate; // Expect the boot core to start in EL2. diff --git a/08_timestamps/README.md b/08_timestamps/README.md index d4af4f66..a5bc09c9 100644 --- a/08_timestamps/README.md +++ b/08_timestamps/README.md @@ -106,7 +106,7 @@ diff -uNr 07_uart_chainloader/src/_arch/aarch64/cpu.rs 08_timestamps/src/_arch/a @@ -21,12 +21,12 @@ #[naked] #[no_mangle] - pub unsafe extern "C" fn _start() -> ! { + pub unsafe fn _start() -> ! { - use crate::relocate; + use crate::runtime_init; diff --git a/08_timestamps/src/_arch/aarch64/cpu.rs b/08_timestamps/src/_arch/aarch64/cpu.rs index f2d96678..9b2da60d 100644 --- a/08_timestamps/src/_arch/aarch64/cpu.rs +++ b/08_timestamps/src/_arch/aarch64/cpu.rs @@ -20,7 +20,7 @@ use cortex_a::{asm, regs::*}; /// - Linker script must ensure to place this function at `0x80_000`. #[naked] #[no_mangle] -pub unsafe extern "C" fn _start() -> ! { +pub unsafe fn _start() -> ! { use crate::runtime_init; // Expect the boot core to start in EL2. diff --git a/09_hw_debug_JTAG/src/_arch/aarch64/cpu.rs b/09_hw_debug_JTAG/src/_arch/aarch64/cpu.rs index f2d96678..9b2da60d 100644 --- a/09_hw_debug_JTAG/src/_arch/aarch64/cpu.rs +++ b/09_hw_debug_JTAG/src/_arch/aarch64/cpu.rs @@ -20,7 +20,7 @@ use cortex_a::{asm, regs::*}; /// - Linker script must ensure to place this function at `0x80_000`. #[naked] #[no_mangle] -pub unsafe extern "C" fn _start() -> ! { +pub unsafe fn _start() -> ! { use crate::runtime_init; // Expect the boot core to start in EL2. diff --git a/10_privilege_level/README.md b/10_privilege_level/README.md index aea968d2..68046efe 100644 --- a/10_privilege_level/README.md +++ b/10_privilege_level/README.md @@ -228,7 +228,7 @@ diff -uNr 09_hw_debug_JTAG/src/_arch/aarch64/cpu.rs 10_privilege_level/src/_arch @@ -21,18 +21,59 @@ #[naked] #[no_mangle] - pub unsafe extern "C" fn _start() -> ! { + pub unsafe fn _start() -> ! { - use crate::runtime_init; - // Expect the boot core to start in EL2. diff --git a/10_privilege_level/src/_arch/aarch64/cpu.rs b/10_privilege_level/src/_arch/aarch64/cpu.rs index b066da5e..ab7c6047 100644 --- a/10_privilege_level/src/_arch/aarch64/cpu.rs +++ b/10_privilege_level/src/_arch/aarch64/cpu.rs @@ -20,7 +20,7 @@ use cortex_a::{asm, regs::*}; /// - Linker script must ensure to place this function at `0x80_000`. #[naked] #[no_mangle] -pub unsafe extern "C" fn _start() -> ! { +pub unsafe fn _start() -> ! { // Expect the boot core to start in EL2. if (bsp::cpu::BOOT_CORE_ID == cpu::smp::core_id()) && (CurrentEL.get() == CurrentEL::EL::EL2.value) diff --git a/11_virtual_mem_part1_identity_mapping/src/_arch/aarch64/cpu.rs b/11_virtual_mem_part1_identity_mapping/src/_arch/aarch64/cpu.rs index b066da5e..ab7c6047 100644 --- a/11_virtual_mem_part1_identity_mapping/src/_arch/aarch64/cpu.rs +++ b/11_virtual_mem_part1_identity_mapping/src/_arch/aarch64/cpu.rs @@ -20,7 +20,7 @@ use cortex_a::{asm, regs::*}; /// - Linker script must ensure to place this function at `0x80_000`. #[naked] #[no_mangle] -pub unsafe extern "C" fn _start() -> ! { +pub unsafe fn _start() -> ! { // Expect the boot core to start in EL2. if (bsp::cpu::BOOT_CORE_ID == cpu::smp::core_id()) && (CurrentEL.get() == CurrentEL::EL::EL2.value) diff --git a/12_exceptions_part1_groundwork/src/_arch/aarch64/cpu.rs b/12_exceptions_part1_groundwork/src/_arch/aarch64/cpu.rs index b066da5e..ab7c6047 100644 --- a/12_exceptions_part1_groundwork/src/_arch/aarch64/cpu.rs +++ b/12_exceptions_part1_groundwork/src/_arch/aarch64/cpu.rs @@ -20,7 +20,7 @@ use cortex_a::{asm, regs::*}; /// - Linker script must ensure to place this function at `0x80_000`. #[naked] #[no_mangle] -pub unsafe extern "C" fn _start() -> ! { +pub unsafe fn _start() -> ! { // Expect the boot core to start in EL2. if (bsp::cpu::BOOT_CORE_ID == cpu::smp::core_id()) && (CurrentEL.get() == CurrentEL::EL::EL2.value) diff --git a/13_integrated_testing/src/_arch/aarch64/cpu.rs b/13_integrated_testing/src/_arch/aarch64/cpu.rs index 1838dd0d..e7fe1711 100644 --- a/13_integrated_testing/src/_arch/aarch64/cpu.rs +++ b/13_integrated_testing/src/_arch/aarch64/cpu.rs @@ -20,7 +20,7 @@ use cortex_a::{asm, regs::*}; /// - Linker script must ensure to place this function at `0x80_000`. #[naked] #[no_mangle] -pub unsafe extern "C" fn _start() -> ! { +pub unsafe fn _start() -> ! { // Expect the boot core to start in EL2. if (bsp::cpu::BOOT_CORE_ID == cpu::smp::core_id()) && (CurrentEL.get() == CurrentEL::EL::EL2.value) diff --git a/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu.rs b/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu.rs index 1838dd0d..e7fe1711 100644 --- a/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu.rs +++ b/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu.rs @@ -20,7 +20,7 @@ use cortex_a::{asm, regs::*}; /// - Linker script must ensure to place this function at `0x80_000`. #[naked] #[no_mangle] -pub unsafe extern "C" fn _start() -> ! { +pub unsafe fn _start() -> ! { // Expect the boot core to start in EL2. if (bsp::cpu::BOOT_CORE_ID == cpu::smp::core_id()) && (CurrentEL.get() == CurrentEL::EL::EL2.value) diff --git a/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu.rs b/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu.rs index 6d41d19d..59840838 100644 --- a/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu.rs +++ b/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu.rs @@ -20,7 +20,7 @@ use cortex_a::{asm, regs::*}; /// - Linker script must ensure to place this function at `0x80_000`. #[naked] #[no_mangle] -pub unsafe extern "C" fn _start() -> ! { +pub unsafe fn _start() -> ! { // Expect the boot core to start in EL2. if (bsp::cpu::BOOT_CORE_ID == cpu::smp::core_id()) && (CurrentEL.get() == CurrentEL::EL::EL2.value)