Skip to content

Commit

Permalink
xtensa: provide proper assembler function boundaries with ENDPROC()
Browse files Browse the repository at this point in the history
Use ENDPROC() to mark the end of assembler functions.

Signed-off-by: Chris Zankel <chris@zankel.net>
  • Loading branch information
Chris Zankel committed Dec 19, 2012
1 parent c0226e3 commit d1538c4
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 25 deletions.
1 change: 1 addition & 0 deletions arch/xtensa/kernel/align.S
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ ENTRY(fast_unaligned)
1: movi a0, _user_exception
jx a0

ENDPROC(fast_unaligned)

#endif /* XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION */

22 changes: 22 additions & 0 deletions arch/xtensa/kernel/coprocessor.S
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@
/* IO protection is currently unsupported. */

ENTRY(fast_io_protect)

wsr a0, excsave1
movi a0, unrecoverable_exception
callx0 a0

ENDPROC(fast_io_protect)

#if XTENSA_HAVE_COPROCESSORS

/*
Expand Down Expand Up @@ -139,6 +142,7 @@ ENTRY(fast_io_protect)
*/

ENTRY(coprocessor_save)

entry a1, 32
s32i a0, a1, 0
movi a0, .Lsave_cp_regs_jump_table
Expand All @@ -150,7 +154,10 @@ ENTRY(coprocessor_save)
1: l32i a0, a1, 0
retw

ENDPROC(coprocessor_save)

ENTRY(coprocessor_load)

entry a1, 32
s32i a0, a1, 0
movi a0, .Lload_cp_regs_jump_table
Expand All @@ -162,6 +169,8 @@ ENTRY(coprocessor_load)
1: l32i a0, a1, 0
retw

ENDPROC(coprocessor_load)

/*
* coprocessor_flush(struct task_info*, index)
* a2 a3
Expand All @@ -178,6 +187,7 @@ ENTRY(coprocessor_load)


ENTRY(coprocessor_flush)

entry a1, 32
s32i a0, a1, 0
movi a0, .Lsave_cp_regs_jump_table
Expand All @@ -191,6 +201,8 @@ ENTRY(coprocessor_flush)
1: l32i a0, a1, 0
retw

ENDPROC(coprocessor_flush)

ENTRY(coprocessor_restore)
entry a1, 32
s32i a0, a1, 0
Expand All @@ -205,6 +217,8 @@ ENTRY(coprocessor_restore)
1: l32i a0, a1, 0
retw

ENDPROC(coprocessor_restore)

/*
* Entry condition:
*
Expand All @@ -220,10 +234,12 @@ ENTRY(coprocessor_restore)
*/

ENTRY(fast_coprocessor_double)

wsr a0, excsave1
movi a0, unrecoverable_exception
callx0 a0

ENDPROC(fast_coprocessor_double)

ENTRY(fast_coprocessor)

Expand Down Expand Up @@ -327,9 +343,15 @@ ENTRY(fast_coprocessor)

rfe

ENDPROC(fast_coprocessor)

.data

ENTRY(coprocessor_owner)

.fill XCHAL_CP_MAX, 4, 0

END(coprocessor_owner)

#endif /* XTENSA_HAVE_COPROCESSORS */

30 changes: 28 additions & 2 deletions arch/xtensa/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ _user_exception:

j common_exception

ENDPROC(user_exception)

/*
* First-level exit handler for kernel exceptions
Expand Down Expand Up @@ -641,6 +642,8 @@ common_exception_exit:
l32i a1, a1, PT_AREG1
rfde

ENDPROC(kernel_exception)

/*
* Debug exception handler.
*
Expand Down Expand Up @@ -701,6 +704,7 @@ ENTRY(debug_exception)
/* Debug exception while in exception mode. */
1: j 1b // FIXME!!

ENDPROC(debug_exception)

/*
* We get here in case of an unrecoverable exception.
Expand Down Expand Up @@ -751,6 +755,7 @@ ENTRY(unrecoverable_exception)

1: j 1b

ENDPROC(unrecoverable_exception)

/* -------------------------- FAST EXCEPTION HANDLERS ----------------------- */

Expand Down Expand Up @@ -929,6 +934,7 @@ ENTRY(fast_alloca)
l32i a2, a2, PT_AREG2
rfe

ENDPROC(fast_alloca)

