Commit 4c9e1385 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

uml: style fixes pass 1

Formatting changes in the files which have been changed in the
tt-removal patchset so far.  These include:
	copyright updates
	header file trimming
	style fixes
	adding severity to printks
	indenting Kconfig help according to the predominant kernel style

These changes should be entirely non-functional.
Signed-off-by: default avatarJeff Dike <jdike@linux.intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c28b59d4
This diff is collapsed.
This diff is collapsed.
...@@ -6,27 +6,27 @@ config GPROF ...@@ -6,27 +6,27 @@ config GPROF
bool "Enable gprof support" bool "Enable gprof support"
depends on DEBUG_INFO depends on DEBUG_INFO
help help
This allows profiling of a User-Mode Linux kernel with the gprof This allows profiling of a User-Mode Linux kernel with the gprof
utility. utility.
See <http://user-mode-linux.sourceforge.net/gprof.html> for more See <http://user-mode-linux.sourceforge.net/gprof.html> for more
details. details.
If you're involved in UML kernel development and want to use gprof, If you're involved in UML kernel development and want to use gprof,
say Y. If you're unsure, say N. say Y. If you're unsure, say N.
config GCOV config GCOV
bool "Enable gcov support" bool "Enable gcov support"
depends on DEBUG_INFO depends on DEBUG_INFO
help help
This option allows developers to retrieve coverage data from a UML This option allows developers to retrieve coverage data from a UML
session. session.
See <http://user-mode-linux.sourceforge.net/gprof.html> for more See <http://user-mode-linux.sourceforge.net/gprof.html> for more
details. details.
If you're involved in UML kernel development and want to use gcov, If you're involved in UML kernel development and want to use gcov,
say Y. If you're unsure, say N. say Y. If you're unsure, say N.
config DEBUG_STACK_USAGE config DEBUG_STACK_USAGE
bool "Stack utilization instrumentation" bool "Stack utilization instrumentation"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# This file is included by the global makefile so that you can add your own # This file is included by the global makefile so that you can add your own
# architecture-specific flags and dependencies. # architecture-specific flags and dependencies.
# #
# Copyright (C) 2002 Jeff Dike (jdike@karaya.com) # Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
# Licensed under the GPL # Licensed under the GPL
# #
...@@ -124,7 +124,7 @@ endif ...@@ -124,7 +124,7 @@ endif
CPPFLAGS_vmlinux.lds = -U$(SUBARCH) -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \ CPPFLAGS_vmlinux.lds = -U$(SUBARCH) -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \
-DELF_FORMAT="$(ELF_FORMAT)" -DKERNEL_STACK_SIZE=$(STACK_SIZE) -DELF_FORMAT="$(ELF_FORMAT)" -DKERNEL_STACK_SIZE=$(STACK_SIZE)
#The wrappers will select whether using "malloc" or the kernel allocator. # The wrappers will select whether using "malloc" or the kernel allocator.
LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS)
...@@ -137,8 +137,8 @@ define cmd_vmlinux__ ...@@ -137,8 +137,8 @@ define cmd_vmlinux__
FORCE ,$^) ; rm -f linux FORCE ,$^) ; rm -f linux
endef endef
#When cleaning we don't include .config, so we don't include # When cleaning we don't include .config, so we don't include
#TT or skas makefiles and don't clean skas_ptregs.h. # TT or skas makefiles and don't clean skas_ptregs.h.
CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \ CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \
$(ARCH_DIR)/include/user_constants.h \ $(ARCH_DIR)/include/user_constants.h \
$(ARCH_DIR)/include/kern_constants.h $(ARCH_DIR)/Kconfig.arch $(ARCH_DIR)/include/kern_constants.h $(ARCH_DIR)/Kconfig.arch
......
/* /*
* Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL * Licensed under the GPL
*/ */
...@@ -37,13 +37,3 @@ extern unsigned long *sc_sigmask(void *sc_ptr); ...@@ -37,13 +37,3 @@ extern unsigned long *sc_sigmask(void *sc_ptr);
extern int sc_get_fpregs(unsigned long buf, void *sc_ptr); extern int sc_get_fpregs(unsigned long buf, void *sc_ptr);
#endif #endif
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
* adjust the settings for this buffer only. This must remain at the end
* of the file.
* ---------------------------------------------------------------------------
* Local variables:
* c-file-style: "linux"
* End:
*/
# #
# Copyright (C) 2002 Jeff Dike (jdike@karaya.com) # Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux,intel}.com)
# Licensed under the GPL # Licensed under the GPL
# #
......
...@@ -3,16 +3,12 @@ ...@@ -3,16 +3,12 @@
* Licensed under the GPL * Licensed under the GPL
*/ */
#include "linux/mm.h"
#include "linux/fs.h"
#include "linux/module.h"
#include "linux/sched.h" #include "linux/sched.h"
#include "linux/init_task.h" #include "linux/init_task.h"
#include "linux/fs.h"
#include "linux/module.h"
#include "linux/mqueue.h" #include "linux/mqueue.h"
#include "asm/uaccess.h" #include "asm/uaccess.h"
#include "asm/pgtable.h"
#include "mem_user.h"
#include "os.h"
static struct fs_struct init_fs = INIT_FS; static struct fs_struct init_fs = INIT_FS;
struct mm_struct init_mm = INIT_MM(init_mm); struct mm_struct init_mm = INIT_MM(init_mm);
......
/* /*
* Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL * Licensed under the GPL
*/ */
...@@ -56,12 +56,12 @@ void smp_send_stop(void) ...@@ -56,12 +56,12 @@ void smp_send_stop(void)
int i; int i;
printk(KERN_INFO "Stopping all CPUs..."); printk(KERN_INFO "Stopping all CPUs...");
for(i = 0; i < num_online_cpus(); i++){ for (i = 0; i < num_online_cpus(); i++) {
if(i == current_thread->cpu) if (i == current_thread->cpu)
continue; continue;
os_write_file(cpu_data[i].ipi_pipe[1], "S", 1); os_write_file(cpu_data[i].ipi_pipe[1], "S", 1);
} }
printk("done\n"); printk(KERN_INFO "done\n");
} }
static cpumask_t smp_commenced_mask = CPU_MASK_NONE; static cpumask_t smp_commenced_mask = CPU_MASK_NONE;
...@@ -72,7 +72,7 @@ static int idle_proc(void *cpup) ...@@ -72,7 +72,7 @@ static int idle_proc(void *cpup)
int cpu = (int) cpup, err; int cpu = (int) cpup, err;
err = os_pipe(cpu_data[cpu].ipi_pipe, 1, 1); err = os_pipe(cpu_data[cpu].ipi_pipe, 1, 1);
if(err < 0) if (err < 0)
panic("CPU#%d failed to create IPI pipe, err = %d", cpu, -err); panic("CPU#%d failed to create IPI pipe, err = %d", cpu, -err);
os_set_fd_async(cpu_data[cpu].ipi_pipe[0], os_set_fd_async(cpu_data[cpu].ipi_pipe[0],
...@@ -80,7 +80,7 @@ static int idle_proc(void *cpup) ...@@ -80,7 +80,7 @@ static int idle_proc(void *cpup)
wmb(); wmb();
if (cpu_test_and_set(cpu, cpu_callin_map)) { if (cpu_test_and_set(cpu, cpu_callin_map)) {
printk("huh, CPU#%d already present??\n", cpu); printk(KERN_ERR "huh, CPU#%d already present??\n", cpu);
BUG(); BUG();
} }
...@@ -99,7 +99,7 @@ static struct task_struct *idle_thread(int cpu) ...@@ -99,7 +99,7 @@ static struct task_struct *idle_thread(int cpu)
current->thread.request.u.thread.proc = idle_proc; current->thread.request.u.thread.proc = idle_proc;
current->thread.request.u.thread.arg = (void *) cpu; current->thread.request.u.thread.arg = (void *) cpu;
new_task = fork_idle(cpu); new_task = fork_idle(cpu);
if(IS_ERR(new_task)) if (IS_ERR(new_task))
panic("copy_process failed in idle_thread, error = %ld", panic("copy_process failed in idle_thread, error = %ld",
PTR_ERR(new_task)); PTR_ERR(new_task));
...@@ -126,14 +126,14 @@ void smp_prepare_cpus(unsigned int maxcpus) ...@@ -126,14 +126,14 @@ void smp_prepare_cpus(unsigned int maxcpus)
cpu_set(me, cpu_callin_map); cpu_set(me, cpu_callin_map);
err = os_pipe(cpu_data[me].ipi_pipe, 1, 1); err = os_pipe(cpu_data[me].ipi_pipe, 1, 1);
if(err < 0) if (err < 0)
panic("CPU#0 failed to create IPI pipe, errno = %d", -err); panic("CPU#0 failed to create IPI pipe, errno = %d", -err);
os_set_fd_async(cpu_data[me].ipi_pipe[0], os_set_fd_async(cpu_data[me].ipi_pipe[0],
current->thread.mode.tt.extern_pid); current->thread.mode.tt.extern_pid);
for(cpu = 1; cpu < ncpus; cpu++){ for (cpu = 1; cpu < ncpus; cpu++) {
printk("Booting processor %d...\n", cpu); printk(KERN_INFO "Booting processor %d...\n", cpu);
idle = idle_thread(cpu); idle = idle_thread(cpu);
...@@ -144,8 +144,8 @@ void smp_prepare_cpus(unsigned int maxcpus) ...@@ -144,8 +144,8 @@ void smp_prepare_cpus(unsigned int maxcpus)
cpu_relax(); cpu_relax();
if (cpu_isset(cpu, cpu_callin_map)) if (cpu_isset(cpu, cpu_callin_map))
printk("done\n"); printk(KERN_INFO "done\n");
else printk("failed\n"); else printk(KERN_INFO "failed\n");
} }
} }
...@@ -187,13 +187,14 @@ void IPI_handler(int cpu) ...@@ -187,13 +187,14 @@ void IPI_handler(int cpu)
break; break;
case 'S': case 'S':
printk("CPU#%d stopping\n", cpu); printk(KERN_INFO "CPU#%d stopping\n", cpu);
while(1) while (1)
pause(); pause();
break; break;
default: default:
printk("CPU#%d received unknown IPI [%c]!\n", cpu, c); printk(KERN_ERR "CPU#%d received unknown IPI [%c]!\n",
cpu, c);
break; break;
} }
} }
......
/* /*
* Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL * Licensed under the GPL
*/ */
#include "linux/kernel.h" #include <linux/mm.h>
#include "asm/errno.h" #include <linux/sched.h>
#include "linux/sched.h" #include <linux/hardirq.h>
#include "linux/mm.h" #include <asm/current.h>
#include "linux/spinlock.h" #include <asm/pgtable.h>
#include "linux/init.h" #include <asm/tlbflush.h>
#include "linux/ptrace.h"
#include "asm/semaphore.h"
#include "asm/pgtable.h"
#include "asm/pgalloc.h"
#include "asm/tlbflush.h"
#include "asm/a.out.h"
#include "asm/current.h"
#include "asm/irq.h"
#include "sysdep/sigcontext.h"
#include "kern_util.h"
#include "as-layout.h"
#include "arch.h" #include "arch.h"
#include "kern.h" #include "as-layout.h"
#include "chan_kern.h" #include "kern_util.h"
#include "mconsole_kern.h"
#include "mem.h"
#include "mem_kern.h"
#include "sysdep/sigcontext.h"
#include "sysdep/ptrace.h"
#include "os.h"
#include "skas.h"
#include "os.h" #include "os.h"
#include "sysdep/sigcontext.h"
/* Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by segv(). */ /*
* Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by
* segv().
*/
int handle_page_fault(unsigned long address, unsigned long ip, int handle_page_fault(unsigned long address, unsigned long ip,
int is_write, int is_user, int *code_out) int is_write, int is_user, int *code_out)
{ {
...@@ -46,31 +32,33 @@ int handle_page_fault(unsigned long address, unsigned long ip, ...@@ -46,31 +32,33 @@ int handle_page_fault(unsigned long address, unsigned long ip,
*code_out = SEGV_MAPERR; *code_out = SEGV_MAPERR;
/* If the fault was during atomic operation, don't take the fault, just /*
* fail. */ * If the fault was during atomic operation, don't take the fault, just
* fail.
*/
if (in_atomic()) if (in_atomic())
goto out_nosemaphore; goto out_nosemaphore;
down_read(&mm->mmap_sem); down_read(&mm->mmap_sem);
vma = find_vma(mm, address); vma = find_vma(mm, address);
if(!vma) if (!vma)
goto out; goto out;
else if(vma->vm_start <= address) else if (vma->vm_start <= address)
goto good_area; goto good_area;
else if(!(vma->vm_flags & VM_GROWSDOWN)) else if (!(vma->vm_flags & VM_GROWSDOWN))
goto out; goto out;
else if(is_user && !ARCH_IS_STACKGROW(address)) else if (is_user && !ARCH_IS_STACKGROW(address))
goto out; goto out;
else if(expand_stack(vma, address)) else if (expand_stack(vma, address))
goto out; goto out;
good_area: good_area:
*code_out = SEGV_ACCERR; *code_out = SEGV_ACCERR;
if(is_write && !(vma->vm_flags & VM_WRITE)) if (is_write && !(vma->vm_flags & VM_WRITE))
goto out; goto out;
/* Don't require VM_READ|VM_EXEC for write faults! */ /* Don't require VM_READ|VM_EXEC for write faults! */
if(!is_write && !(vma->vm_flags & (VM_READ | VM_EXEC))) if (!is_write && !(vma->vm_flags & (VM_READ | VM_EXEC)))
goto out; goto out;
do { do {
...@@ -96,9 +84,10 @@ int handle_page_fault(unsigned long address, unsigned long ip, ...@@ -96,9 +84,10 @@ int handle_page_fault(unsigned long address, unsigned long ip,
pud = pud_offset(pgd, address); pud = pud_offset(pgd, address);
pmd = pmd_offset(pud, address); pmd = pmd_offset(pud, address);
pte = pte_offset_kernel(pmd, address); pte = pte_offset_kernel(pmd, address);
} while(!pte_present(*pte)); } while (!pte_present(*pte));
err = 0; err = 0;
/* The below warning was added in place of /*
* The below warning was added in place of
* pte_mkyoung(); if (is_write) pte_mkdirty(); * pte_mkyoung(); if (is_write) pte_mkdirty();
* If it's triggered, we'd see normally a hang here (a clean pte is * If it's triggered, we'd see normally a hang here (a clean pte is
* marked read-only to emulate the dirty bit). * marked read-only to emulate the dirty bit).
...@@ -112,7 +101,7 @@ int handle_page_fault(unsigned long address, unsigned long ip, ...@@ -112,7 +101,7 @@ int handle_page_fault(unsigned long address, unsigned long ip,
out: out:
up_read(&mm->mmap_sem); up_read(&mm->mmap_sem);
out_nosemaphore: out_nosemaphore:
return(err); return err;
/* /*
* We ran out of memory, or some other thing happened to us that made * We ran out of memory, or some other thing happened to us that made
...@@ -143,7 +132,7 @@ static void segv_handler(int sig, union uml_pt_regs *regs) ...@@ -143,7 +132,7 @@ static void segv_handler(int sig, union uml_pt_regs *regs)
{ {
struct faultinfo * fi = UPT_FAULTINFO(regs); struct faultinfo * fi = UPT_FAULTINFO(regs);
if(UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)){ if (UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)) {
bad_segv(*fi, UPT_IP(regs)); bad_segv(*fi, UPT_IP(regs));
return; return;
} }
...@@ -165,37 +154,41 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, ...@@ -165,37 +154,41 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
int is_write = FAULT_WRITE(fi); int is_write = FAULT_WRITE(fi);
unsigned long address = FAULT_ADDRESS(fi); unsigned long address = FAULT_ADDRESS(fi);
if(!is_user && (address >= start_vm) && (address < end_vm)){ if (!is_user && (address >= start_vm) && (address < end_vm)) {
flush_tlb_kernel_vm(); flush_tlb_kernel_vm();
return 0; return 0;
} }
else if(current->mm == NULL) { else if (current->mm == NULL) {
show_regs(container_of(regs, struct pt_regs, regs)); show_regs(container_of(regs, struct pt_regs, regs));
panic("Segfault with no mm"); panic("Segfault with no mm");
} }
if (SEGV_IS_FIXABLE(&fi) || SEGV_MAYBE_FIXABLE(&fi)) if (SEGV_IS_FIXABLE(&fi) || SEGV_MAYBE_FIXABLE(&fi))
err = handle_page_fault(address, ip, is_write, is_user, &si.si_code); err = handle_page_fault(address, ip, is_write, is_user,
&si.si_code);
else { else {
err = -EFAULT; err = -EFAULT;
/* A thread accessed NULL, we get a fault, but CR2 is invalid. /*
* This code is used in __do_copy_from_user() of TT mode. */ * A thread accessed NULL, we get a fault, but CR2 is invalid.
* This code is used in __do_copy_from_user() of TT mode.
* XXX tt mode is gone, so maybe this isn't needed any more
*/
address = 0; address = 0;
} }
catcher = current->thread.fault_catcher; catcher = current->thread.fault_catcher;
if(!err) if (!err)
return 0; return 0;
else if(catcher != NULL){ else if (catcher != NULL) {
current->thread.fault_addr = (void *) address; current->thread.fault_addr = (void *) address;
do_longjmp(catcher, 1); do_longjmp(catcher, 1);
} }
else if(current->thread.fault_addr != NULL) else if (current->thread.fault_addr != NULL)
panic("fault_addr set but no fault catcher"); panic("fault_addr set but no fault catcher");
else if(!is_user && arch_fixup(ip, regs)) else if (!is_user && arch_fixup(ip, regs))
return 0; return 0;
if(!is_user) { if (!is_user) {
show_regs(container_of(regs, struct pt_regs, regs)); show_regs(container_of(regs, struct pt_regs, regs));
panic("Kernel mode fault at addr 0x%lx, ip 0x%lx", panic("Kernel mode fault at addr 0x%lx, ip 0x%lx",
address, ip); address, ip);
...@@ -209,7 +202,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, ...@@ -209,7 +202,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
current->thread.arch.faultinfo = fi; current->thread.arch.faultinfo = fi;
force_sig_info(SIGBUS, &si, current); force_sig_info(SIGBUS, &si, current);
} else if (err == -ENOMEM) { } else if (err == -ENOMEM) {
printk("VM: killing process %s\n", current->comm); printk(KERN_INFO "VM: killing process %s\n", current->comm);
do_exit(SIGKILL); do_exit(SIGKILL);
} else { } else {
BUG_ON(err != -EFAULT); BUG_ON(err != -EFAULT);
...@@ -223,13 +216,13 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, ...@@ -223,13 +216,13 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
void relay_signal(int sig, union uml_pt_regs *regs) void relay_signal(int sig, union uml_pt_regs *regs)
{ {
if(arch_handle_signal(sig, regs)) if (arch_handle_signal(sig, regs))
return; return;
if(!UPT_IS_USER(regs)){ if (!UPT_IS_USER(regs)) {
if(sig == SIGBUS) if (sig == SIGBUS)
printk("Bus error - the host /dev/shm or /tmp mount " printk(KERN_ERR "Bus error - the host /dev/shm or /tmp "
"likely just ran out of space\n"); "mount likely just ran out of space\n");
panic("Kernel mode signal %d", sig); panic("Kernel mode signal %d", sig);
} }
...@@ -239,7 +232,7 @@ void relay_signal(int sig, union uml_pt_regs *regs) ...@@ -239,7 +232,7 @@ void relay_signal(int sig, union uml_pt_regs *regs)
static void bus_handler(int sig, union uml_pt_regs *regs) static void bus_handler(int sig, union uml_pt_regs *regs)
{ {
if(current->thread.fault_catcher != NULL) if (current->thread.fault_catcher != NULL)
do_longjmp(current->thread.fault_catcher, 1); do_longjmp(current->thread.fault_catcher, 1);
else relay_signal(sig, regs); else relay_signal(sig, regs);
} }
......
# #
# Copyright (C) 2000 Jeff Dike (jdike@karaya.com) # Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
# Licensed under the GPL # Licensed under the GPL
# #
......
# #
# Copyright (C) 2000 Jeff Dike (jdike@karaya.com) # Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
# Licensed under the GPL # Licensed under the GPL
# #
......
/* /*
* Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) * Copyright (C) 2000 - 2007 Jeff Dike (jdike{addtoit,linux.intel}.com)
* Licensed under the GPL * Licensed under the GPL
*/ */
#include <stdio.h> #include <stddef.h>
#include <stdlib.h> #include <errno.h>
#include <unistd.h> #include <signal.h>
#include <time.h> #include <time.h>
#include <sys/time.h> #include <sys/time.h>
#include <signal.h>
#include <errno.h>
#include "kern_util.h" #include "kern_util.h"
#include "user.h"
#include "process.h"
#include "kern_constants.h" #include "kern_constants.h"
#include "os.h" #include "os.h"
#include "uml-config.h" #include "user.h"
int set_interval(int is_virtual) int set_interval(int is_virtual)
{ {
...@@ -24,7 +20,7 @@ int set_interval(int is_virtual) ...@@ -24,7 +20,7 @@ int set_interval(int is_virtual)
struct itimerval interval = ((struct itimerval) { { 0, usec }, struct itimerval interval = ((struct itimerval) { { 0, usec },
{ 0, usec } }); { 0, usec } });
if(setitimer(timer_type, &interval, NULL) == -1) if (setitimer(timer_type, &interval, NULL) == -1)
return -errno; return -errno;
return 0; return 0;
...@@ -33,10 +29,12 @@ int set_interval(int is_virtual) ...@@ -33,10 +29,12 @@ int set_interval(int is_virtual)
void disable_timer(void) void disable_timer(void)
{ {
struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }}); struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }});
if((setitimer(ITIMER_VIRTUAL, &disable, NULL) < 0) ||
(setitimer(ITIMER_REAL, &disable, NULL) < 0)) if ((setitimer(ITIMER_VIRTUAL, &disable, NULL) < 0) ||
printk("disnable_timer - setitimer failed, errno = %d\n", (setitimer(ITIMER_REAL, &disable, NULL) < 0))
errno); printk(UM_KERN_ERR "disable_timer - setitimer failed, "
"errno = %d\n", errno);
/* If there are signals already queued, after unblocking ignore them */ /* If there are signals already queued, after unblocking ignore them */
signal(SIGALRM, SIG_IGN); signal(SIGALRM, SIG_IGN);
signal(SIGVTALRM, SIG_IGN); signal(SIGVTALRM, SIG_IGN);
...@@ -49,7 +47,7 @@ void switch_timers(int to_real) ...@@ -49,7 +47,7 @@ void switch_timers(int to_real)
{ 0, 1000000/hz() }}); { 0, 1000000/hz() }});
int old, new; int old, new;
if(to_real){ if (to_real) {
old = ITIMER_VIRTUAL; old = ITIMER_VIRTUAL;
new = ITIMER_REAL; new = ITIMER_REAL;
} }
...@@ -58,10 +56,10 @@ void switch_timers(int to_real) ...@@ -58,10 +56,10 @@ void switch_timers(int to_real)
new = ITIMER_VIRTUAL; new = ITIMER_VIRTUAL;
} }
if((setitimer(old, &disable, NULL) < 0) || if ((setitimer(old, &disable, NULL) < 0) ||
(setitimer(new, &enable, NULL))) (setitimer(new, &enable, NULL)))
printk("switch_timers - setitimer failed, errno = %d\n", printk(UM_KERN_ERR "switch_timers - setitimer failed, "
errno); "errno = %d\n", errno);
} }
unsigned long long os_nsecs(void) unsigned long long os_nsecs(void)
...@@ -69,7 +67,7 @@ unsigned long long os_nsecs(void) ...@@ -69,7 +67,7 @@ unsigned long long os_nsecs(void)
struct timeval tv; struct timeval tv;
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
return((unsigned long long) tv.tv_sec * BILLION + tv.tv_usec * 1000); return (unsigned long long) tv.tv_sec * BILLION + tv.tv_usec * 1000;
} }
void idle_sleep(int secs) void idle_sleep(int secs)
......
#include <errno.h> #include <errno.h>
#include <unistd.h>
#include <sys/ptrace.h> #include <sys/ptrace.h>
#include <sys/syscall.h>
#include <asm/ldt.h>
#include "sysdep/tls.h" #include "sysdep/tls.h"
#include "uml-config.h"
/* TLS support - we basically rely on the host's one.*/ /* TLS support - we basically rely on the host's one.*/
......
#
# Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
#
obj-y = bug.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \ obj-y = bug.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \
ptrace_user.o setjmp.o signal.o sigcontext.o stub.o stub_segv.o \ ptrace_user.o setjmp.o signal.o sigcontext.o stub.o stub_segv.o \
syscalls.o sysrq.o sys_call_table.o tls.o syscalls.o sysrq.o sys_call_table.o tls.o
......
/* /*
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com) * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL * Licensed under the GPL
*/ */
#include <stdio.h>
#include <stddef.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <sys/ptrace.h>
#include "ptrace_user.h"
/* Grr, asm/user.h includes asm/ptrace.h, so has to follow ptrace_user.h */
#include <asm/user.h>
#include "kern_util.h"
#include "user.h"
#include "os.h"
#include "uml-config.h"
int ptrace_getregs(long pid, unsigned long *regs_out) int ptrace_getregs(long pid, unsigned long *regs_out)
{ {
......
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