Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'xtensa-20181228' of git://github.com/jcmvbkbc/linux-xtensa

Pull Xtensa updates from Max Filippov:

- switch to generated syscall table

- switch ptrace to regsets, use regsets for core dumps

- complete tracehook implementation

- add syscall tracepoints support

- add jumplabels support

- add memtest support

- drop unused/duplicated code from entry.S, ptrace.c, coprocessor.S,
elf.h and syscall.h

- clean up warnings caused by WSR/RSR macros

- clean up DTC warnings about SPI controller node names in xtfpga.dtsi

- simplify coprocessor.S

- get rid of explicit 'l32r' instruction usage in assembly

* tag 'xtensa-20181228' of git://github.com/jcmvbkbc/linux-xtensa: (25 commits)
xtensa: implement jump_label support
xtensa: implement syscall tracepoints
xtensa: implement tracehook functions and enable HAVE_ARCH_TRACEHOOK
xtensa: enable CORE_DUMP_USE_REGSET
xtensa: implement TIE regset
xtensa: implement task_user_regset_view
xtensa: call do_syscall_trace_{enter,leave} selectively
xtensa: use NO_SYSCALL instead of -1
xtensa: define syscall_get_arch()
Move EM_XTENSA to uapi/linux/elf-em.h
xtensa: support memtest
xtensa: don't use l32r opcode directly
xtensa: xtfpga.dtsi: fix dtc warnings about SPI
xtensa: don't clear cpenable unconditionally on release
xtensa: simplify coprocessor.S
xtensa: clean up WSR*/RSR*/get_sr/set_sr
xtensa: drop unused declarations from elf.h
xtensa: clean up syscall.h
xtensa: drop unused coprocessor helper functions
xtensa: drop custom PTRACE_{PEEK,POKE}{TEXT,DATA}
...

