From cf34d92350569ae3840b43dd70577a596ec9dd33 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Wed, 15 Jan 2003 19:36:37 -0800 Subject: [PATCH] x86_64 update x86-64 updates for 2.5.58. Changes only x86-64 specific files. - Rewrote module allocation. Lots of bugs fixed. Module loading should work now again. - Kconfig help fixes from Randy Dunlap - Makefile cleanups from Pavel Machek and Sam Ravnborg - Assembly cleanups from Pavel - defconfig update - Better strlen_user/strnlen_user - Merge with i386: new ptrace commands, 32bit vsyscall signal trampolines new deactivate_mm, add asm/bug.h - Make sure initramfs is freed after booting (thanks to Kai for the hint) - User per cpu data for profile counters (Ravikiran Thirumalai) - 32bit compat_* updates from Stephen Rothwell - Fix race in context switch. The exception handler for bogus segment loads in __switch_to needs to keep interrupts disabled, otherwise an interrupt can deadlock on scheduler locks. Also make sure they don't printk or set oops_in_progress during printk because printk does a wake_up too. - Disable 64bit GS base changes for processes. I cannot get it to work reliably. - Clear IOPL on kernel entry --- include/asm-x86_64/bug.h | 24 ++++++++++++++++++++++++ include/asm-x86_64/compat.h | 13 +++++++++++++ include/asm-x86_64/ia32.h | 13 ------------- include/asm-x86_64/mmu_context.h | 5 ++++- include/asm-x86_64/page.h | 16 +--------------- include/asm-x86_64/proto.h | 6 ++++++ include/asm-x86_64/ptrace.h | 4 ++++ include/asm-x86_64/segment.h | 2 +- include/asm-x86_64/uaccess.h | 2 +- 9 files changed, 54 insertions(+), 31 deletions(-) create mode 100644 include/asm-x86_64/bug.h (limited to 'include') diff --git a/include/asm-x86_64/bug.h b/include/asm-x86_64/bug.h new file mode 100644 index 000000000000..cd37970bd4ee --- /dev/null +++ b/include/asm-x86_64/bug.h @@ -0,0 +1,24 @@ +#ifndef __ASM_X8664_BUG_H +#define __ASM_X8664_BUG_H 1 + +#include + +/* + * Tell the user there is some problem. The exception handler decodes + * this frame. + */ +struct bug_frame { + unsigned char ud2[2]; + /* should use 32bit offset instead, but the assembler doesn't + like it */ + char *filename; + unsigned short line; +} __attribute__((packed)); + +#define BUG() \ + asm volatile("ud2 ; .quad %c1 ; .short %c0" :: \ + "i"(__LINE__), "i" (__stringify(KBUILD_BASENAME))) +#define PAGE_BUG(page) BUG() +void out_of_line_bug(void); + +#endif diff --git a/include/asm-x86_64/compat.h b/include/asm-x86_64/compat.h index 140308fb61e7..5307fdeb598c 100644 --- a/include/asm-x86_64/compat.h +++ b/include/asm-x86_64/compat.h @@ -68,4 +68,17 @@ struct compat_flock { compat_pid_t l_pid; }; +struct compat_statfs { + int f_type; + int f_bsize; + int f_blocks; + int f_bfree; + int f_bavail; + int f_files; + int f_ffree; + compat_fsid_t f_fsid; + int f_namelen; /* SunOS ignores this field. */ + int f_spare[6]; +}; + #endif /* _ASM_X86_64_COMPAT_H */ diff --git a/include/asm-x86_64/ia32.h b/include/asm-x86_64/ia32.h index 7ebb9db48314..c39a426062ee 100644 --- a/include/asm-x86_64/ia32.h +++ b/include/asm-x86_64/ia32.h @@ -101,19 +101,6 @@ struct stat64 { } __attribute__((packed)); -struct statfs32 { - int f_type; - int f_bsize; - int f_blocks; - int f_bfree; - int f_bavail; - int f_files; - int f_ffree; - compat_fsid_t f_fsid; - int f_namelen; /* SunOS ignores this field. */ - int f_spare[6]; -}; - typedef union sigval32 { int sival_int; unsigned int sival_ptr; diff --git a/include/asm-x86_64/mmu_context.h b/include/asm-x86_64/mmu_context.h index 296390b6b5ad..41fc9820ee94 100644 --- a/include/asm-x86_64/mmu_context.h +++ b/include/asm-x86_64/mmu_context.h @@ -62,7 +62,10 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, #endif } -#define deactivate_mm(tsk,mm) do { } while (0) +#define deactivate_mm(tsk,mm) do { \ + load_gs_index(0); \ + asm volatile("movl %0,%%fs"::"r"(0)); \ +} while(0) #define activate_mm(prev, next) \ switch_mm((prev),(next),NULL,smp_processor_id()) diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h index 41a2b59d9d7d..2e65d509ec25 100644 --- a/include/asm-x86_64/page.h +++ b/include/asm-x86_64/page.h @@ -69,21 +69,7 @@ typedef struct { unsigned long pgprot; } pgprot_t; #ifndef __ASSEMBLY__ -#include - -/* - * Tell the user there is some problem. The exception handler decodes this frame. - */ -struct bug_frame { - unsigned char ud2[2]; - char *filename; /* should use 32bit offset instead, but the assembler doesn't like it */ - unsigned short line; -} __attribute__((packed)); -#define BUG() \ - asm volatile("ud2 ; .quad %c1 ; .short %c0" :: \ - "i"(__LINE__), "i" (__stringify(KBUILD_BASENAME))) -#define PAGE_BUG(page) BUG() -void out_of_line_bug(void); +#include /* Pure 2^n version of get_order */ extern __inline__ int get_order(unsigned long size) diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h index 9ca683849c42..f58ac42093e1 100644 --- a/include/asm-x86_64/proto.h +++ b/include/asm-x86_64/proto.h @@ -43,6 +43,12 @@ extern void exception_table_check(void); extern int acpi_boot_init(char *); extern int map_syscall32(struct mm_struct *mm, unsigned long address); +extern char *syscall32_page; + +struct thread_struct; + +int do_set_thread_area(struct thread_struct *t, struct user_desc *u_info); +int do_get_thread_area(struct thread_struct *t, struct user_desc *u_info); #define round_up(x,y) (((x) + (y) - 1) & ~((y)-1)) #define round_down(x,y) ((x) & ~((y)-1)) diff --git a/include/asm-x86_64/ptrace.h b/include/asm-x86_64/ptrace.h index da406de40ca1..496595c011ed 100644 --- a/include/asm-x86_64/ptrace.h +++ b/include/asm-x86_64/ptrace.h @@ -78,6 +78,10 @@ struct pt_regs { #define PTRACE_GETFPXREGS 18 #define PTRACE_SETFPXREGS 19 +#define PTRACE_GET_THREAD_AREA 25 +#define PTRACE_SET_THREAD_AREA 26 + + #if defined(__KERNEL__) && !defined(__ASSEMBLY__) #define user_mode(regs) (!!((regs)->cs & 3)) #define instruction_pointer(regs) ((regs)->rip) diff --git a/include/asm-x86_64/segment.h b/include/asm-x86_64/segment.h index 64f131070585..6992086cbe7c 100644 --- a/include/asm-x86_64/segment.h +++ b/include/asm-x86_64/segment.h @@ -10,7 +10,7 @@ /* * we cannot use the same code segment descriptor for user and kernel - * even not in the long flat model, because of different DPL /kkeil + * -- not even in the long flat mode, because of different DPL /kkeil * The segment offset needs to contain a RPL. Grr. -AK * GDT layout to get 64bit syscall right (sysret hardcodes gdt offsets) */ diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h index c18c2d6a77b2..14fa21f8b302 100644 --- a/include/asm-x86_64/uaccess.h +++ b/include/asm-x86_64/uaccess.h @@ -299,8 +299,8 @@ static inline int __copy_to_user(void *dst, const void *src, unsigned size) long strncpy_from_user(char *dst, const char *src, long count); long __strncpy_from_user(char *dst, const char *src, long count); -#define strlen_user(str) strnlen_user(str, ~0UL >> 1) long strnlen_user(const char *str, long n); +long strlen_user(const char *str); unsigned long clear_user(void *mem, unsigned long len); unsigned long __clear_user(void *mem, unsigned long len); -- cgit v1.2.3