Commit 5606f2f2 authored by David S. Miller's avatar David S. Miller

Merge davem@nuts.davemloft.net:/disk1/BK/sparc-2.6

into kernel.bkbits.net:/home/davem/sparc-2.6
parents c517cfc4 111610ab
......@@ -509,7 +509,7 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev)
fill_ebus_child(node, &regs[0],
child, child_regs_nonstandard(dev));
while ((node = prom_getsibling(node))) {
while ((node = prom_getsibling(node)) != 0) {
child->next = ebus_alloc(sizeof(struct linux_ebus_child));
child = child->next;
......@@ -611,7 +611,7 @@ void __init ebus_init(void)
dev->bus = ebus;
fill_ebus_device(nd, dev);
while ((nd = prom_getsibling(nd))) {
while ((nd = prom_getsibling(nd)) != 0) {
dev->next = ebus_alloc(sizeof(struct linux_ebus_device));
dev = dev->next;
......
......@@ -60,11 +60,11 @@ static int fbiogetputcmap(unsigned int fd, unsigned int cmd, unsigned long arg)
u32 r, g, b;
mm_segment_t old_fs = get_fs();
ret = get_user(f.index, &(((struct fbcmap32 *)arg)->index));
ret |= __get_user(f.count, &(((struct fbcmap32 *)arg)->count));
ret |= __get_user(r, &(((struct fbcmap32 *)arg)->red));
ret |= __get_user(g, &(((struct fbcmap32 *)arg)->green));
ret |= __get_user(b, &(((struct fbcmap32 *)arg)->blue));
ret = get_user(f.index, &(((struct fbcmap32 __user *)arg)->index));
ret |= __get_user(f.count, &(((struct fbcmap32 __user *)arg)->count));
ret |= __get_user(r, &(((struct fbcmap32 __user *)arg)->red));
ret |= __get_user(g, &(((struct fbcmap32 __user *)arg)->green));
ret |= __get_user(b, &(((struct fbcmap32 __user *)arg)->blue));
if (ret)
return -EFAULT;
if ((f.index < 0) || (f.index > 255)) return -EINVAL;
......@@ -113,16 +113,21 @@ static int fbiogscursor(unsigned int fd, unsigned int cmd, unsigned long arg)
u32 m, i;
mm_segment_t old_fs = get_fs();
ret = copy_from_user (&f, (struct fbcursor32 *)arg, 2 * sizeof (short) + 2 * sizeof(struct fbcurpos));
ret |= __get_user(f.size.x, &(((struct fbcursor32 *)arg)->size.x));
ret |= __get_user(f.size.y, &(((struct fbcursor32 *)arg)->size.y));
ret |= __get_user(f.cmap.index, &(((struct fbcursor32 *)arg)->cmap.index));
ret |= __get_user(f.cmap.count, &(((struct fbcursor32 *)arg)->cmap.count));
ret |= __get_user(r, &(((struct fbcursor32 *)arg)->cmap.red));
ret |= __get_user(g, &(((struct fbcursor32 *)arg)->cmap.green));
ret |= __get_user(b, &(((struct fbcursor32 *)arg)->cmap.blue));
ret |= __get_user(m, &(((struct fbcursor32 *)arg)->mask));
ret |= __get_user(i, &(((struct fbcursor32 *)arg)->image));
ret = copy_from_user (&f, (struct fbcursor32 __user *) arg,
2 * sizeof (short) + 2 * sizeof(struct fbcurpos));
ret |= __get_user(f.size.x,
&(((struct fbcursor32 __user *)arg)->size.x));
ret |= __get_user(f.size.y,
&(((struct fbcursor32 __user *)arg)->size.y));
ret |= __get_user(f.cmap.index,
&(((struct fbcursor32 __user *)arg)->cmap.index));
ret |= __get_user(f.cmap.count,
&(((struct fbcursor32 __user *)arg)->cmap.count));
ret |= __get_user(r, &(((struct fbcursor32 __user *)arg)->cmap.red));
ret |= __get_user(g, &(((struct fbcursor32 __user *)arg)->cmap.green));
ret |= __get_user(b, &(((struct fbcursor32 __user *)arg)->cmap.blue));
ret |= __get_user(m, &(((struct fbcursor32 __user *)arg)->mask));
ret |= __get_user(i, &(((struct fbcursor32 __user *)arg)->image));
if (ret)
return -EFAULT;
if (f.set & FB_CUR_SETCMAP) {
......@@ -167,7 +172,7 @@ typedef struct drm32_version {
static int drm32_version(unsigned int fd, unsigned int cmd, unsigned long arg)
{
drm32_version_t *uversion = (drm32_version_t *)arg;
drm32_version_t __user *uversion = (drm32_version_t __user *)arg;
char __user *name_ptr, *date_ptr, *desc_ptr;
u32 tmp1, tmp2, tmp3;
drm_version_t kversion;
......@@ -245,7 +250,7 @@ typedef struct drm32_unique {
static int drm32_getsetunique(unsigned int fd, unsigned int cmd, unsigned long arg)
{
drm32_unique_t *uarg = (drm32_unique_t *)arg;
drm32_unique_t __user *uarg = (drm32_unique_t __user *)arg;
drm_unique_t karg;
mm_segment_t old_fs;
char __user *uptr;
......@@ -309,7 +314,7 @@ typedef struct drm32_map {
static int drm32_addmap(unsigned int fd, unsigned int cmd, unsigned long arg)
{
drm32_map_t *uarg = (drm32_map_t *) arg;
drm32_map_t __user *uarg = (drm32_map_t __user *) arg;
drm_map_t karg;
mm_segment_t old_fs;
u32 tmp;
......@@ -324,7 +329,7 @@ static int drm32_addmap(unsigned int fd, unsigned int cmd, unsigned long arg)
if (ret)
return -EFAULT;
karg.handle = A(tmp);
karg.handle = (void *) (unsigned long) tmp;
old_fs = get_fs();
set_fs(KERNEL_DS);
......@@ -354,7 +359,7 @@ typedef struct drm32_buf_info {
static int drm32_info_bufs(unsigned int fd, unsigned int cmd, unsigned long arg)
{
drm32_buf_info_t *uarg = (drm32_buf_info_t *)arg;
drm32_buf_info_t __user *uarg = (drm32_buf_info_t __user *)arg;
drm_buf_desc_t __user *ulist;
drm_buf_info_t karg;
mm_segment_t old_fs;
......@@ -400,7 +405,7 @@ typedef struct drm32_buf_free {
static int drm32_free_bufs(unsigned int fd, unsigned int cmd, unsigned long arg)
{
drm32_buf_free_t *uarg = (drm32_buf_free_t *)arg;
drm32_buf_free_t __user *uarg = (drm32_buf_free_t __user *)arg;
drm_buf_free_t karg;
mm_segment_t old_fs;
int __user *ulist;
......@@ -448,7 +453,7 @@ typedef struct drm32_buf_map {
static int drm32_map_bufs(unsigned int fd, unsigned int cmd, unsigned long arg)
{
drm32_buf_map_t *uarg = (drm32_buf_map_t *)arg;
drm32_buf_map_t __user *uarg = (drm32_buf_map_t __user *)arg;
drm32_buf_pub_t __user *ulist;
drm_buf_map_t karg;
mm_segment_t old_fs;
......@@ -460,7 +465,7 @@ static int drm32_map_bufs(unsigned int fd, unsigned int cmd, unsigned long arg)
get_user(tmp2, &uarg->list))
return -EFAULT;
karg.virtual = A(tmp1);
karg.virtual = (void *) (unsigned long) tmp1;
ulist = A(tmp2);
orig_count = karg.count;
......@@ -477,7 +482,7 @@ static int drm32_map_bufs(unsigned int fd, unsigned int cmd, unsigned long arg)
get_user(tmp1, &ulist[i].address))
goto out;
karg.list[i].address = A(tmp1);
karg.list[i].address = (void *) (unsigned long) tmp1;
}
old_fs = get_fs();
......@@ -527,7 +532,7 @@ typedef struct drm32_dma {
*/
static int drm32_dma(unsigned int fd, unsigned int cmd, unsigned long arg)
{
drm32_dma_t *uarg = (drm32_dma_t *) arg;
drm32_dma_t __user *uarg = (drm32_dma_t __user *) arg;
int __user *u_si, *u_ss, *u_ri, *u_rs;
drm_dma_t karg;
mm_segment_t old_fs;
......@@ -637,7 +642,7 @@ typedef struct drm32_ctx_res {
static int drm32_res_ctx(unsigned int fd, unsigned int cmd, unsigned long arg)
{
drm32_ctx_res_t *uarg = (drm32_ctx_res_t *) arg;
drm32_ctx_res_t __user *uarg = (drm32_ctx_res_t __user *) arg;
drm_ctx_t __user *ulist;
drm_ctx_res_t karg;
mm_segment_t old_fs;
......
......@@ -1164,7 +1164,7 @@ static struct proc_dir_entry * irq_dir [NUM_IVECS];
#define HEX_DIGITS 16
static unsigned int parse_hex_value (const char *buffer,
static unsigned int parse_hex_value (const char __user *buffer,
unsigned long count, unsigned long *ret)
{
unsigned char hexnum [HEX_DIGITS];
......@@ -1233,7 +1233,7 @@ static inline void set_intr_affinity(int irq, unsigned long hw_aff)
*/
}
static int irq_affinity_write_proc (struct file *file, const char *buffer,
static int irq_affinity_write_proc (struct file *file, const char __user *buffer,
unsigned long count, void *data)
{
int irq = (long) data, full_count = count, err;
......
......@@ -31,7 +31,7 @@ static void module_unmap(void * addr)
return;
}
for (p = &modvmlist ; (tmp = *p) ; p = &tmp->next) {
for (p = &modvmlist; (tmp = *p) != NULL; p = &tmp->next) {
if (tmp->addr == addr) {
*p = tmp->next;
goto found;
......@@ -66,7 +66,7 @@ static void *module_map(unsigned long size)
return NULL;
addr = (void *) MODULES_VADDR;
for (p = &modvmlist; (tmp = *p) ; p = &tmp->next) {
for (p = &modvmlist; (tmp = *p) != NULL; p = &tmp->next) {
if (size + (unsigned long) addr < (unsigned long) tmp->addr)
break;
addr = (void *) (tmp->size + (unsigned long) tmp->addr);
......
......@@ -42,29 +42,29 @@
/* Misc. PSYCHO PCI controller register offsets and definitions. */
#define PSYCHO_CONTROL 0x0010UL
#define PSYCHO_CONTROL_IMPL 0xf000000000000000 /* Implementation of this PSYCHO*/
#define PSYCHO_CONTROL_VER 0x0f00000000000000 /* Version of this PSYCHO */
#define PSYCHO_CONTROL_MID 0x00f8000000000000 /* UPA Module ID of PSYCHO */
#define PSYCHO_CONTROL_IGN 0x0007c00000000000 /* Interrupt Group Number */
#define PSYCHO_CONTROL_RESV 0x00003ffffffffff0 /* Reserved */
#define PSYCHO_CONTROL_APCKEN 0x0000000000000008 /* Address Parity Check Enable */
#define PSYCHO_CONTROL_APERR 0x0000000000000004 /* Incoming System Addr Parerr */
#define PSYCHO_CONTROL_IAP 0x0000000000000002 /* Invert UPA Parity */
#define PSYCHO_CONTROL_MODE 0x0000000000000001 /* PSYCHO clock mode */
#define PSYCHO_CONTROL_IMPL 0xf000000000000000UL /* Implementation of this PSYCHO*/
#define PSYCHO_CONTROL_VER 0x0f00000000000000UL /* Version of this PSYCHO */
#define PSYCHO_CONTROL_MID 0x00f8000000000000UL /* UPA Module ID of PSYCHO */
#define PSYCHO_CONTROL_IGN 0x0007c00000000000UL /* Interrupt Group Number */
#define PSYCHO_CONTROL_RESV 0x00003ffffffffff0UL /* Reserved */
#define PSYCHO_CONTROL_APCKEN 0x0000000000000008UL /* Address Parity Check Enable */
#define PSYCHO_CONTROL_APERR 0x0000000000000004UL /* Incoming System Addr Parerr */
#define PSYCHO_CONTROL_IAP 0x0000000000000002UL /* Invert UPA Parity */
#define PSYCHO_CONTROL_MODE 0x0000000000000001UL /* PSYCHO clock mode */
#define PSYCHO_PCIA_CTRL 0x2000UL
#define PSYCHO_PCIB_CTRL 0x4000UL
#define PSYCHO_PCICTRL_RESV1 0xfffffff000000000 /* Reserved */
#define PSYCHO_PCICTRL_SBH_ERR 0x0000000800000000 /* Streaming byte hole error */
#define PSYCHO_PCICTRL_SERR 0x0000000400000000 /* SERR signal asserted */
#define PSYCHO_PCICTRL_SPEED 0x0000000200000000 /* PCI speed (1 is U2P clock) */
#define PSYCHO_PCICTRL_RESV2 0x00000001ffc00000 /* Reserved */
#define PSYCHO_PCICTRL_ARB_PARK 0x0000000000200000 /* PCI arbitration parking */
#define PSYCHO_PCICTRL_RESV3 0x00000000001ff800 /* Reserved */
#define PSYCHO_PCICTRL_SBH_INT 0x0000000000000400 /* Streaming byte hole int enab */
#define PSYCHO_PCICTRL_WEN 0x0000000000000200 /* Power Mgmt Wake Enable */
#define PSYCHO_PCICTRL_EEN 0x0000000000000100 /* PCI Error Interrupt Enable */
#define PSYCHO_PCICTRL_RESV4 0x00000000000000c0 /* Reserved */
#define PSYCHO_PCICTRL_AEN 0x000000000000003f /* PCI DVMA Arbitration Enable */
#define PSYCHO_PCICTRL_RESV1 0xfffffff000000000UL /* Reserved */
#define PSYCHO_PCICTRL_SBH_ERR 0x0000000800000000UL /* Streaming byte hole error */
#define PSYCHO_PCICTRL_SERR 0x0000000400000000UL /* SERR signal asserted */
#define PSYCHO_PCICTRL_SPEED 0x0000000200000000UL /* PCI speed (1 is U2P clock) */
#define PSYCHO_PCICTRL_RESV2 0x00000001ffc00000UL /* Reserved */
#define PSYCHO_PCICTRL_ARB_PARK 0x0000000000200000UL /* PCI arbitration parking */
#define PSYCHO_PCICTRL_RESV3 0x00000000001ff800UL /* Reserved */
#define PSYCHO_PCICTRL_SBH_INT 0x0000000000000400UL /* Streaming byte hole int enab */
#define PSYCHO_PCICTRL_WEN 0x0000000000000200UL /* Power Mgmt Wake Enable */
#define PSYCHO_PCICTRL_EEN 0x0000000000000100UL /* PCI Error Interrupt Enable */
#define PSYCHO_PCICTRL_RESV4 0x00000000000000c0UL /* Reserved */
#define PSYCHO_PCICTRL_AEN 0x000000000000003fUL /* PCI DVMA Arbitration Enable */
/* U2P Programmer's Manual, page 13-55, configuration space
* address format:
......@@ -403,11 +403,11 @@ enum psycho_error_type {
*/
#define PSYCHO_STRBUF_CONTROL_A 0x2800UL
#define PSYCHO_STRBUF_CONTROL_B 0x4800UL
#define PSYCHO_STRBUF_CTRL_LPTR 0x00000000000000f0 /* LRU Lock Pointer */
#define PSYCHO_STRBUF_CTRL_LENAB 0x0000000000000008 /* LRU Lock Enable */
#define PSYCHO_STRBUF_CTRL_RRDIS 0x0000000000000004 /* Rerun Disable */
#define PSYCHO_STRBUF_CTRL_DENAB 0x0000000000000002 /* Diagnostic Mode Enable */
#define PSYCHO_STRBUF_CTRL_ENAB 0x0000000000000001 /* Streaming Buffer Enable */
#define PSYCHO_STRBUF_CTRL_LPTR 0x00000000000000f0UL /* LRU Lock Pointer */
#define PSYCHO_STRBUF_CTRL_LENAB 0x0000000000000008UL /* LRU Lock Enable */
#define PSYCHO_STRBUF_CTRL_RRDIS 0x0000000000000004UL /* Rerun Disable */
#define PSYCHO_STRBUF_CTRL_DENAB 0x0000000000000002UL /* Diagnostic Mode Enable */
#define PSYCHO_STRBUF_CTRL_ENAB 0x0000000000000001UL /* Streaming Buffer Enable */
#define PSYCHO_STRBUF_FLUSH_A 0x2808UL
#define PSYCHO_STRBUF_FLUSH_B 0x4808UL
#define PSYCHO_STRBUF_FSYNC_A 0x2810UL
......@@ -416,22 +416,22 @@ enum psycho_error_type {
#define PSYCHO_STC_DATA_B 0xc000UL
#define PSYCHO_STC_ERR_A 0xb400UL
#define PSYCHO_STC_ERR_B 0xc400UL
#define PSYCHO_STCERR_WRITE 0x0000000000000002 /* Write Error */
#define PSYCHO_STCERR_READ 0x0000000000000001 /* Read Error */
#define PSYCHO_STCERR_WRITE 0x0000000000000002UL /* Write Error */
#define PSYCHO_STCERR_READ 0x0000000000000001UL /* Read Error */
#define PSYCHO_STC_TAG_A 0xb800UL
#define PSYCHO_STC_TAG_B 0xc800UL
#define PSYCHO_STCTAG_PPN 0x0fffffff00000000 /* Physical Page Number */
#define PSYCHO_STCTAG_VPN 0x00000000ffffe000 /* Virtual Page Number */
#define PSYCHO_STCTAG_VALID 0x0000000000000002 /* Valid */
#define PSYCHO_STCTAG_WRITE 0x0000000000000001 /* Writable */
#define PSYCHO_STCTAG_PPN 0x0fffffff00000000UL /* Physical Page Number */
#define PSYCHO_STCTAG_VPN 0x00000000ffffe000UL /* Virtual Page Number */
#define PSYCHO_STCTAG_VALID 0x0000000000000002UL /* Valid */
#define PSYCHO_STCTAG_WRITE 0x0000000000000001UL /* Writable */
#define PSYCHO_STC_LINE_A 0xb900UL
#define PSYCHO_STC_LINE_B 0xc900UL
#define PSYCHO_STCLINE_LINDX 0x0000000001e00000 /* LRU Index */
#define PSYCHO_STCLINE_SPTR 0x00000000001f8000 /* Dirty Data Start Pointer */
#define PSYCHO_STCLINE_LADDR 0x0000000000007f00 /* Line Address */
#define PSYCHO_STCLINE_EPTR 0x00000000000000fc /* Dirty Data End Pointer */
#define PSYCHO_STCLINE_VALID 0x0000000000000002 /* Valid */
#define PSYCHO_STCLINE_FOFN 0x0000000000000001 /* Fetch Outstanding / Flush Necessary */
#define PSYCHO_STCLINE_LINDX 0x0000000001e00000UL /* LRU Index */
#define PSYCHO_STCLINE_SPTR 0x00000000001f8000UL /* Dirty Data Start Pointer */
#define PSYCHO_STCLINE_LADDR 0x0000000000007f00UL /* Line Address */
#define PSYCHO_STCLINE_EPTR 0x00000000000000fcUL /* Dirty Data End Pointer */
#define PSYCHO_STCLINE_VALID 0x0000000000000002UL /* Valid */
#define PSYCHO_STCLINE_FOFN 0x0000000000000001UL /* Fetch Outstanding / Flush Necessary */
static spinlock_t stc_buf_lock = SPIN_LOCK_UNLOCKED;
static unsigned long stc_error_buf[128];
......@@ -555,24 +555,24 @@ static void __psycho_check_stc_error(struct pci_controller_info *p,
* interrogate the IOMMU state to see if it is the cause.
*/
#define PSYCHO_IOMMU_CONTROL 0x0200UL
#define PSYCHO_IOMMU_CTRL_RESV 0xfffffffff9000000 /* Reserved */
#define PSYCHO_IOMMU_CTRL_XLTESTAT 0x0000000006000000 /* Translation Error Status */
#define PSYCHO_IOMMU_CTRL_XLTEERR 0x0000000001000000 /* Translation Error encountered */
#define PSYCHO_IOMMU_CTRL_LCKEN 0x0000000000800000 /* Enable translation locking */
#define PSYCHO_IOMMU_CTRL_LCKPTR 0x0000000000780000 /* Translation lock pointer */
#define PSYCHO_IOMMU_CTRL_TSBSZ 0x0000000000070000 /* TSB Size */
#define PSYCHO_IOMMU_TSBSZ_1K 0x0000000000000000 /* TSB Table 1024 8-byte entries */
#define PSYCHO_IOMMU_TSBSZ_2K 0x0000000000010000 /* TSB Table 2048 8-byte entries */
#define PSYCHO_IOMMU_TSBSZ_4K 0x0000000000020000 /* TSB Table 4096 8-byte entries */
#define PSYCHO_IOMMU_TSBSZ_8K 0x0000000000030000 /* TSB Table 8192 8-byte entries */
#define PSYCHO_IOMMU_TSBSZ_16K 0x0000000000040000 /* TSB Table 16k 8-byte entries */
#define PSYCHO_IOMMU_TSBSZ_32K 0x0000000000050000 /* TSB Table 32k 8-byte entries */
#define PSYCHO_IOMMU_TSBSZ_64K 0x0000000000060000 /* TSB Table 64k 8-byte entries */
#define PSYCHO_IOMMU_TSBSZ_128K 0x0000000000070000 /* TSB Table 128k 8-byte entries */
#define PSYCHO_IOMMU_CTRL_RESV2 0x000000000000fff8 /* Reserved */
#define PSYCHO_IOMMU_CTRL_TBWSZ 0x0000000000000004 /* Assumed page size, 0=8k 1=64k */
#define PSYCHO_IOMMU_CTRL_DENAB 0x0000000000000002 /* Diagnostic mode enable */
#define PSYCHO_IOMMU_CTRL_ENAB 0x0000000000000001 /* IOMMU Enable */
#define PSYCHO_IOMMU_CTRL_RESV 0xfffffffff9000000UL /* Reserved */
#define PSYCHO_IOMMU_CTRL_XLTESTAT 0x0000000006000000UL /* Translation Error Status */
#define PSYCHO_IOMMU_CTRL_XLTEERR 0x0000000001000000UL /* Translation Error encountered */
#define PSYCHO_IOMMU_CTRL_LCKEN 0x0000000000800000UL /* Enable translation locking */
#define PSYCHO_IOMMU_CTRL_LCKPTR 0x0000000000780000UL /* Translation lock pointer */
#define PSYCHO_IOMMU_CTRL_TSBSZ 0x0000000000070000UL /* TSB Size */
#define PSYCHO_IOMMU_TSBSZ_1K 0x0000000000000000UL /* TSB Table 1024 8-byte entries */
#define PSYCHO_IOMMU_TSBSZ_2K 0x0000000000010000UL /* TSB Table 2048 8-byte entries */
#define PSYCHO_IOMMU_TSBSZ_4K 0x0000000000020000UL /* TSB Table 4096 8-byte entries */
#define PSYCHO_IOMMU_TSBSZ_8K 0x0000000000030000UL /* TSB Table 8192 8-byte entries */
#define PSYCHO_IOMMU_TSBSZ_16K 0x0000000000040000UL /* TSB Table 16k 8-byte entries */
#define PSYCHO_IOMMU_TSBSZ_32K 0x0000000000050000UL /* TSB Table 32k 8-byte entries */
#define PSYCHO_IOMMU_TSBSZ_64K 0x0000000000060000UL /* TSB Table 64k 8-byte entries */
#define PSYCHO_IOMMU_TSBSZ_128K 0x0000000000070000UL /* TSB Table 128k 8-byte entries */
#define PSYCHO_IOMMU_CTRL_RESV2 0x000000000000fff8UL /* Reserved */
#define PSYCHO_IOMMU_CTRL_TBWSZ 0x0000000000000004UL /* Assumed page size, 0=8k 1=64k */
#define PSYCHO_IOMMU_CTRL_DENAB 0x0000000000000002UL /* Diagnostic mode enable */
#define PSYCHO_IOMMU_CTRL_ENAB 0x0000000000000001UL /* IOMMU Enable */
#define PSYCHO_IOMMU_TSBBASE 0x0208UL
#define PSYCHO_IOMMU_FLUSH 0x0210UL
#define PSYCHO_IOMMU_TAG 0xa580UL
......@@ -698,18 +698,18 @@ static void psycho_check_iommu_error(struct pci_controller_info *p,
* relating to UPA interface transactions.
*/
#define PSYCHO_UE_AFSR 0x0030UL
#define PSYCHO_UEAFSR_PPIO 0x8000000000000000 /* Primary PIO is cause */
#define PSYCHO_UEAFSR_PDRD 0x4000000000000000 /* Primary DVMA read is cause */
#define PSYCHO_UEAFSR_PDWR 0x2000000000000000 /* Primary DVMA write is cause */
#define PSYCHO_UEAFSR_SPIO 0x1000000000000000 /* Secondary PIO is cause */
#define PSYCHO_UEAFSR_SDRD 0x0800000000000000 /* Secondary DVMA read is cause */
#define PSYCHO_UEAFSR_SDWR 0x0400000000000000 /* Secondary DVMA write is cause*/
#define PSYCHO_UEAFSR_RESV1 0x03ff000000000000 /* Reserved */
#define PSYCHO_UEAFSR_BMSK 0x0000ffff00000000 /* Bytemask of failed transfer */
#define PSYCHO_UEAFSR_DOFF 0x00000000e0000000 /* Doubleword Offset */
#define PSYCHO_UEAFSR_MID 0x000000001f000000 /* UPA MID causing the fault */
#define PSYCHO_UEAFSR_BLK 0x0000000000800000 /* Trans was block operation */
#define PSYCHO_UEAFSR_RESV2 0x00000000007fffff /* Reserved */
#define PSYCHO_UEAFSR_PPIO 0x8000000000000000UL /* Primary PIO is cause */
#define PSYCHO_UEAFSR_PDRD 0x4000000000000000UL /* Primary DVMA read is cause */
#define PSYCHO_UEAFSR_PDWR 0x2000000000000000UL /* Primary DVMA write is cause */
#define PSYCHO_UEAFSR_SPIO 0x1000000000000000UL /* Secondary PIO is cause */
#define PSYCHO_UEAFSR_SDRD 0x0800000000000000UL /* Secondary DVMA read is cause */
#define PSYCHO_UEAFSR_SDWR 0x0400000000000000UL /* Secondary DVMA write is cause*/
#define PSYCHO_UEAFSR_RESV1 0x03ff000000000000UL /* Reserved */
#define PSYCHO_UEAFSR_BMSK 0x0000ffff00000000UL /* Bytemask of failed transfer */
#define PSYCHO_UEAFSR_DOFF 0x00000000e0000000UL /* Doubleword Offset */
#define PSYCHO_UEAFSR_MID 0x000000001f000000UL /* UPA MID causing the fault */
#define PSYCHO_UEAFSR_BLK 0x0000000000800000UL /* Trans was block operation */
#define PSYCHO_UEAFSR_RESV2 0x00000000007fffffUL /* Reserved */
#define PSYCHO_UE_AFAR 0x0038UL
static irqreturn_t psycho_ue_intr(int irq, void *dev_id, struct pt_regs *regs)
......@@ -774,19 +774,19 @@ static irqreturn_t psycho_ue_intr(int irq, void *dev_id, struct pt_regs *regs)
/* Correctable Errors. */
#define PSYCHO_CE_AFSR 0x0040UL
#define PSYCHO_CEAFSR_PPIO 0x8000000000000000 /* Primary PIO is cause */
#define PSYCHO_CEAFSR_PDRD 0x4000000000000000 /* Primary DVMA read is cause */
#define PSYCHO_CEAFSR_PDWR 0x2000000000000000 /* Primary DVMA write is cause */
#define PSYCHO_CEAFSR_SPIO 0x1000000000000000 /* Secondary PIO is cause */
#define PSYCHO_CEAFSR_SDRD 0x0800000000000000 /* Secondary DVMA read is cause */
#define PSYCHO_CEAFSR_SDWR 0x0400000000000000 /* Secondary DVMA write is cause*/
#define PSYCHO_CEAFSR_RESV1 0x0300000000000000 /* Reserved */
#define PSYCHO_CEAFSR_ESYND 0x00ff000000000000 /* Syndrome Bits */
#define PSYCHO_CEAFSR_BMSK 0x0000ffff00000000 /* Bytemask of failed transfer */
#define PSYCHO_CEAFSR_DOFF 0x00000000e0000000 /* Double Offset */
#define PSYCHO_CEAFSR_MID 0x000000001f000000 /* UPA MID causing the fault */
#define PSYCHO_CEAFSR_BLK 0x0000000000800000 /* Trans was block operation */
#define PSYCHO_CEAFSR_RESV2 0x00000000007fffff /* Reserved */
#define PSYCHO_CEAFSR_PPIO 0x8000000000000000UL /* Primary PIO is cause */
#define PSYCHO_CEAFSR_PDRD 0x4000000000000000UL /* Primary DVMA read is cause */
#define PSYCHO_CEAFSR_PDWR 0x2000000000000000UL /* Primary DVMA write is cause */
#define PSYCHO_CEAFSR_SPIO 0x1000000000000000UL /* Secondary PIO is cause */
#define PSYCHO_CEAFSR_SDRD 0x0800000000000000UL /* Secondary DVMA read is cause */
#define PSYCHO_CEAFSR_SDWR 0x0400000000000000UL /* Secondary DVMA write is cause*/
#define PSYCHO_CEAFSR_RESV1 0x0300000000000000UL /* Reserved */
#define PSYCHO_CEAFSR_ESYND 0x00ff000000000000UL /* Syndrome Bits */
#define PSYCHO_CEAFSR_BMSK 0x0000ffff00000000UL /* Bytemask of failed transfer */
#define PSYCHO_CEAFSR_DOFF 0x00000000e0000000UL /* Double Offset */
#define PSYCHO_CEAFSR_MID 0x000000001f000000UL /* UPA MID causing the fault */
#define PSYCHO_CEAFSR_BLK 0x0000000000800000UL /* Trans was block operation */
#define PSYCHO_CEAFSR_RESV2 0x00000000007fffffUL /* Reserved */
#define PSYCHO_CE_AFAR 0x0040UL
static irqreturn_t psycho_ce_intr(int irq, void *dev_id, struct pt_regs *regs)
......@@ -857,20 +857,20 @@ static irqreturn_t psycho_ce_intr(int irq, void *dev_id, struct pt_regs *regs)
*/
#define PSYCHO_PCI_AFSR_A 0x2010UL
#define PSYCHO_PCI_AFSR_B 0x4010UL
#define PSYCHO_PCIAFSR_PMA 0x8000000000000000 /* Primary Master Abort Error */
#define PSYCHO_PCIAFSR_PTA 0x4000000000000000 /* Primary Target Abort Error */
#define PSYCHO_PCIAFSR_PRTRY 0x2000000000000000 /* Primary Excessive Retries */
#define PSYCHO_PCIAFSR_PPERR 0x1000000000000000 /* Primary Parity Error */
#define PSYCHO_PCIAFSR_SMA 0x0800000000000000 /* Secondary Master Abort Error */
#define PSYCHO_PCIAFSR_STA 0x0400000000000000 /* Secondary Target Abort Error */
#define PSYCHO_PCIAFSR_SRTRY 0x0200000000000000 /* Secondary Excessive Retries */
#define PSYCHO_PCIAFSR_SPERR 0x0100000000000000 /* Secondary Parity Error */
#define PSYCHO_PCIAFSR_RESV1 0x00ff000000000000 /* Reserved */
#define PSYCHO_PCIAFSR_BMSK 0x0000ffff00000000 /* Bytemask of failed transfer */
#define PSYCHO_PCIAFSR_BLK 0x0000000080000000 /* Trans was block operation */
#define PSYCHO_PCIAFSR_RESV2 0x0000000040000000 /* Reserved */
#define PSYCHO_PCIAFSR_MID 0x000000003e000000 /* MID causing the error */
#define PSYCHO_PCIAFSR_RESV3 0x0000000001ffffff /* Reserved */
#define PSYCHO_PCIAFSR_PMA 0x8000000000000000UL /* Primary Master Abort Error */
#define PSYCHO_PCIAFSR_PTA 0x4000000000000000UL /* Primary Target Abort Error */
#define PSYCHO_PCIAFSR_PRTRY 0x2000000000000000UL /* Primary Excessive Retries */
#define PSYCHO_PCIAFSR_PPERR 0x1000000000000000UL /* Primary Parity Error */
#define PSYCHO_PCIAFSR_SMA 0x0800000000000000UL /* Secondary Master Abort Error */
#define PSYCHO_PCIAFSR_STA 0x0400000000000000UL /* Secondary Target Abort Error */
#define PSYCHO_PCIAFSR_SRTRY 0x0200000000000000UL /* Secondary Excessive Retries */
#define PSYCHO_PCIAFSR_SPERR 0x0100000000000000UL /* Secondary Parity Error */
#define PSYCHO_PCIAFSR_RESV1 0x00ff000000000000UL /* Reserved */
#define PSYCHO_PCIAFSR_BMSK 0x0000ffff00000000UL /* Bytemask of failed transfer */
#define PSYCHO_PCIAFSR_BLK 0x0000000080000000UL /* Trans was block operation */
#define PSYCHO_PCIAFSR_RESV2 0x0000000040000000UL /* Reserved */
#define PSYCHO_PCIAFSR_MID 0x000000003e000000UL /* MID causing the error */
#define PSYCHO_PCIAFSR_RESV3 0x0000000001ffffffUL /* Reserved */
#define PSYCHO_PCI_AFAR_A 0x2018UL
#define PSYCHO_PCI_AFAR_B 0x4018UL
......@@ -1017,9 +1017,9 @@ static irqreturn_t psycho_pcierr_intr(int irq, void *dev_id, struct pt_regs *reg
/* XXX What about PowerFail/PowerManagement??? -DaveM */
#define PSYCHO_ECC_CTRL 0x0020
#define PSYCHO_ECCCTRL_EE 0x8000000000000000 /* Enable ECC Checking */
#define PSYCHO_ECCCTRL_UE 0x4000000000000000 /* Enable UE Interrupts */
#define PSYCHO_ECCCTRL_CE 0x2000000000000000 /* Enable CE INterrupts */
#define PSYCHO_ECCCTRL_EE 0x8000000000000000UL /* Enable ECC Checking */
#define PSYCHO_ECCCTRL_UE 0x4000000000000000UL /* Enable UE Interrupts */
#define PSYCHO_ECCCTRL_CE 0x2000000000000000UL /* Enable CE INterrupts */
#define PSYCHO_UE_INO 0x2e
#define PSYCHO_CE_INO 0x2f
#define PSYCHO_PCIERR_A_INO 0x30
......@@ -1282,14 +1282,14 @@ static void __init psycho_iommu_init(struct pci_controller_info *p)
#define PSYCHO_IRQ_RETRY 0x1a00UL
#define PSYCHO_PCIA_DIAG 0x2020UL
#define PSYCHO_PCIB_DIAG 0x4020UL
#define PSYCHO_PCIDIAG_RESV 0xffffffffffffff80 /* Reserved */
#define PSYCHO_PCIDIAG_DRETRY 0x0000000000000040 /* Disable retry limit */
#define PSYCHO_PCIDIAG_DISYNC 0x0000000000000020 /* Disable DMA wr / irq sync */
#define PSYCHO_PCIDIAG_DDWSYNC 0x0000000000000010 /* Disable DMA wr / PIO rd sync */
#define PSYCHO_PCIDIAG_IDDPAR 0x0000000000000008 /* Invert DMA data parity */
#define PSYCHO_PCIDIAG_IPDPAR 0x0000000000000004 /* Invert PIO data parity */
#define PSYCHO_PCIDIAG_IPAPAR 0x0000000000000002 /* Invert PIO address parity */
#define PSYCHO_PCIDIAG_LPBACK 0x0000000000000001 /* Enable loopback mode */
#define PSYCHO_PCIDIAG_RESV 0xffffffffffffff80UL /* Reserved */
#define PSYCHO_PCIDIAG_DRETRY 0x0000000000000040UL /* Disable retry limit */
#define PSYCHO_PCIDIAG_DISYNC 0x0000000000000020UL /* Disable DMA wr / irq sync */
#define PSYCHO_PCIDIAG_DDWSYNC 0x0000000000000010UL /* Disable DMA wr / PIO rd sync */
#define PSYCHO_PCIDIAG_IDDPAR 0x0000000000000008UL /* Invert DMA data parity */
#define PSYCHO_PCIDIAG_IPDPAR 0x0000000000000004UL /* Invert PIO data parity */
#define PSYCHO_PCIDIAG_IPAPAR 0x0000000000000002UL /* Invert PIO address parity */
#define PSYCHO_PCIDIAG_LPBACK 0x0000000000000001UL /* Enable loopback mode */
static void psycho_controller_hwinit(struct pci_controller_info *p)
{
......
......@@ -56,24 +56,24 @@
#define SCHIZO_STRBUF_CTRL_ENAB 0x0000000000000001UL /* Streaming Buffer Enable */
/* IOMMU control register. */
#define SCHIZO_IOMMU_CTRL_RESV 0xfffffffff9000000 /* Reserved */
#define SCHIZO_IOMMU_CTRL_XLTESTAT 0x0000000006000000 /* Translation Error Status */
#define SCHIZO_IOMMU_CTRL_XLTEERR 0x0000000001000000 /* Translation Error encountered */
#define SCHIZO_IOMMU_CTRL_LCKEN 0x0000000000800000 /* Enable translation locking */
#define SCHIZO_IOMMU_CTRL_LCKPTR 0x0000000000780000 /* Translation lock pointer */
#define SCHIZO_IOMMU_CTRL_TSBSZ 0x0000000000070000 /* TSB Size */
#define SCHIZO_IOMMU_TSBSZ_1K 0x0000000000000000 /* TSB Table 1024 8-byte entries */
#define SCHIZO_IOMMU_TSBSZ_2K 0x0000000000010000 /* TSB Table 2048 8-byte entries */
#define SCHIZO_IOMMU_TSBSZ_4K 0x0000000000020000 /* TSB Table 4096 8-byte entries */
#define SCHIZO_IOMMU_TSBSZ_8K 0x0000000000030000 /* TSB Table 8192 8-byte entries */
#define SCHIZO_IOMMU_TSBSZ_16K 0x0000000000040000 /* TSB Table 16k 8-byte entries */
#define SCHIZO_IOMMU_TSBSZ_32K 0x0000000000050000 /* TSB Table 32k 8-byte entries */
#define SCHIZO_IOMMU_TSBSZ_64K 0x0000000000060000 /* TSB Table 64k 8-byte entries */
#define SCHIZO_IOMMU_TSBSZ_128K 0x0000000000070000 /* TSB Table 128k 8-byte entries */
#define SCHIZO_IOMMU_CTRL_RESV2 0x000000000000fff8 /* Reserved */
#define SCHIZO_IOMMU_CTRL_TBWSZ 0x0000000000000004 /* Assumed page size, 0=8k 1=64k */
#define SCHIZO_IOMMU_CTRL_DENAB 0x0000000000000002 /* Diagnostic mode enable */
#define SCHIZO_IOMMU_CTRL_ENAB 0x0000000000000001 /* IOMMU Enable */
#define SCHIZO_IOMMU_CTRL_RESV 0xfffffffff9000000UL /* Reserved */
#define SCHIZO_IOMMU_CTRL_XLTESTAT 0x0000000006000000UL /* Translation Error Status */
#define SCHIZO_IOMMU_CTRL_XLTEERR 0x0000000001000000UL /* Translation Error encountered */
#define SCHIZO_IOMMU_CTRL_LCKEN 0x0000000000800000UL /* Enable translation locking */
#define SCHIZO_IOMMU_CTRL_LCKPTR 0x0000000000780000UL /* Translation lock pointer */
#define SCHIZO_IOMMU_CTRL_TSBSZ 0x0000000000070000UL /* TSB Size */
#define SCHIZO_IOMMU_TSBSZ_1K 0x0000000000000000UL /* TSB Table 1024 8-byte entries */
#define SCHIZO_IOMMU_TSBSZ_2K 0x0000000000010000UL /* TSB Table 2048 8-byte entries */
#define SCHIZO_IOMMU_TSBSZ_4K 0x0000000000020000UL /* TSB Table 4096 8-byte entries */
#define SCHIZO_IOMMU_TSBSZ_8K 0x0000000000030000UL /* TSB Table 8192 8-byte entries */
#define SCHIZO_IOMMU_TSBSZ_16K 0x0000000000040000UL /* TSB Table 16k 8-byte entries */
#define SCHIZO_IOMMU_TSBSZ_32K 0x0000000000050000UL /* TSB Table 32k 8-byte entries */
#define SCHIZO_IOMMU_TSBSZ_64K 0x0000000000060000UL /* TSB Table 64k 8-byte entries */
#define SCHIZO_IOMMU_TSBSZ_128K 0x0000000000070000UL /* TSB Table 128k 8-byte entries */
#define SCHIZO_IOMMU_CTRL_RESV2 0x000000000000fff8UL /* Reserved */
#define SCHIZO_IOMMU_CTRL_TBWSZ 0x0000000000000004UL /* Assumed page size, 0=8k 1=64k */
#define SCHIZO_IOMMU_CTRL_DENAB 0x0000000000000002UL /* Diagnostic mode enable */
#define SCHIZO_IOMMU_CTRL_ENAB 0x0000000000000001UL /* IOMMU Enable */
/* Schizo config space address format is nearly identical to
* that of PSYCHO:
......@@ -1111,9 +1111,9 @@ static irqreturn_t schizo_safarierr_intr(int irq, void *dev_id, struct pt_regs *
/* Nearly identical to PSYCHO equivalents... */
#define SCHIZO_ECC_CTRL 0x10020UL
#define SCHIZO_ECCCTRL_EE 0x8000000000000000 /* Enable ECC Checking */
#define SCHIZO_ECCCTRL_UE 0x4000000000000000 /* Enable UE Interrupts */
#define SCHIZO_ECCCTRL_CE 0x2000000000000000 /* Enable CE INterrupts */
#define SCHIZO_ECCCTRL_EE 0x8000000000000000UL /* Enable ECC Checking */
#define SCHIZO_ECCCTRL_UE 0x4000000000000000UL /* Enable UE Interrupts */
#define SCHIZO_ECCCTRL_CE 0x2000000000000000UL /* Enable CE INterrupts */
#define SCHIZO_SAFARI_ERRCTRL 0x10008UL
#define SCHIZO_SAFERRCTRL_EN 0x8000000000000000UL
......
......@@ -160,39 +160,43 @@ EXPORT_SYMBOL(machine_restart);
static void show_regwindow32(struct pt_regs *regs)
{
struct reg_window32 *rw;
struct reg_window32 __user *rw;
struct reg_window32 r_w;
mm_segment_t old_fs;
__asm__ __volatile__ ("flushw");
rw = (struct reg_window32 *)((long)(unsigned)regs->u_regs[14]);
rw = (struct reg_window32 __user *)((long)(unsigned)regs->u_regs[14]);
old_fs = get_fs();
set_fs (USER_DS);
if (copy_from_user (&r_w, rw, sizeof(r_w))) {
set_fs (old_fs);
return;
}
rw = &r_w;
set_fs (old_fs);
printk("l0: %08x l1: %08x l2: %08x l3: %08x "
"l4: %08x l5: %08x l6: %08x l7: %08x\n",
rw->locals[0], rw->locals[1], rw->locals[2], rw->locals[3],
rw->locals[4], rw->locals[5], rw->locals[6], rw->locals[7]);
r_w.locals[0], r_w.locals[1], r_w.locals[2], r_w.locals[3],
r_w.locals[4], r_w.locals[5], r_w.locals[6], r_w.locals[7]);
printk("i0: %08x i1: %08x i2: %08x i3: %08x "
"i4: %08x i5: %08x i6: %08x i7: %08x\n",
rw->ins[0], rw->ins[1], rw->ins[2], rw->ins[3],
rw->ins[4], rw->ins[5], rw->ins[6], rw->ins[7]);
r_w.ins[0], r_w.ins[1], r_w.ins[2], r_w.ins[3],
r_w.ins[4], r_w.ins[5], r_w.ins[6], r_w.ins[7]);
}
static void show_regwindow(struct pt_regs *regs)
{
struct reg_window *rw;
struct reg_window __user *rw;
struct reg_window *rwk;
struct reg_window r_w;
mm_segment_t old_fs;
if ((regs->tstate & TSTATE_PRIV) || !(test_thread_flag(TIF_32BIT))) {
__asm__ __volatile__ ("flushw");
rw = (struct reg_window *)(regs->u_regs[14] + STACK_BIAS);
rw = (struct reg_window __user *)
(regs->u_regs[14] + STACK_BIAS);
rwk = (struct reg_window *)
(regs->u_regs[14] + STACK_BIAS);
if (!(regs->tstate & TSTATE_PRIV)) {
old_fs = get_fs();
set_fs (USER_DS);
......@@ -200,7 +204,7 @@ static void show_regwindow(struct pt_regs *regs)
set_fs (old_fs);
return;
}
rw = &r_w;
rwk = &r_w;
set_fs (old_fs);
}
} else {
......@@ -208,15 +212,15 @@ static void show_regwindow(struct pt_regs *regs)
return;
}
printk("l0: %016lx l1: %016lx l2: %016lx l3: %016lx\n",
rw->locals[0], rw->locals[1], rw->locals[2], rw->locals[3]);
rwk->locals[0], rwk->locals[1], rwk->locals[2], rwk->locals[3]);
printk("l4: %016lx l5: %016lx l6: %016lx l7: %016lx\n",
rw->locals[4], rw->locals[5], rw->locals[6], rw->locals[7]);
rwk->locals[4], rwk->locals[5], rwk->locals[6], rwk->locals[7]);
printk("i0: %016lx i1: %016lx i2: %016lx i3: %016lx\n",
rw->ins[0], rw->ins[1], rw->ins[2], rw->ins[3]);
rwk->ins[0], rwk->ins[1], rwk->ins[2], rwk->ins[3]);
printk("i4: %016lx i5: %016lx i6: %016lx i7: %016lx\n",
rw->ins[4], rw->ins[5], rw->ins[6], rw->ins[7]);
rwk->ins[4], rwk->ins[5], rwk->ins[6], rwk->ins[7]);
if (regs->tstate & TSTATE_PRIV)
print_symbol("I7: <%s>\n", rw->ins[7]);
print_symbol("I7: <%s>\n", rwk->ins[7]);
}
void show_stackframe(struct sparc_stackf *sf)
......@@ -471,10 +475,10 @@ static unsigned long clone_stackframe(unsigned long csp, unsigned long psp)
if (!(test_thread_flag(TIF_32BIT))) {
csp += STACK_BIAS;
psp += STACK_BIAS;
__get_user(fp, &(((struct reg_window *)psp)->ins[6]));
__get_user(fp, &(((struct reg_window __user *)psp)->ins[6]));
fp += STACK_BIAS;
} else
__get_user(fp, &(((struct reg_window32 *)psp)->ins[6]));
__get_user(fp, &(((struct reg_window32 __user *)psp)->ins[6]));
/* Now 8-byte align the stack as this is mandatory in the
* Sparc ABI due to how register windows work. This hides
......@@ -487,11 +491,12 @@ static unsigned long clone_stackframe(unsigned long csp, unsigned long psp)
if (copy_in_user((void __user *) rval, (void __user *) psp, distance))
rval = 0;
else if (test_thread_flag(TIF_32BIT)) {
if (put_user(((u32)csp), &(((struct reg_window32 *)rval)->ins[6])))
if (put_user(((u32)csp),
&(((struct reg_window32 __user *)rval)->ins[6])))
rval = 0;
} else {
if (put_user(((u64)csp - STACK_BIAS),
&(((struct reg_window *)rval)->ins[6])))
&(((struct reg_window __user *)rval)->ins[6])))
rval = 0;
else
rval = rval - STACK_BIAS;
......@@ -533,7 +538,7 @@ void synchronize_user_stack(void)
unsigned long sp = (t->rwbuf_stkptrs[window] + bias);
struct reg_window *rwin = &t->reg_window[window];
if (!copy_to_user((char *)sp, rwin, winsize)) {
if (!copy_to_user((char __user *)sp, rwin, winsize)) {
shift_window_buffer(window, get_thread_wsaved() - 1, t);
set_thread_wsaved(get_thread_wsaved() - 1);
}
......@@ -562,7 +567,7 @@ void fault_in_user_windows(void)
unsigned long sp = (t->rwbuf_stkptrs[window] + bias);
struct reg_window *rwin = &t->reg_window[window];
if (copy_to_user((char *)sp, rwin, winsize))
if (copy_to_user((char __user *)sp, rwin, winsize))
goto barf;
} while (window--);
}
......@@ -592,8 +597,8 @@ asmlinkage int sparc_do_fork(unsigned long clone_flags,
return do_fork(clone_flags, stack_start,
regs, stack_size,
(int *) parent_tid_ptr,
(int *) child_tid_ptr);
(int __user *) parent_tid_ptr,
(int __user *) child_tid_ptr);
}
/* Copy a Sparc thread. The fork() return value conventions
......@@ -694,24 +699,24 @@ pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
* So we stash 'fn' and 'arg' into global registers which
* will not be modified by the parent.
*/
__asm__ __volatile("mov %4, %%g2\n\t" /* Save FN into global */
"mov %5, %%g3\n\t" /* Save ARG into global */
"mov %1, %%g1\n\t" /* Clone syscall nr. */
"mov %2, %%o0\n\t" /* Clone flags. */
"mov 0, %%o1\n\t" /* usp arg == 0 */
"t 0x6d\n\t" /* Linux/Sparc clone(). */
"brz,a,pn %%o1, 1f\n\t" /* Parent, just return. */
" mov %%o0, %0\n\t"
"jmpl %%g2, %%o7\n\t" /* Call the function. */
" mov %%g3, %%o0\n\t" /* Set arg in delay. */
"mov %3, %%g1\n\t"
"t 0x6d\n\t" /* Linux/Sparc exit(). */
/* Notreached by child. */
"1:" :
"=r" (retval) :
"i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED),
"i" (__NR_exit), "r" (fn), "r" (arg) :
"g1", "g2", "g3", "o0", "o1", "memory", "cc");
__asm__ __volatile__("mov %4, %%g2\n\t" /* Save FN into global */
"mov %5, %%g3\n\t" /* Save ARG into global */
"mov %1, %%g1\n\t" /* Clone syscall nr. */
"mov %2, %%o0\n\t" /* Clone flags. */
"mov 0, %%o1\n\t" /* usp arg == 0 */
"t 0x6d\n\t" /* Linux/Sparc clone(). */
"brz,a,pn %%o1, 1f\n\t" /* Parent, just return. */
" mov %%o0, %0\n\t"
"jmpl %%g2, %%o7\n\t" /* Call the function. */
" mov %%g3, %%o0\n\t" /* Set arg in delay. */
"mov %3, %%g1\n\t"
"t 0x6d\n\t" /* Linux/Sparc exit(). */
/* Notreached by child. */
"1:" :
"=r" (retval) :
"i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED),
"i" (__NR_exit), "r" (fn), "r" (arg) :
"g1", "g2", "g3", "o0", "o1", "memory", "cc");
return retval;
}
......@@ -806,12 +811,15 @@ asmlinkage int sparc_execve(struct pt_regs *regs)
if (regs->u_regs[UREG_G1] == 0)
base = 1;
filename = getname((char *)regs->u_regs[base + UREG_I0]);
filename = getname((char __user *)regs->u_regs[base + UREG_I0]);
error = PTR_ERR(filename);
if (IS_ERR(filename))
goto out;
error = do_execve(filename, (char **) regs->u_regs[base + UREG_I1],
(char **) regs->u_regs[base + UREG_I2], regs);
error = do_execve(filename,
(char __user * __user *)
regs->u_regs[base + UREG_I1],
(char __user * __user *)
regs->u_regs[base + UREG_I2], regs);
putname(filename);
if (!error) {
fprs_write(0);
......
......@@ -53,11 +53,15 @@ static inline void
pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr)
{
if (test_thread_flag(TIF_32BIT)) {
if (put_user(value, (unsigned int *)addr))
return pt_error_return(regs, EFAULT);
if (put_user(value, (unsigned int __user *) addr)) {
pt_error_return(regs, EFAULT);
return;
}
} else {
if (put_user(value, addr))
return pt_error_return(regs, EFAULT);
if (put_user(value, (long __user *) addr)) {
pt_error_return(regs, EFAULT);
return;
}
}
regs->u_regs[UREG_I0] = 0;
regs->tstate &= ~(TSTATE_ICARRY | TSTATE_XCARRY);
......@@ -253,7 +257,8 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
}
case PTRACE_GETREGS: {
struct pt_regs32 *pregs = (struct pt_regs32 *) addr;
struct pt_regs32 __user *pregs =
(struct pt_regs32 __user *) addr;
struct pt_regs *cregs = child->thread_info->kregs;
int rval;
......@@ -277,7 +282,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
}
case PTRACE_GETREGS64: {
struct pt_regs *pregs = (struct pt_regs *) addr;
struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
struct pt_regs *cregs = child->thread_info->kregs;
unsigned long tpc = cregs->tpc;
int rval;
......@@ -304,7 +309,8 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
}
case PTRACE_SETREGS: {
struct pt_regs32 *pregs = (struct pt_regs32 *) addr;
struct pt_regs32 __user *pregs =
(struct pt_regs32 __user *) addr;
struct pt_regs *cregs = child->thread_info->kregs;
unsigned int psr, pc, npc, y;
int i;
......@@ -337,7 +343,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
}
case PTRACE_SETREGS64: {
struct pt_regs *pregs = (struct pt_regs *) addr;
struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
struct pt_regs *cregs = child->thread_info->kregs;
unsigned long tstate, tpc, tnpc, y;
int i;
......@@ -385,7 +391,8 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
unsigned int insnaddr;
unsigned int insn;
} fpq[16];
} *fps = (struct fps *) addr;
};
struct fps __user *fps = (struct fps __user *) addr;
unsigned long *fpregs = child->thread_info->fpregs;
if (copy_to_user(&fps->regs[0], fpregs,
......@@ -406,7 +413,8 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
struct fps {
unsigned int regs[64];
unsigned long fsr;
} *fps = (struct fps *) addr;
};
struct fps __user *fps = (struct fps __user *) addr;
unsigned long *fpregs = child->thread_info->fpregs;
if (copy_to_user(&fps->regs[0], fpregs,
......@@ -430,7 +438,8 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
unsigned int insnaddr;
unsigned int insn;
} fpq[16];
} *fps = (struct fps *) addr;
};
struct fps __user *fps = (struct fps __user *) addr;
unsigned long *fpregs = child->thread_info->fpregs;
unsigned fsr;
......@@ -453,7 +462,8 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
struct fps {
unsigned int regs[64];
unsigned long fsr;
} *fps = (struct fps *) addr;
};
struct fps __user *fps = (struct fps __user *) addr;
unsigned long *fpregs = child->thread_info->fpregs;
if (copy_from_user(fpregs, &fps->regs[0],
......@@ -472,7 +482,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
case PTRACE_READTEXT:
case PTRACE_READDATA: {
int res = ptrace_readdata(child, addr,
(void *)addr2, data);
(char __user *)addr2, data);
if (res == data) {
pt_succ_return(regs, 0);
goto flush_and_out;
......@@ -485,7 +495,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
case PTRACE_WRITETEXT:
case PTRACE_WRITEDATA: {
int res = ptrace_writedata(child, (void *) addr2,
int res = ptrace_writedata(child, (char __user *) addr2,
addr, data);
if (res == data) {
pt_succ_return(regs, 0);
......
......@@ -810,17 +810,17 @@ unsigned int sbus_build_irq(void *buscookie, unsigned int ino)
/* Error interrupt handling. */
#define SYSIO_UE_AFSR 0x0030UL
#define SYSIO_UE_AFAR 0x0038UL
#define SYSIO_UEAFSR_PPIO 0x8000000000000000 /* Primary PIO is cause */
#define SYSIO_UEAFSR_PDRD 0x4000000000000000 /* Primary DVMA read is cause */
#define SYSIO_UEAFSR_PDWR 0x2000000000000000 /* Primary DVMA write is cause */
#define SYSIO_UEAFSR_SPIO 0x1000000000000000 /* Secondary PIO is cause */
#define SYSIO_UEAFSR_SDRD 0x0800000000000000 /* Secondary DVMA read is cause */
#define SYSIO_UEAFSR_SDWR 0x0400000000000000 /* Secondary DVMA write is cause*/
#define SYSIO_UEAFSR_RESV1 0x03ff000000000000 /* Reserved */
#define SYSIO_UEAFSR_DOFF 0x0000e00000000000 /* Doubleword Offset */
#define SYSIO_UEAFSR_SIZE 0x00001c0000000000 /* Bad transfer size is 2**SIZE */
#define SYSIO_UEAFSR_MID 0x000003e000000000 /* UPA MID causing the fault */
#define SYSIO_UEAFSR_RESV2 0x0000001fffffffff /* Reserved */
#define SYSIO_UEAFSR_PPIO 0x8000000000000000UL /* Primary PIO cause */
#define SYSIO_UEAFSR_PDRD 0x4000000000000000UL /* Primary DVMA read cause */
#define SYSIO_UEAFSR_PDWR 0x2000000000000000UL /* Primary DVMA write cause */
#define SYSIO_UEAFSR_SPIO 0x1000000000000000UL /* Secondary PIO is cause */
#define SYSIO_UEAFSR_SDRD 0x0800000000000000UL /* Secondary DVMA read cause */
#define SYSIO_UEAFSR_SDWR 0x0400000000000000UL /* Secondary DVMA write cause*/
#define SYSIO_UEAFSR_RESV1 0x03ff000000000000UL /* Reserved */
#define SYSIO_UEAFSR_DOFF 0x0000e00000000000UL /* Doubleword Offset */
#define SYSIO_UEAFSR_SIZE 0x00001c0000000000UL /* Bad transfer size 2^SIZE */
#define SYSIO_UEAFSR_MID 0x000003e000000000UL /* UPA MID causing the fault */
#define SYSIO_UEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */
static irqreturn_t sysio_ue_handler(int irq, void *dev_id, struct pt_regs *regs)
{
struct sbus_bus *sbus = dev_id;
......@@ -881,18 +881,18 @@ static irqreturn_t sysio_ue_handler(int irq, void *dev_id, struct pt_regs *regs)
#define SYSIO_CE_AFSR 0x0040UL
#define SYSIO_CE_AFAR 0x0048UL
#define SYSIO_CEAFSR_PPIO 0x8000000000000000 /* Primary PIO is cause */
#define SYSIO_CEAFSR_PDRD 0x4000000000000000 /* Primary DVMA read is cause */
#define SYSIO_CEAFSR_PDWR 0x2000000000000000 /* Primary DVMA write is cause */
#define SYSIO_CEAFSR_SPIO 0x1000000000000000 /* Secondary PIO is cause */
#define SYSIO_CEAFSR_SDRD 0x0800000000000000 /* Secondary DVMA read is cause */
#define SYSIO_CEAFSR_SDWR 0x0400000000000000 /* Secondary DVMA write is cause*/
#define SYSIO_CEAFSR_RESV1 0x0300000000000000 /* Reserved */
#define SYSIO_CEAFSR_ESYND 0x00ff000000000000 /* Syndrome Bits */
#define SYSIO_CEAFSR_DOFF 0x0000e00000000000 /* Double Offset */
#define SYSIO_CEAFSR_SIZE 0x00001c0000000000 /* Bad transfer size is 2**SIZE */
#define SYSIO_CEAFSR_MID 0x000003e000000000 /* UPA MID causing the fault */
#define SYSIO_CEAFSR_RESV2 0x0000001fffffffff /* Reserved */
#define SYSIO_CEAFSR_PPIO 0x8000000000000000UL /* Primary PIO cause */
#define SYSIO_CEAFSR_PDRD 0x4000000000000000UL /* Primary DVMA read cause */
#define SYSIO_CEAFSR_PDWR 0x2000000000000000UL /* Primary DVMA write cause */
#define SYSIO_CEAFSR_SPIO 0x1000000000000000UL /* Secondary PIO cause */
#define SYSIO_CEAFSR_SDRD 0x0800000000000000UL /* Secondary DVMA read cause */
#define SYSIO_CEAFSR_SDWR 0x0400000000000000UL /* Secondary DVMA write cause*/
#define SYSIO_CEAFSR_RESV1 0x0300000000000000UL /* Reserved */
#define SYSIO_CEAFSR_ESYND 0x00ff000000000000UL /* Syndrome Bits */
#define SYSIO_CEAFSR_DOFF 0x0000e00000000000UL /* Double Offset */
#define SYSIO_CEAFSR_SIZE 0x00001c0000000000UL /* Bad transfer size 2^SIZE */
#define SYSIO_CEAFSR_MID 0x000003e000000000UL /* UPA MID causing the fault */
#define SYSIO_CEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */
static irqreturn_t sysio_ce_handler(int irq, void *dev_id, struct pt_regs *regs)
{
struct sbus_bus *sbus = dev_id;
......@@ -958,18 +958,18 @@ static irqreturn_t sysio_ce_handler(int irq, void *dev_id, struct pt_regs *regs)
#define SYSIO_SBUS_AFSR 0x2010UL
#define SYSIO_SBUS_AFAR 0x2018UL
#define SYSIO_SBAFSR_PLE 0x8000000000000000 /* Primary Late PIO Error */
#define SYSIO_SBAFSR_PTO 0x4000000000000000 /* Primary SBUS Timeout */
#define SYSIO_SBAFSR_PBERR 0x2000000000000000 /* Primary SBUS Error ACK */
#define SYSIO_SBAFSR_SLE 0x1000000000000000 /* Secondary Late PIO Error */
#define SYSIO_SBAFSR_STO 0x0800000000000000 /* Secondary SBUS Timeout */
#define SYSIO_SBAFSR_SBERR 0x0400000000000000 /* Secondary SBUS Error ACK */
#define SYSIO_SBAFSR_RESV1 0x03ff000000000000 /* Reserved */
#define SYSIO_SBAFSR_RD 0x0000800000000000 /* Primary was late PIO read */
#define SYSIO_SBAFSR_RESV2 0x0000600000000000 /* Reserved */
#define SYSIO_SBAFSR_SIZE 0x00001c0000000000 /* Size of transfer */
#define SYSIO_SBAFSR_MID 0x000003e000000000 /* MID causing the error */
#define SYSIO_SBAFSR_RESV3 0x0000001fffffffff /* Reserved */
#define SYSIO_SBAFSR_PLE 0x8000000000000000UL /* Primary Late PIO Error */
#define SYSIO_SBAFSR_PTO 0x4000000000000000UL /* Primary SBUS Timeout */
#define SYSIO_SBAFSR_PBERR 0x2000000000000000UL /* Primary SBUS Error ACK */
#define SYSIO_SBAFSR_SLE 0x1000000000000000UL /* Secondary Late PIO Error */
#define SYSIO_SBAFSR_STO 0x0800000000000000UL /* Secondary SBUS Timeout */
#define SYSIO_SBAFSR_SBERR 0x0400000000000000UL /* Secondary SBUS Error ACK */
#define SYSIO_SBAFSR_RESV1 0x03ff000000000000UL /* Reserved */
#define SYSIO_SBAFSR_RD 0x0000800000000000UL /* Primary was late PIO read */
#define SYSIO_SBAFSR_RESV2 0x0000600000000000UL /* Reserved */
#define SYSIO_SBAFSR_SIZE 0x00001c0000000000UL /* Size of transfer */
#define SYSIO_SBAFSR_MID 0x000003e000000000UL /* MID causing the error */
#define SYSIO_SBAFSR_RESV3 0x0000001fffffffffUL /* Reserved */
static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id, struct pt_regs *regs)
{
struct sbus_bus *sbus = dev_id;
......@@ -1030,9 +1030,9 @@ static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id, struct pt_reg
}
#define ECC_CONTROL 0x0020UL
#define SYSIO_ECNTRL_ECCEN 0x8000000000000000 /* Enable ECC Checking */
#define SYSIO_ECNTRL_UEEN 0x4000000000000000 /* Enable UE Interrupts */
#define SYSIO_ECNTRL_CEEN 0x2000000000000000 /* Enable CE Interrupts */
#define SYSIO_ECNTRL_ECCEN 0x8000000000000000UL /* Enable ECC Checking */
#define SYSIO_ECNTRL_UEEN 0x4000000000000000UL /* Enable UE Interrupts */
#define SYSIO_ECNTRL_CEEN 0x2000000000000000UL /* Enable CE Interrupts */
#define SYSIO_UE_INO 0x34
#define SYSIO_CE_INO 0x35
......
......@@ -293,7 +293,7 @@ int prom_callback(long *args)
unsigned long tte;
tte = args[3];
prom_printf("%lx ", (tte & 0x07FC000000000000) >> 50);
prom_printf("%lx ", (tte & 0x07FC000000000000UL) >> 50);
args[2] = 2;
args[args[1] + 3] = 0;
......
......@@ -42,7 +42,8 @@ static int do_signal(sigset_t *oldset, struct pt_regs * regs,
/* {set, get}context() needed for 64-bit SparcLinux userland. */
asmlinkage void sparc64_set_context(struct pt_regs *regs)
{
struct ucontext *ucp = (struct ucontext __user *) regs->u_regs[UREG_I0];
struct ucontext __user *ucp = (struct ucontext __user *)
regs->u_regs[UREG_I0];
mc_gregset_t __user *grp;
unsigned long pc, npc, tstate;
unsigned long fp, i7;
......@@ -139,7 +140,8 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs)
asmlinkage void sparc64_get_context(struct pt_regs *regs)
{
struct ucontext *ucp = (struct ucontext __user *) regs->u_regs[UREG_I0];
struct ucontext __user *ucp = (struct ucontext __user *)
regs->u_regs[UREG_I0];
mc_gregset_t __user *grp;
mcontext_t __user *mcp;
unsigned long fp, i7;
......@@ -427,7 +429,7 @@ void do_rt_sigreturn(struct pt_regs *regs)
call it and ignore errors. */
old_fs = get_fs();
set_fs(KERNEL_DS);
do_sigaltstack(&st, NULL, (unsigned long)sf);
do_sigaltstack((const stack_t __user *) &st, NULL, (unsigned long)sf);
set_fs(old_fs);
sigdelsetmask(&set, ~_BLOCKABLE);
......
......@@ -345,8 +345,10 @@ asmlinkage void do_sigreturn32(struct pt_regs *regs)
current_thread_info()->restart_block.fn = do_no_restart_syscall;
synchronize_user_stack();
if (test_thread_flag(TIF_NEWSIGNALS))
return do_new_sigreturn32(regs);
if (test_thread_flag(TIF_NEWSIGNALS)) {
do_new_sigreturn32(regs);
return;
}
scptr = (struct sigcontext32 __user *)
(regs->u_regs[UREG_I0] & 0x00000000ffffffffUL);
......@@ -469,7 +471,7 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
call it and ignore errors. */
old_fs = get_fs();
set_fs(KERNEL_DS);
do_sigaltstack(&st, NULL, (unsigned long)sf);
do_sigaltstack((stack_t __user *) &st, NULL, (unsigned long)sf);
set_fs(old_fs);
switch (_NSIG_WORDS) {
......@@ -1039,7 +1041,7 @@ asmlinkage int svr4_setcontext(svr4_ucontext_t __user *c, struct pt_regs *regs)
call it and ignore errors. */
old_fs = get_fs();
set_fs(KERNEL_DS);
do_sigaltstack(&st, NULL, regs->u_regs[UREG_I6]);
do_sigaltstack((stack_t __user *) &st, NULL, regs->u_regs[UREG_I6]);
set_fs(old_fs);
sigdelsetmask(&set, ~_BLOCKABLE);
......@@ -1361,7 +1363,8 @@ asmlinkage int do_sys32_sigaltstack(u32 ussa, u32 uossa, unsigned long sp)
uss.ss_sp = (void *) (long) u_ss_sp;
old_fs = get_fs();
set_fs(KERNEL_DS);
ret = do_sigaltstack(ussa ? &uss : NULL, uossa ? &uoss : NULL, sp);
ret = do_sigaltstack(ussa ? (stack_t __user *) &uss : NULL,
uossa ? (stack_t __user *) &uoss : NULL, sp);
set_fs(old_fs);
if (!ret && uossa && (put_user((long)uoss.ss_sp, &((stack_t32 __user *)(long)uossa)->ss_sp) ||
__put_user(uoss.ss_flags, &((stack_t32 __user *)(long)uossa)->ss_flags) ||
......
......@@ -104,10 +104,11 @@ asmlinkage int sunos_ioctl (int fd, u32 cmd, u32 arg)
if(cmd == TIOCSETD) {
mm_segment_t old_fs = get_fs();
int *p, ntty = N_TTY;
int __user *p;
int ntty = N_TTY;
int tmp;
p = (int *)A(arg);
p = (int __user *)A(arg);
ret = -EFAULT;
if(get_user(tmp, p))
goto out;
......@@ -237,10 +238,10 @@ asmlinkage int sunos_ioctl (int fd, u32 cmd, u32 arg)
/* Non posix grp */
case _IOW('t', 118, int): {
int oldval, newval, *ptr;
int oldval, newval, __user *ptr;
cmd = TIOCSPGRP;
ptr = (int *) A(arg);
ptr = (int __user *) A(arg);
ret = -EFAULT;
if(get_user(oldval, ptr))
goto out;
......@@ -256,10 +257,10 @@ asmlinkage int sunos_ioctl (int fd, u32 cmd, u32 arg)
}
case _IOR('t', 119, int): {
int oldval, newval, *ptr;
int oldval, newval, __user *ptr;
cmd = TIOCGPGRP;
ptr = (int *) A(arg);
ptr = (int __user *) A(arg);
ret = -EFAULT;
if(get_user(oldval, ptr))
goto out;
......
......@@ -208,10 +208,10 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir
if (call <= SEMCTL)
switch (call) {
case SEMOP:
err = sys_semtimedop (first, (struct sembuf *)ptr, second, NULL);
err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL);
goto out;
case SEMTIMEDOP:
err = sys_semtimedop (first, (struct sembuf *)ptr, second, (const struct timespec *) fifth);
err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, (const struct timespec __user *) fifth);
goto out;
case SEMGET:
err = sys_semget (first, second, (int)third);
......@@ -222,7 +222,7 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir
if (!ptr)
goto out;
err = -EFAULT;
if(get_user(fourth.__pad, (void **)ptr))
if (get_user(fourth.__pad, (void __user * __user *)ptr))
goto out;
err = sys_semctl (first, second | IPC_64, (int)third, fourth);
goto out;
......@@ -234,17 +234,17 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir
if (call <= MSGCTL)
switch (call) {
case MSGSND:
err = sys_msgsnd (first, (struct msgbuf *) ptr,
err = sys_msgsnd (first, (struct msgbuf __user *) ptr,
second, (int)third);
goto out;
case MSGRCV:
err = sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, (int)third);
err = sys_msgrcv (first, (struct msgbuf __user *) ptr, second, fifth, (int)third);
goto out;
case MSGGET:
err = sys_msgget ((key_t) first, second);
goto out;
case MSGCTL:
err = sys_msgctl (first, second | IPC_64, (struct msqid_ds *) ptr);
err = sys_msgctl (first, second | IPC_64, (struct msqid_ds __user *) ptr);
goto out;
default:
err = -ENOSYS;
......@@ -254,7 +254,7 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir
switch (call) {
case SHMAT: {
ulong raddr;
err = do_shmat (first, (char *) ptr, second, &raddr);
err = do_shmat (first, (char __user *) ptr, second, &raddr);
if (!err) {
if (put_user(raddr, (ulong __user *) third))
err = -EFAULT;
......@@ -262,13 +262,13 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir
goto out;
}
case SHMDT:
err = sys_shmdt ((char *)ptr);
err = sys_shmdt ((char __user *)ptr);
goto out;
case SHMGET:
err = sys_shmget (first, second, (int)third);
goto out;
case SHMCTL:
err = sys_shmctl (first, second | IPC_64, (struct shmid_ds *) ptr);
err = sys_shmctl (first, second | IPC_64, (struct shmid_ds __user *) ptr);
goto out;
default:
err = -ENOSYS;
......@@ -636,8 +636,8 @@ sys_perfctr(int opcode, unsigned long arg0, unsigned long arg1, unsigned long ar
switch(opcode) {
case PERFCTR_ON:
current_thread_info()->pcr_reg = arg2;
current_thread_info()->user_cntd0 = (u64 *) arg0;
current_thread_info()->user_cntd1 = (u64 *) arg1;
current_thread_info()->user_cntd0 = (u64 __user *) arg0;
current_thread_info()->user_cntd1 = (u64 __user *) arg1;
current_thread_info()->kernel_cntd0 =
current_thread_info()->kernel_cntd1 = 0;
write_pcr(arg2);
......@@ -684,7 +684,8 @@ sys_perfctr(int opcode, unsigned long arg0, unsigned long arg1, unsigned long ar
break;
case PERFCTR_SETPCR: {
u64 *user_pcr = (u64 *)arg0;
u64 __user *user_pcr = (u64 __user *)arg0;
if (!test_thread_flag(TIF_PERFCTR)) {
err = -EINVAL;
break;
......@@ -698,7 +699,8 @@ sys_perfctr(int opcode, unsigned long arg0, unsigned long arg1, unsigned long ar
}
case PERFCTR_GETPCR: {
u64 *user_pcr = (u64 *)arg0;
u64 __user *user_pcr = (u64 __user *)arg0;
if (!test_thread_flag(TIF_PERFCTR)) {
err = -EINVAL;
break;
......
......@@ -87,12 +87,12 @@
})
asmlinkage long sys32_chown16(const char * filename, u16 user, u16 group)
asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group)
{
return sys_chown(filename, low2highuid(user), low2highgid(group));
}
asmlinkage long sys32_lchown16(const char * filename, u16 user, u16 group)
asmlinkage long sys32_lchown16(const char __user * filename, u16 user, u16 group)
{
return sys_lchown(filename, low2highuid(user), low2highgid(group));
}
......@@ -128,7 +128,7 @@ asmlinkage long sys32_setresuid16(u16 ruid, u16 euid, u16 suid)
low2highuid(suid));
}
asmlinkage long sys32_getresuid16(u16 *ruid, u16 *euid, u16 *suid)
asmlinkage long sys32_getresuid16(u16 __user *ruid, u16 __user *euid, u16 __user *suid)
{
int retval;
......@@ -145,7 +145,7 @@ asmlinkage long sys32_setresgid16(u16 rgid, u16 egid, u16 sgid)
low2highgid(sgid));
}
asmlinkage long sys32_getresgid16(u16 *rgid, u16 *egid, u16 *sgid)
asmlinkage long sys32_getresgid16(u16 __user *rgid, u16 __user *egid, u16 __user *sgid)
{
int retval;
......@@ -166,7 +166,7 @@ asmlinkage long sys32_setfsgid16(u16 gid)
return sys_setfsgid((gid_t)gid);
}
static int groups16_to_user(u16 *grouplist, struct group_info *group_info)
static int groups16_to_user(u16 __user *grouplist, struct group_info *group_info)
{
int i;
u16 group;
......@@ -180,7 +180,7 @@ static int groups16_to_user(u16 *grouplist, struct group_info *group_info)
return 0;
}
static int groups16_from_user(struct group_info *group_info, u16 *grouplist)
static int groups16_from_user(struct group_info *group_info, u16 __user *grouplist)
{
int i;
u16 group;
......@@ -194,7 +194,7 @@ static int groups16_from_user(struct group_info *group_info, u16 *grouplist)
return 0;
}
asmlinkage long sys32_getgroups16(int gidsetsize, u16 *grouplist)
asmlinkage long sys32_getgroups16(int gidsetsize, u16 __user *grouplist)
{
int i;
......@@ -218,7 +218,7 @@ asmlinkage long sys32_getgroups16(int gidsetsize, u16 *grouplist)
return i;
}
asmlinkage long sys32_setgroups16(int gidsetsize, u16 *grouplist)
asmlinkage long sys32_setgroups16(int gidsetsize, u16 __user *grouplist)
{
struct group_info *group_info;
int retval;
......@@ -265,14 +265,14 @@ asmlinkage long sys32_getegid16(void)
/* 32-bit timeval and related flotsam. */
static long get_tv32(struct timeval *o, struct compat_timeval *i)
static long get_tv32(struct timeval *o, struct compat_timeval __user *i)
{
return (!access_ok(VERIFY_READ, tv32, sizeof(*tv32)) ||
(__get_user(o->tv_sec, &i->tv_sec) |
__get_user(o->tv_usec, &i->tv_usec)));
}
static inline long put_tv32(struct compat_timeval *o, struct timeval *i)
static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i)
{
return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
(__put_user(i->tv_sec, &o->tv_sec) |
......@@ -392,12 +392,12 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr)
if (!uptr)
goto out;
err = -EFAULT;
if (get_user (pad, (u32 *)uptr))
if (get_user (pad, (u32 __user *)uptr))
goto out;
if ((third & ~IPC_64) == SETVAL)
fourth.val = (int)pad;
else
fourth.__pad = (void *)A(pad);
fourth.__pad = (void __user *)A(pad);
if (IPCOP_MASK (third) &
(IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SEM_INFO) | IPCOP_MASK (GETVAL) |
IPCOP_MASK (GETPID) | IPCOP_MASK (GETNCNT) | IPCOP_MASK (GETZCNT) |
......@@ -405,7 +405,8 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr)
err = sys_semctl (first, second, third, fourth);
} else if (third & IPC_64) {
struct semid64_ds s;
struct semid64_ds32 *usp = (struct semid64_ds32 *)A(pad);
struct semid64_ds32 __user *usp =
(struct semid64_ds32 __user *)A(pad);
mm_segment_t old_fs;
int need_back_translation;
......@@ -415,13 +416,13 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr)
err |= __get_user (s.sem_perm.mode, &usp->sem_perm.mode);
if (err)
goto out;
fourth.__pad = &s;
fourth.__pad = (void __user *) &s;
}
need_back_translation =
(IPCOP_MASK (third) &
(IPCOP_MASK (SEM_STAT) | IPCOP_MASK (IPC_STAT))) != 0;
if (need_back_translation)
fourth.__pad = &s;
fourth.__pad = (void __user *) &s;
old_fs = get_fs ();
set_fs (KERNEL_DS);
err = sys_semctl (first, second, third, fourth);
......@@ -433,7 +434,8 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr)
}
} else {
struct semid_ds s;
struct semid_ds32 *usp = (struct semid_ds32 *)A(pad);
struct semid_ds32 __user *usp =
(struct semid_ds32 __user *)A(pad);
mm_segment_t old_fs;
int need_back_translation;
......@@ -443,13 +445,13 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr)
err |= __get_user (s.sem_perm.mode, &usp->sem_perm.mode);
if (err)
goto out;
fourth.__pad = &s;
fourth.__pad = (void __user *) &s;
}
need_back_translation =
(IPCOP_MASK (third) &
(IPCOP_MASK (SEM_STAT) | IPCOP_MASK (IPC_STAT))) != 0;
if (need_back_translation)
fourth.__pad = &s;
fourth.__pad = (void __user *) &s;
old_fs = get_fs ();
set_fs (KERNEL_DS);
err = sys_semctl (first, second, third, fourth);
......@@ -475,7 +477,7 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr)
static int do_sys32_msgsnd (int first, int second, int third, void *uptr)
{
struct msgbuf *p = kmalloc (second + sizeof (struct msgbuf), GFP_USER);
struct msgbuf32 *up = (struct msgbuf32 *)uptr;
struct msgbuf32 __user *up = (struct msgbuf32 __user *) uptr;
mm_segment_t old_fs;
int err;
......@@ -487,7 +489,7 @@ static int do_sys32_msgsnd (int first, int second, int third, void *uptr)
goto out;
old_fs = get_fs ();
set_fs (KERNEL_DS);
err = sys_msgsnd (first, p, second, third);
err = sys_msgsnd (first, (struct msgbuf __user *) p, second, third);
set_fs (old_fs);
out:
kfree (p);
......@@ -497,13 +499,14 @@ static int do_sys32_msgsnd (int first, int second, int third, void *uptr)
static int do_sys32_msgrcv (int first, int second, int msgtyp, int third,
int version, void *uptr)
{
struct msgbuf32 *up;
struct msgbuf32 __user *up;
struct msgbuf *p;
mm_segment_t old_fs;
int err;
if (!version) {
struct ipc_kludge *uipck = (struct ipc_kludge *)uptr;
struct ipc_kludge __user *uipck =
(struct ipc_kludge __user *) uptr;
struct ipc_kludge ipck;
err = -EINVAL;
......@@ -521,11 +524,12 @@ static int do_sys32_msgrcv (int first, int second, int msgtyp, int third,
goto out;
old_fs = get_fs ();
set_fs (KERNEL_DS);
err = sys_msgrcv (first, p, second, msgtyp, third);
err = sys_msgrcv (first, (struct msgbuf __user *) p, second,
msgtyp, third);
set_fs (old_fs);
if (err < 0)
goto free_then_out;
up = (struct msgbuf32 *)uptr;
up = (struct msgbuf32 __user *) uptr;
if (put_user (p->mtype, &up->mtype) ||
__copy_to_user (&up->mtext, p->mtext, err))
err = -EFAULT;
......@@ -542,10 +546,12 @@ static int do_sys32_msgctl (int first, int second, void *uptr)
if (IPCOP_MASK (second) &
(IPCOP_MASK (IPC_INFO) | IPCOP_MASK (MSG_INFO) |
IPCOP_MASK (IPC_RMID))) {
err = sys_msgctl (first, second, (struct msqid_ds *)uptr);
err = sys_msgctl (first, second,
(struct msqid_ds __user *)uptr);
} else if (second & IPC_64) {
struct msqid64_ds m;
struct msqid64_ds32 *up = (struct msqid64_ds32 *)uptr;
struct msqid64_ds32 __user *up =
(struct msqid64_ds32 __user *) uptr;
mm_segment_t old_fs;
if (second == (IPC_SET|IPC_64)) {
......@@ -558,7 +564,7 @@ static int do_sys32_msgctl (int first, int second, void *uptr)
}
old_fs = get_fs ();
set_fs (KERNEL_DS);
err = sys_msgctl (first, second, (struct msqid_ds *)&m);
err = sys_msgctl (first, second, (struct msqid_ds __user *)&m);
set_fs (old_fs);
if (IPCOP_MASK (second) &
(IPCOP_MASK (MSG_STAT) | IPCOP_MASK (IPC_STAT))) {
......@@ -573,7 +579,8 @@ static int do_sys32_msgctl (int first, int second, void *uptr)
}
} else {
struct msqid_ds m;
struct msqid_ds32 *up = (struct msqid_ds32 *)uptr;
struct msqid_ds32 __user *up =
(struct msqid_ds32 __user *)uptr;
mm_segment_t old_fs;
if (second == IPC_SET) {
......@@ -586,7 +593,7 @@ static int do_sys32_msgctl (int first, int second, void *uptr)
}
old_fs = get_fs ();
set_fs (KERNEL_DS);
err = sys_msgctl (first, second, &m);
err = sys_msgctl (first, second, (struct msqid_ds __user *) &m);
set_fs (old_fs);
if (IPCOP_MASK (second) &
(IPCOP_MASK (MSG_STAT) | IPCOP_MASK (IPC_STAT))) {
......@@ -614,10 +621,10 @@ static int do_sys32_msgctl (int first, int second, void *uptr)
return err;
}
static int do_sys32_shmat (int first, int second, int third, int version, void *uptr)
static int do_sys32_shmat (int first, int second, int third, int version, void __user *uptr)
{
unsigned long raddr;
u32 *uaddr = (u32 *)A((u32)third);
u32 __user *uaddr = (u32 __user *)A((u32)third);
int err = -EINVAL;
if (version == 1)
......@@ -639,10 +646,12 @@ static int do_sys32_shmctl (int first, int second, void *uptr)
IPCOP_MASK (IPC_RMID))) {
if (second == (IPC_INFO|IPC_64))
second = IPC_INFO; /* So that we don't have to translate it */
err = sys_shmctl (first, second, (struct shmid_ds *)uptr);
err = sys_shmctl (first, second,
(struct shmid_ds __user *) uptr);
} else if ((second & IPC_64) && second != (SHM_INFO|IPC_64)) {
struct shmid64_ds s;
struct shmid64_ds32 *up = (struct shmid64_ds32 *)uptr;
struct shmid64_ds32 __user *up =
(struct shmid64_ds32 __user *) uptr;
mm_segment_t old_fs;
if (second == (IPC_SET|IPC_64)) {
......@@ -654,7 +663,7 @@ static int do_sys32_shmctl (int first, int second, void *uptr)
}
old_fs = get_fs ();
set_fs (KERNEL_DS);
err = sys_shmctl (first, second, (struct shmid_ds *)&s);
err = sys_shmctl (first, second, (struct shmid_ds __user *)&s);
set_fs (old_fs);
if (err < 0)
goto out;
......@@ -672,7 +681,8 @@ static int do_sys32_shmctl (int first, int second, void *uptr)
}
} else {
struct shmid_ds s;
struct shmid_ds32 *up = (struct shmid_ds32 *)uptr;
struct shmid_ds32 __user *up =
(struct shmid_ds32 __user *) uptr;
mm_segment_t old_fs;
second &= ~IPC_64;
......@@ -685,7 +695,7 @@ static int do_sys32_shmctl (int first, int second, void *uptr)
}
old_fs = get_fs ();
set_fs (KERNEL_DS);
err = sys_shmctl (first, second, &s);
err = sys_shmctl (first, second, (struct shmid_ds __user *) &s);
set_fs (old_fs);
if (err < 0)
goto out;
......@@ -696,7 +706,9 @@ static int do_sys32_shmctl (int first, int second, void *uptr)
int used_ids;
u32 shm_tot, shm_rss, shm_swp;
u32 swap_attempts, swap_successes;
} *uip = (struct shm_info32 *)uptr;
};
struct shm_info32 __user *uip =
(struct shm_info32 __user *) uptr;
struct shm_info *kp = (struct shm_info *)&s;
int err2 = put_user (kp->used_ids, &uip->used_ids);
err2 |= __put_user (kp->shm_tot, &uip->shm_tot);
......@@ -730,11 +742,11 @@ static int do_sys32_shmctl (int first, int second, void *uptr)
return err;
}
static int sys32_semtimedop(int semid, struct sembuf *tsems, int nsems,
const struct compat_timespec *timeout32)
static int sys32_semtimedop(int semid, struct sembuf __user *tsems, int nsems,
const struct compat_timespec __user *timeout32)
{
struct compat_timespec t32;
struct timespec *t64 = compat_alloc_user_space(sizeof(*t64));
struct timespec __user *t64 = compat_alloc_user_space(sizeof(*t64));
if (copy_from_user(&t32, timeout32, sizeof(t32)))
return -EFAULT;
......@@ -757,10 +769,10 @@ asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u
switch (call) {
case SEMOP:
/* struct sembuf is the same on 32 and 64bit :)) */
err = sys_semtimedop (first, (struct sembuf *)AA(ptr), second, NULL);
err = sys_semtimedop (first, (struct sembuf __user *)AA(ptr), second, NULL);
goto out;
case SEMTIMEDOP:
err = sys32_semtimedop (first, (struct sembuf *)AA(ptr), second, (const struct compat_timespec *) AA(fifth));
err = sys32_semtimedop (first, (struct sembuf __user *)AA(ptr), second, (const struct compat_timespec __user *) AA(fifth));
case SEMGET:
err = sys_semget (first, second, third);
goto out;
......@@ -794,10 +806,10 @@ asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u
switch (call) {
case SHMAT:
err = do_sys32_shmat (first, second, third,
version, (void *)AA(ptr));
version, (void __user *)AA(ptr));
goto out;
case SHMDT:
err = sys_shmdt ((char *)AA(ptr));
err = sys_shmdt ((char __user *)AA(ptr));
goto out;
case SHMGET:
err = sys_shmget (first, second, third);
......@@ -816,7 +828,7 @@ asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u
return err;
}
asmlinkage int sys32_truncate64(const char * path, unsigned long high, unsigned long low)
asmlinkage int sys32_truncate64(const char __user * path, unsigned long high, unsigned long low)
{
if ((int)high < 0)
return -EINVAL;
......@@ -834,7 +846,7 @@ asmlinkage int sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned l
/* readdir & getdents */
#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
#define ROUND_UP(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
struct old_linux_dirent32 {
......@@ -845,7 +857,7 @@ struct old_linux_dirent32 {
};
struct readdir_callback32 {
struct old_linux_dirent32 * dirent;
struct old_linux_dirent32 __user * dirent;
int count;
};
......@@ -853,7 +865,7 @@ static int fillonedir(void * __buf, const char * name, int namlen,
loff_t offset, ino_t ino, unsigned int d_type)
{
struct readdir_callback32 * buf = (struct readdir_callback32 *) __buf;
struct old_linux_dirent32 * dirent;
struct old_linux_dirent32 __user * dirent;
if (buf->count)
return -EINVAL;
......@@ -867,7 +879,7 @@ static int fillonedir(void * __buf, const char * name, int namlen,
return 0;
}
asmlinkage int old32_readdir(unsigned int fd, struct old_linux_dirent32 *dirent, unsigned int count)
asmlinkage int old32_readdir(unsigned int fd, struct old_linux_dirent32 __user *dirent, unsigned int count)
{
int error = -EBADF;
struct file * file;
......@@ -899,8 +911,8 @@ struct linux_dirent32 {
};
struct getdents_callback32 {
struct linux_dirent32 * current_dir;
struct linux_dirent32 * previous;
struct linux_dirent32 __user *current_dir;
struct linux_dirent32 __user *previous;
int count;
int error;
};
......@@ -908,7 +920,7 @@ struct getdents_callback32 {
static int filldir(void * __buf, const char * name, int namlen, loff_t offset, ino_t ino,
unsigned int d_type)
{
struct linux_dirent32 * dirent;
struct linux_dirent32 __user * dirent;
struct getdents_callback32 * buf = (struct getdents_callback32 *) __buf;
int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 2);
......@@ -924,17 +936,17 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, i
put_user(reclen, &dirent->d_reclen);
copy_to_user(dirent->d_name, name, namlen);
put_user(0, dirent->d_name + namlen);
put_user(d_type, (char *) dirent + reclen - 1);
dirent = (void *) dirent + reclen;
put_user(d_type, (char __user *) dirent + reclen - 1);
dirent = (void __user *) dirent + reclen;
buf->current_dir = dirent;
buf->count -= reclen;
return 0;
}
asmlinkage int sys32_getdents(unsigned int fd, struct linux_dirent32 *dirent, unsigned int count)
asmlinkage int sys32_getdents(unsigned int fd, struct linux_dirent32 __user *dirent, unsigned int count)
{
struct file * file;
struct linux_dirent32 * lastdirent;
struct linux_dirent32 __user *lastdirent;
struct getdents_callback32 buf;
int error = -EBADF;
......@@ -964,7 +976,7 @@ asmlinkage int sys32_getdents(unsigned int fd, struct linux_dirent32 *dirent, un
/* end of readdir & getdents */
int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
{
int err;
......@@ -1016,7 +1028,7 @@ struct sysinfo32 {
char _f[20-2*sizeof(int)-sizeof(int)];
};
asmlinkage int sys32_sysinfo(struct sysinfo32 *info)
asmlinkage int sys32_sysinfo(struct sysinfo32 __user *info)
{
struct sysinfo s;
int ret, err;
......@@ -1024,7 +1036,7 @@ asmlinkage int sys32_sysinfo(struct sysinfo32 *info)
mm_segment_t old_fs = get_fs ();
set_fs(KERNEL_DS);
ret = sys_sysinfo(&s);
ret = sys_sysinfo((struct sysinfo __user *) &s);
set_fs(old_fs);
/* Check to see if any memory value is too large for 32-bit and
* scale down if needed.
......@@ -1063,21 +1075,21 @@ asmlinkage int sys32_sysinfo(struct sysinfo32 *info)
return ret;
}
asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec *interval)
asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *interval)
{
struct timespec t;
int ret;
mm_segment_t old_fs = get_fs ();
set_fs (KERNEL_DS);
ret = sys_sched_rr_get_interval(pid, &t);
ret = sys_sched_rr_get_interval(pid, (struct timespec __user *) &t);
set_fs (old_fs);
if (put_compat_timespec(&t, interval))
return -EFAULT;
return ret;
}
asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset, compat_size_t sigsetsize)
asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, compat_sigset_t __user *oset, compat_size_t sigsetsize)
{
sigset_t s;
compat_sigset_t s32;
......@@ -1095,7 +1107,10 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset
}
}
set_fs (KERNEL_DS);
ret = sys_rt_sigprocmask(how, set ? &s : NULL, oset ? &s : NULL, sigsetsize);
ret = sys_rt_sigprocmask(how,
set ? (sigset_t __user *) &s : NULL,
oset ? (sigset_t __user *) &s : NULL,
sigsetsize);
set_fs (old_fs);
if (ret) return ret;
if (oset) {
......@@ -1111,7 +1126,7 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset
return 0;
}
asmlinkage int sys32_rt_sigpending(compat_sigset_t *set, compat_size_t sigsetsize)
asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *set, compat_size_t sigsetsize)
{
sigset_t s;
compat_sigset_t s32;
......@@ -1119,7 +1134,7 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t *set, compat_size_t sigsetsiz
mm_segment_t old_fs = get_fs();
set_fs (KERNEL_DS);
ret = sys_rt_sigpending(&s, sigsetsize);
ret = sys_rt_sigpending((sigset_t __user *) &s, sigsetsize);
set_fs (old_fs);
if (!ret) {
switch (_NSIG_WORDS) {
......@@ -1135,8 +1150,9 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t *set, compat_size_t sigsetsiz
}
asmlinkage int
sys32_rt_sigtimedwait(compat_sigset_t *uthese, siginfo_t32 *uinfo,
struct compat_timespec *uts, compat_size_t sigsetsize)
sys32_rt_sigtimedwait(compat_sigset_t __user *uthese, siginfo_t32 __user *uinfo,
struct compat_timespec __user *uts,
compat_size_t sigsetsize)
{
int ret, sig;
sigset_t these;
......@@ -1219,7 +1235,7 @@ sys32_rt_sigtimedwait(compat_sigset_t *uthese, siginfo_t32 *uinfo,
}
asmlinkage int
sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 *uinfo)
sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 __user *uinfo)
{
siginfo_t info;
int ret;
......@@ -1229,12 +1245,13 @@ sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 *uinfo)
copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE))
return -EFAULT;
set_fs (KERNEL_DS);
ret = sys_rt_sigqueueinfo(pid, sig, &info);
ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *) &info);
set_fs (old_fs);
return ret;
}
asmlinkage int sys32_sigaction (int sig, struct old_sigaction32 *act, struct old_sigaction32 *oact)
asmlinkage int sys32_sigaction (int sig, struct old_sigaction32 __user *act,
struct old_sigaction32 __user *oact)
{
struct k_sigaction new_ka, old_ka;
int ret;
......@@ -1273,8 +1290,9 @@ asmlinkage int sys32_sigaction (int sig, struct old_sigaction32 *act, struct old
}
asmlinkage int
sys32_rt_sigaction(int sig, struct sigaction32 *act, struct sigaction32 *oact,
void *restorer, compat_size_t sigsetsize)
sys32_rt_sigaction(int sig, struct sigaction32 __user *act,
struct sigaction32 __user *oact,
void __user *restorer, compat_size_t sigsetsize)
{
struct k_sigaction new_ka, old_ka;
int ret;
......@@ -1344,7 +1362,7 @@ asmlinkage int sparc32_execve(struct pt_regs *regs)
if((u32)regs->u_regs[UREG_G1] == 0)
base = 1;
filename = getname((char *)AA(regs->u_regs[base + UREG_I0]));
filename = getname((char __user *)AA(regs->u_regs[base + UREG_I0]));
error = PTR_ERR(filename);
if(IS_ERR(filename))
goto out;
......@@ -1366,12 +1384,14 @@ asmlinkage int sparc32_execve(struct pt_regs *regs)
#ifdef CONFIG_MODULES
asmlinkage int sys32_init_module(void *umod, u32 len, const char *uargs)
asmlinkage int sys32_init_module(void __user *umod, u32 len,
const char __user *uargs)
{
return sys_init_module(umod, len, uargs);
}
asmlinkage int sys32_delete_module(const char *name_user, unsigned int flags)
asmlinkage int sys32_delete_module(const char __user *name_user,
unsigned int flags)
{
return sys_delete_module(name_user, flags);
}
......@@ -1397,7 +1417,8 @@ sys32_delete_module(const char *name_user)
extern struct timezone sys_tz;
asmlinkage int sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
asmlinkage int sys32_gettimeofday(struct compat_timeval __user *tv,
struct timezone __user *tz)
{
if (tv) {
struct timeval ktv;
......@@ -1412,7 +1433,7 @@ asmlinkage int sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz
return 0;
}
static inline long get_ts32(struct timespec *o, struct compat_timeval *i)
static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
{
long usec;
......@@ -1426,7 +1447,8 @@ static inline long get_ts32(struct timespec *o, struct compat_timeval *i)
return 0;
}
asmlinkage int sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
asmlinkage int sys32_settimeofday(struct compat_timeval __user *tv,
struct timezone __user *tz)
{
struct timespec kts;
struct timezone ktz;
......@@ -1443,7 +1465,8 @@ asmlinkage int sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz
return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
}
asmlinkage int sys32_utimes(char *filename, struct compat_timeval *tvs)
asmlinkage int sys32_utimes(char __user *filename,
struct compat_timeval __user *tvs)
{
struct timeval ktvs[2];
......@@ -1472,7 +1495,7 @@ asmlinkage int sys32_pciconfig_read(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf
(unsigned long) dfn,
(unsigned long) off,
(unsigned long) len,
(unsigned char *)AA(ubuf));
(unsigned char __user *)AA(ubuf));
}
asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf)
......@@ -1481,7 +1504,7 @@ asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubu
(unsigned long) dfn,
(unsigned long) off,
(unsigned long) len,
(unsigned char *)AA(ubuf));
(unsigned char __user *)AA(ubuf));
}
asmlinkage int sys32_prctl(int option, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
......@@ -1494,13 +1517,15 @@ asmlinkage int sys32_prctl(int option, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
}
asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, char *ubuf,
compat_size_t count, u32 poshi, u32 poslo)
asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, char __user *ubuf,
compat_size_t count,
u32 poshi, u32 poslo)
{
return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
return sys_pread64(fd, ubuf, count,
((loff_t)AA(poshi) << 32) | AA(poslo));
}
asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd, char *ubuf,
asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd, char __user *ubuf,
compat_size_t count, u32 poshi, u32 poslo)
{
return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
......@@ -1522,7 +1547,7 @@ long sys32_fadvise64_64(int fd, u32 offhi, u32 offlo, u32 lenhi, u32 lenlo, int
((loff_t)AA(lenhi)<<32)|AA(lenlo), advice);
}
asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count)
asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
{
mm_segment_t old_fs = get_fs();
int ret;
......@@ -1532,7 +1557,9 @@ asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 c
return -EFAULT;
set_fs(KERNEL_DS);
ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
ret = sys_sendfile(out_fd, in_fd,
offset ? (off_t __user *) &of : NULL,
count);
set_fs(old_fs);
if (offset && put_user(of, offset))
......@@ -1541,7 +1568,7 @@ asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 c
return ret;
}
asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t *offset, s32 count)
asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, s32 count)
{
mm_segment_t old_fs = get_fs();
int ret;
......@@ -1551,7 +1578,9 @@ asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t *offset, s3
return -EFAULT;
set_fs(KERNEL_DS);
ret = sys_sendfile64(out_fd, in_fd, offset ? &lof : NULL, count);
ret = sys_sendfile64(out_fd, in_fd,
offset ? (loff_t __user *) &lof : NULL,
count);
set_fs(old_fs);
if (offset && put_user(lof, offset))
......@@ -1577,7 +1606,7 @@ struct timex32 {
extern int do_adjtimex(struct timex *);
asmlinkage int sys32_adjtimex(struct timex32 *utp)
asmlinkage int sys32_adjtimex(struct timex32 __user *utp)
{
struct timex txc;
int ret;
......@@ -1637,7 +1666,7 @@ asmlinkage int sys32_adjtimex(struct timex32 *utp)
* not force O_LARGEFILE on.
*/
asmlinkage long sparc32_open(const char * filename, int flags, int mode)
asmlinkage long sparc32_open(const char __user *filename, int flags, int mode)
{
char * tmp;
int fd, error;
......@@ -1732,15 +1761,15 @@ struct __sysctl_args32 {
u32 __unused[4];
};
asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
{
#ifndef CONFIG_SYSCTL
return -ENOSYS;
#else
struct __sysctl_args32 tmp;
int error;
size_t oldlen, *oldlenp = NULL;
unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7;
size_t oldlen, __user *oldlenp = NULL;
unsigned long addr = (((unsigned long)&args->__unused[0]) + 7UL) & ~7UL;
if (copy_from_user(&tmp, args, sizeof(tmp)))
return -EFAULT;
......@@ -1752,20 +1781,21 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
basically copy the whole sysctl.c here, and
glibc's __sysctl uses rw memory for the structure
anyway. */
if (get_user(oldlen, (u32 *)A(tmp.oldlenp)) ||
put_user(oldlen, (size_t *)addr))
if (get_user(oldlen, (u32 __user *)A(tmp.oldlenp)) ||
put_user(oldlen, (size_t __user *)addr))
return -EFAULT;
oldlenp = (size_t *)addr;
oldlenp = (size_t __user *)addr;
}
lock_kernel();
error = do_sysctl((int *)A(tmp.name), tmp.nlen, (void *)A(tmp.oldval),
oldlenp, (void *)A(tmp.newval), tmp.newlen);
error = do_sysctl((int __user *)A(tmp.name), tmp.nlen,
(void __user *)A(tmp.oldval),
oldlenp, (void __user *)A(tmp.newval), tmp.newlen);
unlock_kernel();
if (oldlenp) {
if (!error) {
if (get_user(oldlen, (size_t *)addr) ||
put_user(oldlen, (u32 *)A(tmp.oldlenp)))
if (get_user(oldlen, (size_t __user *)addr) ||
put_user(oldlen, (u32 __user *)A(tmp.oldlenp)))
error = -EFAULT;
}
copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
......@@ -1774,18 +1804,21 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
#endif
}
long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char *buf, size_t len)
long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low,
char __user *buf, size_t len)
{
return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low,
buf, len);
}
extern asmlinkage long
sys_timer_create(clockid_t which_clock, struct sigevent *timer_event_spec,
timer_t * created_timer_id);
sys_timer_create(clockid_t which_clock,
struct sigevent __user *timer_event_spec,
timer_t __user *created_timer_id);
long
sys32_timer_create(u32 clock, struct sigevent32 *se32, timer_t *timer_id)
sys32_timer_create(u32 clock, struct sigevent32 __user *se32,
timer_t __user *timer_id)
{
struct sigevent se;
mm_segment_t oldfs;
......@@ -1808,7 +1841,9 @@ sys32_timer_create(u32 clock, struct sigevent32 *se32, timer_t *timer_id)
oldfs = get_fs();
set_fs(KERNEL_DS);
err = sys_timer_create(clock, &se, &t);
err = sys_timer_create(clock,
(struct sigevent __user *) &se,
(timer_t __user *) &t);
set_fs(oldfs);
if (!err)
......
......@@ -187,7 +187,7 @@ asmlinkage u32 sunos_sbrk(int increment)
/* This should do it hopefully... */
oldbrk = (int)current->mm->brk;
error = sunos_brk(((int) current->mm->brk) + increment);
if(!error)
if (!error)
error = oldbrk;
return error;
}
......@@ -273,19 +273,19 @@ struct sunos_dirent {
};
struct sunos_dirent_callback {
struct sunos_dirent *curr;
struct sunos_dirent *previous;
struct sunos_dirent __user *curr;
struct sunos_dirent __user *previous;
int count;
int error;
};
#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
#define ROUND_UP(x) (((x)+sizeof(s32)-1) & ~(sizeof(s32)-1))
static int sunos_filldir(void * __buf, const char * name, int namlen,
loff_t offset, ino_t ino, unsigned int d_type)
{
struct sunos_dirent * dirent;
struct sunos_dirent __user *dirent;
struct sunos_dirent_callback * buf = (struct sunos_dirent_callback *) __buf;
int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
......@@ -302,7 +302,7 @@ static int sunos_filldir(void * __buf, const char * name, int namlen,
put_user(reclen, &dirent->d_reclen);
copy_to_user(dirent->d_name, name, namlen);
put_user(0, dirent->d_name + namlen);
dirent = (void *) dirent + reclen;
dirent = (void __user *) dirent + reclen;
buf->curr = dirent;
buf->count -= reclen;
return 0;
......@@ -311,23 +311,23 @@ static int sunos_filldir(void * __buf, const char * name, int namlen,
asmlinkage int sunos_getdents(unsigned int fd, u32 u_dirent, int cnt)
{
struct file * file;
struct sunos_dirent * lastdirent;
struct sunos_dirent __user *lastdirent;
struct sunos_dirent_callback buf;
int error = -EBADF;
void *dirent = (void *)A(u_dirent);
void __user *dirent = (void __user *)A(u_dirent);
if(fd >= SUNOS_NR_OPEN)
if (fd >= SUNOS_NR_OPEN)
goto out;
file = fget(fd);
if(!file)
if (!file)
goto out;
error = -EINVAL;
if(cnt < (sizeof(struct sunos_dirent) + 255))
if (cnt < (sizeof(struct sunos_dirent) + 255))
goto out_putf;
buf.curr = (struct sunos_dirent *) dirent;
buf.curr = (struct sunos_dirent __user *) dirent;
buf.previous = NULL;
buf.count = cnt;
buf.error = 0;
......@@ -358,8 +358,8 @@ struct sunos_direntry {
};
struct sunos_direntry_callback {
struct sunos_direntry *curr;
struct sunos_direntry *previous;
struct sunos_direntry __user *curr;
struct sunos_direntry __user *previous;
int count;
int error;
};
......@@ -367,8 +367,9 @@ struct sunos_direntry_callback {
static int sunos_filldirentry(void * __buf, const char * name, int namlen,
loff_t offset, ino_t ino, unsigned int d_type)
{
struct sunos_direntry * dirent;
struct sunos_direntry_callback * buf = (struct sunos_direntry_callback *) __buf;
struct sunos_direntry __user *dirent;
struct sunos_direntry_callback * buf =
(struct sunos_direntry_callback *) __buf;
int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
buf->error = -EINVAL; /* only used if we fail.. */
......@@ -382,7 +383,7 @@ static int sunos_filldirentry(void * __buf, const char * name, int namlen,
put_user(reclen, &dirent->d_reclen);
copy_to_user(dirent->d_name, name, namlen);
put_user(0, dirent->d_name + namlen);
dirent = (void *) dirent + reclen;
dirent = (void __user *) dirent + reclen;
buf->curr = dirent;
buf->count -= reclen;
return 0;
......@@ -391,25 +392,25 @@ static int sunos_filldirentry(void * __buf, const char * name, int namlen,
asmlinkage int sunos_getdirentries(unsigned int fd, u32 u_dirent,
int cnt, u32 u_basep)
{
void *dirent = (void *) A(u_dirent);
unsigned int *basep = (unsigned int *)A(u_basep);
void __user *dirent = (void __user *) A(u_dirent);
unsigned int __user *basep = (unsigned int __user *)A(u_basep);
struct file * file;
struct sunos_direntry * lastdirent;
struct sunos_direntry __user *lastdirent;
int error = -EBADF;
struct sunos_direntry_callback buf;
if(fd >= SUNOS_NR_OPEN)
if (fd >= SUNOS_NR_OPEN)
goto out;
file = fget(fd);
if(!file)
if (!file)
goto out;
error = -EINVAL;
if(cnt < (sizeof(struct sunos_direntry) + 255))
if (cnt < (sizeof(struct sunos_direntry) + 255))
goto out_putf;
buf.curr = (struct sunos_direntry *) dirent;
buf.curr = (struct sunos_direntry __user *) dirent;
buf.previous = NULL;
buf.count = cnt;
buf.error = 0;
......@@ -440,17 +441,22 @@ struct sunos_utsname {
char mach[9];
};
asmlinkage int sunos_uname(struct sunos_utsname *name)
asmlinkage int sunos_uname(struct sunos_utsname __user *name)
{
int ret;
down_read(&uts_sem);
ret = copy_to_user(&name->sname[0], &system_utsname.sysname[0], sizeof(name->sname) - 1);
ret |= copy_to_user(&name->nname[0], &system_utsname.nodename[0], sizeof(name->nname) - 1);
ret = copy_to_user(&name->sname[0], &system_utsname.sysname[0],
sizeof(name->sname) - 1);
ret |= copy_to_user(&name->nname[0], &system_utsname.nodename[0],
sizeof(name->nname) - 1);
ret |= put_user('\0', &name->nname[8]);
ret |= copy_to_user(&name->rel[0], &system_utsname.release[0], sizeof(name->rel) - 1);
ret |= copy_to_user(&name->ver[0], &system_utsname.version[0], sizeof(name->ver) - 1);
ret |= copy_to_user(&name->mach[0], &system_utsname.machine[0], sizeof(name->mach) - 1);
ret |= copy_to_user(&name->rel[0], &system_utsname.release[0],
sizeof(name->rel) - 1);
ret |= copy_to_user(&name->ver[0], &system_utsname.version[0],
sizeof(name->ver) - 1);
ret |= copy_to_user(&name->mach[0], &system_utsname.machine[0],
sizeof(name->mach) - 1);
up_read(&uts_sem);
return (ret ? -EFAULT : 0);
}
......@@ -536,7 +542,7 @@ asmlinkage int sunos_select(int width, u32 inp, u32 outp, u32 exp, u32 tvp_x)
ret = compat_sys_select(width, compat_ptr(inp), compat_ptr(outp),
compat_ptr(exp), compat_ptr(tvp_x));
if (ret == -EINTR && tvp_x) {
struct compat_timeval *tvp = compat_ptr(tvp_x);
struct compat_timeval __user *tvp = compat_ptr(tvp_x);
time_t sec, usec;
__get_user(sec, &tvp->tv_sec);
......@@ -552,6 +558,10 @@ asmlinkage void sunos_nop(void)
return;
}
#if 0 /* This code doesn't translate user pointers correctly,
* disable for now. -DaveM
*/
/* XXXXXXXXXX SunOS mount/umount. XXXXXXXXXXX */
#define SMNT_RDONLY 1
#define SMNT_NOSUID 2
......@@ -600,7 +610,7 @@ sunos_nfs_get_server_fd (int fd, struct sockaddr_in *addr)
struct file *file;
file = fget(fd);
if(!file)
if (!file)
return 0;
inode = file->f_dentry->d_inode;
......@@ -645,7 +655,7 @@ static int get_default (int value, int def_value)
}
/* XXXXXXXXXXXXXXXXXXXX */
static int sunos_nfs_mount(char *dir_name, int linux_flags, void *data)
static int sunos_nfs_mount(char *dir_name, int linux_flags, void __user *data)
{
int server_fd, err;
char *the_name, *mount_page;
......@@ -665,10 +675,10 @@ static int sunos_nfs_mount(char *dir_name, int linux_flags, void *data)
if (server_fd < 0)
return -ENXIO;
if (copy_from_user(&linux_nfs_mount.addr,sunos_mount.addr,
sizeof(*sunos_mount.addr)) ||
copy_from_user(&linux_nfs_mount.root,sunos_mount.fh,
sizeof(*sunos_mount.fh))) {
if (copy_from_user(&linux_nfs_mount.addr, sunos_mount.addr,
sizeof(*sunos_mount.addr)) ||
copy_from_user(&linux_nfs_mount.root, sunos_mount.fh,
sizeof(*sunos_mount.fh))) {
sys_close (server_fd);
return -EFAULT;
}
......@@ -694,7 +704,7 @@ static int sunos_nfs_mount(char *dir_name, int linux_flags, void *data)
linux_nfs_mount.acdirmax = sunos_mount.acdirmax;
the_name = getname(sunos_mount.hostname);
if(IS_ERR(the_name))
if (IS_ERR(the_name))
return PTR_ERR(the_name);
strlcpy(linux_nfs_mount.hostname, the_name,
......@@ -733,11 +743,11 @@ sunos_mount(char *type, char *dir, int flags, void *data)
if (flags & (SMNT_GRPID|SMNT_NOSUB|SMNT_MULTI|SMNT_SYS5))
goto out;
if(flags & SMNT_REMOUNT)
if (flags & SMNT_REMOUNT)
linux_flags |= MS_REMOUNT;
if(flags & SMNT_RDONLY)
if (flags & SMNT_RDONLY)
linux_flags |= MS_RDONLY;
if(flags & SMNT_NOSUID)
if (flags & SMNT_NOSUID)
linux_flags |= MS_NOSUID;
dir_page = getname(dir);
......@@ -750,20 +760,20 @@ sunos_mount(char *type, char *dir, int flags, void *data)
if (IS_ERR(type_page))
goto out1;
if(strcmp(type_page, "ext2") == 0) {
if (strcmp(type_page, "ext2") == 0) {
dev_fname = getname(data);
} else if(strcmp(type_page, "iso9660") == 0) {
} else if (strcmp(type_page, "iso9660") == 0) {
dev_fname = getname(data);
} else if(strcmp(type_page, "minix") == 0) {
} else if (strcmp(type_page, "minix") == 0) {
dev_fname = getname(data);
} else if(strcmp(type_page, "nfs") == 0) {
} else if (strcmp(type_page, "nfs") == 0) {
ret = sunos_nfs_mount (dir_page, flags, data);
goto out2;
} else if(strcmp(type_page, "ufs") == 0) {
} else if (strcmp(type_page, "ufs") == 0) {
printk("Warning: UFS filesystem mounts unsupported.\n");
ret = -ENODEV;
goto out2;
} else if(strcmp(type_page, "proc")) {
} else if (strcmp(type_page, "proc")) {
ret = -ENODEV;
goto out2;
}
......@@ -782,15 +792,15 @@ sunos_mount(char *type, char *dir, int flags, void *data)
out:
return ret;
}
#endif
asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid)
{
int ret;
/* So stupid... */
if((!pid || pid == current->pid) &&
!pgid) {
if ((!pid || pid == current->pid) &&
!pgid) {
sys_setsid();
ret = 0;
} else {
......@@ -825,7 +835,7 @@ asmlinkage int sunos_audit(void)
return -1;
}
extern asmlinkage u32 sunos_gethostid(void)
asmlinkage u32 sunos_gethostid(void)
{
u32 ret;
......@@ -844,7 +854,7 @@ extern asmlinkage u32 sunos_gethostid(void)
#define _SC_SAVED_IDS 7
#define _SC_VERSION 8
extern asmlinkage s32 sunos_sysconf (int name)
asmlinkage s32 sunos_sysconf (int name)
{
s32 ret;
......@@ -908,7 +918,8 @@ asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 ptr)
arg3=SETALL; break;
}
/* sys_semctl(): */
arg4.__pad=(void *)A(ptr); /* value to modify semaphore to */
/* value to modify semaphore to */
arg4.__pad=(void __user *)A(ptr);
ret = sys_semctl((int)arg1, (int)arg2, (int)arg3, arg4);
break;
case 1:
......@@ -917,7 +928,8 @@ asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 ptr)
break;
case 2:
/* sys_semop(): */
ret = sys_semop((int)arg1, (struct sembuf *)A(arg2), (unsigned)arg3);
ret = sys_semop((int)arg1, (struct sembuf __user *)A(arg2),
(unsigned int) arg3);
break;
default:
ret = -EINVAL;
......@@ -959,65 +971,65 @@ struct msqid_ds32
compat_ipc_pid_t msg_lrpid;
};
static inline int sunos_msqid_get(struct msqid_ds32 *user,
static inline int sunos_msqid_get(struct msqid_ds32 __user *user,
struct msqid_ds *kern)
{
if(get_user(kern->msg_perm.key, &user->msg_perm.key) ||
__get_user(kern->msg_perm.uid, &user->msg_perm.uid) ||
__get_user(kern->msg_perm.gid, &user->msg_perm.gid) ||
__get_user(kern->msg_perm.cuid, &user->msg_perm.cuid) ||
__get_user(kern->msg_perm.cgid, &user->msg_perm.cgid) ||
__get_user(kern->msg_stime, &user->msg_stime) ||
__get_user(kern->msg_rtime, &user->msg_rtime) ||
__get_user(kern->msg_ctime, &user->msg_ctime) ||
__get_user(kern->msg_ctime, &user->msg_cbytes) ||
__get_user(kern->msg_ctime, &user->msg_qnum) ||
__get_user(kern->msg_ctime, &user->msg_qbytes) ||
__get_user(kern->msg_ctime, &user->msg_lspid) ||
__get_user(kern->msg_ctime, &user->msg_lrpid))
if (get_user(kern->msg_perm.key, &user->msg_perm.key) ||
__get_user(kern->msg_perm.uid, &user->msg_perm.uid) ||
__get_user(kern->msg_perm.gid, &user->msg_perm.gid) ||
__get_user(kern->msg_perm.cuid, &user->msg_perm.cuid) ||
__get_user(kern->msg_perm.cgid, &user->msg_perm.cgid) ||
__get_user(kern->msg_stime, &user->msg_stime) ||
__get_user(kern->msg_rtime, &user->msg_rtime) ||
__get_user(kern->msg_ctime, &user->msg_ctime) ||
__get_user(kern->msg_ctime, &user->msg_cbytes) ||
__get_user(kern->msg_ctime, &user->msg_qnum) ||
__get_user(kern->msg_ctime, &user->msg_qbytes) ||
__get_user(kern->msg_ctime, &user->msg_lspid) ||
__get_user(kern->msg_ctime, &user->msg_lrpid))
return -EFAULT;
return 0;
}
static inline int sunos_msqid_put(struct msqid_ds32 *user,
static inline int sunos_msqid_put(struct msqid_ds32 __user *user,
struct msqid_ds *kern)
{
if(put_user(kern->msg_perm.key, &user->msg_perm.key) ||
__put_user(kern->msg_perm.uid, &user->msg_perm.uid) ||
__put_user(kern->msg_perm.gid, &user->msg_perm.gid) ||
__put_user(kern->msg_perm.cuid, &user->msg_perm.cuid) ||
__put_user(kern->msg_perm.cgid, &user->msg_perm.cgid) ||
__put_user(kern->msg_stime, &user->msg_stime) ||
__put_user(kern->msg_rtime, &user->msg_rtime) ||
__put_user(kern->msg_ctime, &user->msg_ctime) ||
__put_user(kern->msg_ctime, &user->msg_cbytes) ||
__put_user(kern->msg_ctime, &user->msg_qnum) ||
__put_user(kern->msg_ctime, &user->msg_qbytes) ||
__put_user(kern->msg_ctime, &user->msg_lspid) ||
__put_user(kern->msg_ctime, &user->msg_lrpid))
if (put_user(kern->msg_perm.key, &user->msg_perm.key) ||
__put_user(kern->msg_perm.uid, &user->msg_perm.uid) ||
__put_user(kern->msg_perm.gid, &user->msg_perm.gid) ||
__put_user(kern->msg_perm.cuid, &user->msg_perm.cuid) ||
__put_user(kern->msg_perm.cgid, &user->msg_perm.cgid) ||
__put_user(kern->msg_stime, &user->msg_stime) ||
__put_user(kern->msg_rtime, &user->msg_rtime) ||
__put_user(kern->msg_ctime, &user->msg_ctime) ||
__put_user(kern->msg_ctime, &user->msg_cbytes) ||
__put_user(kern->msg_ctime, &user->msg_qnum) ||
__put_user(kern->msg_ctime, &user->msg_qbytes) ||
__put_user(kern->msg_ctime, &user->msg_lspid) ||
__put_user(kern->msg_ctime, &user->msg_lrpid))
return -EFAULT;
return 0;
}
static inline int sunos_msgbuf_get(struct msgbuf32 *user, struct msgbuf *kern, int len)
static inline int sunos_msgbuf_get(struct msgbuf32 __user *user, struct msgbuf *kern, int len)
{
if(get_user(kern->mtype, &user->mtype) ||
__copy_from_user(kern->mtext, &user->mtext, len))
if (get_user(kern->mtype, &user->mtype) ||
__copy_from_user(kern->mtext, &user->mtext, len))
return -EFAULT;
return 0;
}
static inline int sunos_msgbuf_put(struct msgbuf32 *user, struct msgbuf *kern, int len)
static inline int sunos_msgbuf_put(struct msgbuf32 __user *user, struct msgbuf *kern, int len)
{
if(put_user(kern->mtype, &user->mtype) ||
__copy_to_user(user->mtext, kern->mtext, len))
if (put_user(kern->mtype, &user->mtype) ||
__copy_to_user(user->mtext, kern->mtext, len))
return -EFAULT;
return 0;
}
asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
{
struct sparc_stackf32 *sp;
struct sparc_stackf32 __user *sp;
struct msqid_ds kds;
struct msgbuf *kmbuf;
mm_segment_t old_fs = get_fs();
......@@ -1029,13 +1041,13 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
rval = sys_msgget((key_t)arg1, (int)arg2);
break;
case 1:
if(!sunos_msqid_get((struct msqid_ds32 *)A(arg3), &kds)) {
if (!sunos_msqid_get((struct msqid_ds32 __user *)A(arg3), &kds)) {
set_fs(KERNEL_DS);
rval = sys_msgctl((int)arg1, (int)arg2,
(struct msqid_ds *)A(arg3));
(struct msqid_ds __user *)A(arg3));
set_fs(old_fs);
if(!rval)
rval = sunos_msqid_put((struct msqid_ds32 *)A(arg3),
if (!rval)
rval = sunos_msqid_put((struct msqid_ds32 __user *)A(arg3),
&kds);
} else
rval = -EFAULT;
......@@ -1044,21 +1056,22 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
rval = -EFAULT;
kmbuf = (struct msgbuf *)kmalloc(sizeof(struct msgbuf) + arg3,
GFP_KERNEL);
if(!kmbuf)
if (!kmbuf)
break;
sp = (struct sparc_stackf32 *)
sp = (struct sparc_stackf32 __user *)
(current_thread_info()->kregs->u_regs[UREG_FP] & 0xffffffffUL);
if(get_user(arg5, &sp->xxargs[0])) {
if (get_user(arg5, &sp->xxargs[0])) {
rval = -EFAULT;
kfree(kmbuf);
break;
}
set_fs(KERNEL_DS);
rval = sys_msgrcv((int)arg1, kmbuf, (size_t)arg3,
rval = sys_msgrcv((int)arg1, (struct msgbuf __user *) kmbuf,
(size_t)arg3,
(long)arg4, (int)arg5);
set_fs(old_fs);
if(!rval)
rval = sunos_msgbuf_put((struct msgbuf32 *)A(arg2),
if (!rval)
rval = sunos_msgbuf_put((struct msgbuf32 __user *)A(arg2),
kmbuf, arg3);
kfree(kmbuf);
break;
......@@ -1066,11 +1079,12 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
rval = -EFAULT;
kmbuf = (struct msgbuf *)kmalloc(sizeof(struct msgbuf) + arg3,
GFP_KERNEL);
if(!kmbuf || sunos_msgbuf_get((struct msgbuf32 *)A(arg2),
kmbuf, arg3))
if (!kmbuf || sunos_msgbuf_get((struct msgbuf32 __user *)A(arg2),
kmbuf, arg3))
break;
set_fs(KERNEL_DS);
rval = sys_msgsnd((int)arg1, kmbuf, (size_t)arg3, (int)arg4);
rval = sys_msgsnd((int)arg1, (struct msgbuf __user *) kmbuf,
(size_t)arg3, (int)arg4);
set_fs(old_fs);
kfree(kmbuf);
break;
......@@ -1092,40 +1106,40 @@ struct shmid_ds32 {
unsigned short shm_nattch;
};
static inline int sunos_shmid_get(struct shmid_ds32 *user,
static inline int sunos_shmid_get(struct shmid_ds32 __user *user,
struct shmid_ds *kern)
{
if(get_user(kern->shm_perm.key, &user->shm_perm.key) ||
__get_user(kern->shm_perm.uid, &user->shm_perm.uid) ||
__get_user(kern->shm_perm.gid, &user->shm_perm.gid) ||
__get_user(kern->shm_perm.cuid, &user->shm_perm.cuid) ||
__get_user(kern->shm_perm.cgid, &user->shm_perm.cgid) ||
__get_user(kern->shm_segsz, &user->shm_segsz) ||
__get_user(kern->shm_atime, &user->shm_atime) ||
__get_user(kern->shm_dtime, &user->shm_dtime) ||
__get_user(kern->shm_ctime, &user->shm_ctime) ||
__get_user(kern->shm_cpid, &user->shm_cpid) ||
__get_user(kern->shm_lpid, &user->shm_lpid) ||
__get_user(kern->shm_nattch, &user->shm_nattch))
if (get_user(kern->shm_perm.key, &user->shm_perm.key) ||
__get_user(kern->shm_perm.uid, &user->shm_perm.uid) ||
__get_user(kern->shm_perm.gid, &user->shm_perm.gid) ||
__get_user(kern->shm_perm.cuid, &user->shm_perm.cuid) ||
__get_user(kern->shm_perm.cgid, &user->shm_perm.cgid) ||
__get_user(kern->shm_segsz, &user->shm_segsz) ||
__get_user(kern->shm_atime, &user->shm_atime) ||
__get_user(kern->shm_dtime, &user->shm_dtime) ||
__get_user(kern->shm_ctime, &user->shm_ctime) ||
__get_user(kern->shm_cpid, &user->shm_cpid) ||
__get_user(kern->shm_lpid, &user->shm_lpid) ||
__get_user(kern->shm_nattch, &user->shm_nattch))
return -EFAULT;
return 0;
}
static inline int sunos_shmid_put(struct shmid_ds32 *user,
static inline int sunos_shmid_put(struct shmid_ds32 __user *user,
struct shmid_ds *kern)
{
if(put_user(kern->shm_perm.key, &user->shm_perm.key) ||
__put_user(kern->shm_perm.uid, &user->shm_perm.uid) ||
__put_user(kern->shm_perm.gid, &user->shm_perm.gid) ||
__put_user(kern->shm_perm.cuid, &user->shm_perm.cuid) ||
__put_user(kern->shm_perm.cgid, &user->shm_perm.cgid) ||
__put_user(kern->shm_segsz, &user->shm_segsz) ||
__put_user(kern->shm_atime, &user->shm_atime) ||
__put_user(kern->shm_dtime, &user->shm_dtime) ||
__put_user(kern->shm_ctime, &user->shm_ctime) ||
__put_user(kern->shm_cpid, &user->shm_cpid) ||
__put_user(kern->shm_lpid, &user->shm_lpid) ||
__put_user(kern->shm_nattch, &user->shm_nattch))
if (put_user(kern->shm_perm.key, &user->shm_perm.key) ||
__put_user(kern->shm_perm.uid, &user->shm_perm.uid) ||
__put_user(kern->shm_perm.gid, &user->shm_perm.gid) ||
__put_user(kern->shm_perm.cuid, &user->shm_perm.cuid) ||
__put_user(kern->shm_perm.cgid, &user->shm_perm.cgid) ||
__put_user(kern->shm_segsz, &user->shm_segsz) ||
__put_user(kern->shm_atime, &user->shm_atime) ||
__put_user(kern->shm_dtime, &user->shm_dtime) ||
__put_user(kern->shm_ctime, &user->shm_ctime) ||
__put_user(kern->shm_cpid, &user->shm_cpid) ||
__put_user(kern->shm_lpid, &user->shm_lpid) ||
__put_user(kern->shm_nattch, &user->shm_nattch))
return -EFAULT;
return 0;
}
......@@ -1140,25 +1154,26 @@ asmlinkage int sunos_shmsys(int op, u32 arg1, u32 arg2, u32 arg3)
switch(op) {
case 0:
/* do_shmat(): attach a shared memory area */
rval = do_shmat((int)arg1,(char *)A(arg2),(int)arg3,&raddr);
if(!rval)
rval = do_shmat((int)arg1,(char __user *)A(arg2),(int)arg3,&raddr);
if (!rval)
rval = (int) raddr;
break;
case 1:
/* sys_shmctl(): modify shared memory area attr. */
if(!sunos_shmid_get((struct shmid_ds32 *)A(arg3), &ksds)) {
if (!sunos_shmid_get((struct shmid_ds32 __user *)A(arg3), &ksds)) {
set_fs(KERNEL_DS);
rval = sys_shmctl((int)arg1,(int)arg2, &ksds);
rval = sys_shmctl((int) arg1,(int) arg2,
(struct shmid_ds __user *) &ksds);
set_fs(old_fs);
if(!rval)
rval = sunos_shmid_put((struct shmid_ds32 *)A(arg3),
if (!rval)
rval = sunos_shmid_put((struct shmid_ds32 __user *)A(arg3),
&ksds);
} else
rval = -EFAULT;
break;
case 2:
/* sys_shmdt(): detach a shared memory area */
rval = sys_shmdt((char *)A(arg1));
rval = sys_shmdt((char __user *)A(arg1));
break;
case 3:
/* sys_shmget(): get a shared memory area */
......@@ -1204,7 +1219,7 @@ asmlinkage int sunos_read(unsigned int fd, u32 buf, u32 count)
{
int ret;
ret = check_nonblock(sys_read(fd, (char *)A(buf), count), fd);
ret = check_nonblock(sys_read(fd, (char __user *)A(buf), count), fd);
return ret;
}
......@@ -1212,7 +1227,8 @@ asmlinkage int sunos_readv(u32 fd, u32 vector, s32 count)
{
int ret;
ret = check_nonblock(compat_sys_readv(fd, (void*)A(vector), count), fd);
ret = check_nonblock(compat_sys_readv(fd, (void __user *) A(vector),
count), fd);
return ret;
}
......@@ -1220,7 +1236,7 @@ asmlinkage int sunos_write(unsigned int fd, u32 buf, u32 count)
{
int ret;
ret = check_nonblock(sys_write(fd, (char *)A(buf), count), fd);
ret = check_nonblock(sys_write(fd, (char __user *)A(buf), count), fd);
return ret;
}
......@@ -1228,7 +1244,8 @@ asmlinkage int sunos_writev(u32 fd, u32 vector, s32 count)
{
int ret;
ret = check_nonblock(compat_sys_writev(fd, (void*)A(vector), count), fd);
ret = check_nonblock(compat_sys_writev(fd, (void __user *)A(vector),
count), fd);
return ret;
}
......@@ -1236,7 +1253,8 @@ asmlinkage int sunos_recv(int fd, u32 ubuf, int size, unsigned flags)
{
int ret;
ret = check_nonblock(sys_recv(fd, (void *)A(ubuf), size, flags), fd);
ret = check_nonblock(sys_recv(fd, (void __user *)A(ubuf),
size, flags), fd);
return ret;
}
......@@ -1244,7 +1262,8 @@ asmlinkage int sunos_send(int fd, u32 buff, int len, unsigned flags)
{
int ret;
ret = check_nonblock(sys_send(fd, (void *)A(buff), len, flags), fd);
ret = check_nonblock(sys_send(fd, (void __user *)A(buff),
len, flags), fd);
return ret;
}
......@@ -1253,8 +1272,9 @@ asmlinkage int sunos_accept(int fd, u32 sa, u32 addrlen)
int ret;
while (1) {
ret = check_nonblock(sys_accept(fd, (struct sockaddr *)A(sa),
(int *)A(addrlen)), fd);
ret = check_nonblock(sys_accept(fd,
(struct sockaddr __user *)A(sa),
(int __user *)A(addrlen)), fd);
if (ret != -ENETUNREACH && ret != -EHOSTUNREACH)
break;
}
......@@ -1272,11 +1292,11 @@ asmlinkage int sunos_sigaction (int sig, u32 act, u32 oact)
compat_old_sigset_t mask;
u32 u_handler;
if (get_user(u_handler, &((struct old_sigaction32 *)A(act))->sa_handler) ||
__get_user(new_ka.sa.sa_flags, &((struct old_sigaction32 *)A(act))->sa_flags))
if (get_user(u_handler, &((struct old_sigaction32 __user *)A(act))->sa_handler) ||
__get_user(new_ka.sa.sa_flags, &((struct old_sigaction32 __user *)A(act))->sa_flags))
return -EFAULT;
new_ka.sa.sa_handler = (void *) (long) u_handler;
__get_user(mask, &((struct old_sigaction32 *)A(act))->sa_mask);
__get_user(mask, &((struct old_sigaction32 __user *)A(act))->sa_mask);
new_ka.sa.sa_restorer = NULL;
new_ka.ka_restorer = NULL;
siginitset(&new_ka.sa.sa_mask, mask);
......@@ -1287,10 +1307,10 @@ asmlinkage int sunos_sigaction (int sig, u32 act, u32 oact)
if (!ret && oact) {
old_ka.sa.sa_flags ^= SUNOS_SV_INTERRUPT;
if (put_user((long)old_ka.sa.sa_handler, &((struct old_sigaction32 *)A(oact))->sa_handler) ||
__put_user(old_ka.sa.sa_flags, &((struct old_sigaction32 *)A(oact))->sa_flags))
if (put_user((long)old_ka.sa.sa_handler, &((struct old_sigaction32 __user *)A(oact))->sa_handler) ||
__put_user(old_ka.sa.sa_flags, &((struct old_sigaction32 __user *)A(oact))->sa_flags))
return -EFAULT;
__put_user(old_ka.sa.sa_mask.sig[0], &((struct old_sigaction32 *)A(oact))->sa_mask);
__put_user(old_ka.sa.sa_mask.sig[0], &((struct old_sigaction32 __user *)A(oact))->sa_mask);
}
return ret;
......@@ -1307,7 +1327,8 @@ asmlinkage int sunos_setsockopt(int fd, int level, int optname, u32 optval,
if (tr_opt >=2 && tr_opt <= 6)
tr_opt += 30;
}
ret = sys_setsockopt(fd, level, tr_opt, (char *)A(optval), optlen);
ret = sys_setsockopt(fd, level, tr_opt,
(char __user *)A(optval), optlen);
return ret;
}
......@@ -1322,6 +1343,8 @@ asmlinkage int sunos_getsockopt(int fd, int level, int optname,
if (tr_opt >=2 && tr_opt <= 6)
tr_opt += 30;
}
ret = compat_sys_getsockopt(fd, level, tr_opt, (void*)(unsigned long)optval, (void*)(unsigned long)optlen);
ret = compat_sys_getsockopt(fd, level, tr_opt,
(void __user *)(unsigned long) optval,
(void __user *)(unsigned long) optlen);
return ret;
}
......@@ -205,7 +205,7 @@ sunos_sys_table:
.word sys_oldumount, sunos_nosys, sunos_nosys
.word sys_getdomainname, sys_setdomainname
.word sunos_nosys, sys_quotactl, sunos_nosys
.word sunos_mount, sys_ustat, sunos_semsys
.word sunos_nosys, sys_ustat, sunos_semsys
.word sunos_nosys, sunos_shmsys, sunos_audit
.word sunos_nosys, sunos_getdents, sys_setsid
.word sys_fchdir, sunos_nosys, sunos_nosys
......
......@@ -1708,7 +1708,7 @@ void instruction_dump (unsigned int *pc)
printk("\n");
}
void user_instruction_dump (unsigned int *pc)
static void user_instruction_dump (unsigned int __user *pc)
{
int i;
unsigned int buf[9];
......@@ -1813,7 +1813,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
regs->tpc &= 0xffffffff;
regs->tnpc &= 0xffffffff;
}
user_instruction_dump ((unsigned int *) regs->tpc);
user_instruction_dump ((unsigned int __user *) regs->tpc);
}
#ifdef CONFIG_SMP
smp_report_regs();
......@@ -1838,7 +1838,7 @@ void do_illegal_instruction(struct pt_regs *regs)
die_if_kernel("Kernel illegal instruction", regs);
if (test_thread_flag(TIF_32BIT))
pc = (u32)pc;
if (get_user(insn, (u32 *)pc) != -EFAULT) {
if (get_user(insn, (u32 __user *) pc) != -EFAULT) {
if ((insn & 0xc1ffc000) == 0x81700000) /* POPC */ {
if (handle_popc(insn, regs))
return;
......@@ -1862,9 +1862,12 @@ void mem_address_unaligned(struct pt_regs *regs, unsigned long sfar, unsigned lo
if (regs->tstate & TSTATE_PRIV) {
extern void kernel_unaligned_trap(struct pt_regs *regs,
unsigned int insn,
unsigned long sfar, unsigned long sfsr);
unsigned long sfar,
unsigned long sfsr);
return kernel_unaligned_trap(regs, *((unsigned int *)regs->tpc), sfar, sfsr);
kernel_unaligned_trap(regs, *((unsigned int *)regs->tpc),
sfar, sfsr);
return;
}
info.si_signo = SIGBUS;
info.si_errno = 0;
......
......@@ -128,12 +128,12 @@ static unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs)
win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
value = win->locals[reg - 16];
} else if (test_thread_flag(TIF_32BIT)) {
struct reg_window32 *win32;
win32 = (struct reg_window32 *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
struct reg_window32 __user *win32;
win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
get_user(value, &win32->locals[reg - 16]);
} else {
struct reg_window *win;
win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
struct reg_window __user *win;
win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS);
get_user(value, &win->locals[reg - 16]);
}
return value;
......@@ -477,12 +477,12 @@ int handle_popc(u32 insn, struct pt_regs *regs)
regs->u_regs[rd] = ret;
} else {
if (test_thread_flag(TIF_32BIT)) {
struct reg_window32 *win32;
win32 = (struct reg_window32 *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
struct reg_window32 __user *win32;
win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
put_user(ret, &win32->locals[rd - 16]);
} else {
struct reg_window *win;
win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
struct reg_window __user *win;
win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS);
put_user(ret, &win->locals[rd - 16]);
}
}
......@@ -540,10 +540,10 @@ int handle_ldf_stq(u32 insn, struct pt_regs *regs)
data_access_exception(regs, 0, addr);
return 1;
}
if (put_user (first >> 32, (u32 *)addr) ||
__put_user ((u32)first, (u32 *)(addr + 4)) ||
__put_user (second >> 32, (u32 *)(addr + 8)) ||
__put_user ((u32)second, (u32 *)(addr + 12))) {
if (put_user (first >> 32, (u32 __user *)addr) ||
__put_user ((u32)first, (u32 __user *)(addr + 4)) ||
__put_user (second >> 32, (u32 __user *)(addr + 8)) ||
__put_user ((u32)second, (u32 __user *)(addr + 12))) {
data_access_exception(regs, 0, addr);
return 1;
}
......@@ -568,10 +568,10 @@ int handle_ldf_stq(u32 insn, struct pt_regs *regs)
for (i = 0; i < size; i++)
data[i] = 0;
err = get_user (data[0], (u32 *)addr);
err = get_user (data[0], (u32 __user *) addr);
if (!err) {
for (i = 1; i < size; i++)
err |= __get_user (data[i], (u32 *)(addr + 4*i));
err |= __get_user (data[i], (u32 __user *)(addr + 4*i));
}
if (err && !(asi & 0x2 /* NF */)) {
data_access_exception(regs, 0, addr);
......@@ -620,13 +620,13 @@ void handle_ld_nf(u32 insn, struct pt_regs *regs)
if ((insn & 0x780000) == 0x180000)
reg[1] = 0;
} else if (test_thread_flag(TIF_32BIT)) {
put_user(0, (int *)reg);
put_user(0, (int __user *) reg);
if ((insn & 0x780000) == 0x180000)
put_user(0, ((int *)reg) + 1);
put_user(0, ((int __user *) reg) + 1);
} else {
put_user(0, reg);
put_user(0, (unsigned long __user *) reg);
if ((insn & 0x780000) == 0x180000)
put_user(0, reg + 1);
put_user(0, (unsigned long __user *) reg + 1);
}
advance(regs);
}
......@@ -646,13 +646,13 @@ void handle_lddfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr
die_if_kernel("lddfmna from kernel", regs);
if (test_thread_flag(TIF_32BIT))
pc = (u32)pc;
if (get_user(insn, (u32 *)pc) != -EFAULT) {
if (get_user(insn, (u32 __user *) pc) != -EFAULT) {
asi = sfsr >> 16;
if ((asi > ASI_SNFL) ||
(asi < ASI_P))
goto daex;
if (get_user(first, (u32 *)sfar) ||
get_user(second, (u32 *)(sfar + 4))) {
if (get_user(first, (u32 __user *)sfar) ||
get_user(second, (u32 __user *)(sfar + 4))) {
if (asi & 0x2) /* NF */ {
first = 0; second = 0;
} else
......@@ -698,7 +698,7 @@ void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr
die_if_kernel("stdfmna from kernel", regs);
if (test_thread_flag(TIF_32BIT))
pc = (u32)pc;
if (get_user(insn, (u32 *)pc) != -EFAULT) {
if (get_user(insn, (u32 __user *) pc) != -EFAULT) {
freg = ((insn >> 25) & 0x1e) | ((insn >> 20) & 0x20);
asi = sfsr >> 16;
value = 0;
......@@ -717,8 +717,8 @@ void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr
value = __swab64p(&value); break;
default: goto daex;
}
if (put_user (value >> 32, (u32 *)sfar) ||
__put_user ((u32)value, (u32 *)(sfar + 4)))
if (put_user (value >> 32, (u32 __user *) sfar) ||
__put_user ((u32)value, (u32 __user *)(sfar + 4)))
goto daex;
} else {
daex: data_access_exception(regs, sfsr, sfar);
......
......@@ -185,7 +185,7 @@ int do_mathemu(struct pt_regs *regs, struct fpustate *f)
die_if_kernel("unfinished/unimplemented FPop from kernel", regs);
if (test_thread_flag(TIF_32BIT))
pc = (u32)pc;
if (get_user(insn, (u32 *)pc) != -EFAULT) {
if (get_user(insn, (u32 __user *) pc) != -EFAULT) {
if ((insn & 0xc1f80000) == 0x81a00000) /* FPOP1 */ {
switch ((insn >> 5) & 0x1ff) {
/* QUAD - ftt == 3 */
......@@ -298,14 +298,14 @@ int do_mathemu(struct pt_regs *regs, struct fpustate *f)
else if (freg < 16)
XR = regs->u_regs[freg];
else if (test_thread_flag(TIF_32BIT)) {
struct reg_window32 *win32;
struct reg_window32 __user *win32;
flushw_user ();
win32 = (struct reg_window32 *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
get_user(XR, &win32->locals[freg - 16]);
} else {
struct reg_window *win;
struct reg_window __user *win;
flushw_user ();
win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS);
get_user(XR, &win->locals[freg - 16]);
}
IR = 0;
......
......@@ -14,171 +14,171 @@
#define CHMCTRL_MACTRL 0x30 /* Memory Address Control */
/* Memory Timing Control I */
#define TCTRL1_SDRAMCTL_DLY 0xf000000000000000
#define TCTRL1_SDRAMCTL_DLY 0xf000000000000000UL
#define TCTRL1_SDRAMCTL_DLY_SHIFT 60
#define TCTRL1_SDRAMCLK_DLY 0x0e00000000000000
#define TCTRL1_SDRAMCLK_DLY 0x0e00000000000000UL
#define TCTRL1_SDRAMCLK_DLY_SHIFT 57
#define TCTRL1_R 0x0100000000000000
#define TCTRL1_R 0x0100000000000000UL
#define TCTRL1_R_SHIFT 56
#define TCTRL1_AUTORFR_CYCLE 0x00fe000000000000
#define TCTRL1_AUTORFR_CYCLE 0x00fe000000000000UL
#define TCTRL1_AUTORFR_CYCLE_SHIFT 49
#define TCTRL1_RD_WAIT 0x0001f00000000000
#define TCTRL1_RD_WAIT 0x0001f00000000000UL
#define TCTRL1_RD_WAIT_SHIFT 44
#define TCTRL1_PC_CYCLE 0x00000fc000000000
#define TCTRL1_PC_CYCLE 0x00000fc000000000UL
#define TCTRL1_PC_CYCLE_SHIFT 38
#define TCTRL1_WR_MORE_RAS_PW 0x0000003f00000000
#define TCTRL1_WR_MORE_RAS_PW 0x0000003f00000000UL
#define TCTRL1_WR_MORE_RAS_PW_SHIFT 32
#define TCTRL1_RD_MORE_RAW_PW 0x00000000fc000000
#define TCTRL1_RD_MORE_RAW_PW 0x00000000fc000000UL
#define TCTRL1_RD_MORE_RAS_PW_SHIFT 26
#define TCTRL1_ACT_WR_DLY 0x0000000003f00000
#define TCTRL1_ACT_WR_DLY 0x0000000003f00000UL
#define TCTRL1_ACT_WR_DLY_SHIFT 20
#define TCTRL1_ACT_RD_DLY 0x00000000000fc000
#define TCTRL1_ACT_RD_DLY 0x00000000000fc000UL
#define TCTRL1_ACT_RD_DLY_SHIFT 14
#define TCTRL1_BANK_PRESENT 0x0000000000003000
#define TCTRL1_BANK_PRESENT 0x0000000000003000UL
#define TCTRL1_BANK_PRESENT_SHIFT 12
#define TCTRL1_RFR_INT 0x0000000000000ff8
#define TCTRL1_RFR_INT 0x0000000000000ff8UL
#define TCTRL1_RFR_INT_SHIFT 3
#define TCTRL1_SET_MODE_REG 0x0000000000000004
#define TCTRL1_SET_MODE_REG 0x0000000000000004UL
#define TCTRL1_SET_MODE_REG_SHIFT 2
#define TCTRL1_RFR_ENABLE 0x0000000000000002
#define TCTRL1_RFR_ENABLE 0x0000000000000002UL
#define TCTRL1_RFR_ENABLE_SHIFT 1
#define TCTRL1_PRECHG_ALL 0x0000000000000001
#define TCTRL1_PRECHG_ALL 0x0000000000000001UL
#define TCTRL1_PRECHG_ALL_SHIFT 0
/* Memory Timing Control II */
#define TCTRL2_WR_MSEL_DLY 0xfc00000000000000
#define TCTRL2_WR_MSEL_DLY 0xfc00000000000000UL
#define TCTRL2_WR_MSEL_DLY_SHIFT 58
#define TCTRL2_RD_MSEL_DLY 0x03f0000000000000
#define TCTRL2_RD_MSEL_DLY 0x03f0000000000000UL
#define TCTRL2_RD_MSEL_DLY_SHIFT 52
#define TCTRL2_WRDATA_THLD 0x000c000000000000
#define TCTRL2_WRDATA_THLD 0x000c000000000000UL
#define TCTRL2_WRDATA_THLD_SHIFT 50
#define TCTRL2_RDWR_RD_TI_DLY 0x0003f00000000000
#define TCTRL2_RDWR_RD_TI_DLY 0x0003f00000000000UL
#define TCTRL2_RDWR_RD_TI_DLY_SHIFT 44
#define TCTRL2_AUTOPRECHG_ENBL 0x0000080000000000
#define TCTRL2_AUTOPRECHG_ENBL 0x0000080000000000UL
#define TCTRL2_AUTOPRECHG_ENBL_SHIFT 43
#define TCTRL2_RDWR_PI_MORE_DLY 0x000007c000000000
#define TCTRL2_RDWR_PI_MORE_DLY 0x000007c000000000UL
#define TCTRL2_RDWR_PI_MORE_DLY_SHIFT 38
#define TCTRL2_RDWR_1_DLY 0x0000003f00000000
#define TCTRL2_RDWR_1_DLY 0x0000003f00000000UL
#define TCTRL2_RDWR_1_DLY_SHIFT 32
#define TCTRL2_WRWR_PI_MORE_DLY 0x00000000f8000000
#define TCTRL2_WRWR_PI_MORE_DLY 0x00000000f8000000UL
#define TCTRL2_WRWR_PI_MORE_DLY_SHIFT 27
#define TCTRL2_WRWR_1_DLY 0x0000000007e00000
#define TCTRL2_WRWR_1_DLY 0x0000000007e00000UL
#define TCTRL2_WRWR_1_DLY_SHIFT 21
#define TCTRL2_RDWR_RD_PI_MORE_DLY 0x00000000001f0000
#define TCTRL2_RDWR_RD_PI_MORE_DLY 0x00000000001f0000UL
#define TCTRL2_RDWR_RD_PI_MORE_DLY_SHIFT 16
#define TCTRL2_R 0x0000000000008000
#define TCTRL2_R 0x0000000000008000UL
#define TCTRL2_R_SHIFT 15
#define TCTRL2_SDRAM_MODE_REG_DATA 0x0000000000007fff
#define TCTRL2_SDRAM_MODE_REG_DATA 0x0000000000007fffUL
#define TCTRL2_SDRAM_MODE_REG_DATA_SHIFT 0
/* Memory Timing Control III */
#define TCTRL3_SDRAM_CTL_DLY 0xf000000000000000
#define TCTRL3_SDRAM_CTL_DLY 0xf000000000000000UL
#define TCTRL3_SDRAM_CTL_DLY_SHIFT 60
#define TCTRL3_SDRAM_CLK_DLY 0x0e00000000000000
#define TCTRL3_SDRAM_CLK_DLY 0x0e00000000000000UL
#define TCTRL3_SDRAM_CLK_DLY_SHIFT 57
#define TCTRL3_R 0x0100000000000000
#define TCTRL3_R 0x0100000000000000UL
#define TCTRL3_R_SHIFT 56
#define TCTRL3_AUTO_RFR_CYCLE 0x00fe000000000000
#define TCTRL3_AUTO_RFR_CYCLE 0x00fe000000000000UL
#define TCTRL3_AUTO_RFR_CYCLE_SHIFT 49
#define TCTRL3_RD_WAIT 0x0001f00000000000
#define TCTRL3_RD_WAIT 0x0001f00000000000UL
#define TCTRL3_RD_WAIT_SHIFT 44
#define TCTRL3_PC_CYCLE 0x00000fc000000000
#define TCTRL3_PC_CYCLE 0x00000fc000000000UL
#define TCTRL3_PC_CYCLE_SHIFT 38
#define TCTRL3_WR_MORE_RAW_PW 0x0000003f00000000
#define TCTRL3_WR_MORE_RAW_PW 0x0000003f00000000UL
#define TCTRL3_WR_MORE_RAW_PW_SHIFT 32
#define TCTRL3_RD_MORE_RAW_PW 0x00000000fc000000
#define TCTRL3_RD_MORE_RAW_PW 0x00000000fc000000UL
#define TCTRL3_RD_MORE_RAW_PW_SHIFT 26
#define TCTRL3_ACT_WR_DLY 0x0000000003f00000
#define TCTRL3_ACT_WR_DLY 0x0000000003f00000UL
#define TCTRL3_ACT_WR_DLY_SHIFT 20
#define TCTRL3_ACT_RD_DLY 0x00000000000fc000
#define TCTRL3_ACT_RD_DLY 0x00000000000fc000UL
#define TCTRL3_ACT_RD_DLY_SHIFT 14
#define TCTRL3_BANK_PRESENT 0x0000000000003000
#define TCTRL3_BANK_PRESENT 0x0000000000003000UL
#define TCTRL3_BANK_PRESENT_SHIFT 12
#define TCTRL3_RFR_INT 0x0000000000000ff8
#define TCTRL3_RFR_INT 0x0000000000000ff8UL
#define TCTRL3_RFR_INT_SHIFT 3
#define TCTRL3_SET_MODE_REG 0x0000000000000004
#define TCTRL3_SET_MODE_REG 0x0000000000000004UL
#define TCTRL3_SET_MODE_REG_SHIFT 2
#define TCTRL3_RFR_ENABLE 0x0000000000000002
#define TCTRL3_RFR_ENABLE 0x0000000000000002UL
#define TCTRL3_RFR_ENABLE_SHIFT 1
#define TCTRL3_PRECHG_ALL 0x0000000000000001
#define TCTRL3_PRECHG_ALL 0x0000000000000001UL
#define TCTRL3_PRECHG_ALL_SHIFT 0
/* Memory Timing Control IV */
#define TCTRL4_WR_MSEL_DLY 0xfc00000000000000
#define TCTRL4_WR_MSEL_DLY 0xfc00000000000000UL
#define TCTRL4_WR_MSEL_DLY_SHIFT 58
#define TCTRL4_RD_MSEL_DLY 0x03f0000000000000
#define TCTRL4_RD_MSEL_DLY 0x03f0000000000000UL
#define TCTRL4_RD_MSEL_DLY_SHIFT 52
#define TCTRL4_WRDATA_THLD 0x000c000000000000
#define TCTRL4_WRDATA_THLD 0x000c000000000000UL
#define TCTRL4_WRDATA_THLD_SHIFT 50
#define TCTRL4_RDWR_RD_RI_DLY 0x0003f00000000000
#define TCTRL4_RDWR_RD_RI_DLY 0x0003f00000000000UL
#define TCTRL4_RDWR_RD_RI_DLY_SHIFT 44
#define TCTRL4_AUTO_PRECHG_ENBL 0x0000080000000000
#define TCTRL4_AUTO_PRECHG_ENBL 0x0000080000000000UL
#define TCTRL4_AUTO_PRECHG_ENBL_SHIFT 43
#define TCTRL4_RD_WR_PI_MORE_DLY 0x000007c000000000
#define TCTRL4_RD_WR_PI_MORE_DLY 0x000007c000000000UL
#define TCTRL4_RD_WR_PI_MORE_DLY_SHIFT 38
#define TCTRL4_RD_WR_TI_DLY 0x0000003f00000000
#define TCTRL4_RD_WR_TI_DLY 0x0000003f00000000UL
#define TCTRL4_RD_WR_TI_DLY_SHIFT 32
#define TCTRL4_WR_WR_PI_MORE_DLY 0x00000000f8000000
#define TCTRL4_WR_WR_PI_MORE_DLY 0x00000000f8000000UL
#define TCTRL4_WR_WR_PI_MORE_DLY_SHIFT 27
#define TCTRL4_WR_WR_TI_DLY 0x0000000007e00000
#define TCTRL4_WR_WR_TI_DLY 0x0000000007e00000UL
#define TCTRL4_WR_WR_TI_DLY_SHIFT 21
#define TCTRL4_RDWR_RD_PI_MORE_DLY 0x00000000001f0000
#define TCTRL4_RDWR_RD_PI_MORE_DLY 0x00000000001f000UL0
#define TCTRL4_RDWR_RD_PI_MORE_DLY_SHIFT 16
#define TCTRL4_R 0x0000000000008000
#define TCTRL4_R 0x0000000000008000UL
#define TCTRL4_R_SHIFT 15
#define TCTRL4_SDRAM_MODE_REG_DATA 0x0000000000007fff
#define TCTRL4_SDRAM_MODE_REG_DATA 0x0000000000007fffUL
#define TCTRL4_SDRAM_MODE_REG_DATA_SHIFT 0
/* All 4 memory address decoding registers have the
* same layout.
*/
#define MEM_DECODE_VALID 0x8000000000000000 /* Valid */
#define MEM_DECODE_VALID 0x8000000000000000UL /* Valid */
#define MEM_DECODE_VALID_SHIFT 63
#define MEM_DECODE_UK 0x001ffe0000000000 /* Upper mask */
#define MEM_DECODE_UK 0x001ffe0000000000UL /* Upper mask */
#define MEM_DECODE_UK_SHIFT 41
#define MEM_DECODE_UM 0x0000001ffff00000 /* Upper match */
#define MEM_DECODE_UM 0x0000001ffff00000UL /* Upper match */
#define MEM_DECODE_UM_SHIFT 20
#define MEM_DECODE_LK 0x000000000003c000 /* Lower mask */
#define MEM_DECODE_LK 0x000000000003c000UL /* Lower mask */
#define MEM_DECODE_LK_SHIFT 14
#define MEM_DECODE_LM 0x0000000000000f00 /* Lower match */
#define MEM_DECODE_LM 0x0000000000000f00UL /* Lower match */
#define MEM_DECODE_LM_SHIFT 8
#define PA_UPPER_BITS 0x000007fffc000000
#define PA_UPPER_BITS 0x000007fffc000000UL
#define PA_UPPER_BITS_SHIFT 26
#define PA_LOWER_BITS 0x00000000000003c0
#define PA_LOWER_BITS 0x00000000000003c0UL
#define PA_LOWER_BITS_SHIFT 6
#define MACTRL_R0 0x8000000000000000
#define MACTRL_R0 0x8000000000000000UL
#define MACTRL_R0_SHIFT 63
#define MACTRL_ADDR_LE_PW 0x7000000000000000
#define MACTRL_ADDR_LE_PW 0x7000000000000000UL
#define MACTRL_ADDR_LE_PW_SHIFT 60
#define MACTRL_CMD_PW 0x0f00000000000000
#define MACTRL_CMD_PW 0x0f00000000000000UL
#define MACTRL_CMD_PW_SHIFT 56
#define MACTRL_HALF_MODE_WR_MSEL_DLY 0x00fc000000000000
#define MACTRL_HALF_MODE_WR_MSEL_DLY 0x00fc000000000000UL
#define MACTRL_HALF_MODE_WR_MSEL_DLY_SHIFT 50
#define MACTRL_HALF_MODE_RD_MSEL_DLY 0x0003f00000000000
#define MACTRL_HALF_MODE_RD_MSEL_DLY 0x0003f00000000000UL
#define MACTRL_HALF_MODE_RD_MSEL_DLY_SHIFT 44
#define MACTRL_HALF_MODE_SDRAM_CTL_DLY 0x00000f0000000000
#define MACTRL_HALF_MODE_SDRAM_CTL_DLY 0x00000f0000000000UL
#define MACTRL_HALF_MODE_SDRAM_CTL_DLY_SHIFT 40
#define MACTRL_HALF_MODE_SDRAM_CLK_DLY 0x000000e000000000
#define MACTRL_HALF_MODE_SDRAM_CLK_DLY 0x000000e000000000UL
#define MACTRL_HALF_MODE_SDRAM_CLK_DLY_SHIFT 37
#define MACTRL_R1 0x0000001000000000
#define MACTRL_R1 0x0000001000000000UL
#define MACTRL_R1_SHIFT 36
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B3 0x0000000f00000000
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B3 0x0000000f00000000UL
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B3_SHIFT 32
#define MACTRL_ENC_INTLV_B3 0x00000000f8000000
#define MACTRL_ENC_INTLV_B3 0x00000000f8000000UL
#define MACTRL_ENC_INTLV_B3_SHIFT 27
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B2 0x0000000007800000
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B2 0x0000000007800000UL
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B2_SHIFT 23
#define MACTRL_ENC_INTLV_B2 0x00000000007c0000
#define MACTRL_ENC_INTLV_B2 0x00000000007c0000UL
#define MACTRL_ENC_INTLV_B2_SHIFT 18
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B1 0x000000000003c000
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B1 0x000000000003c000UL
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B1_SHIFT 14
#define MACTRL_ENC_INTLV_B1 0x0000000000003e00
#define MACTRL_ENC_INTLV_B1 0x0000000000003e00UL
#define MACTRL_ENC_INTLV_B1_SHIFT 9
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B0 0x00000000000001e0
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B0 0x00000000000001e0UL
#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B0_SHIFT 5
#define MACTRL_ENC_INTLV_B0 0x000000000000001f
#define MACTRL_ENC_INTLV_B0 0x000000000000001fUL
#define MACTRL_ENC_INTLV_B0_SHIFT 0
#endif /* _SPARC64_CHMCTRL_H */
......@@ -116,12 +116,12 @@ typedef u32 compat_sigset_word;
*/
typedef u32 compat_uptr_t;
static inline void *compat_ptr(compat_uptr_t uptr)
static inline void __user *compat_ptr(compat_uptr_t uptr)
{
return (void *)(unsigned long)uptr;
return (void __user *)(unsigned long)uptr;
}
static __inline__ void *compat_alloc_user_space(long len)
static __inline__ void __user *compat_alloc_user_space(long len)
{
struct pt_regs *regs = current_thread_info()->kregs;
unsigned long usp = regs->u_regs[UREG_I6];
......@@ -129,7 +129,7 @@ static __inline__ void *compat_alloc_user_space(long len)
if (!(test_thread_flag(TIF_32BIT)))
usp += STACK_BIAS;
return (void *) (usp - len);
return (void __user *) (usp - len);
}
#endif /* _ASM_SPARC64_COMPAT_H */
/* const.h: Macros for dealing with constants. */
#ifndef _SPARC64_CONST_H
#define _SPARC64_CONST_H
/* Some constant macros are used in both assembler and
* C code. Therefore we cannot annotate them always with
* 'UL' and other type specificers unilaterally. We
* use the following macros to deal with this.
*/
#ifdef __ASSEMBLY__
#define _AC(X,Y) X
#else
#define _AC(X,Y) (X##Y)
#endif
#endif /* !(_SPARC64_CONST_H) */
......@@ -55,15 +55,6 @@ typedef struct {
#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT)
#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT)
/*
* The hardirq mask has to be large enough to have
* space for potentially all IRQ sources in the system
* nesting on a single CPU:
*/
#if (1 << HARDIRQ_BITS) < NR_IRQS
# error HARDIRQ_BITS is too low!
#endif
/*
* Are we doing bottom half or hardware interrupt processing?
* Are we in a softirq context? Interrupt context?
......
......@@ -7,13 +7,13 @@
#define _SPARC64_IOMMU_H
/* The format of an iopte in the page tables. */
#define IOPTE_VALID 0x8000000000000000 /* IOPTE is valid */
#define IOPTE_64K 0x2000000000000000 /* IOPTE is for 64k page */
#define IOPTE_STBUF 0x1000000000000000 /* DVMA can use streaming buffer */
#define IOPTE_INTRA 0x0800000000000000 /* SBUS slot-->slot direct transfer */
#define IOPTE_CONTEXT 0x07ff800000000000 /* Context number */
#define IOPTE_PAGE 0x00007fffffffe000 /* Physical page number (PA[42:13]) */
#define IOPTE_CACHE 0x0000000000000010 /* Cached (in UPA E-cache) */
#define IOPTE_WRITE 0x0000000000000002 /* Writeable */
#define IOPTE_VALID 0x8000000000000000UL /* IOPTE is valid */
#define IOPTE_64K 0x2000000000000000UL /* IOPTE is for 64k page */
#define IOPTE_STBUF 0x1000000000000000UL /* DVMA can use streaming buffer */
#define IOPTE_INTRA 0x0800000000000000UL /* SBUS slot-->slot direct transfer*/
#define IOPTE_CONTEXT 0x07ff800000000000UL /* Context number */
#define IOPTE_PAGE 0x00007fffffffe000UL /* Physical page number (PA[42:13])*/
#define IOPTE_CACHE 0x0000000000000010UL /* Cached (in UPA E-cache) */
#define IOPTE_WRITE 0x0000000000000002UL /* Writeable */
#endif /* !(_SPARC_IOMMU_H) */
......@@ -2,17 +2,19 @@
#ifndef _SPARC64_LSU_H
#define _SPARC64_LSU_H
#include <asm/const.h>
/* LSU Control Register */
#define LSU_CONTROL_PM 0x000001fe00000000 /* Phys-watchpoint byte mask */
#define LSU_CONTROL_VM 0x00000001fe000000 /* Virt-watchpoint byte mask */
#define LSU_CONTROL_PR 0x0000000001000000 /* Phys-read watchpoint enable */
#define LSU_CONTROL_PW 0x0000000000800000 /* Phys-write watchpoint enable */
#define LSU_CONTROL_VR 0x0000000000400000 /* Virt-read watchpoint enable */
#define LSU_CONTROL_VW 0x0000000000200000 /* Virt-write watchpoint enable */
#define LSU_CONTROL_FM 0x00000000000ffff0 /* Parity mask enables. */
#define LSU_CONTROL_DM 0x0000000000000008 /* Data MMU enable. */
#define LSU_CONTROL_IM 0x0000000000000004 /* Instruction MMU enable. */
#define LSU_CONTROL_DC 0x0000000000000002 /* Data cache enable. */
#define LSU_CONTROL_IC 0x0000000000000001 /* Instruction cache enable. */
#define LSU_CONTROL_PM _AC(0x000001fe00000000,UL) /* Phys-watchpoint byte mask*/
#define LSU_CONTROL_VM _AC(0x00000001fe000000,UL) /* Virt-watchpoint byte mask*/
#define LSU_CONTROL_PR _AC(0x0000000001000000,UL) /* Phys-rd watchpoint enable*/
#define LSU_CONTROL_PW _AC(0x0000000000800000,UL) /* Phys-wr watchpoint enable*/
#define LSU_CONTROL_VR _AC(0x0000000000400000,UL) /* Virt-rd watchpoint enable*/
#define LSU_CONTROL_VW _AC(0x0000000000200000,UL) /* Virt-wr watchpoint enable*/
#define LSU_CONTROL_FM _AC(0x00000000000ffff0,UL) /* Parity mask enables. */
#define LSU_CONTROL_DM _AC(0x0000000000000008,UL) /* Data MMU enable. */
#define LSU_CONTROL_IM _AC(0x0000000000000004,UL) /* Instruction MMU enable. */
#define LSU_CONTROL_DC _AC(0x0000000000000002,UL) /* Data cache enable. */
#define LSU_CONTROL_IC _AC(0x0000000000000001,UL) /* Instruction cache enable.*/
#endif /* !(_SPARC64_LSU_H) */
......@@ -4,18 +4,12 @@
#define _SPARC64_PAGE_H
#include <linux/config.h>
#include <asm/const.h>
#define PAGE_SHIFT 13
#ifndef __ASSEMBLY__
/* I have my suspicions... -DaveM */
#define PAGE_SIZE (1UL << PAGE_SHIFT)
#else
#define PAGE_SIZE (1 << PAGE_SHIFT)
#endif
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
#ifdef __KERNEL__
#ifndef __ASSEMBLY__
......@@ -99,13 +93,13 @@ typedef unsigned long iopgprot_t;
#endif
#ifdef CONFIG_HUGETLB_PAGE
#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
#define HPAGE_MASK (~(HPAGE_SIZE - 1UL))
#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
#endif
#define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \
(0x0000000070000000UL) : (PAGE_OFFSET))
(_AC(0x0000000070000000,UL)) : (PAGE_OFFSET))
#endif /* !(__ASSEMBLY__) */
......@@ -115,7 +109,7 @@ typedef unsigned long iopgprot_t;
/* We used to stick this into a hard-coded global register (%g4)
* but that does not make sense anymore.
*/
#define PAGE_OFFSET 0xFFFFF80000000000
#define PAGE_OFFSET _AC(0xFFFFF80000000000,UL)
#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET)
#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
......
......@@ -168,7 +168,7 @@ extern int pci_dma_supported(struct pci_dev *hwdev, u64 mask);
* can drive enough of the 64 bits.
*/
#define PCI64_REQUIRED_MASK (~(dma64_addr_t)0)
#define PCI64_ADDR_BASE 0xfffc000000000000
#define PCI64_ADDR_BASE 0xfffc000000000000UL
/* Usage of the pci_dac_foo interfaces is only valid if this
* test passes.
......
......@@ -18,6 +18,7 @@
#include <asm/system.h>
#include <asm/page.h>
#include <asm/processor.h>
#include <asm/const.h>
/* The kernel image occupies 0x4000000 to 0x1000000 (4MB --> 16MB).
* The page copy blockops use 0x1000000 to 0x18000000 (16MB --> 24MB).
......@@ -26,14 +27,14 @@
* There is a single static kernel PMD which maps from 0x0 to address
* 0x400000000.
*/
#define TLBTEMP_BASE 0x0000000001000000
#define MODULES_VADDR 0x0000000002000000
#define MODULES_LEN 0x000000007e000000
#define MODULES_END 0x0000000080000000
#define VMALLOC_START 0x0000000140000000
#define VMALLOC_END 0x0000000200000000
#define LOW_OBP_ADDRESS 0x00000000f0000000
#define HI_OBP_ADDRESS 0x0000000100000000
#define TLBTEMP_BASE _AC(0x0000000001000000,UL)
#define MODULES_VADDR _AC(0x0000000002000000,UL)
#define MODULES_LEN _AC(0x000000007e000000,UL)
#define MODULES_END _AC(0x0000000080000000,UL)
#define VMALLOC_START _AC(0x0000000140000000,UL)
#define VMALLOC_END _AC(0x0000000200000000,UL)
#define LOW_OBP_ADDRESS _AC(0x00000000f0000000,UL)
#define HI_OBP_ADDRESS _AC(0x0000000100000000,UL)
/* XXX All of this needs to be rethought so we can take advantage
* XXX cheetah's full 64-bit virtual address space, ie. no more hole
......@@ -49,7 +50,9 @@
* long). Finally, the higher few bits determine pgde#.
*/
/* PMD_SHIFT determines the size of the area a second-level page table can map */
/* PMD_SHIFT determines the size of the area a second-level page
* table can map
*/
#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3))
#define PMD_SIZE (1UL << PMD_SHIFT)
#define PMD_MASK (~(PMD_SIZE-1))
......@@ -78,7 +81,8 @@
*/
#define REAL_PTRS_PER_PMD (1UL << PMD_BITS)
#define PTRS_PER_PMD ((const int)(test_thread_flag(TIF_32BIT) ? \
(1UL << (32 - (PAGE_SHIFT-3) - PAGE_SHIFT)) : (REAL_PTRS_PER_PMD)))
(1UL << (32 - (PAGE_SHIFT-3) - PAGE_SHIFT)) : \
(REAL_PTRS_PER_PMD)))
/*
* We cannot use the top address range because VPTE table lives there. This
......@@ -86,9 +90,9 @@
* vpte size, then aligns it to the number of bytes mapped by one pgde, and
* thus calculates the number of pgdes needed.
*/
#define PTRS_PER_PGD (((1UL << VA_BITS) - VPTE_SIZE + (1UL << (PAGE_SHIFT + \
(PAGE_SHIFT-3) + PMD_BITS)) - 1) / (1UL << (PAGE_SHIFT + \
(PAGE_SHIFT-3) + PMD_BITS)))
#define PTRS_PER_PGD (((1UL << VA_BITS) - VPTE_SIZE + (1UL << (PAGE_SHIFT + \
(PAGE_SHIFT-3) + PMD_BITS)) - 1) / (1UL << (PAGE_SHIFT + \
(PAGE_SHIFT-3) + PMD_BITS)))
/* Kernel has a separate 44bit address space. */
#define USER_PTRS_PER_PGD ((const int)(test_thread_flag(TIF_32BIT)) ? \
......@@ -102,33 +106,33 @@
#endif /* !(__ASSEMBLY__) */
/* Spitfire/Cheetah TTE bits. */
#define _PAGE_VALID 0x8000000000000000 /* Valid TTE */
#define _PAGE_R 0x8000000000000000 /* Used to keep ref bit up to date */
#define _PAGE_SZ4MB 0x6000000000000000 /* 4MB Page */
#define _PAGE_SZ512K 0x4000000000000000 /* 512K Page */
#define _PAGE_SZ64K 0x2000000000000000 /* 64K Page */
#define _PAGE_SZ8K 0x0000000000000000 /* 8K Page */
#define _PAGE_NFO 0x1000000000000000 /* No Fault Only */
#define _PAGE_IE 0x0800000000000000 /* Invert Endianness */
#define _PAGE_SN 0x0000800000000000 /* (Cheetah) Snoop */
#define _PAGE_PADDR_SF 0x000001FFFFFFE000 /* (Spitfire) Phys Address [40:13] */
#define _PAGE_PADDR 0x000007FFFFFFE000 /* (Cheetah) Phys Address [42:13] */
#define _PAGE_SOFT 0x0000000000001F80 /* Software bits */
#define _PAGE_L 0x0000000000000040 /* Locked TTE */
#define _PAGE_CP 0x0000000000000020 /* Cacheable in Physical Cache */
#define _PAGE_CV 0x0000000000000010 /* Cacheable in Virtual Cache */
#define _PAGE_E 0x0000000000000008 /* side-Effect */
#define _PAGE_P 0x0000000000000004 /* Privileged Page */
#define _PAGE_W 0x0000000000000002 /* Writable */
#define _PAGE_G 0x0000000000000001 /* Global */
#define _PAGE_VALID _AC(0x8000000000000000,UL) /* Valid TTE */
#define _PAGE_R _AC(0x8000000000000000,UL) /* Keep ref bit up to date */
#define _PAGE_SZ4MB _AC(0x6000000000000000,UL) /* 4MB Page */
#define _PAGE_SZ512K _AC(0x4000000000000000,UL) /* 512K Page */
#define _PAGE_SZ64K _AC(0x2000000000000000,UL) /* 64K Page */
#define _PAGE_SZ8K _AC(0x0000000000000000,UL) /* 8K Page */
#define _PAGE_NFO _AC(0x1000000000000000,UL) /* No Fault Only */
#define _PAGE_IE _AC(0x0800000000000000,UL) /* Invert Endianness */
#define _PAGE_SN _AC(0x0000800000000000,UL) /* (Cheetah) Snoop */
#define _PAGE_PADDR_SF _AC(0x000001FFFFFFE000,UL) /* (Spitfire) paddr [40:13]*/
#define _PAGE_PADDR _AC(0x000007FFFFFFE000,UL) /* (Cheetah) paddr [42:13] */
#define _PAGE_SOFT _AC(0x0000000000001F80,UL) /* Software bits */
#define _PAGE_L _AC(0x0000000000000040,UL) /* Locked TTE */
#define _PAGE_CP _AC(0x0000000000000020,UL) /* Cacheable in P-Cache */
#define _PAGE_CV _AC(0x0000000000000010,UL) /* Cacheable in V-Cache */
#define _PAGE_E _AC(0x0000000000000008,UL) /* side-Effect */
#define _PAGE_P _AC(0x0000000000000004,UL) /* Privileged Page */
#define _PAGE_W _AC(0x0000000000000002,UL) /* Writable */
#define _PAGE_G _AC(0x0000000000000001,UL) /* Global */
/* Here are the SpitFire software bits we use in the TTE's. */
#define _PAGE_FILE 0x0000000000001000 /* Pagecache page */
#define _PAGE_MODIFIED 0x0000000000000800 /* Modified Page (ie. dirty) */
#define _PAGE_ACCESSED 0x0000000000000400 /* Accessed Page (ie. referenced) */
#define _PAGE_READ 0x0000000000000200 /* Readable SW Bit */
#define _PAGE_WRITE 0x0000000000000100 /* Writable SW Bit */
#define _PAGE_PRESENT 0x0000000000000080 /* Present Page (ie. not swapped out) */
#define _PAGE_FILE _AC(0x0000000000001000,UL) /* Pagecache page */
#define _PAGE_MODIFIED _AC(0x0000000000000800,UL) /* Modified (dirty) */
#define _PAGE_ACCESSED _AC(0x0000000000000400,UL) /* Accessed (ref'd) */
#define _PAGE_READ _AC(0x0000000000000200,UL) /* Readable SW Bit */
#define _PAGE_WRITE _AC(0x0000000000000100,UL) /* Writable SW Bit */
#define _PAGE_PRESENT _AC(0x0000000000000080,UL) /* Present */
#if PAGE_SHIFT == 13
#define _PAGE_SZBITS _PAGE_SZ8K
......@@ -173,7 +177,8 @@
#define _PFN_MASK _PAGE_PADDR
#define pg_iobits (_PAGE_VALID | _PAGE_PRESENT | __DIRTY_BITS | __ACCESS_BITS | _PAGE_E)
#define pg_iobits (_PAGE_VALID | _PAGE_PRESENT | __DIRTY_BITS | \
__ACCESS_BITS | _PAGE_E)
#define __P000 PAGE_NONE
#define __P001 PAGE_READONLY
......@@ -260,9 +265,12 @@ static inline pte_t pte_modify(pte_t orig_pte, pgprot_t new_prot)
#define pte_dirty(pte) (pte_val(pte) & _PAGE_MODIFIED)
#define pte_young(pte) (pte_val(pte) & _PAGE_ACCESSED)
#define pte_wrprotect(pte) (__pte(pte_val(pte) & ~(_PAGE_WRITE|_PAGE_W)))
#define pte_rdprotect(pte) (__pte(((pte_val(pte)<<1UL)>>1UL) & ~_PAGE_READ))
#define pte_mkclean(pte) (__pte(pte_val(pte) & ~(_PAGE_MODIFIED|_PAGE_W)))
#define pte_mkold(pte) (__pte(((pte_val(pte)<<1UL)>>1UL) & ~_PAGE_ACCESSED))
#define pte_rdprotect(pte) \
(__pte(((pte_val(pte)<<1UL)>>1UL) & ~_PAGE_READ))
#define pte_mkclean(pte) \
(__pte(pte_val(pte) & ~(_PAGE_MODIFIED|_PAGE_W)))
#define pte_mkold(pte) \
(__pte(((pte_val(pte)<<1UL)>>1UL) & ~_PAGE_ACCESSED))
/* Permanent address of a page. */
#define __page_address(page) page_address(page)
......@@ -280,12 +288,14 @@ static inline pte_t pte_modify(pte_t orig_pte, pgprot_t new_prot)
#define pgd_offset_k(address) pgd_offset(&init_mm, address)
/* Find an entry in the second-level page table.. */
#define pmd_offset(dir, address) ((pmd_t *) pgd_page(*(dir)) + \
((address >> PMD_SHIFT) & (REAL_PTRS_PER_PMD-1)))
#define pmd_offset(dir, address) \
((pmd_t *) pgd_page(*(dir)) + \
((address >> PMD_SHIFT) & (REAL_PTRS_PER_PMD-1)))
/* Find an entry in the third-level page table.. */
#define pte_index(dir, address) ((pte_t *) __pmd_page(*(dir)) + \
((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
#define pte_index(dir, address) \
((pte_t *) __pmd_page(*(dir)) + \
((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
#define pte_offset_kernel pte_index
#define pte_offset_map pte_index
#define pte_offset_map_nested pte_index
......@@ -305,7 +315,8 @@ extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
static inline pte_t mk_pte_io(unsigned long page, pgprot_t prot, int space)
{
pte_t pte;
pte_val(pte) = ((page) | pgprot_val(prot) | _PAGE_E) & ~(unsigned long)_PAGE_CACHE;
pte_val(pte) = (((page) | pgprot_val(prot) | _PAGE_E) &
~(unsigned long)_PAGE_CACHE);
pte_val(pte) |= (((unsigned long)space) << 32);
return pte;
}
......@@ -365,7 +376,8 @@ extern unsigned long *sparc64_valid_addr_bitmap;
#define kern_addr_valid(addr) \
(test_bit(__pa((unsigned long)(addr))>>22, sparc64_valid_addr_bitmap))
extern int io_remap_page_range(struct vm_area_struct *vma, unsigned long from, unsigned long offset,
extern int io_remap_page_range(struct vm_area_struct *vma, unsigned long from,
unsigned long offset,
unsigned long size, pgprot_t prot, int space);
#include <asm-generic/pgtable.h>
......@@ -376,7 +388,9 @@ extern int io_remap_page_range(struct vm_area_struct *vma, unsigned long from, u
/* We provide a special get_unmapped_area for framebuffer mmaps to try and use
* the largest alignment possible such that larget PTEs can be used.
*/
extern unsigned long get_fb_unmapped_area(struct file *filp, unsigned long, unsigned long, unsigned long, unsigned long);
extern unsigned long get_fb_unmapped_area(struct file *filp, unsigned long,
unsigned long, unsigned long,
unsigned long);
#define HAVE_ARCH_FB_UNMAPPED_AREA
/*
......
......@@ -2,6 +2,8 @@
#ifndef _SPARC64_PSTATE_H
#define _SPARC64_PSTATE_H
#include <asm/const.h>
/* The V9 PSTATE Register (with SpitFire extensions).
*
* -----------------------------------------------------------------------
......@@ -9,20 +11,20 @@
* -----------------------------------------------------------------------
* 63 12 11 10 9 8 7 6 5 4 3 2 1 0
*/
#define PSTATE_IG 0x0000000000000800 /* Interrupt Globals. */
#define PSTATE_MG 0x0000000000000400 /* MMU Globals. */
#define PSTATE_CLE 0x0000000000000200 /* Current Little Endian. */
#define PSTATE_TLE 0x0000000000000100 /* Trap Little Endian. */
#define PSTATE_MM 0x00000000000000c0 /* Memory Model. */
#define PSTATE_TSO 0x0000000000000000 /* MM: Total Store Order */
#define PSTATE_PSO 0x0000000000000040 /* MM: Partial Store Order */
#define PSTATE_RMO 0x0000000000000080 /* MM: Relaxed Memory Order */
#define PSTATE_RED 0x0000000000000020 /* Reset Error Debug State. */
#define PSTATE_PEF 0x0000000000000010 /* Floating Point Enable. */
#define PSTATE_AM 0x0000000000000008 /* Address Mask. */
#define PSTATE_PRIV 0x0000000000000004 /* Privilege. */
#define PSTATE_IE 0x0000000000000002 /* Interrupt Enable. */
#define PSTATE_AG 0x0000000000000001 /* Alternate Globals. */
#define PSTATE_IG _AC(0x0000000000000800,UL) /* Interrupt Globals. */
#define PSTATE_MG _AC(0x0000000000000400,UL) /* MMU Globals. */
#define PSTATE_CLE _AC(0x0000000000000200,UL) /* Current Little Endian.*/
#define PSTATE_TLE _AC(0x0000000000000100,UL) /* Trap Little Endian. */
#define PSTATE_MM _AC(0x00000000000000c0,UL) /* Memory Model. */
#define PSTATE_TSO _AC(0x0000000000000000,UL) /* MM: TotalStoreOrder */
#define PSTATE_PSO _AC(0x0000000000000040,UL) /* MM: PartialStoreOrder */
#define PSTATE_RMO _AC(0x0000000000000080,UL) /* MM: RelaxedMemoryOrder*/
#define PSTATE_RED _AC(0x0000000000000020,UL) /* Reset Error Debug. */
#define PSTATE_PEF _AC(0x0000000000000010,UL) /* Floating Point Enable.*/
#define PSTATE_AM _AC(0x0000000000000008,UL) /* Address Mask. */
#define PSTATE_PRIV _AC(0x0000000000000004,UL) /* Privilege. */
#define PSTATE_IE _AC(0x0000000000000002,UL) /* Interrupt Enable. */
#define PSTATE_AG _AC(0x0000000000000001,UL) /* Alternate Globals. */
/* The V9 TSTATE Register (with SpitFire and Linux extensions).
*
......@@ -31,35 +33,35 @@
* ---------------------------------------------------------------
* 63 40 39 32 31 24 23 20 19 8 7 5 4 0
*/
#define TSTATE_CCR 0x000000ff00000000 /* Condition Codes. */
#define TSTATE_XCC 0x000000f000000000 /* Condition Codes. */
#define TSTATE_XNEG 0x0000008000000000 /* %xcc Negative. */
#define TSTATE_XZERO 0x0000004000000000 /* %xcc Zero. */
#define TSTATE_XOVFL 0x0000002000000000 /* %xcc Overflow. */
#define TSTATE_XCARRY 0x0000001000000000 /* %xcc Carry. */
#define TSTATE_ICC 0x0000000f00000000 /* Condition Codes. */
#define TSTATE_INEG 0x0000000800000000 /* %icc Negative. */
#define TSTATE_IZERO 0x0000000400000000 /* %icc Zero. */
#define TSTATE_IOVFL 0x0000000200000000 /* %icc Overflow. */
#define TSTATE_ICARRY 0x0000000100000000 /* %icc Carry. */
#define TSTATE_ASI 0x00000000ff000000 /* Address Space Identifier. */
#define TSTATE_PIL 0x0000000000f00000 /* %pil (Linux traps set this) */
#define TSTATE_PSTATE 0x00000000000fff00 /* PSTATE. */
#define TSTATE_IG 0x0000000000080000 /* Interrupt Globals. */
#define TSTATE_MG 0x0000000000040000 /* MMU Globals. */
#define TSTATE_CLE 0x0000000000020000 /* Current Little Endian. */
#define TSTATE_TLE 0x0000000000010000 /* Trap Little Endian. */
#define TSTATE_MM 0x000000000000c000 /* Memory Model. */
#define TSTATE_TSO 0x0000000000000000 /* MM: Total Store Order */
#define TSTATE_PSO 0x0000000000004000 /* MM: Partial Store Order */
#define TSTATE_RMO 0x0000000000008000 /* MM: Relaxed Memory Order */
#define TSTATE_RED 0x0000000000002000 /* Reset Error Debug State. */
#define TSTATE_PEF 0x0000000000001000 /* Floating Point Enable. */
#define TSTATE_AM 0x0000000000000800 /* Address Mask. */
#define TSTATE_PRIV 0x0000000000000400 /* Privilege. */
#define TSTATE_IE 0x0000000000000200 /* Interrupt Enable. */
#define TSTATE_AG 0x0000000000000100 /* Alternate Globals. */
#define TSTATE_CWP 0x000000000000001f /* Current Window Pointer. */
#define TSTATE_CCR _AC(0x000000ff00000000,UL) /* Condition Codes. */
#define TSTATE_XCC _AC(0x000000f000000000,UL) /* Condition Codes. */
#define TSTATE_XNEG _AC(0x0000008000000000,UL) /* %xcc Negative. */
#define TSTATE_XZERO _AC(0x0000004000000000,UL) /* %xcc Zero. */
#define TSTATE_XOVFL _AC(0x0000002000000000,UL) /* %xcc Overflow. */
#define TSTATE_XCARRY _AC(0x0000001000000000,UL) /* %xcc Carry. */
#define TSTATE_ICC _AC(0x0000000f00000000,UL) /* Condition Codes. */
#define TSTATE_INEG _AC(0x0000000800000000,UL) /* %icc Negative. */
#define TSTATE_IZERO _AC(0x0000000400000000,UL) /* %icc Zero. */
#define TSTATE_IOVFL _AC(0x0000000200000000,UL) /* %icc Overflow. */
#define TSTATE_ICARRY _AC(0x0000000100000000,UL) /* %icc Carry. */
#define TSTATE_ASI _AC(0x00000000ff000000,UL) /* AddrSpace ID. */
#define TSTATE_PIL _AC(0x0000000000f00000,UL) /* %pil (Linux traps)*/
#define TSTATE_PSTATE _AC(0x00000000000fff00,UL) /* PSTATE. */
#define TSTATE_IG _AC(0x0000000000080000,UL) /* Interrupt Globals.*/
#define TSTATE_MG _AC(0x0000000000040000,UL) /* MMU Globals. */
#define TSTATE_CLE _AC(0x0000000000020000,UL) /* CurrLittleEndian. */
#define TSTATE_TLE _AC(0x0000000000010000,UL) /* TrapLittleEndian. */
#define TSTATE_MM _AC(0x000000000000c000,UL) /* Memory Model. */
#define TSTATE_TSO _AC(0x0000000000000000,UL) /* MM: TSO */
#define TSTATE_PSO _AC(0x0000000000004000,UL) /* MM: PSO */
#define TSTATE_RMO _AC(0x0000000000008000,UL) /* MM: RMO */
#define TSTATE_RED _AC(0x0000000000002000,UL) /* Reset Error Debug.*/
#define TSTATE_PEF _AC(0x0000000000001000,UL) /* FPU Enable. */
#define TSTATE_AM _AC(0x0000000000000800,UL) /* Address Mask. */
#define TSTATE_PRIV _AC(0x0000000000000400,UL) /* Privilege. */
#define TSTATE_IE _AC(0x0000000000000200,UL) /* Interrupt Enable. */
#define TSTATE_AG _AC(0x0000000000000100,UL) /* Alternate Globals.*/
#define TSTATE_CWP _AC(0x000000000000001f,UL) /* Curr Win-Pointer. */
/* Floating-Point Registers State Register.
*
......@@ -68,9 +70,9 @@
* --------------------------------
* 63 3 2 1 0
*/
#define FPRS_FEF 0x0000000000000004 /* Enable Floating Point. */
#define FPRS_DU 0x0000000000000002 /* Dirty Upper. */
#define FPRS_DL 0x0000000000000001 /* Dirty Lower. */
#define FPRS_FEF _AC(0x0000000000000004,UL) /* FPU Enable. */
#define FPRS_DU _AC(0x0000000000000002,UL) /* Dirty Upper. */
#define FPRS_DL _AC(0x0000000000000001,UL) /* Dirty Lower. */
/* Version Register.
*
......@@ -79,10 +81,10 @@
* ------------------------------------------------------
* 63 48 47 32 31 24 23 16 15 8 7 5 4 0
*/
#define VERS_MANUF 0xffff000000000000 /* Manufacturer. */
#define VERS_IMPL 0x0000ffff00000000 /* Implementation. */
#define VERS_MASK 0x00000000ff000000 /* Mask Set Revision. */
#define VERS_MAXTL 0x000000000000ff00 /* Maximum Trap Level. */
#define VERS_MAXWIN 0x000000000000001f /* Maximum Reg Window Index. */
#define VERS_MANUF _AC(0xffff000000000000,UL) /* Manufacturer. */
#define VERS_IMPL _AC(0x0000ffff00000000,UL) /* Implementation. */
#define VERS_MASK _AC(0x00000000ff000000,UL) /* Mask Set Revision.*/
#define VERS_MAXTL _AC(0x000000000000ff00,UL) /* Max Trap Level. */
#define VERS_MAXWIN _AC(0x000000000000001f,UL) /* Max RegWindow Idx.*/
#endif /* !(_SPARC64_PSTATE_H) */
......@@ -99,7 +99,7 @@ typedef struct sigevent32 {
} _sigev_un;
} sigevent_t32;
extern int copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from);
extern int copy_siginfo_to_user32(siginfo_t32 __user *to, siginfo_t *from);
#endif /* __KERNEL__ */
......
......@@ -212,7 +212,7 @@ struct __new_sigaction32 {
struct k_sigaction {
struct __new_sigaction sa;
void *ka_restorer;
void __user *ka_restorer;
};
#endif
......
......@@ -56,7 +56,8 @@ struct thread_info {
unsigned long gsr[7];
unsigned long xfsr[7];
__u64 *user_cntd0, *user_cntd1;
__u64 __user *user_cntd0;
__u64 __user *user_cntd1;
__u64 kernel_cntd0, kernel_cntd1;
__u64 pcr_reg;
......
......@@ -90,6 +90,10 @@ unsigned long search_extables_range(unsigned long addr, unsigned long *g2);
extern void __ret_efault(void);
extern long not_a_user_address;
#define check_user_ptr(x) \
(void) ({ void __user * __userptr = (__typeof__(*(x)) *)&not_a_user_address; __userptr; })
/* Uh, these should become the main single-value transfer routines..
* They automatically use the right size if we just have the right
* pointer type..
......@@ -101,10 +105,12 @@ extern void __ret_efault(void);
*/
#define put_user(x,ptr) ({ \
unsigned long __pu_addr = (unsigned long)(ptr); \
check_user_ptr(ptr); \
__put_user_nocheck((__typeof__(*(ptr)))(x),__pu_addr,sizeof(*(ptr))); })
#define get_user(x,ptr) ({ \
unsigned long __gu_addr = (unsigned long)(ptr); \
check_user_ptr(ptr); \
__get_user_nocheck((x),__gu_addr,sizeof(*(ptr)),__typeof__(*(ptr))); })
#define __put_user(x,ptr) put_user(x,ptr)
......@@ -163,7 +169,7 @@ __asm__ __volatile__( \
".previous\n\n\t" \
: "=r" (foo) : "r" (x), "r" (__m(addr))); \
else \
__asm__ __volatile( \
__asm__ __volatile__( \
"/* Put user asm ret, inline. */\n" \
"1:\t" "st"#size "a %1, [%2] %%asi\n\n\t" \
".section .fixup,#alloc,#execinstr\n\t" \
......@@ -263,12 +269,12 @@ extern unsigned long __copy_in_user(void __user *to, const void __user *from,
#define copy_to_user __copy_to_user
#define copy_in_user __copy_in_user
extern unsigned long __bzero_noasi(void *, unsigned long);
extern unsigned long __bzero_noasi(void __user *, unsigned long);
static inline unsigned long __clear_user(void __user *addr, unsigned long size)
{
return __bzero_noasi((void *) addr, size);
return __bzero_noasi(addr, size);
}
#define clear_user __clear_user
......
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