s390: move sys_call_table and last_break from thread_info to thread_struct
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 8 Nov 2016 11:33:38 +0000 (12:33 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 15 Nov 2016 15:48:20 +0000 (16:48 +0100)
Move the last two architecture specific fields from the thread_info
structure to the thread_struct. All that is left in thread_info is
the flags field.

Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/elf.h
arch/s390/include/asm/processor.h
arch/s390/include/asm/thread_info.h
arch/s390/kernel/asm-offsets.c
arch/s390/kernel/compat_signal.c
arch/s390/kernel/entry.S
arch/s390/kernel/ptrace.c
arch/s390/kernel/signal.c

index 1736c7d3c94c7e3fe32a5a44c5f5ddb02dbaaa9f..f4381e1fb19e5e8e3e6b0bd2f1dcfe7615d24c58 100644 (file)
@@ -193,7 +193,7 @@ extern char elf_platform[];
 do {                                                           \
        set_personality(PER_LINUX |                             \
                (current->personality & (~PER_MASK)));          \
-       current_thread_info()->sys_call_table =                 \
+       current->thread.sys_call_table =                        \
                (unsigned long) &sys_call_table;                \
 } while (0)
 #else /* CONFIG_COMPAT */
@@ -204,11 +204,11 @@ do {                                                              \
                        (current->personality & ~PER_MASK));    \
        if ((ex).e_ident[EI_CLASS] == ELFCLASS32) {             \
                set_thread_flag(TIF_31BIT);                     \
-               current_thread_info()->sys_call_table =         \
+               current->thread.sys_call_table =                \
                        (unsigned long) &sys_call_table_emu;    \
        } else {                                                \
                clear_thread_flag(TIF_31BIT);                   \
-               current_thread_info()->sys_call_table =         \
+               current->thread.sys_call_table =                \
                        (unsigned long) &sys_call_table;        \
        }                                                       \
 } while (0)
