diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-03-12 12:23:30 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-03-12 12:23:30 -0400 |
| commit | 5627511205e474f960d37a6242749c6964993836 (patch) | |
| tree | ea408d284be2ac6432dceeaf6d8222cbc1e6c8ac | |
| parent | 53da3bc2ba9e4899f32707b5cd7d18421b943687 (diff) | |
| parent | 92d5dd8cd6e2b211d32d8fbc6cf4b7470765a09f (diff) | |
Merge tag 'nios2-fix-4.0-rc4' of git://git.rocketboards.org/linux-socfpga-next
Pull arch/nios2 fix from Ley Foon Tan:
"Remove pt_regs from user header and use generic ucontext.h"
* tag 'nios2-fix-4.0-rc4' of git://git.rocketboards.org/linux-socfpga-next:
nios2: update pt_regs
| -rw-r--r-- | arch/nios2/include/asm/ptrace.h | 47 | ||||
| -rw-r--r-- | arch/nios2/include/asm/ucontext.h | 32 | ||||
| -rw-r--r-- | arch/nios2/include/uapi/asm/Kbuild | 2 | ||||
| -rw-r--r-- | arch/nios2/include/uapi/asm/elf.h | 4 | ||||
| -rw-r--r-- | arch/nios2/include/uapi/asm/ptrace.h | 50 | ||||
| -rw-r--r-- | arch/nios2/include/uapi/asm/sigcontext.h | 12 | ||||
| -rw-r--r-- | arch/nios2/kernel/signal.c | 4 |
7 files changed, 62 insertions, 89 deletions
diff --git a/arch/nios2/include/asm/ptrace.h b/arch/nios2/include/asm/ptrace.h index 20fb1cf2dab6..642462144872 100644 --- a/arch/nios2/include/asm/ptrace.h +++ b/arch/nios2/include/asm/ptrace.h | |||
| @@ -15,7 +15,54 @@ | |||
| 15 | 15 | ||
| 16 | #include <uapi/asm/ptrace.h> | 16 | #include <uapi/asm/ptrace.h> |
| 17 | 17 | ||
| 18 | /* This struct defines the way the registers are stored on the | ||
| 19 | stack during a system call. */ | ||
| 20 | |||
| 18 | #ifndef __ASSEMBLY__ | 21 | #ifndef __ASSEMBLY__ |
| 22 | struct pt_regs { | ||
| 23 | unsigned long r8; /* r8-r15 Caller-saved GP registers */ | ||
| 24 | unsigned long r9; | ||
| 25 | unsigned long r10; | ||
| 26 | unsigned long r11; | ||
| 27 | unsigned long r12; | ||
| 28 | unsigned long r13; | ||
| 29 | unsigned long r14; | ||
| 30 | unsigned long r15; | ||
| 31 | unsigned long r1; /* Assembler temporary */ | ||
| 32 | unsigned long r2; /* Retval LS 32bits */ | ||
| 33 | unsigned long r3; /* Retval MS 32bits */ | ||
| 34 | unsigned long r4; /* r4-r7 Register arguments */ | ||
| 35 | unsigned long r5; | ||
| 36 | unsigned long r6; | ||
| 37 | unsigned long r7; | ||
| 38 | unsigned long orig_r2; /* Copy of r2 ?? */ | ||
| 39 | unsigned long ra; /* Return address */ | ||
| 40 | unsigned long fp; /* Frame pointer */ | ||
| 41 | unsigned long sp; /* Stack pointer */ | ||
| 42 | unsigned long gp; /* Global pointer */ | ||
| 43 | unsigned long estatus; | ||
| 44 | unsigned long ea; /* Exception return address (pc) */ | ||
| 45 | unsigned long orig_r7; | ||
| 46 | }; | ||
| 47 | |||
| 48 | /* | ||
| 49 | * This is the extended stack used by signal handlers and the context | ||
| 50 | * switcher: it's pushed after the normal "struct pt_regs". | ||
| 51 | */ | ||
| 52 | struct switch_stack { | ||
| 53 | unsigned long r16; /* r16-r23 Callee-saved GP registers */ | ||
| 54 | unsigned long r17; | ||
| 55 | unsigned long r18; | ||
| 56 | unsigned long r19; | ||
| 57 | unsigned long r20; | ||
| 58 | unsigned long r21; | ||
| 59 | unsigned long r22; | ||
| 60 | unsigned long r23; | ||
| 61 | unsigned long fp; | ||
| 62 | unsigned long gp; | ||
| 63 | unsigned long ra; | ||
| 64 | }; | ||
| 65 | |||
| 19 | #define user_mode(regs) (((regs)->estatus & ESTATUS_EU)) | 66 | #define user_mode(regs) (((regs)->estatus & ESTATUS_EU)) |
| 20 | 67 | ||
| 21 | #define instruction_pointer(regs) ((regs)->ra) | 68 | #define instruction_pointer(regs) ((regs)->ra) |
diff --git a/arch/nios2/include/asm/ucontext.h b/arch/nios2/include/asm/ucontext.h deleted file mode 100644 index 2c87614b0f6e..000000000000 --- a/arch/nios2/include/asm/ucontext.h +++ /dev/null | |||
| @@ -1,32 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
| 3 | * Copyright (C) 2004 Microtronix Datacom Ltd | ||
| 4 | * | ||
| 5 | * This file is subject to the terms and conditions of the GNU General Public | ||
| 6 | * License. See the file "COPYING" in the main directory of this archive | ||
| 7 | * for more details. | ||
| 8 | */ | ||
| 9 | |||
| 10 | #ifndef _ASM_NIOS2_UCONTEXT_H | ||
| 11 | #define _ASM_NIOS2_UCONTEXT_H | ||
| 12 | |||
| 13 | typedef int greg_t; | ||
| 14 | #define NGREG 32 | ||
| 15 | typedef greg_t gregset_t[NGREG]; | ||
| 16 | |||
| 17 | struct mcontext { | ||
| 18 | int version; | ||
| 19 | gregset_t gregs; | ||
| 20 | }; | ||
| 21 | |||
| 22 | #define MCONTEXT_VERSION 2 | ||
| 23 | |||
| 24 | struct ucontext { | ||
| 25 | unsigned long uc_flags; | ||
| 26 | struct ucontext *uc_link; | ||
| 27 | stack_t uc_stack; | ||
| 28 | struct mcontext uc_mcontext; | ||
| 29 | sigset_t uc_sigmask; /* mask last for extensibility */ | ||
| 30 | }; | ||
| 31 | |||
| 32 | #endif | ||
diff --git a/arch/nios2/include/uapi/asm/Kbuild b/arch/nios2/include/uapi/asm/Kbuild index 4f07ca3f8d10..376131194cc3 100644 --- a/arch/nios2/include/uapi/asm/Kbuild +++ b/arch/nios2/include/uapi/asm/Kbuild | |||
| @@ -2,3 +2,5 @@ include include/uapi/asm-generic/Kbuild.asm | |||
| 2 | 2 | ||
| 3 | header-y += elf.h | 3 | header-y += elf.h |
| 4 | header-y += ucontext.h | 4 | header-y += ucontext.h |
| 5 | |||
| 6 | generic-y += ucontext.h | ||
diff --git a/arch/nios2/include/uapi/asm/elf.h b/arch/nios2/include/uapi/asm/elf.h index a5b91ae5cf56..6f06d3b2949e 100644 --- a/arch/nios2/include/uapi/asm/elf.h +++ b/arch/nios2/include/uapi/asm/elf.h | |||
| @@ -50,9 +50,7 @@ | |||
| 50 | 50 | ||
| 51 | typedef unsigned long elf_greg_t; | 51 | typedef unsigned long elf_greg_t; |
| 52 | 52 | ||
| 53 | #define ELF_NGREG \ | 53 | #define ELF_NGREG 49 |
| 54 | ((sizeof(struct pt_regs) + sizeof(struct switch_stack)) / \ | ||
| 55 | sizeof(elf_greg_t)) | ||
| 56 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | 54 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; |
| 57 | 55 | ||
| 58 | typedef unsigned long elf_fpregset_t; | 56 | typedef unsigned long elf_fpregset_t; |
diff --git a/arch/nios2/include/uapi/asm/ptrace.h b/arch/nios2/include/uapi/asm/ptrace.h index e83a7c9d1c36..71a330597adf 100644 --- a/arch/nios2/include/uapi/asm/ptrace.h +++ b/arch/nios2/include/uapi/asm/ptrace.h | |||
| @@ -67,53 +67,9 @@ | |||
| 67 | 67 | ||
| 68 | #define NUM_PTRACE_REG (PTR_TLBMISC + 1) | 68 | #define NUM_PTRACE_REG (PTR_TLBMISC + 1) |
| 69 | 69 | ||
| 70 | /* this struct defines the way the registers are stored on the | 70 | /* User structures for general purpose registers. */ |
| 71 | stack during a system call. | 71 | struct user_pt_regs { |
| 72 | 72 | __u32 regs[49]; | |
| 73 | There is a fake_regs in setup.c that has to match pt_regs.*/ | ||
| 74 | |||
| 75 | struct pt_regs { | ||
| 76 | unsigned long r8; /* r8-r15 Caller-saved GP registers */ | ||
| 77 | unsigned long r9; | ||
| 78 | unsigned long r10; | ||
| 79 | unsigned long r11; | ||
| 80 | unsigned long r12; | ||
| 81 | unsigned long r13; | ||
| 82 | unsigned long r14; | ||
| 83 | unsigned long r15; | ||
| 84 | unsigned long r1; /* Assembler temporary */ | ||
| 85 | unsigned long r2; /* Retval LS 32bits */ | ||
| 86 | unsigned long r3; /* Retval MS 32bits */ | ||
| 87 | unsigned long r4; /* r4-r7 Register arguments */ | ||
| 88 | unsigned long r5; | ||
| 89 | unsigned long r6; | ||
| 90 | unsigned long r7; | ||
| 91 | unsigned long orig_r2; /* Copy of r2 ?? */ | ||
| 92 | unsigned long ra; /* Return address */ | ||
| 93 | unsigned long fp; /* Frame pointer */ | ||
| 94 | unsigned long sp; /* Stack pointer */ | ||
| 95 | unsigned long gp; /* Global pointer */ | ||
| 96 | unsigned long estatus; | ||
| 97 | unsigned long ea; /* Exception return address (pc) */ | ||
| 98 | unsigned long orig_r7; | ||
| 99 | }; | ||
| 100 | |||
| 101 | /* | ||
| 102 | * This is the extended stack used by signal handlers and the context | ||
| 103 | * switcher: it's pushed after the normal "struct pt_regs". | ||
| 104 | */ | ||
| 105 | struct switch_stack { | ||
| 106 | unsigned long r16; /* r16-r23 Callee-saved GP registers */ | ||
| 107 | unsigned long r17; | ||
| 108 | unsigned long r18; | ||
| 109 | unsigned long r19; | ||
| 110 | unsigned long r20; | ||
| 111 | unsigned long r21; | ||
| 112 | unsigned long r22; | ||
| 113 | unsigned long r23; | ||
| 114 | unsigned long fp; | ||
| 115 | unsigned long gp; | ||
| 116 | unsigned long ra; | ||
| 117 | }; | 73 | }; |
| 118 | 74 | ||
| 119 | #endif /* __ASSEMBLY__ */ | 75 | #endif /* __ASSEMBLY__ */ |
diff --git a/arch/nios2/include/uapi/asm/sigcontext.h b/arch/nios2/include/uapi/asm/sigcontext.h index 7b8bb41867d4..b67944a50927 100644 --- a/arch/nios2/include/uapi/asm/sigcontext.h +++ b/arch/nios2/include/uapi/asm/sigcontext.h | |||
| @@ -15,14 +15,16 @@ | |||
| 15 | * details. | 15 | * details. |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #ifndef _ASM_NIOS2_SIGCONTEXT_H | 18 | #ifndef _UAPI__ASM_SIGCONTEXT_H |
| 19 | #define _ASM_NIOS2_SIGCONTEXT_H | 19 | #define _UAPI__ASM_SIGCONTEXT_H |
| 20 | 20 | ||
| 21 | #include <asm/ptrace.h> | 21 | #include <linux/types.h> |
| 22 | |||
| 23 | #define MCONTEXT_VERSION 2 | ||
| 22 | 24 | ||
| 23 | struct sigcontext { | 25 | struct sigcontext { |
| 24 | struct pt_regs regs; | 26 | int version; |
| 25 | unsigned long sc_mask; /* old sigmask */ | 27 | unsigned long gregs[32]; |
| 26 | }; | 28 | }; |
| 27 | 29 | ||
| 28 | #endif | 30 | #endif |
diff --git a/arch/nios2/kernel/signal.c b/arch/nios2/kernel/signal.c index 2d0ea25be171..dda41e4fe707 100644 --- a/arch/nios2/kernel/signal.c +++ b/arch/nios2/kernel/signal.c | |||
| @@ -39,7 +39,7 @@ static inline int rt_restore_ucontext(struct pt_regs *regs, | |||
| 39 | struct ucontext *uc, int *pr2) | 39 | struct ucontext *uc, int *pr2) |
| 40 | { | 40 | { |
| 41 | int temp; | 41 | int temp; |
| 42 | greg_t *gregs = uc->uc_mcontext.gregs; | 42 | unsigned long *gregs = uc->uc_mcontext.gregs; |
| 43 | int err; | 43 | int err; |
| 44 | 44 | ||
| 45 | /* Always make any pending restarted system calls return -EINTR */ | 45 | /* Always make any pending restarted system calls return -EINTR */ |
| @@ -127,7 +127,7 @@ badframe: | |||
| 127 | static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs) | 127 | static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs) |
| 128 | { | 128 | { |
| 129 | struct switch_stack *sw = (struct switch_stack *)regs - 1; | 129 | struct switch_stack *sw = (struct switch_stack *)regs - 1; |
| 130 | greg_t *gregs = uc->uc_mcontext.gregs; | 130 | unsigned long *gregs = uc->uc_mcontext.gregs; |
| 131 | int err = 0; | 131 | int err = 0; |
| 132 | 132 | ||
| 133 | err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version); | 133 | err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version); |
