diff options
Diffstat (limited to 'arch/um')
72 files changed, 193 insertions, 138 deletions
diff --git a/arch/um/Kconfig b/arch/um/Kconfig index d753075..5ac1f29 100644 --- a/arch/um/Kconfig +++ b/arch/um/Kconfig @@ -1,3 +1,8 @@ +config DEFCONFIG_LIST + string + option defconfig_list + default "arch/$ARCH/defconfig" + # UML uses the generic IRQ sugsystem config GENERIC_HARDIRQS bool @@ -25,6 +30,19 @@ config PCI config PCMCIA bool +# Yet to do! +config TRACE_IRQFLAGS_SUPPORT + bool + default n + +config LOCKDEP_SUPPORT + bool + default y + +config STACKTRACE_SUPPORT + bool + default y + config GENERIC_CALIBRATE_DELAY bool default y @@ -37,13 +55,16 @@ config IRQ_RELEASE_METHOD menu "UML-specific options" config MODE_TT - bool "Tracing thread support" + bool "Tracing thread support (DEPRECATED)" default n + depends on BROKEN help This option controls whether tracing thread support is compiled - into UML. This option is largely obsolete, given that skas0 provides + into UML. This option is largely obsolete, given that skas0 provides skas security and performance without needing to patch the host. - It is safe to say 'N' here. + It is safe to say 'N' here; saying 'Y' may cause additional problems + with the resulting binary even if you run UML in SKAS mode, and running + in TT mode is strongly *NOT RECOMMENDED*. config STATIC_LINK bool "Force a static link" @@ -56,6 +77,9 @@ config STATIC_LINK for use in a chroot jail. So, if you intend to run UML inside a chroot, and you disable CONFIG_MODE_TT, you probably want to say Y here. + Additionally, this option enables using higher memory spaces (up to + 2.75G) for UML - disabling CONFIG_MODE_TT and enabling this option leads + to best results for this. config KERNEL_HALF_GIGS int "Kernel address space size (in .5G units)" @@ -72,10 +96,13 @@ config MODE_SKAS default y help This option controls whether skas (separate kernel address space) - support is compiled in. If you have applied the skas patch to the - host, then you certainly want to say Y here (and consider saying N - to CONFIG_MODE_TT). Otherwise, it is safe to say Y. Disabling this - option will shrink the UML binary slightly. + support is compiled in. + Unless you have specific needs to use TT mode (which applies almost only + to developers), you should say Y here. + SKAS mode will make use of the SKAS3 patch if it is applied on the host + (and your UML will run in SKAS3 mode), but if no SKAS patch is applied + on the host it will run in SKAS0 mode, which is anyway faster than TT + mode. source "arch/um/Kconfig.arch" source "mm/Kconfig" diff --git a/arch/um/Kconfig.char b/arch/um/Kconfig.char index 62d87b7..e03e40c 100644 --- a/arch/um/Kconfig.char +++ b/arch/um/Kconfig.char @@ -190,6 +190,11 @@ config HOSTAUDIO tristate default UML_SOUND +#It is selected elsewhere, so kconfig would warn without this. +config HW_RANDOM + tristate + default n + config UML_RANDOM tristate "Hardware random number generator" help diff --git a/arch/um/Kconfig.i386 b/arch/um/Kconfig.i386 index f6eb72d..f191a55 100644 --- a/arch/um/Kconfig.i386 +++ b/arch/um/Kconfig.i386 @@ -16,23 +16,42 @@ config SEMAPHORE_SLEEPERS bool default y -config HOST_2G_2G - bool "2G/2G host address space split" - default n - help - This is needed when the host on which you run has a 2G/2G memory - split, instead of the customary 3G/1G. - - Note that to enable such a host - configuration, which makes sense only in some cases, you need special - host patches. - - So, if you do not know what to do here, say 'N'. +choice + prompt "Host memory split" + default HOST_VMSPLIT_3G + ---help--- + This is needed when the host kernel on which you run has a non-default + (like 2G/2G) memory split, instead of the customary 3G/1G. If you did + not recompile your own kernel but use the default distro's one, you can + safely accept the "Default split" option. + + It can be enabled on recent (>=2.6.16-rc2) vanilla kernels via + CONFIG_VM_SPLIT_*, or on previous kernels with special patches (-ck + patchset by Con Kolivas, or other ones) - option names match closely the + host CONFIG_VM_SPLIT_* ones. + + A lower setting (where 1G/3G is lowest and 3G/1G is higher) will + tolerate even more "normal" host kernels, but an higher setting will be + stricter. + + So, if you do not know what to do here, say 'Default split'. + + config HOST_VMSPLIT_3G + bool "Default split (3G/1G user/kernel host split)" + config HOST_VMSPLIT_3G_OPT + bool "3G/1G user/kernel host split (for full 1G low memory)" + config HOST_VMSPLIT_2G + bool "2G/2G user/kernel host split" + config HOST_VMSPLIT_1G + bool "1G/3G user/kernel host split" +endchoice config TOP_ADDR - hex - default 0xc0000000 if !HOST_2G_2G - default 0x80000000 if HOST_2G_2G + hex + default 0xB0000000 if HOST_VMSPLIT_3G_OPT + default 0x78000000 if HOST_VMSPLIT_2G + default 0x40000000 if HOST_VMSPLIT_1G + default 0xC0000000 config 3_LEVEL_PGTABLES bool "Three-level pagetables (EXPERIMENTAL)" diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64 index 11154b6..d278682 100644 --- a/arch/um/Makefile-x86_64 +++ b/arch/um/Makefile-x86_64 @@ -1,10 +1,10 @@ # Copyright 2003 - 2004 Pathscale, Inc # Released under the GPL -core-y += arch/um/sys-x86_64/ +core-y += arch/um/sys-x86_64/ arch/x86_64/crypto/ START := 0x60000000 -_extra_flags_ = -fno-builtin -m64 -mcmodel=kernel +_extra_flags_ = -fno-builtin -m64 #We #undef __x86_64__ for kernelspace, not for userspace where #it's needed for headers to work! diff --git a/arch/um/drivers/cow_sys.h b/arch/um/drivers/cow_sys.h index 7a5b4af..c6a3084 100644 --- a/arch/um/drivers/cow_sys.h +++ b/arch/um/drivers/cow_sys.h @@ -5,6 +5,7 @@ #include "user_util.h" #include "os.h" #include "user.h" +#include "um_malloc.h" static inline void *cow_malloc(int size) { diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c index 77954ea..310af0f 100644 --- a/arch/um/drivers/daemon_user.c +++ b/arch/um/drivers/daemon_user.c @@ -17,6 +17,7 @@ #include "user_util.h" #include "user.h" #include "os.h" +#include "um_malloc.h" #define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER) diff --git a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c index 108b7da..218aa0e 100644 --- a/arch/um/drivers/fd.c +++ b/arch/um/drivers/fd.c @@ -12,6 +12,7 @@ #include "user_util.h" #include "chan_user.h" #include "os.h" +#include "um_malloc.h" struct fd_chan { int fd; diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c index d247ef4..a0d148ea 100644 --- a/arch/um/drivers/hostaudio_kern.c +++ b/arch/um/drivers/hostaudio_kern.c @@ -3,7 +3,6 @@ * Licensed under the GPL */ -#include "linux/config.h" #include "linux/module.h" #include "linux/init.h" #include "linux/slab.h" diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index cfd9f01..426633e 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c @@ -20,7 +20,7 @@ #define LINE_BUFSIZE 4096 -static irqreturn_t line_interrupt(int irq, void *data, struct pt_regs *unused) +static irqreturn_t line_interrupt(int irq, void *data) { struct chan *chan = data; struct line *line = chan->line; @@ -364,8 +364,7 @@ void line_unthrottle(struct tty_struct *tty) reactivate_chan(&line->chan_list, line->driver->read_irq); } -static irqreturn_t line_write_interrupt(int irq, void *data, - struct pt_regs *unused) +static irqreturn_t line_write_interrupt(int irq, void *data) { struct chan *chan = data; struct line *line = chan->line; @@ -712,7 +711,7 @@ struct winch { struct tty_struct *tty; }; -static irqreturn_t winch_interrupt(int irq, void *data, struct pt_regs *unused) +static irqreturn_t winch_interrupt(int irq, void *data) { struct winch *winch = data; struct tty_struct *tty; diff --git a/arch/um/drivers/mcast_user.c b/arch/um/drivers/mcast_user.c index 4d2bd39..8138f5e 100644 --- a/arch/um/drivers/mcast_user.c +++ b/arch/um/drivers/mcast_user.c @@ -23,6 +23,7 @@ #include "user_util.h" #include "user.h" #include "os.h" +#include "um_malloc.h" #define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER) diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index a67dcbd..d08bd03 100644 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c @@ -74,8 +74,7 @@ static void mc_work_proc(void *unused) static DECLARE_WORK(mconsole_work, mc_work_proc, NULL); -static irqreturn_t mconsole_interrupt(int irq, void *dev_id, - struct pt_regs *regs) +static irqreturn_t mconsole_interrupt(int irq, void *dev_id) { /* long to avoid size mismatch warnings from gcc */ long fd; @@ -674,8 +673,9 @@ static void with_console(struct mc_request *req, void (*proc)(void *), static void sysrq_proc(void *arg) { char *op = arg; - - handle_sysrq(*op, ¤t->thread.regs, NULL); + struct pt_regs *old_regs = set_irq_regs(¤t->thread.regs); + handle_sysrq(*op, NULL); + set_irq_regs(old_regs); } void mconsole_sysrq(struct mc_request *req) diff --git a/arch/um/drivers/mmapper_kern.c b/arch/um/drivers/mmapper_kern.c index 9a3b5da..df3516e 100644 --- a/arch/um/drivers/mmapper_kern.c +++ b/arch/um/drivers/mmapper_kern.c @@ -95,7 +95,8 @@ static const struct file_operations mmapper_fops = { .release = mmapper_release, }; -static const struct miscdevice mmapper_dev = { +/* No locking needed - only used (and modified) by below initcall and exitcall. */ +static struct miscdevice mmapper_dev = { .minor = MISC_DYNAMIC_MINOR, .name = "mmapper", .fops = &mmapper_fops diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c index 300a54a..ec9eb8b 100644 --- a/arch/um/drivers/net_kern.c +++ b/arch/um/drivers/net_kern.c @@ -5,7 +5,6 @@ * Licensed under the GPL. */ -#include "linux/config.h" #include "linux/kernel.h" #include "linux/netdevice.h" #include "linux/rtnetlink.h" @@ -78,7 +77,7 @@ static void uml_dev_close(void* dev) dev_close( (struct net_device *) dev); } -irqreturn_t uml_net_interrupt(int irq, void *dev_id, struct pt_regs *regs) +irqreturn_t uml_net_interrupt(int irq, void *dev_id) { struct net_device *dev = dev_id; struct uml_net_private *lp = dev->priv; diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c index f3a3f8a..0ffd7ac 100644 --- a/arch/um/drivers/net_user.c +++ b/arch/um/drivers/net_user.c @@ -18,6 +18,7 @@ #include "kern_util.h" #include "net_user.h" #include "os.h" +#include "um_malloc.h" int tap_open_common(void *dev, char *gate_addr) { diff --git a/arch/um/drivers/pcap_user.c b/arch/um/drivers/pcap_user.c index 2ef641d..11921a7 100644 --- a/arch/um/drivers/pcap_user.c +++ b/arch/um/drivers/pcap_user.c @@ -12,6 +12,7 @@ #include "net_user.h" #include "pcap_user.h" #include "user.h" +#include "um_malloc.h" #define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER) diff --git a/arch/um/drivers/pcap_user.h b/arch/um/drivers/pcap_user.h index 58f9f6a..96b80b5 100644 --- a/arch/um/drivers/pcap_user.h +++ b/arch/um/drivers/pcap_user.h @@ -15,7 +15,7 @@ struct pcap_data { void *dev; }; -extern struct net_user_info pcap_user_info; +extern const struct net_user_info pcap_user_info; extern int pcap_user_read(int fd, void *buf, int len, struct pcap_data *pri); diff --git a/arch/um/drivers/port_kern.c b/arch/um/drivers/port_kern.c index 73755f3..ce9f373 100644 --- a/arch/um/drivers/port_kern.c +++ b/arch/um/drivers/port_kern.c @@ -47,7 +47,7 @@ struct connection { struct port_list *port; }; -static irqreturn_t pipe_interrupt(int irq, void *data, struct pt_regs *regs) +static irqreturn_t pipe_interrupt(int irq, void *data) { struct connection *conn = data; int fd; @@ -152,7 +152,7 @@ void port_work_proc(void *unused) DECLARE_WORK(port_work, port_work_proc, NULL); -static irqreturn_t port_interrupt(int irq, void *data, struct pt_regs *regs) +static irqreturn_t port_interrupt(int irq, void *data) { struct port_list *port = data; diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c index f2e8fc4..bc6afaf 100644 --- a/arch/um/drivers/port_user.c +++ b/arch/um/drivers/port_user.c @@ -19,6 +19,7 @@ #include "chan_user.h" #include "port.h" #include "os.h" +#include "um_malloc.h" struct port_chan { int raw; diff --git a/arch/um/drivers/pty.c b/arch/um/drivers/pty.c index abec620..829a5ec 100644 --- a/arch/um/drivers/pty.c +++ b/arch/um/drivers/pty.c @@ -13,6 +13,7 @@ #include "user_util.h" #include "kern_util.h" #include "os.h" +#include "um_malloc.h" struct pty_chan { void (*announce)(char *dev_name, int dev); diff --git a/arch/um/drivers/slip_kern.c b/arch/um/drivers/slip_kern.c index ccea2d7..788da54 100644 --- a/arch/um/drivers/slip_kern.c +++ b/arch/um/drivers/slip_kern.c @@ -1,4 +1,3 @@ -#include "linux/config.h" #include "linux/kernel.h" #include "linux/stddef.h" #include "linux/init.h" diff --git a/arch/um/drivers/slip_user.c b/arch/um/drivers/slip_user.c index 8460285..7eddacc 100644 --- a/arch/um/drivers/slip_user.c +++ b/arch/um/drivers/slip_user.c @@ -15,6 +15,7 @@ #include "slip.h" #include "slip_common.h" #include "os.h" +#include "um_malloc.h" void slip_user_init(void *data, void *dev) { diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c index 6f13e7c..ed9c590 100644 --- a/arch/um/drivers/ssl.c +++ b/arch/um/drivers/ssl.c @@ -3,7 +3,6 @@ * Licensed under the GPL */ -#include "linux/config.h" #include "linux/fs.h" #include "linux/tty.h" #include "linux/tty_driver.h" diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c index e4bfcfe..7a4897e 100644 --- a/arch/um/drivers/stdio_console.c +++ b/arch/um/drivers/stdio_console.c @@ -3,7 +3,6 @@ * Licensed under the GPL */ -#include "linux/config.h" #include "linux/posix_types.h" #include "linux/tty.h" #include "linux/tty_flip.h" diff --git a/arch/um/drivers/tty.c b/arch/um/drivers/tty.c index 11de3ac..d95d643 100644 --- a/arch/um/drivers/tty.c +++ b/arch/um/drivers/tty.c @@ -11,6 +11,7 @@ #include "user_util.h" #include "user.h" #include "os.h" +#include "um_malloc.h" struct tty_chan { char *dev; diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index fda4a39..bc458f5 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -20,7 +20,6 @@ #define MAJOR_NR UBD_MAJOR #define UBD_SHIFT 4 -#include "linux/config.h" #include "linux/module.h" #include "linux/blkdev.h" #include "linux/hdreg.h" @@ -525,7 +524,7 @@ static void ubd_handler(void) do_ubd_request(ubd_queue); } -static irqreturn_t ubd_intr(int irq, void *dev, struct pt_regs *unused) +static irqreturn_t ubd_intr(int irq, void *dev) { ubd_handler(); return(IRQ_HANDLED); diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c index 386f8b9..850221d 100644 --- a/arch/um/drivers/xterm.c +++ b/arch/um/drivers/xterm.c @@ -136,8 +136,6 @@ int xterm_open(int input, int output, int primary, void *d, return(pid); } - if(data->stack == 0) free_stack(stack, 0); - if (data->direct_rcv) { new = os_rcv_fd(fd, &data->helper_pid); } else { diff --git a/arch/um/drivers/xterm_kern.c b/arch/um/drivers/xterm_kern.c index 6036ec8..a4ce705 100644 --- a/arch/um/drivers/xterm_kern.c +++ b/arch/um/drivers/xterm_kern.c @@ -21,7 +21,7 @@ struct xterm_wait { int new_fd; }; -static irqreturn_t xterm_interrupt(int irq, void *data, struct pt_regs *regs) +static irqreturn_t xterm_interrupt(int irq, void *data) { struct xterm_wait *xterm = data; int fd; diff --git a/arch/um/include/common-offsets.h b/arch/um/include/common-offsets.h index 356390d..461175f 100644 --- a/arch/um/include/common-offsets.h +++ b/arch/um/include/common-offsets.h @@ -1,9 +1,16 @@ /* for use by sys-$SUBARCH/kernel-offsets.c */ +DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE); +#ifdef CONFIG_MODE_TT +OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); +#endif + OFFSET(HOST_TASK_REGS, task_struct, thread.regs); OFFSET(HOST_TASK_PID, task_struct, pid); + DEFINE(UM_KERN_PAGE_SIZE, PAGE_SIZE); DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC); + DEFINE_STR(UM_KERN_EMERG, KERN_EMERG); DEFINE_STR(UM_KERN_ALERT, KERN_ALERT); DEFINE_STR(UM_KERN_CRIT, KERN_CRIT); @@ -12,6 +19,10 @@ DEFINE_STR(UM_KERN_WARNING, KERN_WARNING); DEFINE_STR(UM_KERN_NOTICE, KERN_NOTICE); DEFINE_STR(UM_KERN_INFO, KERN_INFO); DEFINE_STR(UM_KERN_DEBUG, KERN_DEBUG); + DEFINE(UM_ELF_CLASS, ELF_CLASS); DEFINE(UM_ELFCLASS32, ELFCLASS32); DEFINE(UM_ELFCLASS64, ELFCLASS64); + +/* For crypto assembler code. */ +DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx)); diff --git a/arch/um/include/irq_kern.h b/arch/um/include/irq_kern.h index c222d56..4f77559 100644 --- a/arch/um/include/irq_kern.h +++ b/arch/um/include/irq_kern.h @@ -10,12 +10,11 @@ #include "asm/ptrace.h" extern int um_request_irq(unsigned int irq, int fd, int type, - irqreturn_t (*handler)(int, void *, - struct pt_regs *), + irq_handler_t handler, unsigned long irqflags, const char * devname, void *dev_id); extern int init_aio_irq(int irq, char *name, - irqreturn_t (*handler)(int, void *, struct pt_regs *)); + irq_handler_t handler); #endif diff --git a/arch/um/include/kern_util.h b/arch/um/include/kern_util.h index 59cfa9e..cec9fcc 100644 --- a/arch/um/include/kern_util.h +++ b/arch/um/include/kern_util.h @@ -6,7 +6,6 @@ #ifndef __KERN_UTIL_H__ #define __KERN_UTIL_H__ -#include "linux/threads.h" #include "sysdep/ptrace.h" #include "sysdep/faultinfo.h" diff --git a/arch/um/include/longjmp.h b/arch/um/include/longjmp.h index e93c6d3..e860bc584 100644 --- a/arch/um/include/longjmp.h +++ b/arch/um/include/longjmp.h @@ -12,7 +12,8 @@ extern void longjmp(jmp_buf, int); } while(0) #define UML_SETJMP(buf) ({ \ - int n, enable; \ + int n; \ + volatile int enable; \ enable = get_signals(); \ n = setjmp(*buf); \ if(n != 0) \ diff --git a/arch/um/include/mconsole_kern.h b/arch/um/include/mconsole_kern.h index d86ee14..d0b6901 100644 --- a/arch/um/include/mconsole_kern.h +++ b/arch/um/include/mconsole_kern.h @@ -6,7 +6,6 @@ #ifndef __MCONSOLE_KERN_H__ #define __MCONSOLE_KERN_H__ -#include "linux/config.h" #include "linux/list.h" #include "mconsole.h" diff --git a/arch/um/include/mode_kern.h b/arch/um/include/mode_kern.h index e7539a8..88e5e77 100644 --- a/arch/um/include/mode_kern.h +++ b/arch/um/include/mode_kern.h @@ -6,8 +6,6 @@ #ifndef __MODE_KERN_H__ #define __MODE_KERN_H__ -#include "linux/config.h" - #ifdef CONFIG_MODE_TT #include "mode_kern_tt.h" #endif diff --git a/arch/um/include/os.h b/arch/um/include/os.h index 120ca21..6516f6d 100644 --- a/arch/um/include/os.h +++ b/arch/um/include/os.h @@ -201,6 +201,7 @@ extern int os_getpgrp(void); #ifdef UML_CONFIG_MODE_TT extern void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int)); +extern void stop(void); #endif extern void init_new_thread_signals(void); extern int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr); diff --git a/arch/um/include/skas/mmu-skas.h b/arch/um/include/skas/mmu-skas.h index d8869a6..b26986c 100644 --- a/arch/um/include/skas/mmu-skas.h +++ b/arch/um/include/skas/mmu-skas.h @@ -6,7 +6,6 @@ #ifndef __SKAS_MMU_H #define __SKAS_MMU_H -#include "linux/config.h" #include "mm_id.h" #include "asm/ldt.h" diff --git a/arch/um/include/sysdep-i386/kernel-offsets.h b/arch/um/include/sysdep-i386/kernel-offsets.h index 2c13de3..97ec9d8 100644 --- a/arch/um/include/sysdep-i386/kernel-offsets.h +++ b/arch/um/include/sysdep-i386/kernel-offsets.h @@ -1,6 +1,7 @@ #include <linux/stddef.h> #include <linux/sched.h> #include <linux/elf.h> +#include <linux/crypto.h> #include <asm/mman.h> #define DEFINE(sym, val) \ @@ -17,9 +18,5 @@ void foo(void) { OFFSET(HOST_TASK_DEBUGREGS, task_struct, thread.arch.debugregs); - DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE); -#ifdef CONFIG_MODE_TT - OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); -#endif #include <common-offsets.h> } diff --git a/arch/um/include/sysdep-ppc/ptrace.h b/arch/um/include/sysdep-ppc/ptrace.h index 8a27353..df2397d 100644 --- a/arch/um/include/sysdep-ppc/ptrace.h +++ b/arch/um/include/sysdep-ppc/ptrace.h @@ -5,7 +5,6 @@ #ifndef __SYS_PTRACE_PPC_H #define __SYS_PTRACE_PPC_H -#include "linux/config.h" #include "linux/types.h" /* the following taken from <asm-ppc/ptrace.h> */ diff --git a/arch/um/include/sysdep-x86_64/kernel-offsets.h b/arch/um/include/sysdep-x86_64/kernel-offsets.h index 91d129f..a307237 100644 --- a/arch/um/include/sysdep-x86_64/kernel-offsets.h +++ b/arch/um/include/sysdep-x86_64/kernel-offsets.h @@ -2,6 +2,7 @@ #include <linux/sched.h> #include <linux/time.h> #include <linux/elf.h> +#include <linux/crypto.h> #include <asm/page.h> #include <asm/mman.h> @@ -18,9 +19,5 @@ void foo(void) { - DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE); -#ifdef CONFIG_MODE_TT - OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); -#endif #include <common-offsets.h> } diff --git a/arch/um/include/um_malloc.h b/arch/um/include/um_malloc.h new file mode 100644 index 0000000..0363a9b --- /dev/null +++ b/arch/um/include/um_malloc.h @@ -0,0 +1,17 @@ +/* + * Copyright (C) 2005 Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> + * Licensed under the GPL + */ + +#ifndef __UM_MALLOC_H__ +#define __UM_MALLOC_H__ + +extern void *um_kmalloc(int size); +extern void *um_kmalloc_atomic(int size); +extern void kfree(const void *ptr); + +extern void *um_vmalloc(int size); +extern void *um_vmalloc_atomic(int size); +extern void vfree(void *ptr); + +#endif /* __UM_MALLOC_H__ */ diff --git a/arch/um/include/um_uaccess.h b/arch/um/include/um_uaccess.h index 4567f1e..5126a99 100644 --- a/arch/um/include/um_uaccess.h +++ b/arch/um/include/um_uaccess.h @@ -6,7 +6,6 @@ #ifndef __ARCH_UM_UACCESS_H #define __ARCH_UM_UACCESS_H -#include "linux/config.h" #include "choose-mode.h" #ifdef CONFIG_MODE_TT diff --git a/arch/um/include/user.h b/arch/um/include/user.h index 39f8c88..acadce3 100644 --- a/arch/um/include/user.h +++ b/arch/um/include/user.h @@ -11,17 +11,11 @@ extern void panic(const char *fmt, ...) extern int printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); extern void schedule(void); -extern void *um_kmalloc(int size); -extern void *um_kmalloc_atomic(int size); -extern void kfree(void *ptr); extern int in_aton(char *str); extern int open_gdb_chan(void); /* These use size_t, however unsigned long is correct on both i386 and x86_64. */ extern unsigned long strlcpy(char *, const char *, unsigned long); extern unsigned long strlcat(char *, const char *, unsigned long); -extern void *um_vmalloc(int size); -extern void *um_vmalloc_atomic(int size); -extern void vfree(void *ptr); #endif diff --git a/arch/um/include/user_util.h b/arch/um/include/user_util.h index 802d784..06625fe 100644 --- a/arch/um/include/user_util.h +++ b/arch/um/include/user_util.h @@ -52,7 +52,6 @@ extern int linux_main(int argc, char **argv); extern void set_cmdline(char *cmd); extern void input_cb(void (*proc)(void *), void *arg, int arg_len); extern int get_pty(void); -extern void *um_kmalloc(int size); extern int switcheroo(int fd, int prot, void *from, void *to, int size); extern void do_exec(int old_pid, int new_pid); extern void tracer_panic(char *msg, ...) diff --git a/arch/um/kernel/init_task.c b/arch/um/kernel/init_task.c index 49ed5dd..8cde431 100644 --- a/arch/um/kernel/init_task.c +++ b/arch/um/kernel/init_task.c @@ -3,7 +3,6 @@ * Licensed under the GPL */ -#include "linux/config.h" #include "linux/mm.h" #include "linux/module.h" #include "linux/sched.h" diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c index ce7f233..5c1e611 100644 --- a/arch/um/kernel/irq.c +++ b/arch/um/kernel/irq.c @@ -5,7 +5,6 @@ * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar */ -#include "linux/config.h" #include "linux/kernel.h" #include "linux/module.h" #include "linux/smp.h" @@ -32,6 +31,7 @@ #include "irq_kern.h" #include "os.h" #include "sigio.h" +#include "um_malloc.h" #include "misc_constants.h" /* @@ -356,14 +356,16 @@ void forward_interrupts(int pid) */ unsigned int do_IRQ(int irq, union uml_pt_regs *regs) { - irq_enter(); - __do_IRQ(irq, (struct pt_regs *)regs); - irq_exit(); - return 1; + struct pt_regs *old_regs = set_irq_regs((struct pt_regs *)regs); + irq_enter(); + __do_IRQ(irq); + irq_exit(); + set_irq_regs(old_regs); + return 1; } int um_request_irq(unsigned int irq, int fd, int type, - irqreturn_t (*handler)(int, void *, struct pt_regs *), + irq_handler_t handler, unsigned long irqflags, const char * devname, void *dev_id) { @@ -424,8 +426,7 @@ void __init init_IRQ(void) } } -int init_aio_irq(int irq, char *name, irqreturn_t (*handler)(int, void *, - struct pt_regs *)) +int init_aio_irq(int irq, char *name, irq_handler_t handler) { int fds[2], err; diff --git a/arch/um/kernel/ksyms.c b/arch/um/kernel/ksyms.c index f030e44..0e00cf9 100644 --- a/arch/um/kernel/ksyms.c +++ b/arch/um/kernel/ksyms.c @@ -3,7 +3,6 @@ * Licensed under the GPL */ -#include "linux/config.h" #include "linux/module.h" #include "linux/string.h" #include "linux/smp_lock.h" diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index fe6c64a..348b272 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c @@ -46,6 +46,7 @@ #include "mode.h" #include "mode_kern.h" #include "choose-mode.h" +#include "um_malloc.h" /* This is a per-cpu array. A processor only modifies its entry and it only * cares about its entry, so it's OK if another processor is modifying its diff --git a/arch/um/kernel/sigio.c b/arch/um/kernel/sigio.c index 0ad755c..2b0ab43 100644 --- a/arch/um/kernel/sigio.c +++ b/arch/um/kernel/sigio.c @@ -17,7 +17,7 @@ /* Protected by sigio_lock() called from write_sigio_workaround */ static int sigio_irq_fd = -1; -static irqreturn_t sigio_interrupt(int irq, void *data, struct pt_regs *unused) +static irqreturn_t sigio_interrupt(int irq, void *data) { char c; diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c index 4aa9808..2a32e5e 100644 --- a/arch/um/kernel/signal.c +++ b/arch/um/kernel/signal.c @@ -3,7 +3,6 @@ * Licensed under the GPL */ -#include "linux/config.h" #include "linux/stddef.h" #include "linux/sys.h" #include "linux/sched.h" diff --git a/arch/um/kernel/skas/mem.c b/arch/um/kernel/skas/mem.c index 27bbf54..0d2cce6 100644 --- a/arch/um/kernel/skas/mem.c +++ b/arch/um/kernel/skas/mem.c @@ -3,7 +3,6 @@ * Licensed under the GPL */ -#include "linux/config.h" #include "linux/mm.h" #include "asm/pgtable.h" #include "mem_user.h" diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c index 4cd2ff5..2c6d090 100644 --- a/arch/um/kernel/skas/mmu.c +++ b/arch/um/kernel/skas/mmu.c @@ -3,7 +3,6 @@ * Licensed under the GPL */ -#include "linux/config.h" #include "linux/sched.h" #include "linux/list.h" #include "linux/spinlock.h" @@ -61,10 +60,7 @@ static int init_stub_pte(struct mm_struct *mm, unsigned long proc, #endif *pte = mk_pte(virt_to_page(kernel), __pgprot(_PAGE_PRESENT)); - /* This is wrong for the code page, but it doesn't matter since the - * stub is mapped by hand with the correct permissions. - */ - *pte = pte_mkwrite(*pte); + *pte = pte_mkread(*pte); return(0); out_pmd: diff --git a/arch/um/kernel/skas/tlb.c b/arch/um/kernel/skas/tlb.c index 6e84963..27eb29c 100644 --- a/arch/um/kernel/skas/tlb.c +++ b/arch/um/kernel/skas/tlb.c @@ -6,7 +6,6 @@ #include "linux/stddef.h" #include "linux/sched.h" -#include "linux/config.h" #include "linux/mm.h" #include "asm/page.h" #include "asm/pgtable.h" diff --git a/arch/um/kernel/smp.c b/arch/um/kernel/smp.c index 511116a..759b070 100644 --- a/arch/um/kernel/smp.c +++ b/arch/um/kernel/smp.c @@ -3,7 +3,6 @@ * Licensed under the GPL */ -#include "linux/config.h" #include "linux/percpu.h" #include "asm/pgalloc.h" #include "asm/tlb.h" diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c index b331e97..239c980 100644 --- a/arch/um/kernel/sysrq.c +++ b/arch/um/kernel/sysrq.c @@ -3,7 +3,6 @@ * Licensed under the GPL */ -#include "linux/config.h" #include "linux/sched.h" #include "linux/kernel.h" #include "linux/module.h" diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index a92965f..2e354b3 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c @@ -86,7 +86,7 @@ static inline unsigned long long get_time(void) return nsecs; } -irqreturn_t um_timer(int irq, void *dev, struct pt_regs *regs) +irqreturn_t um_timer(int irq, void *dev) { unsigned long long nsecs; unsigned long flags; diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c index c7b195c..b5f124a 100644 --- a/arch/um/kernel/trap.c +++ b/arch/um/kernel/trap.c @@ -8,7 +8,6 @@ #include "linux/sched.h" #include "linux/mm.h" #include "linux/spinlock.h" -#include "linux/config.h" #include "linux/init.h" #include "linux/ptrace.h" #include "asm/semaphore.h" diff --git a/arch/um/kernel/tt/gdb_kern.c b/arch/um/kernel/tt/gdb_kern.c index 2650638..68e1bf6 100644 --- a/arch/um/kernel/tt/gdb_kern.c +++ b/arch/um/kernel/tt/gdb_kern.c @@ -4,7 +4,6 @@ */ #include "linux/init.h" -#include "linux/config.h" #include "mconsole_kern.h" #ifdef CONFIG_MCONSOLE diff --git a/arch/um/kernel/tt/mem.c b/arch/um/kernel/tt/mem.c index 84a23b1..4d1929d 100644 --- a/arch/um/kernel/tt/mem.c +++ b/arch/um/kernel/tt/mem.c @@ -4,7 +4,6 @@ */ #include "linux/stddef.h" -#include "linux/config.h" #include "linux/mm.h" #include "asm/uaccess.h" #include "mem_user.h" diff --git a/arch/um/kernel/tt/uaccess_user.c b/arch/um/kernel/tt/uaccess_user.c index 6c92bbc..ed1abcf 100644 --- a/arch/um/kernel/tt/uaccess_user.c +++ b/arch/um/kernel/tt/uaccess_user.c @@ -4,13 +4,13 @@ * Licensed under the GPL */ -#include <setjmp.h> #include <string.h> #include "user_util.h" #include "uml_uaccess.h" #include "task.h" #include "kern_util.h" #include "os.h" +#include "longjmp.h" int __do_copy_from_user(void *to, const void *from, int n, void **fault_addr, void **fault_catcher) @@ -80,10 +80,10 @@ int __do_strnlen_user(const char *str, unsigned long n, struct tt_regs save = TASK_REGS(get_current())->tt; int ret; unsigned long *faddrp = (unsigned long *)fault_addr; - sigjmp_buf jbuf; + jmp_buf jbuf; *fault_catcher = &jbuf; - if(sigsetjmp(jbuf, 1) == 0) + if(UML_SETJMP(&jbuf) == 0) ret = strlen(str) + 1; else ret = *faddrp - (unsigned long) str; diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 97d88e7..66f43c9 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -3,7 +3,6 @@ * Licensed under the GPL */ -#include "linux/config.h" #include "linux/kernel.h" #include "linux/sched.h" #include "linux/notifier.h" diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c index f559bdf7..863981b 100644 --- a/arch/um/os-Linux/drivers/ethertap_user.c +++ b/arch/um/os-Linux/drivers/ethertap_user.c @@ -20,6 +20,7 @@ #include "net_user.h" #include "etap.h" #include "os.h" +#include "um_malloc.h" #define MAX_PACKET ETH_MAX_PACKET diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c index cd15b9d..d13299c 100644 --- a/arch/um/os-Linux/helper.c +++ b/arch/um/os-Linux/helper.c @@ -35,22 +35,23 @@ static int helper_child(void *arg) char **argv = data->argv; int errval; - if(helper_pause){ + if (helper_pause){ signal(SIGHUP, helper_hup); pause(); } - if(data->pre_exec != NULL) + if (data->pre_exec != NULL) (*data->pre_exec)(data->pre_data); execvp(argv[0], argv); errval = -errno; printk("helper_child - execve of '%s' failed - errno = %d\n", argv[0], errno); os_write_file(data->fd, &errval, sizeof(errval)); kill(os_getpid(), SIGKILL); - return(0); + return 0; } /* Returns either the pid of the child process we run or -E* on failure. - * XXX The alloc_stack here breaks if this is called in the tracing thread */ + * XXX The alloc_stack here breaks if this is called in the tracing thread, so + * we need to receive a preallocated stack (a local buffer is ok). */ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, unsigned long *stack_out) { @@ -58,20 +59,21 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, unsigned long stack, sp; int pid, fds[2], ret, n; - if((stack_out != NULL) && (*stack_out != 0)) + if ((stack_out != NULL) && (*stack_out != 0)) stack = *stack_out; - else stack = alloc_stack(0, __cant_sleep()); - if(stack == 0) + else + stack = alloc_stack(0, __cant_sleep()); + if (stack == 0) return -ENOMEM; ret = os_pipe(fds, 1, 0); - if(ret < 0){ + if (ret < 0) { printk("run_helper : pipe failed, ret = %d\n", -ret); goto out_free; } ret = os_set_exec_close(fds[1], 1); - if(ret < 0){ + if (ret < 0) { printk("run_helper : setting FD_CLOEXEC failed, ret = %d\n", -ret); goto out_close; @@ -83,7 +85,7 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, data.argv = argv; data.fd = fds[1]; pid = clone(helper_child, (void *) sp, CLONE_VM | SIGCHLD, &data); - if(pid < 0){ + if (pid < 0) { ret = -errno; printk("run_helper : clone failed, errno = %d\n", errno); goto out_close; @@ -95,10 +97,10 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, /* Read the errno value from the child, if the exec failed, or get 0 if * the exec succeeded because the pipe fd was set as close-on-exec. */ n = os_read_file(fds[0], &ret, sizeof(ret)); - if(n == 0) + if (n == 0) { ret = pid; - else { - if(n < 0){ + } else { + if (n < 0) { printk("run_helper : read on pipe failed, ret = %d\n", -n); ret = n; @@ -112,10 +114,9 @@ out_close: close(fds[1]); close(fds[0]); out_free: - if(stack_out == NULL) + if ((stack_out == NULL) || (*stack_out == 0)) free_stack(stack, 0); - else *stack_out = stack; - return(ret); + return ret; } int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags, @@ -125,31 +126,32 @@ int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags, int pid, status, err; stack = alloc_stack(stack_order, __cant_sleep()); - if(stack == 0) return(-ENOMEM); + if (stack == 0) + return -ENOMEM; sp = stack + (page_size() << stack_order) - sizeof(void *); pid = clone(proc, (void *) sp, flags | SIGCHLD, arg); - if(pid < 0){ + if (pid < 0) { err = -errno; printk("run_helper_thread : clone failed, errno = %d\n", errno); return err; } - if(stack_out == NULL){ + if (stack_out == NULL) { CATCH_EINTR(pid = waitpid(pid, &status, 0)); - if(pid < 0){ + if (pid < 0) { err = -errno; printk("run_helper_thread - wait failed, errno = %d\n", errno); pid = err; } - if(!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) + if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) printk("run_helper_thread - thread returned status " "0x%x\n", status); free_stack(stack, stack_order); - } - else *stack_out = stack; - return(pid); + } else + *stack_out = stack; + return pid; } int helper_wait(int pid) @@ -157,9 +159,9 @@ int helper_wait(int pid) int ret; CATCH_EINTR(ret = waitpid(pid, NULL, WNOHANG)); - if(ret < 0){ + if (ret < 0) { ret = -errno; printk("helper_wait : waitpid failed, errno = %d\n", errno); } - return(ret); + return ret; } diff --git a/arch/um/os-Linux/irq.c b/arch/um/os-Linux/irq.c index a97206d..d46b818 100644 --- a/arch/um/os-Linux/irq.c +++ b/arch/um/os-Linux/irq.c @@ -18,6 +18,7 @@ #include "sigio.h" #include "irq_user.h" #include "os.h" +#include "um_malloc.h" static struct pollfd *pollfds = NULL; static int pollfds_num = 0; diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c index d1c5670..685feaa 100644 --- a/arch/um/os-Linux/main.c +++ b/arch/um/os-Linux/main.c @@ -23,6 +23,7 @@ #include "choose-mode.h" #include "uml-config.h" #include "os.h" +#include "um_malloc.h" /* Set in set_stklim, which is called from main and __wrap_malloc. * __wrap_malloc only calls it if main hasn't started. diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c index f645776..925a652 100644 --- a/arch/um/os-Linux/sigio.c +++ b/arch/um/os-Linux/sigio.c @@ -19,6 +19,7 @@ #include "user_util.h" #include "sigio.h" #include "os.h" +#include "um_malloc.h" /* Protected by sigio_lock(), also used by sigio_cleanup, which is an * exitcall. diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c index 38be096..2115b8b 100644 --- a/arch/um/os-Linux/time.c +++ b/arch/um/os-Linux/time.c @@ -16,6 +16,7 @@ #include "process.h" #include "kern_constants.h" #include "os.h" +#include "uml-config.h" int set_interval(int is_virtual) { @@ -30,7 +31,7 @@ int set_interval(int is_virtual) return 0; } -#ifdef CONFIG_MODE_TT +#ifdef UML_CONFIG_MODE_TT void enable_timer(void) { set_interval(1); diff --git a/arch/um/os-Linux/tt.c b/arch/um/os-Linux/tt.c index 5461a06..3dc3a02 100644 --- a/arch/um/os-Linux/tt.c +++ b/arch/um/os-Linux/tt.c @@ -10,7 +10,6 @@ #include <errno.h> #include <stdarg.h> #include <stdlib.h> -#include <setjmp.h> #include <sys/time.h> #include <sys/ptrace.h> #include <linux/ptrace.h> diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c index 3f5b151..56b8a50 100644 --- a/arch/um/os-Linux/util.c +++ b/arch/um/os-Linux/util.c @@ -80,11 +80,18 @@ void setup_machinename(char *machine_out) struct utsname host; uname(&host); -#if defined(UML_CONFIG_UML_X86) && !defined(UML_CONFIG_64BIT) +#ifdef UML_CONFIG_UML_X86 +# ifndef UML_CONFIG_64BIT if (!strcmp(host.machine, "x86_64")) { strcpy(machine_out, "i686"); return; } +# else + if (!strcmp(host.machine, "i686")) { + strcpy(machine_out, "x86_64"); + return; + } +# endif #endif strcpy(machine_out, host.machine); } diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c index 69971b7..e299ee5 100644 --- a/arch/um/sys-i386/ldt.c +++ b/arch/um/sys-i386/ldt.c @@ -4,7 +4,6 @@ */ #include "linux/stddef.h" -#include "linux/config.h" #include "linux/sched.h" #include "linux/slab.h" #include "linux/types.h" diff --git a/arch/um/sys-i386/sysrq.c b/arch/um/sys-i386/sysrq.c index d5244f0..171b3e9 100644 --- a/arch/um/sys-i386/sysrq.c +++ b/arch/um/sys-i386/sysrq.c @@ -3,7 +3,6 @@ * Licensed under the GPL */ -#include "linux/config.h" #include "linux/kernel.h" #include "linux/smp.h" #include "linux/sched.h" diff --git a/arch/um/sys-i386/tls.c b/arch/um/sys-i386/tls.c index 71b97962..643dab5 100644 --- a/arch/um/sys-i386/tls.c +++ b/arch/um/sys-i386/tls.c @@ -3,7 +3,6 @@ * Licensed under the GPL */ -#include "linux/config.h" #include "linux/kernel.h" #include "linux/sched.h" #include "linux/slab.h" diff --git a/arch/um/sys-x86_64/ksyms.c b/arch/um/sys-x86_64/ksyms.c index 8592738..12c5936 100644 --- a/arch/um/sys-x86_64/ksyms.c +++ b/arch/um/sys-x86_64/ksyms.c @@ -14,6 +14,3 @@ EXPORT_SYMBOL(__up_wakeup); /*XXX: we need them because they would be exported by x86_64 */ EXPORT_SYMBOL(__memcpy); - -/* Networking helper routines. */ -EXPORT_SYMBOL(ip_compute_csum); diff --git a/arch/um/sys-x86_64/stub_segv.c b/arch/um/sys-x86_64/stub_segv.c index 1c96702..652fa34 100644 --- a/arch/um/sys-x86_64/stub_segv.c +++ b/arch/um/sys-x86_64/stub_segv.c @@ -5,7 +5,6 @@ #include <stddef.h> #include <signal.h> -#include <linux/compiler.h> #include <asm/unistd.h> #include "uml-config.h" #include "sysdep/sigcontext.h" |