From 51bc0a065c7e7ba5b811e9c4400087fbfcba6516 Mon Sep 17 00:00:00 2001 From: Yasushi SHOJI Date: Thu, 20 Jun 2019 18:28:37 +0900 Subject: [PATCH] linker: Make alignment size for sw_isr_table configurable sw_isr_table has two entries, an argument and an ISR function. The comment on struct _isr_table_entry in include/sw_isr_table.h says that "This allows a table entry to be loaded [...] with one ldmia instruction, on ARM [...]". Some arch, e.g. SPARC, also has a double word load instruction, "ldd", but the instruct must have address align to double word or 8 bytes. This commit makes the table alignment configurable. It allows each architecture to specify it, if needed. The default value is 0 for no alignment. Signed-off-by: Yasushi SHOJI --- arch/Kconfig | 10 ++++++++++ include/linker/common-ram.ld | 6 ++++++ include/linker/common-rom.ld | 6 ++++++ 3 files changed, 22 insertions(+) diff --git a/arch/Kconfig b/arch/Kconfig index 0d884b691b3..41dfe5600cf 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -302,6 +302,16 @@ config GEN_SW_ISR_TABLE _isr_table_entry containing the interrupt service routine and supplied parameter. +config ARCH_SW_ISR_TABLE_ALIGN + int "Alignment size of a software ISR table" + default 0 + depends on GEN_SW_ISR_TABLE + help + This option controls alignment size of generated + _sw_isr_table. Some architecture needs a software ISR table + to be aligned to architecture specific size. The default + size is 0 for no alignment. + config GEN_IRQ_START_VECTOR int default 0 diff --git a/include/linker/common-ram.ld b/include/linker/common-ram.ld index b16adfaa539..ec462b6f07e 100644 --- a/include/linker/common-ram.ld +++ b/include/linker/common-ram.ld @@ -8,6 +8,12 @@ #if defined(CONFIG_GEN_ISR_TABLES) && defined(CONFIG_DYNAMIC_INTERRUPTS) SECTION_DATA_PROLOGUE(sw_isr_table,,) { + /* + * Some arch requires an entry to be aligned to arch + * specific boundary for using double word load + * instruction. See include/sw_isr_table.h. + */ + . = ALIGN(CONFIG_ARCH_SW_ISR_TABLE_ALIGN); *(SW_ISR_TABLE) } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) #endif diff --git a/include/linker/common-rom.ld b/include/linker/common-rom.ld index 71371bba22a..4c914f1bb20 100644 --- a/include/linker/common-rom.ld +++ b/include/linker/common-rom.ld @@ -3,6 +3,12 @@ #if defined(CONFIG_GEN_ISR_TABLES) && !defined(CONFIG_DYNAMIC_INTERRUPTS) SECTION_PROLOGUE(sw_isr_table,,) { + /* + * Some arch requires an entry to be aligned to arch + * specific boundary for using double word load + * instruction. See include/sw_isr_table.h. + */ + . = ALIGN(CONFIG_ARCH_SW_ISR_TABLE_ALIGN); *(SW_ISR_TABLE) } GROUP_LINK_IN(ROMABLE_REGION) #endif