aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2019-12-26 18:48:38 +0100
committerWojtek Kosior <kwojtus@protonmail.com>2019-12-26 18:48:38 +0100
commit9d587f9f750253461314757f2f861c5214563120 (patch)
tree92fa206180daa7297a86eb240f906b9b84fa5126
parent93a1c704c99a48803d118f66ac4fe08510fb4b89 (diff)
downloadrpi-MMU-example-9d587f9f750253461314757f2f861c5214563120.tar.gz
rpi-MMU-example-9d587f9f750253461314757f2f861c5214563120.zip
improve linking of interrupts
-rw-r--r--demo_functionality.c10
-rw-r--r--interrupt_vector.S4
-rw-r--r--interrupts.c9
-rw-r--r--linker.ld18
4 files changed, 23 insertions, 18 deletions
diff --git a/demo_functionality.c b/demo_functionality.c
index aedab08..c6f7e5c 100644
--- a/demo_functionality.c
+++ b/demo_functionality.c
@@ -164,9 +164,9 @@ void demo_go_unprivileged(void)
}
extern char
- __interrupt_vectors_start,
- __interrupt_vectors_end,
- __interrupt_vectors_size;
+ __interrupts_start,
+ __interrupts_end,
+ __interrupts_size;
extern void (*volatile system_reentry_point)(void);
@@ -180,7 +180,7 @@ void demo_setup_interrupts(void)
{
system_reentry_point = system_reentry;
- for (size_t i = 0; i < (size_t) &__interrupt_vectors_size; i++)
+ for (size_t i = 0; i < (size_t) &__interrupts_size; i++)
((volatile char*) 0)[i] =
- (&__interrupt_vectors_start)[i];
+ (&__interrupts_start)[i];
}
diff --git a/interrupt_vector.S b/interrupt_vector.S
index f71330b..d20bf6d 100644
--- a/interrupt_vector.S
+++ b/interrupt_vector.S
@@ -1,4 +1,4 @@
-.section ".interrupt_vectors.text"
+.section ".interrupts.vector"
.global abort_handler
.local generic_handler
@@ -12,6 +12,8 @@ _interrupt_vectors:
b generic_handler
b generic_handler
+.section ".interrupts.text"
+
generic_handler:
b generic_handler
abort_handler_caller:
diff --git a/interrupts.c b/interrupts.c
index 191ce40..6952f89 100644
--- a/interrupts.c
+++ b/interrupts.c
@@ -5,7 +5,10 @@
If an undefined instruction is encountered, the CPU will start
executing this function. Just trap here as a debug solution.
*/
-void __attribute__((interrupt("UNDEF"))) undefined_instruction_vector(void)
+void
+__attribute__((interrupt("UNDEF")))
+__attribute__((section(".interrupts.text")))
+undefined_instruction_vector(void)
{
uart_puts("Undefined instruction occured");
while( 1 )
@@ -14,12 +17,12 @@ void __attribute__((interrupt("UNDEF"))) undefined_instruction_vector(void)
}
}
-void __attribute__((section(".interrupt_vectors.data")))
+void __attribute__((section(".interrupts.data")))
(*system_reentry_point) (void);
void
__attribute__((interrupt("ABORT")))
-__attribute__((section(".interrupt_vectors.text")))
+__attribute__((section(".interrupts.text")))
abort_handler(void)
{
system_reentry_point();
diff --git a/linker.ld b/linker.ld
index ed40054..5bdbfd2 100644
--- a/linker.ld
+++ b/linker.ld
@@ -42,17 +42,17 @@ SECTIONS
__libkernel_size = __libkernel_end - __libkernel_start;
- . = ALIGN(4096); /* align to page size */
- __interrupt_vectors_start = .;
- .interrupt_vectors :
+
+ .interrupts :
{
- interrupt_vectors = .;
- *(.interrupt_vectors.text)
- *(.interrupt_vectors.data)
+ __interrupts_start = .;
+ KEEP(*(.interrupts.vector))
+ interrupt_vector.o
+ interrupts.o
+ __interrupts_end = .;
}
- . = ALIGN(4096); /* align to page size */
- __interrupt_vectors_end = .;
- __interrupt_vectors_size = __interrupt_vectors_end - __interrupt_vectors_start;
+
+ __interrupts_size = __interrupts_end - __interrupts_start;
__end = .;
}