/*
* fast system calls.
Expand Down Expand Up @@ -966,6 +972,8 @@ ENTRY(fast_syscall_kernel)

j kernel_exception

ENDPROC(fast_syscall_kernel)

ENTRY(fast_syscall_user)

/* Skip syscall. */
Expand All @@ -983,6 +991,8 @@ ENTRY(fast_syscall_user)

j user_exception

ENDPROC(fast_syscall_user)

ENTRY(fast_syscall_unrecoverable)

/* Restore all states. */
Expand All @@ -995,7 +1005,7 @@ ENTRY(fast_syscall_unrecoverable)
movi a0, unrecoverable_exception
callx0 a0


ENDPROC(fast_syscall_unrecoverable)

/*
* sysxtensa syscall handler
Expand Down Expand Up @@ -1101,7 +1111,7 @@ CATCH
movi a2, -EINVAL
rfe


ENDPROC(fast_syscall_xtensa)


/* fast_syscall_spill_registers.
Expand Down Expand Up @@ -1160,6 +1170,8 @@ ENTRY(fast_syscall_spill_registers)
movi a2, 0
rfe

ENDPROC(fast_syscall_spill_registers)

/* Fixup handler.
*
* We get here if the spill routine causes an exception, e.g. tlb miss.
Expand Down Expand Up @@ -1464,6 +1476,8 @@ ENTRY(_spill_registers)
callx0 a0 # should not return
1: j 1b

ENDPROC(_spill_registers)

#ifdef CONFIG_MMU
/*
* We should never get here. Bail out!
Expand All @@ -1475,6 +1489,8 @@ ENTRY(fast_second_level_miss_double_kernel)
callx0 a0 # should not return
1: j 1b

ENDPROC(fast_second_level_miss_double_kernel)

/* First-level entry handler for user, kernel, and double 2nd-level
* TLB miss exceptions. Note that for now, user and kernel miss
* exceptions share the same entry point and are handled identically.
Expand Down Expand Up @@ -1682,6 +1698,7 @@ ENTRY(fast_second_level_miss)
j _kernel_exception
1: j _user_exception

ENDPROC(fast_second_level_miss)

/*
* StoreProhibitedException
Expand Down Expand Up @@ -1777,6 +1794,9 @@ ENTRY(fast_store_prohibited)
bbsi.l a2, PS_UM_BIT, 1f
j _kernel_exception
1: j _user_exception

ENDPROC(fast_store_prohibited)

#endif /* CONFIG_MMU */

/*
Expand All @@ -1787,6 +1807,7 @@ ENTRY(fast_store_prohibited)
*/

ENTRY(system_call)

entry a1, 32

/* regs->syscall = regs->areg[2] */
Expand Down Expand Up @@ -1831,6 +1852,8 @@ ENTRY(system_call)
callx4 a4
retw

ENDPROC(system_call)


/*
* Task switch.
Expand Down Expand Up @@ -1899,6 +1922,7 @@ ENTRY(_switch_to)

retw

ENDPROC(_switch_to)

ENTRY(ret_from_fork)

Expand All @@ -1914,6 +1938,8 @@ ENTRY(ret_from_fork)

j common_exception_return

ENDPROC(ret_from_fork)

/*
* Kernel thread creation helper
* On entry, set up by copy_thread: a2 = thread_fn, a3 = thread_fn arg
Expand Down
14 changes: 10 additions & 4 deletions arch/xtensa/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,19 @@
*/

__HEAD
.globl _start
_start: _j 2f
ENTRY(_start)

_j 2f
.align 4
1: .word _startup
2: l32r a0, 1b
jx a0

ENDPROC(_start)

.section .init.text, "ax"
.align 4
_startup:

ENTRY(_startup)

/* Disable interrupts and exceptions. */

Expand Down Expand Up @@ -230,6 +233,7 @@ _startup:
should_never_return:
j should_never_return

ENDPROC(_startup)

/*
* BSS section
Expand All @@ -239,6 +243,8 @@ __PAGE_ALIGNED_BSS
#ifdef CONFIG_MMU
ENTRY(swapper_pg_dir)
.fill PAGE_SIZE, 1, 0
END(swapper_pg_dir)
#endif
ENTRY(empty_zero_page)
.fill PAGE_SIZE, 1, 0
END(empty_zero_page)
Loading

0 comments on commit d1538c4

Please sign in to comment.