Commit 6aa802ce authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

uml: throw out CHOOSE_MODE

The next stage after removing code which depends on CONFIG_MODE_TT is removing
the CHOOSE_MODE abstraction, which provided both compile-time and run-time
branching to either tt-mode or skas-mode code.

This patch removes choose-mode.h and all inclusions of it, and replaces all
CHOOSE_MODE invocations with the skas branch.  This leaves a number of trivial
functions which will be dealt with in a later patch.

There are some changes in the uaccess and tls support which go somewhat beyond
this and eliminate some of the now-redundant functions.
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 4c9e1385
...@@ -264,8 +264,7 @@ void register_winch(int fd, struct tty_struct *tty) ...@@ -264,8 +264,7 @@ void register_winch(int fd, struct tty_struct *tty)
return; return;
pid = tcgetpgrp(fd); pid = tcgetpgrp(fd);
if (!CHOOSE_MODE_PROC(is_tracer_winch, is_skas_winch, pid, fd, tty) && if (!is_skas_winch(pid, fd, tty) && (pid == -1)) {
(pid == -1)) {
thread = winch_tramp(fd, tty, &thread_fd, &stack); thread = winch_tramp(fd, tty, &thread_fd, &stack);
if (thread < 0) if (thread < 0)
return; return;
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "user.h" #include "user.h"
#include "mconsole.h" #include "mconsole.h"
#include "os.h" #include "os.h"
#include "choose-mode.h"
#include "mode.h" #include "mode.h"
struct dog_data { struct dog_data {
...@@ -64,7 +63,7 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock) ...@@ -64,7 +63,7 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
} }
else { else {
/* XXX The os_getpid() is not SMP correct */ /* XXX The os_getpid() is not SMP correct */
sprintf(pid_buf, "%d", CHOOSE_MODE(tracing_pid, os_getpid())); sprintf(pid_buf, "%d", os_getpid());
args = pid_args; args = pid_args;
} }
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include "init.h" #include "init.h"
#include "os.h" #include "os.h"
#include "irq_kern.h" #include "irq_kern.h"
#include "choose-mode.h"
static int do_unlink_socket(struct notifier_block *notifier, static int do_unlink_socket(struct notifier_block *notifier,
unsigned long what, void *data) unsigned long what, void *data)
......
/*
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#ifndef __CHOOSE_MODE_H__
#define __CHOOSE_MODE_H__
#include "uml-config.h"
#define CHOOSE_MODE(tt, skas) (skas)
#define CHOOSE_MODE_PROC(tt, skas, args...) \
CHOOSE_MODE(tt(args), skas(args))
#ifndef __CHOOSE_MODE
#define __CHOOSE_MODE(tt, skas) CHOOSE_MODE(tt, skas)
#endif
#endif
/*
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#ifndef __SKAS_UACCESS_H
#define __SKAS_UACCESS_H
#include "asm/errno.h"
/* No SKAS-specific checking. */
#define access_ok_skas(type, addr, size) 0
extern int copy_from_user_skas(void *to, const void __user *from, int n);
extern int copy_to_user_skas(void __user *to, const void *from, int n);
extern int strncpy_from_user_skas(char *dst, const char __user *src, int count);
extern int __clear_user_skas(void __user *mem, int len);
extern int clear_user_skas(void __user *mem, int len);
extern int strnlen_user_skas(const void __user *str, int len);
#endif
/* /*
* 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
*/ */
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "uml-config.h" #include "uml-config.h"
#include "user_constants.h" #include "user_constants.h"
#include "sysdep/faultinfo.h" #include "sysdep/faultinfo.h"
#include "choose-mode.h"
#define MAX_REG_NR (UM_FRAME_SIZE / sizeof(unsigned long)) #define MAX_REG_NR (UM_FRAME_SIZE / sizeof(unsigned long))
#define MAX_REG_OFFSET (UM_FRAME_SIZE) #define MAX_REG_OFFSET (UM_FRAME_SIZE)
...@@ -67,40 +66,23 @@ union uml_pt_regs { ...@@ -67,40 +66,23 @@ union uml_pt_regs {
#define EMPTY_UML_PT_REGS { } #define EMPTY_UML_PT_REGS { }
#define UPT_SC(r) ((r)->tt.sc) #define UPT_SC(r) ((r)->tt.sc)
#define UPT_IP(r) \ #define UPT_IP(r) REGS_IP((r)->skas.regs)
__CHOOSE_MODE(SC_IP(UPT_SC(r)), REGS_IP((r)->skas.regs)) #define UPT_SP(r) REGS_SP((r)->skas.regs)
#define UPT_SP(r) \ #define UPT_EFLAGS(r) REGS_EFLAGS((r)->skas.regs)
__CHOOSE_MODE(SC_SP(UPT_SC(r)), REGS_SP((r)->skas.regs)) #define UPT_EAX(r) REGS_EAX((r)->skas.regs)
#define UPT_EFLAGS(r) \ #define UPT_EBX(r) REGS_EBX((r)->skas.regs)
__CHOOSE_MODE(SC_EFLAGS(UPT_SC(r)), REGS_EFLAGS((r)->skas.regs)) #define UPT_ECX(r) REGS_ECX((r)->skas.regs)
#define UPT_EAX(r) \ #define UPT_EDX(r) REGS_EDX((r)->skas.regs)
__CHOOSE_MODE(SC_EAX(UPT_SC(r)), REGS_EAX((r)->skas.regs)) #define UPT_ESI(r) REGS_ESI((r)->skas.regs)
#define UPT_EBX(r) \ #define UPT_EDI(r) REGS_EDI((r)->skas.regs)
__CHOOSE_MODE(SC_EBX(UPT_SC(r)), REGS_EBX((r)->skas.regs)) #define UPT_EBP(r) REGS_EBP((r)->skas.regs)
#define UPT_ECX(r) \ #define UPT_ORIG_EAX(r) ((r)->skas.syscall)
__CHOOSE_MODE(SC_ECX(UPT_SC(r)), REGS_ECX((r)->skas.regs)) #define UPT_CS(r) REGS_CS((r)->skas.regs)
#define UPT_EDX(r) \ #define UPT_SS(r) REGS_SS((r)->skas.regs)
__CHOOSE_MODE(SC_EDX(UPT_SC(r)), REGS_EDX((r)->skas.regs)) #define UPT_DS(r) REGS_DS((r)->skas.regs)
#define UPT_ESI(r) \ #define UPT_ES(r) REGS_ES((r)->skas.regs)
__CHOOSE_MODE(SC_ESI(UPT_SC(r)), REGS_ESI((r)->skas.regs)) #define UPT_FS(r) REGS_FS((r)->skas.regs)
#define UPT_EDI(r) \ #define UPT_GS(r) REGS_GS((r)->skas.regs)
__CHOOSE_MODE(SC_EDI(UPT_SC(r)), REGS_EDI((r)->skas.regs))
#define UPT_EBP(r) \
__CHOOSE_MODE(SC_EBP(UPT_SC(r)), REGS_EBP((r)->skas.regs))
#define UPT_ORIG_EAX(r) \
__CHOOSE_MODE((r)->tt.syscall, (r)->skas.syscall)
#define UPT_CS(r) \
__CHOOSE_MODE(SC_CS(UPT_SC(r)), REGS_CS((r)->skas.regs))
#define UPT_SS(r) \
__CHOOSE_MODE(SC_SS(UPT_SC(r)), REGS_SS((r)->skas.regs))
#define UPT_DS(r) \
__CHOOSE_MODE(SC_DS(UPT_SC(r)), REGS_DS((r)->skas.regs))
#define UPT_ES(r) \
__CHOOSE_MODE(SC_ES(UPT_SC(r)), REGS_ES((r)->skas.regs))
#define UPT_FS(r) \
__CHOOSE_MODE(SC_FS(UPT_SC(r)), REGS_FS((r)->skas.regs))
#define UPT_GS(r) \
__CHOOSE_MODE(SC_GS(UPT_SC(r)), REGS_GS((r)->skas.regs))
#define UPT_SYSCALL_ARG1(r) UPT_EBX(r) #define UPT_SYSCALL_ARG1(r) UPT_EBX(r)
#define UPT_SYSCALL_ARG2(r) UPT_ECX(r) #define UPT_SYSCALL_ARG2(r) UPT_ECX(r)
...@@ -111,8 +93,7 @@ union uml_pt_regs { ...@@ -111,8 +93,7 @@ union uml_pt_regs {
extern int user_context(unsigned long sp); extern int user_context(unsigned long sp);
#define UPT_IS_USER(r) \ #define UPT_IS_USER(r) ((r)->skas.is_user)
CHOOSE_MODE(user_context(UPT_SP(r)), (r)->skas.is_user)
struct syscall_args { struct syscall_args {
unsigned long args[6]; unsigned long args[6];
...@@ -181,18 +162,14 @@ struct syscall_args { ...@@ -181,18 +162,14 @@ struct syscall_args {
} while (0) } while (0)
#define UPT_SET_SYSCALL_RETURN(r, res) \ #define UPT_SET_SYSCALL_RETURN(r, res) \
CHOOSE_MODE(SC_SET_SYSCALL_RETURN(UPT_SC(r), (res)), \ REGS_SET_SYSCALL_RETURN((r)->skas.regs, (res))
REGS_SET_SYSCALL_RETURN((r)->skas.regs, (res)))
#define UPT_RESTART_SYSCALL(r) \ #define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->skas.regs)
CHOOSE_MODE(SC_RESTART_SYSCALL(UPT_SC(r)), \
REGS_RESTART_SYSCALL((r)->skas.regs))
#define UPT_ORIG_SYSCALL(r) UPT_EAX(r) #define UPT_ORIG_SYSCALL(r) UPT_EAX(r)
#define UPT_SYSCALL_NR(r) UPT_ORIG_EAX(r) #define UPT_SYSCALL_NR(r) UPT_ORIG_EAX(r)
#define UPT_SYSCALL_RET(r) UPT_EAX(r) #define UPT_SYSCALL_RET(r) UPT_EAX(r)
#define UPT_FAULTINFO(r) \ #define UPT_FAULTINFO(r) (&(r)->skas.faultinfo)
CHOOSE_MODE((&(r)->tt.faultinfo), (&(r)->skas.faultinfo))
#endif #endif
...@@ -84,8 +84,6 @@ ...@@ -84,8 +84,6 @@
#define REGS_ERR(r) ((r)->fault_type) #define REGS_ERR(r) ((r)->fault_type)
#include "choose-mode.h"
/* XXX */ /* XXX */
union uml_pt_regs { union uml_pt_regs {
struct skas_regs { struct skas_regs {
...@@ -99,48 +97,45 @@ union uml_pt_regs { ...@@ -99,48 +97,45 @@ union uml_pt_regs {
#define EMPTY_UML_PT_REGS { } #define EMPTY_UML_PT_REGS { }
#define UPT_RBX(r) __CHOOSE_MODE(SC_RBX(UPT_SC(r)), REGS_RBX((r)->skas.regs)) #define UPT_RBX(r) REGS_RBX((r)->skas.regs)
#define UPT_RCX(r) __CHOOSE_MODE(SC_RCX(UPT_SC(r)), REGS_RCX((r)->skas.regs)) #define UPT_RCX(r) REGS_RCX((r)->skas.regs)
#define UPT_RDX(r) __CHOOSE_MODE(SC_RDX(UPT_SC(r)), REGS_RDX((r)->skas.regs)) #define UPT_RDX(r) REGS_RDX((r)->skas.regs)
#define UPT_RSI(r) __CHOOSE_MODE(SC_RSI(UPT_SC(r)), REGS_RSI((r)->skas.regs)) #define UPT_RSI(r) REGS_RSI((r)->skas.regs)
#define UPT_RDI(r) __CHOOSE_MODE(SC_RDI(UPT_SC(r)), REGS_RDI((r)->skas.regs)) #define UPT_RDI(r) REGS_RDI((r)->skas.regs)
#define UPT_RBP(r) __CHOOSE_MODE(SC_RBP(UPT_SC(r)), REGS_RBP((r)->skas.regs)) #define UPT_RBP(r) REGS_RBP((r)->skas.regs)
#define UPT_RAX(r) __CHOOSE_MODE(SC_RAX(UPT_SC(r)), REGS_RAX((r)->skas.regs)) #define UPT_RAX(r) REGS_RAX((r)->skas.regs)
#define UPT_R8(r) __CHOOSE_MODE(SC_R8(UPT_SC(r)), REGS_R8((r)->skas.regs)) #define UPT_R8(r) REGS_R8((r)->skas.regs)
#define UPT_R9(r) __CHOOSE_MODE(SC_R9(UPT_SC(r)), REGS_R9((r)->skas.regs)) #define UPT_R9(r) REGS_R9((r)->skas.regs)
#define UPT_R10(r) __CHOOSE_MODE(SC_R10(UPT_SC(r)), REGS_R10((r)->skas.regs)) #define UPT_R10(r) REGS_R10((r)->skas.regs)
#define UPT_R11(r) __CHOOSE_MODE(SC_R11(UPT_SC(r)), REGS_R11((r)->skas.regs)) #define UPT_R11(r) REGS_R11((r)->skas.regs)
#define UPT_R12(r) __CHOOSE_MODE(SC_R12(UPT_SC(r)), REGS_R12((r)->skas.regs)) #define UPT_R12(r) REGS_R12((r)->skas.regs)
#define UPT_R13(r) __CHOOSE_MODE(SC_R13(UPT_SC(r)), REGS_R13((r)->skas.regs)) #define UPT_R13(r) REGS_R13((r)->skas.regs)
#define UPT_R14(r) __CHOOSE_MODE(SC_R14(UPT_SC(r)), REGS_R14((r)->skas.regs)) #define UPT_R14(r) REGS_R14((r)->skas.regs)
#define UPT_R15(r) __CHOOSE_MODE(SC_R15(UPT_SC(r)), REGS_R15((r)->skas.regs)) #define UPT_R15(r) REGS_R15((r)->skas.regs)
#define UPT_CS(r) __CHOOSE_MODE(SC_CS(UPT_SC(r)), REGS_CS((r)->skas.regs)) #define UPT_CS(r) REGS_CS((r)->skas.regs)
#define UPT_FS_BASE(r) \ #define UPT_FS_BASE(r) \
__CHOOSE_MODE(SC_FS_BASE(UPT_SC(r)), REGS_FS_BASE((r)->skas.regs)) REGS_FS_BASE((r)->skas.regs)
#define UPT_FS(r) __CHOOSE_MODE(SC_FS(UPT_SC(r)), REGS_FS((r)->skas.regs)) #define UPT_FS(r) REGS_FS((r)->skas.regs)
#define UPT_GS_BASE(r) \ #define UPT_GS_BASE(r) \
__CHOOSE_MODE(SC_GS_BASE(UPT_SC(r)), REGS_GS_BASE((r)->skas.regs)) REGS_GS_BASE((r)->skas.regs)
#define UPT_GS(r) __CHOOSE_MODE(SC_GS(UPT_SC(r)), REGS_GS((r)->skas.regs)) #define UPT_GS(r) REGS_GS((r)->skas.regs)
#define UPT_DS(r) __CHOOSE_MODE(SC_DS(UPT_SC(r)), REGS_DS((r)->skas.regs)) #define UPT_DS(r) REGS_DS((r)->skas.regs)
#define UPT_ES(r) __CHOOSE_MODE(SC_ES(UPT_SC(r)), REGS_ES((r)->skas.regs)) #define UPT_ES(r) REGS_ES((r)->skas.regs)
#define UPT_CS(r) __CHOOSE_MODE(SC_CS(UPT_SC(r)), REGS_CS((r)->skas.regs)) #define UPT_CS(r) REGS_CS((r)->skas.regs)
#define UPT_SS(r) __CHOOSE_MODE(SC_SS(UPT_SC(r)), REGS_SS((r)->skas.regs)) #define UPT_SS(r) REGS_SS((r)->skas.regs)
#define UPT_ORIG_RAX(r) \ #define UPT_ORIG_RAX(r) REGS_ORIG_RAX((r)->skas.regs)
__CHOOSE_MODE((r)->tt.orig_rax, REGS_ORIG_RAX((r)->skas.regs))
#define UPT_IP(r) REGS_IP((r)->skas.regs)
#define UPT_IP(r) __CHOOSE_MODE(SC_IP(UPT_SC(r)), REGS_IP((r)->skas.regs)) #define UPT_SP(r) REGS_SP((r)->skas.regs)
#define UPT_SP(r) __CHOOSE_MODE(SC_SP(UPT_SC(r)), REGS_SP((r)->skas.regs))
#define UPT_EFLAGS(r) REGS_EFLAGS((r)->skas.regs)
#define UPT_EFLAGS(r) \
__CHOOSE_MODE(SC_EFLAGS(UPT_SC(r)), REGS_EFLAGS((r)->skas.regs))
#define UPT_SC(r) ((r)->tt.sc) #define UPT_SC(r) ((r)->tt.sc)
#define UPT_SYSCALL_NR(r) __CHOOSE_MODE((r)->tt.syscall, (r)->skas.syscall) #define UPT_SYSCALL_NR(r) ((r)->skas.syscall)
#define UPT_SYSCALL_RET(r) UPT_RAX(r) #define UPT_SYSCALL_RET(r) UPT_RAX(r)
extern int user_context(unsigned long sp); extern int user_context(unsigned long sp);
#define UPT_IS_USER(r) \ #define UPT_IS_USER(r) ((r)->skas.is_user)
CHOOSE_MODE(user_context(UPT_SP(r)), (r)->skas.is_user)
#define UPT_SYSCALL_ARG1(r) UPT_RDI(r) #define UPT_SYSCALL_ARG1(r) UPT_RDI(r)
#define UPT_SYSCALL_ARG2(r) UPT_RSI(r) #define UPT_SYSCALL_ARG2(r) UPT_RSI(r)
...@@ -237,18 +232,12 @@ struct syscall_args { ...@@ -237,18 +232,12 @@ struct syscall_args {
}) })
#define UPT_SET_SYSCALL_RETURN(r, res) \ #define UPT_SET_SYSCALL_RETURN(r, res) \
CHOOSE_MODE(SC_SET_SYSCALL_RETURN(UPT_SC(r), (res)), \ REGS_SET_SYSCALL_RETURN((r)->skas.regs, (res))
REGS_SET_SYSCALL_RETURN((r)->skas.regs, (res)))
#define UPT_RESTART_SYSCALL(r) \ #define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->skas.regs)
CHOOSE_MODE(SC_RESTART_SYSCALL(UPT_SC(r)), \
REGS_RESTART_SYSCALL((r)->skas.regs))
#define UPT_SEGV_IS_FIXABLE(r) \ #define UPT_SEGV_IS_FIXABLE(r) REGS_SEGV_IS_FIXABLE(&r->skas)
CHOOSE_MODE(SC_SEGV_IS_FIXABLE(UPT_SC(r)), \
REGS_SEGV_IS_FIXABLE(&r->skas))
#define UPT_FAULTINFO(r) \ #define UPT_FAULTINFO(r) (&(r)->skas.faultinfo)
CHOOSE_MODE((&(r)->tt.faultinfo), (&(r)->skas.faultinfo))
#endif #endif
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#define __ARCH_UM_MMU_H #define __ARCH_UM_MMU_H
#include "uml-config.h" #include "uml-config.h"
#include "choose-mode.h"
#include "mmu-skas.h" #include "mmu-skas.h"
typedef union mm_context { typedef union mm_context {
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
#ifndef __ARCH_UM_UACCESS_H #ifndef __ARCH_UM_UACCESS_H
#define __ARCH_UM_UACCESS_H #define __ARCH_UM_UACCESS_H
#include "choose-mode.h"
#include "uaccess-skas.h"
#include "asm/fixmap.h" #include "asm/fixmap.h"
#define __under_task_size(addr, size) \ #define __under_task_size(addr, size) \
...@@ -27,20 +25,10 @@ ...@@ -27,20 +25,10 @@
(__addr_range_nowrap(addr, size) && \ (__addr_range_nowrap(addr, size) && \
(__under_task_size(addr, size) || \ (__under_task_size(addr, size) || \
__access_ok_vsyscall(type, addr, size) || \ __access_ok_vsyscall(type, addr, size) || \
segment_eq(get_fs(), KERNEL_DS) || \ segment_eq(get_fs(), KERNEL_DS)))
CHOOSE_MODE_PROC(access_ok_tt, access_ok_skas, type, addr, size)))
static inline int copy_from_user(void *to, const void __user *from, int n) extern int copy_from_user(void *to, const void __user *from, int n);
{ extern int copy_to_user(void __user *to, const void *from, int n);
return(CHOOSE_MODE_PROC(copy_from_user_tt, copy_from_user_skas, to,
from, n));
}
static inline int copy_to_user(void __user *to, const void *from, int n)
{
return(CHOOSE_MODE_PROC(copy_to_user_tt, copy_to_user_skas, to,
from, n));
}
/* /*
* strncpy_from_user: - Copy a NUL terminated string from userspace. * strncpy_from_user: - Copy a NUL terminated string from userspace.
...@@ -61,11 +49,7 @@ static inline int copy_to_user(void __user *to, const void *from, int n) ...@@ -61,11 +49,7 @@ static inline int copy_to_user(void __user *to, const void *from, int n)
* and returns @count. * and returns @count.
*/ */
static inline int strncpy_from_user(char *dst, const char __user *src, int count) extern int strncpy_from_user(char *dst, const char __user *src, int count);
{
return(CHOOSE_MODE_PROC(strncpy_from_user_tt, strncpy_from_user_skas,
dst, src, count));
}
/* /*
* __clear_user: - Zero a block of memory in user space, with less checking. * __clear_user: - Zero a block of memory in user space, with less checking.
...@@ -78,10 +62,7 @@ static inline int strncpy_from_user(char *dst, const char __user *src, int count ...@@ -78,10 +62,7 @@ static inline int strncpy_from_user(char *dst, const char __user *src, int count
* Returns number of bytes that could not be cleared. * Returns number of bytes that could not be cleared.
* On success, this will be zero. * On success, this will be zero.
*/ */
static inline int __clear_user(void *mem, int len) extern int __clear_user(void __user *mem, int len);
{
return(CHOOSE_MODE_PROC(__clear_user_tt, __clear_user_skas, mem, len));
}
/* /*
* clear_user: - Zero a block of memory in user space. * clear_user: - Zero a block of memory in user space.
...@@ -93,10 +74,7 @@ static inline int __clear_user(void *mem, int len) ...@@ -93,10 +74,7 @@ static inline int __clear_user(void *mem, int len)
* Returns number of bytes that could not be cleared. * Returns number of bytes that could not be cleared.
* On success, this will be zero. * On success, this will be zero.
*/ */
static inline int clear_user(void __user *mem, int len) extern int clear_user(void __user *mem, int len);
{
return(CHOOSE_MODE_PROC(clear_user_tt, clear_user_skas, mem, len));
}
/* /*
* strlen_user: - Get the size of a string in user space. * strlen_user: - Get the size of a string in user space.
...@@ -109,10 +87,7 @@ static inline int clear_user(void __user *mem, int len) ...@@ -109,10 +87,7 @@ static inline int clear_user(void __user *mem, int len)
* On exception, returns 0. * On exception, returns 0.
* If the string is too long, returns a value greater than @n. * If the string is too long, returns a value greater than @n.
*/ */
static inline int strnlen_user(const void __user *str, long len) extern int strnlen_user(const void __user *str, int len);
{
return(CHOOSE_MODE_PROC(strnlen_user_tt, strnlen_user_skas, str, len));
}
#endif #endif
......
...@@ -18,18 +18,17 @@ ...@@ -18,18 +18,17 @@
#include "irq_user.h" #include "irq_user.h"
#include "tlb.h" #include "tlb.h"
#include "os.h" #include "os.h"
#include "choose-mode.h"
#include "mode_kern.h" #include "mode_kern.h"
void flush_thread(void) void flush_thread(void)
{ {
arch_flush_thread(&current->thread.arch); arch_flush_thread(&current->thread.arch);
CHOOSE_MODE(flush_thread_tt(), flush_thread_skas()); flush_thread_skas();
} }
void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
{ {
CHOOSE_MODE_PROC(start_thread_tt, start_thread_skas, regs, eip, esp); start_thread_skas(regs, eip, esp);
} }
#ifdef CONFIG_TTY_LOG #ifdef CONFIG_TTY_LOG
......
...@@ -37,11 +37,11 @@ EXPORT_SYMBOL(um_virt_to_phys); ...@@ -37,11 +37,11 @@ EXPORT_SYMBOL(um_virt_to_phys);
EXPORT_SYMBOL(handle_page_fault); EXPORT_SYMBOL(handle_page_fault);
EXPORT_SYMBOL(find_iomem); EXPORT_SYMBOL(find_iomem);
EXPORT_SYMBOL(strnlen_user_skas); EXPORT_SYMBOL(strnlen_user);
EXPORT_SYMBOL(strncpy_from_user_skas); EXPORT_SYMBOL(strncpy_from_user);
EXPORT_SYMBOL(copy_to_user_skas); EXPORT_SYMBOL(copy_to_user);
EXPORT_SYMBOL(copy_from_user_skas); EXPORT_SYMBOL(copy_from_user);
EXPORT_SYMBOL(clear_user_skas); EXPORT_SYMBOL(clear_user);
EXPORT_SYMBOL(uml_strdup); EXPORT_SYMBOL(uml_strdup);
EXPORT_SYMBOL(os_stat_fd); EXPORT_SYMBOL(os_stat_fd);
......
...@@ -61,7 +61,7 @@ static unsigned long kmem_top = 0; ...@@ -61,7 +61,7 @@ static unsigned long kmem_top = 0;
unsigned long get_kmem_end(void) unsigned long get_kmem_end(void)
{ {
if (kmem_top == 0) if (kmem_top == 0)
kmem_top = CHOOSE_MODE(kmem_end_tt, kmem_end_skas); kmem_top = kmem_end_skas;
return kmem_top; return kmem_top;
} }
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include "os.h" #include "os.h"
#include "mode.h" #include "mode.h"
#include "mode_kern.h" #include "mode_kern.h"
#include "choose-mode.h"
/* This is a per-cpu array. A processor only modifies its entry and it only /* This is a per-cpu array. A processor only modifies its entry and it only
* cares about its entry, so it's OK if another processor is modifying its * cares about its entry, so it's OK if another processor is modifying its
...@@ -55,7 +54,7 @@ struct cpu_task cpu_tasks[NR_CPUS] = { [0 ... NR_CPUS - 1] = { -1, NULL } }; ...@@ -55,7 +54,7 @@ struct cpu_task cpu_tasks[NR_CPUS] = { [0 ... NR_CPUS - 1] = { -1, NULL } };
static inline int external_pid(struct task_struct *task) static inline int external_pid(struct task_struct *task)
{ {
return CHOOSE_MODE_PROC(external_pid_tt, external_pid_skas, task); return external_pid_skas(task);
} }
int pid_to_processor_id(int pid) int pid_to_processor_id(int pid)
...@@ -114,8 +113,8 @@ void *_switch_to(void *prev, void *next, void *last) ...@@ -114,8 +113,8 @@ void *_switch_to(void *prev, void *next, void *last)
set_current(to); set_current(to);
do { do {
current->thread.saved_task = NULL ; current->thread.saved_task = NULL;
CHOOSE_MODE_PROC(switch_to_tt, switch_to_skas, prev, next); switch_to_skas(prev, next);
if(current->thread.saved_task) if(current->thread.saved_task)
show_regs(&(current->thread.regs)); show_regs(&(current->thread.regs));
next= current->thread.saved_task; next= current->thread.saved_task;
...@@ -136,7 +135,7 @@ void interrupt_end(void) ...@@ -136,7 +135,7 @@ void interrupt_end(void)
void release_thread(struct task_struct *task) void release_thread(struct task_struct *task)
{ {
CHOOSE_MODE(release_thread_tt(task), release_thread_skas(task)); release_thread_skas(task);
} }
void exit_thread(void) void exit_thread(void)
...@@ -155,8 +154,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, ...@@ -155,8 +154,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
int ret; int ret;
p->thread = (struct thread_struct) INIT_THREAD; p->thread = (struct thread_struct) INIT_THREAD;
ret = CHOOSE_MODE_PROC(copy_thread_tt, copy_thread_skas, nr, ret = copy_thread_skas(nr, clone_flags, sp, stack_top, p, regs);
clone_flags, sp, stack_top, p, regs);
if (ret || !current->thread.forking) if (ret || !current->thread.forking)
goto out; goto out;
...@@ -178,15 +176,12 @@ void initial_thread_cb(void (*proc)(void *), void *arg) ...@@ -178,15 +176,12 @@ void initial_thread_cb(void (*proc)(void *), void *arg)
int save_kmalloc_ok = kmalloc_ok; int save_kmalloc_ok = kmalloc_ok;
kmalloc_ok = 0; kmalloc_ok = 0;
CHOOSE_MODE_PROC(initial_thread_cb_tt, initial_thread_cb_skas, proc, initial_thread_cb_skas(proc, arg);
arg);
kmalloc_ok = save_kmalloc_ok; kmalloc_ok = save_kmalloc_ok;
} }
void default_idle(void) void default_idle(void)
{ {
CHOOSE_MODE(uml_idle_timer(), (void) 0);
while(1){ while(1){
/* endless idle loop with no priority at all */ /* endless idle loop with no priority at all */
...@@ -203,7 +198,7 @@ void default_idle(void) ...@@ -203,7 +198,7 @@ void default_idle(void)
void cpu_idle(void) void cpu_idle(void)
{ {
CHOOSE_MODE(init_idle_tt(), init_idle_skas()); init_idle_skas();
} }
void *um_virt_to_phys(struct task_struct *task, unsigned long addr, void *um_virt_to_phys(struct task_struct *task, unsigned long addr,
......
...@@ -10,13 +10,12 @@ ...@@ -10,13 +10,12 @@
#include "kern.h" #include "kern.h"
#include "os.h" #include "os.h"
#include "mode.h" #include "mode.h"
#include "choose-mode.h"
void (*pm_power_off)(void); void (*pm_power_off)(void);
static void kill_off_processes(void) static void kill_off_processes(void)
{ {
CHOOSE_MODE(kill_off_processes_tt(), kill_off_processes_skas()); kill_off_processes_skas();
} }
void uml_cleanup(void) void uml_cleanup(void)
...@@ -29,13 +28,13 @@ void uml_cleanup(void) ...@@ -29,13 +28,13 @@ void uml_cleanup(void)
void machine_restart(char * __unused) void machine_restart(char * __unused)
{ {
uml_cleanup(); uml_cleanup();
CHOOSE_MODE(reboot_tt(), reboot_skas()); reboot_skas();
} }
void machine_power_off(void) void machine_power_off(void)
{ {
uml_cleanup(); uml_cleanup();
CHOOSE_MODE(halt_tt(), halt_skas()); halt_skas();
} }
void machine_halt(void) void machine_halt(void)
......
...@@ -139,7 +139,7 @@ static int copy_chunk_from_user(unsigned long from, int len, void *arg) ...@@ -139,7 +139,7 @@ static int copy_chunk_from_user(unsigned long from, int len, void *arg)
return(0); return(0);
} }
int copy_from_user_skas(void *to, const void __user *from, int n) int copy_from_user(void *to, const void __user *from, int n)
{ {
if(segment_eq(get_fs(), KERNEL_DS)){ if(segment_eq(get_fs(), KERNEL_DS)){
memcpy(to, (__force void*)from, n); memcpy(to, (__force void*)from, n);
...@@ -160,7 +160,7 @@ static int copy_chunk_to_user(unsigned long to, int len, void *arg) ...@@ -160,7 +160,7 @@ static int copy_chunk_to_user(unsigned long to, int len, void *arg)
return(0); return(0);
} }
int copy_to_user_skas(void __user *to, const void *from, int n) int copy_to_user(void __user *to, const void *from, int n)
{ {
if(segment_eq(get_fs(), KERNEL_DS)){ if(segment_eq(get_fs(), KERNEL_DS)){
memcpy((__force void*)to, from, n); memcpy((__force void*)to, from, n);
...@@ -186,7 +186,7 @@ static int strncpy_chunk_from_user(unsigned long from, int len, void *arg) ...@@ -186,7 +186,7 @@ static int strncpy_chunk_from_user(unsigned long from, int len, void *arg)
return(0); return(0);
} }
int strncpy_from_user_skas(char *dst, const char __user *src, int count) int strncpy_from_user(char *dst, const char __user *src, int count)
{ {
int n; int n;
char *ptr = dst; char *ptr = dst;
...@@ -212,12 +212,12 @@ static int clear_chunk(unsigned long addr, int len, void *unused) ...@@ -212,12 +212,12 @@ static int clear_chunk(unsigned long addr, int len, void *unused)
return(0); return(0);
} }
int __clear_user_skas(void __user *mem, int len) int __clear_user(void __user *mem, int len)
{ {
return(buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL)); return(buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL));
} }
int clear_user_skas(void __user *mem, int len) int clear_user(void __user *mem, int len)
{ {
if(segment_eq(get_fs(), KERNEL_DS)){ if(segment_eq(get_fs(), KERNEL_DS)){
memset((__force void*)mem, 0, len); memset((__force void*)mem, 0, len);
...@@ -240,7 +240,7 @@ static int strnlen_chunk(unsigned long str, int len, void *arg) ...@@ -240,7 +240,7 @@ static int strnlen_chunk(unsigned long str, int len, void *arg)
return(0); return(0);
} }
int strnlen_user_skas(const void __user *str, int len) int strnlen_user(const void __user *str, int len)
{ {
int count = 0, n; int count = 0, n;
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "kern_util.h" #include "kern_util.h"
#include "sysdep/syscalls.h" #include "sysdep/syscalls.h"
#include "mode_kern.h" #include "mode_kern.h"
#include "choose-mode.h"
/* Unlocked, I don't care if this is a bit off */ /* Unlocked, I don't care if this is a bit off */
int nsyscalls = 0; int nsyscalls = 0;
......
...@@ -181,9 +181,7 @@ void timer_handler(int sig, union uml_pt_regs *regs) ...@@ -181,9 +181,7 @@ void timer_handler(int sig, union uml_pt_regs *regs)
timer_irq(regs); timer_irq(regs);
local_irq_disable(); local_irq_disable();
irq_enter(); irq_enter();
update_process_times(CHOOSE_MODE( update_process_times((regs)->skas.is_user);
(UPT_SC(regs) && user_context(UPT_SP(regs))),
(regs)->skas.is_user));
irq_exit(); irq_exit();
local_irq_enable(); local_irq_enable();
} }
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "asm/pgalloc.h" #include "asm/pgalloc.h"
#include "asm/pgtable.h" #include "asm/pgtable.h"
#include "asm/tlbflush.h" #include "asm/tlbflush.h"
#include "choose-mode.h"
#include "mode_kern.h" #include "mode_kern.h"
#include "as-layout.h" #include "as-layout.h"
#include "tlb.h" #include "tlb.h"
...@@ -378,35 +377,31 @@ void flush_tlb_all(void) ...@@ -378,35 +377,31 @@ void flush_tlb_all(void)
void flush_tlb_kernel_range(unsigned long start, unsigned long end) void flush_tlb_kernel_range(unsigned long start, unsigned long end)
{ {
CHOOSE_MODE_PROC(flush_tlb_kernel_range_tt, flush_tlb_kernel_range_common(start, end);
flush_tlb_kernel_range_common, start, end);
} }
void flush_tlb_kernel_vm(void) void flush_tlb_kernel_vm(void)
{ {
CHOOSE_MODE(flush_tlb_kernel_vm_tt(), flush_tlb_kernel_range_common(start_vm, end_vm);
flush_tlb_kernel_range_common(start_vm, end_vm));
} }
void __flush_tlb_one(unsigned long addr) void __flush_tlb_one(unsigned long addr)
{ {
CHOOSE_MODE_PROC(__flush_tlb_one_tt, __flush_tlb_one_skas, addr); __flush_tlb_one_skas(addr);
} }
void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
unsigned long end) unsigned long end)
{ {
CHOOSE_MODE_PROC(flush_tlb_range_tt, flush_tlb_range_skas, vma, start, flush_tlb_range_skas(vma, start, end);
end);
} }
void flush_tlb_mm(struct mm_struct *mm) void flush_tlb_mm(struct mm_struct *mm)
{ {
CHOOSE_MODE_PROC(flush_tlb_mm_tt, flush_tlb_mm_skas, mm); flush_tlb_mm_skas(mm);
} }
void force_flush_all(void) void force_flush_all(void)
{ {
CHOOSE_MODE(force_flush_all_tt(), force_flush_all_skas()); force_flush_all_skas();
} }
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include "initrd.h" #include "initrd.h"
#include "init.h" #include "init.h"
#include "os.h" #include "os.h"
#include "choose-mode.h"
#include "mode_kern.h" #include "mode_kern.h"
#include "mode.h" #include "mode.h"
#include "skas.h" #include "skas.h"
...@@ -68,8 +67,7 @@ struct cpuinfo_um boot_cpu_data = { ...@@ -68,8 +67,7 @@ struct cpuinfo_um boot_cpu_data = {
unsigned long thread_saved_pc(struct task_struct *task) unsigned long thread_saved_pc(struct task_struct *task)
{ {
return os_process_pc(CHOOSE_MODE_PROC(thread_pid_tt, thread_pid_skas, return os_process_pc(thread_pid_skas(task));
task));
} }
/* Changed in setup_arch, which is called in early boot */ /* Changed in setup_arch, which is called in early boot */
...@@ -88,7 +86,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) ...@@ -88,7 +86,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
seq_printf(m, "processor\t: %d\n", index); seq_printf(m, "processor\t: %d\n", index);
seq_printf(m, "vendor_id\t: User Mode Linux\n"); seq_printf(m, "vendor_id\t: User Mode Linux\n");
seq_printf(m, "model name\t: UML\n"); seq_printf(m, "model name\t: UML\n");
seq_printf(m, "mode\t\t: %s\n", CHOOSE_MODE("tt", "skas")); seq_printf(m, "mode\t\t: skas\n");
seq_printf(m, "host\t\t: %s\n", host_info); seq_printf(m, "host\t\t: %s\n", host_info);
seq_printf(m, "bogomips\t: %lu.%02lu\n\n", seq_printf(m, "bogomips\t: %lu.%02lu\n\n",
loops_per_jiffy/(500000/HZ), loops_per_jiffy/(500000/HZ),
...@@ -283,8 +281,7 @@ int __init linux_main(int argc, char **argv) ...@@ -283,8 +281,7 @@ int __init linux_main(int argc, char **argv)
printf("UML running in %s mode\n", mode); printf("UML running in %s mode\n", mode);
host_task_size = CHOOSE_MODE_PROC(set_task_sizes_tt, host_task_size = set_task_sizes_skas(&task_size);
set_task_sizes_skas, &task_size);
/* /*
* Setting up handlers to 'sig_info' struct * Setting up handlers to 'sig_info' struct
...@@ -292,7 +289,7 @@ int __init linux_main(int argc, char **argv) ...@@ -292,7 +289,7 @@ int __init linux_main(int argc, char **argv)
os_fill_handlinfo(handlinfo_kern); os_fill_handlinfo(handlinfo_kern);
brk_start = (unsigned long) sbrk(0); brk_start = (unsigned long) sbrk(0);
CHOOSE_MODE_PROC(before_mem_tt, before_mem_skas, brk_start); before_mem_skas(brk_start);
/* Increase physical memory size for exec-shield users /* Increase physical memory size for exec-shield users
so they actually get what they asked for. This should so they actually get what they asked for. This should
add zero for non-exec shield users */ add zero for non-exec shield users */
...@@ -357,7 +354,7 @@ int __init linux_main(int argc, char **argv) ...@@ -357,7 +354,7 @@ int __init linux_main(int argc, char **argv)
stack_protections((unsigned long) &init_thread_info); stack_protections((unsigned long) &init_thread_info);
os_flush_stdout(); os_flush_stdout();
return CHOOSE_MODE(start_uml_tt(), start_uml_skas()); return start_uml_skas();
} }
extern int uml_exitcode; extern int uml_exitcode;
......
...@@ -320,11 +320,6 @@ static int init_aio(void) ...@@ -320,11 +320,6 @@ static int init_aio(void)
{ {
int err; int err;
CHOOSE_MODE(({ if(!aio_24){
printk("Disabling 2.6 AIO in tt mode\n");
aio_24 = 1;
} }), (void) 0);
if(!aio_24){ if(!aio_24){
err = init_aio_26(); err = init_aio_26();
if(err && (errno == ENOSYS)){ if(err && (errno == ENOSYS)){
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include "user.h" #include "user.h"
#include "init.h" #include "init.h"
#include "mode.h" #include "mode.h"
#include "choose-mode.h"
#include "uml-config.h" #include "uml-config.h"
#include "os.h" #include "os.h"
#include "um_malloc.h" #include "um_malloc.h"
...@@ -189,16 +188,13 @@ int __init main(int argc, char **argv, char **envp) ...@@ -189,16 +188,13 @@ int __init main(int argc, char **argv, char **envp)
return uml_exitcode; return uml_exitcode;
} }
#define CAN_KMALLOC() \
(kmalloc_ok && CHOOSE_MODE((os_getpid() != tracing_pid), 1))
extern void *__real_malloc(int); extern void *__real_malloc(int);
void *__wrap_malloc(int size) void *__wrap_malloc(int size)
{ {
void *ret; void *ret;
if(!CAN_KMALLOC()) if(!kmalloc_ok)
return __real_malloc(size); return __real_malloc(size);
else if(size <= UM_KERN_PAGE_SIZE) else if(size <= UM_KERN_PAGE_SIZE)
/* finding contiguous pages can be hard*/ /* finding contiguous pages can be hard*/
...@@ -251,11 +247,11 @@ void __wrap_free(void *ptr) ...@@ -251,11 +247,11 @@ void __wrap_free(void *ptr)
*/ */
if((addr >= uml_physmem) && (addr < high_physmem)){ if((addr >= uml_physmem) && (addr < high_physmem)){
if(CAN_KMALLOC()) if(kmalloc_ok)
kfree(ptr); kfree(ptr);
} }
else if((addr >= start_vm) && (addr < end_vm)){ else if((addr >= start_vm) && (addr < end_vm)){
if(CAN_KMALLOC()) if(kmalloc_ok)
vfree(ptr); vfree(ptr);
} }
else __real_free(ptr); else __real_free(ptr);
......
...@@ -53,8 +53,7 @@ void sig_handler(int sig, struct sigcontext *sc) ...@@ -53,8 +53,7 @@ void sig_handler(int sig, struct sigcontext *sc)
block_signals(); block_signals();
CHOOSE_MODE_PROC(sig_handler_common_tt, sig_handler_common_skas, sig_handler_common_skas(sig, sc);
sig, sc);
set_signals(enabled); set_signals(enabled);
} }
...@@ -257,8 +256,7 @@ void unblock_signals(void) ...@@ -257,8 +256,7 @@ void unblock_signals(void)
* back here. * back here.
*/ */
if(save_pending & SIGIO_MASK) if(save_pending & SIGIO_MASK)
CHOOSE_MODE_PROC(sig_handler_common_tt, sig_handler_common_skas(SIGIO, NULL);
sig_handler_common_skas, SIGIO, NULL);
if(save_pending & SIGALRM_MASK) if(save_pending & SIGALRM_MASK)
real_alarm_handler(SIGALRM, NULL); real_alarm_handler(SIGALRM, NULL);
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "init.h" #include "init.h"
#include "os.h" #include "os.h"
#include "uml-config.h" #include "uml-config.h"
#include "choose-mode.h"
#include "mode.h" #include "mode.h"
#include "tempfile.h" #include "tempfile.h"
#include "kern_constants.h" #include "kern_constants.h"
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
void usr2_handler(int sig, union uml_pt_regs *regs) void usr2_handler(int sig, union uml_pt_regs *regs)
{ {
CHOOSE_MODE(syscall_handler_tt(sig, regs), (void) 0);
} }
/* Initialized from linux_main() */ /* Initialized from linux_main() */
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "asm/smp.h" #include "asm/smp.h"
#include "asm/ldt.h" #include "asm/ldt.h"
#include "asm/unistd.h" #include "asm/unistd.h"
#include "choose-mode.h"
#include "kern.h" #include "kern.h"
#include "mode_kern.h" #include "mode_kern.h"
#include "os.h" #include "os.h"
...@@ -506,6 +505,5 @@ void free_ldt(struct mmu_context_skas * mm) ...@@ -506,6 +505,5 @@ void free_ldt(struct mmu_context_skas * mm)
int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount) int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount)
{ {
return CHOOSE_MODE_PROC(do_modify_ldt_tt, do_modify_ldt_skas, func, return do_modify_ldt_skas(func, ptr, bytecount);
ptr, bytecount);
} }
...@@ -230,13 +230,13 @@ static inline unsigned long twd_fxsr_to_i387( struct i387_fxsave_struct *fxsave ...@@ -230,13 +230,13 @@ static inline unsigned long twd_fxsr_to_i387( struct i387_fxsave_struct *fxsave
static inline int convert_fxsr_to_user(struct _fpstate __user *buf, static inline int convert_fxsr_to_user(struct _fpstate __user *buf,
struct pt_regs *regs) struct pt_regs *regs)
{ {
return(CHOOSE_MODE(convert_fxsr_to_user_tt(buf, regs), 0)); return 0;
} }
static inline int convert_fxsr_from_user(struct pt_regs *regs, static inline int convert_fxsr_from_user(struct pt_regs *regs,
struct _fpstate __user *buf) struct _fpstate __user *buf)
{ {
return(CHOOSE_MODE(convert_fxsr_from_user_tt(regs, buf), 0)); return 0;
} }
int get_fpregs(unsigned long buf, struct task_struct *child) int get_fpregs(unsigned long buf, struct task_struct *child)
...@@ -261,12 +261,12 @@ int set_fpregs(unsigned long buf, struct task_struct *child) ...@@ -261,12 +261,12 @@ int set_fpregs(unsigned long buf, struct task_struct *child)
int get_fpxregs(unsigned long buf, struct task_struct *tsk) int get_fpxregs(unsigned long buf, struct task_struct *tsk)
{ {
return(CHOOSE_MODE(get_fpxregs_tt(buf, tsk), 0)); return 0;
} }
int set_fpxregs(unsigned long buf, struct task_struct *tsk) int set_fpxregs(unsigned long buf, struct task_struct *tsk)
{ {
return(CHOOSE_MODE(set_fpxregs_tt(buf, tsk), 0)); return 0;
} }
#ifdef notdef #ifdef notdef
...@@ -286,16 +286,9 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu) ...@@ -286,16 +286,9 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
} }
#endif #endif
static inline void copy_fpu_fxsave(struct pt_regs *regs,
struct user_i387_struct *buf)
{
(void) CHOOSE_MODE(copy_fpu_fxsave_tt(regs, buf), 0);
}
int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu ) int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu )
{ {
copy_fpu_fxsave(regs, (struct user_i387_struct *) fpu); return 1;
return(1);
} }
/* /*
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "frame_kern.h" #include "frame_kern.h"
#include "sigcontext.h" #include "sigcontext.h"
#include "registers.h" #include "registers.h"
#include "mode.h"
#include "skas.h" #include "skas.h"
void copy_sc(union uml_pt_regs *regs, void *from) void copy_sc(union uml_pt_regs *regs, void *from)
...@@ -108,20 +107,13 @@ int copy_sc_to_user_skas(struct sigcontext __user *to, struct _fpstate __user *t ...@@ -108,20 +107,13 @@ int copy_sc_to_user_skas(struct sigcontext __user *to, struct _fpstate __user *t
static int copy_sc_from_user(struct pt_regs *to, void __user *from) static int copy_sc_from_user(struct pt_regs *to, void __user *from)
{ {
int ret; return copy_sc_from_user_skas(to, from);
ret = CHOOSE_MODE(copy_sc_from_user_tt(UPT_SC(&to->regs), from,
sizeof(struct _fpstate)),
copy_sc_from_user_skas(to, from));
return ret;
} }
static int copy_sc_to_user(struct sigcontext __user *to, struct _fpstate __user *fp, static int copy_sc_to_user(struct sigcontext __user *to, struct _fpstate __user *fp,
struct pt_regs *from, unsigned long sp) struct pt_regs *from, unsigned long sp)
{ {
return CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs), return copy_sc_to_user_skas(to, fp, from, sp);
sizeof(*fp), sp),
copy_sc_to_user_skas(to, fp, from, sp));
} }
static int copy_ucontext_to_user(struct ucontext __user *uc, struct _fpstate __user *fp, static int copy_ucontext_to_user(struct ucontext __user *uc, struct _fpstate __user *fp,
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "asm/segment.h" #include "asm/segment.h"
#include "asm/smp.h" #include "asm/smp.h"
#include "asm/desc.h" #include "asm/desc.h"
#include "choose-mode.h"
#include "kern.h" #include "kern.h"
#include "kern_util.h" #include "kern_util.h"
#include "mode_kern.h" #include "mode_kern.h"
...@@ -28,7 +27,7 @@ ...@@ -28,7 +27,7 @@
static int host_supports_tls = -1; static int host_supports_tls = -1;
int host_gdt_entry_tls_min; int host_gdt_entry_tls_min;
int do_set_thread_area_skas(struct user_desc *info) int do_set_thread_area(struct user_desc *info)
{ {
int ret; int ret;
u32 cpu; u32 cpu;
...@@ -39,7 +38,7 @@ int do_set_thread_area_skas(struct user_desc *info) ...@@ -39,7 +38,7 @@ int do_set_thread_area_skas(struct user_desc *info)
return ret; return ret;
} }
int do_get_thread_area_skas(struct user_desc *info) int do_get_thread_area(struct user_desc *info)
{ {
int ret; int ret;
u32 cpu; u32 cpu;
...@@ -277,7 +276,7 @@ asmlinkage int sys_set_thread_area(struct user_desc __user *user_desc) ...@@ -277,7 +276,7 @@ asmlinkage int sys_set_thread_area(struct user_desc __user *user_desc)
return -EFAULT; return -EFAULT;
} }
ret = CHOOSE_MODE_PROC(do_set_thread_area_tt, do_set_thread_area_skas, &info); ret = do_set_thread_area(&info);
if (ret) if (ret)
return ret; return ret;
return set_tls_entry(current, &info, idx, 1); return set_tls_entry(current, &info, idx, 1);
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "asm/sigcontext.h" #include "asm/sigcontext.h"
#include "asm/ptrace.h" #include "asm/ptrace.h"
#include "asm/arch/ucontext.h" #include "asm/arch/ucontext.h"
#include "choose-mode.h"
#include "sysdep/ptrace.h" #include "sysdep/ptrace.h"
#include "frame_kern.h" #include "frame_kern.h"
#include "skas.h" #include "skas.h"
...@@ -135,9 +134,7 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from) ...@@ -135,9 +134,7 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from)
{ {
int ret; int ret;
ret = CHOOSE_MODE(copy_sc_from_user_tt(UPT_SC(&to->regs), from, ret = copy_sc_from_user_skas(to, from);
sizeof(struct _fpstate)),
copy_sc_from_user_skas(to, from));
return(ret); return(ret);
} }
...@@ -146,9 +143,7 @@ static int copy_sc_to_user(struct sigcontext __user *to, ...@@ -146,9 +143,7 @@ static int copy_sc_to_user(struct sigcontext __user *to,
struct pt_regs *from, unsigned long mask, struct pt_regs *from, unsigned long mask,
unsigned long sp) unsigned long sp)
{ {
return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs), return copy_sc_to_user_skas(to, fp, from, mask, sp);
sizeof(*fp), sp),
copy_sc_to_user_skas(to, fp, from, mask, sp)));
} }
struct rt_sigframe struct rt_sigframe
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "asm/ptrace.h" #include "asm/ptrace.h"
#include "asm/unistd.h" #include "asm/unistd.h"
#include "asm/prctl.h" /* XXX This should get the constants from libc */ #include "asm/prctl.h" /* XXX This should get the constants from libc */
#include "choose-mode.h"
#include "kern.h" #include "kern.h"
#include "os.h" #include "os.h"
...@@ -92,8 +91,7 @@ long arch_prctl_skas(struct task_struct *task, int code, ...@@ -92,8 +91,7 @@ long arch_prctl_skas(struct task_struct *task, int code,
long sys_arch_prctl(int code, unsigned long addr) long sys_arch_prctl(int code, unsigned long addr)
{ {
return CHOOSE_MODE_PROC(arch_prctl_tt, arch_prctl_skas, current, code, return arch_prctl_skas(current, code, (unsigned long __user *) addr);
(unsigned long __user *) addr);
} }
long sys_clone(unsigned long clone_flags, unsigned long newsp, long sys_clone(unsigned long clone_flags, unsigned long newsp,
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
#define __UM_A_OUT_H #define __UM_A_OUT_H
#include "asm/arch/a.out.h" #include "asm/arch/a.out.h"
#include "choose-mode.h"
#undef STACK_TOP #undef STACK_TOP
#undef STACK_TOP_MAX #undef STACK_TOP_MAX
...@@ -13,9 +12,7 @@ extern unsigned long host_task_size; ...@@ -13,9 +12,7 @@ extern unsigned long host_task_size;
#define STACK_ROOM (stacksizelim) #define STACK_ROOM (stacksizelim)
extern int honeypot; #define STACK_TOP task_size
#define STACK_TOP \
CHOOSE_MODE((honeypot ? host_task_size : task_size), task_size)
#define STACK_TOP_MAX STACK_TOP #define STACK_TOP_MAX STACK_TOP
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <asm-generic/mm_hooks.h> #include <asm-generic/mm_hooks.h>
#include "linux/sched.h" #include "linux/sched.h"
#include "choose-mode.h"
#include "um_mmu.h" #include "um_mmu.h"
#define get_mmu_context(task) do ; while(0) #define get_mmu_context(task) do ; while(0)
...@@ -30,8 +29,7 @@ static inline void activate_mm(struct mm_struct *old, struct mm_struct *new) ...@@ -30,8 +29,7 @@ static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
* possible. * possible.
*/ */
if (old != new && (current->flags & PF_BORROWED_MM)) if (old != new && (current->flags & PF_BORROWED_MM))
CHOOSE_MODE(force_flush_all(), switch_mm_skas(&new->context.skas.id);
switch_mm_skas(&new->context.skas.id));
} }
static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
...@@ -43,8 +41,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, ...@@ -43,8 +41,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
cpu_clear(cpu, prev->cpu_vm_mask); cpu_clear(cpu, prev->cpu_vm_mask);
cpu_set(cpu, next->cpu_vm_mask); cpu_set(cpu, next->cpu_vm_mask);
if(next != &init_mm) if(next != &init_mm)
CHOOSE_MODE((void) 0, switch_mm_skas(&next->context.skas.id);
switch_mm_skas(&next->context.skas.id));
} }
} }
...@@ -59,15 +56,14 @@ extern int init_new_context_skas(struct task_struct *task, ...@@ -59,15 +56,14 @@ extern int init_new_context_skas(struct task_struct *task,
static inline int init_new_context(struct task_struct *task, static inline int init_new_context(struct task_struct *task,
struct mm_struct *mm) struct mm_struct *mm)
{ {
return(CHOOSE_MODE_PROC(init_new_context_tt, init_new_context_skas, return(init_new_context_skas(task, mm));
task, mm));
} }
extern void destroy_context_skas(struct mm_struct *mm); extern void destroy_context_skas(struct mm_struct *mm);
static inline void destroy_context(struct mm_struct *mm) static inline void destroy_context(struct mm_struct *mm)
{ {
CHOOSE_MODE((void) 0, destroy_context_skas(mm)); destroy_context_skas(mm);
} }
#endif #endif
......
...@@ -11,7 +11,6 @@ struct pt_regs; ...@@ -11,7 +11,6 @@ struct pt_regs;
struct task_struct; struct task_struct;
#include "asm/ptrace.h" #include "asm/ptrace.h"
#include "choose-mode.h"
#include "registers.h" #include "registers.h"
#include "sysdep/archsetjmp.h" #include "sysdep/archsetjmp.h"
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "sysdep/ptrace.h" #include "sysdep/ptrace.h"
#include "asm/ptrace-generic.h" #include "asm/ptrace-generic.h"
#include "asm/host_ldt.h" #include "asm/host_ldt.h"
#include "choose-mode.h"
#define PT_REGS_EAX(r) UPT_EAX(&(r)->regs) #define PT_REGS_EAX(r) UPT_EAX(&(r)->regs)
#define PT_REGS_EBX(r) UPT_EBX(&(r)->regs) #define PT_REGS_EBX(r) UPT_EBX(&(r)->regs)
...@@ -59,15 +58,8 @@ extern int arch_switch_tls_tt(struct task_struct *from, struct task_struct *to); ...@@ -59,15 +58,8 @@ extern int arch_switch_tls_tt(struct task_struct *from, struct task_struct *to);
extern void arch_switch_to_tt(struct task_struct *from, struct task_struct *to); extern void arch_switch_to_tt(struct task_struct *from, struct task_struct *to);
extern void arch_switch_to_skas(struct task_struct *from, struct task_struct *to); extern void arch_switch_to_skas(struct task_struct *from, struct task_struct *to);
static inline int do_get_thread_area(struct user_desc *info) extern int do_get_thread_area_skas(struct user_desc *info);
{ extern int do_set_thread_area_skas(struct user_desc *info);
return CHOOSE_MODE_PROC(do_get_thread_area_tt, do_get_thread_area_skas, info);
}
static inline int do_set_thread_area(struct user_desc *info)
{
return CHOOSE_MODE_PROC(do_set_thread_area_tt, do_set_thread_area_skas, info);
}
struct task_struct; struct task_struct;
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#define __UM_TLBFLUSH_H #define __UM_TLBFLUSH_H
#include <linux/mm.h> #include <linux/mm.h>
#include "choose-mode.h"
/* /*
* TLB flushing: * TLB flushing:
...@@ -31,10 +30,7 @@ extern void flush_tlb_page_skas(struct vm_area_struct *vma, ...@@ -31,10 +30,7 @@ extern void flush_tlb_page_skas(struct vm_area_struct *vma,
static inline void flush_tlb_page(struct vm_area_struct *vma, static inline void flush_tlb_page(struct vm_area_struct *vma,
unsigned long address) unsigned long address)
{ {
address &= PAGE_MASK; flush_tlb_page_skas(vma, address & PAGE_MASK);
CHOOSE_MODE(flush_tlb_range(vma, address, address + PAGE_SIZE),
flush_tlb_page_skas(vma, address));
} }
extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr); extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
__put_user(x, private_ptr) : -EFAULT); \ __put_user(x, private_ptr) : -EFAULT); \
}) })
#define strlen_user(str) strnlen_user(str, ~0UL >> 1) #define strlen_user(str) strnlen_user(str, ~0U >> 1)
struct exception_table_entry struct exception_table_entry
{ {
......
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