Commit bfff273c authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] x86-64 fixes for gcc 3.5

From: Andi Kleen <ak@muc.de>

Fix all the x86-64 warnings with gcc 3.5 and make it compile again.
parent 7767803d
...@@ -274,13 +274,16 @@ sys32_rt_sigaction(int sig, struct sigaction32 *act, ...@@ -274,13 +274,16 @@ sys32_rt_sigaction(int sig, struct sigaction32 *act,
return -EINVAL; return -EINVAL;
if (act) { if (act) {
compat_uptr_t handler, restorer;
if (verify_area(VERIFY_READ, act, sizeof(*act)) || if (verify_area(VERIFY_READ, act, sizeof(*act)) ||
__get_user((long)new_ka.sa.sa_handler, &act->sa_handler) || __get_user(handler, &act->sa_handler) ||
__get_user(new_ka.sa.sa_flags, &act->sa_flags) || __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
__get_user((long)new_ka.sa.sa_restorer, &act->sa_restorer)|| __get_user(restorer, &act->sa_restorer)||
__copy_from_user(&set32, &act->sa_mask, sizeof(compat_sigset_t))) __copy_from_user(&set32, &act->sa_mask, sizeof(compat_sigset_t)))
return -EFAULT; return -EFAULT;
new_ka.sa.sa_handler = compat_ptr(handler);
new_ka.sa.sa_restorer = compat_ptr(restorer);
/* FIXME: here we rely on _COMPAT_NSIG_WORS to be >= than _NSIG_WORDS << 1 */ /* FIXME: here we rely on _COMPAT_NSIG_WORS to be >= than _NSIG_WORDS << 1 */
switch (_NSIG_WORDS) { switch (_NSIG_WORDS) {
case 4: new_ka.sa.sa_mask.sig[3] = set32.sig[6] case 4: new_ka.sa.sa_mask.sig[3] = set32.sig[6]
...@@ -331,13 +334,18 @@ sys32_sigaction (int sig, struct old_sigaction32 *act, struct old_sigaction32 *o ...@@ -331,13 +334,18 @@ sys32_sigaction (int sig, struct old_sigaction32 *act, struct old_sigaction32 *o
if (act) { if (act) {
compat_old_sigset_t mask; compat_old_sigset_t mask;
compat_uptr_t handler, restorer;
if (verify_area(VERIFY_READ, act, sizeof(*act)) || if (verify_area(VERIFY_READ, act, sizeof(*act)) ||
__get_user((long)new_ka.sa.sa_handler, &act->sa_handler) || __get_user(handler, &act->sa_handler) ||
__get_user(new_ka.sa.sa_flags, &act->sa_flags) || __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
__get_user((long)new_ka.sa.sa_restorer, &act->sa_restorer) || __get_user(restorer, &act->sa_restorer) ||
__get_user(mask, &act->sa_mask)) __get_user(mask, &act->sa_mask))
return -EFAULT; return -EFAULT;
new_ka.sa.sa_handler = compat_ptr(handler);
new_ka.sa.sa_restorer = compat_ptr(restorer);
siginitset(&new_ka.sa.sa_mask, mask); siginitset(&new_ka.sa.sa_mask, mask);
} }
...@@ -525,7 +533,7 @@ filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino, ...@@ -525,7 +533,7 @@ filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino,
put_user(reclen, &dirent->d_reclen); put_user(reclen, &dirent->d_reclen);
copy_to_user(dirent->d_name, name, namlen); copy_to_user(dirent->d_name, name, namlen);
put_user(0, dirent->d_name + namlen); put_user(0, dirent->d_name + namlen);
((char *) dirent) += reclen; dirent = ((void *)dirent) + reclen;
buf->current_dir = dirent; buf->current_dir = dirent;
buf->count -= reclen; buf->count -= reclen;
return 0; return 0;
......
...@@ -87,13 +87,15 @@ static int __init aperture_valid(char *name, u64 aper_base, u32 aper_size) ...@@ -87,13 +87,15 @@ static int __init aperture_valid(char *name, u64 aper_base, u32 aper_size)
/* Find a PCI capability */ /* Find a PCI capability */
static __u32 __init find_cap(int num, int slot, int func, int cap) static __u32 __init find_cap(int num, int slot, int func, int cap)
{ {
u8 pos;
int bytes;
if (!(read_pci_config_16(num,slot,func,PCI_STATUS) & PCI_STATUS_CAP_LIST)) if (!(read_pci_config_16(num,slot,func,PCI_STATUS) & PCI_STATUS_CAP_LIST))
return 0; return 0;
u8 pos = read_pci_config_byte(num,slot,func,PCI_CAPABILITY_LIST); pos = read_pci_config_byte(num,slot,func,PCI_CAPABILITY_LIST);
int bytes;
for (bytes = 0; bytes < 48 && pos >= 0x40; bytes++) { for (bytes = 0; bytes < 48 && pos >= 0x40; bytes++) {
u8 id;
pos &= ~3; pos &= ~3;
u8 id = read_pci_config_byte(num,slot,func,pos+PCI_CAP_LIST_ID); id = read_pci_config_byte(num,slot,func,pos+PCI_CAP_LIST_ID);
if (id == 0xff) if (id == 0xff)
break; break;
if (id == cap) if (id == cap)
...@@ -106,26 +108,31 @@ static __u32 __init find_cap(int num, int slot, int func, int cap) ...@@ -106,26 +108,31 @@ static __u32 __init find_cap(int num, int slot, int func, int cap)
/* Read a standard AGPv3 bridge header */ /* Read a standard AGPv3 bridge header */
static __u32 __init read_agp(int num, int slot, int func, int cap, u32 *order) static __u32 __init read_agp(int num, int slot, int func, int cap, u32 *order)
{ {
printk("AGP bridge at %02x:%02x:%02x\n", num, slot, func); u32 apsize;
u32 apsizereg = read_pci_config_16(num,slot,func, cap + 0x14); u32 apsizereg;
int nbits;
u32 aper_low, aper_hi;
u64 aper;
printk("AGP bridge at %02x:%02x:%02x\n", num, slot, func);
apsizereg = read_pci_config_16(num,slot,func, cap + 0x14);
if (apsizereg == 0xffffffff) { if (apsizereg == 0xffffffff) {
printk("APSIZE in AGP bridge unreadable\n"); printk("APSIZE in AGP bridge unreadable\n");
return 0; return 0;
} }
u32 apsize = apsizereg & 0xfff; apsize = apsizereg & 0xfff;
/* Some BIOS use weird encodings not in the AGPv3 table. */ /* Some BIOS use weird encodings not in the AGPv3 table. */
if (apsize & 0xff) if (apsize & 0xff)
apsize |= 0xf00; apsize |= 0xf00;
int nbits = hweight16(apsize); nbits = hweight16(apsize);
*order = 7 - nbits; *order = 7 - nbits;
if ((int)*order < 0) /* < 32MB */ if ((int)*order < 0) /* < 32MB */
*order = 0; *order = 0;
u32 aper_low = read_pci_config(num,slot,func, 0x10); aper_low = read_pci_config(num,slot,func, 0x10);
u32 aper_hi = read_pci_config(num,slot,func,0x14); aper_hi = read_pci_config(num,slot,func,0x14);
u64 aper = (aper_low & ~((1<<22)-1)) | ((u64)aper_hi << 32); aper = (aper_low & ~((1<<22)-1)) | ((u64)aper_hi << 32);
printk("Aperture from AGP @ %Lx size %u MB (APSIZE %x)\n", printk("Aperture from AGP @ %Lx size %u MB (APSIZE %x)\n",
aper, 32 << *order, apsizereg); aper, 32 << *order, apsizereg);
...@@ -155,6 +162,7 @@ static __u32 __init search_agp_bridge(u32 *order, int *valid_agp) ...@@ -155,6 +162,7 @@ static __u32 __init search_agp_bridge(u32 *order, int *valid_agp)
for (slot = 0; slot < 32; slot++) { for (slot = 0; slot < 32; slot++) {
for (func = 0; func < 8; func++) { for (func = 0; func < 8; func++) {
u32 class, cap; u32 class, cap;
u8 type;
class = read_pci_config(num,slot,func, class = read_pci_config(num,slot,func,
PCI_CLASS_REVISION); PCI_CLASS_REVISION);
if (class == 0xffffffff) if (class == 0xffffffff)
...@@ -172,7 +180,7 @@ static __u32 __init search_agp_bridge(u32 *order, int *valid_agp) ...@@ -172,7 +180,7 @@ static __u32 __init search_agp_bridge(u32 *order, int *valid_agp)
} }
/* No multi-function device? */ /* No multi-function device? */
u8 type = read_pci_config_byte(num,slot,func, type = read_pci_config_byte(num,slot,func,
PCI_HEADER_TYPE); PCI_HEADER_TYPE);
if (!(type & 0x80)) if (!(type & 0x80))
break; break;
......
...@@ -311,11 +311,11 @@ void touch_nmi_watchdog (void) ...@@ -311,11 +311,11 @@ void touch_nmi_watchdog (void)
void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason) void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason)
{ {
int sum, cpu = safe_smp_processor_id();
if (nmi_watchdog_disabled) if (nmi_watchdog_disabled)
return; return;
int sum, cpu = safe_smp_processor_id();
sum = read_pda(apic_timer_irqs); sum = read_pda(apic_timer_irqs);
if (last_irq_sums[cpu] == sum) { if (last_irq_sums[cpu] == sum) {
/* /*
......
...@@ -117,11 +117,11 @@ static unsigned long alloc_iommu(int size) ...@@ -117,11 +117,11 @@ static unsigned long alloc_iommu(int size)
static void free_iommu(unsigned long offset, int size) static void free_iommu(unsigned long offset, int size)
{ {
unsigned long flags;
if (size == 1) { if (size == 1) {
clear_bit(offset, iommu_gart_bitmap); clear_bit(offset, iommu_gart_bitmap);
return; return;
} }
unsigned long flags;
spin_lock_irqsave(&iommu_bitmap_lock, flags); spin_lock_irqsave(&iommu_bitmap_lock, flags);
__clear_bit_string(iommu_gart_bitmap, offset, size); __clear_bit_string(iommu_gart_bitmap, offset, size);
spin_unlock_irqrestore(&iommu_bitmap_lock, flags); spin_unlock_irqrestore(&iommu_bitmap_lock, flags);
...@@ -329,6 +329,7 @@ static dma_addr_t pci_map_area(struct pci_dev *dev, unsigned long phys_mem, ...@@ -329,6 +329,7 @@ static dma_addr_t pci_map_area(struct pci_dev *dev, unsigned long phys_mem,
{ {
unsigned long npages = to_pages(phys_mem, size); unsigned long npages = to_pages(phys_mem, size);
unsigned long iommu_page = alloc_iommu(npages); unsigned long iommu_page = alloc_iommu(npages);
int i;
if (iommu_page == -1) { if (iommu_page == -1) {
if (!nonforced_iommu(dev, phys_mem, size)) if (!nonforced_iommu(dev, phys_mem, size))
return phys_mem; return phys_mem;
...@@ -338,7 +339,6 @@ static dma_addr_t pci_map_area(struct pci_dev *dev, unsigned long phys_mem, ...@@ -338,7 +339,6 @@ static dma_addr_t pci_map_area(struct pci_dev *dev, unsigned long phys_mem,
return bad_dma_address; return bad_dma_address;
} }
int i;
for (i = 0; i < npages; i++) { for (i = 0; i < npages; i++) {
iommu_gatt_base[iommu_page + i] = GPTE_ENCODE(phys_mem); iommu_gatt_base[iommu_page + i] = GPTE_ENCODE(phys_mem);
SET_LEAK(iommu_page + i); SET_LEAK(iommu_page + i);
...@@ -398,11 +398,11 @@ static int __pci_map_cont(struct scatterlist *sg, int start, int stopat, ...@@ -398,11 +398,11 @@ static int __pci_map_cont(struct scatterlist *sg, int start, int stopat,
struct scatterlist *sout, unsigned long pages) struct scatterlist *sout, unsigned long pages)
{ {
unsigned long iommu_start = alloc_iommu(pages); unsigned long iommu_start = alloc_iommu(pages);
if (iommu_start == -1)
return -1;
unsigned long iommu_page = iommu_start; unsigned long iommu_page = iommu_start;
int i; int i;
if (iommu_start == -1)
return -1;
for (i = start; i < stopat; i++) { for (i = start; i < stopat; i++) {
struct scatterlist *s = &sg[i]; struct scatterlist *s = &sg[i];
...@@ -519,12 +519,12 @@ void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, ...@@ -519,12 +519,12 @@ void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
{ {
unsigned long iommu_page; unsigned long iommu_page;
int npages; int npages;
int i;
if (dma_addr < iommu_bus_base + EMERGENCY_PAGES*PAGE_SIZE || if (dma_addr < iommu_bus_base + EMERGENCY_PAGES*PAGE_SIZE ||
dma_addr > iommu_bus_base + iommu_size) dma_addr > iommu_bus_base + iommu_size)
return; return;
iommu_page = (dma_addr - iommu_bus_base)>>PAGE_SHIFT; iommu_page = (dma_addr - iommu_bus_base)>>PAGE_SHIFT;
npages = to_pages(dma_addr, size); npages = to_pages(dma_addr, size);
int i;
for (i = 0; i < npages; i++) { for (i = 0; i < npages; i++) {
iommu_gatt_base[iommu_page + i] = 0; iommu_gatt_base[iommu_page + i] = 0;
CLEAR_LEAK(iommu_page + i); CLEAR_LEAK(iommu_page + i);
......
...@@ -122,4 +122,4 @@ loop: ...@@ -122,4 +122,4 @@ loop:
.quad 0 .quad 0
loop2: loop2:
.quad 0 .quad 0
.previous .previous
\ No newline at end of file
...@@ -56,6 +56,8 @@ static __force_inline unsigned do_csum(const unsigned char *buff, unsigned len) ...@@ -56,6 +56,8 @@ static __force_inline unsigned do_csum(const unsigned char *buff, unsigned len)
} }
count >>= 1; /* nr of 32-bit words.. */ count >>= 1; /* nr of 32-bit words.. */
if (count) { if (count) {
unsigned long zero;
unsigned count64;
if (4 & (unsigned long) buff) { if (4 & (unsigned long) buff) {
result += *(unsigned int *) buff; result += *(unsigned int *) buff;
count--; count--;
...@@ -65,8 +67,8 @@ static __force_inline unsigned do_csum(const unsigned char *buff, unsigned len) ...@@ -65,8 +67,8 @@ static __force_inline unsigned do_csum(const unsigned char *buff, unsigned len)
count >>= 1; /* nr of 64-bit words.. */ count >>= 1; /* nr of 64-bit words.. */
/* main loop using 64byte blocks */ /* main loop using 64byte blocks */
unsigned long zero = 0; zero = 0;
unsigned count64 = count >> 3; count64 = count >> 3;
while (count64) { while (count64) {
asm("addq 0*8(%[src]),%[res]\n\t" asm("addq 0*8(%[src]),%[res]\n\t"
"adcq 1*8(%[src]),%[res]\n\t" "adcq 1*8(%[src]),%[res]\n\t"
......
...@@ -142,6 +142,10 @@ static int bad_address(void *p) ...@@ -142,6 +142,10 @@ static int bad_address(void *p)
void dump_pagetable(unsigned long address) void dump_pagetable(unsigned long address)
{ {
pml4_t *pml4; pml4_t *pml4;
pgd_t *pgd;
pmd_t *pmd;
pte_t *pte;
asm("movq %%cr3,%0" : "=r" (pml4)); asm("movq %%cr3,%0" : "=r" (pml4));
pml4 = __va((unsigned long)pml4 & PHYSICAL_PAGE_MASK); pml4 = __va((unsigned long)pml4 & PHYSICAL_PAGE_MASK);
...@@ -150,17 +154,17 @@ void dump_pagetable(unsigned long address) ...@@ -150,17 +154,17 @@ void dump_pagetable(unsigned long address)
if (bad_address(pml4)) goto bad; if (bad_address(pml4)) goto bad;
if (!pml4_present(*pml4)) goto ret; if (!pml4_present(*pml4)) goto ret;
pgd_t *pgd = __pgd_offset_k((pgd_t *)pml4_page(*pml4), address); pgd = __pgd_offset_k((pgd_t *)pml4_page(*pml4), address);
if (bad_address(pgd)) goto bad; if (bad_address(pgd)) goto bad;
printk("PGD %lx ", pgd_val(*pgd)); printk("PGD %lx ", pgd_val(*pgd));
if (!pgd_present(*pgd)) goto ret; if (!pgd_present(*pgd)) goto ret;
pmd_t *pmd = pmd_offset(pgd, address); pmd = pmd_offset(pgd, address);
if (bad_address(pmd)) goto bad; if (bad_address(pmd)) goto bad;
printk("PMD %lx ", pmd_val(*pmd)); printk("PMD %lx ", pmd_val(*pmd));
if (!pmd_present(*pmd)) goto ret; if (!pmd_present(*pmd)) goto ret;
pte_t *pte = pte_offset_kernel(pmd, address); pte = pte_offset_kernel(pmd, address);
if (bad_address(pte)) goto bad; if (bad_address(pte)) goto bad;
printk("PTE %lx", pte_val(*pte)); printk("PTE %lx", pte_val(*pte));
ret: ret:
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#define Dprintk(x...) #define Dprintk(x...)
extern char _stext; extern char _stext[];
DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
...@@ -80,7 +80,7 @@ void show_mem(void) ...@@ -80,7 +80,7 @@ void show_mem(void)
/* References to section boundaries */ /* References to section boundaries */
extern char _text, _etext, _edata, __bss_start, _end; extern char _text, _etext, _edata, __bss_start, _end[];
extern char __init_begin, __init_end; extern char __init_begin, __init_end;
int after_bootmem; int after_bootmem;
...@@ -442,7 +442,7 @@ void __init mem_init(void) ...@@ -442,7 +442,7 @@ void __init mem_init(void)
kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT); kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT);
kclist_add(&kcore_vmalloc, (void *)VMALLOC_START, kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
VMALLOC_END-VMALLOC_START); VMALLOC_END-VMALLOC_START);
kclist_add(&kcore_kernel, &_stext, &_end - &_stext); kclist_add(&kcore_kernel, &_stext, _end - _stext);
kclist_add(&kcore_modules, (void *)MODULES_VADDR, MODULES_LEN); kclist_add(&kcore_modules, (void *)MODULES_VADDR, MODULES_LEN);
kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START, kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START,
VSYSCALL_END - VSYSCALL_START); VSYSCALL_END - VSYSCALL_START);
......
...@@ -79,7 +79,7 @@ extern void disable_lapic_nmi_watchdog(void); ...@@ -79,7 +79,7 @@ extern void disable_lapic_nmi_watchdog(void);
extern void enable_lapic_nmi_watchdog(void); extern void enable_lapic_nmi_watchdog(void);
extern void disable_timer_nmi_watchdog(void); extern void disable_timer_nmi_watchdog(void);
extern void enable_timer_nmi_watchdog(void); extern void enable_timer_nmi_watchdog(void);
extern inline void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason); extern void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason);
extern int APIC_init_uniprocessor (void); extern int APIC_init_uniprocessor (void);
extern void disable_APIC_timer(void); extern void disable_APIC_timer(void);
extern void enable_APIC_timer(void); extern void enable_APIC_timer(void);
......
...@@ -77,7 +77,7 @@ struct hw_interrupt_type; ...@@ -77,7 +77,7 @@ struct hw_interrupt_type;
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
extern u8 irq_vector[NR_IRQ_VECTORS]; extern u8 irq_vector[NR_IRQ_VECTORS];
#define IO_APIC_VECTOR(irq) ((int)irq_vector[irq]) #define IO_APIC_VECTOR(irq) (irq_vector[irq])
/* /*
* Various low-level irq details needed by irq.c, process.c, * Various low-level irq details needed by irq.c, process.c,
...@@ -132,7 +132,7 @@ static inline void x86_do_profile (struct pt_regs *regs) ...@@ -132,7 +132,7 @@ static inline void x86_do_profile (struct pt_regs *regs)
{ {
unsigned long rip; unsigned long rip;
extern unsigned long prof_cpu_mask; extern unsigned long prof_cpu_mask;
extern char _stext; extern char _stext[];
profile_hook(regs); profile_hook(regs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment