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

nios2: update pt_regs

Remove struct pt_regs from user header and use generic ucontext.h.

Signed-off-by: Chung-Ling Tang <cltang@codesourcery.com>
Acked-by: Ley Foon Tan <lftan@altera.com>

authored by

Chung-Ling Tang and committed by
Ley Foon Tan
92d5dd8c 9eccca08

+62 -89
+47
arch/nios2/include/asm/ptrace.h
··· 15 15 16 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 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 66 #define user_mode(regs) (((regs)->estatus & ESTATUS_EU)) 20 67 21 68 #define instruction_pointer(regs) ((regs)->ra)
-32
arch/nios2/include/asm/ucontext.h
··· 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
+2
arch/nios2/include/uapi/asm/Kbuild
··· 2 2 3 3 header-y += elf.h 4 4 header-y += ucontext.h 5 + 6 + generic-y += ucontext.h
+1 -3
arch/nios2/include/uapi/asm/elf.h
··· 50 50 51 51 typedef unsigned long elf_greg_t; 52 52 53 - #define ELF_NGREG \ 54 - ((sizeof(struct pt_regs) + sizeof(struct switch_stack)) / \ 55 - sizeof(elf_greg_t)) 53 + #define ELF_NGREG 49 56 54 typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 57 55 58 56 typedef unsigned long elf_fpregset_t;
+3 -47
arch/nios2/include/uapi/asm/ptrace.h
··· 67 67 68 68 #define NUM_PTRACE_REG (PTR_TLBMISC + 1) 69 69 70 - /* this struct defines the way the registers are stored on the 71 - stack during a system call. 72 - 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; 70 + /* User structures for general purpose registers. */ 71 + struct user_pt_regs { 72 + __u32 regs[49]; 117 73 }; 118 74 119 75 #endif /* __ASSEMBLY__ */
+7 -5
arch/nios2/include/uapi/asm/sigcontext.h
··· 15 15 * details. 16 16 */ 17 17 18 - #ifndef _ASM_NIOS2_SIGCONTEXT_H 19 - #define _ASM_NIOS2_SIGCONTEXT_H 18 + #ifndef _UAPI__ASM_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 25 struct sigcontext { 24 - struct pt_regs regs; 25 - unsigned long sc_mask; /* old sigmask */ 26 + int version; 27 + unsigned long gregs[32]; 26 28 }; 27 29 28 30 #endif
+2 -2
arch/nios2/kernel/signal.c
··· 39 39 struct ucontext *uc, int *pr2) 40 40 { 41 41 int temp; 42 - greg_t *gregs = uc->uc_mcontext.gregs; 42 + unsigned long *gregs = uc->uc_mcontext.gregs; 43 43 int err; 44 44 45 45 /* Always make any pending restarted system calls return -EINTR */ ··· 127 127 static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs) 128 128 { 129 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 131 int err = 0; 132 132 133 133 err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version);