diff options
Diffstat (limited to 'include/asm-sh')
-rw-r--r-- | include/asm-sh/atomic.h | 25 | ||||
-rw-r--r-- | include/asm-sh/bitops.h | 34 | ||||
-rw-r--r-- | include/asm-sh/checksum.h | 12 | ||||
-rw-r--r-- | include/asm-sh/delay.h | 3 | ||||
-rw-r--r-- | include/asm-sh/fcntl.h | 21 | ||||
-rw-r--r-- | include/asm-sh/ide.h | 3 | ||||
-rw-r--r-- | include/asm-sh/io_hd64461.h | 4 | ||||
-rw-r--r-- | include/asm-sh/irq.h | 3 | ||||
-rw-r--r-- | include/asm-sh/page.h | 10 | ||||
-rw-r--r-- | include/asm-sh/pci.h | 16 | ||||
-rw-r--r-- | include/asm-sh/pgtable.h | 62 | ||||
-rw-r--r-- | include/asm-sh/resource.h | 4 | ||||
-rw-r--r-- | include/asm-sh/string.h | 13 | ||||
-rw-r--r-- | include/asm-sh/system.h | 33 | ||||
-rw-r--r-- | include/asm-sh/uaccess.h | 62 | ||||
-rw-r--r-- | include/asm-sh/unistd.h | 44 |
16 files changed, 185 insertions, 164 deletions
diff --git a/include/asm-sh/atomic.h b/include/asm-sh/atomic.h index e46fdc7bc..6fe7d5194 100644 --- a/include/asm-sh/atomic.h +++ b/include/asm-sh/atomic.h @@ -7,13 +7,7 @@ * */ -#include <linux/config.h> - -#ifdef CONFIG_SMP typedef struct { volatile int counter; } atomic_t; -#else -typedef struct { int counter; } atomic_t; -#endif #define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) @@ -23,19 +17,12 @@ typedef struct { int counter; } atomic_t; #include <asm/system.h> /* - * Make sure gcc doesn't try to be clever and move things around - * on us. We need to use _exactly_ the address the user gave us, - * not some alias that contains the same information. - */ -#define __atomic_fool_gcc(x) (*(volatile struct { int a[100]; } *)x) - -/* * To get proper branch prediction for the main line, we must branch * forward to code at the end of this object's .text section, then * branch back to restart the operation. */ -extern __inline__ void atomic_add(int i, atomic_t * v) +static __inline__ void atomic_add(int i, atomic_t * v) { unsigned long flags; @@ -44,7 +31,7 @@ extern __inline__ void atomic_add(int i, atomic_t * v) restore_flags(flags); } -extern __inline__ void atomic_sub(int i, atomic_t *v) +static __inline__ void atomic_sub(int i, atomic_t *v) { unsigned long flags; @@ -53,7 +40,7 @@ extern __inline__ void atomic_sub(int i, atomic_t *v) restore_flags(flags); } -extern __inline__ int atomic_add_return(int i, atomic_t * v) +static __inline__ int atomic_add_return(int i, atomic_t * v) { unsigned long temp, flags; @@ -66,7 +53,7 @@ extern __inline__ int atomic_add_return(int i, atomic_t * v) return temp; } -extern __inline__ int atomic_sub_return(int i, atomic_t * v) +static __inline__ int atomic_sub_return(int i, atomic_t * v) { unsigned long temp, flags; @@ -88,7 +75,7 @@ extern __inline__ int atomic_sub_return(int i, atomic_t * v) #define atomic_inc(v) atomic_add(1,(v)) #define atomic_dec(v) atomic_sub(1,(v)) -extern __inline__ void atomic_clear_mask(unsigned int mask, atomic_t *v) +static __inline__ void atomic_clear_mask(unsigned int mask, atomic_t *v) { unsigned long flags; @@ -97,7 +84,7 @@ extern __inline__ void atomic_clear_mask(unsigned int mask, atomic_t *v) restore_flags(flags); } -extern __inline__ void atomic_set_mask(unsigned int mask, atomic_t *v) +static __inline__ void atomic_set_mask(unsigned int mask, atomic_t *v) { unsigned long flags; diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h index fde5f2121..d74bd4fbf 100644 --- a/include/asm-sh/bitops.h +++ b/include/asm-sh/bitops.h @@ -6,7 +6,7 @@ /* For __swab32 */ #include <asm/byteorder.h> -extern __inline__ void set_bit(int nr, volatile void * addr) +static __inline__ void set_bit(int nr, volatile void * addr) { int mask; volatile unsigned int *a = addr; @@ -19,7 +19,12 @@ extern __inline__ void set_bit(int nr, volatile void * addr) restore_flags(flags); } -extern __inline__ void clear_bit(int nr, volatile void * addr) +/* + * clear_bit() doesn't provide any barrier for the compiler. + */ +#define smp_mb__before_clear_bit() barrier() +#define smp_mb__after_clear_bit() barrier() +static __inline__ void clear_bit(int nr, volatile void * addr) { int mask; volatile unsigned int *a = addr; @@ -32,7 +37,7 @@ extern __inline__ void clear_bit(int nr, volatile void * addr) restore_flags(flags); } -extern __inline__ void change_bit(int nr, volatile void * addr) +static __inline__ void change_bit(int nr, volatile void * addr) { int mask; volatile unsigned int *a = addr; @@ -45,7 +50,7 @@ extern __inline__ void change_bit(int nr, volatile void * addr) restore_flags(flags); } -extern __inline__ int test_and_set_bit(int nr, volatile void * addr) +static __inline__ int test_and_set_bit(int nr, volatile void * addr) { int mask, retval; volatile unsigned int *a = addr; @@ -61,7 +66,7 @@ extern __inline__ int test_and_set_bit(int nr, volatile void * addr) return retval; } -extern __inline__ int test_and_clear_bit(int nr, volatile void * addr) +static __inline__ int test_and_clear_bit(int nr, volatile void * addr) { int mask, retval; volatile unsigned int *a = addr; @@ -77,7 +82,7 @@ extern __inline__ int test_and_clear_bit(int nr, volatile void * addr) return retval; } -extern __inline__ int test_and_change_bit(int nr, volatile void * addr) +static __inline__ int test_and_change_bit(int nr, volatile void * addr) { int mask, retval; volatile unsigned int *a = addr; @@ -94,12 +99,12 @@ extern __inline__ int test_and_change_bit(int nr, volatile void * addr) } -extern __inline__ int test_bit(int nr, const volatile void *addr) +static __inline__ int test_bit(int nr, const volatile void *addr) { return 1UL & (((const volatile unsigned int *) addr)[nr >> 5] >> (nr & 31)); } -extern __inline__ unsigned long ffz(unsigned long word) +static __inline__ unsigned long ffz(unsigned long word) { unsigned long result; @@ -108,11 +113,12 @@ extern __inline__ unsigned long ffz(unsigned long word) "bt/s 1b\n\t" " add #1, %0" : "=r" (result), "=r" (word) - : "0" (~0L), "1" (word)); + : "0" (~0L), "1" (word) + : "t"); return result; } -extern __inline__ int find_next_zero_bit(void *addr, int size, int offset) +static __inline__ int find_next_zero_bit(void *addr, int size, int offset) { unsigned long *p = ((unsigned long *) addr) + (offset >> 5); unsigned long result = offset & ~31UL; @@ -159,7 +165,7 @@ found_middle: #define ext2_find_next_zero_bit(addr, size, offset) \ find_next_zero_bit((addr), (size), (offset)) #else -extern __inline__ int ext2_set_bit(int nr, volatile void * addr) +static __inline__ int ext2_set_bit(int nr, volatile void * addr) { int mask, retval; unsigned long flags; @@ -174,7 +180,7 @@ extern __inline__ int ext2_set_bit(int nr, volatile void * addr) return retval; } -extern __inline__ int ext2_clear_bit(int nr, volatile void * addr) +static __inline__ int ext2_clear_bit(int nr, volatile void * addr) { int mask, retval; unsigned long flags; @@ -189,7 +195,7 @@ extern __inline__ int ext2_clear_bit(int nr, volatile void * addr) return retval; } -extern __inline__ int ext2_test_bit(int nr, const volatile void * addr) +static __inline__ int ext2_test_bit(int nr, const volatile void * addr) { int mask; const volatile unsigned char *ADDR = (const unsigned char *) addr; @@ -202,7 +208,7 @@ extern __inline__ int ext2_test_bit(int nr, const volatile void * addr) #define ext2_find_first_zero_bit(addr, size) \ ext2_find_next_zero_bit((addr), (size), 0) -extern __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset) +static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset) { unsigned long *p = ((unsigned long *) addr) + (offset >> 5); unsigned long result = offset & ~31UL; diff --git a/include/asm-sh/checksum.h b/include/asm-sh/checksum.h index 05a556fc7..7e9418b3b 100644 --- a/include/asm-sh/checksum.h +++ b/include/asm-sh/checksum.h @@ -82,7 +82,8 @@ static __inline__ unsigned int csum_fold(unsigned int sum) "add %1, %0\n\t" "not %0, %0\n\t" : "=r" (sum), "=&r" (__dummy) - : "0" (sum)); + : "0" (sum) + : "t"); return sum; } @@ -115,7 +116,8 @@ static __inline__ unsigned short ip_fast_csum(unsigned char * iph, unsigned int are modified, we must also specify them as outputs, or gcc will assume they contain their original values. */ : "=r" (sum), "=r" (iph), "=r" (ihl), "=&r" (__dummy0), "=&z" (__dummy1) - : "1" (iph), "2" (ihl)); + : "1" (iph), "2" (ihl) + : "t"); return csum_fold(sum); } @@ -138,7 +140,8 @@ static __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr, "movt %0\n\t" "add %1, %0" : "=r" (sum), "=r" (len_proto) - : "r" (daddr), "r" (saddr), "1" (len_proto), "0" (sum)); + : "r" (daddr), "r" (saddr), "1" (len_proto), "0" (sum) + : "t"); return sum; } @@ -197,7 +200,8 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, "add %1, %0\n" : "=r" (sum), "=&r" (__dummy) : "r" (saddr), "r" (daddr), - "r" (htonl(len)), "r" (htonl(proto)), "0" (sum)); + "r" (htonl(len)), "r" (htonl(proto)), "0" (sum) + : "t"); return csum_fold(sum); } diff --git a/include/asm-sh/delay.h b/include/asm-sh/delay.h index 7495d31c8..38e5a48c0 100644 --- a/include/asm-sh/delay.h +++ b/include/asm-sh/delay.h @@ -15,7 +15,8 @@ extern __inline__ void __delay(unsigned long loops) "bf/s 1b\n\t" " dt %0" : "=r" (loops) - : "0" (loops)); + : "0" (loops) + : "t"); } extern __inline__ void __udelay(unsigned long usecs, unsigned long lps) diff --git a/include/asm-sh/fcntl.h b/include/asm-sh/fcntl.h index 7e8345ff6..21e39b7cc 100644 --- a/include/asm-sh/fcntl.h +++ b/include/asm-sh/fcntl.h @@ -35,6 +35,10 @@ #define F_SETSIG 10 /* for sockets. */ #define F_GETSIG 11 /* for sockets. */ +#define F_GETLK64 12 /* using 'struct flock64' */ +#define F_SETLK64 13 +#define F_SETLKW64 14 + /* for F_[GET|SET]FL */ #define FD_CLOEXEC 1 /* actually anything with low bit set goes */ @@ -47,6 +51,9 @@ #define F_EXLCK 4 /* or 3 */ #define F_SHLCK 8 /* or 4 */ +/* for leases */ +#define F_INPROGRESS 16 + /* operations for bsd flock(), also used by the kernel implementation */ #define LOCK_SH 1 /* shared lock */ #define LOCK_EX 2 /* exclusive lock */ @@ -54,6 +61,11 @@ blocking */ #define LOCK_UN 8 /* remove lock */ +#define LOCK_MAND 32 /* This is a mandatory flock */ +#define LOCK_READ 64 /* ... Which allows concurrent read operations */ +#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */ +#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */ + struct flock { short l_type; short l_whence; @@ -62,5 +74,14 @@ struct flock { pid_t l_pid; }; +struct flock64 { + short l_type; + short l_whence; + loff_t l_start; + loff_t l_len; + pid_t l_pid; +}; + +#define F_LINUX_SPECIFIC_BASE 1024 #endif /* __ASM_SH_FCNTL_H */ diff --git a/include/asm-sh/ide.h b/include/asm-sh/ide.h index 25570cea2..db9df9256 100644 --- a/include/asm-sh/ide.h +++ b/include/asm-sh/ide.h @@ -18,7 +18,8 @@ #include <asm/machvec.h> #ifndef MAX_HWIFS -#define MAX_HWIFS 1 +/* Should never have less than 2, ide-pci.c(ide_match_hwif) requires it */ +#define MAX_HWIFS 2 #endif #define ide__sti() __sti() diff --git a/include/asm-sh/io_hd64461.h b/include/asm-sh/io_hd64461.h index 2574a39ab..ab7a8a506 100644 --- a/include/asm-sh/io_hd64461.h +++ b/include/asm-sh/io_hd64461.h @@ -62,6 +62,10 @@ extern void hd64461_outsl(unsigned int port, const void *addr, unsigned long cou # define __writew generic_writew # define __writel generic_writel +# define __isa_port2addr generic_isa_port2addr +# define __ioremap generic_ioremap +# define __iounmap generic_iounmap + #endif #endif /* _ASM_SH_IO_HD64461_H */ diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h index 48016e3f9..28d25be33 100644 --- a/include/asm-sh/irq.h +++ b/include/asm-sh/irq.h @@ -42,6 +42,7 @@ #if defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709) #define SCIF_ERI_IRQ 56 #define SCIF_RXI_IRQ 57 +#define SCIF_BRI_IRQ 58 #define SCIF_TXI_IRQ 59 #define SCIF_IPR_ADDR INTC_IPRE #define SCIF_IPR_POS 1 @@ -49,6 +50,7 @@ #define IRDA_ERI_IRQ 52 #define IRDA_RXI_IRQ 53 +#define IRDA_BRI_IRQ 54 #define IRDA_TXI_IRQ 55 #define IRDA_IPR_ADDR INTC_IPRE #define IRDA_IPR_POS 2 @@ -56,6 +58,7 @@ #elif defined(CONFIG_CPU_SUBTYPE_SH7750) #define SCIF_ERI_IRQ 40 #define SCIF_RXI_IRQ 41 +#define SCIF_BRI_IRQ 42 #define SCIF_TXI_IRQ 43 #define SCIF_IPR_ADDR INTC_IPRC #define SCIF_IPR_POS 1 diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h index dcac85fa6..aa406533f 100644 --- a/include/asm-sh/page.h +++ b/include/asm-sh/page.h @@ -9,7 +9,7 @@ [ P0/U0 (virtual) ] 0x00000000 <------ User space [ P1 (fixed) cached ] 0x80000000 <------ Kernel space [ P2 (fixed) non-cachable] 0xA0000000 <------ Physical access - [ P3 (virtual) cached] 0xC0000000 <------ not used + [ P3 (virtual) cached] 0xC0000000 <------ vmalloced area [ P4 control ] 0xE0000000 */ @@ -26,8 +26,14 @@ #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) #define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE) + +#if defined(__sh3__) #define clear_user_page(page, vaddr) clear_page(page) #define copy_user_page(to, from, vaddr) copy_page(to, from) +#elif defined(__SH4__) +extern void clear_user_page(void *to, unsigned long address); +extern void copy_user_page(void *to, void *from, unsigned long address); +#endif /* * These are used to make use of C type-checking.. @@ -62,7 +68,7 @@ typedef struct { unsigned long pgprot; } pgprot_t; #define __MEMORY_START CONFIG_MEMORY_START -#define PAGE_OFFSET (0x80000000) +#define PAGE_OFFSET (0x80000000UL) #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) #define virt_to_page(kaddr) (mem_map + ((__pa(kaddr)-__MEMORY_START) >> PAGE_SHIFT)) diff --git a/include/asm-sh/pci.h b/include/asm-sh/pci.h index 2c3ce9038..9c53169f6 100644 --- a/include/asm-sh/pci.h +++ b/include/asm-sh/pci.h @@ -18,12 +18,12 @@ #define PCIBIOS_MIN_MEM 0x10000000 #endif -extern inline void pcibios_set_master(struct pci_dev *dev) +static inline void pcibios_set_master(struct pci_dev *dev) { /* No special bus mastering setup handling */ } -extern inline void pcibios_penalize_isa_irq(int irq) +static inline void pcibios_penalize_isa_irq(int irq) { /* We don't do dynamic PCI IRQ allocation */ } @@ -67,7 +67,7 @@ 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 inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, +static inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size,int directoin) { return virt_to_bus(ptr); @@ -80,7 +80,7 @@ extern inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, * After this call, reads by the cpu to the buffer are guarenteed to see * whatever the device wrote there. */ -extern inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, +static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, size_t size,int direction) { /* Nothing to do */ @@ -101,7 +101,7 @@ extern inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, * Device ownership issues as mentioned above for pci_map_single are * the same here. */ -extern inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, +static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents,int direction) { return nents; @@ -111,7 +111,7 @@ extern inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, * Again, cpu read rules concerning calls here are the same as for * pci_unmap_single() above. */ -extern inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, +static inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents,int direction) { /* Nothing to do */ @@ -126,7 +126,7 @@ extern inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, * next point you give the PCI dma address back to the card, the * device again owns the buffer. */ -extern inline void pci_dma_sync_single(struct pci_dev *hwdev, +static inline void pci_dma_sync_single(struct pci_dev *hwdev, dma_addr_t dma_handle, size_t size,int direction) { @@ -139,7 +139,7 @@ extern inline void pci_dma_sync_single(struct pci_dev *hwdev, * The same as pci_dma_sync_single but for a scatter-gather list, * same rules and usage. */ -extern inline void pci_dma_sync_sg(struct pci_dev *hwdev, +static inline void pci_dma_sync_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nelems,int direction) { diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h index df3e8edf2..f84b7904a 100644 --- a/include/asm-sh/pgtable.h +++ b/include/asm-sh/pgtable.h @@ -92,45 +92,44 @@ extern unsigned long empty_zero_page[1024]; #define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END P4SEG -#define _PAGE_PRESENT 0x001 /* software: page is present */ -#define _PAGE_ACCESSED 0x002 /* software: page referenced */ +/* 0x001 WT-bit on SH-4, 0 on SH-3 */ +#define _PAGE_HW_SHARED 0x002 /* SH-bit : page is shared among processes */ #define _PAGE_DIRTY 0x004 /* D-bit : page changed */ #define _PAGE_CACHABLE 0x008 /* C-bit : cachable */ -/* 0x010 SZ-bit : size of page */ +/* 0x010 SZ0-bit : Size of page */ #define _PAGE_RW 0x020 /* PR0-bit : write access allowed */ #define _PAGE_USER 0x040 /* PR1-bit : user space access allowed */ -#define _PAGE_PROTNONE 0x080 /* software: if not present */ -/* 0x100 V-bit : page is valid */ -/* 0x200 can be used as software flag */ -/* 0x400 can be used as software flag */ -/* 0x800 can be used as software flag */ +/* 0x080 SZ1-bit : Size of page (on SH-4) */ +#define _PAGE_PRESENT 0x100 /* V-bit : page is valid */ +#define _PAGE_PROTNONE 0x200 /* software: if not present */ +#define _PAGE_ACCESSED 0x400 /* software: page referenced */ +#define _PAGE_U0_SHARED 0x800 /* software: page is shared in user space */ -#if defined(__sh3__) /* Mask which drop software flags */ -#define _PAGE_FLAGS_HARDWARE_MASK 0x1ffff06c -/* Flags defalult: SZ=1 (4k-byte), C=0 (non-cachable), SH=0 (not shared) */ -#define _PAGE_FLAGS_HARDWARE_DEFAULT 0x00000110 +#define _PAGE_FLAGS_HARDWARE_MASK 0x1ffff1ff +/* Hardware flags: SZ=1 (4k-byte) */ +#define _PAGE_FLAGS_HARD 0x00000010 + +#if defined(__sh3__) +#define _PAGE_SHARED _PAGE_HW_SHARED #elif defined(__SH4__) -/* Mask which drops software flags */ -#define _PAGE_FLAGS_HARDWARE_MASK 0x1ffff06c -/* Flags defalult: SZ=01 (4k-byte), C=0 (non-cachable), SH=0 (not shared), WT=0 */ -#define _PAGE_FLAGS_HARDWARE_DEFAULT 0x00000110 +#define _PAGE_SHARED _PAGE_U0_SHARED #endif #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) #define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) -#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_CACHABLE | _PAGE_DIRTY) +#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_CACHABLE | _PAGE_DIRTY | _PAGE_SHARED) -#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE |_PAGE_ACCESSED) -#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_CACHABLE |_PAGE_ACCESSED) -#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED) -#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED) -#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_CACHABLE | _PAGE_DIRTY | _PAGE_ACCESSED) -#define PAGE_KERNEL_RO __pgprot(_PAGE_PRESENT | _PAGE_CACHABLE | _PAGE_DIRTY | _PAGE_ACCESSED) +#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE |_PAGE_ACCESSED | _PAGE_FLAGS_HARD) +#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_CACHABLE |_PAGE_ACCESSED | _PAGE_SHARED | _PAGE_FLAGS_HARD) +#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD) +#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD) +#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_CACHABLE | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_HW_SHARED | _PAGE_FLAGS_HARD) +#define PAGE_KERNEL_RO __pgprot(_PAGE_PRESENT | _PAGE_CACHABLE | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_HW_SHARED | _PAGE_FLAGS_HARD) /* * As i386 and MIPS, SuperH can't do page protection for execute, and - * considers that the same are read. Also, write permissions imply + * considers that the same as a read. Also, write permissions imply * read permissions. This is the closest we can get.. */ @@ -184,6 +183,7 @@ extern inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; } extern inline int pte_dirty(pte_t pte){ return pte_val(pte) & _PAGE_DIRTY; } extern inline int pte_young(pte_t pte){ return pte_val(pte) & _PAGE_ACCESSED; } extern inline int pte_write(pte_t pte){ return pte_val(pte) & _PAGE_RW; } +extern inline int pte_shared(pte_t pte){ return pte_val(pte) & _PAGE_SHARED; } extern inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } extern inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } @@ -244,11 +244,15 @@ extern void update_mmu_cache(struct vm_area_struct * vma, unsigned long address, pte_t pte); /* Encode and de-code a swap entry */ -#define SWP_TYPE(x) (((x).val >> 1) & 0x3f) -#define SWP_OFFSET(x) ((x).val >> 8) -#define SWP_ENTRY(type, offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 8) }) -#define pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) -#define swp_entry_to_pte(x) ((pte_t) { (x).val }) +/* + * NOTE: We should set ZEROs at the position of _PAGE_PRESENT + * and _PAGE_PROTONOE bits + */ +#define SWP_TYPE(x) ((x).val & 0xff) +#define SWP_OFFSET(x) ((x).val >> 10) +#define SWP_ENTRY(type, offset) ((swp_entry_t) { (type) | ((offset) << 10) }) +#define pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) +#define swp_entry_to_pte(x) ((pte_t) { (x).val }) #define module_map vmalloc #define module_unmap vfree diff --git a/include/asm-sh/resource.h b/include/asm-sh/resource.h index 084ad61ec..574b64488 100644 --- a/include/asm-sh/resource.h +++ b/include/asm-sh/resource.h @@ -15,8 +15,9 @@ #define RLIMIT_NOFILE 7 /* max number of open files */ #define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */ #define RLIMIT_AS 9 /* address space limit */ +#define RLIMIT_LOCKS 10 /* maximum file locks held */ -#define RLIM_NLIMITS 10 +#define RLIM_NLIMITS 11 #ifdef __KERNEL__ @@ -38,6 +39,7 @@ { INR_OPEN, INR_OPEN }, \ { RLIM_INFINITY, RLIM_INFINITY }, \ { RLIM_INFINITY, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ } #endif /* __KERNEL__ */ diff --git a/include/asm-sh/string.h b/include/asm-sh/string.h index 3eab1c123..d85e4e406 100644 --- a/include/asm-sh/string.h +++ b/include/asm-sh/string.h @@ -20,7 +20,7 @@ extern __inline__ char *strcpy(char *__dest, const char *__src) " add #1, %0\n\t" : "=r" (__dest), "=r" (__src), "=&z" (__dummy) : "0" (__dest), "1" (__src) - : "memory"); + : "memory", "t"); return __xdest; } @@ -46,7 +46,7 @@ extern __inline__ char *strncpy(char *__dest, const char *__src, size_t __n) "2:" : "=r" (__dest), "=r" (__src), "=&z" (__dummy) : "0" (__dest), "1" (__src), "r" (__src+__n) - : "memory"); + : "memory", "t"); return __xdest; } @@ -71,7 +71,8 @@ extern __inline__ int strcmp(const char *__cs, const char *__ct) "sub %3, %2\n" "2:" : "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy) - : "0" (__cs), "1" (__ct)); + : "0" (__cs), "1" (__ct) + : "t"); return __res; } @@ -82,6 +83,9 @@ extern __inline__ int strncmp(const char *__cs, const char *__ct, size_t __n) register int __res; unsigned long __dummy; + if (__n == 0) + return 0; + __asm__ __volatile__( "mov.b @%1+, %3\n" "1:\n\t" @@ -99,7 +103,8 @@ extern __inline__ int strncmp(const char *__cs, const char *__ct, size_t __n) "sub %3, %2\n" "3:" :"=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy) - : "0" (__cs), "1" (__ct), "r" (__cs+__n)); + : "0" (__cs), "1" (__ct), "r" (__cs+__n) + : "t"); return __res; } diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h index c3ca3b467..86786c730 100644 --- a/include/asm-sh/system.h +++ b/include/asm-sh/system.h @@ -21,12 +21,12 @@ typedef struct { #define prepare_to_switch() do { } while(0) #define switch_to(prev,next,last) do { \ register struct task_struct *__last; \ - register unsigned long *__ts1 __asm__ ("$r1") = &prev->thread.sp; \ - register unsigned long *__ts2 __asm__ ("$r2") = &prev->thread.pc; \ - register unsigned long *__ts4 __asm__ ("$r4") = (unsigned long *)prev; \ - register unsigned long *__ts5 __asm__ ("$r5") = (unsigned long *)next; \ - register unsigned long *__ts6 __asm__ ("$r6") = &next->thread.sp; \ - register unsigned long __ts7 __asm__ ("$r7") = next->thread.pc; \ + register unsigned long *__ts1 __asm__ ("r1") = &prev->thread.sp; \ + register unsigned long *__ts2 __asm__ ("r2") = &prev->thread.pc; \ + register unsigned long *__ts4 __asm__ ("r4") = (unsigned long *)prev; \ + register unsigned long *__ts5 __asm__ ("r5") = (unsigned long *)next; \ + register unsigned long *__ts6 __asm__ ("r6") = &next->thread.sp; \ + register unsigned long __ts7 __asm__ ("r7") = next->thread.pc; \ __asm__ __volatile__ (".balign 4\n\t" \ "stc.l $gbr, @-$r15\n\t" \ "sts.l $pr, @-$r15\n\t" \ @@ -63,7 +63,7 @@ typedef struct { :"0" (prev), \ "r" (__ts1), "r" (__ts2), \ "r" (__ts4), "r" (__ts5), "r" (__ts6), "r" (__ts7) \ - :"r3"); \ + :"r3", "t"); \ last = __last; \ } while (0) #endif @@ -88,11 +88,22 @@ extern void __xchg_called_with_bad_pointer(void); #define mb() __asm__ __volatile__ ("": : :"memory") #define rmb() mb() #define wmb() __asm__ __volatile__ ("": : :"memory") + +#ifdef CONFIG_SMP +#define smp_mb() mb() +#define smp_rmb() rmb() +#define smp_wmb() wmb() +#else +#define smp_mb() barrier() +#define smp_rmb() barrier() +#define smp_wmb() barrier() +#endif + #define set_mb(var, value) do { xchg(&var, value); } while (0) #define set_wmb(var, value) do { var = value; wmb(); } while (0) /* Interrupt Control */ -extern __inline__ void __sti(void) +static __inline__ void __sti(void) { unsigned long __dummy0, __dummy1; @@ -106,7 +117,7 @@ extern __inline__ void __sti(void) : "memory"); } -extern __inline__ void __cli(void) +static __inline__ void __cli(void) { unsigned long __dummy; __asm__ __volatile__("stc $sr, %0\n\t" @@ -205,7 +216,7 @@ extern void __global_restore_flags(unsigned long); #endif -extern __inline__ unsigned long xchg_u32(volatile int * m, unsigned long val) +static __inline__ unsigned long xchg_u32(volatile int * m, unsigned long val) { unsigned long flags, retval; @@ -216,7 +227,7 @@ extern __inline__ unsigned long xchg_u32(volatile int * m, unsigned long val) return retval; } -extern __inline__ unsigned long xchg_u8(volatile unsigned char * m, unsigned long val) +static __inline__ unsigned long xchg_u8(volatile unsigned char * m, unsigned long val) { unsigned long flags, retval; diff --git a/include/asm-sh/uaccess.h b/include/asm-sh/uaccess.h index 2237d34a4..4fe09b005 100644 --- a/include/asm-sh/uaccess.h +++ b/include/asm-sh/uaccess.h @@ -45,11 +45,12 @@ * sum := addr + size; carry? --> flag = true; * if (sum >= addr_limit) flag = true; */ -#define __range_ok(addr,size) ({ \ - unsigned long flag,sum; \ - __asm__("clrt; addc %3, %1; movt %0; cmp/hi %4, %1; rotcl %0" \ - :"=&r" (flag), "=r" (sum) \ - :"1" (addr), "r" ((int)(size)), "r" (current->addr_limit.seg)); \ +#define __range_ok(addr,size) ({ \ + unsigned long flag,sum; \ + __asm__("clrt; addc %3, %1; movt %0; cmp/hi %4, %1; rotcl %0" \ + :"=&r" (flag), "=r" (sum) \ + :"1" (addr), "r" ((int)(size)), "r" (current->addr_limit.seg) \ + :"t"); \ flag; }) #define access_ok(type,addr,size) (__range_ok(addr,size) == 0) @@ -83,24 +84,6 @@ extern inline int verify_area(int type, const void * addr, unsigned long size) #define __put_user(x,ptr) __put_user_nocheck((x),(ptr),sizeof(*(ptr))) #define __get_user(x,ptr) __get_user_nocheck((x),(ptr),sizeof(*(ptr))) -/* - * The "xxx_ret" versions return constant specified in third argument, if - * something bad happens. These macros can be optimized for the - * case of just returning from the function xxx_ret is used. - */ - -#define put_user_ret(x,ptr,ret) ({ \ -if (put_user(x,ptr)) return ret; }) - -#define get_user_ret(x,ptr,ret) ({ \ -if (get_user(x,ptr)) return ret; }) - -#define __put_user_ret(x,ptr,ret) ({ \ -if (__put_user(x,ptr)) return ret; }) - -#define __get_user_ret(x,ptr,ret) ({ \ -if (__get_user(x,ptr)) return ret; }) - struct __large_struct { unsigned long buf[100]; }; #define __m(x) (*(struct __large_struct *)(x)) @@ -204,7 +187,8 @@ __asm__ __volatile__( \ ".long 1b, 3b\n\t" \ ".previous" \ :"=&r" (__pu_err) \ - :"r" (__pu_val), "m" (__m(__pu_addr)), "i" (-EFAULT)); }) + :"r" (__pu_val), "m" (__m(__pu_addr)), "i" (-EFAULT) \ + :"memory"); }) extern void __put_user_unknown(void); @@ -242,7 +226,7 @@ __copy_user(void *__to, const void *__from, __kernel_size_t __n) ".previous" : "=r" (res), "=&z" (__dummy), "=r" (_f), "=r" (_t) : "2" (__from), "3" (__to), "0" (res) - : "memory"); + : "memory", "t"); return res; } @@ -256,20 +240,10 @@ __copy_res = __copy_user(__copy_to, (void *) (from), __copy_size); \ } else __copy_res = __copy_size; \ __copy_res; }) -#define copy_to_user_ret(to,from,n,retval) ({ \ -if (copy_to_user(to,from,n)) \ - return retval; \ -}) - #define __copy_to_user(to,from,n) \ __copy_user((void *)(to), \ (void *)(from), n) -#define __copy_to_user_ret(to,from,n,retval) ({ \ -if (__copy_to_user(to,from,n)) \ - return retval; \ -}) - #define copy_from_user(to,from,n) ({ \ void *__copy_to = (void *) (to); \ void *__copy_from = (void *) (from); \ @@ -280,20 +254,10 @@ __copy_res = __copy_user(__copy_to, __copy_from, __copy_size); \ } else __copy_res = __copy_size; \ __copy_res; }) -#define copy_from_user_ret(to,from,n,retval) ({ \ -if (copy_from_user(to,from,n)) \ - return retval; \ -}) - #define __copy_from_user(to,from,n) \ __copy_user((void *)(to), \ (void *)(from), n) -#define __copy_from_user_ret(to,from,n,retval) ({ \ -if (__copy_from_user(to,from,n)) \ - return retval; \ -}) - /* XXX: Not sure it works well.. should be such that: 4byte clear and the rest. */ extern __inline__ __kernel_size_t @@ -322,7 +286,8 @@ __clear_user(void *addr, __kernel_size_t size) " .long 1b,3b\n" ".previous" : "=r" (size), "=r" (__a) - : "0" (size), "1" (addr), "r" (0)); + : "0" (size), "1" (addr), "r" (0) + : "memory", "t"); return size; } @@ -368,7 +333,7 @@ __strncpy_from_user(unsigned long __dest, unsigned long __src, int __count) : "=r" (res), "=&z" (__dummy), "=r" (_s), "=r" (_d) : "0" (__count), "2" (__src), "3" (__dest), "r" (__count), "i" (-EFAULT) - : "memory"); + : "memory", "t"); return res; } @@ -414,7 +379,8 @@ extern __inline__ long __strnlen_user(const char *__s, long __n) " .long 1b,3b\n" ".previous" : "=z" (res), "=&r" (__dummy) - : "0" (0), "r" (__s), "r" (__n), "i" (-EFAULT)); + : "0" (0), "r" (__s), "r" (__n), "i" (-EFAULT) + : "t"); return res; } diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h index 132a4edc1..e5896abec 100644 --- a/include/asm-sh/unistd.h +++ b/include/asm-sh/unistd.h @@ -230,6 +230,7 @@ #define __NR_mincore 218 #define __NR_madvise 219 #define __NR_getdents64 220 +#define __NR_fcntl64 221 /* user-visible error numbers are in the range -1 - -125: see <asm-sh/errno.h> */ @@ -249,7 +250,7 @@ do { \ #define _syscall0(type,name) \ type name(void) \ { \ -register long __sc0 __asm__ ("$r3") = __NR_##name; \ +register long __sc0 __asm__ ("r3") = __NR_##name; \ __asm__ __volatile__ ("trapa #0x10" \ : "=z" (__sc0) \ : "0" (__sc0) \ @@ -260,8 +261,8 @@ __syscall_return(type,__sc0); \ #define _syscall1(type,name,type1,arg1) \ type name(type1 arg1) \ { \ -register long __sc0 __asm__ ("$r3") = __NR_##name; \ -register long __sc4 __asm__ ("$r4") = (long) arg1; \ +register long __sc0 __asm__ ("r3") = __NR_##name; \ +register long __sc4 __asm__ ("r4") = (long) arg1; \ __asm__ __volatile__ ("trapa #0x11" \ : "=z" (__sc0) \ : "0" (__sc0), "r" (__sc4) \ @@ -272,9 +273,9 @@ __syscall_return(type,__sc0); \ #define _syscall2(type,name,type1,arg1,type2,arg2) \ type name(type1 arg1,type2 arg2) \ { \ -register long __sc0 __asm__ ("$r3") = __NR_##name; \ -register long __sc4 __asm__ ("$r4") = (long) arg1; \ -register long __sc5 __asm__ ("$r5") = (long) arg2; \ +register long __sc0 __asm__ ("r3") = __NR_##name; \ +register long __sc4 __asm__ ("r4") = (long) arg1; \ +register long __sc5 __asm__ ("r5") = (long) arg2; \ __asm__ __volatile__ ("trapa #0x12" \ : "=z" (__sc0) \ : "0" (__sc0), "r" (__sc4), "r" (__sc5) \ @@ -285,10 +286,10 @@ __syscall_return(type,__sc0); \ #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ type name(type1 arg1,type2 arg2,type3 arg3) \ { \ -register long __sc0 __asm__ ("$r3") = __NR_##name; \ -register long __sc4 __asm__ ("$r4") = (long) arg1; \ -register long __sc5 __asm__ ("$r5") = (long) arg2; \ -register long __sc6 __asm__ ("$r6") = (long) arg3; \ +register long __sc0 __asm__ ("r3") = __NR_##name; \ +register long __sc4 __asm__ ("r4") = (long) arg1; \ +register long __sc5 __asm__ ("r5") = (long) arg2; \ +register long __sc6 __asm__ ("r6") = (long) arg3; \ __asm__ __volatile__ ("trapa #0x13" \ : "=z" (__sc0) \ : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6) \ @@ -299,11 +300,11 @@ __syscall_return(type,__sc0); \ #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ { \ -register long __sc0 __asm__ ("$r3") = __NR_##name; \ -register long __sc4 __asm__ ("$r4") = (long) arg1; \ -register long __sc5 __asm__ ("$r5") = (long) arg2; \ -register long __sc6 __asm__ ("$r6") = (long) arg3; \ -register long __sc7 __asm__ ("$r7") = (long) arg4; \ +register long __sc0 __asm__ ("r3") = __NR_##name; \ +register long __sc4 __asm__ ("r4") = (long) arg1; \ +register long __sc5 __asm__ ("r5") = (long) arg2; \ +register long __sc6 __asm__ ("r6") = (long) arg3; \ +register long __sc7 __asm__ ("r7") = (long) arg4; \ __asm__ __volatile__ ("trapa #0x14" \ : "=z" (__sc0) \ : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), \ @@ -315,12 +316,12 @@ __syscall_return(type,__sc0); \ #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ { \ -register long __sc3 __asm__ ("$r3") = __NR_##name; \ -register long __sc4 __asm__ ("$r4") = (long) arg1; \ -register long __sc5 __asm__ ("$r5") = (long) arg2; \ -register long __sc6 __asm__ ("$r6") = (long) arg3; \ -register long __sc7 __asm__ ("$r7") = (long) arg4; \ -register long __sc0 __asm__ ("$r0") = (long) arg5; \ +register long __sc3 __asm__ ("r3") = __NR_##name; \ +register long __sc4 __asm__ ("r4") = (long) arg1; \ +register long __sc5 __asm__ ("r5") = (long) arg2; \ +register long __sc6 __asm__ ("r6") = (long) arg3; \ +register long __sc7 __asm__ ("r7") = (long) arg4; \ +register long __sc0 __asm__ ("r0") = (long) arg5; \ __asm__ __volatile__ ("trapa #0x15" \ : "=z" (__sc0) \ : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \ @@ -345,7 +346,6 @@ __syscall_return(type,__sc0); \ */ #define __NR__exit __NR_exit static __inline__ _syscall0(int,pause) -static __inline__ _syscall1(int,setup,int,magic) static __inline__ _syscall0(int,sync) static __inline__ _syscall0(pid_t,setsid) static __inline__ _syscall3(int,write,int,fd,const char *,buf,off_t,count) |