diff options
| author | Andi Kleen <ak@suse.de> | 2003-03-24 19:54:54 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-03-24 19:54:54 -0800 |
| commit | b4f6270ea3fec60e9b02f4bdf36f2ae7298cd024 (patch) | |
| tree | aef7bd1a413f18119415c05b49cbc50d4a84c917 /include | |
| parent | 5563e77b38c287f8d88b6a3298b411b7db24f901 (diff) | |
[PATCH] x86-64 updates
Lots of x86-64 updates. Merge with 2.4 and NUMA works now. Also reenabled
the preemptive kernel. And some other bug fixes.
IOMMU disabled by default now because it has problems.
- Add more CONFIG options for device driver debugging and iommu
force/debug. (don't enable iommu force currently)
- Some S3/ACPI fixes/cleanups from Pavel.
- Set MSG_COMPAT_* in msg_flags for networking 32bit emulation.
This unfortunately still doesn't fix the fd passing problems.
- Sync PCI IOMMU code with 2.4 (minor fixes, flush less often)
- Really fix UP compilation (Pavel)
- Reenable preempt
- Fix CONFIG_DISCONTIGMEM bootup and enable. Still needs more tuning.
- Fix some bugs in topology discovery and clean code up.
- Don't put unwind tables into object files
- Some kernel debugging hooks
- Move CPU detection into early real mode code to better interact with
vesafb consoles
- Initialize mode in real mode character output
- New 32bit FPU signal save/restore
- Various fixes in FPU handling in ptrace
- Fix security holes in ptrace (32bit and 64bit)
- Fix serial ioctl (including security hole)
- Add bluetooth ioctls to 32bit emu (from sparc64)
- Correctly enable si_val in queued signals in 32bit emulation
- Rework SEM_STAT emulation. LTP still fails unfortunately.
- Fix error case in msg* emulation
- Fix debug register access from ptrace (Michal Ludvig, me)
- Fix handling of NULL arguments in 32bit execve
- Fix some error cases for 32bit readv/writev (LTP still complains)
- Remove rate control from unimplemented syscall warnings
- Fix error message for missing aperture
- Turn some APIC printks into Dprintk to make the bootup more quiet
- Some fixes for no APIC (probably still broken), add disableapic
option (untested)
- Sync K8 MCE handler with 2.4. Should work a lot better now.
- Remove never used KDB hooks
- Fix buffer overflow in command line copying
- Merge from i386: use separate status word for lazy FPU state
- Don't force the IOMMU for dma masks < 4GB.
- Print backtrace in Sysrq-T (from Andrea)
- Merge from i386: fix FPU race in fork.
- Disable NX mode by default for now
- Rewrite dump_pagetable
- Fix off by one bug in ioremap (i386 merge)
- Merge from i386: handle VIA pci bridge bugs
- Disable NUMA ACPI support (no SRAT support yet)
- Fix aio 32bit emulation
- Increase 32bit address space to nearly 4GB
- Add exit_group syscall
- Fix TLS setting in clone (Ulrich Drepper)
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-x86_64/apic.h | 2 | ||||
| -rw-r--r-- | include/asm-x86_64/debugreg.h | 2 | ||||
| -rw-r--r-- | include/asm-x86_64/desc.h | 1 | ||||
| -rw-r--r-- | include/asm-x86_64/hdreg.h | 2 | ||||
| -rw-r--r-- | include/asm-x86_64/i387.h | 38 | ||||
| -rw-r--r-- | include/asm-x86_64/kdebug.h | 16 | ||||
| -rw-r--r-- | include/asm-x86_64/numa.h | 6 | ||||
| -rw-r--r-- | include/asm-x86_64/pci.h | 25 | ||||
| -rw-r--r-- | include/asm-x86_64/pgtable.h | 1 | ||||
| -rw-r--r-- | include/asm-x86_64/processor.h | 6 | ||||
| -rw-r--r-- | include/asm-x86_64/proto.h | 3 | ||||
| -rw-r--r-- | include/asm-x86_64/suspend.h | 2 | ||||
| -rw-r--r-- | include/asm-x86_64/system.h | 29 | ||||
| -rw-r--r-- | include/asm-x86_64/thread_info.h | 16 | ||||
| -rw-r--r-- | include/asm-x86_64/unistd.h | 4 |
15 files changed, 83 insertions, 70 deletions
diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h index e15d95de1f69..bce8e2252907 100644 --- a/include/asm-x86_64/apic.h +++ b/include/asm-x86_64/apic.h @@ -75,7 +75,7 @@ extern void smp_local_timer_interrupt (struct pt_regs * regs); extern void setup_boot_APIC_clock (void); extern void setup_secondary_APIC_clock (void); extern void setup_apic_nmi_watchdog (void); -extern inline void nmi_watchdog_tick (struct pt_regs * regs); +extern void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason); extern int APIC_init_uniprocessor (void); extern void disable_APIC_timer(void); extern void enable_APIC_timer(void); diff --git a/include/asm-x86_64/debugreg.h b/include/asm-x86_64/debugreg.h index 81c8f097e4d6..2c4fe65e69ac 100644 --- a/include/asm-x86_64/debugreg.h +++ b/include/asm-x86_64/debugreg.h @@ -58,7 +58,7 @@ We can slow the instruction pipeline for instructions coming via the gdt or the ldt if we want to. I am not sure why this is an advantage */ -#define DR_CONTROL_RESERVED (0xFC00) /* Reserved by Intel */ +#define DR_CONTROL_RESERVED (0xFFFFFFFFFC00) /* Reserved by Intel */ #define DR_LOCAL_SLOWDOWN (0x100) /* Local slow the pipeline */ #define DR_GLOBAL_SLOWDOWN (0x200) /* Global slow the pipeline */ diff --git a/include/asm-x86_64/desc.h b/include/asm-x86_64/desc.h index 33d997b78ecc..c871c9e5aecb 100644 --- a/include/asm-x86_64/desc.h +++ b/include/asm-x86_64/desc.h @@ -8,6 +8,7 @@ #ifndef __ASSEMBLY__ #include <asm/segment.h> +#include <asm/mmu.h> // 8 byte segment descriptor struct desc_struct { diff --git a/include/asm-x86_64/hdreg.h b/include/asm-x86_64/hdreg.h index 6ca37a9778de..52a2ed303fcf 100644 --- a/include/asm-x86_64/hdreg.h +++ b/include/asm-x86_64/hdreg.h @@ -7,6 +7,4 @@ #ifndef __ASMx86_64_HDREG_H #define __ASMx86_64_HDREG_H -typedef unsigned long ide_ioreg_t; - #endif /* __ASMx86_64_HDREG_H */ diff --git a/include/asm-x86_64/i387.h b/include/asm-x86_64/i387.h index 09e18af42ae9..e5bc31f19001 100644 --- a/include/asm-x86_64/i387.h +++ b/include/asm-x86_64/i387.h @@ -19,15 +19,15 @@ #include <asm/thread_info.h> extern void fpu_init(void); -extern void init_fpu(void); -int save_i387(struct _fpstate *buf); +extern void init_fpu(struct task_struct *child); +extern int save_i387(struct _fpstate *buf); static inline int need_signal_i387(struct task_struct *me) { if (!me->used_math) return 0; me->used_math = 0; - if (me->thread_info->flags & _TIF_USEDFPU) + if (me->thread_info->status & TS_USEDFPU) return 0; return 1; } @@ -39,14 +39,14 @@ static inline int need_signal_i387(struct task_struct *me) #define kernel_fpu_end() stts() #define unlazy_fpu(tsk) do { \ - if ((tsk)->thread_info->flags & _TIF_USEDFPU) \ + if ((tsk)->thread_info->status & TS_USEDFPU) \ save_init_fpu(tsk); \ } while (0) #define clear_fpu(tsk) do { \ - if ((tsk)->thread_info->flags & _TIF_USEDFPU) { \ + if ((tsk)->thread_info->status & TS_USEDFPU) { \ asm volatile("fwait"); \ - (tsk)->thread_info->flags &= ~_TIF_USEDFPU; \ + (tsk)->thread_info->status &= ~TS_USEDFPU; \ stts(); \ } \ } while (0) @@ -114,11 +114,11 @@ static inline int save_i387_checking(struct i387_fxsave_struct *fx) static inline void kernel_fpu_begin(void) { - struct task_struct *me = current; - if (test_tsk_thread_flag(me,TIF_USEDFPU)) { - asm volatile("fxsave %0 ; fnclex" - : "=m" (me->thread.i387.fxsave)); - clear_tsk_thread_flag(me, TIF_USEDFPU); + struct thread_info *me = current_thread_info(); + if (me->status & TS_USEDFPU) { + asm volatile("rex64 ; fxsave %0 ; fnclex" + : "=m" (me->task->thread.i387.fxsave)); + me->status &= ~TS_USEDFPU; return; } clts(); @@ -128,7 +128,7 @@ static inline void save_init_fpu( struct task_struct *tsk ) { asm volatile( "fxsave %0 ; fnclex" : "=m" (tsk->thread.i387.fxsave)); - tsk->thread_info->flags &= ~TIF_USEDFPU; + tsk->thread_info->status &= ~TS_USEDFPU; stts(); } @@ -140,18 +140,4 @@ static inline int restore_i387(struct _fpstate *buf) return restore_fpu_checking((struct i387_fxsave_struct *)buf); } - -static inline void empty_fpu(struct task_struct *child) -{ - if (!child->used_math) { - /* Simulate an empty FPU. */ - memset(&child->thread.i387.fxsave,0,sizeof(struct i387_fxsave_struct)); - child->thread.i387.fxsave.cwd = 0x037f; - child->thread.i387.fxsave.swd = 0; - child->thread.i387.fxsave.twd = 0; - child->thread.i387.fxsave.mxcsr = 0x1f80; - } - child->used_math = 1; -} - #endif /* __ASM_X86_64_I387_H */ diff --git a/include/asm-x86_64/kdebug.h b/include/asm-x86_64/kdebug.h index 745262828a27..316d01ac6eef 100644 --- a/include/asm-x86_64/kdebug.h +++ b/include/asm-x86_64/kdebug.h @@ -9,8 +9,13 @@ struct die_args { struct pt_regs *regs; const char *str; long err; + int trapnr; + int signr; }; +/* Note - you should never unregister because that can race with NMIs. + If you really want to do it first unregister - then synchronize_kernel - then free. + */ extern struct notifier_block *die_chain; /* Grossly misnamed. */ @@ -21,15 +26,16 @@ enum die_val { DIE_PANIC, DIE_NMI, DIE_DIE, + DIE_NMIWATCHDOG, + DIE_KERNELDEBUG, + DIE_TRAP, + DIE_GPF, DIE_CALL, - DIE_CPUINIT, /* not really a die, but .. */ - DIE_TRAPINIT, /* not really a die, but .. */ - DIE_STOP, }; -static inline int notify_die(enum die_val val,char *str,struct pt_regs *regs,long err) +static inline int notify_die(enum die_val val,char *str,struct pt_regs *regs,long err,int trap, int sig) { - struct die_args args = { regs: regs, str: str, err: err }; + struct die_args args = { .regs=regs, .str=str, .err=err, .trapnr=trap,.signr=sig }; return notifier_call_chain(&die_chain, val, &args); } diff --git a/include/asm-x86_64/numa.h b/include/asm-x86_64/numa.h index 7686e4dfd9f4..340e71cfc538 100644 --- a/include/asm-x86_64/numa.h +++ b/include/asm-x86_64/numa.h @@ -8,13 +8,11 @@ struct node { u64 start,end; }; -#define for_all_nodes(x) for ((x) = 0; (x) <= maxnode; (x)++) \ +#define for_all_nodes(x) for ((x) = 0; (x) < numnodes; (x)++) \ if ((1UL << (x)) & nodes_present) -#define early_for_all_nodes(n) \ - for (n=0; n<MAXNODE;n++) if (nodes[n].start!=nodes[n].end) -extern int compute_hash_shift(struct node *nodes, int numnodes, u64 maxmem); +extern int compute_hash_shift(struct node *nodes); extern unsigned long nodes_present; #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT)) diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h index 74594c63e38c..d94c514a06ab 100644 --- a/include/asm-x86_64/pci.h +++ b/include/asm-x86_64/pci.h @@ -44,8 +44,7 @@ int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); struct pci_dev; -extern int iommu_setup(char *opt, char **end); - +extern int iommu_setup(char *opt); extern void pci_iommu_init(void); /* Allocate and map kernel buffer using consistent mode DMA for a device. @@ -77,10 +76,11 @@ extern void pci_free_consistent(struct pci_dev *hwdev, size_t size, * Once the device is given the dma address, the device owns this memory * until either pci_unmap_single or pci_dma_sync_single is performed. */ -extern dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, - size_t size, int direction); +extern dma_addr_t __pci_map_single(struct pci_dev *hwdev, void *ptr, + size_t size, int direction, int flush); + -extern void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t addr, +void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t addr, size_t size, int direction); /* @@ -118,12 +118,16 @@ static inline void pci_dma_sync_sg(struct pci_dev *hwdev, BUG_ON(direction == PCI_DMA_NONE); } -#define PCI_DMA_BUS_IS_PHYS 0 +/* The PCI address space does equal the physical memory + * address space. The networking and block device layers use + * this boolean for bounce buffer decisions. + */ +#define PCI_DMA_BUS_IS_PHYS (0) #else -static inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, - size_t size, int direction) +static inline dma_addr_t __pci_map_single(struct pci_dev *hwdev, void *ptr, + size_t size, int direction, int flush) { dma_addr_t addr; @@ -210,6 +214,11 @@ extern int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, extern void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction); +static inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, + size_t size, int direction) +{ + return __pci_map_single(hwdev,ptr,size,direction,1); +} #define pci_unmap_page pci_unmap_single diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h index 7aa012007c7b..4d31ca2fef05 100644 --- a/include/asm-x86_64/pgtable.h +++ b/include/asm-x86_64/pgtable.h @@ -283,6 +283,7 @@ static inline int pmd_large(pmd_t pte) { #define pml4_page(pml4) ((unsigned long) __va(pml4_val(pml4) & PTE_MASK)) #define pml4_index(address) ((address >> PML4_SHIFT) & (PTRS_PER_PML4-1)) #define pml4_offset_k(address) (init_level4_pgt + pml4_index(address)) +#define pml4_present(pml4) (pml4_val(pml4) & _PAGE_PRESENT) #define mk_kernel_pml4(address) ((pml4_t){ (address) | _KERNPG_TABLE }) #define level3_offset_k(dir, address) ((pgd_t *) pml4_page(*(dir)) + pgd_index(address)) diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h index 705ccf54580c..49d3c6ee414d 100644 --- a/include/asm-x86_64/processor.h +++ b/include/asm-x86_64/processor.h @@ -269,7 +269,7 @@ struct mm_struct; extern void release_thread(struct task_struct *); /* Prepare to copy thread state - unlazy all lazy status */ -#define prepare_to_copy(tsk) do { } while (0) +extern void prepare_to_copy(struct task_struct *tsk); /* * create a kernel thread without removing it from tasklists @@ -308,8 +308,8 @@ extern inline void sync_core(void) #define ARCH_HAS_PREFETCHW #define ARCH_HAS_SPINLOCK_PREFETCH -#define prefetch(x) __builtin_prefetch((x),0) -#define prefetchw(x) __builtin_prefetch((x),1) +#define prefetch(x) __builtin_prefetch((x),0,1) +#define prefetchw(x) __builtin_prefetch((x),1,1) #define spin_lock_prefetch(x) prefetchw(x) #define cpu_relax() rep_nop() diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h index 785d812fe2e8..2ced019ad2ed 100644 --- a/include/asm-x86_64/proto.h +++ b/include/asm-x86_64/proto.h @@ -6,6 +6,7 @@ /* misc architecture specific prototypes */ struct cpuinfo_x86; +struct pt_regs; extern void get_cpu_vendor(struct cpuinfo_x86*); extern void start_kernel(void); @@ -41,6 +42,8 @@ extern void free_bootmem_generic(unsigned long phys, unsigned len); extern unsigned long end_pfn_map; extern void show_stack(unsigned long * rsp); +extern void show_trace(unsigned long * rsp); +extern void show_registers(struct pt_regs *regs); extern void exception_table_check(void); diff --git a/include/asm-x86_64/suspend.h b/include/asm-x86_64/suspend.h index bccd85bb8dec..cc193889eefa 100644 --- a/include/asm-x86_64/suspend.h +++ b/include/asm-x86_64/suspend.h @@ -11,7 +11,7 @@ arch_prepare_suspend(void) { } -/* image of the saved processor state */ +/* Image of the saved processor state. If you touch this, fix acpi_wakeup.S. */ struct saved_context { u16 ds, es, fs, gs, ss; unsigned long gs_base, gs_kernel_base, fs_base; diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h index 439c801f015b..3d3846fc9e04 100644 --- a/include/asm-x86_64/system.h +++ b/include/asm-x86_64/system.h @@ -22,18 +22,18 @@ struct save_context_frame { unsigned long rbp; unsigned long rbx; + unsigned long r11; + unsigned long r10; + unsigned long r9; + unsigned long r8; unsigned long rcx; unsigned long rdx; - unsigned long rsi; - unsigned long rdi; unsigned long r15; unsigned long r14; unsigned long r13; unsigned long r12; - unsigned long r11; - unsigned long r10; - unsigned long r9; - unsigned long r8; + unsigned long rdi; + unsigned long rsi; }; /* frame pointer must be last for get_wchan */ @@ -43,19 +43,20 @@ struct save_context_frame { rbp needs to be always explicitely saved because gcc cannot clobber the frame pointer and the scheduler is compiled with frame pointers. -AK */ #define SAVE_CONTEXT \ - __PUSH(r8) __PUSH(r9) __PUSH(r10) __PUSH(r11) __PUSH(r12) __PUSH(r13) \ - __PUSH(r14) __PUSH(r15) \ - __PUSH(rdi) __PUSH(rsi) \ - __PUSH(rdx) __PUSH(rcx) \ + __PUSH(rsi) __PUSH(rdi) \ + __PUSH(r12) __PUSH(r13) __PUSH(r14) __PUSH(r15) \ + __PUSH(rdx) __PUSH(rcx) __PUSH(r8) __PUSH(r9) __PUSH(r10) __PUSH(r11) \ __PUSH(rbx) __PUSH(rbp) #define RESTORE_CONTEXT \ __POP(rbp) __POP(rbx) \ - __POP(rcx) __POP(rdx) \ - __POP(rsi) __POP(rdi) \ - __POP(r15) __POP(r14) __POP(r13) __POP(r12) __POP(r11) __POP(r10) \ - __POP(r9) __POP(r8) + __POP(r11) __POP(r10) __POP(r9) __POP(r8) __POP(rcx) __POP(rdx) \ + __POP(r15) __POP(r14) __POP(r13) __POP(r12) \ + __POP(rdi) __POP(rsi) /* RED-PEN: pipeline stall on ret because it is not predicted */ +/* RED-PEN: the register saving could be optimized */ +/* frame pointer must be last for get_wchan */ + #define switch_to(prev,next,last) \ asm volatile(SAVE_CONTEXT \ "movq %%rsp,%[prevrsp]\n\t" \ diff --git a/include/asm-x86_64/thread_info.h b/include/asm-x86_64/thread_info.h index f841e925bef0..11e8d21989c7 100644 --- a/include/asm-x86_64/thread_info.h +++ b/include/asm-x86_64/thread_info.h @@ -27,6 +27,7 @@ struct thread_info { struct task_struct *task; /* main task structure */ struct exec_domain *exec_domain; /* execution domain */ __u32 flags; /* low level flags */ + __u32 status; /* thread synchronous flags */ __u32 cpu; /* current CPU */ int preempt_count; @@ -100,16 +101,14 @@ static inline struct thread_info *stack_thread_info(void) #define TIF_SIGPENDING 2 /* signal pending */ #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ #define TIF_SINGLESTEP 4 /* reenable singlestep on user return*/ -#define TIF_USEDFPU 16 /* FPU was used by this task this quantum */ -#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ -#define TIF_IA32 18 /* 32bit process */ +#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ +#define TIF_IA32 17 /* 32bit process */ #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) -#define _TIF_USEDFPU (1<<TIF_USEDFPU) #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) #define _TIF_IA32 (1<<TIF_IA32) @@ -118,6 +117,15 @@ static inline struct thread_info *stack_thread_info(void) #define PREEMPT_ACTIVE 0x4000000 +/* + * Thread-synchronous status. + * + * This is different from the flags in that nobody else + * ever touches our thread-synchronous status, so we don't + * have to worry about atomic accesses. + */ +#define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */ + #endif /* __KERNEL__ */ #endif /* _ASM_THREAD_INFO_H */ diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h index 2c2d2e3fd5f8..7702073edc1c 100644 --- a/include/asm-x86_64/unistd.h +++ b/include/asm-x86_64/unistd.h @@ -520,8 +520,10 @@ __SYSCALL(__NR_clock_gettime, sys_clock_gettime) __SYSCALL(__NR_clock_getres, sys_clock_getres) #define __NR_clock_nanosleep 230 __SYSCALL(__NR_clock_nanosleep, sys_clock_nanosleep) +#define __NR_exit_group 231 +__SYSCALL(__NR_exit_group, sys_exit_group) -#define __NR_syscall_max __NR_clock_nanosleep +#define __NR_syscall_max __NR_exit_group #ifndef __NO_STUBS /* user-visible error numbers are in the range -1 - -4095 */ |
