Add missing stack unwind information to several assembly functions on

ARMv6/7:

- Define _SAVE() macro to allow unwind data to be conditionally defined for
  ARM assembly code in the kernel.

- Use _SAVE() to provide unwind information for bcopy_page(), and two (of
  many) instances of copyin() and copyout().

Reviewed by:	andrew, imp
MFC after:	3 days
Sponsored by:	University of Cambridge
This commit is contained in:
rwatson 2015-10-04 09:39:40 +00:00
parent 0dee60f8c8
commit 707e8db7f8
3 changed files with 7 additions and 2 deletions

View File

@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$");
#endif /* ! COPY_CHUNK */ #endif /* ! COPY_CHUNK */
#ifndef SAVE_REGS #ifndef SAVE_REGS
#define SAVE_REGS stmfd sp!, {r4-r8, lr} #define SAVE_REGS stmfd sp!, {r4-r8, lr}; _SAVE({r4-r8, lr})
#define RESTORE_REGS ldmfd sp!, {r4-r8, pc} #define RESTORE_REGS ldmfd sp!, {r4-r8, pc}
#endif #endif
@ -134,6 +134,7 @@ END(bcopy_page)
ENTRY(bzero_page) ENTRY(bzero_page)
stmfd sp!, {r4-r8, lr} stmfd sp!, {r4-r8, lr}
_SAVE({r4-r8, lr})
#ifdef BIG_LOOPS #ifdef BIG_LOOPS
mov r2, #(PAGE_SIZE >> 9) mov r2, #(PAGE_SIZE >> 9)
#else #else
@ -189,6 +190,7 @@ END(bzero_page)
ENTRY(bcopy_page) ENTRY(bcopy_page)
pld [r0] pld [r0]
stmfd sp!, {r4, r5} stmfd sp!, {r4, r5}
_SAVE({r4, r5})
mov ip, #32 mov ip, #32
ldr r2, [r0], #0x04 /* 0x00 */ ldr r2, [r0], #0x04 /* 0x00 */
ldr r3, [r0], #0x04 /* 0x04 */ ldr r3, [r0], #0x04 /* 0x04 */

View File

@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$");
#endif #endif
#define SAVE_REGS stmfd sp!, {r4-r11} #define SAVE_REGS stmfd sp!, {r4-r11}; _SAVE({r4-r11})
#define RESTORE_REGS ldmfd sp!, {r4-r11} #define RESTORE_REGS ldmfd sp!, {r4-r11}
#if defined(_ARM_ARCH_5E) #if defined(_ARM_ARCH_5E)
@ -341,6 +341,7 @@ ENTRY(copyout)
cmp r2, r3 cmp r2, r3
blt .Lnormale blt .Lnormale
stmfd sp!, {r0-r2, r4, lr} stmfd sp!, {r0-r2, r4, lr}
_SAVE({r0-r2, r4, lr})
mov r3, r0 mov r3, r0
mov r0, r1 mov r0, r1
mov r1, r3 mov r1, r3

View File

@ -53,10 +53,12 @@
#define STOP_UNWINDING .cantunwind #define STOP_UNWINDING .cantunwind
#define _FNSTART .fnstart #define _FNSTART .fnstart
#define _FNEND .fnend #define _FNEND .fnend
#define _SAVE(...) .save __VA_ARGS__
#else #else
#define STOP_UNWINDING #define STOP_UNWINDING
#define _FNSTART #define _FNSTART
#define _FNEND #define _FNEND
#define _SAVE(...)
#endif #endif
/* /*