index ecfa40874f7973fefae2c30999def6d0cc0d8738..9c00351f1545808c1f9e9ec9dd21fd5aa46d0184 100644 (file)
@@ -112,6 +112,7 @@ struct thread_struct {
         unsigned long ksp;              /* kernel stack pointer             */
        unsigned long user_timer;       /* task cputime in user space */
        unsigned long system_timer;     /* task cputime in kernel space */
+       unsigned long sys_call_table;   /* system call table address */
        mm_segment_t mm_segment;
        unsigned long gmap_addr;        /* address of last gmap fault. */
        unsigned int gmap_write_flag;   /* gmap fault write indication */
@@ -122,6 +123,7 @@ struct thread_struct {
        struct per_event per_event;     /* Cause of the last PER trap */
        unsigned long per_flags;        /* Flags to control debug behavior */
        unsigned int system_call;       /* system call number in signal */
+       unsigned long last_break;       /* last breaking-event-address. */
         /* pfault_wait is used to block the process on a pfault event */
        unsigned long pfault_wait;
        struct list_head list;
index b75d940fb3441c3b718c4467ed199c23847a0e9e..6084706885ab24e4234d3bd614113559aa8c0c21 100644 (file)
@@ -31,8 +31,6 @@
  */
 struct thread_info {
        unsigned long           flags;          /* low level flags */
-       unsigned long           sys_call_table; /* System call table address */
-       unsigned long           last_break;     /* last breaking-event-address. */
 };
 
 /*
index 27d0cac5f30cb45103605cd38bbd201e3e09aac5..c4b3570ded5b358547527843cbd7ab25a2328a6c 100644 (file)
@@ -31,6 +31,8 @@ int main(void)
        BLANK();
        /* thread struct offsets */
        OFFSET(__THREAD_ksp, thread_struct, ksp);
+       OFFSET(__THREAD_sysc_table,  thread_struct, sys_call_table);
+       OFFSET(__THREAD_last_break, thread_struct, last_break);
        OFFSET(__THREAD_FPU_fpc, thread_struct, fpu.fpc);
        OFFSET(__THREAD_FPU_regs, thread_struct, fpu.regs);
        OFFSET(__THREAD_per_cause, thread_struct, per_event.cause);
@@ -40,8 +42,6 @@ int main(void)
        BLANK();
        /* thread info offsets */
        OFFSET(__TI_flags, task_struct, thread_info.flags);
-       OFFSET(__TI_sysc_table,  task_struct, thread_info.sys_call_table);
-       OFFSET(__TI_last_break, task_struct, thread_info.last_break);
        BLANK();
        /* pt_regs offsets */
        OFFSET(__PT_ARGS, pt_regs, args);
index 4af60374eba01fba89dc8b170a41428b094160b5..6f2a6ab13cb53ced84db41aaa499eb0b75d054e1 100644 (file)
@@ -446,7 +446,7 @@ static int setup_frame32(struct ksignal *ksig, sigset_t *set,
                /* set extra registers only for synchronous signals */
                regs->gprs[4] = regs->int_code & 127;
                regs->gprs[5] = regs->int_parm_long;
-               regs->gprs[6] = task_thread_info(current)->last_break;
+               regs->gprs[6] = current->thread.last_break;
        }
 
        return 0;
@@ -523,7 +523,7 @@ static int setup_rt_frame32(struct ksignal *ksig, sigset_t *set,
        regs->gprs[2] = ksig->sig;
        regs->gprs[3] = (__force __u64) &frame->info;
        regs->gprs[4] = (__force __u64) &frame->uc;
-       regs->gprs[5] = task_thread_info(current)->last_break;
+       regs->gprs[5] = current->thread.last_break;
        return 0;
 }
 
index 06cc1e6f8a695e24aea964f0f8a63f16c7d9a2d8..1cc4578d861faafa0391b0e2ed8951b521080343 100644 (file)
@@ -124,7 +124,12 @@ _PIF_WORK  = (_PIF_PER_TRAP)
        .macro  LAST_BREAK scratch
        srag    \scratch,%r10,23
        jz      .+10
-       stg     %r10,__TI_last_break(%r12)
+#ifdef CONFIG_HAVE_MARCH_Z990_FEATURES
+       stg     %r10,__TASK_thread+__THREAD_last_break(%r12)
+#else
+       lghi    \scratch,__TASK_thread
+       stg     %r10,__THREAD_last_break(\scratch,%r12)
+#endif
        .endm
 
        .macro REENABLE_IRQS
@@ -287,7 +292,13 @@ ENTRY(system_call)
        mvc     __PT_INT_CODE(4,%r11),__LC_SVC_ILC
        stg     %r14,__PT_FLAGS(%r11)
 .Lsysc_do_svc:
-       lg      %r10,__TI_sysc_table(%r12)      # address of system call table
+       # load address of system call table
+#ifdef CONFIG_HAVE_MARCH_Z990_FEATURES
+       lg      %r10,__TASK_thread+__THREAD_sysc_table(%r12)
+#else
+       lghi    %r13,__TASK_thread
+       lg      %r10,__THREAD_sysc_table(%r13,%r12)
+#endif
        llgh    %r8,__PT_INT_CODE+2(%r11)
        slag    %r8,%r8,2                       # shift and test for svc 0
        jnz     .Lsysc_nr_ok
@@ -388,7 +399,6 @@ ENTRY(system_call)
        TSTMSK  __PT_FLAGS(%r11),_PIF_SYSCALL
        jno     .Lsysc_return
        lmg     %r2,%r7,__PT_R2(%r11)   # load svc arguments
-       lg      %r10,__TI_sysc_table(%r12)      # address of system call table
        lghi    %r8,0                   # svc 0 returns -ENOSYS
        llgh    %r1,__PT_INT_CODE+2(%r11)       # load new svc number
        cghi    %r1,NR_syscalls
@@ -1084,7 +1094,7 @@ cleanup_critical:
        jhe     0f
        # set up saved registers r10 and r12
        stg     %r10,16(%r11)           # r10 last break
-       stg     %r12,32(%r11)           # r12 thread-info pointer
+       stg     %r12,32(%r11)           # r12 task struct pointer
 0:     # check if the user time update has been done
        clg     %r9,BASED(.Lcleanup_system_call_insn+24)
        jh      0f
@@ -1105,7 +1115,9 @@ cleanup_critical:
        lg      %r9,16(%r11)
        srag    %r9,%r9,23
        jz      0f
-       mvc     __TI_last_break(8,%r12),16(%r11)
+       lgr     %r9,%r12
+       aghi    %r9,__TASK_thread
+       mvc     __THREAD_last_break(8,%r9),16(%r11)
 0:     # set up saved register r11
        lg      %r15,__LC_KERNEL_STACK
        la      %r9,STACK_FRAME_OVERHEAD(%r15)
index 32b791abe38cad6d4932a61a1550284d5aae35e5..b81ab8882e2ec9f1f8b2880cc511419b32ac6765 100644 (file)
@@ -461,7 +461,7 @@ long arch_ptrace(struct task_struct *child, long request,
                }
                return 0;
        case PTRACE_GET_LAST_BREAK:
-               put_user(task_thread_info(child)->last_break,
+               put_user(child->thread.last_break,
                         (unsigned long __user *) data);
                return 0;
        case PTRACE_ENABLE_TE:
@@ -811,7 +811,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
                }
                return 0;
        case PTRACE_GET_LAST_BREAK:
-               put_user(task_thread_info(child)->last_break,
+               put_user(child->thread.last_break,
                         (unsigned int __user *) data);
                return 0;
        }
@@ -997,10 +997,10 @@ static int s390_last_break_get(struct task_struct *target,
        if (count > 0) {
                if (kbuf) {
                        unsigned long *k = kbuf;
-                       *k = task_thread_info(target)->last_break;
+                       *k = target->thread.last_break;
                } else {
                        unsigned long  __user *u = ubuf;
-                       if (__put_user(task_thread_info(target)->last_break, u))
+                       if (__put_user(target->thread.last_break, u))
                                return -EFAULT;
                }
        }
@@ -1327,7 +1327,7 @@ static int s390_compat_last_break_get(struct task_struct *target,
        compat_ulong_t last_break;
 
        if (count > 0) {
-               last_break = task_thread_info(target)->last_break;
+               last_break = target->thread.last_break;
                if (kbuf) {
                        unsigned long *k = kbuf;
                        *k = last_break;
index 8c6fba710acfce3da81bd46291add354c243a4ef..9f241d1efeda6421ecead6dc0083f07d5cee8951 100644 (file)
@@ -359,7 +359,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
                /* set extra registers only for synchronous signals */
                regs->gprs[4] = regs->int_code & 127;
                regs->gprs[5] = regs->int_parm_long;
-               regs->gprs[6] = task_thread_info(current)->last_break;
+               regs->gprs[6] = current->thread.last_break;
        }
        return 0;
 }
@@ -430,7 +430,7 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
        regs->gprs[2] = ksig->sig;
        regs->gprs[3] = (unsigned long) &frame->info;
        regs->gprs[4] = (unsigned long) &frame->uc;
-       regs->gprs[5] = task_thread_info(current)->last_break;
+       regs->gprs[5] = current->thread.last_break;
        return 0;
 }