From 78a864c433ffad18e0d7e1d34c68c378c868aa9f Mon Sep 17 00:00:00 2001 From: Berkus Decker Date: Tue, 1 Nov 2022 20:33:59 +0200 Subject: [PATCH] =?UTF-8?q?refactor(linker):=20=F0=9F=93=A6=20Share=20exce?= =?UTF-8?q?ption=20handlers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/chainboot/src/link.ld | 2 ++ linker/aarch64-exceptions.ld | 19 +++++++++++++++++++ linker/aarch64.ld | 20 +------------------- nucleus/build.rs | 2 ++ 4 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 linker/aarch64-exceptions.ld diff --git a/bin/chainboot/src/link.ld b/bin/chainboot/src/link.ld index d940a7c..839af8d 100644 --- a/bin/chainboot/src/link.ld +++ b/bin/chainboot/src/link.ld @@ -97,3 +97,5 @@ SECTIONS /DISCARD/ : { *(.comment) *(.gnu*) *(.note*) *(.eh_frame*) *(.text.boot*)} } + +INCLUDE linker/aarch64-exceptions.ld diff --git a/linker/aarch64-exceptions.ld b/linker/aarch64-exceptions.ld new file mode 100644 index 0000000..1f125d0 --- /dev/null +++ b/linker/aarch64-exceptions.ld @@ -0,0 +1,19 @@ +PROVIDE(current_el0_synchronous = default_exception_handler); +PROVIDE(current_el0_irq = default_exception_handler); +PROVIDE(current_el0_fiq = default_exception_handler); +PROVIDE(current_el0_serror = default_exception_handler); + +PROVIDE(current_elx_synchronous = default_exception_handler); +PROVIDE(current_elx_irq = default_exception_handler); +PROVIDE(current_elx_fiq = default_exception_handler); +PROVIDE(current_elx_serror = default_exception_handler); + +PROVIDE(lower_aarch64_synchronous = default_exception_handler); +PROVIDE(lower_aarch64_irq = default_exception_handler); +PROVIDE(lower_aarch64_fiq = default_exception_handler); +PROVIDE(lower_aarch64_serror = default_exception_handler); + +PROVIDE(lower_aarch32_synchronous = default_exception_handler); +PROVIDE(lower_aarch32_irq = default_exception_handler); +PROVIDE(lower_aarch32_fiq = default_exception_handler); +PROVIDE(lower_aarch32_serror = default_exception_handler); diff --git a/linker/aarch64.ld b/linker/aarch64.ld index 5d3e083..5541c9a 100644 --- a/linker/aarch64.ld +++ b/linker/aarch64.ld @@ -65,22 +65,4 @@ SECTIONS /DISCARD/ : { *(.comment) *(.gnu*) *(.note*) *(.eh_frame*) *(.text.chainboot*) } } -PROVIDE(current_el0_synchronous = default_exception_handler); -PROVIDE(current_el0_irq = default_exception_handler); -PROVIDE(current_el0_fiq = default_exception_handler); -PROVIDE(current_el0_serror = default_exception_handler); - -PROVIDE(current_elx_synchronous = default_exception_handler); -PROVIDE(current_elx_irq = default_exception_handler); -PROVIDE(current_elx_fiq = default_exception_handler); -PROVIDE(current_elx_serror = default_exception_handler); - -PROVIDE(lower_aarch64_synchronous = default_exception_handler); -PROVIDE(lower_aarch64_irq = default_exception_handler); -PROVIDE(lower_aarch64_fiq = default_exception_handler); -PROVIDE(lower_aarch64_serror = default_exception_handler); - -PROVIDE(lower_aarch32_synchronous = default_exception_handler); -PROVIDE(lower_aarch32_irq = default_exception_handler); -PROVIDE(lower_aarch32_fiq = default_exception_handler); -PROVIDE(lower_aarch32_serror = default_exception_handler); +INCLUDE linker/aarch64-exceptions.ld diff --git a/nucleus/build.rs b/nucleus/build.rs index da0d01f..75c61c1 100644 --- a/nucleus/build.rs +++ b/nucleus/build.rs @@ -1,6 +1,8 @@ const LINKER_SCRIPT: &str = "linker/aarch64.ld"; +const LINKER_SCRIPT_AUX: &str = "linker/aarch64-exceptions.ld"; fn main() { println!("cargo:rerun-if-changed={}", LINKER_SCRIPT); + println!("cargo:rerun-if-changed={}", LINKER_SCRIPT_AUX); println!("cargo:rustc-link-arg=--script={}", LINKER_SCRIPT); }