]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blame - arch/xtensa/include/asm/traps.h
Merge tag 'armsoc-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[mirror_ubuntu-eoan-kernel.git] / arch / xtensa / include / asm / traps.h
CommitLineData
28570e8d
MF
1/*
2 * arch/xtensa/include/asm/traps.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2012 Tensilica Inc.
9 */
10#ifndef _XTENSA_TRAPS_H
11#define _XTENSA_TRAPS_H
12
13#include <asm/ptrace.h>
14
15/*
16 * handler must be either of the following:
17 * void (*)(struct pt_regs *regs);
18 * void (*)(struct pt_regs *regs, unsigned long exccause);
19 */
20extern void * __init trap_set_handler(int cause, void *handler);
21extern void do_unhandled(struct pt_regs *regs, unsigned long exccause);
f615136c 22void secondary_trap_init(void);
28570e8d 23
2d6f82fe
MF
24static inline void spill_registers(void)
25{
e2fd1374 26#if XCHAL_NUM_AREGS > 16
2d6f82fe 27 __asm__ __volatile__ (
77d6273e 28 " call8 1f\n"
e2fd1374
MF
29 " _j 2f\n"
30 " retw\n"
31 " .align 4\n"
32 "1:\n"
77d6273e
MF
33#if XCHAL_NUM_AREGS == 32
34 " _entry a1, 32\n"
35 " addi a8, a0, 3\n"
36 " _entry a1, 16\n"
37 " mov a12, a12\n"
38 " retw\n"
39#else
e2fd1374 40 " _entry a1, 48\n"
77d6273e
MF
41 " call12 1f\n"
42 " retw\n"
43 " .align 4\n"
44 "1:\n"
45 " .rept (" __stringify(XCHAL_NUM_AREGS) " - 16) / 12\n"
e2fd1374
MF
46 " _entry a1, 48\n"
47 " mov a12, a0\n"
48 " .endr\n"
77d6273e 49 " _entry a1, 16\n"
e2fd1374 50#if XCHAL_NUM_AREGS % 12 == 0
e2fd1374 51 " mov a12, a12\n"
77d6273e 52#elif XCHAL_NUM_AREGS % 12 == 4
e2fd1374 53 " mov a4, a4\n"
77d6273e
MF
54#elif XCHAL_NUM_AREGS % 12 == 8
55 " mov a8, a8\n"
e2fd1374
MF
56#endif
57 " retw\n"
77d6273e 58#endif
e2fd1374 59 "2:\n"
77d6273e 60 : : : "a8", "a9", "memory");
2d6f82fe 61#else
e2fd1374
MF
62 __asm__ __volatile__ (
63 " mov a12, a12\n"
64 : : : "memory");
2d6f82fe 65#endif
2d6f82fe
MF
66}
67
28570e8d 68#endif /* _XTENSA_TRAPS_H */