Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
c438a80a
Commit
c438a80a
authored
Nov 19, 2002
by
Jeff Dike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged the skas exec reorg.
parent
08cca5ac
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
255 additions
and
13 deletions
+255
-13
arch/um/Kconfig
arch/um/Kconfig
+7
-0
arch/um/Makefile
arch/um/Makefile
+10
-7
arch/um/include/choose-mode.h
arch/um/include/choose-mode.h
+35
-0
arch/um/kernel/Makefile
arch/um/kernel/Makefile
+5
-4
arch/um/kernel/exec_kern.c
arch/um/kernel/exec_kern.c
+6
-2
arch/um/kernel/skas/exec_kern.c
arch/um/kernel/skas/exec_kern.c
+41
-0
arch/um/kernel/skas/exec_user.c
arch/um/kernel/skas/exec_user.c
+61
-0
arch/um/kernel/tt/Makefile
arch/um/kernel/tt/Makefile
+4
-0
arch/um/kernel/tt/exec_kern.c
arch/um/kernel/tt/exec_kern.c
+83
-0
arch/um/kernel/tt/exec_user.c
arch/um/kernel/tt/exec_user.c
+0
-0
arch/um/kernel/um_arch.c
arch/um/kernel/um_arch.c
+3
-0
No files found.
arch/um/Kconfig
View file @
c438a80a
...
@@ -30,6 +30,13 @@ config RWSEM_GENERIC_SPINLOCK
...
@@ -30,6 +30,13 @@ config RWSEM_GENERIC_SPINLOCK
bool
bool
default y
default y
config MODE_TT
bool
default y
config MODE_SKAS
bool
default y
menu "Code maturity level options"
menu "Code maturity level options"
...
...
arch/um/Makefile
View file @
c438a80a
...
@@ -52,8 +52,8 @@ SYMLINK_HEADERS = include/asm-um/archparam.h include/asm-um/system.h \
...
@@ -52,8 +52,8 @@ SYMLINK_HEADERS = include/asm-um/archparam.h include/asm-um/system.h \
include/asm-um/sigcontext.h include/asm-um/processor.h
\
include/asm-um/sigcontext.h include/asm-um/processor.h
\
include/asm-um/ptrace.h include/asm-um/arch-signal.h
include/asm-um/ptrace.h include/asm-um/arch-signal.h
ARCH_SYMLINKS
=
include/asm-um/arch
arch
/um/include/sysdep
arch
/um
/os
\
ARCH_SYMLINKS
=
include/asm-um/arch
$(ARCH_DIR)
/include/sysdep
$(ARCH_DIR)
/os
\
$(SYMLINK_HEADERS)
$(SYMLINK_HEADERS)
$(ARCH_DIR)
/include/uml-config.h
GEN_HEADERS
=
$(ARCH_DIR)
/include/task.h
GEN_HEADERS
=
$(ARCH_DIR)
/include/task.h
...
@@ -75,8 +75,8 @@ $(ARCH_DIR)/uml.lds.s : $(ARCH_DIR)/uml.lds.S scripts FORCE
...
@@ -75,8 +75,8 @@ $(ARCH_DIR)/uml.lds.s : $(ARCH_DIR)/uml.lds.S scripts FORCE
AFLAGS_uml.lds.o
=
-U
$(SUBARCH)
-DSTART
=
$$
((
$(TOP_ADDR)
-
$(SIZE)
))
\
AFLAGS_uml.lds.o
=
-U
$(SUBARCH)
-DSTART
=
$$
((
$(TOP_ADDR)
-
$(SIZE)
))
\
-DELF_ARCH
=
$(ELF_ARCH)
-DELF_FORMAT
=
\"
$(ELF_FORMAT)
\"
-P
-C
-Uum
-DELF_ARCH
=
$(ELF_ARCH)
-DELF_FORMAT
=
\"
$(ELF_FORMAT)
\"
-P
-C
-Uum
linux
:
arch/um
/uml.lds.s vmlinux
linux
:
$(ARCH_DIR)
/uml.lds.s vmlinux
$(CC)
-Wl
,-T,
arch/um
/uml.lds.s
-o
$@
$(LINK_PROFILE)
\
$(CC)
-Wl
,-T,
$(ARCH_DIR)
/uml.lds.s
-o
$@
$(LINK_PROFILE)
\
$(LINK_WRAPS)
-static
vmlinux
-L
/usr/lib
-lutil
$(LINK_WRAPS)
-static
vmlinux
-L
/usr/lib
-lutil
...
@@ -121,12 +121,15 @@ $(SYMLINK_HEADERS):
...
@@ -121,12 +121,15 @@ $(SYMLINK_HEADERS):
include/asm-um/arch
:
include/asm-um/arch
:
cd
$(TOPDIR)
/include/asm-um
&&
ln
-sf
../asm-
$(SUBARCH)
arch
cd
$(TOPDIR)
/include/asm-um
&&
ln
-sf
../asm-
$(SUBARCH)
arch
arch/um
/include/sysdep
:
$(ARCH_DIR)
/include/sysdep
:
cd
$(
TOPDIR)
/arch/um
/include
&&
ln
-sf
sysdep-
$(SUBARCH)
sysdep
cd
$(
ARCH_DIR)
/include
&&
ln
-sf
sysdep-
$(SUBARCH)
sysdep
arch/um
/os
:
$(ARCH_DIR)
/os
:
cd
$(ARCH_DIR)
&&
ln
-sf
os-
$(OS)
os
cd
$(ARCH_DIR)
&&
ln
-sf
os-
$(OS)
os
$(ARCH_DIR)/include/uml-config.h
:
ln
-sf
$(TOPDIR)
/include/linux/autoconf.h
$@
$(ARCH_DIR)/include/task.h
:
$(ARCH_DIR)/util/mk_task
$(ARCH_DIR)/include/task.h
:
$(ARCH_DIR)/util/mk_task
$<
>
$@
$<
>
$@
...
...
arch/um/include/choose-mode.h
0 → 100644
View file @
c438a80a
/*
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#ifndef __CHOOSE_MODE_H__
#define __CHOOSE_MODE_H__
#include "uml-config.h"
#if defined(CONFIG_MODE_TT) && defined(CONFIG_MODE_SKAS)
#define CHOOSE_MODE(tt, skas) (mode_tt ? (tt) : (skas))
#elif defined(CONFIG_MODE_SKAS)
#define CHOOSE_MODE(tt, skas) (skas)
#elif defined(CONFIG_MODE_TT)
#define CHOOSE_MODE(tt, skas) (tt)
#endif
#define CHOOSE_MODE_PROC(tt, skas, args...) \
CHOOSE_MODE(tt(args), skas(args))
#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:
*/
arch/um/kernel/Makefile
View file @
c438a80a
...
@@ -5,9 +5,9 @@
...
@@ -5,9 +5,9 @@
EXTRA_TARGETS
:=
unmap_fin.o
EXTRA_TARGETS
:=
unmap_fin.o
obj-y
=
config.o exec_kern.o ex
ec_user.o exitcode.o frame_kern.o frame
.o
\
obj-y
=
config.o exec_kern.o ex
itcode.o frame_kern.o frame.o helper
.o
\
helper.o init_task.o irq.o irq_user.o ksyms.o mem.o mem_user
.o
\
init_task.o irq.o irq_user.o ksyms.o mem.o mem_user.o process
.o
\
process
.o process
_kern.o ptrace.o reboot.o resource.o sigio_user.o
\
process_kern.o ptrace.o reboot.o resource.o sigio_user.o
\
sigio_kern.o signal_kern.o signal_user.o smp.o syscall_kern.o
\
sigio_kern.o signal_kern.o signal_user.o smp.o syscall_kern.o
\
syscall_user.o sysrq.o sys_call_table.o tempfile.o time.o
\
syscall_user.o sysrq.o sys_call_table.o tempfile.o time.o
\
time_kern.o tlb.o trap_kern.o trap_user.o uaccess_user.o um_arch.o
\
time_kern.o tlb.o trap_kern.o trap_user.o uaccess_user.o um_arch.o
\
...
@@ -18,7 +18,8 @@ obj-$(CONFIG_GPROF) += gprof_syms.o
...
@@ -18,7 +18,8 @@ obj-$(CONFIG_GPROF) += gprof_syms.o
obj-$(CONFIG_GCOV)
+=
gmon_syms.o
obj-$(CONFIG_GCOV)
+=
gmon_syms.o
obj-$(CONFIG_TTY_LOG)
+=
tty_log.o
obj-$(CONFIG_TTY_LOG)
+=
tty_log.o
obj-$(CONFIG_PT_PROXY)
+=
tt/
obj-$(CONFIG_MODE_TT)
+=
tt/
obj-$(CONFIG_MODE_SKAS)
+=
tt/
user-objs-$(CONFIG_TTY_LOG)
+=
tty_log.o
user-objs-$(CONFIG_TTY_LOG)
+=
tty_log.o
...
...
arch/um/kernel/exec_kern.c
View file @
c438a80a
...
@@ -93,8 +93,12 @@ static int execve1(char *file, char **argv, char **env)
...
@@ -93,8 +93,12 @@ static int execve1(char *file, char **argv, char **env)
int
um_execve
(
char
*
file
,
char
**
argv
,
char
**
env
)
int
um_execve
(
char
*
file
,
char
**
argv
,
char
**
env
)
{
{
if
(
execve1
(
file
,
argv
,
env
)
==
0
)
do_longjmp
(
current
->
thread
.
jmp
);
int
err
;
return
(
-
1
);
err
=
execve1
(
file
,
argv
,
env
);
if
(
!
err
)
do_longjmp
(
current
->
thread
.
exec_buf
,
1
);
return
(
err
);
}
}
int
sys_execve
(
char
*
file
,
char
**
argv
,
char
**
env
)
int
sys_execve
(
char
*
file
,
char
**
argv
,
char
**
env
)
...
...
arch/um/kernel/skas/exec_kern.c
0 → 100644
View file @
c438a80a
/*
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#include "linux/kernel.h"
#include "asm/current.h"
#include "asm/page.h"
#include "asm/signal.h"
#include "asm/ptrace.h"
#include "asm/uaccess.h"
#include "asm/mmu_context.h"
#include "tlb.h"
#include "skas.h"
#include "mmu.h"
#include "os.h"
void
flush_thread_skas
(
void
)
{
force_flush_all
();
switch_mm_skas
(
current
->
mm
->
context
.
skas
.
mm_fd
);
}
void
start_thread_skas
(
struct
pt_regs
*
regs
,
unsigned
long
eip
,
unsigned
long
esp
)
{
set_fs
(
USER_DS
);
PT_REGS_IP
(
regs
)
=
eip
;
PT_REGS_SP
(
regs
)
=
esp
;
}
/*
* 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:
*/
arch/um/kernel/skas/exec_user.c
0 → 100644
View file @
c438a80a
/*
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
#include <sched.h>
#include <sys/wait.h>
#include <sys/ptrace.h>
#include "user.h"
#include "kern_util.h"
#include "os.h"
#include "time_user.h"
static
int
user_thread_tramp
(
void
*
arg
)
{
if
(
ptrace
(
PTRACE_TRACEME
,
0
,
0
,
0
)
<
0
)
panic
(
"user_thread_tramp - PTRACE_TRACEME failed, "
"errno = %d
\n
"
,
errno
);
enable_timer
();
os_stop_process
(
os_getpid
());
return
(
0
);
}
int
user_thread
(
unsigned
long
stack
,
int
flags
)
{
int
pid
,
status
;
pid
=
clone
(
user_thread_tramp
,
(
void
*
)
stack_sp
(
stack
),
flags
|
CLONE_FILES
|
SIGCHLD
,
NULL
);
if
(
pid
<
0
){
printk
(
"user_thread - clone failed, errno = %d
\n
"
,
errno
);
return
(
pid
);
}
if
(
waitpid
(
pid
,
&
status
,
WUNTRACED
)
<
0
){
printk
(
"user_thread - waitpid failed, errno = %d
\n
"
,
errno
);
return
(
-
errno
);
}
if
(
!
WIFSTOPPED
(
status
)
||
(
WSTOPSIG
(
status
)
!=
SIGSTOP
)){
printk
(
"user_thread - trampoline didn't stop, status = %d
\n
"
,
status
);
return
(
-
EINVAL
);
}
return
(
pid
);
}
/*
* 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:
*/
arch/um/kernel/tt/Makefile
View file @
c438a80a
...
@@ -3,6 +3,10 @@
...
@@ -3,6 +3,10 @@
# Licensed under the GPL
# Licensed under the GPL
#
#
O_TARGET
=
tt.o
obj-y
=
exec_kern.o exec_user.o
obj-$(CONFIG_PT_PROXY)
+=
ptproxy/
obj-$(CONFIG_PT_PROXY)
+=
ptproxy/
include
$(TOPDIR)/Rules.make
include
$(TOPDIR)/Rules.make
...
...
arch/um/kernel/tt/exec_kern.c
0 → 100644
View file @
c438a80a
/*
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#include "linux/kernel.h"
#include "linux/mm.h"
#include "asm/signal.h"
#include "asm/ptrace.h"
#include "asm/uaccess.h"
#include "asm/pgalloc.h"
#include "user_util.h"
#include "kern_util.h"
#include "irq_user.h"
#include "time_user.h"
#include "mem_user.h"
#include "os.h"
#include "tlb.h"
static
int
exec_tramp
(
void
*
sig_stack
)
{
init_new_thread_stack
(
sig_stack
,
NULL
);
init_new_thread_signals
(
1
);
os_stop_process
(
os_getpid
());
return
(
0
);
}
void
flush_thread_tt
(
void
)
{
unsigned
long
stack
;
int
new_pid
;
stack
=
alloc_stack
(
0
,
0
);
if
(
stack
==
0
){
printk
(
KERN_ERR
"flush_thread : failed to allocate temporary stack
\n
"
);
do_exit
(
SIGKILL
);
}
new_pid
=
start_fork_tramp
((
void
*
)
current
->
thread
.
kernel_stack
,
stack
,
0
,
exec_tramp
);
if
(
new_pid
<
0
){
printk
(
KERN_ERR
"flush_thread : new thread failed, errno = %d
\n
"
,
-
new_pid
);
do_exit
(
SIGKILL
);
}
if
(
current
->
processor
==
0
)
forward_interrupts
(
new_pid
);
current
->
thread
.
request
.
op
=
OP_EXEC
;
current
->
thread
.
request
.
u
.
exec
.
pid
=
new_pid
;
unprotect_stack
((
unsigned
long
)
current
);
os_usr1_process
(
os_getpid
());
enable_timer
();
free_page
(
stack
);
protect_memory
(
uml_reserved
,
high_physmem
-
uml_reserved
,
1
,
1
,
0
,
1
);
task_protections
((
unsigned
long
)
current
);
force_flush_all
();
unblock_signals
();
}
void
start_thread_tt
(
struct
pt_regs
*
regs
,
unsigned
long
eip
,
unsigned
long
esp
)
{
set_fs
(
USER_DS
);
flush_tlb_mm
(
current
->
mm
);
PT_REGS_IP
(
regs
)
=
eip
;
PT_REGS_SP
(
regs
)
=
esp
;
PT_FIX_EXEC_STACK
(
esp
);
}
/*
* 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:
*/
arch/um/kernel/exec_user.c
→
arch/um/kernel/
tt/
exec_user.c
View file @
c438a80a
File moved
arch/um/kernel/um_arch.c
View file @
c438a80a
...
@@ -293,6 +293,9 @@ int linux_main(int argc, char **argv)
...
@@ -293,6 +293,9 @@ int linux_main(int argc, char **argv)
if
(
!
jail
||
debug
)
if
(
!
jail
||
debug
)
remap_data
(
ROUND_DOWN
(
&
_stext
),
ROUND_UP
(
&
_etext
),
1
);
remap_data
(
ROUND_DOWN
(
&
_stext
),
ROUND_UP
(
&
_etext
),
1
);
remap_data
(
ROUND_DOWN
(
&
_sdata
),
ROUND_UP
(
&
_edata
),
1
);
remap_data
(
ROUND_DOWN
(
&
_sdata
),
ROUND_UP
(
&
_edata
),
1
);
mode_tt
=
1
;
brk_start
=
(
unsigned
long
)
sbrk
(
0
);
brk_start
=
(
unsigned
long
)
sbrk
(
0
);
remap_data
(
ROUND_DOWN
(
&
__bss_start
),
ROUND_UP
(
brk_start
),
1
);
remap_data
(
ROUND_DOWN
(
&
__bss_start
),
ROUND_UP
(
brk_start
),
1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment