Skip to content

Commit

Permalink
Thumb-2: Correctly handle undefined instructions in the kernel
Browse files Browse the repository at this point in the history
VFP instructions in the kernel may trigger undefined exceptions if VFP
hardware is not present. This patch corrects the loading of such Thumb-2
instructions. It also marks the "no_fp" label as a function so that the
linker generate a Thumb address.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
  • Loading branch information
Catalin Marinas committed Sep 18, 2009
1 parent 74109b8 commit 83e686e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion arch/arm/kernel/entry-armv.S
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,15 @@ __und_svc:
@
@ r0 - instruction
@
#ifndef CONFIG_THUMB2_KERNEL
ldr r0, [r2, #-4]
#else
ldrh r0, [r2, #-2] @ Thumb instruction at LR - 2
and r9, r0, #0xf800
cmp r9, #0xe800 @ 32-bit instruction if xx >= 0
ldrhhs r9, [r2] @ bottom 16 bits
orrhs r0, r9, r0, lsl #16
#endif
adr r9, BSYM(1f)
bl call_fpe

Expand Down Expand Up @@ -678,7 +686,9 @@ ENTRY(fp_enter)
.word no_fp
.previous

no_fp: mov pc, lr
ENTRY(no_fp)
mov pc, lr
ENDPROC(no_fp)

__und_usr_unknown:
enable_irq
Expand Down

0 comments on commit 83e686e

Please sign in to comment.