+1121 -1260
+1 -1
Documentation/features/core/jump-labels/arch-support.txt
··· 29 29 | um: | TODO | 30 30 | unicore32: | TODO | 31 31 | x86: | ok | 32 - | xtensa: | TODO | 32 + | xtensa: | ok | 33 33 -----------------------
+3
arch/xtensa/Kconfig
··· 16 16 select GENERIC_PCI_IOMAP 17 17 select GENERIC_SCHED_CLOCK 18 18 select GENERIC_STRNCPY_FROM_USER if KASAN 19 + select HAVE_ARCH_JUMP_LABEL 19 20 select HAVE_ARCH_KASAN if MMU 21 + select HAVE_ARCH_TRACEHOOK 20 22 select HAVE_DEBUG_KMEMLEAK 21 23 select HAVE_DMA_CONTIGUOUS 22 24 select HAVE_EXIT_THREAD ··· 29 27 select HAVE_OPROFILE 30 28 select HAVE_PERF_EVENTS 31 29 select HAVE_STACKPROTECTOR 30 + select HAVE_SYSCALL_TRACEPOINTS 32 31 select IRQ_DOMAIN 33 32 select MODULES_USE_ELF_RELA 34 33 select PERF_USE_VMALLOC
+3
arch/xtensa/Makefile
··· 90 90 all Image zImage uImage: vmlinux 91 91 $(Q)$(MAKE) $(build)=$(boot) $@ 92 92 93 + archheaders: 94 + $(Q)$(MAKE) $(build)=arch/xtensa/kernel/syscalls all 95 + 93 96 define archhelp 94 97 @echo '* Image - Kernel ELF image with reset vector' 95 98 @echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
+14 -15
arch/xtensa/boot/boot-elf/bootstrap.S
··· 29 29 .begin no-absolute-literals 30 30 .literal_position 31 31 32 - #if defined(CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX) && \ 33 - XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY 34 - .literal RomInitAddr, CONFIG_KERNEL_LOAD_ADDRESS 35 - #else 36 - .literal RomInitAddr, KERNELOFFSET 37 - #endif 38 - #ifndef CONFIG_PARSE_BOOTPARAM 39 - .literal RomBootParam, 0 40 - #else 41 - .literal RomBootParam, _bootparam 42 - 32 + #ifdef CONFIG_PARSE_BOOTPARAM 43 33 .align 4 44 34 _bootparam: 45 35 .short BP_TAG_FIRST ··· 56 66 initialize_mmu 57 67 #endif 58 68 59 - .end no-absolute-literals 60 - 61 69 rsil a0, XCHAL_DEBUGLEVEL-1 62 70 rsync 63 71 reset: 64 - l32r a0, RomInitAddr 65 - l32r a2, RomBootParam 72 + #if defined(CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX) && \ 73 + XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY 74 + movi a0, CONFIG_KERNEL_LOAD_ADDRESS 75 + #else 76 + movi a0, KERNELOFFSET 77 + #endif 78 + #ifdef CONFIG_PARSE_BOOTPARAM 79 + movi a2, _bootparam 80 + #else 81 + movi a2, 0 82 + #endif 66 83 movi a3, 0 67 84 movi a4, 0 68 85 jx a0 86 + 87 + .end no-absolute-literals
+1 -1
arch/xtensa/boot/dts/xtfpga.dtsi
··· 103 103 }; 104 104 }; 105 105 106 - spi0: spi-master@0d0a0000 { 106 + spi0: spi@0d0a0000 { 107 107 compatible = "cdns,xtfpga-spi"; 108 108 #address-cells = <1>; 109 109 #size-cells = <0>;
+1
arch/xtensa/include/asm/Kbuild
··· 1 + generated-y += syscall_table.h 1 2 generic-y += bug.h 2 3 generic-y += compat.h 3 4 generic-y += device.h
-23
arch/xtensa/include/asm/coprocessor.h
··· 12 12 #ifndef _XTENSA_COPROCESSOR_H 13 13 #define _XTENSA_COPROCESSOR_H 14 14 15 - #include <linux/stringify.h> 16 15 #include <variant/core.h> 17 16 #include <variant/tie.h> 18 17 #include <asm/types.h> ··· 89 90 90 91 #ifndef __ASSEMBLY__ 91 92 92 - 93 - #if XCHAL_HAVE_CP 94 - 95 - #define RSR_CPENABLE(x) do { \ 96 - __asm__ __volatile__("rsr %0, cpenable" : "=a" (x)); \ 97 - } while(0); 98 - #define WSR_CPENABLE(x) do { \ 99 - __asm__ __volatile__("wsr %0, cpenable; rsync" :: "a" (x)); \ 100 - } while(0); 101 - 102 - #endif /* XCHAL_HAVE_CP */ 103 - 104 - 105 93 /* 106 94 * Additional registers. 107 95 * We define three types of additional registers: ··· 143 157 __attribute__ ((aligned (XCHAL_CP7_SA_ALIGN))); 144 158 145 159 extern struct thread_info* coprocessor_owner[XCHAL_CP_MAX]; 146 - extern void coprocessor_save(void*, int); 147 - extern void coprocessor_load(void*, int); 148 160 extern void coprocessor_flush(struct thread_info*, int); 149 - extern void coprocessor_restore(struct thread_info*, int); 150 161 151 162 extern void coprocessor_release_all(struct thread_info*); 152 163 extern void coprocessor_flush_all(struct thread_info*); 153 - 154 - static inline void coprocessor_clear_cpenable(void) 155 - { 156 - unsigned long i = 0; 157 - WSR_CPENABLE(i); 158 - } 159 164 160 165 #endif /* XTENSA_HAVE_COPROCESSORS */ 161 166
+3 -30
arch/xtensa/include/asm/elf.h
··· 15 15 16 16 #include <asm/ptrace.h> 17 17 #include <asm/coprocessor.h> 18 + #include <linux/elf-em.h> 18 19 19 20 /* Xtensa processor ELF architecture-magic number */ 20 21 21 - #define EM_XTENSA 94 22 22 #define EM_XTENSA_OLD 0xABC7 23 23 24 24 /* Xtensa relocations defined by the ABIs */ ··· 75 75 76 76 typedef unsigned long elf_greg_t; 77 77 78 - typedef struct { 79 - elf_greg_t pc; 80 - elf_greg_t ps; 81 - elf_greg_t lbeg; 82 - elf_greg_t lend; 83 - elf_greg_t lcount; 84 - elf_greg_t sar; 85 - elf_greg_t windowstart; 86 - elf_greg_t windowbase; 87 - elf_greg_t threadptr; 88 - elf_greg_t reserved[7+48]; 89 - elf_greg_t a[64]; 90 - } xtensa_gregset_t; 78 + typedef struct user_pt_regs xtensa_gregset_t; 91 79 92 80 #define ELF_NGREG (sizeof(xtensa_gregset_t) / sizeof(elf_greg_t)) 93 81 ··· 85 97 86 98 typedef unsigned int elf_fpreg_t; 87 99 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; 88 - 89 - #define ELF_CORE_COPY_REGS(_eregs, _pregs) \ 90 - xtensa_elf_core_copy_regs ((xtensa_gregset_t*)&(_eregs), _pregs); 91 - 92 - extern void xtensa_elf_core_copy_regs (xtensa_gregset_t *, struct pt_regs *); 93 100 94 101 /* 95 102 * This is used to ensure we don't load something for the wrong architecture. ··· 109 126 #define ELF_ARCH EM_XTENSA 110 127 111 128 #define ELF_EXEC_PAGESIZE PAGE_SIZE 129 + #define CORE_DUMP_USE_REGSET 112 130 113 131 /* 114 132 * This is the location that an ET_DYN program is loaded if exec'ed. Typical ··· 176 192 177 193 #define SET_PERSONALITY(ex) \ 178 194 set_personality(PER_LINUX_32BIT | (current->personality & (~PER_MASK))) 179 - 180 - struct task_struct; 181 - 182 - extern void do_copy_regs (xtensa_gregset_t*, struct pt_regs*, 183 - struct task_struct*); 184 - extern void do_restore_regs (xtensa_gregset_t*, struct pt_regs*, 185 - struct task_struct*); 186 - extern void do_save_fpregs (elf_fpregset_t*, struct pt_regs*, 187 - struct task_struct*); 188 - extern int do_restore_fpregs (elf_fpregset_t*, struct pt_regs*, 189 - struct task_struct*); 190 195 191 196 #endif /* _XTENSA_ELF_H */
+4 -4
arch/xtensa/include/asm/futex.h
··· 32 32 "3:\n" \ 33 33 " .section .fixup,\"ax\"\n" \ 34 34 " .align 4\n" \ 35 - "4: .long 3b\n" \ 36 - "5: l32r %0, 4b\n" \ 35 + " .literal_position\n" \ 36 + "5: movi %0, 3b\n" \ 37 37 " movi %1, %3\n" \ 38 38 " jx %0\n" \ 39 39 " .previous\n" \ ··· 108 108 "2:\n" 109 109 " .section .fixup,\"ax\"\n" 110 110 " .align 4\n" 111 - "3: .long 2b\n" 112 - "4: l32r %1, 3b\n" 111 + " .literal_position\n" 112 + "4: movi %1, 2b\n" 113 113 " movi %0, %7\n" 114 114 " jx %1\n" 115 115 " .previous\n"
+1
arch/xtensa/include/asm/irqflags.h
··· 12 12 #ifndef _XTENSA_IRQFLAGS_H 13 13 #define _XTENSA_IRQFLAGS_H 14 14 15 + #include <linux/stringify.h> 15 16 #include <linux/types.h> 16 17 #include <asm/processor.h> 17 18
+65
arch/xtensa/include/asm/jump_label.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* Copyright (C) 2018 Cadence Design Systems Inc. */ 3 + 4 + #ifndef _ASM_XTENSA_JUMP_LABEL_H 5 + #define _ASM_XTENSA_JUMP_LABEL_H 6 + 7 + #ifndef __ASSEMBLY__ 8 + 9 + #include <linux/types.h> 10 + 11 + #define JUMP_LABEL_NOP_SIZE 3 12 + 13 + static __always_inline bool arch_static_branch(struct static_key *key, 14 + bool branch) 15 + { 16 + asm_volatile_goto("1:\n\t" 17 + "_nop\n\t" 18 + ".pushsection __jump_table, \"aw\"\n\t" 19 + ".word 1b, %l[l_yes], %c0\n\t" 20 + ".popsection\n\t" 21 + : : "i" (&((char *)key)[branch]) : : l_yes); 22 + 23 + return false; 24 + l_yes: 25 + return true; 26 + } 27 + 28 + static __always_inline bool arch_static_branch_jump(struct static_key *key, 29 + bool branch) 30 + { 31 + /* 32 + * Xtensa assembler will mark certain points in the code 33 + * as unreachable, so that later assembler or linker relaxation 34 + * passes could use them. A spot right after the J instruction 35 + * is one such point. Assembler and/or linker may insert padding 36 + * or literals here, breaking code flow in case the J instruction 37 + * is later replaced with NOP. Put a label right after the J to 38 + * make it reachable and wrap both into a no-transform block 39 + * to avoid any assembler interference with this. 40 + */ 41 + asm_volatile_goto("1:\n\t" 42 + ".begin no-transform\n\t" 43 + "_j %l[l_yes]\n\t" 44 + "2:\n\t" 45 + ".end no-transform\n\t" 46 + ".pushsection __jump_table, \"aw\"\n\t" 47 + ".word 1b, %l[l_yes], %c0\n\t" 48 + ".popsection\n\t" 49 + : : "i" (&((char *)key)[branch]) : : l_yes); 50 + 51 + return false; 52 + l_yes: 53 + return true; 54 + } 55 + 56 + typedef u32 jump_label_t; 57 + 58 + struct jump_entry { 59 + jump_label_t code; 60 + jump_label_t target; 61 + jump_label_t key; 62 + }; 63 + 64 + #endif /* __ASSEMBLY__ */ 65 + #endif
+12 -4
arch/xtensa/include/asm/processor.h
··· 13 13 #include <variant/core.h> 14 14 15 15 #include <linux/compiler.h> 16 + #include <linux/stringify.h> 16 17 #include <asm/ptrace.h> 17 18 #include <asm/types.h> 18 19 #include <asm/regs.h> ··· 213 212 214 213 /* Special register access. */ 215 214 216 - #define WSR(v,sr) __asm__ __volatile__ ("wsr %0,"__stringify(sr) :: "a"(v)); 217 - #define RSR(v,sr) __asm__ __volatile__ ("rsr %0,"__stringify(sr) : "=a"(v)); 215 + #define xtensa_set_sr(x, sr) \ 216 + ({ \ 217 + unsigned int v = (unsigned int)(x); \ 218 + __asm__ __volatile__ ("wsr %0, "__stringify(sr) :: "a"(v)); \ 219 + }) 218 220 219 - #define set_sr(x,sr) ({unsigned int v=(unsigned int)x; WSR(v,sr);}) 220 - #define get_sr(sr) ({unsigned int v; RSR(v,sr); v; }) 221 + #define xtensa_get_sr(sr) \ 222 + ({ \ 223 + unsigned int v; \ 224 + __asm__ __volatile__ ("rsr %0, "__stringify(sr) : "=a"(v)); \ 225 + v; \ 226 + }) 221 227 222 228 #ifndef XCHAL_HAVE_EXTERN_REGS 223 229 #define XCHAL_HAVE_EXTERN_REGS 0
+7
arch/xtensa/include/asm/ptrace.h
··· 39 39 * +-----------------------+ -------- 40 40 */ 41 41 42 + #define NO_SYSCALL (-1) 43 + 42 44 #ifndef __ASSEMBLY__ 43 45 44 46 #include <asm/coprocessor.h> ··· 101 99 # endif 102 100 103 101 #define user_stack_pointer(regs) ((regs)->areg[1]) 102 + 103 + static inline unsigned long regs_return_value(struct pt_regs *regs) 104 + { 105 + return regs->areg[2]; 106 + } 104 107 105 108 #else /* __ASSEMBLY__ */ 106 109
+95 -14
arch/xtensa/include/asm/syscall.h
··· 1 1 /* 2 - * include/asm-xtensa/syscall.h 3 - * 4 2 * This file is subject to the terms and conditions of the GNU General Public 5 3 * License. See the file "COPYING" in the main directory of this archive 6 4 * for more details. 7 5 * 8 6 * Copyright (C) 2001 - 2007 Tensilica Inc. 7 + * Copyright (C) 2018 Cadence Design Systems Inc. 9 8 */ 10 9 11 - struct pt_regs; 12 - asmlinkage long xtensa_ptrace(long, long, long, long); 13 - asmlinkage long xtensa_sigreturn(struct pt_regs*); 10 + #ifndef _ASM_SYSCALL_H 11 + #define _ASM_SYSCALL_H 12 + 13 + #include <linux/err.h> 14 + #include <asm/ptrace.h> 15 + #include <uapi/linux/audit.h> 16 + 17 + static inline int syscall_get_arch(void) 18 + { 19 + return AUDIT_ARCH_XTENSA; 20 + } 21 + 22 + typedef void (*syscall_t)(void); 23 + extern syscall_t sys_call_table[]; 24 + 25 + static inline long syscall_get_nr(struct task_struct *task, 26 + struct pt_regs *regs) 27 + { 28 + return regs->syscall; 29 + } 30 + 31 + static inline void syscall_rollback(struct task_struct *task, 32 + struct pt_regs *regs) 33 + { 34 + /* Do nothing. */ 35 + } 36 + 37 + static inline long syscall_get_error(struct task_struct *task, 38 + struct pt_regs *regs) 39 + { 40 + /* 0 if syscall succeeded, otherwise -Errorcode */ 41 + return IS_ERR_VALUE(regs->areg[2]) ? regs->areg[2] : 0; 42 + } 43 + 44 + static inline long syscall_get_return_value(struct task_struct *task, 45 + struct pt_regs *regs) 46 + { 47 + return regs->areg[2]; 48 + } 49 + 50 + static inline void syscall_set_return_value(struct task_struct *task, 51 + struct pt_regs *regs, 52 + int error, long val) 53 + { 54 + regs->areg[0] = (long) error ? error : val; 55 + } 56 + 57 + #define SYSCALL_MAX_ARGS 6 58 + #define XTENSA_SYSCALL_ARGUMENT_REGS {6, 3, 4, 5, 8, 9} 59 + 60 + static inline void syscall_get_arguments(struct task_struct *task, 61 + struct pt_regs *regs, 62 + unsigned int i, unsigned int n, 63 + unsigned long *args) 64 + { 65 + static const unsigned int reg[] = XTENSA_SYSCALL_ARGUMENT_REGS; 66 + unsigned int j; 67 + 68 + if (n == 0) 69 + return; 70 + 71 + WARN_ON_ONCE(i + n > SYSCALL_MAX_ARGS); 72 + 73 + for (j = 0; j < n; ++j) { 74 + if (i + j < SYSCALL_MAX_ARGS) 75 + args[j] = regs->areg[reg[i + j]]; 76 + else 77 + args[j] = 0; 78 + } 79 + } 80 + 81 + static inline void syscall_set_arguments(struct task_struct *task, 82 + struct pt_regs *regs, 83 + unsigned int i, unsigned int n, 84 + const unsigned long *args) 85 + { 86 + static const unsigned int reg[] = XTENSA_SYSCALL_ARGUMENT_REGS; 87 + unsigned int j; 88 + 89 + if (n == 0) 90 + return; 91 + 92 + if (WARN_ON_ONCE(i + n > SYSCALL_MAX_ARGS)) { 93 + if (i < SYSCALL_MAX_ARGS) 94 + n = SYSCALL_MAX_ARGS - i; 95 + else 96 + return; 97 + } 98 + 99 + for (j = 0; j < n; ++j) 100 + regs->areg[reg[i + j]] = args[j]; 101 + } 102 + 14 103 asmlinkage long xtensa_rt_sigreturn(struct pt_regs*); 15 104 asmlinkage long xtensa_shmat(int, char __user *, int); 16 105 asmlinkage long xtensa_fadvise64_64(int, int, 17 106 unsigned long long, unsigned long long); 18 107 19 - /* Should probably move to linux/syscalls.h */ 20 - struct pollfd; 21 - asmlinkage long sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp, 22 - fd_set __user *exp, struct timespec __user *tsp, 23 - void __user *sig); 24 - asmlinkage long sys_ppoll(struct pollfd __user *ufds, unsigned int nfds, 25 - struct timespec __user *tsp, 26 - const sigset_t __user *sigmask, 27 - size_t sigsetsize); 108 + #endif
+5 -4
arch/xtensa/include/asm/thread_info.h
··· 11 11 #ifndef _XTENSA_THREAD_INFO_H 12 12 #define _XTENSA_THREAD_INFO_H 13 13 14 + #include <linux/stringify.h> 14 15 #include <asm/kmem_layout.h> 15 16 16 17 #define CURRENT_SHIFT KERNEL_STACK_SHIFT ··· 101 100 /* 102 101 * thread information flags 103 102 * - these are process state flags that various assembly files may need to access 104 - * - pending work-to-be-done flags are in LSW 105 - * - other flags in MSW 106 103 */ 107 104 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 108 105 #define TIF_SIGPENDING 1 /* signal pending */ 109 106 #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ 110 107 #define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */ 108 + #define TIF_SYSCALL_TRACEPOINT 4 /* syscall tracepoint instrumentation */ 111 109 #define TIF_MEMDIE 5 /* is terminating due to OOM killer */ 112 110 #define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */ 113 111 #define TIF_NOTIFY_RESUME 7 /* callback before returning to user */ ··· 116 116 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 117 117 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 118 118 #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) 119 + #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) 119 120 120 - #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ 121 - #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ 121 + #define _TIF_WORK_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \ 122 + _TIF_SYSCALL_TRACEPOINT) 122 123 123 124 /* 124 125 * Thread-synchronous status.
+4 -14
arch/xtensa/include/asm/timex.h
··· 10 10 #define _XTENSA_TIMEX_H 11 11 12 12 #include <asm/processor.h> 13 - #include <linux/stringify.h> 14 13 15 14 #if XCHAL_NUM_TIMERS > 0 && \ 16 15 XTENSA_INT_LEVEL(XCHAL_TIMER0_INTERRUPT) <= XCHAL_EXCM_LEVEL ··· 39 40 * Register access. 40 41 */ 41 42 42 - #define WSR_CCOUNT(r) asm volatile ("wsr %0, ccount" :: "a" (r)) 43 - #define RSR_CCOUNT(r) asm volatile ("rsr %0, ccount" : "=a" (r)) 44 - #define WSR_CCOMPARE(x,r) asm volatile ("wsr %0,"__stringify(SREG_CCOMPARE)"+"__stringify(x) :: "a"(r)) 45 - #define RSR_CCOMPARE(x,r) asm volatile ("rsr %0,"__stringify(SREG_CCOMPARE)"+"__stringify(x) : "=a"(r)) 46 - 47 43 static inline unsigned long get_ccount (void) 48 44 { 49 - unsigned long ccount; 50 - RSR_CCOUNT(ccount); 51 - return ccount; 45 + return xtensa_get_sr(ccount); 52 46 } 53 47 54 48 static inline void set_ccount (unsigned long ccount) 55 49 { 56 - WSR_CCOUNT(ccount); 50 + xtensa_set_sr(ccount, ccount); 57 51 } 58 52 59 53 static inline unsigned long get_linux_timer (void) 60 54 { 61 - unsigned ccompare; 62 - RSR_CCOMPARE(LINUX_TIMER, ccompare); 63 - return ccompare; 55 + return xtensa_get_sr(SREG_CCOMPARE + LINUX_TIMER); 64 56 } 65 57 66 58 static inline void set_linux_timer (unsigned long ccompare) 67 59 { 68 - WSR_CCOMPARE(LINUX_TIMER, ccompare); 60 + xtensa_set_sr(ccompare, SREG_CCOMPARE + LINUX_TIMER); 69 61 } 70 62 71 63 #endif /* _XTENSA_TIMEX_H */
-2
arch/xtensa/include/asm/traps.h
··· 25 25 void *fixup; 26 26 /* For passing a parameter to fixup */ 27 27 void *fixup_param; 28 - /* For fast syscall handler */ 29 - unsigned long syscall_save; 30 28 /* Fast user exception handlers */ 31 29 void *fast_user_handler[EXCCAUSE_N]; 32 30 /* Fast kernel exception handlers */
+4 -6
arch/xtensa/include/asm/uaccess.h
··· 159 159 "2: \n" \ 160 160 " .section .fixup,\"ax\" \n" \ 161 161 " .align 4 \n" \ 162 - "4: \n" \ 163 - " .long 2b \n" \ 162 + " .literal_position \n" \ 164 163 "5: \n" \ 165 - " l32r %1, 4b \n" \ 164 + " movi %1, 2b \n" \ 166 165 " movi %0, %4 \n" \ 167 166 " jx %1 \n" \ 168 167 " .previous \n" \ ··· 216 217 "2: \n" \ 217 218 " .section .fixup,\"ax\" \n" \ 218 219 " .align 4 \n" \ 219 - "4: \n" \ 220 - " .long 2b \n" \ 220 + " .literal_position \n" \ 221 221 "5: \n" \ 222 - " l32r %1, 4b \n" \ 222 + " movi %1, 2b \n" \ 223 223 " movi %2, 0 \n" \ 224 224 " movi %0, %4 \n" \ 225 225 " jx %1 \n" \
+2
arch/xtensa/include/asm/unistd.h
··· 22 22 #define __IGNORE_vfork /* use clone */ 23 23 #define __IGNORE_fadvise64 /* use fadvise64_64 */ 24 24 25 + #define NR_syscalls __NR_syscalls 26 + 25 27 #endif /* _XTENSA_UNISTD_H */
+1
arch/xtensa/include/uapi/asm/Kbuild
··· 1 1 # UAPI Header export list 2 2 include include/uapi/asm-generic/Kbuild.asm 3 3 4 + generated-y += unistd_32.h 4 5 generic-y += bitsperlong.h 5 6 generic-y += bpf_perf_event.h 6 7 generic-y += errno.h
+18
arch/xtensa/include/uapi/asm/ptrace.h
··· 12 12 #ifndef _UAPI_XTENSA_PTRACE_H 13 13 #define _UAPI_XTENSA_PTRACE_H 14 14 15 + #include <linux/types.h> 16 + 15 17 /* Registers used by strace */ 16 18 17 19 #define REG_A_BASE 0x0000 ··· 38 36 #define PTRACE_GETHBPREGS 20 39 37 #define PTRACE_SETHBPREGS 21 40 38 39 + #ifndef __ASSEMBLY__ 41 40 41 + struct user_pt_regs { 42 + __u32 pc; 43 + __u32 ps; 44 + __u32 lbeg; 45 + __u32 lend; 46 + __u32 lcount; 47 + __u32 sar; 48 + __u32 windowstart; 49 + __u32 windowbase; 50 + __u32 threadptr; 51 + __u32 reserved[7 + 48]; 52 + __u32 a[64]; 53 + }; 54 + 55 + #endif 42 56 #endif /* _UAPI_XTENSA_PTRACE_H */
+2 -779
arch/xtensa/include/uapi/asm/unistd.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 - #if !defined(_UAPI_XTENSA_UNISTD_H) || defined(__SYSCALL) 2 + #ifndef _UAPI_XTENSA_UNISTD_H 3 3 #define _UAPI_XTENSA_UNISTD_H 4 4 5 - #ifndef __SYSCALL 6 - # define __SYSCALL(nr,func,nargs) 7 - #endif 5 + #include <asm/unistd_32.h> 8 6 9 - #define __NR_spill 0 10 - __SYSCALL( 0, sys_ni_syscall, 0) 11 - #define __NR_xtensa 1 12 - __SYSCALL( 1, sys_ni_syscall, 0) 13 - #define __NR_available4 2 14 - __SYSCALL( 2, sys_ni_syscall, 0) 15 - #define __NR_available5 3 16 - __SYSCALL( 3, sys_ni_syscall, 0) 17 - #define __NR_available6 4 18 - __SYSCALL( 4, sys_ni_syscall, 0) 19 - #define __NR_available7 5 20 - __SYSCALL( 5, sys_ni_syscall, 0) 21 - #define __NR_available8 6 22 - __SYSCALL( 6, sys_ni_syscall, 0) 23 - #define __NR_available9 7 24 - __SYSCALL( 7, sys_ni_syscall, 0) 25 - 26 - /* File Operations */ 27 - 28 - #define __NR_open 8 29 - __SYSCALL( 8, sys_open, 3) 30 - #define __NR_close 9 31 - __SYSCALL( 9, sys_close, 1) 32 - #define __NR_dup 10 33 - __SYSCALL( 10, sys_dup, 1) 34 - #define __NR_dup2 11 35 - __SYSCALL( 11, sys_dup2, 2) 36 - #define __NR_read 12 37 - __SYSCALL( 12, sys_read, 3) 38 - #define __NR_write 13 39 - __SYSCALL( 13, sys_write, 3) 40 - #define __NR_select 14 41 - __SYSCALL( 14, sys_select, 5) 42 - #define __NR_lseek 15 43 - __SYSCALL( 15, sys_lseek, 3) 44 - #define __NR_poll 16 45 - __SYSCALL( 16, sys_poll, 3) 46 - #define __NR__llseek 17 47 - __SYSCALL( 17, sys_llseek, 5) 48 - #define __NR_epoll_wait 18 49 - __SYSCALL( 18, sys_epoll_wait, 4) 50 - #define __NR_epoll_ctl 19 51 - __SYSCALL( 19, sys_epoll_ctl, 4) 52 - #define __NR_epoll_create 20 53 - __SYSCALL( 20, sys_epoll_create, 1) 54 - #define __NR_creat 21 55 - __SYSCALL( 21, sys_creat, 2) 56 - #define __NR_truncate 22 57 - __SYSCALL( 22, sys_truncate, 2) 58 - #define __NR_ftruncate 23 59 - __SYSCALL( 23, sys_ftruncate, 2) 60 - #define __NR_readv 24 61 - __SYSCALL( 24, sys_readv, 3) 62 - #define __NR_writev 25 63 - __SYSCALL( 25, sys_writev, 3) 64 - #define __NR_fsync 26 65 - __SYSCALL( 26, sys_fsync, 1) 66 - #define __NR_fdatasync 27 67 - __SYSCALL( 27, sys_fdatasync, 1) 68 - #define __NR_truncate64 28 69 - __SYSCALL( 28, sys_truncate64, 2) 70 - #define __NR_ftruncate64 29 71 - __SYSCALL( 29, sys_ftruncate64, 2) 72 - #define __NR_pread64 30 73 - __SYSCALL( 30, sys_pread64, 6) 74 - #define __NR_pwrite64 31 75 - __SYSCALL( 31, sys_pwrite64, 6) 76 - 77 - #define __NR_link 32 78 - __SYSCALL( 32, sys_link, 2) 79 - #define __NR_rename 33 80 - __SYSCALL( 33, sys_rename, 2) 81 - #define __NR_symlink 34 82 - __SYSCALL( 34, sys_symlink, 2) 83 - #define __NR_readlink 35 84 - __SYSCALL( 35, sys_readlink, 3) 85 - #define __NR_mknod 36 86 - __SYSCALL( 36, sys_mknod, 3) 87 - #define __NR_pipe 37 88 - __SYSCALL( 37, sys_pipe, 1) 89 - #define __NR_unlink 38 90 - __SYSCALL( 38, sys_unlink, 1) 91 - #define __NR_rmdir 39 92 - __SYSCALL( 39, sys_rmdir, 1) 93 - 94 - #define __NR_mkdir 40 95 - __SYSCALL( 40, sys_mkdir, 2) 96 - #define __NR_chdir 41 97 - __SYSCALL( 41, sys_chdir, 1) 98 - #define __NR_fchdir 42 99 - __SYSCALL( 42, sys_fchdir, 1) 100 - #define __NR_getcwd 43 101 - __SYSCALL( 43, sys_getcwd, 2) 102 - 103 - #define __NR_chmod 44 104 - __SYSCALL( 44, sys_chmod, 2) 105 - #define __NR_chown 45 106 - __SYSCALL( 45, sys_chown, 3) 107 - #define __NR_stat 46 108 - __SYSCALL( 46, sys_newstat, 2) 109 - #define __NR_stat64 47 110 - __SYSCALL( 47, sys_stat64, 2) 111 - 112 - #define __NR_lchown 48 113 - __SYSCALL( 48, sys_lchown, 3) 114 - #define __NR_lstat 49 115 - __SYSCALL( 49, sys_newlstat, 2) 116 - #define __NR_lstat64 50 117 - __SYSCALL( 50, sys_lstat64, 2) 118 - #define __NR_available51 51 119 - __SYSCALL( 51, sys_ni_syscall, 0) 120 - 121 - #define __NR_fchmod 52 122 - __SYSCALL( 52, sys_fchmod, 2) 123 - #define __NR_fchown 53 124 - __SYSCALL( 53, sys_fchown, 3) 125 - #define __NR_fstat 54 126 - __SYSCALL( 54, sys_newfstat, 2) 127 - #define __NR_fstat64 55 128 - __SYSCALL( 55, sys_fstat64, 2) 129 - 130 - #define __NR_flock 56 131 - __SYSCALL( 56, sys_flock, 2) 132 - #define __NR_access 57 133 - __SYSCALL( 57, sys_access, 2) 134 - #define __NR_umask 58 135 - __SYSCALL( 58, sys_umask, 1) 136 - #define __NR_getdents 59 137 - __SYSCALL( 59, sys_getdents, 3) 138 - #define __NR_getdents64 60 139 - __SYSCALL( 60, sys_getdents64, 3) 140 - #define __NR_fcntl64 61 141 - __SYSCALL( 61, sys_fcntl64, 3) 142 - #define __NR_fallocate 62 143 - __SYSCALL( 62, sys_fallocate, 6) 144 - #define __NR_fadvise64_64 63 145 - __SYSCALL( 63, xtensa_fadvise64_64, 6) 146 - #define __NR_utime 64 /* glibc 2.3.3 ?? */ 147 - __SYSCALL( 64, sys_utime, 2) 148 - #define __NR_utimes 65 149 - __SYSCALL( 65, sys_utimes, 2) 150 - #define __NR_ioctl 66 151 - __SYSCALL( 66, sys_ioctl, 3) 152 - #define __NR_fcntl 67 153 - __SYSCALL( 67, sys_fcntl, 3) 154 - 155 - #define __NR_setxattr 68 156 - __SYSCALL( 68, sys_setxattr, 5) 157 - #define __NR_getxattr 69 158 - __SYSCALL( 69, sys_getxattr, 4) 159 - #define __NR_listxattr 70 160 - __SYSCALL( 70, sys_listxattr, 3) 161 - #define __NR_removexattr 71 162 - __SYSCALL( 71, sys_removexattr, 2) 163 - #define __NR_lsetxattr 72 164 - __SYSCALL( 72, sys_lsetxattr, 5) 165 - #define __NR_lgetxattr 73 166 - __SYSCALL( 73, sys_lgetxattr, 4) 167 - #define __NR_llistxattr 74 168 - __SYSCALL( 74, sys_llistxattr, 3) 169 - #define __NR_lremovexattr 75 170 - __SYSCALL( 75, sys_lremovexattr, 2) 171 - #define __NR_fsetxattr 76 172 - __SYSCALL( 76, sys_fsetxattr, 5) 173 - #define __NR_fgetxattr 77 174 - __SYSCALL( 77, sys_fgetxattr, 4) 175 - #define __NR_flistxattr 78 176 - __SYSCALL( 78, sys_flistxattr, 3) 177 - #define __NR_fremovexattr 79 178 - __SYSCALL( 79, sys_fremovexattr, 2) 179 - 180 - /* File Map / Shared Memory Operations */ 181 - 182 - #define __NR_mmap2 80 183 - __SYSCALL( 80, sys_mmap_pgoff, 6) 184 - #define __NR_munmap 81 185 - __SYSCALL( 81, sys_munmap, 2) 186 - #define __NR_mprotect 82 187 - __SYSCALL( 82, sys_mprotect, 3) 188 - #define __NR_brk 83 189 - __SYSCALL( 83, sys_brk, 1) 190 - #define __NR_mlock 84 191 - __SYSCALL( 84, sys_mlock, 2) 192 - #define __NR_munlock 85 193 - __SYSCALL( 85, sys_munlock, 2) 194 - #define __NR_mlockall 86 195 - __SYSCALL( 86, sys_mlockall, 1) 196 - #define __NR_munlockall 87 197 - __SYSCALL( 87, sys_munlockall, 0) 198 - #define __NR_mremap 88 199 - __SYSCALL( 88, sys_mremap, 4) 200 - #define __NR_msync 89 201 - __SYSCALL( 89, sys_msync, 3) 202 - #define __NR_mincore 90 203 - __SYSCALL( 90, sys_mincore, 3) 204 - #define __NR_madvise 91 205 - __SYSCALL( 91, sys_madvise, 3) 206 - #define __NR_shmget 92 207 - __SYSCALL( 92, sys_shmget, 4) 208 - #define __NR_shmat 93 209 - __SYSCALL( 93, xtensa_shmat, 4) 210 - #define __NR_shmctl 94 211 - __SYSCALL( 94, sys_shmctl, 4) 212 - #define __NR_shmdt 95 213 - __SYSCALL( 95, sys_shmdt, 4) 214 - 215 - /* Socket Operations */ 216 - 217 - #define __NR_socket 96 218 - __SYSCALL( 96, sys_socket, 3) 219 - #define __NR_setsockopt 97 220 - __SYSCALL( 97, sys_setsockopt, 5) 221 - #define __NR_getsockopt 98 222 - __SYSCALL( 98, sys_getsockopt, 5) 223 - #define __NR_shutdown 99 224 - __SYSCALL( 99, sys_shutdown, 2) 225 - 226 - #define __NR_bind 100 227 - __SYSCALL(100, sys_bind, 3) 228 - #define __NR_connect 101 229 - __SYSCALL(101, sys_connect, 3) 230 - #define __NR_listen 102 231 - __SYSCALL(102, sys_listen, 2) 232 - #define __NR_accept 103 233 - __SYSCALL(103, sys_accept, 3) 234 - 235 - #define __NR_getsockname 104 236 - __SYSCALL(104, sys_getsockname, 3) 237 - #define __NR_getpeername 105 238 - __SYSCALL(105, sys_getpeername, 3) 239 - #define __NR_sendmsg 106 240 - __SYSCALL(106, sys_sendmsg, 3) 241 - #define __NR_recvmsg 107 242 - __SYSCALL(107, sys_recvmsg, 3) 243 - #define __NR_send 108 244 - __SYSCALL(108, sys_send, 4) 245 - #define __NR_recv 109 246 - __SYSCALL(109, sys_recv, 4) 247 - #define __NR_sendto 110 248 - __SYSCALL(110, sys_sendto, 6) 249 - #define __NR_recvfrom 111 250 - __SYSCALL(111, sys_recvfrom, 6) 251 - 252 - #define __NR_socketpair 112 253 - __SYSCALL(112, sys_socketpair, 4) 254 - #define __NR_sendfile 113 255 - __SYSCALL(113, sys_sendfile, 4) 256 - #define __NR_sendfile64 114 257 - __SYSCALL(114, sys_sendfile64, 4) 258 - #define __NR_sendmmsg 115 259 - __SYSCALL(115, sys_sendmmsg, 4) 260 - 261 - /* Process Operations */ 262 - 263 - #define __NR_clone 116 264 - __SYSCALL(116, sys_clone, 5) 265 - #define __NR_execve 117 266 - __SYSCALL(117, sys_execve, 3) 267 - #define __NR_exit 118 268 - __SYSCALL(118, sys_exit, 1) 269 - #define __NR_exit_group 119 270 - __SYSCALL(119, sys_exit_group, 1) 271 - #define __NR_getpid 120 272 - __SYSCALL(120, sys_getpid, 0) 273 - #define __NR_wait4 121 274 - __SYSCALL(121, sys_wait4, 4) 275 - #define __NR_waitid 122 276 - __SYSCALL(122, sys_waitid, 5) 277 - #define __NR_kill 123 278 - __SYSCALL(123, sys_kill, 2) 279 - #define __NR_tkill 124 280 - __SYSCALL(124, sys_tkill, 2) 281 - #define __NR_tgkill 125 282 - __SYSCALL(125, sys_tgkill, 3) 283 - #define __NR_set_tid_address 126 284 - __SYSCALL(126, sys_set_tid_address, 1) 285 - #define __NR_gettid 127 286 - __SYSCALL(127, sys_gettid, 0) 287 - #define __NR_setsid 128 288 - __SYSCALL(128, sys_setsid, 0) 289 - #define __NR_getsid 129 290 - __SYSCALL(129, sys_getsid, 1) 291 - #define __NR_prctl 130 292 - __SYSCALL(130, sys_prctl, 5) 293 - #define __NR_personality 131 294 - __SYSCALL(131, sys_personality, 1) 295 - #define __NR_getpriority 132 296 - __SYSCALL(132, sys_getpriority, 2) 297 - #define __NR_setpriority 133 298 - __SYSCALL(133, sys_setpriority, 3) 299 - #define __NR_setitimer 134 300 - __SYSCALL(134, sys_setitimer, 3) 301 - #define __NR_getitimer 135 302 - __SYSCALL(135, sys_getitimer, 2) 303 - #define __NR_setuid 136 304 - __SYSCALL(136, sys_setuid, 1) 305 - #define __NR_getuid 137 306 - __SYSCALL(137, sys_getuid, 0) 307 - #define __NR_setgid 138 308 - __SYSCALL(138, sys_setgid, 1) 309 - #define __NR_getgid 139 310 - __SYSCALL(139, sys_getgid, 0) 311 - #define __NR_geteuid 140 312 - __SYSCALL(140, sys_geteuid, 0) 313 - #define __NR_getegid 141 314 - __SYSCALL(141, sys_getegid, 0) 315 - #define __NR_setreuid 142 316 - __SYSCALL(142, sys_setreuid, 2) 317 - #define __NR_setregid 143 318 - __SYSCALL(143, sys_setregid, 2) 319 - #define __NR_setresuid 144 320 - __SYSCALL(144, sys_setresuid, 3) 321 - #define __NR_getresuid 145 322 - __SYSCALL(145, sys_getresuid, 3) 323 - #define __NR_setresgid 146 324 - __SYSCALL(146, sys_setresgid, 3) 325 - #define __NR_getresgid 147 326 - __SYSCALL(147, sys_getresgid, 3) 327 - #define __NR_setpgid 148 328 - __SYSCALL(148, sys_setpgid, 2) 329 - #define __NR_getpgid 149 330 - __SYSCALL(149, sys_getpgid, 1) 331 - #define __NR_getppid 150 332 - __SYSCALL(150, sys_getppid, 0) 333 - #define __NR_getpgrp 151 334 - __SYSCALL(151, sys_getpgrp, 0) 335 - 336 - #define __NR_reserved152 152 /* set_thread_area */ 337 - __SYSCALL(152, sys_ni_syscall, 0) 338 - #define __NR_reserved153 153 /* get_thread_area */ 339 - __SYSCALL(153, sys_ni_syscall, 0) 340 - #define __NR_times 154 341 - __SYSCALL(154, sys_times, 1) 342 - #define __NR_acct 155 343 - __SYSCALL(155, sys_acct, 1) 344 - #define __NR_sched_setaffinity 156 345 - __SYSCALL(156, sys_sched_setaffinity, 3) 346 - #define __NR_sched_getaffinity 157 347 - __SYSCALL(157, sys_sched_getaffinity, 3) 348 - #define __NR_capget 158 349 - __SYSCALL(158, sys_capget, 2) 350 - #define __NR_capset 159 351 - __SYSCALL(159, sys_capset, 2) 352 - #define __NR_ptrace 160 353 - __SYSCALL(160, sys_ptrace, 4) 354 - #define __NR_semtimedop 161 355 - __SYSCALL(161, sys_semtimedop, 5) 356 - #define __NR_semget 162 357 - __SYSCALL(162, sys_semget, 4) 358 - #define __NR_semop 163 359 - __SYSCALL(163, sys_semop, 4) 360 - #define __NR_semctl 164 361 - __SYSCALL(164, sys_semctl, 4) 362 - #define __NR_available165 165 363 - __SYSCALL(165, sys_ni_syscall, 0) 364 - #define __NR_msgget 166 365 - __SYSCALL(166, sys_msgget, 4) 366 - #define __NR_msgsnd 167 367 - __SYSCALL(167, sys_msgsnd, 4) 368 - #define __NR_msgrcv 168 369 - __SYSCALL(168, sys_msgrcv, 4) 370 - #define __NR_msgctl 169 371 - __SYSCALL(169, sys_msgctl, 4) 372 - #define __NR_available170 170 373 - __SYSCALL(170, sys_ni_syscall, 0) 374 - 375 - /* File System */ 376 - 377 - #define __NR_umount2 171 378 - __SYSCALL(171, sys_umount, 2) 379 - #define __NR_mount 172 380 - __SYSCALL(172, sys_mount, 5) 381 - #define __NR_swapon 173 382 - __SYSCALL(173, sys_swapon, 2) 383 - #define __NR_chroot 174 384 - __SYSCALL(174, sys_chroot, 1) 385 - #define __NR_pivot_root 175 386 - __SYSCALL(175, sys_pivot_root, 2) 387 - #define __NR_umount 176 388 - __SYSCALL(176, sys_oldumount, 1) 389 7 #define __ARCH_WANT_SYS_OLDUMOUNT 390 - #define __NR_swapoff 177 391 - __SYSCALL(177, sys_swapoff, 1) 392 - #define __NR_sync 178 393 - __SYSCALL(178, sys_sync, 0) 394 - #define __NR_syncfs 179 395 - __SYSCALL(179, sys_syncfs, 1) 396 - #define __NR_setfsuid 180 397 - __SYSCALL(180, sys_setfsuid, 1) 398 - #define __NR_setfsgid 181 399 - __SYSCALL(181, sys_setfsgid, 1) 400 - #define __NR_sysfs 182 401 - __SYSCALL(182, sys_sysfs, 3) 402 - #define __NR_ustat 183 403 - __SYSCALL(183, sys_ustat, 2) 404 - #define __NR_statfs 184 405 - __SYSCALL(184, sys_statfs, 2) 406 - #define __NR_fstatfs 185 407 - __SYSCALL(185, sys_fstatfs, 2) 408 - #define __NR_statfs64 186 409 - __SYSCALL(186, sys_statfs64, 3) 410 - #define __NR_fstatfs64 187 411 - __SYSCALL(187, sys_fstatfs64, 3) 412 - 413 - /* System */ 414 - 415 - #define __NR_setrlimit 188 416 - __SYSCALL(188, sys_setrlimit, 2) 417 - #define __NR_getrlimit 189 418 - __SYSCALL(189, sys_getrlimit, 2) 419 - #define __NR_getrusage 190 420 - __SYSCALL(190, sys_getrusage, 2) 421 - #define __NR_futex 191 422 - __SYSCALL(191, sys_futex, 5) 423 - #define __NR_gettimeofday 192 424 - __SYSCALL(192, sys_gettimeofday, 2) 425 - #define __NR_settimeofday 193 426 - __SYSCALL(193, sys_settimeofday, 2) 427 - #define __NR_adjtimex 194 428 - __SYSCALL(194, sys_adjtimex, 1) 429 - #define __NR_nanosleep 195 430 - __SYSCALL(195, sys_nanosleep, 2) 431 - #define __NR_getgroups 196 432 - __SYSCALL(196, sys_getgroups, 2) 433 - #define __NR_setgroups 197 434 - __SYSCALL(197, sys_setgroups, 2) 435 - #define __NR_sethostname 198 436 - __SYSCALL(198, sys_sethostname, 2) 437 - #define __NR_setdomainname 199 438 - __SYSCALL(199, sys_setdomainname, 2) 439 - #define __NR_syslog 200 440 - __SYSCALL(200, sys_syslog, 3) 441 - #define __NR_vhangup 201 442 - __SYSCALL(201, sys_vhangup, 0) 443 - #define __NR_uselib 202 444 - __SYSCALL(202, sys_uselib, 1) 445 - #define __NR_reboot 203 446 - __SYSCALL(203, sys_reboot, 3) 447 - #define __NR_quotactl 204 448 - __SYSCALL(204, sys_quotactl, 4) 449 - #define __NR_nfsservctl 205 450 - __SYSCALL(205, sys_ni_syscall, 0) /* old nfsservctl */ 451 - #define __NR__sysctl 206 452 - __SYSCALL(206, sys_sysctl, 1) 453 - #define __NR_bdflush 207 454 - __SYSCALL(207, sys_bdflush, 2) 455 - #define __NR_uname 208 456 - __SYSCALL(208, sys_newuname, 1) 457 - #define __NR_sysinfo 209 458 - __SYSCALL(209, sys_sysinfo, 1) 459 - #define __NR_init_module 210 460 - __SYSCALL(210, sys_init_module, 2) 461 - #define __NR_delete_module 211 462 - __SYSCALL(211, sys_delete_module, 1) 463 - 464 - #define __NR_sched_setparam 212 465 - __SYSCALL(212, sys_sched_setparam, 2) 466 - #define __NR_sched_getparam 213 467 - __SYSCALL(213, sys_sched_getparam, 2) 468 - #define __NR_sched_setscheduler 214 469 - __SYSCALL(214, sys_sched_setscheduler, 3) 470 - #define __NR_sched_getscheduler 215 471 - __SYSCALL(215, sys_sched_getscheduler, 1) 472 - #define __NR_sched_get_priority_max 216 473 - __SYSCALL(216, sys_sched_get_priority_max, 1) 474 - #define __NR_sched_get_priority_min 217 475 - __SYSCALL(217, sys_sched_get_priority_min, 1) 476 - #define __NR_sched_rr_get_interval 218 477 - __SYSCALL(218, sys_sched_rr_get_interval, 2) 478 - #define __NR_sched_yield 219 479 - __SYSCALL(219, sys_sched_yield, 0) 480 - #define __NR_available222 222 481 - __SYSCALL(222, sys_ni_syscall, 0) 482 - 483 - /* Signal Handling */ 484 - 485 - #define __NR_restart_syscall 223 486 - __SYSCALL(223, sys_restart_syscall, 0) 487 - #define __NR_sigaltstack 224 488 - __SYSCALL(224, sys_sigaltstack, 2) 489 - #define __NR_rt_sigreturn 225 490 - __SYSCALL(225, xtensa_rt_sigreturn, 1) 491 - #define __NR_rt_sigaction 226 492 - __SYSCALL(226, sys_rt_sigaction, 4) 493 - #define __NR_rt_sigprocmask 227 494 - __SYSCALL(227, sys_rt_sigprocmask, 4) 495 - #define __NR_rt_sigpending 228 496 - __SYSCALL(228, sys_rt_sigpending, 2) 497 - #define __NR_rt_sigtimedwait 229 498 - __SYSCALL(229, sys_rt_sigtimedwait, 4) 499 - #define __NR_rt_sigqueueinfo 230 500 - __SYSCALL(230, sys_rt_sigqueueinfo, 3) 501 - #define __NR_rt_sigsuspend 231 502 - __SYSCALL(231, sys_rt_sigsuspend, 2) 503 - 504 - /* Message */ 505 - 506 - #define __NR_mq_open 232 507 - __SYSCALL(232, sys_mq_open, 4) 508 - #define __NR_mq_unlink 233 509 - __SYSCALL(233, sys_mq_unlink, 1) 510 - #define __NR_mq_timedsend 234 511 - __SYSCALL(234, sys_mq_timedsend, 5) 512 - #define __NR_mq_timedreceive 235 513 - __SYSCALL(235, sys_mq_timedreceive, 5) 514 - #define __NR_mq_notify 236 515 - __SYSCALL(236, sys_mq_notify, 2) 516 - #define __NR_mq_getsetattr 237 517 - __SYSCALL(237, sys_mq_getsetattr, 3) 518 - #define __NR_available238 238 519 - __SYSCALL(238, sys_ni_syscall, 0) 520 - 521 - /* IO */ 522 - 523 - #define __NR_io_setup 239 524 - __SYSCALL(239, sys_io_setup, 2) 525 - #define __NR_io_destroy 240 526 - __SYSCALL(240, sys_io_destroy, 1) 527 - #define __NR_io_submit 241 528 - __SYSCALL(241, sys_io_submit, 3) 529 - #define __NR_io_getevents 242 530 - __SYSCALL(242, sys_io_getevents, 5) 531 - #define __NR_io_cancel 243 532 - __SYSCALL(243, sys_io_cancel, 3) 533 - #define __NR_clock_settime 244 534 - __SYSCALL(244, sys_clock_settime, 2) 535 - #define __NR_clock_gettime 245 536 - __SYSCALL(245, sys_clock_gettime, 2) 537 - #define __NR_clock_getres 246 538 - __SYSCALL(246, sys_clock_getres, 2) 539 - #define __NR_clock_nanosleep 247 540 - __SYSCALL(247, sys_clock_nanosleep, 4) 541 - 542 - /* Timer */ 543 - 544 - #define __NR_timer_create 248 545 - __SYSCALL(248, sys_timer_create, 3) 546 - #define __NR_timer_delete 249 547 - __SYSCALL(249, sys_timer_delete, 1) 548 - #define __NR_timer_settime 250 549 - __SYSCALL(250, sys_timer_settime, 4) 550 - #define __NR_timer_gettime 251 551 - __SYSCALL(251, sys_timer_gettime, 2) 552 - #define __NR_timer_getoverrun 252 553 - __SYSCALL(252, sys_timer_getoverrun, 1) 554 - 555 - /* System */ 556 - 557 - #define __NR_reserved253 253 558 - __SYSCALL(253, sys_ni_syscall, 0) 559 - #define __NR_lookup_dcookie 254 560 - __SYSCALL(254, sys_lookup_dcookie, 4) 561 - #define __NR_available255 255 562 - __SYSCALL(255, sys_ni_syscall, 0) 563 - #define __NR_add_key 256 564 - __SYSCALL(256, sys_add_key, 5) 565 - #define __NR_request_key 257 566 - __SYSCALL(257, sys_request_key, 5) 567 - #define __NR_keyctl 258 568 - __SYSCALL(258, sys_keyctl, 5) 569 - #define __NR_available259 259 570 - __SYSCALL(259, sys_ni_syscall, 0) 571 - 572 - 573 - #define __NR_readahead 260 574 - __SYSCALL(260, sys_readahead, 5) 575 - #define __NR_remap_file_pages 261 576 - __SYSCALL(261, sys_remap_file_pages, 5) 577 - #define __NR_migrate_pages 262 578 - __SYSCALL(262, sys_migrate_pages, 0) 579 - #define __NR_mbind 263 580 - __SYSCALL(263, sys_mbind, 6) 581 - #define __NR_get_mempolicy 264 582 - __SYSCALL(264, sys_get_mempolicy, 5) 583 - #define __NR_set_mempolicy 265 584 - __SYSCALL(265, sys_set_mempolicy, 3) 585 - #define __NR_unshare 266 586 - __SYSCALL(266, sys_unshare, 1) 587 - #define __NR_move_pages 267 588 - __SYSCALL(267, sys_move_pages, 0) 589 - #define __NR_splice 268 590 - __SYSCALL(268, sys_splice, 0) 591 - #define __NR_tee 269 592 - __SYSCALL(269, sys_tee, 0) 593 - #define __NR_vmsplice 270 594 - __SYSCALL(270, sys_vmsplice, 0) 595 - #define __NR_available271 271 596 - __SYSCALL(271, sys_ni_syscall, 0) 597 - 598 - #define __NR_pselect6 272 599 - __SYSCALL(272, sys_pselect6, 0) 600 - #define __NR_ppoll 273 601 - __SYSCALL(273, sys_ppoll, 0) 602 - #define __NR_epoll_pwait 274 603 - __SYSCALL(274, sys_epoll_pwait, 0) 604 - #define __NR_epoll_create1 275 605 - __SYSCALL(275, sys_epoll_create1, 1) 606 - 607 - #define __NR_inotify_init 276 608 - __SYSCALL(276, sys_inotify_init, 0) 609 - #define __NR_inotify_add_watch 277 610 - __SYSCALL(277, sys_inotify_add_watch, 3) 611 - #define __NR_inotify_rm_watch 278 612 - __SYSCALL(278, sys_inotify_rm_watch, 2) 613 - #define __NR_inotify_init1 279 614 - __SYSCALL(279, sys_inotify_init1, 1) 615 - 616 - #define __NR_getcpu 280 617 - __SYSCALL(280, sys_getcpu, 0) 618 - #define __NR_kexec_load 281 619 - __SYSCALL(281, sys_ni_syscall, 0) 620 - 621 - #define __NR_ioprio_set 282 622 - __SYSCALL(282, sys_ioprio_set, 2) 623 - #define __NR_ioprio_get 283 624 - __SYSCALL(283, sys_ioprio_get, 3) 625 - 626 - #define __NR_set_robust_list 284 627 - __SYSCALL(284, sys_set_robust_list, 3) 628 - #define __NR_get_robust_list 285 629 - __SYSCALL(285, sys_get_robust_list, 3) 630 - #define __NR_available286 286 631 - __SYSCALL(286, sys_ni_syscall, 0) 632 - #define __NR_available287 287 633 - __SYSCALL(287, sys_ni_syscall, 0) 634 - 635 - /* Relative File Operations */ 636 - 637 - #define __NR_openat 288 638 - __SYSCALL(288, sys_openat, 4) 639 - #define __NR_mkdirat 289 640 - __SYSCALL(289, sys_mkdirat, 3) 641 - #define __NR_mknodat 290 642 - __SYSCALL(290, sys_mknodat, 4) 643 - #define __NR_unlinkat 291 644 - __SYSCALL(291, sys_unlinkat, 3) 645 - #define __NR_renameat 292 646 - __SYSCALL(292, sys_renameat, 4) 647 - #define __NR_linkat 293 648 - __SYSCALL(293, sys_linkat, 5) 649 - #define __NR_symlinkat 294 650 - __SYSCALL(294, sys_symlinkat, 3) 651 - #define __NR_readlinkat 295 652 - __SYSCALL(295, sys_readlinkat, 4) 653 - #define __NR_utimensat 296 654 - __SYSCALL(296, sys_utimensat, 0) 655 - #define __NR_fchownat 297 656 - __SYSCALL(297, sys_fchownat, 5) 657 - #define __NR_futimesat 298 658 - __SYSCALL(298, sys_futimesat, 4) 659 - #define __NR_fstatat64 299 660 - __SYSCALL(299, sys_fstatat64, 0) 661 - #define __NR_fchmodat 300 662 - __SYSCALL(300, sys_fchmodat, 4) 663 - #define __NR_faccessat 301 664 - __SYSCALL(301, sys_faccessat, 4) 665 - #define __NR_available302 302 666 - __SYSCALL(302, sys_ni_syscall, 0) 667 - #define __NR_available303 303 668 - __SYSCALL(303, sys_ni_syscall, 0) 669 - 670 - #define __NR_signalfd 304 671 - __SYSCALL(304, sys_signalfd, 3) 672 - /* 305 was __NR_timerfd */ 673 - __SYSCALL(305, sys_ni_syscall, 0) 674 - #define __NR_eventfd 306 675 - __SYSCALL(306, sys_eventfd, 1) 676 - #define __NR_recvmmsg 307 677 - __SYSCALL(307, sys_recvmmsg, 5) 678 - 679 - #define __NR_setns 308 680 - __SYSCALL(308, sys_setns, 2) 681 - #define __NR_signalfd4 309 682 - __SYSCALL(309, sys_signalfd4, 4) 683 - #define __NR_dup3 310 684 - __SYSCALL(310, sys_dup3, 3) 685 - #define __NR_pipe2 311 686 - __SYSCALL(311, sys_pipe2, 2) 687 - 688 - #define __NR_timerfd_create 312 689 - __SYSCALL(312, sys_timerfd_create, 2) 690 - #define __NR_timerfd_settime 313 691 - __SYSCALL(313, sys_timerfd_settime, 4) 692 - #define __NR_timerfd_gettime 314 693 - __SYSCALL(314, sys_timerfd_gettime, 2) 694 - #define __NR_available315 315 695 - __SYSCALL(315, sys_ni_syscall, 0) 696 - 697 - #define __NR_eventfd2 316 698 - __SYSCALL(316, sys_eventfd2, 2) 699 - #define __NR_preadv 317 700 - __SYSCALL(317, sys_preadv, 5) 701 - #define __NR_pwritev 318 702 - __SYSCALL(318, sys_pwritev, 5) 703 - #define __NR_available319 319 704 - __SYSCALL(319, sys_ni_syscall, 0) 705 - 706 - #define __NR_fanotify_init 320 707 - __SYSCALL(320, sys_fanotify_init, 2) 708 - #define __NR_fanotify_mark 321 709 - __SYSCALL(321, sys_fanotify_mark, 6) 710 - #define __NR_process_vm_readv 322 711 - __SYSCALL(322, sys_process_vm_readv, 6) 712 - #define __NR_process_vm_writev 323 713 - __SYSCALL(323, sys_process_vm_writev, 6) 714 - 715 - #define __NR_name_to_handle_at 324 716 - __SYSCALL(324, sys_name_to_handle_at, 5) 717 - #define __NR_open_by_handle_at 325 718 - __SYSCALL(325, sys_open_by_handle_at, 3) 719 - #define __NR_sync_file_range2 326 720 - __SYSCALL(326, sys_sync_file_range2, 6) 721 - #define __NR_perf_event_open 327 722 - __SYSCALL(327, sys_perf_event_open, 5) 723 - 724 - #define __NR_rt_tgsigqueueinfo 328 725 - __SYSCALL(328, sys_rt_tgsigqueueinfo, 4) 726 - #define __NR_clock_adjtime 329 727 - __SYSCALL(329, sys_clock_adjtime, 2) 728 - #define __NR_prlimit64 330 729 - __SYSCALL(330, sys_prlimit64, 4) 730 - #define __NR_kcmp 331 731 - __SYSCALL(331, sys_kcmp, 5) 732 - 733 - #define __NR_finit_module 332 734 - __SYSCALL(332, sys_finit_module, 3) 735 - 736 - #define __NR_accept4 333 737 - __SYSCALL(333, sys_accept4, 4) 738 - 739 - #define __NR_sched_setattr 334 740 - __SYSCALL(334, sys_sched_setattr, 2) 741 - #define __NR_sched_getattr 335 742 - __SYSCALL(335, sys_sched_getattr, 3) 743 - 744 - #define __NR_renameat2 336 745 - __SYSCALL(336, sys_renameat2, 5) 746 - 747 - #define __NR_seccomp 337 748 - __SYSCALL(337, sys_seccomp, 3) 749 - #define __NR_getrandom 338 750 - __SYSCALL(338, sys_getrandom, 3) 751 - #define __NR_memfd_create 339 752 - __SYSCALL(339, sys_memfd_create, 2) 753 - #define __NR_bpf 340 754 - __SYSCALL(340, sys_bpf, 3) 755 - #define __NR_execveat 341 756 - __SYSCALL(341, sys_execveat, 5) 757 - 758 - #define __NR_userfaultfd 342 759 - __SYSCALL(342, sys_userfaultfd, 1) 760 - #define __NR_membarrier 343 761 - __SYSCALL(343, sys_membarrier, 2) 762 - #define __NR_mlock2 344 763 - __SYSCALL(344, sys_mlock2, 3) 764 - #define __NR_copy_file_range 345 765 - __SYSCALL(345, sys_copy_file_range, 6) 766 - #define __NR_preadv2 346 767 - __SYSCALL(346, sys_preadv2, 6) 768 - #define __NR_pwritev2 347 769 - __SYSCALL(347, sys_pwritev2, 6) 770 - 771 - #define __NR_pkey_mprotect 348 772 - __SYSCALL(348, sys_pkey_mprotect, 4) 773 - #define __NR_pkey_alloc 349 774 - __SYSCALL(349, sys_pkey_alloc, 2) 775 - #define __NR_pkey_free 350 776 - __SYSCALL(350, sys_pkey_free, 1) 777 - 778 - #define __NR_statx 351 779 - __SYSCALL(351, sys_statx, 5) 780 - 781 - #define __NR_syscall_count 352 782 8 783 9 /* 784 10 * sysxtensa syscall handler ··· 21 795 #define SYS_XTENSA_ATOMIC_EXG_ADD 2 /* exchange memory and add */ 22 796 #define SYS_XTENSA_ATOMIC_ADD 3 /* add to memory */ 23 797 #define SYS_XTENSA_ATOMIC_CMP_SWP 4 /* compare and swap */ 24 - 25 798 #define SYS_XTENSA_COUNT 5 /* count */ 26 - 27 - #undef __SYSCALL 28 799 29 800 #endif /* _UAPI_XTENSA_UNISTD_H */
+1
arch/xtensa/kernel/Makefile
··· 16 16 obj-$(CONFIG_XTENSA_VARIANT_HAVE_PERF_EVENTS) += perf_event.o 17 17 obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o 18 18 obj-$(CONFIG_S32C1I_SELFTEST) += s32c1i_selftest.o 19 + obj-$(CONFIG_JUMP_LABEL) += jump_label.o 19 20 20 21 # In the Xtensa architecture, assembly generates literals which must always 21 22 # precede the L32R instruction with a relative offset less than 256 kB.
-2
arch/xtensa/kernel/asm-offsets.c
··· 137 137 DEFINE(EXC_TABLE_DOUBLE_SAVE, offsetof(struct exc_table, double_save)); 138 138 DEFINE(EXC_TABLE_FIXUP, offsetof(struct exc_table, fixup)); 139 139 DEFINE(EXC_TABLE_PARAM, offsetof(struct exc_table, fixup_param)); 140 - DEFINE(EXC_TABLE_SYSCALL_SAVE, 141 - offsetof(struct exc_table, syscall_save)); 142 140 DEFINE(EXC_TABLE_FAST_USER, 143 141 offsetof(struct exc_table, fast_user_handler)); 144 142 DEFINE(EXC_TABLE_FAST_KERNEL,
+20 -82
arch/xtensa/kernel/coprocessor.S
··· 33 33 */ 34 34 35 35 #define SAVE_CP_REGS(x) \ 36 - .align 4; \ 37 - .Lsave_cp_regs_cp##x: \ 38 36 .if XTENSA_HAVE_COPROCESSOR(x); \ 37 + .align 4; \ 38 + .Lsave_cp_regs_cp##x: \ 39 39 xchal_cp##x##_store a2 a4 a5 a6 a7; \ 40 - .endif; \ 41 - jx a0 40 + jx a0; \ 41 + .endif 42 42 43 43 #define SAVE_CP_REGS_TAB(x) \ 44 44 .if XTENSA_HAVE_COPROCESSOR(x); \ 45 - .long .Lsave_cp_regs_cp##x - .Lsave_cp_regs_jump_table; \ 45 + .long .Lsave_cp_regs_cp##x; \ 46 46 .else; \ 47 47 .long 0; \ 48 48 .endif; \ ··· 50 50 51 51 52 52 #define LOAD_CP_REGS(x) \ 53 - .align 4; \ 54 - .Lload_cp_regs_cp##x: \ 55 53 .if XTENSA_HAVE_COPROCESSOR(x); \ 54 + .align 4; \ 55 + .Lload_cp_regs_cp##x: \ 56 56 xchal_cp##x##_load a2 a4 a5 a6 a7; \ 57 - .endif; \ 58 - jx a0 57 + jx a0; \ 58 + .endif 59 59 60 60 #define LOAD_CP_REGS_TAB(x) \ 61 61 .if XTENSA_HAVE_COPROCESSOR(x); \ 62 - .long .Lload_cp_regs_cp##x - .Lload_cp_regs_jump_table; \ 62 + .long .Lload_cp_regs_cp##x; \ 63 63 .else; \ 64 64 .long 0; \ 65 65 .endif; \ ··· 83 83 LOAD_CP_REGS(6) 84 84 LOAD_CP_REGS(7) 85 85 86 + .section ".rodata", "a" 86 87 .align 4 87 88 .Lsave_cp_regs_jump_table: 88 89 SAVE_CP_REGS_TAB(0) ··· 105 104 LOAD_CP_REGS_TAB(6) 106 105 LOAD_CP_REGS_TAB(7) 107 106 108 - /* 109 - * coprocessor_save(buffer, index) 110 - * a2 a3 111 - * coprocessor_load(buffer, index) 112 - * a2 a3 113 - * 114 - * Save or load coprocessor registers for coprocessor 'index'. 115 - * The register values are saved to or loaded from them 'buffer' address. 116 - * 117 - * Note that these functions don't update the coprocessor_owner information! 118 - * 119 - */ 120 - 121 - ENTRY(coprocessor_save) 122 - 123 - entry a1, 32 124 - s32i a0, a1, 0 125 - movi a0, .Lsave_cp_regs_jump_table 126 - addx8 a3, a3, a0 127 - l32i a3, a3, 0 128 - beqz a3, 1f 129 - add a0, a0, a3 130 - callx0 a0 131 - 1: l32i a0, a1, 0 132 - retw 133 - 134 - ENDPROC(coprocessor_save) 135 - 136 - ENTRY(coprocessor_load) 137 - 138 - entry a1, 32 139 - s32i a0, a1, 0 140 - movi a0, .Lload_cp_regs_jump_table 141 - addx4 a3, a3, a0 142 - l32i a3, a3, 0 143 - beqz a3, 1f 144 - add a0, a0, a3 145 - callx0 a0 146 - 1: l32i a0, a1, 0 147 - retw 148 - 149 - ENDPROC(coprocessor_load) 107 + .previous 150 108 151 109 /* 152 - * coprocessor_flush(struct task_info*, index) 110 + * coprocessor_flush(struct thread_info*, index) 153 111 * a2 a3 154 - * coprocessor_restore(struct task_info*, index) 155 - * a2 a3 156 112 * 157 - * Save or load coprocessor registers for coprocessor 'index'. 113 + * Save coprocessor registers for coprocessor 'index'. 158 114 * The register values are saved to or loaded from the coprocessor area 159 115 * inside the task_info structure. 160 116 * 161 - * Note that these functions don't update the coprocessor_owner information! 117 + * Note that this function doesn't update the coprocessor_owner information! 162 118 * 163 119 */ 164 - 165 120 166 121 ENTRY(coprocessor_flush) 167 122 ··· 129 172 l32i a3, a3, 0 130 173 add a2, a2, a4 131 174 beqz a3, 1f 132 - add a0, a0, a3 133 - callx0 a0 175 + callx0 a3 134 176 1: l32i a0, a1, 0 135 177 retw 136 178 137 179 ENDPROC(coprocessor_flush) 138 - 139 - ENTRY(coprocessor_restore) 140 - entry a1, 32 141 - s32i a0, a1, 0 142 - movi a0, .Lload_cp_regs_jump_table 143 - addx4 a3, a3, a0 144 - l32i a4, a3, 4 145 - l32i a3, a3, 0 146 - add a2, a2, a4 147 - beqz a3, 1f 148 - add a0, a0, a3 149 - callx0 a0 150 - 1: l32i a0, a1, 0 151 - retw 152 - 153 - ENDPROC(coprocessor_restore) 154 180 155 181 /* 156 182 * Entry condition: ··· 214 274 movi a0, 2f # a0: 'return' address 215 275 addx8 a3, a3, a5 # a3: coprocessor number 216 276 l32i a2, a3, 4 # a2: xtregs offset 217 - l32i a3, a3, 0 # a3: jump offset 277 + l32i a3, a3, 0 # a3: jump address 218 278 add a2, a2, a4 219 - add a4, a3, a5 # a4: address of save routine 220 - jx a4 279 + jx a3 221 280 222 281 /* Note that only a0 and a1 were preserved. */ 223 282 ··· 236 297 movi a0, 1f 237 298 addx8 a3, a3, a5 238 299 l32i a2, a3, 4 # a2: xtregs offset 239 - l32i a3, a3, 0 # a3: jump offset 300 + l32i a3, a3, 0 # a3: jump address 240 301 add a2, a2, a4 241 - add a4, a3, a5 242 - jx a4 302 + jx a3 243 303 244 304 /* Restore all registers and return from exception handler. */ 245 305
+21 -28
arch/xtensa/kernel/entry.S
··· 364 364 s32i a2, a1, PT_DEBUGCAUSE 365 365 s32i a3, a1, PT_PC 366 366 367 - movi a2, -1 367 + movi a2, NO_SYSCALL 368 368 rsr a3, excvaddr 369 369 s32i a2, a1, PT_SYSCALL 370 370 movi a2, 0 ··· 1021 1021 * depc: a2, original value saved on stack (PT_DEPC) 1022 1022 * excsave_1: dispatch table 1023 1023 */ 1024 - 1025 - ENTRY(fast_syscall_kernel) 1026 - 1027 - /* Skip syscall. */ 1028 - 1029 - rsr a0, epc1 1030 - addi a0, a0, 3 1031 - wsr a0, epc1 1032 - 1033 - l32i a0, a2, PT_DEPC 1034 - bgeui a0, VALID_DOUBLE_EXCEPTION_ADDRESS, fast_syscall_unrecoverable 1035 - 1036 - rsr a0, depc # get syscall-nr 1037 - _beqz a0, fast_syscall_spill_registers 1038 - _beqi a0, __NR_xtensa, fast_syscall_xtensa 1039 - 1040 - j kernel_exception 1041 - 1042 - ENDPROC(fast_syscall_kernel) 1043 1024 1044 1025 ENTRY(fast_syscall_user) 1045 1026 ··· 1846 1865 1847 1866 /* regs->syscall = regs->areg[2] */ 1848 1867 1849 - l32i a3, a2, PT_AREG2 1850 - mov a6, a2 1851 - s32i a3, a2, PT_SYSCALL 1852 - call4 do_syscall_trace_enter 1853 - mov a3, a6 1868 + l32i a7, a2, PT_AREG2 1869 + s32i a7, a2, PT_SYSCALL 1854 1870 1871 + GET_THREAD_INFO(a4, a1) 1872 + l32i a3, a4, TI_FLAGS 1873 + movi a4, _TIF_WORK_MASK 1874 + and a3, a3, a4 1875 + beqz a3, 1f 1876 + 1877 + mov a6, a2 1878 + call4 do_syscall_trace_enter 1879 + l32i a7, a2, PT_SYSCALL 1880 + 1881 + 1: 1855 1882 /* syscall = sys_call_table[syscall_nr] */ 1856 1883 1857 1884 movi a4, sys_call_table 1858 - movi a5, __NR_syscall_count 1885 + movi a5, __NR_syscalls 1859 1886 movi a6, -ENOSYS 1860 - bgeu a3, a5, 1f 1887 + bgeu a7, a5, 1f 1861 1888 1862 - addx4 a4, a3, a4 1889 + addx4 a4, a7, a4 1863 1890 l32i a4, a4, 0 1864 1891 movi a5, sys_ni_syscall; 1865 1892 beq a4, a5, 1f ··· 1889 1900 1: /* regs->areg[2] = return_value */ 1890 1901 1891 1902 s32i a6, a2, PT_AREG2 1903 + bnez a3, 1f 1904 + retw 1905 + 1906 + 1: 1892 1907 mov a6, a2 1893 1908 call4 do_syscall_trace_leave 1894 1909 retw
+2 -6
arch/xtensa/kernel/head.S
··· 59 59 60 60 .align 4 61 61 .literal_position 62 - .Lstartup: 63 - .word _startup 64 - 65 - .align 4 66 62 _SetupOCD: 67 63 /* 68 64 * Initialize WB, WS, and clear PS.EXCM (to allow loop instructions). ··· 95 99 1: 96 100 #endif 97 101 #endif 98 - .end no-absolute-literals 99 102 100 - l32r a0, .Lstartup 103 + movi a0, _startup 101 104 jx a0 102 105 103 106 ENDPROC(_start) 107 + .end no-absolute-literals 104 108 105 109 __REF 106 110 .literal_position
+11 -10
arch/xtensa/kernel/hw_breakpoint.c
··· 101 101 switch (sr) { 102 102 #if XCHAL_NUM_IBREAK > 0 103 103 case SREG_IBREAKA + 0: 104 - WSR(v, SREG_IBREAKA + 0); 104 + xtensa_set_sr(v, SREG_IBREAKA + 0); 105 105 break; 106 106 #endif 107 107 #if XCHAL_NUM_IBREAK > 1 108 108 case SREG_IBREAKA + 1: 109 - WSR(v, SREG_IBREAKA + 1); 109 + xtensa_set_sr(v, SREG_IBREAKA + 1); 110 110 break; 111 111 #endif 112 112 113 113 #if XCHAL_NUM_DBREAK > 0 114 114 case SREG_DBREAKA + 0: 115 - WSR(v, SREG_DBREAKA + 0); 115 + xtensa_set_sr(v, SREG_DBREAKA + 0); 116 116 break; 117 117 case SREG_DBREAKC + 0: 118 - WSR(v, SREG_DBREAKC + 0); 118 + xtensa_set_sr(v, SREG_DBREAKC + 0); 119 119 break; 120 120 #endif 121 121 #if XCHAL_NUM_DBREAK > 1 122 122 case SREG_DBREAKA + 1: 123 - WSR(v, SREG_DBREAKA + 1); 123 + xtensa_set_sr(v, SREG_DBREAKA + 1); 124 124 break; 125 125 126 126 case SREG_DBREAKC + 1: 127 - WSR(v, SREG_DBREAKC + 1); 127 + xtensa_set_sr(v, SREG_DBREAKC + 1); 128 128 break; 129 129 #endif 130 130 } ··· 150 150 unsigned long ibreakenable; 151 151 152 152 xtensa_wsr(info->address, SREG_IBREAKA + reg); 153 - RSR(ibreakenable, SREG_IBREAKENABLE); 154 - WSR(ibreakenable | (1 << reg), SREG_IBREAKENABLE); 153 + ibreakenable = xtensa_get_sr(SREG_IBREAKENABLE); 154 + xtensa_set_sr(ibreakenable | (1 << reg), SREG_IBREAKENABLE); 155 155 } 156 156 157 157 static void set_dbreak_regs(int reg, struct perf_event *bp) ··· 214 214 /* Breakpoint */ 215 215 i = free_slot(this_cpu_ptr(bp_on_reg), XCHAL_NUM_IBREAK, bp); 216 216 if (i >= 0) { 217 - RSR(ibreakenable, SREG_IBREAKENABLE); 218 - WSR(ibreakenable & ~(1 << i), SREG_IBREAKENABLE); 217 + ibreakenable = xtensa_get_sr(SREG_IBREAKENABLE); 218 + xtensa_set_sr(ibreakenable & ~(1 << i), 219 + SREG_IBREAKENABLE); 219 220 } 220 221 } else { 221 222 /* Watchpoint */
+99
arch/xtensa/kernel/jump_label.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // Copyright (C) 2018 Cadence Design Systems Inc. 3 + 4 + #include <linux/cpu.h> 5 + #include <linux/jump_label.h> 6 + #include <linux/kernel.h> 7 + #include <linux/memory.h> 8 + #include <linux/stop_machine.h> 9 + #include <linux/types.h> 10 + 11 + #include <asm/cacheflush.h> 12 + 13 + #ifdef HAVE_JUMP_LABEL 14 + 15 + #define J_OFFSET_MASK 0x0003ffff 16 + #define J_SIGN_MASK (~(J_OFFSET_MASK >> 1)) 17 + 18 + #if defined(__XTENSA_EL__) 19 + #define J_INSN 0x6 20 + #define NOP_INSN 0x0020f0 21 + #elif defined(__XTENSA_EB__) 22 + #define J_INSN 0x60000000 23 + #define NOP_INSN 0x0f020000 24 + #else 25 + #error Unsupported endianness. 26 + #endif 27 + 28 + struct patch { 29 + atomic_t cpu_count; 30 + unsigned long addr; 31 + size_t sz; 32 + const void *data; 33 + }; 34 + 35 + static void local_patch_text(unsigned long addr, const void *data, size_t sz) 36 + { 37 + memcpy((void *)addr, data, sz); 38 + local_flush_icache_range(addr, addr + sz); 39 + } 40 + 41 + static int patch_text_stop_machine(void *data) 42 + { 43 + struct patch *patch = data; 44 + 45 + if (atomic_inc_return(&patch->cpu_count) == 1) { 46 + local_patch_text(patch->addr, patch->data, patch->sz); 47 + atomic_inc(&patch->cpu_count); 48 + } else { 49 + while (atomic_read(&patch->cpu_count) <= num_online_cpus()) 50 + cpu_relax(); 51 + __invalidate_icache_range(patch->addr, patch->sz); 52 + } 53 + return 0; 54 + } 55 + 56 + static void patch_text(unsigned long addr, const void *data, size_t sz) 57 + { 58 + if (IS_ENABLED(CONFIG_SMP)) { 59 + struct patch patch = { 60 + .cpu_count = ATOMIC_INIT(0), 61 + .addr = addr, 62 + .sz = sz, 63 + .data = data, 64 + }; 65 + stop_machine_cpuslocked(patch_text_stop_machine, 66 + &patch, NULL); 67 + } else { 68 + unsigned long flags; 69 + 70 + local_irq_save(flags); 71 + local_patch_text(addr, data, sz); 72 + local_irq_restore(flags); 73 + } 74 + } 75 + 76 + void arch_jump_label_transform(struct jump_entry *e, 77 + enum jump_label_type type) 78 + { 79 + u32 d = (jump_entry_target(e) - (jump_entry_code(e) + 4)); 80 + u32 insn; 81 + 82 + /* Jump only works within 128K of the J instruction. */ 83 + BUG_ON(!((d & J_SIGN_MASK) == 0 || 84 + (d & J_SIGN_MASK) == J_SIGN_MASK)); 85 + 86 + if (type == JUMP_LABEL_JMP) { 87 + #if defined(__XTENSA_EL__) 88 + insn = ((d & J_OFFSET_MASK) << 6) | J_INSN; 89 + #elif defined(__XTENSA_EB__) 90 + insn = ((d & J_OFFSET_MASK) << 8) | J_INSN; 91 + #endif 92 + } else { 93 + insn = NOP_INSN; 94 + } 95 + 96 + patch_text(jump_entry_code(e), &insn, JUMP_LABEL_NOP_SIZE); 97 + } 98 + 99 + #endif /* HAVE_JUMP_LABEL */
+5 -50
arch/xtensa/kernel/process.c
··· 87 87 } 88 88 89 89 ti->cpenable = cpenable; 90 - coprocessor_clear_cpenable(); 90 + if (ti == current_thread_info()) 91 + xtensa_set_sr(0, cpenable); 91 92 92 93 preempt_enable(); 93 94 } ··· 100 99 101 100 preempt_disable(); 102 101 103 - RSR_CPENABLE(old_cpenable); 102 + old_cpenable = xtensa_get_sr(cpenable); 104 103 cpenable = ti->cpenable; 105 - WSR_CPENABLE(cpenable); 104 + xtensa_set_sr(cpenable, cpenable); 106 105 107 106 for (i = 0; i < XCHAL_CP_MAX; i++) { 108 107 if ((cpenable & 1) != 0 && coprocessor_owner[i] == ti) 109 108 coprocessor_flush(ti, i); 110 109 cpenable >>= 1; 111 110 } 112 - WSR_CPENABLE(old_cpenable); 111 + xtensa_set_sr(old_cpenable, cpenable); 113 112 114 113 preempt_enable(); 115 114 } ··· 324 323 pc = MAKE_PC_FROM_RA(*(unsigned long*)sp - 4, sp); 325 324 sp = *(unsigned long *)sp - 3; 326 325 } while (count++ < 16); 327 - return 0; 328 - } 329 - 330 - /* 331 - * xtensa_gregset_t and 'struct pt_regs' are vastly different formats 332 - * of processor registers. Besides different ordering, 333 - * xtensa_gregset_t contains non-live register information that 334 - * 'struct pt_regs' does not. Exception handling (primarily) uses 335 - * 'struct pt_regs'. Core files and ptrace use xtensa_gregset_t. 336 - * 337 - */ 338 - 339 - void xtensa_elf_core_copy_regs (xtensa_gregset_t *elfregs, struct pt_regs *regs) 340 - { 341 - unsigned long wb, ws, wm; 342 - int live, last; 343 - 344 - wb = regs->windowbase; 345 - ws = regs->windowstart; 346 - wm = regs->wmask; 347 - ws = ((ws >> wb) | (ws << (WSBITS - wb))) & ((1 << WSBITS) - 1); 348 - 349 - /* Don't leak any random bits. */ 350 - 351 - memset(elfregs, 0, sizeof(*elfregs)); 352 - 353 - /* Note: PS.EXCM is not set while user task is running; its 354 - * being set in regs->ps is for exception handling convenience. 355 - */ 356 - 357 - elfregs->pc = regs->pc; 358 - elfregs->ps = (regs->ps & ~(1 << PS_EXCM_BIT)); 359 - elfregs->lbeg = regs->lbeg; 360 - elfregs->lend = regs->lend; 361 - elfregs->lcount = regs->lcount; 362 - elfregs->sar = regs->sar; 363 - elfregs->windowstart = ws; 364 - 365 - live = (wm & 2) ? 4 : (wm & 4) ? 8 : (wm & 8) ? 12 : 16; 366 - last = XCHAL_NUM_AREGS - (wm >> 4) * 4; 367 - memcpy(elfregs->a, regs->areg, live * 4); 368 - memcpy(elfregs->a + last, regs->areg + last, (wm >> 4) * 16); 369 - } 370 - 371 - int dump_fpu(void) 372 - { 373 326 return 0; 374 327 }
+205 -156
arch/xtensa/kernel/ptrace.c
··· 18 18 #include <linux/mm.h> 19 19 #include <linux/perf_event.h> 20 20 #include <linux/ptrace.h> 21 + #include <linux/regset.h> 21 22 #include <linux/sched.h> 22 23 #include <linux/sched/task_stack.h> 23 24 #include <linux/security.h> ··· 27 26 #include <linux/tracehook.h> 28 27 #include <linux/uaccess.h> 29 28 29 + #define CREATE_TRACE_POINTS 30 + #include <trace/events/syscalls.h> 31 + 30 32 #include <asm/coprocessor.h> 31 33 #include <asm/elf.h> 32 34 #include <asm/page.h> 33 35 #include <asm/pgtable.h> 34 36 #include <asm/ptrace.h> 35 37 38 + static int gpr_get(struct task_struct *target, 39 + const struct user_regset *regset, 40 + unsigned int pos, unsigned int count, 41 + void *kbuf, void __user *ubuf) 42 + { 43 + struct pt_regs *regs = task_pt_regs(target); 44 + struct user_pt_regs newregs = { 45 + .pc = regs->pc, 46 + .ps = regs->ps & ~(1 << PS_EXCM_BIT), 47 + .lbeg = regs->lbeg, 48 + .lend = regs->lend, 49 + .lcount = regs->lcount, 50 + .sar = regs->sar, 51 + .threadptr = regs->threadptr, 52 + .windowbase = regs->windowbase, 53 + .windowstart = regs->windowstart, 54 + }; 55 + 56 + memcpy(newregs.a, 57 + regs->areg + XCHAL_NUM_AREGS - regs->windowbase * 4, 58 + regs->windowbase * 16); 59 + memcpy(newregs.a + regs->windowbase * 4, 60 + regs->areg, 61 + (WSBITS - regs->windowbase) * 16); 62 + 63 + return user_regset_copyout(&pos, &count, &kbuf, &ubuf, 64 + &newregs, 0, -1); 65 + } 66 + 67 + static int gpr_set(struct task_struct *target, 68 + const struct user_regset *regset, 69 + unsigned int pos, unsigned int count, 70 + const void *kbuf, const void __user *ubuf) 71 + { 72 + int ret; 73 + struct user_pt_regs newregs = {0}; 74 + struct pt_regs *regs; 75 + const u32 ps_mask = PS_CALLINC_MASK | PS_OWB_MASK; 76 + 77 + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &newregs, 0, -1); 78 + if (ret) 79 + return ret; 80 + 81 + if (newregs.windowbase >= XCHAL_NUM_AREGS / 4) 82 + return -EINVAL; 83 + 84 + regs = task_pt_regs(target); 85 + regs->pc = newregs.pc; 86 + regs->ps = (regs->ps & ~ps_mask) | (newregs.ps & ps_mask); 87 + regs->lbeg = newregs.lbeg; 88 + regs->lend = newregs.lend; 89 + regs->lcount = newregs.lcount; 90 + regs->sar = newregs.sar; 91 + regs->threadptr = newregs.threadptr; 92 + 93 + if (newregs.windowbase != regs->windowbase || 94 + newregs.windowstart != regs->windowstart) { 95 + u32 rotws, wmask; 96 + 97 + rotws = (((newregs.windowstart | 98 + (newregs.windowstart << WSBITS)) >> 99 + newregs.windowbase) & 100 + ((1 << WSBITS) - 1)) & ~1; 101 + wmask = ((rotws ? WSBITS + 1 - ffs(rotws) : 0) << 4) | 102 + (rotws & 0xF) | 1; 103 + regs->windowbase = newregs.windowbase; 104 + regs->windowstart = newregs.windowstart; 105 + regs->wmask = wmask; 106 + } 107 + 108 + memcpy(regs->areg + XCHAL_NUM_AREGS - newregs.windowbase * 4, 109 + newregs.a, newregs.windowbase * 16); 110 + memcpy(regs->areg, newregs.a + newregs.windowbase * 4, 111 + (WSBITS - newregs.windowbase) * 16); 112 + 113 + return 0; 114 + } 115 + 116 + static int tie_get(struct task_struct *target, 117 + const struct user_regset *regset, 118 + unsigned int pos, unsigned int count, 119 + void *kbuf, void __user *ubuf) 120 + { 121 + int ret; 122 + struct pt_regs *regs = task_pt_regs(target); 123 + struct thread_info *ti = task_thread_info(target); 124 + elf_xtregs_t *newregs = kzalloc(sizeof(elf_xtregs_t), GFP_KERNEL); 125 + 126 + if (!newregs) 127 + return -ENOMEM; 128 + 129 + newregs->opt = regs->xtregs_opt; 130 + newregs->user = ti->xtregs_user; 131 + 132 + #if XTENSA_HAVE_COPROCESSORS 133 + /* Flush all coprocessor registers to memory. */ 134 + coprocessor_flush_all(ti); 135 + newregs->cp0 = ti->xtregs_cp.cp0; 136 + newregs->cp1 = ti->xtregs_cp.cp1; 137 + newregs->cp2 = ti->xtregs_cp.cp2; 138 + newregs->cp3 = ti->xtregs_cp.cp3; 139 + newregs->cp4 = ti->xtregs_cp.cp4; 140 + newregs->cp5 = ti->xtregs_cp.cp5; 141 + newregs->cp6 = ti->xtregs_cp.cp6; 142 + newregs->cp7 = ti->xtregs_cp.cp7; 143 + #endif 144 + ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, 145 + newregs, 0, -1); 146 + kfree(newregs); 147 + return ret; 148 + } 149 + 150 + static int tie_set(struct task_struct *target, 151 + const struct user_regset *regset, 152 + unsigned int pos, unsigned int count, 153 + const void *kbuf, const void __user *ubuf) 154 + { 155 + int ret; 156 + struct pt_regs *regs = task_pt_regs(target); 157 + struct thread_info *ti = task_thread_info(target); 158 + elf_xtregs_t *newregs = kzalloc(sizeof(elf_xtregs_t), GFP_KERNEL); 159 + 160 + if (!newregs) 161 + return -ENOMEM; 162 + 163 + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, 164 + newregs, 0, -1); 165 + 166 + if (ret) 167 + goto exit; 168 + regs->xtregs_opt = newregs->opt; 169 + ti->xtregs_user = newregs->user; 170 + 171 + #if XTENSA_HAVE_COPROCESSORS 172 + /* Flush all coprocessors before we overwrite them. */ 173 + coprocessor_flush_all(ti); 174 + coprocessor_release_all(ti); 175 + ti->xtregs_cp.cp0 = newregs->cp0; 176 + ti->xtregs_cp.cp1 = newregs->cp1; 177 + ti->xtregs_cp.cp2 = newregs->cp2; 178 + ti->xtregs_cp.cp3 = newregs->cp3; 179 + ti->xtregs_cp.cp4 = newregs->cp4; 180 + ti->xtregs_cp.cp5 = newregs->cp5; 181 + ti->xtregs_cp.cp6 = newregs->cp6; 182 + ti->xtregs_cp.cp7 = newregs->cp7; 183 + #endif 184 + exit: 185 + kfree(newregs); 186 + return ret; 187 + } 188 + 189 + enum xtensa_regset { 190 + REGSET_GPR, 191 + REGSET_TIE, 192 + }; 193 + 194 + static const struct user_regset xtensa_regsets[] = { 195 + [REGSET_GPR] = { 196 + .core_note_type = NT_PRSTATUS, 197 + .n = sizeof(struct user_pt_regs) / sizeof(u32), 198 + .size = sizeof(u32), 199 + .align = sizeof(u32), 200 + .get = gpr_get, 201 + .set = gpr_set, 202 + }, 203 + [REGSET_TIE] = { 204 + .core_note_type = NT_PRFPREG, 205 + .n = sizeof(elf_xtregs_t) / sizeof(u32), 206 + .size = sizeof(u32), 207 + .align = sizeof(u32), 208 + .get = tie_get, 209 + .set = tie_set, 210 + }, 211 + }; 212 + 213 + static const struct user_regset_view user_xtensa_view = { 214 + .name = "xtensa", 215 + .e_machine = EM_XTENSA, 216 + .regsets = xtensa_regsets, 217 + .n = ARRAY_SIZE(xtensa_regsets) 218 + }; 219 + 220 + const struct user_regset_view *task_user_regset_view(struct task_struct *task) 221 + { 222 + return &user_xtensa_view; 223 + } 36 224 37 225 void user_enable_single_step(struct task_struct *child) 38 226 { ··· 244 54 245 55 static int ptrace_getregs(struct task_struct *child, void __user *uregs) 246 56 { 247 - struct pt_regs *regs = task_pt_regs(child); 248 - xtensa_gregset_t __user *gregset = uregs; 249 - unsigned long wb = regs->windowbase; 250 - int i; 251 - 252 - if (!access_ok(VERIFY_WRITE, uregs, sizeof(xtensa_gregset_t))) 253 - return -EIO; 254 - 255 - __put_user(regs->pc, &gregset->pc); 256 - __put_user(regs->ps & ~(1 << PS_EXCM_BIT), &gregset->ps); 257 - __put_user(regs->lbeg, &gregset->lbeg); 258 - __put_user(regs->lend, &gregset->lend); 259 - __put_user(regs->lcount, &gregset->lcount); 260 - __put_user(regs->windowstart, &gregset->windowstart); 261 - __put_user(regs->windowbase, &gregset->windowbase); 262 - __put_user(regs->threadptr, &gregset->threadptr); 263 - 264 - for (i = 0; i < XCHAL_NUM_AREGS; i++) 265 - __put_user(regs->areg[i], 266 - gregset->a + ((wb * 4 + i) % XCHAL_NUM_AREGS)); 267 - 268 - return 0; 57 + return copy_regset_to_user(child, &user_xtensa_view, REGSET_GPR, 58 + 0, sizeof(xtensa_gregset_t), uregs); 269 59 } 270 60 271 61 static int ptrace_setregs(struct task_struct *child, void __user *uregs) 272 62 { 273 - struct pt_regs *regs = task_pt_regs(child); 274 - xtensa_gregset_t *gregset = uregs; 275 - const unsigned long ps_mask = PS_CALLINC_MASK | PS_OWB_MASK; 276 - unsigned long ps; 277 - unsigned long wb, ws; 278 - 279 - if (!access_ok(VERIFY_WRITE, uregs, sizeof(xtensa_gregset_t))) 280 - return -EIO; 281 - 282 - __get_user(regs->pc, &gregset->pc); 283 - __get_user(ps, &gregset->ps); 284 - __get_user(regs->lbeg, &gregset->lbeg); 285 - __get_user(regs->lend, &gregset->lend); 286 - __get_user(regs->lcount, &gregset->lcount); 287 - __get_user(ws, &gregset->windowstart); 288 - __get_user(wb, &gregset->windowbase); 289 - __get_user(regs->threadptr, &gregset->threadptr); 290 - 291 - regs->ps = (regs->ps & ~ps_mask) | (ps & ps_mask) | (1 << PS_EXCM_BIT); 292 - 293 - if (wb >= XCHAL_NUM_AREGS / 4) 294 - return -EFAULT; 295 - 296 - if (wb != regs->windowbase || ws != regs->windowstart) { 297 - unsigned long rotws, wmask; 298 - 299 - rotws = (((ws | (ws << WSBITS)) >> wb) & 300 - ((1 << WSBITS) - 1)) & ~1; 301 - wmask = ((rotws ? WSBITS + 1 - ffs(rotws) : 0) << 4) | 302 - (rotws & 0xF) | 1; 303 - regs->windowbase = wb; 304 - regs->windowstart = ws; 305 - regs->wmask = wmask; 306 - } 307 - 308 - if (wb != 0 && __copy_from_user(regs->areg + XCHAL_NUM_AREGS - wb * 4, 309 - gregset->a, wb * 16)) 310 - return -EFAULT; 311 - 312 - if (__copy_from_user(regs->areg, gregset->a + wb * 4, 313 - (WSBITS - wb) * 16)) 314 - return -EFAULT; 315 - 316 - return 0; 63 + return copy_regset_from_user(child, &user_xtensa_view, REGSET_GPR, 64 + 0, sizeof(xtensa_gregset_t), uregs); 317 65 } 318 - 319 - 320 - #if XTENSA_HAVE_COPROCESSORS 321 - #define CP_OFFSETS(cp) \ 322 - { \ 323 - .elf_xtregs_offset = offsetof(elf_xtregs_t, cp), \ 324 - .ti_offset = offsetof(struct thread_info, xtregs_cp.cp), \ 325 - .sz = sizeof(xtregs_ ## cp ## _t), \ 326 - } 327 - 328 - static const struct { 329 - size_t elf_xtregs_offset; 330 - size_t ti_offset; 331 - size_t sz; 332 - } cp_offsets[] = { 333 - CP_OFFSETS(cp0), 334 - CP_OFFSETS(cp1), 335 - CP_OFFSETS(cp2), 336 - CP_OFFSETS(cp3), 337 - CP_OFFSETS(cp4), 338 - CP_OFFSETS(cp5), 339 - CP_OFFSETS(cp6), 340 - CP_OFFSETS(cp7), 341 - }; 342 - #endif 343 66 344 67 static int ptrace_getxregs(struct task_struct *child, void __user *uregs) 345 68 { 346 - struct pt_regs *regs = task_pt_regs(child); 347 - struct thread_info *ti = task_thread_info(child); 348 - elf_xtregs_t __user *xtregs = uregs; 349 - int ret = 0; 350 - int i __maybe_unused; 351 - 352 - if (!access_ok(VERIFY_WRITE, uregs, sizeof(elf_xtregs_t))) 353 - return -EIO; 354 - 355 - #if XTENSA_HAVE_COPROCESSORS 356 - /* Flush all coprocessor registers to memory. */ 357 - coprocessor_flush_all(ti); 358 - 359 - for (i = 0; i < ARRAY_SIZE(cp_offsets); ++i) 360 - ret |= __copy_to_user((char __user *)xtregs + 361 - cp_offsets[i].elf_xtregs_offset, 362 - (const char *)ti + 363 - cp_offsets[i].ti_offset, 364 - cp_offsets[i].sz); 365 - #endif 366 - ret |= __copy_to_user(&xtregs->opt, &regs->xtregs_opt, 367 - sizeof(xtregs->opt)); 368 - ret |= __copy_to_user(&xtregs->user,&ti->xtregs_user, 369 - sizeof(xtregs->user)); 370 - 371 - return ret ? -EFAULT : 0; 69 + return copy_regset_to_user(child, &user_xtensa_view, REGSET_TIE, 70 + 0, sizeof(elf_xtregs_t), uregs); 372 71 } 373 72 374 73 static int ptrace_setxregs(struct task_struct *child, void __user *uregs) 375 74 { 376 - struct thread_info *ti = task_thread_info(child); 377 - struct pt_regs *regs = task_pt_regs(child); 378 - elf_xtregs_t *xtregs = uregs; 379 - int ret = 0; 380 - int i __maybe_unused; 381 - 382 - if (!access_ok(VERIFY_READ, uregs, sizeof(elf_xtregs_t))) 383 - return -EFAULT; 384 - 385 - #if XTENSA_HAVE_COPROCESSORS 386 - /* Flush all coprocessors before we overwrite them. */ 387 - coprocessor_flush_all(ti); 388 - coprocessor_release_all(ti); 389 - 390 - for (i = 0; i < ARRAY_SIZE(cp_offsets); ++i) 391 - ret |= __copy_from_user((char *)ti + cp_offsets[i].ti_offset, 392 - (const char __user *)xtregs + 393 - cp_offsets[i].elf_xtregs_offset, 394 - cp_offsets[i].sz); 395 - #endif 396 - ret |= __copy_from_user(&regs->xtregs_opt, &xtregs->opt, 397 - sizeof(xtregs->opt)); 398 - ret |= __copy_from_user(&ti->xtregs_user, &xtregs->user, 399 - sizeof(xtregs->user)); 400 - 401 - return ret ? -EFAULT : 0; 75 + return copy_regset_from_user(child, &user_xtensa_view, REGSET_TIE, 76 + 0, sizeof(elf_xtregs_t), uregs); 402 77 } 403 78 404 79 static int ptrace_peekusr(struct task_struct *child, long regno, ··· 502 447 void __user *datap = (void __user *) data; 503 448 504 449 switch (request) { 505 - case PTRACE_PEEKTEXT: /* read word at location addr. */ 506 - case PTRACE_PEEKDATA: 507 - ret = generic_ptrace_peekdata(child, addr, data); 508 - break; 509 - 510 450 case PTRACE_PEEKUSR: /* read register specified by addr. */ 511 451 ret = ptrace_peekusr(child, addr, datap); 512 - break; 513 - 514 - case PTRACE_POKETEXT: /* write the word at location addr. */ 515 - case PTRACE_POKEDATA: 516 - ret = generic_ptrace_pokedata(child, addr, data); 517 452 break; 518 453 519 454 case PTRACE_POKEUSR: /* write register specified by addr. */ ··· 542 497 return ret; 543 498 } 544 499 545 - unsigned long do_syscall_trace_enter(struct pt_regs *regs) 500 + void do_syscall_trace_enter(struct pt_regs *regs) 546 501 { 547 502 if (test_thread_flag(TIF_SYSCALL_TRACE) && 548 503 tracehook_report_syscall_entry(regs)) 549 - return -1; 504 + regs->syscall = NO_SYSCALL; 550 505 551 - return regs->areg[2]; 506 + if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 507 + trace_sys_enter(regs, syscall_get_nr(current, regs)); 552 508 } 553 509 554 510 void do_syscall_trace_leave(struct pt_regs *regs) 555 511 { 556 512 int step; 513 + 514 + if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 515 + trace_sys_exit(regs, regs_return_value(regs)); 557 516 558 517 step = test_thread_flag(TIF_SINGLESTEP); 559 518
+4 -4
arch/xtensa/kernel/setup.c
··· 318 318 void __init setup_arch(char **cmdline_p) 319 319 { 320 320 pr_info("config ID: %08x:%08x\n", 321 - get_sr(SREG_EPC), get_sr(SREG_EXCSAVE)); 322 - if (get_sr(SREG_EPC) != XCHAL_HW_CONFIGID0 || 323 - get_sr(SREG_EXCSAVE) != XCHAL_HW_CONFIGID1) 321 + xtensa_get_sr(SREG_EPC), xtensa_get_sr(SREG_EXCSAVE)); 322 + if (xtensa_get_sr(SREG_EPC) != XCHAL_HW_CONFIGID0 || 323 + xtensa_get_sr(SREG_EXCSAVE) != XCHAL_HW_CONFIGID1) 324 324 pr_info("built for config ID: %08x:%08x\n", 325 325 XCHAL_HW_CONFIGID0, XCHAL_HW_CONFIGID1); 326 326 ··· 596 596 num_online_cpus(), 597 597 cpumask_pr_args(cpu_online_mask), 598 598 XCHAL_BUILD_UNIQUE_ID, 599 - get_sr(SREG_EPC), get_sr(SREG_EXCSAVE), 599 + xtensa_get_sr(SREG_EPC), xtensa_get_sr(SREG_EXCSAVE), 600 600 XCHAL_HAVE_BE ? "big" : "little", 601 601 ccount_freq/1000000, 602 602 (ccount_freq/10000) % 100,
+4 -4
arch/xtensa/kernel/signal.c
··· 185 185 COPY(sar); 186 186 #undef COPY 187 187 188 - /* All registers were flushed to stack. Start with a prestine frame. */ 188 + /* All registers were flushed to stack. Start with a pristine frame. */ 189 189 190 190 regs->wmask = 1; 191 191 regs->windowbase = 0; 192 192 regs->windowstart = 1; 193 193 194 - regs->syscall = -1; /* disable syscall checks */ 194 + regs->syscall = NO_SYSCALL; /* disable syscall checks */ 195 195 196 196 /* For PS, restore only PS.CALLINC. 197 197 * Assume that all other bits are either the same as for the signal ··· 423 423 424 424 /* Are we from a system call? */ 425 425 426 - if ((signed)regs->syscall >= 0) { 426 + if (regs->syscall != NO_SYSCALL) { 427 427 428 428 /* If so, check system call restarting.. */ 429 429 ··· 462 462 } 463 463 464 464 /* Did we come from a system call? */ 465 - if ((signed) regs->syscall >= 0) { 465 + if (regs->syscall != NO_SYSCALL) { 466 466 /* Restart the system call - no handlers present */ 467 467 switch (regs->areg[2]) { 468 468 case -ERESTARTNOHAND:
+5 -6
arch/xtensa/kernel/syscall.c
··· 28 28 #include <linux/sched/mm.h> 29 29 #include <linux/shm.h> 30 30 31 - typedef void (*syscall_t)(void); 31 + syscall_t sys_call_table[__NR_syscalls] /* FIXME __cacheline_aligned */= { 32 + [0 ... __NR_syscalls - 1] = (syscall_t)&sys_ni_syscall, 32 33 33 - syscall_t sys_call_table[__NR_syscall_count] /* FIXME __cacheline_aligned */= { 34 - [0 ... __NR_syscall_count - 1] = (syscall_t)&sys_ni_syscall, 35 - 36 - #define __SYSCALL(nr,symbol,nargs) [ nr ] = (syscall_t)symbol, 37 - #include <uapi/asm/unistd.h> 34 + #define __SYSCALL(nr, entry, nargs)[nr] = (syscall_t)entry, 35 + #include <asm/syscall_table.h> 36 + #undef __SYSCALL 38 37 }; 39 38 40 39 #define COLOUR_ALIGN(addr, pgoff) \
+38
arch/xtensa/kernel/syscalls/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + kapi := arch/$(SRCARCH)/include/generated/asm 3 + uapi := arch/$(SRCARCH)/include/generated/uapi/asm 4 + 5 + _dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \ 6 + $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)') 7 + 8 + syscall := $(srctree)/$(src)/syscall.tbl 9 + syshdr := $(srctree)/$(src)/syscallhdr.sh 10 + systbl := $(srctree)/$(src)/syscalltbl.sh 11 + 12 + quiet_cmd_syshdr = SYSHDR $@ 13 + cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@' \ 14 + '$(syshdr_abis_$(basetarget))' \ 15 + '$(syshdr_pfx_$(basetarget))' \ 16 + '$(syshdr_offset_$(basetarget))' 17 + 18 + quiet_cmd_systbl = SYSTBL $@ 19 + cmd_systbl = $(CONFIG_SHELL) '$(systbl)' '$<' '$@' \ 20 + '$(systbl_abis_$(basetarget))' \ 21 + '$(systbl_abi_$(basetarget))' \ 22 + '$(systbl_offset_$(basetarget))' 23 + 24 + $(uapi)/unistd_32.h: $(syscall) $(syshdr) 25 + $(call if_changed,syshdr) 26 + 27 + $(kapi)/syscall_table.h: $(syscall) $(systbl) 28 + $(call if_changed,systbl) 29 + 30 + uapisyshdr-y += unistd_32.h 31 + kapisyshdr-y += syscall_table.h 32 + 33 + targets += $(uapisyshdr-y) $(kapisyshdr-y) 34 + 35 + PHONY += all 36 + all: $(addprefix $(uapi)/,$(uapisyshdr-y)) 37 + all: $(addprefix $(kapi)/,$(kapisyshdr-y)) 38 + @:
+374
arch/xtensa/kernel/syscalls/syscall.tbl
··· 1 + # SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note 2 + # 3 + # system call numbers and entry vectors for xtensa 4 + # 5 + # The format is: 6 + # <number> <abi> <name> <entry point> 7 + # 8 + # The <abi> is always "common" for this file 9 + # 10 + 0 common spill sys_ni_syscall 11 + 1 common xtensa sys_ni_syscall 12 + 2 common available4 sys_ni_syscall 13 + 3 common available5 sys_ni_syscall 14 + 4 common available6 sys_ni_syscall 15 + 5 common available7 sys_ni_syscall 16 + 6 common available8 sys_ni_syscall 17 + 7 common available9 sys_ni_syscall 18 + # File Operations 19 + 8 common open sys_open 20 + 9 common close sys_close 21 + 10 common dup sys_dup 22 + 11 common dup2 sys_dup2 23 + 12 common read sys_read 24 + 13 common write sys_write 25 + 14 common select sys_select 26 + 15 common lseek sys_lseek 27 + 16 common poll sys_poll 28 + 17 common _llseek sys_llseek 29 + 18 common epoll_wait sys_epoll_wait 30 + 19 common epoll_ctl sys_epoll_ctl 31 + 20 common epoll_create sys_epoll_create 32 + 21 common creat sys_creat 33 + 22 common truncate sys_truncate 34 + 23 common ftruncate sys_ftruncate 35 + 24 common readv sys_readv 36 + 25 common writev sys_writev 37 + 26 common fsync sys_fsync 38 + 27 common fdatasync sys_fdatasync 39 + 28 common truncate64 sys_truncate64 40 + 29 common ftruncate64 sys_ftruncate64 41 + 30 common pread64 sys_pread64 42 + 31 common pwrite64 sys_pwrite64 43 + 32 common link sys_link 44 + 33 common rename sys_rename 45 + 34 common symlink sys_symlink 46 + 35 common readlink sys_readlink 47 + 36 common mknod sys_mknod 48 + 37 common pipe sys_pipe 49 + 38 common unlink sys_unlink 50 + 39 common rmdir sys_rmdir 51 + 40 common mkdir sys_mkdir 52 + 41 common chdir sys_chdir 53 + 42 common fchdir sys_fchdir 54 + 43 common getcwd sys_getcwd 55 + 44 common chmod sys_chmod 56 + 45 common chown sys_chown 57 + 46 common stat sys_newstat 58 + 47 common stat64 sys_stat64 59 + 48 common lchown sys_lchown 60 + 49 common lstat sys_newlstat 61 + 50 common lstat64 sys_lstat64 62 + 51 common available51 sys_ni_syscall 63 + 52 common fchmod sys_fchmod 64 + 53 common fchown sys_fchown 65 + 54 common fstat sys_newfstat 66 + 55 common fstat64 sys_fstat64 67 + 56 common flock sys_flock 68 + 57 common access sys_access 69 + 58 common umask sys_umask 70 + 59 common getdents sys_getdents 71 + 60 common getdents64 sys_getdents64 72 + 61 common fcntl64 sys_fcntl64 73 + 62 common fallocate sys_fallocate 74 + 63 common fadvise64_64 xtensa_fadvise64_64 75 + 64 common utime sys_utime 76 + 65 common utimes sys_utimes 77 + 66 common ioctl sys_ioctl 78 + 67 common fcntl sys_fcntl 79 + 68 common setxattr sys_setxattr 80 + 69 common getxattr sys_getxattr 81 + 70 common listxattr sys_listxattr 82 + 71 common removexattr sys_removexattr 83 + 72 common lsetxattr sys_lsetxattr 84 + 73 common lgetxattr sys_lgetxattr 85 + 74 common llistxattr sys_llistxattr 86 + 75 common lremovexattr sys_lremovexattr 87 + 76 common fsetxattr sys_fsetxattr 88 + 77 common fgetxattr sys_fgetxattr 89 + 78 common flistxattr sys_flistxattr 90 + 79 common fremovexattr sys_fremovexattr 91 + # File Map / Shared Memory Operations 92 + 80 common mmap2 sys_mmap_pgoff 93 + 81 common munmap sys_munmap 94 + 82 common mprotect sys_mprotect 95 + 83 common brk sys_brk 96 + 84 common mlock sys_mlock 97 + 85 common munlock sys_munlock 98 + 86 common mlockall sys_mlockall 99 + 87 common munlockall sys_munlockall 100 + 88 common mremap sys_mremap 101 + 89 common msync sys_msync 102 + 90 common mincore sys_mincore 103 + 91 common madvise sys_madvise 104 + 92 common shmget sys_shmget 105 + 93 common shmat xtensa_shmat 106 + 94 common shmctl sys_shmctl 107 + 95 common shmdt sys_shmdt 108 + # Socket Operations 109 + 96 common socket sys_socket 110 + 97 common setsockopt sys_setsockopt 111 + 98 common getsockopt sys_getsockopt 112 + 99 common shutdown sys_shutdown 113 + 100 common bind sys_bind 114 + 101 common connect sys_connect 115 + 102 common listen sys_listen 116 + 103 common accept sys_accept 117 + 104 common getsockname sys_getsockname 118 + 105 common getpeername sys_getpeername 119 + 106 common sendmsg sys_sendmsg 120 + 107 common recvmsg sys_recvmsg 121 + 108 common send sys_send 122 + 109 common recv sys_recv 123 + 110 common sendto sys_sendto 124 + 111 common recvfrom sys_recvfrom 125 + 112 common socketpair sys_socketpair 126 + 113 common sendfile sys_sendfile 127 + 114 common sendfile64 sys_sendfile64 128 + 115 common sendmmsg sys_sendmmsg 129 + # Process Operations 130 + 116 common clone sys_clone 131 + 117 common execve sys_execve 132 + 118 common exit sys_exit 133 + 119 common exit_group sys_exit_group 134 + 120 common getpid sys_getpid 135 + 121 common wait4 sys_wait4 136 + 122 common waitid sys_waitid 137 + 123 common kill sys_kill 138 + 124 common tkill sys_tkill 139 + 125 common tgkill sys_tgkill 140 + 126 common set_tid_address sys_set_tid_address 141 + 127 common gettid sys_gettid 142 + 128 common setsid sys_setsid 143 + 129 common getsid sys_getsid 144 + 130 common prctl sys_prctl 145 + 131 common personality sys_personality 146 + 132 common getpriority sys_getpriority 147 + 133 common setpriority sys_setpriority 148 + 134 common setitimer sys_setitimer 149 + 135 common getitimer sys_getitimer 150 + 136 common setuid sys_setuid 151 + 137 common getuid sys_getuid 152 + 138 common setgid sys_setgid 153 + 139 common getgid sys_getgid 154 + 140 common geteuid sys_geteuid 155 + 141 common getegid sys_getegid 156 + 142 common setreuid sys_setreuid 157 + 143 common setregid sys_setregid 158 + 144 common setresuid sys_setresuid 159 + 145 common getresuid sys_getresuid 160 + 146 common setresgid sys_setresgid 161 + 147 common getresgid sys_getresgid 162 + 148 common setpgid sys_setpgid 163 + 149 common getpgid sys_getpgid 164 + 150 common getppid sys_getppid 165 + 151 common getpgrp sys_getpgrp 166 + # 152 was set_thread_area 167 + 152 common reserved152 sys_ni_syscall 168 + # 153 was get_thread_area 169 + 153 common reserved153 sys_ni_syscall 170 + 154 common times sys_times 171 + 155 common acct sys_acct 172 + 156 common sched_setaffinity sys_sched_setaffinity 173 + 157 common sched_getaffinity sys_sched_getaffinity 174 + 158 common capget sys_capget 175 + 159 common capset sys_capset 176 + 160 common ptrace sys_ptrace 177 + 161 common semtimedop sys_semtimedop 178 + 162 common semget sys_semget 179 + 163 common semop sys_semop 180 + 164 common semctl sys_semctl 181 + 165 common available165 sys_ni_syscall 182 + 166 common msgget sys_msgget 183 + 167 common msgsnd sys_msgsnd 184 + 168 common msgrcv sys_msgrcv 185 + 169 common msgctl sys_msgctl 186 + 170 common available170 sys_ni_syscall 187 + # File System 188 + 171 common umount2 sys_umount 189 + 172 common mount sys_mount 190 + 173 common swapon sys_swapon 191 + 174 common chroot sys_chroot 192 + 175 common pivot_root sys_pivot_root 193 + 176 common umount sys_oldumount 194 + 177 common swapoff sys_swapoff 195 + 178 common sync sys_sync 196 + 179 common syncfs sys_syncfs 197 + 180 common setfsuid sys_setfsuid 198 + 181 common setfsgid sys_setfsgid 199 + 182 common sysfs sys_sysfs 200 + 183 common ustat sys_ustat 201 + 184 common statfs sys_statfs 202 + 185 common fstatfs sys_fstatfs 203 + 186 common statfs64 sys_statfs64 204 + 187 common fstatfs64 sys_fstatfs64 205 + # System 206 + 188 common setrlimit sys_setrlimit 207 + 189 common getrlimit sys_getrlimit 208 + 190 common getrusage sys_getrusage 209 + 191 common futex sys_futex 210 + 192 common gettimeofday sys_gettimeofday 211 + 193 common settimeofday sys_settimeofday 212 + 194 common adjtimex sys_adjtimex 213 + 195 common nanosleep sys_nanosleep 214 + 196 common getgroups sys_getgroups 215 + 197 common setgroups sys_setgroups 216 + 198 common sethostname sys_sethostname 217 + 199 common setdomainname sys_setdomainname 218 + 200 common syslog sys_syslog 219 + 201 common vhangup sys_vhangup 220 + 202 common uselib sys_uselib 221 + 203 common reboot sys_reboot 222 + 204 common quotactl sys_quotactl 223 + # 205 was old nfsservctl 224 + 205 common nfsservctl sys_ni_syscall 225 + 206 common _sysctl sys_sysctl 226 + 207 common bdflush sys_bdflush 227 + 208 common uname sys_newuname 228 + 209 common sysinfo sys_sysinfo 229 + 210 common init_module sys_init_module 230 + 211 common delete_module sys_delete_module 231 + 212 common sched_setparam sys_sched_setparam 232 + 213 common sched_getparam sys_sched_getparam 233 + 214 common sched_setscheduler sys_sched_setscheduler 234 + 215 common sched_getscheduler sys_sched_getscheduler 235 + 216 common sched_get_priority_max sys_sched_get_priority_max 236 + 217 common sched_get_priority_min sys_sched_get_priority_min 237 + 218 common sched_rr_get_interval sys_sched_rr_get_interval 238 + 219 common sched_yield sys_sched_yield 239 + 222 common available222 sys_ni_syscall 240 + # Signal Handling 241 + 223 common restart_syscall sys_restart_syscall 242 + 224 common sigaltstack sys_sigaltstack 243 + 225 common rt_sigreturn xtensa_rt_sigreturn 244 + 226 common rt_sigaction sys_rt_sigaction 245 + 227 common rt_sigprocmask sys_rt_sigprocmask 246 + 228 common rt_sigpending sys_rt_sigpending 247 + 229 common rt_sigtimedwait sys_rt_sigtimedwait 248 + 230 common rt_sigqueueinfo sys_rt_sigqueueinfo 249 + 231 common rt_sigsuspend sys_rt_sigsuspend 250 + # Message 251 + 232 common mq_open sys_mq_open 252 + 233 common mq_unlink sys_mq_unlink 253 + 234 common mq_timedsend sys_mq_timedsend 254 + 235 common mq_timedreceive sys_mq_timedreceive 255 + 236 common mq_notify sys_mq_notify 256 + 237 common mq_getsetattr sys_mq_getsetattr 257 + 238 common available238 sys_ni_syscall 258 + 239 common io_setup sys_io_setup 259 + # IO 260 + 240 common io_destroy sys_io_destroy 261 + 241 common io_submit sys_io_submit 262 + 242 common io_getevents sys_io_getevents 263 + 243 common io_cancel sys_io_cancel 264 + 244 common clock_settime sys_clock_settime 265 + 245 common clock_gettime sys_clock_gettime 266 + 246 common clock_getres sys_clock_getres 267 + 247 common clock_nanosleep sys_clock_nanosleep 268 + # Timer 269 + 248 common timer_create sys_timer_create 270 + 249 common timer_delete sys_timer_delete 271 + 250 common timer_settime sys_timer_settime 272 + 251 common timer_gettime sys_timer_gettime 273 + 252 common timer_getoverrun sys_timer_getoverrun 274 + # System 275 + 253 common reserved253 sys_ni_syscall 276 + 254 common lookup_dcookie sys_lookup_dcookie 277 + 255 common available255 sys_ni_syscall 278 + 256 common add_key sys_add_key 279 + 257 common request_key sys_request_key 280 + 258 common keyctl sys_keyctl 281 + 259 common available259 sys_ni_syscall 282 + 260 common readahead sys_readahead 283 + 261 common remap_file_pages sys_remap_file_pages 284 + 262 common migrate_pages sys_migrate_pages 285 + 263 common mbind sys_mbind 286 + 264 common get_mempolicy sys_get_mempolicy 287 + 265 common set_mempolicy sys_set_mempolicy 288 + 266 common unshare sys_unshare 289 + 267 common move_pages sys_move_pages 290 + 268 common splice sys_splice 291 + 269 common tee sys_tee 292 + 270 common vmsplice sys_vmsplice 293 + 271 common available271 sys_ni_syscall 294 + 272 common pselect6 sys_pselect6 295 + 273 common ppoll sys_ppoll 296 + 274 common epoll_pwait sys_epoll_pwait 297 + 275 common epoll_create1 sys_epoll_create1 298 + 276 common inotify_init sys_inotify_init 299 + 277 common inotify_add_watch sys_inotify_add_watch 300 + 278 common inotify_rm_watch sys_inotify_rm_watch 301 + 279 common inotify_init1 sys_inotify_init1 302 + 280 common getcpu sys_getcpu 303 + 281 common kexec_load sys_ni_syscall 304 + 282 common ioprio_set sys_ioprio_set 305 + 283 common ioprio_get sys_ioprio_get 306 + 284 common set_robust_list sys_set_robust_list 307 + 285 common get_robust_list sys_get_robust_list 308 + 286 common available286 sys_ni_syscall 309 + 287 common available287 sys_ni_syscall 310 + # Relative File Operations 311 + 288 common openat sys_openat 312 + 289 common mkdirat sys_mkdirat 313 + 290 common mknodat sys_mknodat 314 + 291 common unlinkat sys_unlinkat 315 + 292 common renameat sys_renameat 316 + 293 common linkat sys_linkat 317 + 294 common symlinkat sys_symlinkat 318 + 295 common readlinkat sys_readlinkat 319 + 296 common utimensat sys_utimensat 320 + 297 common fchownat sys_fchownat 321 + 298 common futimesat sys_futimesat 322 + 299 common fstatat64 sys_fstatat64 323 + 300 common fchmodat sys_fchmodat 324 + 301 common faccessat sys_faccessat 325 + 302 common available302 sys_ni_syscall 326 + 303 common available303 sys_ni_syscall 327 + 304 common signalfd sys_signalfd 328 + # 305 was timerfd 329 + 306 common eventfd sys_eventfd 330 + 307 common recvmmsg sys_recvmmsg 331 + 308 common setns sys_setns 332 + 309 common signalfd4 sys_signalfd4 333 + 310 common dup3 sys_dup3 334 + 311 common pipe2 sys_pipe2 335 + 312 common timerfd_create sys_timerfd_create 336 + 313 common timerfd_settime sys_timerfd_settime 337 + 314 common timerfd_gettime sys_timerfd_gettime 338 + 315 common available315 sys_ni_syscall 339 + 316 common eventfd2 sys_eventfd2 340 + 317 common preadv sys_preadv 341 + 318 common pwritev sys_pwritev 342 + 319 common available319 sys_ni_syscall 343 + 320 common fanotify_init sys_fanotify_init 344 + 321 common fanotify_mark sys_fanotify_mark 345 + 322 common process_vm_readv sys_process_vm_readv 346 + 323 common process_vm_writev sys_process_vm_writev 347 + 324 common name_to_handle_at sys_name_to_handle_at 348 + 325 common open_by_handle_at sys_open_by_handle_at 349 + 326 common sync_file_range2 sys_sync_file_range2 350 + 327 common perf_event_open sys_perf_event_open 351 + 328 common rt_tgsigqueueinfo sys_rt_tgsigqueueinfo 352 + 329 common clock_adjtime sys_clock_adjtime 353 + 330 common prlimit64 sys_prlimit64 354 + 331 common kcmp sys_kcmp 355 + 332 common finit_module sys_finit_module 356 + 333 common accept4 sys_accept4 357 + 334 common sched_setattr sys_sched_setattr 358 + 335 common sched_getattr sys_sched_getattr 359 + 336 common renameat2 sys_renameat2 360 + 337 common seccomp sys_seccomp 361 + 338 common getrandom sys_getrandom 362 + 339 common memfd_create sys_memfd_create 363 + 340 common bpf sys_bpf 364 + 341 common execveat sys_execveat 365 + 342 common userfaultfd sys_userfaultfd 366 + 343 common membarrier sys_membarrier 367 + 344 common mlock2 sys_mlock2 368 + 345 common copy_file_range sys_copy_file_range 369 + 346 common preadv2 sys_preadv2 370 + 347 common pwritev2 sys_pwritev2 371 + 348 common pkey_mprotect sys_pkey_mprotect 372 + 349 common pkey_alloc sys_pkey_alloc 373 + 350 common pkey_free sys_pkey_free 374 + 351 common statx sys_statx
+36
arch/xtensa/kernel/syscalls/syscallhdr.sh
··· 1 + #!/bin/sh 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + in="$1" 5 + out="$2" 6 + my_abis=`echo "($3)" | tr ',' '|'` 7 + prefix="$4" 8 + offset="$5" 9 + 10 + fileguard=_UAPI_ASM_XTENSA_`basename "$out" | sed \ 11 + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ 12 + -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'` 13 + grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( 14 + printf "#ifndef %s\n" "${fileguard}" 15 + printf "#define %s\n" "${fileguard}" 16 + printf "\n" 17 + 18 + nxt=0 19 + while read nr abi name entry ; do 20 + if [ -z "$offset" ]; then 21 + printf "#define __NR_%s%s\t%s\n" \ 22 + "${prefix}" "${name}" "${nr}" 23 + else 24 + printf "#define __NR_%s%s\t(%s + %s)\n" \ 25 + "${prefix}" "${name}" "${offset}" "${nr}" 26 + fi 27 + nxt=$((nr+1)) 28 + done 29 + 30 + printf "\n" 31 + printf "#ifdef __KERNEL__\n" 32 + printf "#define __NR_syscalls\t%s\n" "${nxt}" 33 + printf "#endif\n" 34 + printf "\n" 35 + printf "#endif /* %s */" "${fileguard}" 36 + ) > "$out"
+32
arch/xtensa/kernel/syscalls/syscalltbl.sh
··· 1 + #!/bin/sh 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + in="$1" 5 + out="$2" 6 + my_abis=`echo "($3)" | tr ',' '|'` 7 + my_abi="$4" 8 + offset="$5" 9 + 10 + emit() { 11 + t_nxt="$1" 12 + t_nr="$2" 13 + t_entry="$3" 14 + 15 + while [ $t_nxt -lt $t_nr ]; do 16 + printf "__SYSCALL(%s, sys_ni_syscall, )\n" "${t_nxt}" 17 + t_nxt=$((t_nxt+1)) 18 + done 19 + printf "__SYSCALL(%s, %s, )\n" "${t_nxt}" "${t_entry}" 20 + } 21 + 22 + grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( 23 + nxt=0 24 + if [ -z "$offset" ]; then 25 + offset=0 26 + fi 27 + 28 + while read nr abi name entry ; do 29 + emit $((nxt+offset)) $((nr+offset)) $entry 30 + nxt=$((nr+1)) 31 + done 32 + ) > "$out"
+4 -6
arch/xtensa/kernel/traps.c
··· 51 51 extern void kernel_exception(void); 52 52 extern void user_exception(void); 53 53 54 - extern void fast_syscall_kernel(void); 55 54 extern void fast_syscall_user(void); 56 55 extern void fast_alloca(void); 57 56 extern void fast_unaligned(void); ··· 88 89 static dispatch_init_table_t __initdata dispatch_init_table[] = { 89 90 90 91 { EXCCAUSE_ILLEGAL_INSTRUCTION, 0, do_illegal_instruction}, 91 - { EXCCAUSE_SYSTEM_CALL, KRNL, fast_syscall_kernel }, 92 92 { EXCCAUSE_SYSTEM_CALL, USER, fast_syscall_user }, 93 93 { EXCCAUSE_SYSTEM_CALL, 0, system_call }, 94 94 /* EXCCAUSE_INSTRUCTION_FETCH unhandled */ ··· 213 215 214 216 static inline void check_valid_nmi(void) 215 217 { 216 - unsigned intread = get_sr(interrupt); 217 - unsigned intenable = get_sr(intenable); 218 + unsigned intread = xtensa_get_sr(interrupt); 219 + unsigned intenable = xtensa_get_sr(intenable); 218 220 219 221 BUG_ON(intread & intenable & 220 222 ~(XTENSA_INTLEVEL_ANDBELOW_MASK(PROFILING_INTLEVEL) ^ ··· 271 273 irq_enter(); 272 274 273 275 for (;;) { 274 - unsigned intread = get_sr(interrupt); 275 - unsigned intenable = get_sr(intenable); 276 + unsigned intread = xtensa_get_sr(interrupt); 277 + unsigned intenable = xtensa_get_sr(intenable); 276 278 unsigned int_at_level = intread & intenable; 277 279 unsigned level; 278 280
+3
arch/xtensa/mm/init.c
··· 60 60 max_pfn = PFN_DOWN(memblock_end_of_DRAM()); 61 61 max_low_pfn = min(max_pfn, MAX_LOW_PFN); 62 62 63 + early_memtest((phys_addr_t)min_low_pfn << PAGE_SHIFT, 64 + (phys_addr_t)max_low_pfn << PAGE_SHIFT); 65 + 63 66 memblock_set_current_limit(PFN_PHYS(max_low_pfn)); 64 67 dma_contiguous_reserve(PFN_PHYS(max_low_pfn)); 65 68
+5 -5
drivers/irqchip/irq-xtensa-mx.c
··· 62 62 __this_cpu_write(cached_irq_mask, 63 63 XCHAL_INTTYPE_MASK_EXTERN_EDGE | 64 64 XCHAL_INTTYPE_MASK_EXTERN_LEVEL); 65 - set_sr(XCHAL_INTTYPE_MASK_EXTERN_EDGE | 65 + xtensa_set_sr(XCHAL_INTTYPE_MASK_EXTERN_EDGE | 66 66 XCHAL_INTTYPE_MASK_EXTERN_LEVEL, intenable); 67 67 } 68 68 ··· 77 77 } else { 78 78 mask = __this_cpu_read(cached_irq_mask) & ~mask; 79 79 __this_cpu_write(cached_irq_mask, mask); 80 - set_sr(mask, intenable); 80 + xtensa_set_sr(mask, intenable); 81 81 } 82 82 } 83 83 ··· 92 92 } else { 93 93 mask |= __this_cpu_read(cached_irq_mask); 94 94 __this_cpu_write(cached_irq_mask, mask); 95 - set_sr(mask, intenable); 95 + xtensa_set_sr(mask, intenable); 96 96 } 97 97 } 98 98 ··· 108 108 109 109 static void xtensa_mx_irq_ack(struct irq_data *d) 110 110 { 111 - set_sr(1 << d->hwirq, intclear); 111 + xtensa_set_sr(1 << d->hwirq, intclear); 112 112 } 113 113 114 114 static int xtensa_mx_irq_retrigger(struct irq_data *d) 115 115 { 116 - set_sr(1 << d->hwirq, intset); 116 + xtensa_set_sr(1 << d->hwirq, intset); 117 117 return 1; 118 118 } 119 119
+4 -4
drivers/irqchip/irq-xtensa-pic.c
··· 44 44 static void xtensa_irq_mask(struct irq_data *d) 45 45 { 46 46 cached_irq_mask &= ~(1 << d->hwirq); 47 - set_sr(cached_irq_mask, intenable); 47 + xtensa_set_sr(cached_irq_mask, intenable); 48 48 } 49 49 50 50 static void xtensa_irq_unmask(struct irq_data *d) 51 51 { 52 52 cached_irq_mask |= 1 << d->hwirq; 53 - set_sr(cached_irq_mask, intenable); 53 + xtensa_set_sr(cached_irq_mask, intenable); 54 54 } 55 55 56 56 static void xtensa_irq_enable(struct irq_data *d) ··· 65 65 66 66 static void xtensa_irq_ack(struct irq_data *d) 67 67 { 68 - set_sr(1 << d->hwirq, intclear); 68 + xtensa_set_sr(1 << d->hwirq, intclear); 69 69 } 70 70 71 71 static int xtensa_irq_retrigger(struct irq_data *d) 72 72 { 73 - set_sr(1 << d->hwirq, intset); 73 + xtensa_set_sr(1 << d->hwirq, intset); 74 74 return 1; 75 75 } 76 76
+1
include/uapi/linux/audit.h
··· 411 411 #define AUDIT_ARCH_TILEGX32 (EM_TILEGX|__AUDIT_ARCH_LE) 412 412 #define AUDIT_ARCH_TILEPRO (EM_TILEPRO|__AUDIT_ARCH_LE) 413 413 #define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 414 + #define AUDIT_ARCH_XTENSA (EM_XTENSA) 414 415 415 416 #define AUDIT_PERM_EXEC 1 416 417 #define AUDIT_PERM_WRITE 2
+1
include/uapi/linux/elf-em.h
··· 34 34 #define EM_M32R 88 /* Renesas M32R */ 35 35 #define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ 36 36 #define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ 37 + #define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ 37 38 #define EM_BLACKFIN 106 /* ADI Blackfin Processor */ 38 39 #define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core processor */ 39 40 #define EM_TI_C6000 140 /* TI C6X DSPs */