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

sparc64: remove CONFIG_SET_FS support

sparc64 uses address space identifiers to differentiate between kernel
and user space, using ASI_P for kernel threads but ASI_AIUS for normal
user space, with the option of changing between them.

As nothing really changes the ASI any more, just hardcode ASI_AIUS
everywhere. Kernel threads are not allowed to access __user pointers
anyway.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+9 -49
+1 -1
arch/sparc/Kconfig
··· 46 46 select LOCKDEP_SMALL if LOCKDEP 47 47 select NEED_DMA_MAP_STATE 48 48 select NEED_SG_DMA_LENGTH 49 - select SET_FS 50 49 select TRACE_IRQFLAGS_SUPPORT 51 50 52 51 config SPARC32 ··· 58 59 select HAVE_UID16 59 60 select OLD_SIGACTION 60 61 select ZONE_DMA 62 + select SET_FS 61 63 62 64 config SPARC64 63 65 def_bool 64BIT
-4
arch/sparc/include/asm/processor_64.h
··· 47 47 48 48 #ifndef __ASSEMBLY__ 49 49 50 - typedef struct { 51 - unsigned char seg; 52 - } mm_segment_t; 53 - 54 50 /* The Sparc processor specific thread struct. */ 55 51 /* XXX This should die, everything can go into thread_info now. */ 56 52 struct thread_struct {
+1 -3
arch/sparc/include/asm/switch_to_64.h
··· 20 20 */ 21 21 #define switch_to(prev, next, last) \ 22 22 do { save_and_clear_fpu(); \ 23 - /* If you are tempted to conditionalize the following */ \ 24 - /* so that ASI is only written if it changes, think again. */ \ 25 23 __asm__ __volatile__("wr %%g0, %0, %%asi" \ 26 - : : "r" (task_thread_info(next)->current_ds));\ 24 + : : "r" (ASI_AIUS)); \ 27 25 trap_block[current_thread_info()->cpu].thread = \ 28 26 task_thread_info(next); \ 29 27 __asm__ __volatile__( \
+1 -3
arch/sparc/include/asm/thread_info_64.h
··· 46 46 struct pt_regs *kregs; 47 47 int preempt_count; /* 0 => preemptable, <0 => BUG */ 48 48 __u8 new_child; 49 - __u8 current_ds; 49 + __u8 __pad; 50 50 __u16 cpu; 51 51 52 52 unsigned long *utraps; ··· 81 81 #define TI_KREGS 0x00000028 82 82 #define TI_PRE_COUNT 0x00000030 83 83 #define TI_NEW_CHILD 0x00000034 84 - #define TI_CURRENT_DS 0x00000035 85 84 #define TI_CPU 0x00000036 86 85 #define TI_UTRAPS 0x00000038 87 86 #define TI_REG_WINDOW 0x00000040 ··· 115 116 #define INIT_THREAD_INFO(tsk) \ 116 117 { \ 117 118 .task = &tsk, \ 118 - .current_ds = ASI_P, \ 119 119 .preempt_count = INIT_PREEMPT_COUNT, \ 120 120 .kregs = (struct pt_regs *)(init_stack+THREAD_SIZE)-1 \ 121 121 }
+1 -19
arch/sparc/include/asm/uaccess_64.h
··· 12 12 #include <asm/spitfire.h> 13 13 14 14 #include <asm/processor.h> 15 + #include <asm-generic/access_ok.h> 15 16 16 17 /* 17 18 * Sparc64 is segmented, though more like the M68K than the I386. 18 19 * We use the secondary ASI to address user memory, which references a 19 20 * completely different VM map, thus there is zero chance of the user 20 21 * doing something queer and tricking us into poking kernel memory. 21 - * 22 - * What is left here is basically what is needed for the other parts of 23 - * the kernel that expect to be able to manipulate, erum, "segments". 24 - * Or perhaps more properly, permissions. 25 - * 26 - * "For historical reasons, these macros are grossly misnamed." -Linus 27 22 */ 28 - 29 - #define KERNEL_DS ((mm_segment_t) { ASI_P }) 30 - #define USER_DS ((mm_segment_t) { ASI_AIUS }) /* har har har */ 31 - 32 - #define get_fs() ((mm_segment_t){(current_thread_info()->current_ds)}) 33 - 34 - #include <asm-generic/access_ok.h> 35 - 36 - #define set_fs(val) \ 37 - do { \ 38 - current_thread_info()->current_ds = (val).seg; \ 39 - __asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "r" ((val).seg)); \ 40 - } while(0) 41 23 42 24 /* 43 25 * Test whether a block of memory is a valid user space address.
-12
arch/sparc/kernel/process_64.c
··· 106 106 { 107 107 struct reg_window32 __user *rw; 108 108 struct reg_window32 r_w; 109 - mm_segment_t old_fs; 110 109 111 110 __asm__ __volatile__ ("flushw"); 112 111 rw = compat_ptr((unsigned int)regs->u_regs[14]); 113 - old_fs = get_fs(); 114 - set_fs (USER_DS); 115 112 if (copy_from_user (&r_w, rw, sizeof(r_w))) { 116 - set_fs (old_fs); 117 113 return; 118 114 } 119 115 120 - set_fs (old_fs); 121 116 printk("l0: %08x l1: %08x l2: %08x l3: %08x " 122 117 "l4: %08x l5: %08x l6: %08x l7: %08x\n", 123 118 r_w.locals[0], r_w.locals[1], r_w.locals[2], r_w.locals[3], ··· 131 136 struct reg_window __user *rw; 132 137 struct reg_window *rwk; 133 138 struct reg_window r_w; 134 - mm_segment_t old_fs; 135 139 136 140 if ((regs->tstate & TSTATE_PRIV) || !(test_thread_flag(TIF_32BIT))) { 137 141 __asm__ __volatile__ ("flushw"); ··· 139 145 rwk = (struct reg_window *) 140 146 (regs->u_regs[14] + STACK_BIAS); 141 147 if (!(regs->tstate & TSTATE_PRIV)) { 142 - old_fs = get_fs(); 143 - set_fs (USER_DS); 144 148 if (copy_from_user (&r_w, rw, sizeof(r_w))) { 145 - set_fs (old_fs); 146 149 return; 147 150 } 148 151 rwk = &r_w; 149 - set_fs (old_fs); 150 152 } 151 153 } else { 152 154 show_regwindow32(regs); ··· 588 598 memset(child_trap_frame, 0, child_stack_sz); 589 599 __thread_flag_byte_ptr(t)[TI_FLAG_BYTE_CWP] = 590 600 (current_pt_regs()->tstate + 1) & TSTATE_CWP; 591 - t->current_ds = ASI_P; 592 601 t->kregs->u_regs[UREG_G1] = sp; /* function */ 593 602 t->kregs->u_regs[UREG_G2] = arg; 594 603 return 0; ··· 602 613 t->kregs->u_regs[UREG_FP] = sp; 603 614 __thread_flag_byte_ptr(t)[TI_FLAG_BYTE_CWP] = 604 615 (regs->tstate + 1) & TSTATE_CWP; 605 - t->current_ds = ASI_AIUS; 606 616 if (sp != regs->u_regs[UREG_FP]) { 607 617 unsigned long csp; 608 618
-2
arch/sparc/kernel/traps_64.c
··· 2857 2857 TI_PRE_COUNT != offsetof(struct thread_info, 2858 2858 preempt_count) || 2859 2859 TI_NEW_CHILD != offsetof(struct thread_info, new_child) || 2860 - TI_CURRENT_DS != offsetof(struct thread_info, 2861 - current_ds) || 2862 2860 TI_KUNA_REGS != offsetof(struct thread_info, 2863 2861 kern_una_regs) || 2864 2862 TI_KUNA_INSN != offsetof(struct thread_info,
+1 -2
arch/sparc/lib/NGmemcpy.S
··· 10 10 #include <asm/thread_info.h> 11 11 #define GLOBAL_SPARE %g7 12 12 #define RESTORE_ASI(TMP) \ 13 - ldub [%g6 + TI_CURRENT_DS], TMP; \ 14 - wr TMP, 0x0, %asi; 13 + wr %g0, ASI_AIUS, %asi 15 14 #else 16 15 #define GLOBAL_SPARE %g5 17 16 #define RESTORE_ASI(TMP) \
+4 -3
arch/sparc/mm/init_64.c
··· 709 709 710 710 void prom_world(int enter) 711 711 { 712 - if (!enter) 713 - set_fs(get_fs()); 714 - 712 + /* 713 + * No need to change the address space any more, just flush 714 + * the register windows 715 + */ 715 716 __asm__ __volatile__("flushw"); 716 717 } 717 718