Skip to content

Commit a5b43a8

Browse files
mrutland-armwilldeacon
authored andcommitted
arm64: entry: template the entry asm functions
Now that the majority of the exception triage logic has been converted to C, the entry assembly functions all have a uniform structure. Let's generate them all with an assembly macro to reduce the amount of code and to ensure they all remain in sync if we make changes in future. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Marc Zyngier <maz@kernel.org> Reviewed-by: Joey Gouly <joey.gouly@arm.com> Cc: James Morse <james.morse@arm.com> Cc: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20210607094624.34689-14-mark.rutland@arm.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent ca0c264 commit a5b43a8

1 file changed

Lines changed: 27 additions & 86 deletions

File tree

arch/arm64/kernel/entry.S

Lines changed: 27 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -604,102 +604,43 @@ SYM_CODE_START_LOCAL(el1_error_invalid)
604604
inv_entry 1, BAD_ERROR
605605
SYM_CODE_END(el1_error_invalid)
606606

607-
/*
608-
* EL1 mode handlers.
609-
*/
610-
SYM_CODE_START_LOCAL(el1_sync)
611-
kernel_entry 1
612-
mov x0, sp
613-
bl el1_sync_handler
614-
b ret_to_kernel
615-
SYM_CODE_END(el1_sync)
616-
617-
SYM_CODE_START_LOCAL(el1_irq)
618-
kernel_entry 1
619-
mov x0, sp
620-
bl el1_irq_handler
621-
b ret_to_kernel
622-
SYM_CODE_END(el1_irq)
623-
624-
SYM_CODE_START_LOCAL(el1_fiq)
625-
kernel_entry 1
626-
mov x0, sp
627-
bl el1_fiq_handler
628-
b ret_to_kernel
629-
SYM_CODE_END(el1_fiq)
630-
631-
SYM_CODE_START_LOCAL(el1_error)
632-
kernel_entry 1
607+
.macro entry_handler el:req, regsize:req, label:req
608+
SYM_CODE_START_LOCAL(el\el\()_\label)
609+
kernel_entry \el, \regsize
633610
mov x0, sp
634-
bl el1_error_handler
611+
bl el\el\()_\label\()_handler
612+
.if \el == 0
613+
b ret_to_user
614+
.else
635615
b ret_to_kernel
636-
SYM_CODE_END(el1_error)
637-
638-
SYM_CODE_START_LOCAL(ret_to_kernel)
639-
kernel_exit 1
640-
SYM_CODE_END(ret_to_kernel)
616+
.endif
617+
SYM_CODE_END(el\el\()_\label)
618+
.endm
641619

642620
/*
643-
* EL0 mode handlers.
621+
* Early exception handlers
644622
*/
645-
SYM_CODE_START_LOCAL(el0_sync)
646-
kernel_entry 0
647-
mov x0, sp
648-
bl el0_sync_handler
649-
b ret_to_user
650-
SYM_CODE_END(el0_sync)
623+
entry_handler 1, 64, sync
624+
entry_handler 1, 64, irq
625+
entry_handler 1, 64, fiq
626+
entry_handler 1, 64, error
651627

652-
SYM_CODE_START_LOCAL(el0_irq)
653-
kernel_entry 0
654-
mov x0, sp
655-
bl el0_irq_handler
656-
b ret_to_user
657-
SYM_CODE_END(el0_irq)
658-
659-
SYM_CODE_START_LOCAL(el0_fiq)
660-
kernel_entry 0
661-
mov x0, sp
662-
bl el0_fiq_handler
663-
b ret_to_user
664-
SYM_CODE_END(el0_fiq)
665-
666-
SYM_CODE_START_LOCAL(el0_error)
667-
kernel_entry 0
668-
mov x0, sp
669-
bl el0_error_handler
670-
b ret_to_user
671-
SYM_CODE_END(el0_error)
628+
entry_handler 0, 64, sync
629+
entry_handler 0, 64, irq
630+
entry_handler 0, 64, fiq
631+
entry_handler 0, 64, error
672632

673633
#ifdef CONFIG_COMPAT
674-
SYM_CODE_START_LOCAL(el0_sync_compat)
675-
kernel_entry 0, 32
676-
mov x0, sp
677-
bl el0_sync_compat_handler
678-
b ret_to_user
679-
SYM_CODE_END(el0_sync_compat)
680-
681-
SYM_CODE_START_LOCAL(el0_irq_compat)
682-
kernel_entry 0, 32
683-
mov x0, sp
684-
bl el0_irq_compat_handler
685-
b ret_to_user
686-
SYM_CODE_END(el0_irq_compat)
687-
688-
SYM_CODE_START_LOCAL(el0_fiq_compat)
689-
kernel_entry 0, 32
690-
mov x0, sp
691-
bl el0_fiq_compat_handler
692-
b ret_to_user
693-
SYM_CODE_END(el0_fiq_compat)
694-
695-
SYM_CODE_START_LOCAL(el0_error_compat)
696-
kernel_entry 0, 32
697-
mov x0, sp
698-
bl el0_error_compat_handler
699-
b ret_to_user
700-
SYM_CODE_END(el0_error_compat)
634+
entry_handler 0, 32, sync_compat
635+
entry_handler 0, 32, irq_compat
636+
entry_handler 0, 32, fiq_compat
637+
entry_handler 0, 32, error_compat
701638
#endif
702639

640+
SYM_CODE_START_LOCAL(ret_to_kernel)
641+
kernel_exit 1
642+
SYM_CODE_END(ret_to_kernel)
643+
703644
/*
704645
* "slow" syscall return path.
705646
*/

0 commit comments

Comments
 (0)