Commit 986edf12 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

[PATCH] UML: code tidying

Some small cleanups that resulted from the x86_64 merge:
	Some unneeded includes were removed
	Some overlong lines were shortened
	current_thread_info was replaced by a generic version.
	Some warnings were fixed
Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6b566c8b
......@@ -6,7 +6,7 @@
#ifndef __PROCESS_H__
#define __PROCESS_H__
#include <asm/sigcontext.h>
#include <signal.h>
extern void sig_handler(int sig, struct sigcontext sc);
extern void alarm_handler(int sig, struct sigcontext sc);
......
......@@ -173,6 +173,7 @@ static void init_highmem(void)
static void __init fixaddr_user_init( void)
{
#if FIXADDR_USER_START != 0
long size = FIXADDR_USER_END - FIXADDR_USER_START;
pgd_t *pgd;
pmd_t *pmd;
......@@ -192,6 +193,7 @@ static void __init fixaddr_user_init( void)
pte = pte_offset_kernel(pmd, vaddr);
pte_set_val( (*pte), paddr, PAGE_READONLY);
}
#endif
}
void paging_init(void)
......
......@@ -48,8 +48,6 @@
#include "tempfile.h"
#include "kern_constants.h"
extern struct mem_region physmem_region;
#define TEMPNAME_TEMPLATE "vm_file-XXXXXX"
static int create_tmp_file(unsigned long len)
......@@ -135,7 +133,7 @@ static int create_anon_file(unsigned long len)
addr = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
if(addr == MAP_FAILED){
os_print_error((int) addr, "mapping physmem file");
perror("mapping physmem file");
exit(1);
}
munmap(addr, len);
......
......@@ -13,14 +13,10 @@
#include <setjmp.h>
#include <sys/time.h>
#include <sys/ptrace.h>
#include <linux/ptrace.h>
#include <sys/wait.h>
#include <sys/mman.h>
#include <asm/ptrace.h>
#include <asm/sigcontext.h>
#include <asm/unistd.h>
#include <asm/page.h>
#include <asm/user.h>
#include "user_util.h"
#include "kern_util.h"
#include "user.h"
......@@ -28,6 +24,7 @@
#include "signal_kern.h"
#include "signal_user.h"
#include "sysdep/ptrace.h"
#include "sysdep/ptrace_user.h"
#include "sysdep/sigcontext.h"
#include "irq_user.h"
#include "ptrace_user.h"
......@@ -331,7 +328,7 @@ void __init check_ptrace(void)
CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
if(n < 0)
panic("check_ptrace : wait failed, errno = %d", errno);
if(!WIFSTOPPED(status) || (WSTOPSIG(status) != (SIGTRAP + 0x80)))
if(!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP + 0x80))
panic("check_ptrace : expected SIGTRAP + 0x80, "
"got status = %d", status);
......
......@@ -73,7 +73,8 @@ static void handle_trap(int pid, union uml_pt_regs *regs, int local_using_sysemu
"errno = %d\n", errno);
CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));
if((err < 0) || !WIFSTOPPED(status) || (WSTOPSIG(status) != (SIGTRAP + 0x80)))
if((err < 0) || !WIFSTOPPED(status) ||
(WSTOPSIG(status) != SIGTRAP + 0x80))
panic("handle_trap - failed to wait at end of syscall, "
"errno = %d, status = %d\n", errno, status);
}
......
......@@ -5,7 +5,6 @@
#include <signal.h>
#include <errno.h>
#include <asm/sigcontext.h>
#include "sysdep/ptrace.h"
#include "signal_user.h"
#include "user_util.h"
......
......@@ -12,7 +12,6 @@ terms and conditions.
#include <errno.h>
#include <sys/types.h>
#include <sys/ptrace.h>
#include <asm/ptrace.h>
#include <linux/unistd.h>
#include "ptrace_user.h"
#include "user_util.h"
......
......@@ -10,7 +10,6 @@ terms and conditions.
#include <signal.h>
#include <sys/wait.h>
#include <sys/ptrace.h>
#include <asm/ptrace.h>
#include "ptproxy.h"
#include "sysdep.h"
......
......@@ -6,7 +6,6 @@
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
#include <asm/sigcontext.h>
#include "sysdep/ptrace.h"
#include "signal_user.h"
#include "user_util.h"
......
......@@ -17,6 +17,7 @@
#include "linux/sysrq.h"
#include "linux/seq_file.h"
#include "linux/delay.h"
#include "linux/module.h"
#include "asm/page.h"
#include "asm/pgtable.h"
#include "asm/ptrace.h"
......@@ -156,6 +157,8 @@ static int __init uml_version_setup(char *line, int *add)
{
printf("%s\n", system_utsname.release);
exit(0);
return 0;
}
__uml_setup("--version", uml_version_setup,
......@@ -256,6 +259,8 @@ static int __init Usage(char *line, int *add)
p++;
}
exit(0);
return 0;
}
__uml_setup("--help", Usage,
......
......@@ -11,3 +11,5 @@ USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
$(USER_OBJS) : %.o: %.c
$(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $<
CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH)
......@@ -26,7 +26,6 @@ unsigned long vsyscall_end;
unsigned long __kernel_vsyscall;
__init void scan_elf_aux( char **envp)
{
long page_size = 0;
......
......@@ -26,9 +26,6 @@ EXPORT_SYMBOL(printf);
EXPORT_SYMBOL(strstr);
EXPORT_SYMBOL(vsyscall_ehdr);
EXPORT_SYMBOL(vsyscall_end);
/* Here, instead, I can provide a fake prototype. Yes, someone cares: genksyms.
* However, the modules will use the CRC defined *here*, no matter if it is
* good; so the versions of these symbols will always match
......@@ -37,6 +34,11 @@ EXPORT_SYMBOL(vsyscall_end);
int sym(void); \
EXPORT_SYMBOL(sym);
#ifdef SUBARCH_i386
EXPORT_SYMBOL(vsyscall_ehdr);
EXPORT_SYMBOL(vsyscall_end);
#endif
EXPORT_SYMBOL_PROTO(__errno_location);
EXPORT_SYMBOL_PROTO(access);
......
......@@ -24,7 +24,8 @@ struct arch_thread {
* instruction pointer ("program counter"). Stolen
* from asm-i386/processor.h
*/
#define current_text_addr() ({ void *pc; __asm__("movl $1f,%0\n1:":"=g" (pc)); pc; })
#define current_text_addr() \
({ void *pc; __asm__("movl $1f,%0\n1:":"=g" (pc)); pc; })
#include "asm/processor-generic.h"
......
......@@ -47,7 +47,7 @@ static inline struct thread_info *current_thread_info(void)
struct thread_info *ti;
unsigned long mask = PAGE_SIZE *
(1 << CONFIG_KERNEL_STACK_ORDER) - 1;
__asm__("andl %%esp,%0; ":"=r" (ti) : "0" (~mask));
ti = (struct thread_info *) (((unsigned long) &ti) & ~mask);
return ti;
}
......
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