Commit e58d2eb0 authored by Jeff Garzik's avatar Jeff Garzik

Merge pobox.com:/spare/repo/linux-2.6

into pobox.com:/spare/repo/libata-2.6
parents 5c6f34a7 8b5915b0
...@@ -107,7 +107,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) ...@@ -107,7 +107,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
/* read the word at location addr in the USER area. */ /* read the word at location addr in the USER area. */
case PTRACE_PEEKUSR: { case PTRACE_PEEKUSR: {
unsigned long tmp; unsigned long tmp = 0;
if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) { if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) {
ret = -EIO; ret = -EIO;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
of the assembly has to go. */ of the assembly has to go. */
#include <net/checksum.h> #include <net/checksum.h>
#include <linux/module.h>
static inline unsigned short from32to16(unsigned long x) static inline unsigned short from32to16(unsigned long x)
{ {
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192 /* Timer input freq. */ #define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192 /* Timer input freq. */
int platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *)) void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
{ {
/* setup 8bit timer ch2 */ /* setup 8bit timer ch2 */
ctrl_outb(H8300_TIMER_FREQ / HZ, TCORA2); /* set interval */ ctrl_outb(H8300_TIMER_FREQ / HZ, TCORA2); /* set interval */
...@@ -69,7 +69,7 @@ void platform_timer_eoi(void) ...@@ -69,7 +69,7 @@ void platform_timer_eoi(void)
#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8 /* Timer input freq. */ #define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8 /* Timer input freq. */
int platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *)) void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
{ {
*(unsigned short *)GRA= H8300_TIMER_FREQ / HZ; /* set interval */ *(unsigned short *)GRA= H8300_TIMER_FREQ / HZ; /* set interval */
*(unsigned short *)TCNT=0; /* clear counter */ *(unsigned short *)TCNT=0; /* clear counter */
......
...@@ -234,7 +234,7 @@ ENTRY(fsys_gettimeofday) ...@@ -234,7 +234,7 @@ ENTRY(fsys_gettimeofday)
cmp.eq p9,p0 = 1,r8 // MMIO64 ? cmp.eq p9,p0 = 1,r8 // MMIO64 ?
extr r2 = r21,24,8 // time_interpolator->jitter extr r2 = r21,24,8 // time_interpolator->jitter
cmp.eq p10,p0 = 2,r8 // MMIO32 ? cmp.eq p10,p0 = 2,r8 // MMIO32 ?
cmp.lt p11,p0 = 2,r8 // function? cmp.ltu p11,p0 = 2,r8 // function or other clock
(p11) br.cond.spnt.many fsys_fallback_syscall (p11) br.cond.spnt.many fsys_fallback_syscall
;; ;;
setf.sig f7 = r3 // Setup for scaling of counter setf.sig f7 = r3 // Setup for scaling of counter
...@@ -338,7 +338,7 @@ ENTRY(fsys_clock_gettime) ...@@ -338,7 +338,7 @@ ENTRY(fsys_clock_gettime)
.prologue .prologue
.altrp b6 .altrp b6
.body .body
cmp4.lt p6, p0 = CLOCK_MONOTONIC, r32 cmp4.ltu p6, p0 = CLOCK_MONOTONIC, r32
// Fallback if this is not CLOCK_REALTIME or CLOCK_MONOTONIC // Fallback if this is not CLOCK_REALTIME or CLOCK_MONOTONIC
(p6) br.spnt.few fsys_fallback_syscall (p6) br.spnt.few fsys_fallback_syscall
mov r31 = r33 mov r31 = r33
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright (c) 2001, 2002 Hirokazu Takata, Hitoshi Yamamoto, H. Kondo * Copyright (c) 2001, 2002 Hirokazu Takata, Hitoshi Yamamoto, H. Kondo
* Copyright (c) 2003 Hitoshi Yamamoto * Copyright (c) 2003 Hitoshi Yamamoto
* Copyright (c) 2004 Hirokazu Takata <takata at linux-m32r.org>
* *
* Taken from i386 version. * Taken from i386 version.
* Copyright (C) 1991, 1992 Linus Torvalds * Copyright (C) 1991, 1992 Linus Torvalds
...@@ -798,7 +799,7 @@ ENTRY(sys_call_table) ...@@ -798,7 +799,7 @@ ENTRY(sys_call_table)
.long sys_swapon .long sys_swapon
.long sys_reboot .long sys_reboot
.long old_readdir .long old_readdir
.long old_mmap /* 90 */ .long sys_ni_syscall /* 90 - old_mmap syscall holder */
.long sys_munmap .long sys_munmap
.long sys_truncate .long sys_truncate
.long sys_ftruncate .long sys_ftruncate
...@@ -993,15 +994,6 @@ ENTRY(sys_call_table) ...@@ -993,15 +994,6 @@ ENTRY(sys_call_table)
.long sys_mq_getsetattr .long sys_mq_getsetattr
.long sys_ni_syscall /* reserved for kexec */ .long sys_ni_syscall /* reserved for kexec */
.long sys_waitid .long sys_waitid
.long sys_perfctr_info
.long sys_vperfctr_open
.long sys_vperfctr_control
.long sys_vperfctr_unlink
.long sys_vperfctr_iresume
.long sys_vperfctr_read /* 290 */
.long sys_add_key
.long sys_request_key
.long sys_keyctl
syscall_table_size=(.-sys_call_table) syscall_table_size=(.-sys_call_table)
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
* Taken from i386 version. * Taken from i386 version.
*/ */
/* $Id$ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/sched.h> #include <linux/sched.h>
...@@ -88,10 +86,9 @@ sys_pipe(unsigned long r0, unsigned long r1, unsigned long r2, ...@@ -88,10 +86,9 @@ sys_pipe(unsigned long r0, unsigned long r1, unsigned long r2,
return error; return error;
} }
static inline long do_mmap2( asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags, unsigned long prot, unsigned long flags,
int fd, unsigned long pgoff) unsigned long fd, unsigned long pgoff)
{ {
int error = -EBADF; int error = -EBADF;
struct file *file = NULL; struct file *file = NULL;
...@@ -113,62 +110,6 @@ static inline long do_mmap2( ...@@ -113,62 +110,6 @@ static inline long do_mmap2(
return error; return error;
} }
asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags,
unsigned long fd, unsigned long pgoff)
{
return do_mmap2(addr, len, prot, flags, fd, pgoff);
}
/*
* Perform the select(nd, in, out, ex, tv) and mmap() system
* calls. Linux/M32R didn't use to be able to handle more than
* 4 system call parameters, so these system calls used a memory
* block for parameter passing..
*/
struct mmap_arg_struct {
unsigned long addr;
unsigned long len;
unsigned long prot;
unsigned long flags;
unsigned long fd;
unsigned long offset;
};
asmlinkage int old_mmap(struct mmap_arg_struct *arg)
{
struct mmap_arg_struct a;
int err = -EFAULT;
if (copy_from_user(&a, arg, sizeof(a)))
goto out;
err = -EINVAL;
if (a.offset & ~PAGE_MASK)
goto out;
err = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd,
a.offset>>PAGE_SHIFT);
out:
return err;
}
struct sel_arg_struct {
unsigned long n;
fd_set __user *inp, *outp, *exp;
struct timeval __user *tvp;
};
asmlinkage int old_select(struct sel_arg_struct __user *arg)
{
struct sel_arg_struct a;
if (copy_from_user(&a, arg, sizeof(a)))
return -EFAULT;
/* sys_select() does the appropriate kernel locking */
return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
}
/* /*
* sys_ipc() is the de-multiplexer for the SysV IPC calls.. * sys_ipc() is the de-multiplexer for the SysV IPC calls..
* *
......
...@@ -263,7 +263,7 @@ _GLOBAL(htab_call_hpte_updatepp) ...@@ -263,7 +263,7 @@ _GLOBAL(htab_call_hpte_updatepp)
/* if we failed because typically the HPTE wasn't really here /* if we failed because typically the HPTE wasn't really here
* we try an insertion. * we try an insertion.
*/ */
cmpi 0,r3,-1 cmpdi 0,r3,-1
beq- htab_insert_pte beq- htab_insert_pte
/* Clear the BUSY bit and Write out the PTE */ /* Clear the BUSY bit and Write out the PTE */
......
...@@ -143,7 +143,6 @@ config SMP ...@@ -143,7 +143,6 @@ config SMP
will appear to be running simultaneously. If the host is a will appear to be running simultaneously. If the host is a
multiprocessor, then UML processes may run simultaneously, depending multiprocessor, then UML processes may run simultaneously, depending
on the host scheduler. on the host scheduler.
CONFIG_SMP will be set to whatever this option is set to.
It is safe to leave this unchanged. It is safe to leave this unchanged.
config NR_CPUS config NR_CPUS
...@@ -179,6 +178,7 @@ config KERNEL_HALF_GIGS ...@@ -179,6 +178,7 @@ config KERNEL_HALF_GIGS
config HIGHMEM config HIGHMEM
bool "Highmem support" bool "Highmem support"
depends on BROKEN
config KERNEL_STACK_ORDER config KERNEL_STACK_ORDER
int "Kernel stack size order" int "Kernel stack size order"
...@@ -226,6 +226,7 @@ source "crypto/Kconfig" ...@@ -226,6 +226,7 @@ source "crypto/Kconfig"
source "lib/Kconfig" source "lib/Kconfig"
menu "SCSI support" menu "SCSI support"
depends on BROKEN
config SCSI config SCSI
tristate "SCSI support" tristate "SCSI support"
...@@ -242,6 +243,8 @@ endmenu ...@@ -242,6 +243,8 @@ endmenu
source "drivers/md/Kconfig" source "drivers/md/Kconfig"
source "drivers/mtd/Kconfig" if BROKEN
source "drivers/mtd/Kconfig"
endif
source "arch/um/Kconfig.debug" source "arch/um/Kconfig.debug"
...@@ -54,6 +54,7 @@ config BLK_DEV_INITRD ...@@ -54,6 +54,7 @@ config BLK_DEV_INITRD
config MMAPPER config MMAPPER
tristate "Example IO memory driver" tristate "Example IO memory driver"
depends on BROKEN
help help
The User-Mode Linux port can provide support for IO Memory The User-Mode Linux port can provide support for IO Memory
emulation with this option. This allows a host file to be emulation with this option. This allows a host file to be
......
...@@ -72,6 +72,10 @@ config XTERM_CHAN ...@@ -72,6 +72,10 @@ config XTERM_CHAN
well, since UML's gdb currently requires an xterm. well, since UML's gdb currently requires an xterm.
It is safe to say 'Y' here. It is safe to say 'Y' here.
config NOCONFIG_CHAN
bool
default !(XTERM_CHAN && TTY_CHAN && PTY_CHAN && PORT_CHAN && FD_CHAN && NULL_CHAN)
config CON_ZERO_CHAN config CON_ZERO_CHAN
string "Default main console channel initialization" string "Default main console channel initialization"
default "fd:0,fd:1" default "fd:0,fd:1"
......
...@@ -135,7 +135,7 @@ config UML_NET_MCAST ...@@ -135,7 +135,7 @@ config UML_NET_MCAST
config UML_NET_PCAP config UML_NET_PCAP
bool "pcap transport" bool "pcap transport"
depends on UML_NET depends on UML_NET && BROKEN
help help
The pcap transport makes a pcap packet stream on the host look The pcap transport makes a pcap packet stream on the host look
like an ethernet device inside UML. This is useful for making like an ethernet device inside UML. This is useful for making
......
...@@ -5,20 +5,13 @@ ...@@ -5,20 +5,13 @@
ARCH_DIR = arch/um ARCH_DIR = arch/um
OS := $(shell uname -s) OS := $(shell uname -s)
#We require it or things break.
SHELL := /bin/bash
# Recalculate MODLIB to reflect the EXTRAVERSION changes (via KERNELRELEASE) filechk_gen_header = $<
# The way the toplevel Makefile is written EXTRAVERSION is not supposed
# to be changed outside the toplevel Makefile, but recalculating MODLIB is
# a sufficient workaround until we no longer need architecture dependent
# EXTRAVERSION...
MODLIB := $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
ifeq ($(CONFIG_DEBUG_INFO),y)
CFLAGS := $(subst -fomit-frame-pointer,,$(CFLAGS))
endif
core-y += $(ARCH_DIR)/kernel/ \ core-y += $(ARCH_DIR)/kernel/ \
$(ARCH_DIR)/drivers/ \ $(ARCH_DIR)/drivers/ \
$(ARCH_DIR)/sys-$(SUBARCH)/ $(ARCH_DIR)/sys-$(SUBARCH)/
# Have to precede the include because the included Makefiles reference them. # Have to precede the include because the included Makefiles reference them.
...@@ -31,13 +24,6 @@ ARCH_SYMLINKS = include/asm-um/arch $(ARCH_DIR)/include/sysdep $(ARCH_DIR)/os \ ...@@ -31,13 +24,6 @@ ARCH_SYMLINKS = include/asm-um/arch $(ARCH_DIR)/include/sysdep $(ARCH_DIR)/os \
GEN_HEADERS += $(ARCH_DIR)/include/task.h $(ARCH_DIR)/include/kern_constants.h GEN_HEADERS += $(ARCH_DIR)/include/task.h $(ARCH_DIR)/include/kern_constants.h
# This target adds dependencies to "prepare". They are defined in the included
# Makefiles (see Makefile-i386).
.PHONY: sys_prepare
sys_prepare:
@:
MAKEFILE-$(CONFIG_MODE_TT) += Makefile-tt MAKEFILE-$(CONFIG_MODE_TT) += Makefile-tt
MAKEFILE-$(CONFIG_MODE_SKAS) += Makefile-skas MAKEFILE-$(CONFIG_MODE_SKAS) += Makefile-skas
...@@ -45,11 +31,12 @@ ifneq ($(MAKEFILE-y),) ...@@ -45,11 +31,12 @@ ifneq ($(MAKEFILE-y),)
include $(addprefix $(ARCH_DIR)/,$(MAKEFILE-y)) include $(addprefix $(ARCH_DIR)/,$(MAKEFILE-y))
endif endif
ARCH_INCLUDE := -I$(ARCH_DIR)/include
SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH)
include $(ARCH_DIR)/Makefile-$(SUBARCH) include $(ARCH_DIR)/Makefile-$(SUBARCH)
include $(ARCH_DIR)/Makefile-os-$(OS) include $(ARCH_DIR)/Makefile-os-$(OS)
ARCH_INCLUDE = -I$(ARCH_DIR)/include
# -Derrno=kernel_errno - This turns all kernel references to errno into # -Derrno=kernel_errno - This turns all kernel references to errno into
# kernel_errno to separate them from the libc errno. This allows -fno-common # kernel_errno to separate them from the libc errno. This allows -fno-common
# in CFLAGS. Otherwise, it would cause ld to complain about the two different # in CFLAGS. Otherwise, it would cause ld to complain about the two different
...@@ -59,7 +46,7 @@ CFLAGS += $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \ ...@@ -59,7 +46,7 @@ CFLAGS += $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \
-D_LARGEFILE64_SOURCE $(ARCH_INCLUDE) -Derrno=kernel_errno \ -D_LARGEFILE64_SOURCE $(ARCH_INCLUDE) -Derrno=kernel_errno \
-Dsigprocmask=kernel_sigprocmask $(MODE_INCLUDE) -Dsigprocmask=kernel_sigprocmask $(MODE_INCLUDE)
CFLAGS += $(call check_gcc,-fno-unit-at-a-time,) CFLAGS += $(call cc-option,-fno-unit-at-a-time,)
LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
...@@ -72,23 +59,17 @@ CONFIG_KERNEL_HALF_GIGS ?= 0 ...@@ -72,23 +59,17 @@ CONFIG_KERNEL_HALF_GIGS ?= 0
SIZE = (($(CONFIG_NEST_LEVEL) + $(CONFIG_KERNEL_HALF_GIGS)) * 0x20000000) SIZE = (($(CONFIG_NEST_LEVEL) + $(CONFIG_KERNEL_HALF_GIGS)) * 0x20000000)
ifeq ($(CONFIG_MODE_SKAS), y) ifeq ($(CONFIG_MODE_SKAS), y)
$(SYS_HEADERS) : $(TOPDIR)/$(ARCH_DIR)/include/skas_ptregs.h $(SYS_HEADERS) : $(ARCH_DIR)/include/skas_ptregs.h
endif endif
include/linux/version.h: arch/$(ARCH)/Makefile prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS) \
$(ARCH_DIR)/kernel/vmlinux.lds.S
$(ARCH_DIR)/vmlinux.lds.S :
touch $@
prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS)
LDFLAGS_vmlinux = -r
# These aren't in Makefile-tt because they are needed in the !CONFIG_MODE_TT + # These aren't in Makefile-tt because they are needed in the !CONFIG_MODE_TT +
# CONFIG_MODE_SKAS + CONFIG_STATIC_LINK case. # CONFIG_MODE_SKAS + CONFIG_STATIC_LINK case.
LINK_TT = -static LINK_TT = -static
LD_SCRIPT_TT := uml.lds LD_SCRIPT_TT := uml.lds.S
ifeq ($(CONFIG_STATIC_LINK),y) ifeq ($(CONFIG_STATIC_LINK),y)
LINK-y += $(LINK_TT) LINK-y += $(LINK_TT)
...@@ -118,13 +99,14 @@ CPPFLAGS_vmlinux.lds = $(shell echo -U$(SUBARCH) \ ...@@ -118,13 +99,14 @@ CPPFLAGS_vmlinux.lds = $(shell echo -U$(SUBARCH) \
-DELF_FORMAT=\"$(ELF_FORMAT)\" $(CPP_MODE_TT) \ -DELF_FORMAT=\"$(ELF_FORMAT)\" $(CPP_MODE_TT) \
-DKERNEL_STACK_SIZE=$(STACK_SIZE)) -DKERNEL_STACK_SIZE=$(STACK_SIZE))
export CPPFLAGS_$(LD_SCRIPT-y) = $(CPPFLAGS_vmlinux.lds) -P -C -Uum CFLAGS_vmlinux = $(LINK-y) $(LINK_WRAPS)
define cmd_vmlinux__
LD_SCRIPT-y := $(ARCH_DIR)/kernel/$(LD_SCRIPT-y) $(CC) $(CFLAGS_vmlinux) -o $@ \
-Wl,-T,$(vmlinux-lds) $(vmlinux-init) \
linux: vmlinux $(LD_SCRIPT-y) -Wl,--start-group $(vmlinux-main) -Wl,--end-group \
$(CC) -Wl,-T,$(LD_SCRIPT-y) $(LINK-y) $(LINK_WRAPS) \ -L/usr/lib -lutil \
-o linux vmlinux -L/usr/lib -lutil $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE ,$^)
endef
USER_CFLAGS := $(patsubst -I%,,$(CFLAGS)) USER_CFLAGS := $(patsubst -I%,,$(CFLAGS))
USER_CFLAGS := $(patsubst -Derrno=kernel_errno,,$(USER_CFLAGS)) USER_CFLAGS := $(patsubst -Derrno=kernel_errno,,$(USER_CFLAGS))
...@@ -135,76 +117,72 @@ USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \ ...@@ -135,76 +117,72 @@ USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \
# To get a definition of F_SETSIG # To get a definition of F_SETSIG
USER_CFLAGS += -D_GNU_SOURCE USER_CFLAGS += -D_GNU_SOURCE
# From main Makefile, these options are set after including the ARCH makefile. #When cleaning we don't include .config, so we don't include
# So copy them here. #TT or skas makefiles and don't clean skas_ptregs.h.
CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE $(GEN_HEADERS) $(ARCH_DIR)/include/skas_ptregs.h
USER_CFLAGS += -Os
else
USER_CFLAGS += -O2
endif
ifndef CONFIG_FRAME_POINTER
USER_CFLAGS += -fomit-frame-pointer
endif
ifdef CONFIG_DEBUG_INFO
USER_CFLAGS += -g
endif
CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/uml.lds \
$(ARCH_DIR)/dyn_link.ld.s $(ARCH_DIR)/include/uml-config.h \
$(GEN_HEADERS)
MRPROPER_FILES += $(SYMLINK_HEADERS) $(ARCH_SYMLINKS) \ MRPROPER_FILES += $(SYMLINK_HEADERS) $(ARCH_SYMLINKS) \
$(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS)) $(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS)) $(ARCH_DIR)/os
archmrproper: archmrproper:
@: @:
archclean: archclean:
$(Q)$(MAKE) $(clean)=$(ARCH_DIR)/util
@find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \ @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
-o -name '*.gcov' \) -type f -print | xargs rm -f -o -name '*.gcov' \) -type f -print | xargs rm -f
#We need to re-preprocess this when the symlink dest changes.
#So we touch it.
$(ARCH_DIR)/kernel/vmlinux.lds.S: FORCE
@echo ' SYMLINK $@'
$(Q)ln -sf $(LD_SCRIPT-y) $@
$(Q)touch $@
$(SYMLINK_HEADERS): $(SYMLINK_HEADERS):
cd $(TOPDIR)/$(dir $@) ; \ @echo ' SYMLINK $@'
$(Q)cd $(TOPDIR)/$(dir $@) ; \
ln -sf $(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $(notdir $@) ln -sf $(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $(notdir $@)
include/asm-um/arch: include/asm-um/arch:
cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(SUBARCH) arch @echo ' SYMLINK $@'
$(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(SUBARCH) arch
$(ARCH_DIR)/include/sysdep: $(ARCH_DIR)/include/sysdep:
cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep @echo ' SYMLINK $@'
$(Q)cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep
$(ARCH_DIR)/os: $(ARCH_DIR)/os:
cd $(ARCH_DIR) && ln -sf os-$(OS) os @echo ' SYMLINK $@'
$(Q)cd $(ARCH_DIR) && ln -sf os-$(OS) os
# Generated files # Generated files
define filechk_umlconfig define filechk_umlconfig
sed 's/ CONFIG/ UML_CONFIG/' sed 's/ CONFIG/ UML_CONFIG/'
endef endef
$(ARCH_DIR)/include/uml-config.h : $(TOPDIR)/include/linux/autoconf.h $(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h
$(call filechk,umlconfig) $(call filechk,umlconfig)
filechk_gen_header = $< $(ARCH_DIR)/include/task.h: $(ARCH_DIR)/util/mk_task
$(call filechk,gen_header)
$(ARCH_DIR)/include/task.h : $(ARCH_DIR)/util/mk_task $(ARCH_DIR)/include/kern_constants.h: $(ARCH_DIR)/util/mk_constants
$(call filechk,gen_header) $(call filechk,gen_header)
$(ARCH_DIR)/include/kern_constants.h : $(ARCH_DIR)/util/mk_constants $(ARCH_DIR)/include/skas_ptregs.h: $(ARCH_DIR)/kernel/skas/util/mk_ptregs
$(call filechk,gen_header) $(call filechk,gen_header)
$(ARCH_DIR)/util/mk_task $(ARCH_DIR)/util/mk_constants : $(ARCH_DIR)/util \ $(ARCH_DIR)/util/mk_task $(ARCH_DIR)/util/mk_constants: $(ARCH_DIR)/util \
sys_prepare FORCE ; FORCE ;
$(ARCH_DIR)/util: FORCE $(ARCH_DIR)/kernel/skas/util/mk_ptregs: $(ARCH_DIR)/kernel/skas/util FORCE ;
$(Q)$(MAKE) $(build)=$@
export SUBARCH USER_CFLAGS OS $(ARCH_DIR)/util: scripts_basic $(SYS_DIR)/sc.h FORCE
$(Q)$(MAKE) $(build)=$@
all: linux $(ARCH_DIR)/kernel/skas/util: scripts_basic FORCE
$(Q)$(MAKE) $(build)=$@
define archhelp export SUBARCH USER_CFLAGS OS
echo '* linux - Binary kernel image (./linux)'
endef
ifeq ($(CONFIG_HOST_2G_2G), y) ifeq ($(CONFIG_HOST_2G_2G), y)
TOP_ADDR = 0x80000000 TOP_ADDR := 0x80000000
else else
TOP_ADDR = 0xc0000000 TOP_ADDR := 0xc0000000
endif endif
ifeq ($(CONFIG_MODE_SKAS),y) ifeq ($(CONFIG_MODE_SKAS),y)
ifneq ($(CONFIG_MODE_TT),y) ifneq ($(CONFIG_MODE_TT),y)
START = 0x8048000 START := 0x8048000
endif endif
endif endif
...@@ -16,37 +16,30 @@ ifneq ($(CONFIG_GPROF),y) ...@@ -16,37 +16,30 @@ ifneq ($(CONFIG_GPROF),y)
ARCH_CFLAGS += -DUM_FASTCALL ARCH_CFLAGS += -DUM_FASTCALL
endif endif
ELF_ARCH = $(SUBARCH) ELF_ARCH := $(SUBARCH)
ELF_FORMAT = elf32-$(SUBARCH) ELF_FORMAT := elf32-$(SUBARCH)
OBJCOPYFLAGS := -O binary -R .note -R .comment -S OBJCOPYFLAGS := -O binary -R .note -R .comment -S
SYS_DIR := $(ARCH_DIR)/include/sysdep-i386
SYS_UTIL_DIR := $(ARCH_DIR)/sys-i386/util SYS_UTIL_DIR := $(ARCH_DIR)/sys-i386/util
SYS_HEADERS = $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h SYS_HEADERS := $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h
sys_prepare: $(SYS_DIR)/sc.h
prepare: $(SYS_HEADERS) prepare: $(SYS_HEADERS)
filechk_$(SYS_DIR)/sc.h := $(SYS_UTIL_DIR)/mk_sc
$(SYS_DIR)/sc.h: $(SYS_UTIL_DIR)/mk_sc $(SYS_DIR)/sc.h: $(SYS_UTIL_DIR)/mk_sc
$(call filechk,$@) $(call filechk,gen_header)
filechk_$(SYS_DIR)/thread.h := $(SYS_UTIL_DIR)/mk_thread
$(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread $(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread
$(call filechk,$@) $(call filechk,gen_header)
$(SYS_UTIL_DIR)/mk_sc: scripts/basic/fixdep include/config/MARKER FORCE ; $(SYS_UTIL_DIR)/mk_sc: scripts_basic FORCE
$(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@ $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@
$(SYS_UTIL_DIR)/mk_thread: $(ARCH_SYMLINKS) $(GEN_HEADERS) sys_prepare FORCE ; $(SYS_UTIL_DIR)/mk_thread: scripts_basic $(ARCH_SYMLINKS) $(GEN_HEADERS) FORCE
$(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@ $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@
$(SYS_UTIL_DIR): include/asm FORCE $(SYS_UTIL_DIR): scripts_basic include/asm FORCE
$(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR)
CLEAN_FILES += $(SYS_HEADERS) CLEAN_FILES += $(SYS_HEADERS)
...@@ -9,12 +9,9 @@ CFLAGS-$(CONFIG_GCOV) += -fprofile-arcs -ftest-coverage ...@@ -9,12 +9,9 @@ CFLAGS-$(CONFIG_GCOV) += -fprofile-arcs -ftest-coverage
CFLAGS-$(CONFIG_GPROF) += $(PROFILE) CFLAGS-$(CONFIG_GPROF) += $(PROFILE)
LINK-$(CONFIG_GPROF) += $(PROFILE) LINK-$(CONFIG_GPROF) += $(PROFILE)
MODE_INCLUDE += -I$(TOPDIR)/$(ARCH_DIR)/kernel/skas/include MODE_INCLUDE += -I$(srctree)/$(ARCH_DIR)/kernel/skas/include
LINK_SKAS = -Wl,-rpath,/lib LINK_SKAS = -Wl,-rpath,/lib
LD_SCRIPT_SKAS = dyn.lds LD_SCRIPT_SKAS = dyn.lds.S
GEN_HEADERS += $(TOPDIR)/$(ARCH_DIR)/include/skas_ptregs.h GEN_HEADERS += $(ARCH_DIR)/include/skas_ptregs.h
$(TOPDIR)/$(ARCH_DIR)/include/skas_ptregs.h :
$(Q)$(MAKE) $(build)=$(ARCH_DIR)/kernel/skas $@
...@@ -3,5 +3,4 @@ ...@@ -3,5 +3,4 @@
# Licensed under the GPL # Licensed under the GPL
# #
MODE_INCLUDE += -I$(TOPDIR)/$(ARCH_DIR)/kernel/tt/include MODE_INCLUDE += -I$(srctree)/$(ARCH_DIR)/kernel/tt/include
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "line.h" #include "line.h"
#include "os.h" #include "os.h"
#ifdef CONFIG_NOCONFIG_CHAN
static void *not_configged_init(char *str, int device, struct chan_opts *opts) static void *not_configged_init(char *str, int device, struct chan_opts *opts)
{ {
printk(KERN_ERR "Using a channel type which is configured out of " printk(KERN_ERR "Using a channel type which is configured out of "
...@@ -87,6 +88,7 @@ static struct chan_ops not_configged_ops = { ...@@ -87,6 +88,7 @@ static struct chan_ops not_configged_ops = {
.free = not_configged_free, .free = not_configged_free,
.winch = 0, .winch = 0,
}; };
#endif /* CONFIG_NOCONFIG_CHAN */
void generic_close(int fd, void *unused) void generic_close(int fd, void *unused)
{ {
......
...@@ -396,14 +396,13 @@ int thread_fd = -1; ...@@ -396,14 +396,13 @@ int thread_fd = -1;
*/ */
int intr_count = 0; int intr_count = 0;
static void ubd_finish(struct request *req, int error) /* call ubd_finish if you need to serialize */
static void __ubd_finish(struct request *req, int error)
{ {
int nsect; int nsect;
if(error){ if(error){
spin_lock(&ubd_io_lock);
end_request(req, 0); end_request(req, 0);
spin_unlock(&ubd_io_lock);
return; return;
} }
nsect = req->current_nr_sectors; nsect = req->current_nr_sectors;
...@@ -412,11 +411,17 @@ static void ubd_finish(struct request *req, int error) ...@@ -412,11 +411,17 @@ static void ubd_finish(struct request *req, int error)
req->errors = 0; req->errors = 0;
req->nr_sectors -= nsect; req->nr_sectors -= nsect;
req->current_nr_sectors = 0; req->current_nr_sectors = 0;
spin_lock(&ubd_io_lock);
end_request(req, 1); end_request(req, 1);
}
static inline void ubd_finish(struct request *req, int error)
{
spin_lock(&ubd_io_lock);
__ubd_finish(req, error);
spin_unlock(&ubd_io_lock); spin_unlock(&ubd_io_lock);
} }
/* Called without ubd_io_lock held */
static void ubd_handler(void) static void ubd_handler(void)
{ {
struct io_thread_req req; struct io_thread_req req;
...@@ -768,9 +773,11 @@ int ubd_driver_init(void){ ...@@ -768,9 +773,11 @@ int ubd_driver_init(void){
unsigned long stack; unsigned long stack;
int err; int err;
/* Set by CONFIG_BLK_DEV_UBD_SYNC or ubd=sync.*/
if(global_openflags.s){ if(global_openflags.s){
printk(KERN_INFO "ubd : Synchronous mode\n"); printk(KERN_INFO "ubd: Synchronous mode\n");
return(0); /* Letting ubd=sync be like using ubd#s= instead of ubd#= is
* enough. So use anyway the io thread. */
} }
stack = alloc_stack(0, 0); stack = alloc_stack(0, 0);
io_pid = start_io_thread(stack + PAGE_SIZE - sizeof(void *), io_pid = start_io_thread(stack + PAGE_SIZE - sizeof(void *),
...@@ -965,6 +972,7 @@ static int prepare_mmap_request(struct ubd *dev, int fd, __u64 offset, ...@@ -965,6 +972,7 @@ static int prepare_mmap_request(struct ubd *dev, int fd, __u64 offset,
return(0); return(0);
} }
/* Called with ubd_io_lock held */
static int prepare_request(struct request *req, struct io_thread_req *io_req) static int prepare_request(struct request *req, struct io_thread_req *io_req)
{ {
struct gendisk *disk = req->rq_disk; struct gendisk *disk = req->rq_disk;
...@@ -977,9 +985,7 @@ static int prepare_request(struct request *req, struct io_thread_req *io_req) ...@@ -977,9 +985,7 @@ static int prepare_request(struct request *req, struct io_thread_req *io_req)
if((rq_data_dir(req) == WRITE) && !dev->openflags.w){ if((rq_data_dir(req) == WRITE) && !dev->openflags.w){
printk("Write attempted on readonly ubd device %s\n", printk("Write attempted on readonly ubd device %s\n",
disk->disk_name); disk->disk_name);
spin_lock(&ubd_io_lock);
end_request(req, 0); end_request(req, 0);
spin_unlock(&ubd_io_lock);
return(1); return(1);
} }
...@@ -1029,6 +1035,7 @@ static int prepare_request(struct request *req, struct io_thread_req *io_req) ...@@ -1029,6 +1035,7 @@ static int prepare_request(struct request *req, struct io_thread_req *io_req)
return(0); return(0);
} }
/* Called with ubd_io_lock held */
static void do_ubd_request(request_queue_t *q) static void do_ubd_request(request_queue_t *q)
{ {
struct io_thread_req io_req; struct io_thread_req io_req;
...@@ -1040,7 +1047,7 @@ static void do_ubd_request(request_queue_t *q) ...@@ -1040,7 +1047,7 @@ static void do_ubd_request(request_queue_t *q)
err = prepare_request(req, &io_req); err = prepare_request(req, &io_req);
if(!err){ if(!err){
do_io(&io_req); do_io(&io_req);
ubd_finish(req, io_req.error); __ubd_finish(req, io_req.error);
} }
} }
} }
......
all : sc.h
sc.h : ../util/mk_sc
../util/mk_sc > $@
../util/mk_sc :
$(MAKE) -C ../util mk_sc
...@@ -103,7 +103,8 @@ static inline unsigned short ip_fast_csum(unsigned char * iph, ...@@ -103,7 +103,8 @@ static inline unsigned short ip_fast_csum(unsigned char * iph,
are modified, we must also specify them as outputs, or gcc are modified, we must also specify them as outputs, or gcc
will assume they contain their original values. */ will assume they contain their original values. */
: "=r" (sum), "=r" (iph), "=r" (ihl) : "=r" (sum), "=r" (iph), "=r" (ihl)
: "1" (iph), "2" (ihl)); : "1" (iph), "2" (ihl)
: "memory");
return(sum); return(sum);
} }
......
...@@ -4,11 +4,7 @@ ...@@ -4,11 +4,7 @@
# #
extra-y := vmlinux.lds extra-y := vmlinux.lds
clean-files := vmlinux.lds.S
# Descend into ../util for make clean. This is here because it doesn't work
# in arch/um/Makefile.
subdir- = ../util
obj-y = checksum.o config.o exec_kern.o exitcode.o frame_kern.o frame.o \ obj-y = checksum.o config.o exec_kern.o exitcode.o frame_kern.o frame.o \
helper.o init_task.o irq.o irq_user.o ksyms.o main.o mem.o mem_user.o \ helper.o init_task.o irq.o irq_user.o ksyms.o main.o mem.o mem_user.o \
...@@ -29,24 +25,16 @@ obj-$(CONFIG_MODE_SKAS) += skas/ ...@@ -29,24 +25,16 @@ obj-$(CONFIG_MODE_SKAS) += skas/
user-objs-$(CONFIG_TTY_LOG) += tty_log.o user-objs-$(CONFIG_TTY_LOG) += tty_log.o
USER_OBJS := $(filter %_user.o,$(obj-y)) $(user-objs-y) config.o helper.o \ USER_OBJS := $(filter %_user.o,$(obj-y)) $(user-objs-y) config.o helper.o \
main.o process.o tempfile.o time.o tty_log.o umid.o user_util.o main.o process.o tempfile.o time.o tty_log.o umid.o user_util.o frame.o
USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
CFLAGS_frame.o := $(patsubst -fomit-frame-pointer,,$(USER_CFLAGS)) CFLAGS_frame.o := -fno-omit-frame-pointer
# This has to be separate because it needs be compiled with frame pointers
# regardless of how the rest of the kernel is built.
$(obj)/frame.o: $(src)/frame.c
$(CC) $(CFLAGS_$(notdir $@)) -c -o $@ $<
$(USER_OBJS) : %.o: %.c $(USER_OBJS) : %.o: %.c
$(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< $(CC) $(USER_CFLAGS) $(CFLAGS_$(notdir $@)) -c -o $@ $<
QUOTE = 'my $$config=`cat $(TOPDIR)/.config`; $$config =~ s/"/\\"/g ; $$config =~ s/\n/\\n"\n"/g ; while(<STDIN>) { $$_ =~ s/CONFIG/$$config/; print $$_ }' QUOTE = 'my $$config=`cat $(TOPDIR)/.config`; $$config =~ s/"/\\"/g ; $$config =~ s/\n/\\n"\n"/g ; while(<STDIN>) { $$_ =~ s/CONFIG/$$config/; print $$_ }'
$(obj)/config.o : $(obj)/config.c
quiet_cmd_quote = QUOTE $@ quiet_cmd_quote = QUOTE $@
cmd_quote = $(PERL) -e $(QUOTE) < $< > $@ cmd_quote = $(PERL) -e $(QUOTE) < $< > $@
......
...@@ -441,6 +441,8 @@ int um_request_irq(unsigned int irq, int fd, int type, ...@@ -441,6 +441,8 @@ int um_request_irq(unsigned int irq, int fd, int type,
err = activate_fd(irq, fd, type, dev_id); err = activate_fd(irq, fd, type, dev_id);
return(err); return(err);
} }
EXPORT_SYMBOL(um_request_irq);
EXPORT_SYMBOL(reactivate_fd);
/* this was setup_x86_irq but it seems pretty generic */ /* this was setup_x86_irq but it seems pretty generic */
int setup_irq(unsigned int irq, struct irqaction * new) int setup_irq(unsigned int irq, struct irqaction * new)
......
...@@ -60,6 +60,7 @@ EXPORT_SYMBOL(strncpy_from_user_skas); ...@@ -60,6 +60,7 @@ EXPORT_SYMBOL(strncpy_from_user_skas);
EXPORT_SYMBOL(copy_to_user_skas); EXPORT_SYMBOL(copy_to_user_skas);
EXPORT_SYMBOL(copy_from_user_skas); EXPORT_SYMBOL(copy_from_user_skas);
#endif #endif
EXPORT_SYMBOL(uml_strdup);
EXPORT_SYMBOL(os_stat_fd); EXPORT_SYMBOL(os_stat_fd);
EXPORT_SYMBOL(os_stat_file); EXPORT_SYMBOL(os_stat_file);
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "linux/slab.h" #include "linux/slab.h"
#include "linux/vmalloc.h" #include "linux/vmalloc.h"
#include "linux/bootmem.h" #include "linux/bootmem.h"
#include "linux/module.h"
#include "asm/types.h" #include "asm/types.h"
#include "asm/pgtable.h" #include "asm/pgtable.h"
#include "kern_util.h" #include "kern_util.h"
...@@ -36,7 +37,7 @@ static struct rb_node **find_rb(void *virt) ...@@ -36,7 +37,7 @@ static struct rb_node **find_rb(void *virt)
struct phys_desc *d; struct phys_desc *d;
while(*n != NULL){ while(*n != NULL){
d = rb_entry(n, struct phys_desc, rb); d = rb_entry(*n, struct phys_desc, rb);
if(d->virt == virt) if(d->virt == virt)
return(n); return(n);
...@@ -56,7 +57,7 @@ static struct phys_desc *find_phys_mapping(void *virt) ...@@ -56,7 +57,7 @@ static struct phys_desc *find_phys_mapping(void *virt)
if(*n == NULL) if(*n == NULL)
return(NULL); return(NULL);
return(rb_entry(n, struct phys_desc, rb)); return(rb_entry(*n, struct phys_desc, rb));
} }
static void insert_phys_mapping(struct phys_desc *desc) static void insert_phys_mapping(struct phys_desc *desc)
...@@ -220,6 +221,10 @@ void physmem_forget_descriptor(int fd) ...@@ -220,6 +221,10 @@ void physmem_forget_descriptor(int fd)
kfree(desc); kfree(desc);
} }
EXPORT_SYMBOL(physmem_forget_descriptor);
EXPORT_SYMBOL(physmem_remove_mapping);
EXPORT_SYMBOL(physmem_subst_mapping);
void arch_free_page(struct page *page, int order) void arch_free_page(struct page *page, int order)
{ {
void *virt; void *virt;
......
...@@ -3,26 +3,14 @@ ...@@ -3,26 +3,14 @@
# Licensed under the GPL # Licensed under the GPL
# #
obj-y = exec_kern.o exec_user.o mem.o mem_user.o mmu.o process.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 sys-$(SUBARCH)/ uaccess.o sys-$(SUBARCH)/
hostprogs-y := util/mk_ptregs subdir-y := util
clean-files := include/skas_ptregs.h
USER_OBJS = $(filter %_user.o,$(obj-y)) process.o time.o USER_OBJS = $(filter %_user.o,$(obj-y)) process.o time.o
USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
$(TOPDIR)/arch/um/include/skas_ptregs.h : $(src)/util/mk_ptregs
@echo -n ' Generating $@'
@$< > $@.tmp
@if [ -r $@ ] && cmp -s $@ $@.tmp; then \
echo ' (unchanged)'; \
rm -f $@.tmp; \
else \
echo ' (updated)'; \
mv -f $@.tmp $@; \
fi
$(USER_OBJS) : %.o: %.c $(USER_OBJS) : %.o: %.c
$(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $<
all: mk_ptregs hostprogs-y := mk_ptregs
always := $(hostprogs-y)
mk_ptregs : mk_ptregs.o
$(HOSTCC) -o mk_ptregs mk_ptregs.o
mk_ptregs.o : mk_ptregs.c
$(HOSTCC) -c $<
clean-files := mk_ptregs *.o *~
...@@ -44,7 +44,9 @@ int timer_irq_inited = 0; ...@@ -44,7 +44,9 @@ int timer_irq_inited = 0;
static int first_tick; static int first_tick;
static unsigned long long prev_usecs; static unsigned long long prev_usecs;
#ifdef CONFIG_UML_REAL_TIME_CLOCK
static long long delta; /* Deviation per interval */ static long long delta; /* Deviation per interval */
#endif
#define MILLION 1000000 #define MILLION 1000000
...@@ -60,7 +62,7 @@ void timer_irq(union uml_pt_regs *regs) ...@@ -60,7 +62,7 @@ void timer_irq(union uml_pt_regs *regs)
} }
if(first_tick){ if(first_tick){
#if defined(CONFIG_UML_REAL_TIME_CLOCK) #ifdef CONFIG_UML_REAL_TIME_CLOCK
/* We've had 1 tick */ /* We've had 1 tick */
unsigned long long usecs = os_usecs(); unsigned long long usecs = os_usecs();
......
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT(ELF_FORMAT)
OUTPUT_ARCH(ELF_ARCH)
ENTRY(_start)
jiffies = jiffies_64;
SECTIONS
{
#include "asm/common.lds.S"
}
...@@ -8,10 +8,13 @@ USER_OBJS := bugs.o ptrace_user.o sigcontext.o fault.o ...@@ -8,10 +8,13 @@ USER_OBJS := bugs.o ptrace_user.o sigcontext.o fault.o
USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
SYMLINKS = bitops.c semaphore.c highmem.c module.c SYMLINKS = bitops.c semaphore.c highmem.c module.c
SYMLINKS := $(foreach f,$(SYMLINKS),$(src)/$f)
# this needs to be before the foreach, because clean-files does not accept
# complete paths like $(src)/$f.
clean-files := $(SYMLINKS) clean-files := $(SYMLINKS)
SYMLINKS := $(foreach f,$(SYMLINKS),$(src)/$f)
bitops.c-dir = lib bitops.c-dir = lib
semaphore.c-dir = kernel semaphore.c-dir = kernel
highmem.c-dir = mm highmem.c-dir = mm
......
...@@ -6,8 +6,3 @@ mk_thread-objs := mk_thread_kern.o mk_thread_user.o ...@@ -6,8 +6,3 @@ mk_thread-objs := mk_thread_kern.o mk_thread_user.o
HOSTCFLAGS_mk_thread_kern.o := $(CFLAGS) $(CPPFLAGS) HOSTCFLAGS_mk_thread_kern.o := $(CFLAGS) $(CPPFLAGS)
HOSTCFLAGS_mk_thread_user.o := $(USER_CFLAGS) HOSTCFLAGS_mk_thread_user.o := $(USER_CFLAGS)
clean :
$(RM) -f $(build-targets)
archmrproper : clean
...@@ -160,6 +160,7 @@ static struct serio * __init parkbd_allocate_serio(void) ...@@ -160,6 +160,7 @@ static struct serio * __init parkbd_allocate_serio(void)
serio = kmalloc(sizeof(struct serio), GFP_KERNEL); serio = kmalloc(sizeof(struct serio), GFP_KERNEL);
if (serio) { if (serio) {
memset(serio, 0, sizeof(struct serio));
serio->type = parkbd_mode; serio->type = parkbd_mode;
serio->write = parkbd_write, serio->write = parkbd_write,
strlcpy(serio->name, "PARKBD AT/XT keyboard adapter", sizeof(serio->name)); strlcpy(serio->name, "PARKBD AT/XT keyboard adapter", sizeof(serio->name));
......
/* /*
* $Id: lubbock-flash.c,v 1.15 2004/07/12 21:59:44 dwmw2 Exp $ * $Id: lubbock-flash.c,v 1.18 2004/09/28 18:54:40 nico Exp $
* *
* Map driver for the Lubbock developer platform. * Map driver for the Lubbock developer platform.
* *
...@@ -15,11 +15,13 @@ ...@@ -15,11 +15,13 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/dma-mapping.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/map.h> #include <linux/mtd/map.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/arch/pxa-regs.h>
#include <asm/arch/lubbock.h> #include <asm/arch/lubbock.h>
...@@ -82,16 +84,14 @@ static int __init init_lubbock(void) ...@@ -82,16 +84,14 @@ static int __init init_lubbock(void)
lubbock_maps[flashboot].name = "Lubbock Boot ROM"; lubbock_maps[flashboot].name = "Lubbock Boot ROM";
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
lubbock_maps[i].virt = (unsigned long)ioremap(lubbock_maps[i].phys, WINDOW_SIZE); lubbock_maps[i].virt = (void __iomem *)ioremap(lubbock_maps[i].phys, WINDOW_SIZE);
if (!lubbock_maps[i].virt) { if (!lubbock_maps[i].virt) {
printk(KERN_WARNING "Failed to ioremap %s\n", lubbock_maps[i].name); printk(KERN_WARNING "Failed to ioremap %s\n", lubbock_maps[i].name);
if (!ret) if (!ret)
ret = -ENOMEM; ret = -ENOMEM;
continue; continue;
} }
lubbock_maps[i].cached = __ioremap(lubbock_maps[i].phys, lubbock_maps[i].cached = ioremap_cached(lubbock_maps[i].phys, WINDOW_SIZE);
WINDOW_SIZE,
L_PTE_CACHEABLE, 1);
if (!lubbock_maps[i].cached) if (!lubbock_maps[i].cached)
printk(KERN_WARNING "Failed to ioremap cached %s\n", lubbock_maps[i].name); printk(KERN_WARNING "Failed to ioremap cached %s\n", lubbock_maps[i].name);
simple_map_init(&lubbock_maps[i]); simple_map_init(&lubbock_maps[i]);
......
...@@ -373,7 +373,10 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max ...@@ -373,7 +373,10 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max
child->bridge_ctl = bctl; child->bridge_ctl = bctl;
cmax = pci_scan_child_bus(child); cmax = pci_scan_child_bus(child);
if (cmax > max) max = cmax; if (cmax > max)
max = cmax;
if (child->subordinate > max)
max = child->subordinate;
} else { } else {
/* /*
* We need to assign a number to this bus which we always * We need to assign a number to this bus which we always
......
...@@ -1166,7 +1166,7 @@ static struct fb_videomode __devinitdata cyber2000fb_default_mode = { ...@@ -1166,7 +1166,7 @@ static struct fb_videomode __devinitdata cyber2000fb_default_mode = {
.vmode = FB_VMODE_NONINTERLACED .vmode = FB_VMODE_NONINTERLACED
}; };
static char igs_regs[] __devinitdata = { static char igs_regs[] = {
EXT_CRT_IRQ, 0, EXT_CRT_IRQ, 0,
EXT_CRT_TEST, 0, EXT_CRT_TEST, 0,
EXT_SYNC_CTL, 0, EXT_SYNC_CTL, 0,
...@@ -1289,7 +1289,7 @@ cyberpro_alloc_fb_info(unsigned int id, char *name) ...@@ -1289,7 +1289,7 @@ cyberpro_alloc_fb_info(unsigned int id, char *name)
return cfb; return cfb;
} }
static void __devinit static void
cyberpro_free_fb_info(struct cfb_info *cfb) cyberpro_free_fb_info(struct cfb_info *cfb)
{ {
if (cfb) { if (cfb) {
......
...@@ -360,7 +360,11 @@ int proc_pid_stat(struct task_struct *task, char * buffer) ...@@ -360,7 +360,11 @@ int proc_pid_stat(struct task_struct *task, char * buffer)
read_unlock(&tasklist_lock); read_unlock(&tasklist_lock);
/* Temporary variable needed for gcc-2.96 */ /* Temporary variable needed for gcc-2.96 */
start_time = jiffies_64_to_clock_t(task->start_time - INITIAL_JIFFIES); /* convert timespec -> nsec*/
start_time = (unsigned long long)task->start_time.tv_sec * NSEC_PER_SEC
+ task->start_time.tv_nsec;
/* convert nsec -> ticks */
start_time = nsec_to_clock_t(start_time);
res = sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \ res = sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \
%lu %lu %lu %lu %lu %ld %ld %ld %ld %d %ld %llu %lu %ld %lu %lu %lu %lu %lu \ %lu %lu %lu %lu %lu %ld %ld %ld %ld %d %ld %llu %lu %ld %lu %lu %lu %lu %lu \
......
...@@ -818,13 +818,15 @@ xfs_ioctl( ...@@ -818,13 +818,15 @@ xfs_ioctl(
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
freeze_bdev(inode->i_sb->s_bdev); if (inode->i_sb->s_frozen == SB_UNFROZEN)
freeze_bdev(inode->i_sb->s_bdev);
return 0; return 0;
case XFS_IOC_THAW: case XFS_IOC_THAW:
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
thaw_bdev(inode->i_sb->s_bdev, inode->i_sb); if (inode->i_sb->s_frozen != SB_UNFROZEN)
thaw_bdev(inode->i_sb->s_bdev, inode->i_sb);
return 0; return 0;
case XFS_IOC_GOINGDOWN: { case XFS_IOC_GOINGDOWN: {
......
...@@ -339,16 +339,16 @@ linvfs_write_inode( ...@@ -339,16 +339,16 @@ linvfs_write_inode(
int sync) int sync)
{ {
vnode_t *vp = LINVFS_GET_VP(inode); vnode_t *vp = LINVFS_GET_VP(inode);
int error, flags = FLUSH_INODE; int error = 0, flags = FLUSH_INODE;
error = 0;
if (vp) { if (vp) {
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
if (sync) if (sync)
flags |= FLUSH_SYNC; flags |= FLUSH_SYNC;
VOP_IFLUSH(vp, flags, error); VOP_IFLUSH(vp, flags, error);
} }
return error;
return -error;
} }
STATIC void STATIC void
...@@ -491,8 +491,14 @@ xfssyncd( ...@@ -491,8 +491,14 @@ xfssyncd(
break; break;
spin_lock(&vfsp->vfs_sync_lock); spin_lock(&vfsp->vfs_sync_lock);
if (!timeleft) { /*
timeleft = (xfs_syncd_centisecs * HZ) / 100; * We can get woken by laptop mode, to do a sync -
* that's the (only!) case where the list would be
* empty with time remaining.
*/
if (!timeleft || list_empty(&vfsp->vfs_sync_list)) {
if (!timeleft)
timeleft = (xfs_syncd_centisecs * HZ) / 100;
INIT_LIST_HEAD(&vfsp->vfs_sync_work.w_list); INIT_LIST_HEAD(&vfsp->vfs_sync_work.w_list);
list_add_tail(&vfsp->vfs_sync_work.w_list, list_add_tail(&vfsp->vfs_sync_work.w_list,
&vfsp->vfs_sync_list); &vfsp->vfs_sync_list);
...@@ -595,9 +601,10 @@ linvfs_sync_super( ...@@ -595,9 +601,10 @@ linvfs_sync_super(
if (unlikely(laptop_mode)) { if (unlikely(laptop_mode)) {
int prev_sync_seq = vfsp->vfs_sync_seq; int prev_sync_seq = vfsp->vfs_sync_seq;
/* /*
* The disk must be active because we're syncing. * The disk must be active because we're syncing.
* We schedule syncd now (now that the disk is * We schedule xfssyncd now (now that the disk is
* active) instead of later (when it might not be). * active) instead of later (when it might not be).
*/ */
wake_up_process(vfsp->vfs_sync_task); wake_up_process(vfsp->vfs_sync_task);
......
...@@ -216,4 +216,8 @@ extern void bhv_insert_all_vfsops(struct vfs *); ...@@ -216,4 +216,8 @@ extern void bhv_insert_all_vfsops(struct vfs *);
extern void bhv_remove_all_vfsops(struct vfs *, int); extern void bhv_remove_all_vfsops(struct vfs *, int);
extern void bhv_remove_vfsops(struct vfs *, int); extern void bhv_remove_vfsops(struct vfs *, int);
#define fs_frozen(vfsp) ((vfsp)->vfs_super->s_frozen)
#define fs_check_frozen(vfsp, level) \
vfs_check_frozen(vfsp->vfs_super, level);
#endif /* __XFS_VFS_H__ */ #endif /* __XFS_VFS_H__ */
...@@ -590,9 +590,6 @@ xfs_fs_goingdown( ...@@ -590,9 +590,6 @@ xfs_fs_goingdown(
xfs_mount_t *mp, xfs_mount_t *mp,
__uint32_t inflags) __uint32_t inflags)
{ {
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
switch (inflags) { switch (inflags) {
case XFS_FSOP_GOING_FLAGS_DEFAULT: { case XFS_FSOP_GOING_FLAGS_DEFAULT: {
struct vfs *vfsp = XFS_MTOVFS(mp); struct vfs *vfsp = XFS_MTOVFS(mp);
...@@ -602,7 +599,7 @@ xfs_fs_goingdown( ...@@ -602,7 +599,7 @@ xfs_fs_goingdown(
xfs_force_shutdown(mp, XFS_FORCE_UMOUNT); xfs_force_shutdown(mp, XFS_FORCE_UMOUNT);
thaw_bdev(sb->s_bdev, sb); thaw_bdev(sb->s_bdev, sb);
} }
break; break;
} }
case XFS_FSOP_GOING_FLAGS_LOGFLUSH: case XFS_FSOP_GOING_FLAGS_LOGFLUSH:
......
...@@ -811,7 +811,7 @@ xfs_log_need_covered(xfs_mount_t *mp) ...@@ -811,7 +811,7 @@ xfs_log_need_covered(xfs_mount_t *mp)
xlog_t *log = mp->m_log; xlog_t *log = mp->m_log;
vfs_t *vfsp = XFS_MTOVFS(mp); vfs_t *vfsp = XFS_MTOVFS(mp);
if (vfsp->vfs_super->s_frozen || XFS_FORCED_SHUTDOWN(mp) || if (fs_frozen(vfsp) || XFS_FORCED_SHUTDOWN(mp) ||
(vfsp->vfs_flag & VFS_RDONLY)) (vfsp->vfs_flag & VFS_RDONLY))
return 0; return 0;
......
...@@ -131,7 +131,7 @@ xfs_trans_alloc( ...@@ -131,7 +131,7 @@ xfs_trans_alloc(
xfs_mount_t *mp, xfs_mount_t *mp,
uint type) uint type)
{ {
vfs_check_frozen(XFS_MTOVFS(mp)->vfs_super, SB_FREEZE_TRANS); fs_check_frozen(XFS_MTOVFS(mp), SB_FREEZE_TRANS);
atomic_inc(&mp->m_active_trans); atomic_inc(&mp->m_active_trans);
return (_xfs_trans_alloc(mp, type)); return (_xfs_trans_alloc(mp, type));
......
...@@ -13,11 +13,19 @@ ...@@ -13,11 +13,19 @@
* Note: the old pte is known to not be writable, so we don't need to * Note: the old pte is known to not be writable, so we don't need to
* worry about dirty bits etc getting lost. * worry about dirty bits etc getting lost.
*/ */
#ifndef __HAVE_ARCH_SET_PTE_ATOMIC
#define ptep_establish(__vma, __address, __ptep, __entry) \ #define ptep_establish(__vma, __address, __ptep, __entry) \
do { \ do { \
set_pte(__ptep, __entry); \ set_pte(__ptep, __entry); \
flush_tlb_page(__vma, __address); \ flush_tlb_page(__vma, __address); \
} while (0) } while (0)
#else /* __HAVE_ARCH_SET_PTE_ATOMIC */
#define ptep_establish(__vma, __address, __ptep, __entry) \
do { \
set_pte_atomic(__ptep, __entry); \
flush_tlb_page(__vma, __address); \
} while (0)
#endif /* __HAVE_ARCH_SET_PTE_ATOMIC */
#endif #endif
#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
......
...@@ -273,6 +273,8 @@ static __inline__ unsigned long find_next_bit(const unsigned long *addr, ...@@ -273,6 +273,8 @@ static __inline__ unsigned long find_next_bit(const unsigned long *addr,
return result + __ffs(tmp); return result + __ffs(tmp);
} }
#define find_first_bit(addr, size) find_next_bit(addr, size, 0)
/* /*
* Every architecture must define this function. It's the fastest * Every architecture must define this function. It's the fastest
* way of searching a 140-bit bitmap where the first 100 bits are * way of searching a 140-bit bitmap where the first 100 bits are
......
...@@ -54,6 +54,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte) ...@@ -54,6 +54,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
smp_wmb(); smp_wmb();
ptep->pte_low = pte.pte_low; ptep->pte_low = pte.pte_low;
} }
#define __HAVE_ARCH_SET_PTE_ATOMIC
#define set_pte_atomic(pteptr,pteval) \ #define set_pte_atomic(pteptr,pteval) \
set_64bit((unsigned long long *)(pteptr),pte_val(pteval)) set_64bit((unsigned long long *)(pteptr),pte_val(pteval))
#define set_pmd(pmdptr,pmdval) \ #define set_pmd(pmdptr,pmdval) \
......
...@@ -294,25 +294,16 @@ ...@@ -294,25 +294,16 @@
#define __NR_mq_getsetattr (__NR_mq_open+5) #define __NR_mq_getsetattr (__NR_mq_open+5)
#define __NR_sys_kexec_load 283 #define __NR_sys_kexec_load 283
#define __NR_waitid 284 #define __NR_waitid 284
#define __NR_perfctr_info 285
#define __NR_vperfctr_open (__NR_perfctr_info+1)
#define __NR_vperfctr_control (__NR_perfctr_info+2)
#define __NR_vperfctr_unlink (__NR_perfctr_info+3)
#define __NR_vperfctr_iresume (__NR_perfctr_info+4)
#define __NR_vperfctr_read (__NR_perfctr_info+5)
#define __NR_add_key 291
#define __NR_request_key 292
#define __NR_keyctl 293
#define NR_syscalls 294 #define NR_syscalls 285
/* user-visible error numbers are in the range -1 - -128: see /* user-visible error numbers are in the range -1 - -124: see
* <asm-m32r/errno.h> * <asm-m32r/errno.h>
*/ */
#define __syscall_return(type, res) \ #define __syscall_return(type, res) \
do { \ do { \
if ((unsigned long)(res) >= (unsigned long)(-(128 + 1))) { \ if ((unsigned long)(res) >= (unsigned long)(-(124 + 1))) { \
/* Avoid using "res" which is declared to be in register r0; \ /* Avoid using "res" which is declared to be in register r0; \
errno might expand to a function call and clobber it. */ \ errno might expand to a function call and clobber it. */ \
int __err = -(res); \ int __err = -(res); \
......
#ifndef _ASM_DMA_MAPPING_H #ifndef _ASM_DMA_MAPPING_H
#define _ASM_DMA_MAPPING_H #define _ASM_DMA_MAPPING_H
#include <asm/scatterlist.h>
static inline int static inline int
dma_supported(struct device *dev, u64 mask) dma_supported(struct device *dev, u64 mask)
{ {
......
...@@ -8,10 +8,6 @@ ...@@ -8,10 +8,6 @@
#include "asm/current.h" #include "asm/current.h"
#include "linux/cpumask.h" #include "linux/cpumask.h"
extern cpumask_t cpu_online_map;
extern cpumask_t cpu_possible_map;
#define smp_processor_id() (current_thread->cpu) #define smp_processor_id() (current_thread->cpu)
#define cpu_logical_map(n) (n) #define cpu_logical_map(n) (n)
#define cpu_number_map(n) (n) #define cpu_number_map(n) (n)
...@@ -19,8 +15,6 @@ extern cpumask_t cpu_possible_map; ...@@ -19,8 +15,6 @@ extern cpumask_t cpu_possible_map;
extern int hard_smp_processor_id(void); extern int hard_smp_processor_id(void);
#define NO_PROC_ID -1 #define NO_PROC_ID -1
#define cpu_online(cpu) cpu_isset(cpu, cpu_online_map)
extern int ncpus; extern int ncpus;
......
...@@ -172,17 +172,24 @@ static inline u32 jiffies_to_AHZ(unsigned long x) ...@@ -172,17 +172,24 @@ static inline u32 jiffies_to_AHZ(unsigned long x)
#endif #endif
} }
static inline u64 jiffies_64_to_AHZ(u64 x) static inline u64 nsec_to_AHZ(u64 x)
{ {
#if (TICK_NSEC % (NSEC_PER_SEC / AHZ)) == 0 #if (NSEC_PER_SEC % AHZ) == 0
#if HZ != AHZ
do_div(x, HZ / AHZ);
#endif
#else
x *= TICK_NSEC;
do_div(x, (NSEC_PER_SEC / AHZ)); do_div(x, (NSEC_PER_SEC / AHZ));
#elif (AHZ % 512) == 0
x *= AHZ/512;
do_div(x, (NSEC_PER_SEC / 512));
#else
/*
* max relative error 5.7e-8 (1.8s per year) for AHZ <= 1024,
* overflow after 64.99 years.
* exact for AHZ=60, 72, 90, 120, 144, 180, 300, 600, 900, ...
*/
x *= 9;
do_div(x, (unsigned long)((9ull * NSEC_PER_SEC + (AHZ/2))
/ AHZ));
#endif #endif
return x; return x;
} }
#endif /* __KERNEL */ #endif /* __KERNEL */
......
...@@ -40,6 +40,8 @@ static inline void clear_user_highpage(struct page *page, unsigned long vaddr) ...@@ -40,6 +40,8 @@ static inline void clear_user_highpage(struct page *page, unsigned long vaddr)
void *addr = kmap_atomic(page, KM_USER0); void *addr = kmap_atomic(page, KM_USER0);
clear_user_page(addr, vaddr, page); clear_user_page(addr, vaddr, page);
kunmap_atomic(addr, KM_USER0); kunmap_atomic(addr, KM_USER0);
/* Make sure this page is cleared on other CPU's too before using it */
smp_wmb();
} }
static inline void clear_highpage(struct page *page) static inline void clear_highpage(struct page *page)
...@@ -73,6 +75,8 @@ static inline void copy_user_highpage(struct page *to, struct page *from, unsign ...@@ -73,6 +75,8 @@ static inline void copy_user_highpage(struct page *to, struct page *from, unsign
copy_user_page(vto, vfrom, vaddr, to); copy_user_page(vto, vfrom, vaddr, to);
kunmap_atomic(vfrom, KM_USER0); kunmap_atomic(vfrom, KM_USER0);
kunmap_atomic(vto, KM_USER1); kunmap_atomic(vto, KM_USER1);
/* Make sure this page is cleared on other CPU's too before using it */
smp_wmb();
} }
static inline void copy_highpage(struct page *to, struct page *from) static inline void copy_highpage(struct page *to, struct page *from)
......
...@@ -508,7 +508,7 @@ struct task_struct { ...@@ -508,7 +508,7 @@ struct task_struct {
struct timer_list real_timer; struct timer_list real_timer;
unsigned long utime, stime; unsigned long utime, stime;
unsigned long nvcsw, nivcsw; /* context switch counts */ unsigned long nvcsw, nivcsw; /* context switch counts */
u64 start_time; struct timespec start_time;
/* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */ /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */
unsigned long min_flt, maj_flt; unsigned long min_flt, maj_flt;
/* process credentials */ /* process credentials */
......
...@@ -55,6 +55,26 @@ static inline u64 jiffies_64_to_clock_t(u64 x) ...@@ -55,6 +55,26 @@ static inline u64 jiffies_64_to_clock_t(u64 x)
} }
#endif #endif
static inline u64 nsec_to_clock_t(u64 x)
{
#if (NSEC_PER_SEC % USER_HZ) == 0
do_div(x, (NSEC_PER_SEC / USER_HZ));
#elif (USER_HZ % 512) == 0
x *= USER_HZ/512;
do_div(x, (NSEC_PER_SEC / 512));
#else
/*
* max relative error 5.7e-8 (1.8s per year) for USER_HZ <= 1024,
* overflow after 64.99 years.
* exact for HZ=60, 72, 90, 120, 144, 180, 300, 600, 900, ...
*/
x *= 9;
do_div(x, (unsigned long)((9ull * NSEC_PER_SEC + (USER_HZ/2))
/ USER_HZ));
#endif
return x;
}
struct tms { struct tms {
clock_t tms_utime; clock_t tms_utime;
clock_t tms_stime; clock_t tms_stime;
......
...@@ -384,6 +384,8 @@ static void do_acct_process(long exitcode, struct file *file) ...@@ -384,6 +384,8 @@ static void do_acct_process(long exitcode, struct file *file)
unsigned long vsize; unsigned long vsize;
unsigned long flim; unsigned long flim;
u64 elapsed; u64 elapsed;
u64 run_time;
struct timespec uptime;
/* /*
* First check to see if there is enough free_space to continue * First check to see if there is enough free_space to continue
...@@ -401,7 +403,13 @@ static void do_acct_process(long exitcode, struct file *file) ...@@ -401,7 +403,13 @@ static void do_acct_process(long exitcode, struct file *file)
ac.ac_version = ACCT_VERSION | ACCT_BYTEORDER; ac.ac_version = ACCT_VERSION | ACCT_BYTEORDER;
strlcpy(ac.ac_comm, current->comm, sizeof(ac.ac_comm)); strlcpy(ac.ac_comm, current->comm, sizeof(ac.ac_comm));
elapsed = jiffies_64_to_AHZ(get_jiffies_64() - current->start_time); /* calculate run_time in nsec*/
do_posix_clock_monotonic_gettime(&uptime);
run_time = (u64)uptime.tv_sec*NSEC_PER_SEC + uptime.tv_nsec;
run_time -= (u64)current->start_time.tv_sec*NSEC_PER_SEC
+ current->start_time.tv_nsec;
/* convert nsec -> AHZ */
elapsed = nsec_to_AHZ(run_time);
#if ACCT_VERSION==3 #if ACCT_VERSION==3
ac.ac_etime = encode_float(elapsed); ac.ac_etime = encode_float(elapsed);
#else #else
......
...@@ -992,7 +992,7 @@ static task_t *copy_process(unsigned long clone_flags, ...@@ -992,7 +992,7 @@ static task_t *copy_process(unsigned long clone_flags,
p->utime = p->stime = 0; p->utime = p->stime = 0;
p->lock_depth = -1; /* -1 = no lock */ p->lock_depth = -1; /* -1 = no lock */
p->start_time = get_jiffies_64(); do_posix_clock_monotonic_gettime(&p->start_time);
p->security = NULL; p->security = NULL;
p->io_context = NULL; p->io_context = NULL;
p->io_wait = NULL; p->io_wait = NULL;
...@@ -1146,7 +1146,8 @@ static task_t *copy_process(unsigned long clone_flags, ...@@ -1146,7 +1146,8 @@ static task_t *copy_process(unsigned long clone_flags,
bad_fork_cleanup_namespace: bad_fork_cleanup_namespace:
exit_namespace(p); exit_namespace(p);
bad_fork_cleanup_mm: bad_fork_cleanup_mm:
mmput(p->mm); if (p->mm)
mmput(p->mm);
bad_fork_cleanup_signal: bad_fork_cleanup_signal:
exit_signal(p); exit_signal(p);
bad_fork_cleanup_sighand: bad_fork_cleanup_sighand:
......
...@@ -219,11 +219,6 @@ static __init int init_posix_timers(void) ...@@ -219,11 +219,6 @@ static __init int init_posix_timers(void)
.clock_set = do_posix_clock_monotonic_settime .clock_set = do_posix_clock_monotonic_settime
}; };
#ifdef CONFIG_TIME_INTERPOLATION
/* Clocks are more accurate with time interpolators */
clock_realtime.res = clock_monotonic.res = time_interpolator_resolution();
#endif
register_posix_clock(CLOCK_REALTIME, &clock_realtime); register_posix_clock(CLOCK_REALTIME, &clock_realtime);
register_posix_clock(CLOCK_MONOTONIC, &clock_monotonic); register_posix_clock(CLOCK_MONOTONIC, &clock_monotonic);
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
/** /**
* oom_badness - calculate a numeric value for how bad this task has been * oom_badness - calculate a numeric value for how bad this task has been
* @p: task struct of which task we should calculate * @p: task struct of which task we should calculate
* @p: current uptime in seconds
* *
* The formula used is relatively simple and documented inline in the * The formula used is relatively simple and documented inline in the
* function. The main rationale is that we want to select a good task * function. The main rationale is that we want to select a good task
...@@ -41,7 +42,7 @@ ...@@ -41,7 +42,7 @@
* of least surprise ... (be careful when you change it) * of least surprise ... (be careful when you change it)
*/ */
static unsigned long badness(struct task_struct *p) static unsigned long badness(struct task_struct *p, unsigned long uptime)
{ {
unsigned long points, cpu_time, run_time, s; unsigned long points, cpu_time, run_time, s;
...@@ -56,12 +57,16 @@ static unsigned long badness(struct task_struct *p) ...@@ -56,12 +57,16 @@ static unsigned long badness(struct task_struct *p)
points = p->mm->total_vm; points = p->mm->total_vm;
/* /*
* CPU time is in seconds and run time is in minutes. There is no * CPU time is in tens of seconds and run time is in thousands
* particular reason for this other than that it turned out to work * of seconds. There is no particular reason for this other than
* very well in practice. * that it turned out to work very well in practice.
*/ */
cpu_time = (p->utime + p->stime) >> (SHIFT_HZ + 3); cpu_time = (p->utime + p->stime) >> (SHIFT_HZ + 3);
run_time = (get_jiffies_64() - p->start_time) >> (SHIFT_HZ + 10);
if (uptime >= p->start_time.tv_sec)
run_time = (uptime - p->start_time.tv_sec) >> 10;
else
run_time = 0;
s = int_sqrt(cpu_time); s = int_sqrt(cpu_time);
if (s) if (s)
...@@ -111,10 +116,12 @@ static struct task_struct * select_bad_process(void) ...@@ -111,10 +116,12 @@ static struct task_struct * select_bad_process(void)
unsigned long maxpoints = 0; unsigned long maxpoints = 0;
struct task_struct *g, *p; struct task_struct *g, *p;
struct task_struct *chosen = NULL; struct task_struct *chosen = NULL;
struct timespec uptime;
do_posix_clock_monotonic_gettime(&uptime);
do_each_thread(g, p) do_each_thread(g, p)
if (p->pid) { if (p->pid) {
unsigned long points = badness(p); unsigned long points = badness(p, uptime.tv_sec);
if (points > maxpoints) { if (points > maxpoints) {
chosen = p; chosen = p;
maxpoints = points; maxpoints = points;
......
...@@ -153,11 +153,9 @@ get_dirty_limits(struct writeback_state *wbs, long *pbackground, long *pdirty) ...@@ -153,11 +153,9 @@ get_dirty_limits(struct writeback_state *wbs, long *pbackground, long *pdirty)
if (dirty_ratio < 5) if (dirty_ratio < 5)
dirty_ratio = 5; dirty_ratio = 5;
/* background_ratio = dirty_background_ratio;
* Keep the ratio between dirty_ratio and background_ratio roughly if (background_ratio >= dirty_ratio)
* what the sysctls are after dirty_ratio has been scaled (above). background_ratio = dirty_ratio / 2;
*/
background_ratio = dirty_background_ratio * dirty_ratio/vm_dirty_ratio;
background = (background_ratio * total_pages) / 100; background = (background_ratio * total_pages) / 100;
dirty = (dirty_ratio * total_pages) / 100; dirty = (dirty_ratio * total_pages) / 100;
......
...@@ -183,7 +183,7 @@ auth_domain_lookup(struct auth_domain *item, int set) ...@@ -183,7 +183,7 @@ auth_domain_lookup(struct auth_domain *item, int set)
} }
/* Didn't find anything */ /* Didn't find anything */
if (!set) if (!set)
goto out_noset; goto out_nada;
auth_domain_cache.entries++; auth_domain_cache.entries++;
out_set: out_set:
set_bit(CACHE_HASHED, &item->h.flags); set_bit(CACHE_HASHED, &item->h.flags);
...@@ -193,6 +193,8 @@ auth_domain_lookup(struct auth_domain *item, int set) ...@@ -193,6 +193,8 @@ auth_domain_lookup(struct auth_domain *item, int set)
cache_fresh(&auth_domain_cache, &item->h, item->h.expiry_time); cache_fresh(&auth_domain_cache, &item->h, item->h.expiry_time);
cache_get(&item->h); cache_get(&item->h);
return item; return item;
out_nada:
tmp = NULL;
out_noset: out_noset:
read_unlock(&auth_domain_cache.hash_lock); read_unlock(&auth_domain_cache.hash_lock);
return tmp; return tmp;
......
...@@ -2466,21 +2466,14 @@ static int selinux_file_ioctl(struct file *file, unsigned int cmd, ...@@ -2466,21 +2466,14 @@ static int selinux_file_ioctl(struct file *file, unsigned int cmd,
return error; return error;
} }
static int selinux_file_mmap(struct file *file, unsigned long prot, unsigned long flags) static int file_map_prot_check(struct file *file, unsigned long prot, int shared)
{ {
u32 av;
int rc;
rc = secondary_ops->file_mmap(file, prot, flags);
if (rc)
return rc;
if (file) { if (file) {
/* read access is always possible with a mapping */ /* read access is always possible with a mapping */
av = FILE__READ; u32 av = FILE__READ;
/* write access only matters if the mapping is shared */ /* write access only matters if the mapping is shared */
if ((flags & MAP_TYPE) == MAP_SHARED && (prot & PROT_WRITE)) if (shared && (prot & PROT_WRITE))
av |= FILE__WRITE; av |= FILE__WRITE;
if (prot & PROT_EXEC) if (prot & PROT_EXEC)
...@@ -2491,6 +2484,18 @@ static int selinux_file_mmap(struct file *file, unsigned long prot, unsigned lon ...@@ -2491,6 +2484,18 @@ static int selinux_file_mmap(struct file *file, unsigned long prot, unsigned lon
return 0; return 0;
} }
static int selinux_file_mmap(struct file *file, unsigned long prot, unsigned long flags)
{
int rc;
rc = secondary_ops->file_mmap(file, prot, flags);
if (rc)
return rc;
return file_map_prot_check(file, prot,
(flags & MAP_TYPE) == MAP_SHARED);
}
static int selinux_file_mprotect(struct vm_area_struct *vma, static int selinux_file_mprotect(struct vm_area_struct *vma,
unsigned long prot) unsigned long prot)
{ {
...@@ -2500,7 +2505,7 @@ static int selinux_file_mprotect(struct vm_area_struct *vma, ...@@ -2500,7 +2505,7 @@ static int selinux_file_mprotect(struct vm_area_struct *vma,
if (rc) if (rc)
return rc; return rc;
return selinux_file_mmap(vma->vm_file, prot, vma->vm_flags); return file_map_prot_check(vma->vm_file, prot, vma->vm_flags&VM_SHARED);
} }
static int selinux_file_lock(struct file *file, unsigned int cmd) static int selinux_file_lock(struct file *file, unsigned int cmd)
...@@ -2625,6 +2630,11 @@ static int selinux_task_alloc_security(struct task_struct *tsk) ...@@ -2625,6 +2630,11 @@ static int selinux_task_alloc_security(struct task_struct *tsk)
tsec2->exec_sid = tsec1->exec_sid; tsec2->exec_sid = tsec1->exec_sid;
tsec2->create_sid = tsec1->create_sid; tsec2->create_sid = tsec1->create_sid;
/* Retain ptracer SID across fork, if any.
This will be reset by the ptrace hook upon any
subsequent ptrace_attach operations. */
tsec2->ptrace_sid = tsec1->ptrace_sid;
return 0; return 0;
} }
......
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