Commit 111610ab authored by David S. Miller's avatar David S. Miller

[SPARC64]: Lots of sparse work for arch/sparc64.

parent ab843583
......@@ -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
......@@ -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);
......
......@@ -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,9 +675,9 @@ 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,
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,
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,14 +792,14 @@ 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) &&
if ((!pid || pid == current->pid) &&
!pgid) {
sys_setsid();
ret = 0;
......@@ -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,10 +971,10 @@ 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) ||
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) ||
......@@ -979,10 +991,10 @@ static inline int sunos_msqid_get(struct msqid_ds32 *user,
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) ||
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) ||
......@@ -999,17 +1011,17 @@ static inline int sunos_msqid_put(struct msqid_ds32 *user,
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) ||
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) ||
if (put_user(kern->mtype, &user->mtype) ||
__copy_to_user(user->mtext, kern->mtext, len))
return -EFAULT;
return 0;
......@@ -1017,7 +1029,7 @@ static inline int sunos_msgbuf_put(struct msgbuf32 *user, struct msgbuf *kern, i
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),
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,10 +1106,10 @@ 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) ||
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) ||
......@@ -1111,10 +1125,10 @@ static inline int sunos_shmid_get(struct shmid_ds32 *user,
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) ||
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) ||
......@@ -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;
......
......@@ -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 */
......@@ -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) */
......@@ -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)
......@@ -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