summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjdike <jdike>2003-12-16 16:21:46 +0000
committerjdike <jdike>2003-12-16 16:21:46 +0000
commit3c0c3e7adf61899a435bb58bb332875cda5c2750 (patch)
treed91b0e1631844a4859157677948af5c843f56705
parent8f2aace62ecadbcc256bae04f0b28e0650819e54 (diff)
downloaduml-history-3c0c3e7adf61899a435bb58bb332875cda5c2750.tar.gz
Fixed a compile bug.
Code cleanup and restructuring. Improved error messages. Random small bug fixes.
-rw-r--r--arch/um/drivers/hostaudio_kern.c16
-rw-r--r--arch/um/fs/hostfs/hostfs_user.c24
-rw-r--r--arch/um/kernel/skas/Makefile3
-rw-r--r--arch/um/kernel/skas/include/mode.h5
-rw-r--r--arch/um/kernel/skas/include/uaccess.h208
-rw-r--r--arch/um/kernel/skas/mmu.c8
-rw-r--r--arch/um/kernel/skas/uaccess.c217
-rw-r--r--arch/um/kernel/tt/Makefile4
-rw-r--r--arch/um/kernel/tt/include/uaccess.h65
-rw-r--r--arch/um/kernel/tt/uaccess.c73
-rw-r--r--arch/um/kernel/tt/uaccess_user.c8
-rw-r--r--arch/um/os-Linux/drivers/tuntap_user.c2
-rw-r--r--arch/um/sys-i386/Makefile2
-rw-r--r--drivers/char/tty_io.c7
-rw-r--r--include/asm-um/system-generic.h2
15 files changed, 352 insertions, 292 deletions
diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c
index 74c09d2..6595eac 100644
--- a/arch/um/drivers/hostaudio_kern.c
+++ b/arch/um/drivers/hostaudio_kern.c
@@ -20,6 +20,14 @@
char *dsp = HOSTAUDIO_DEV_DSP;
char *mixer = HOSTAUDIO_DEV_MIXER;
+#define DSP_HELP \
+" This is used to specify the host dsp device to the hostaudio driver.\n" \
+" The default is \"" HOSTAUDIO_DEV_DSP "\".\n\n"
+
+#define MIXER_HELP \
+" This is used to specify the host mixer device to the hostaudio driver.\n" \
+" The default is \"" HOSTAUDIO_DEV_MIXER "\".\n\n"
+
#ifndef MODULE
static int set_dsp(char *name, int *add)
{
@@ -27,10 +35,6 @@ static int set_dsp(char *name, int *add)
return(0);
}
-#define DSP_HELP \
-" This is used to specify the host dsp device to the hostaudio driver.\n" \
-" The default is \"" HOSTAUDIO_DEV_DSP "\".\n\n"
-
__uml_setup("dsp=", set_dsp, "dsp=<dsp device>\n" DSP_HELP);
static int set_mixer(char *name, int *add)
@@ -39,10 +43,6 @@ static int set_mixer(char *name, int *add)
return(0);
}
-#define MIXER_HELP \
-" This is used to specify the host mixer device to the hostaudio driver.\n" \
-" The default is \"" HOSTAUDIO_DEV_MIXER "\".\n\n"
-
__uml_setup("mixer=", set_mixer, "mixer=<mixer device>\n" MIXER_HELP);
#else /*MODULE*/
diff --git a/arch/um/fs/hostfs/hostfs_user.c b/arch/um/fs/hostfs/hostfs_user.c
index 48f3e4e..eba3b6a 100644
--- a/arch/um/fs/hostfs/hostfs_user.c
+++ b/arch/um/fs/hostfs/hostfs_user.c
@@ -121,20 +121,32 @@ char *read_dir(void *stream, unsigned long long *pos,
int read_file(int fd, unsigned long long *offset, char *buf, int len)
{
- int n;
+ int n, err;
+
+ err = os_seek_file(fd, *offset);
+ if(err)
+ return(err);
+
+ n = os_read_file(fd, buf, len);
+ if(n < 0)
+ return(n);
- n = pread64(fd, buf, len, *offset);
- if(n < 0) return(-errno);
*offset += n;
return(n);
}
int write_file(int fd, unsigned long long *offset, const char *buf, int len)
{
- int n;
+ int n, err;
+
+ err = os_seek_file(fd, *offset);
+ if(err)
+ return(err);
+
+ n = os_write_file(fd, buf, len);
+ if(n < 0)
+ return(n);
- n = pwrite64(fd, buf, len, *offset);
- if(n < 0) return(-errno);
*offset += n;
return(n);
}
diff --git a/arch/um/kernel/skas/Makefile b/arch/um/kernel/skas/Makefile
index 944335e..cb26bee 100644
--- a/arch/um/kernel/skas/Makefile
+++ b/arch/um/kernel/skas/Makefile
@@ -6,7 +6,8 @@
O_TARGET = skas.o
obj-y = exec_kern.o exec_user.o mem.o mem_user.o mmu.o process.o \
- process_kern.o syscall_kern.o syscall_user.o time.o tlb.o trap_user.o
+ process_kern.o syscall_kern.o syscall_user.o time.o tlb.o trap_user.o \
+ uaccess.o
subdir-y = sys-$(SUBARCH)
diff --git a/arch/um/kernel/skas/include/mode.h b/arch/um/kernel/skas/include/mode.h
index 99563cd..aa16dc0 100644
--- a/arch/um/kernel/skas/include/mode.h
+++ b/arch/um/kernel/skas/include/mode.h
@@ -12,8 +12,9 @@ extern unsigned long exec_fpx_regs[];
extern int have_fpx_regs;
extern void user_time_init_skas(void);
-extern int copy_sc_from_user_skas(union uml_pt_regs *regs, void *from_ptr);
-extern int copy_sc_to_user_skas(void *to_ptr, void *fp,
+extern int copy_sc_from_user_skas(int pid, union uml_pt_regs *regs,
+ void *from_ptr);
+extern int copy_sc_to_user_skas(int pid, void *to_ptr, void *fp,
union uml_pt_regs *regs,
unsigned long fault_addr, int fault_type);
extern void sig_handler_common_skas(int sig, void *sc_ptr);
diff --git a/arch/um/kernel/skas/include/uaccess.h b/arch/um/kernel/skas/include/uaccess.h
index 67198a4..db499c5 100644
--- a/arch/um/kernel/skas/include/uaccess.h
+++ b/arch/um/kernel/skas/include/uaccess.h
@@ -6,15 +6,6 @@
#ifndef __SKAS_UACCESS_H
#define __SKAS_UACCESS_H
-#include "linux/string.h"
-#include "linux/sched.h"
-#include "asm/processor.h"
-#include "asm/pgtable.h"
-#include "asm/errno.h"
-#include "asm/current.h"
-#include "asm/a.out.h"
-#include "kern_util.h"
-
#define access_ok_skas(type, addr, size) \
((segment_eq(get_fs(), KERNEL_DS)) || \
(((unsigned long) (addr) < TASK_SIZE) && \
@@ -26,200 +17,15 @@ static inline int verify_area_skas(int type, const void * addr,
return(access_ok_skas(type, addr, size) ? 0 : -EFAULT);
}
-static inline unsigned long maybe_map(unsigned long virt, int is_write)
-{
- pte_t pte;
-
- void *phys = um_virt_to_phys(current, virt, &pte);
- int dummy_code;
-
- if(IS_ERR(phys) || (is_write && !pte_write(pte))){
- if(!handle_page_fault(virt, 0, is_write, 0, &dummy_code))
- return(0);
- phys = um_virt_to_phys(current, virt, NULL);
- }
- return((unsigned long) __va((unsigned long) phys));
-}
-
-static inline int buffer_op(unsigned long addr, int len,
- int (*op)(unsigned long addr, int len, void *arg),
- void *arg)
-{
- int size = min(PAGE_ALIGN(addr) - addr, (unsigned long) len);
- int remain = len, n;
-
- n = (*op)(addr, size, arg);
- if(n != 0)
- return(n < 0 ? remain : 0);
-
- addr += size;
- remain -= size;
- if(remain == 0)
- return(0);
-
- while(addr < ((addr + remain) & PAGE_MASK)){
- n = (*op)(addr, PAGE_SIZE, arg);
- if(n != 0)
- return(n < 0 ? remain : 0);
-
- addr += PAGE_SIZE;
- remain -= PAGE_SIZE;
- }
- if(remain == 0)
- return(0);
-
- n = (*op)(addr, remain, arg);
- if(n != 0)
- return(n < 0 ? remain : 0);
- return(0);
-}
-
-static inline int copy_chunk_from_user(unsigned long from, int len, void *arg)
-{
- unsigned long *to_ptr = arg, to = *to_ptr;
-
- from = maybe_map(from, 0);
- if(from == 0)
- return(-1);
-
- memcpy((void *) to, (void *) from, len);
- *to_ptr += len;
- return(0);
-}
-
-static inline int copy_from_user_skas(void *to, const void *from, int n)
-{
- if(segment_eq(get_fs(), KERNEL_DS)){
- memcpy(to, from, n);
- return(0);
- }
-
- return(access_ok_skas(VERIFY_READ, from, n) ?
- buffer_op((unsigned long) from, n, copy_chunk_from_user, &to) :
- n);
-}
-
-static inline int copy_chunk_to_user(unsigned long to, int len, void *arg)
-{
- unsigned long *from_ptr = arg, from = *from_ptr;
-
- to = maybe_map(to, 1);
- if(to == 0)
- return(-1);
-
- memcpy((void *) to, (void *) from, len);
- *from_ptr += len;
- return(0);
-}
-
-static inline int copy_to_user_skas(void *to, const void *from, int n)
-{
- if(segment_eq(get_fs(), KERNEL_DS)){
- memcpy(to, from, n);
- return(0);
- }
-
- return(access_ok_skas(VERIFY_WRITE, to, n) ?
- buffer_op((unsigned long) to, n, copy_chunk_to_user, &from) :
- n);
-}
-
-static inline int strncpy_chunk_from_user(unsigned long from, int len,
- void *arg)
-{
- char **to_ptr = arg, *to = *to_ptr;
- int n;
-
- from = maybe_map(from, 0);
- if(from == 0)
- return(-1);
-
- strncpy(to, (void *) from, len);
- n = strnlen(to, len);
- *to_ptr += n;
-
- if(n < len)
- return(1);
- return(0);
-}
-
-static inline int strncpy_from_user_skas(char *dst, const char *src, int count)
-{
- int n;
- char *ptr = dst;
-
- if(segment_eq(get_fs(), KERNEL_DS)){
- strncpy(dst, src, count);
- return(strnlen(dst, count));
- }
-
- if(!access_ok_skas(VERIFY_READ, src, 1))
- return(-EFAULT);
-
- n = buffer_op((unsigned long) src, count, strncpy_chunk_from_user,
- &ptr);
- if(n != 0)
- return(-EFAULT);
- return(strnlen(dst, count));
-}
-
-static inline int clear_chunk(unsigned long addr, int len, void *unused)
-{
- addr = maybe_map(addr, 1);
- if(addr == 0)
- return(-1);
-
- memset((void *) addr, 0, len);
- return(0);
-}
-
-static inline int __clear_user_skas(void *mem, int len)
-{
- return(buffer_op((unsigned long) mem, len, clear_chunk, NULL));
-}
-
-static inline int clear_user_skas(void *mem, int len)
-{
- if(segment_eq(get_fs(), KERNEL_DS)){
- memset(mem, 0, len);
- return(0);
- }
-
- return(access_ok_skas(VERIFY_WRITE, mem, len) ?
- buffer_op((unsigned long) mem, len, clear_chunk, NULL) : len);
-}
-
-static inline int strnlen_chunk(unsigned long str, int len, void *arg)
-{
- int *len_ptr = arg, n;
-
- str = maybe_map(str, 0);
- if(str == 0)
- return(-1);
-
- n = strnlen((void *) str, len);
- *len_ptr += n;
-
- if(n < len)
- return(1);
- return(0);
-}
-
-static inline int strnlen_user_skas(const void *str, int len)
-{
- int count = 0, n;
-
- if(segment_eq(get_fs(), KERNEL_DS))
- return(strnlen(str, len) + 1);
-
- n = buffer_op((unsigned long) str, len, strnlen_chunk, &count);
- if(n == 0)
- return(count + 1);
- return(-EFAULT);
-}
-
#endif
+extern int copy_from_user_skas(void *to, const void *from, int n);
+extern int copy_to_user_skas(void *to, const void *from, int n);
+extern int strncpy_from_user_skas(char *dst, const char *src, int count);
+extern int __clear_user_skas(void *mem, int len);
+extern int clear_user_skas(void *mem, int len);
+extern int strnlen_user_skas(const void *str, int len);
+
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c
index 34fb52e..008ca41 100644
--- a/arch/um/kernel/skas/mmu.c
+++ b/arch/um/kernel/skas/mmu.c
@@ -20,9 +20,11 @@ int init_new_context_skas(struct task_struct *task, struct mm_struct *mm)
else from = -1;
mm->context.skas.mm_fd = new_mm(from);
- if(mm->context.skas.mm_fd < 0)
- panic("init_new_context_skas - new_mm failed, errno = %d\n",
- mm->context.skas.mm_fd);
+ if(mm->context.skas.mm_fd < 0){
+ printk("init_new_context_skas - new_mm failed, errno = %d\n",
+ mm->context.skas.mm_fd);
+ return(mm->context.skas.mm_fd);
+ }
return(0);
}
diff --git a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c
new file mode 100644
index 0000000..ba1d853
--- /dev/null
+++ b/arch/um/kernel/skas/uaccess.c
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com)
+ * Licensed under the GPL
+ */
+
+#include "linux/stddef.h"
+#include "linux/kernel.h"
+#include "linux/string.h"
+#include "linux/fs.h"
+#include "linux/highmem.h"
+#include "asm/page.h"
+#include "asm/pgtable.h"
+#include "asm/uaccess.h"
+#include "kern_util.h"
+
+extern void *um_virt_to_phys(struct task_struct *task, unsigned long addr,
+ pte_t *pte_out);
+
+static unsigned long maybe_map(unsigned long virt, int is_write)
+{
+ pte_t pte;
+
+ void *phys = um_virt_to_phys(current, virt, &pte);
+ int dummy_code;
+
+ if(IS_ERR(phys) || (is_write && !pte_write(pte))){
+ if(!handle_page_fault(virt, 0, is_write, 0, &dummy_code))
+ return(0);
+ phys = um_virt_to_phys(current, virt, NULL);
+ }
+ return((unsigned long) phys);
+}
+
+static int do_op(unsigned long addr, int len, int is_write,
+ int (*op)(unsigned long addr, int len, void *arg), void *arg)
+{
+ struct page *page;
+ int n;
+
+ addr = maybe_map(addr, is_write);
+ if(addr == -1)
+ return(-1);
+
+ page = phys_to_page(addr);
+ addr = (unsigned long) kmap(page) + (addr & ~PAGE_MASK);
+ n = (*op)(addr, len, arg);
+ kunmap(page);
+
+ return(n);
+}
+
+static int buffer_op(unsigned long addr, int len, int is_write,
+ int (*op)(unsigned long addr, int len, void *arg),
+ void *arg)
+{
+ int size = min(PAGE_ALIGN(addr) - addr, (unsigned long) len);
+ int remain = len, n;
+
+ n = do_op(addr, size, is_write, op, arg);
+ if(n != 0)
+ return(n < 0 ? remain : 0);
+
+ addr += size;
+ remain -= size;
+ if(remain == 0)
+ return(0);
+
+ while(addr < ((addr + remain) & PAGE_MASK)){
+ n = do_op(addr, PAGE_SIZE, is_write, op, arg);
+ if(n != 0)
+ return(n < 0 ? remain : 0);
+
+ addr += PAGE_SIZE;
+ remain -= PAGE_SIZE;
+ }
+ if(remain == 0)
+ return(0);
+
+ n = do_op(addr, remain, is_write, op, arg);
+ if(n != 0)
+ return(n < 0 ? remain : 0);
+ return(0);
+}
+
+static int copy_chunk_from_user(unsigned long from, int len, void *arg)
+{
+ unsigned long *to_ptr = arg, to = *to_ptr;
+
+ memcpy((void *) to, (void *) from, len);
+ *to_ptr += len;
+ return(0);
+}
+
+int copy_from_user_skas(void *to, const void *from, int n)
+{
+ if(segment_eq(get_fs(), KERNEL_DS)){
+ memcpy(to, from, n);
+ return(0);
+ }
+
+ return(access_ok_skas(VERIFY_READ, from, n) ?
+ buffer_op((unsigned long) from, n, 0, copy_chunk_from_user, &to):
+ n);
+}
+
+static int copy_chunk_to_user(unsigned long to, int len, void *arg)
+{
+ unsigned long *from_ptr = arg, from = *from_ptr;
+
+ memcpy((void *) to, (void *) from, len);
+ *from_ptr += len;
+ return(0);
+}
+
+int copy_to_user_skas(void *to, const void *from, int n)
+{
+ if(segment_eq(get_fs(), KERNEL_DS)){
+ memcpy(to, from, n);
+ return(0);
+ }
+
+ return(access_ok_skas(VERIFY_WRITE, to, n) ?
+ buffer_op((unsigned long) to, n, 1, copy_chunk_to_user, &from) :
+ n);
+}
+
+static int strncpy_chunk_from_user(unsigned long from, int len, void *arg)
+{
+ char **to_ptr = arg, *to = *to_ptr;
+ int n;
+
+ strncpy(to, (void *) from, len);
+ n = strnlen(to, len);
+ *to_ptr += n;
+
+ if(n < len)
+ return(1);
+ return(0);
+}
+
+int strncpy_from_user_skas(char *dst, const char *src, int count)
+{
+ int n;
+ char *ptr = dst;
+
+ if(segment_eq(get_fs(), KERNEL_DS)){
+ strncpy(dst, src, count);
+ return(strnlen(dst, count));
+ }
+
+ if(!access_ok_skas(VERIFY_READ, src, 1))
+ return(-EFAULT);
+
+ n = buffer_op((unsigned long) src, count, 0, strncpy_chunk_from_user,
+ &ptr);
+ if(n != 0)
+ return(-EFAULT);
+ return(strnlen(dst, count));
+}
+
+static int clear_chunk(unsigned long addr, int len, void *unused)
+{
+ memset((void *) addr, 0, len);
+ return(0);
+}
+
+int __clear_user_skas(void *mem, int len)
+{
+ return(buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL));
+}
+
+int clear_user_skas(void *mem, int len)
+{
+ if(segment_eq(get_fs(), KERNEL_DS)){
+ memset(mem, 0, len);
+ return(0);
+ }
+
+ return(access_ok_skas(VERIFY_WRITE, mem, len) ?
+ buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL) : len);
+}
+
+static int strnlen_chunk(unsigned long str, int len, void *arg)
+{
+ int *len_ptr = arg, n;
+
+ n = strnlen((void *) str, len);
+ *len_ptr += n;
+
+ if(n < len)
+ return(1);
+ return(0);
+}
+
+int strnlen_user_skas(const void *str, int len)
+{
+ int count = 0, n;
+
+ if(segment_eq(get_fs(), KERNEL_DS))
+ return(strnlen(str, len) + 1);
+
+ n = buffer_op((unsigned long) str, len, 0, strnlen_chunk, &count);
+ if(n == 0)
+ return(count + 1);
+ return(-EFAULT);
+}
+
+/*
+ * Overrides for Emacs so that we follow Linus's tabbing style.
+ * Emacs will notice this stuff at the end of the file and automatically
+ * adjust the settings for this buffer only. This must remain at the end
+ * of the file.
+ * ---------------------------------------------------------------------------
+ * Local variables:
+ * c-file-style: "linux"
+ * End:
+ */
diff --git a/arch/um/kernel/tt/Makefile b/arch/um/kernel/tt/Makefile
index d775068..565ddab 100644
--- a/arch/um/kernel/tt/Makefile
+++ b/arch/um/kernel/tt/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
+# Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com)
# Licensed under the GPL
#
@@ -7,7 +7,7 @@ O_TARGET = tt.o
obj-y = exec_kern.o exec_user.o gdb.o ksyms.o mem.o mem_user.o process_kern.o \
syscall_kern.o syscall_user.o time.o tlb.o tracer.o trap_user.o \
- uaccess_user.o
+ uaccess.o uaccess_user.o
obj-$(CONFIG_PT_PROXY) += gdb_kern.o
diff --git a/arch/um/kernel/tt/include/uaccess.h b/arch/um/kernel/tt/include/uaccess.h
index 16b8052..7399836 100644
--- a/arch/um/kernel/tt/include/uaccess.h
+++ b/arch/um/kernel/tt/include/uaccess.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
+ * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
* Licensed under the GPL
*/
@@ -43,70 +43,19 @@ extern unsigned long get_fault_addr(void);
extern int __do_copy_from_user(void *to, const void *from, int n,
void **fault_addr, void **fault_catcher);
-
-static inline int copy_from_user_tt(void *to, const void *from, int n)
-{
- if(!access_ok_tt(VERIFY_READ, from, n))
- return(n);
-
- return(__do_copy_from_user(to, from, n, &current->thread.fault_addr,
- &current->thread.fault_catcher));
-}
-
-static inline int copy_to_user_tt(void *to, const void *from, int n)
-{
- if(!access_ok_tt(VERIFY_WRITE, to, n))
- return(n);
-
- return(__do_copy_to_user(to, from, n, &current->thread.fault_addr,
- &current->thread.fault_catcher));
-}
-
extern int __do_strncpy_from_user(char *dst, const char *src, size_t n,
void **fault_addr, void **fault_catcher);
-
-static inline int strncpy_from_user_tt(char *dst, const char *src, int count)
-{
- int n;
-
- if(!access_ok_tt(VERIFY_READ, src, 1))
- return(-EFAULT);
-
- n = __do_strncpy_from_user(dst, src, count,
- &current->thread.fault_addr,
- &current->thread.fault_catcher);
- if(n < 0) return(-EFAULT);
- return(n);
-}
-
extern int __do_clear_user(void *mem, size_t len, void **fault_addr,
void **fault_catcher);
-
-static inline int __clear_user_tt(void *mem, int len)
-{
- return(__do_clear_user(mem, len,
- &current->thread.fault_addr,
- &current->thread.fault_catcher));
-}
-
-static inline int clear_user_tt(void *mem, int len)
-{
- if(!access_ok_tt(VERIFY_WRITE, mem, len))
- return(len);
-
- return(__do_clear_user(mem, len, &current->thread.fault_addr,
- &current->thread.fault_catcher));
-}
-
extern int __do_strnlen_user(const char *str, unsigned long n,
void **fault_addr, void **fault_catcher);
-static inline int strnlen_user_tt(const void *str, int len)
-{
- return(__do_strnlen_user(str, len,
- &current->thread.fault_addr,
- &current->thread.fault_catcher));
-}
+extern int copy_from_user_tt(void *to, const void *from, int n);
+extern int copy_to_user_tt(void *to, const void *from, int n);
+extern int strncpy_from_user_tt(char *dst, const char *src, int count);
+extern int __clear_user_tt(void *mem, int len);
+extern int clear_user_tt(void *mem, int len);
+extern int strnlen_user_tt(const void *str, int len);
#endif
diff --git a/arch/um/kernel/tt/uaccess.c b/arch/um/kernel/tt/uaccess.c
new file mode 100644
index 0000000..9c84011
--- /dev/null
+++ b/arch/um/kernel/tt/uaccess.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
+ * Licensed under the GPL
+ */
+
+#include "linux/sched.h"
+#include "asm/uaccess.h"
+
+int copy_from_user_tt(void *to, const void *from, int n)
+{
+ if(!access_ok_tt(VERIFY_READ, from, n))
+ return(n);
+
+ return(__do_copy_from_user(to, from, n, &current->thread.fault_addr,
+ &current->thread.fault_catcher));
+}
+
+int copy_to_user_tt(void *to, const void *from, int n)
+{
+ if(!access_ok_tt(VERIFY_WRITE, to, n))
+ return(n);
+
+ return(__do_copy_to_user(to, from, n, &current->thread.fault_addr,
+ &current->thread.fault_catcher));
+}
+
+int strncpy_from_user_tt(char *dst, const char *src, int count)
+{
+ int n;
+
+ if(!access_ok_tt(VERIFY_READ, src, 1))
+ return(-EFAULT);
+
+ n = __do_strncpy_from_user(dst, src, count,
+ &current->thread.fault_addr,
+ &current->thread.fault_catcher);
+ if(n < 0) return(-EFAULT);
+ return(n);
+}
+
+int __clear_user_tt(void *mem, int len)
+{
+ return(__do_clear_user(mem, len,
+ &current->thread.fault_addr,
+ &current->thread.fault_catcher));
+}
+
+int clear_user_tt(void *mem, int len)
+{
+ if(!access_ok_tt(VERIFY_WRITE, mem, len))
+ return(len);
+
+ return(__do_clear_user(mem, len, &current->thread.fault_addr,
+ &current->thread.fault_catcher));
+}
+
+int strnlen_user_tt(const void *str, int len)
+{
+ return(__do_strnlen_user(str, len,
+ &current->thread.fault_addr,
+ &current->thread.fault_catcher));
+}
+
+/*
+ * Overrides for Emacs so that we follow Linus's tabbing style.
+ * Emacs will notice this stuff at the end of the file and automatically
+ * adjust the settings for this buffer only. This must remain at the end
+ * of the file.
+ * ---------------------------------------------------------------------------
+ * Local variables:
+ * c-file-style: "linux"
+ * End:
+ */
diff --git a/arch/um/kernel/tt/uaccess_user.c b/arch/um/kernel/tt/uaccess_user.c
index 1a38a28..f084f0c 100644
--- a/arch/um/kernel/tt/uaccess_user.c
+++ b/arch/um/kernel/tt/uaccess_user.c
@@ -75,12 +75,10 @@ int __do_strnlen_user(const char *str, unsigned long n,
jmp_buf jbuf;
*fault_catcher = &jbuf;
- if(sigsetjmp(jbuf, 1) == 0){
+ if(sigsetjmp(jbuf, 1) == 0)
ret = strlen(str) + 1;
- }
- else {
- ret = *faddrp - (unsigned long) str;
- }
+ else ret = *faddrp - (unsigned long) str;
+
*fault_addr = NULL;
*fault_catcher = NULL;
diff --git a/arch/um/os-Linux/drivers/tuntap_user.c b/arch/um/os-Linux/drivers/tuntap_user.c
index c8b1fab..f880ac7 100644
--- a/arch/um/os-Linux/drivers/tuntap_user.c
+++ b/arch/um/os-Linux/drivers/tuntap_user.c
@@ -146,7 +146,7 @@ static int tuntap_open(void *data)
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
strncpy(ifr.ifr_name, pri->dev_name, sizeof(ifr.ifr_name) - 1);
if(ioctl(pri->fd, TUNSETIFF, (void *) &ifr) < 0){
- printk("TUNSETIFF failed, errno = %d", errno);
+ printk("TUNSETIFF failed, errno = %d\n", errno);
os_close_file(pri->fd);
return(-errno);
}
diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile
index 0b23fef..2ddff6d 100644
--- a/arch/um/sys-i386/Makefile
+++ b/arch/um/sys-i386/Makefile
@@ -6,7 +6,7 @@
O_TARGET = built-in.o
obj-y = bugs.o checksum.o extable.o fault.o ksyms.o ldt.o ptrace.o \
- ptrace_user.o semaphore.o sigcontext.o syscalls.o sysrq.o
+ ptrace_user.o semaphore.o sigcontext.o syscalls.o sysrq.o time.o
export-objs = ksyms.o
USER_OBJS = bugs.o ptrace_user.o sigcontext.o fault.o
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index dc277b0..c6ee59d 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -996,9 +996,7 @@ static int init_dev(kdev_t device, struct tty_struct **ret_tty)
goto release_mem_out;
}
}
-#ifdef CONFIG_TTY_LOG
- tty->log_fd = -1;
-#endif
+
goto success;
/*
@@ -2085,6 +2083,9 @@ static void initialize_tty_struct(struct tty_struct *tty)
spin_lock_init(&tty->read_lock);
INIT_LIST_HEAD(&tty->tty_files);
INIT_TQUEUE(&tty->SAK_tq, 0, 0);
+#ifdef CONFIG_TTY_LOG
+ tty->log_fd = -1;
+#endif
}
/*
diff --git a/include/asm-um/system-generic.h b/include/asm-um/system-generic.h
index 71bf74a..2e770ba 100644
--- a/include/asm-um/system-generic.h
+++ b/include/asm-um/system-generic.h
@@ -41,7 +41,7 @@ extern void unblock_signals(void);
#define __cli() block_signals()
#define cli() block_signals()
-#define __save_flags(x) do { (flags) = get_signals(); } while(0)
+#define __save_flags(x) do { (x) = get_signals(); } while(0)
#define save_flags(x) __save_flags(x)
#define __restore_flags(x) local_irq_restore(x)