Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83175
b: refs/heads/master
c: edea138
h: refs/heads/master
i:
  83173: 0cfa78e
  83171: c43e89c
  83167: b54e5e8
v: v3
  • Loading branch information
Jeff Dike authored and Linus Torvalds committed Feb 5, 2008
1 parent f6bbd34 commit cb19e7e
Show file tree
Hide file tree
Showing 26 changed files with 90 additions and 174 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0ba7fe03b638a084a4e15e21d2e585ba321ad9c8
refs/heads/master: edea138584d7586a3b93b6d5ab5ec021d18e11e9
1 change: 1 addition & 0 deletions trunk/arch/um/drivers/line.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "chan_kern.h"
#include "irq_kern.h"
#include "irq_user.h"
#include "kern_util.h"
#include "os.h"

#define LINE_BUFSIZE 4096
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/um/drivers/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "line.h"
#include "ssl.h"
#include "chan_kern.h"
#include "kern_util.h"
#include "kern.h"
#include "init.h"
#include "irq_user.h"
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/um/drivers/stdio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "stdio_console.h"
#include "line.h"
#include "chan_kern.h"
#include "kern_util.h"
#include "irq_user.h"
#include "mconsole_kern.h"
#include "init.h"
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/um/drivers/ubd_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "irq_user.h"
#include "irq_kern.h"
#include "ubd_user.h"
#include "kern_util.h"
#include "os.h"
#include "mem.h"
#include "mem_kern.h"
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/um/drivers/ubd_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <sys/mman.h>
#include <sys/param.h>
#include "asm/types.h"
#include "kern_util.h"
#include "user.h"
#include "ubd_user.h"
#include "os.h"
Expand Down
118 changes: 35 additions & 83 deletions trunk/arch/um/include/kern_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,107 +9,59 @@
#include "sysdep/ptrace.h"
#include "sysdep/faultinfo.h"

typedef void (*kern_hndl)(int, struct uml_pt_regs *);

struct kern_handlers {
kern_hndl relay_signal;
kern_hndl winch;
kern_hndl bus_handler;
kern_hndl page_fault;
kern_hndl sigio_handler;
kern_hndl timer_handler;
};

extern const struct kern_handlers handlinfo_kern;

extern int ncpus;
extern char *gdb_init;
extern int kmalloc_ok;
extern int jail;
extern int nsyscalls;

#define UML_ROUND_DOWN(addr) ((void *)(((unsigned long) addr) & PAGE_MASK))
#define UML_ROUND_UP(addr) \
UML_ROUND_DOWN(((unsigned long) addr) + PAGE_SIZE - 1)
((((unsigned long) addr) + PAGE_SIZE - 1) & PAGE_MASK)

extern int kernel_fork(unsigned long flags, int (*fn)(void *), void * arg);
extern int kernel_thread_proc(void *data);
extern void syscall_segv(int sig);
extern int current_pid(void);
extern unsigned long alloc_stack(int order, int atomic);
extern void free_stack(unsigned long stack, int order);

extern int do_signal(void);
extern int is_stack_fault(unsigned long sp);
extern void copy_sc(struct uml_pt_regs *regs, void *from);
extern void interrupt_end(void);
extern void relay_signal(int sig, struct uml_pt_regs *regs);

extern unsigned long segv(struct faultinfo fi, unsigned long ip,
int is_user, struct uml_pt_regs *regs);
extern int handle_page_fault(unsigned long address, unsigned long ip,
int is_write, int is_user, int *code_out);
extern void syscall_ready(void);
extern void set_tracing(void *t, int tracing);
extern int is_tracing(void *task);
extern int segv_syscall(void);
extern void kern_finish_exec(void *task, int new_pid, unsigned long stack);
extern unsigned long page_mask(void);
extern int need_finish_fork(void);
extern void free_stack(unsigned long stack, int order);
extern void add_input_request(int op, void (*proc)(int), void *arg);
extern char *current_cmd(void);
extern void timer_handler(int sig, struct uml_pt_regs *regs);
extern int set_signals(int enable);
extern int pid_to_processor_id(int pid);
extern void deliver_signals(void *t);
extern int next_trap_index(int max);
extern void default_idle(void);
extern void finish_fork(void);
extern void paging_init(void);
extern void init_flush_vm(void);
extern void *syscall_sp(void *t);
extern void syscall_trace(struct uml_pt_regs *regs, int entryexit);

extern unsigned int do_IRQ(int irq, struct uml_pt_regs *regs);
extern void interrupt_end(void);
extern void initial_thread_cb(void (*proc)(void *), void *arg);
extern int debugger_signal(int status, int pid);
extern void debugger_parent_signal(int status, int pid);
extern void child_signal(int pid, int status);
extern int init_ptrace_proxy(int idle_pid, int startup, int stop);
extern int init_parent_proxy(int pid);
extern int singlestepping(void *t);
extern void check_stack_overflow(void *ptr);
extern void relay_signal(int sig, struct uml_pt_regs *regs);
extern int user_context(unsigned long sp);
extern void timer_irq(struct uml_pt_regs *regs);
extern void do_uml_exitcalls(void);
extern int attach_debugger(int idle_pid, int pid, int stop);
extern int config_gdb(char *str);
extern int remove_gdb(void);
extern char *uml_strdup(const char *string);
extern void unprotect_kernel_mem(void);
extern void protect_kernel_mem(void);
extern void uml_cleanup(void);
extern void lock_signalled_task(void *t);
extern void IPI_handler(int cpu);
extern int jail_setup(char *line, int *add);
extern void *get_init_task(void);
extern int clear_user_proc(void *buf, int size);
extern int copy_to_user_proc(void *to, void *from, int size);
extern int copy_from_user_proc(void *to, void *from, int size);
extern int strlen_user_proc(char *str);
extern long execute_syscall(void *r);
extern int smp_sigio_handler(void);
extern void *get_current(void);
extern struct task_struct *get_task(int pid, int require);
extern void machine_halt(void);
extern void initial_thread_cb(void (*proc)(void *), void *arg);
extern int is_syscall(unsigned long addr);
extern void timer_handler(int sig, struct uml_pt_regs *regs);

extern void free_irq(unsigned int, void *);
extern int cpu(void);
extern void timer_handler(int sig, struct uml_pt_regs *regs);

extern int start_uml(void);
extern void paging_init(void);

extern void time_init_kern(void);
extern void uml_cleanup(void);
extern void do_uml_exitcalls(void);

/* Are we disallowed to sleep? Used to choose between GFP_KERNEL and GFP_ATOMIC. */
/*
* Are we disallowed to sleep? Used to choose between GFP_KERNEL and
* GFP_ATOMIC.
*/
extern int __cant_sleep(void);
extern void sigio_handler(int sig, struct uml_pt_regs *regs);
extern void copy_sc(struct uml_pt_regs *regs, void *from);
extern void *get_current(void);
extern int copy_from_user_proc(void *to, void *from, int size);
extern int cpu(void);
extern char *uml_strdup(const char *string);

extern unsigned long to_irq_stack(unsigned long *mask_out);
unsigned long from_irq_stack(int nested);
extern int start_uml(void);
extern unsigned long from_irq_stack(int nested);

extern void syscall_trace(struct uml_pt_regs *regs, int entryexit);
extern int singlestepping(void *t);

extern void segv_handler(int sig, struct uml_pt_regs *regs);
extern void bus_handler(int sig, struct uml_pt_regs *regs);
extern void winch(int sig, struct uml_pt_regs *regs);


#endif
4 changes: 0 additions & 4 deletions trunk/arch/um/include/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include <stdarg.h>
#include "irq_user.h"
#include "kern_util.h"
#include "longjmp.h"
#include "mm_id.h"
#include "sysdep/tls.h"
Expand Down Expand Up @@ -237,9 +236,6 @@ extern void unblock_signals(void);
extern int get_signals(void);
extern int set_signals(int enable);

/* trap.c */
extern void os_fill_handlinfo(struct kern_handlers h);

/* util.c */
extern void stack_protections(unsigned long address);
extern int raw(int fd);
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/um/kernel/initrd.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "linux/bootmem.h"
#include "linux/initrd.h"
#include "asm/types.h"
#include "kern_util.h"
#include "initrd.h"
#include "init.h"
#include "os.h"
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/um/kernel/reboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#include "linux/sched.h"
#include "kern_util.h"
#include "os.h"
#include "skas.h"

Expand Down
1 change: 0 additions & 1 deletion trunk/arch/um/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
#include "asm/smp.h"
#include "asm/processor.h"
#include "asm/spinlock.h"
#include "kern_util.h"
#include "kern.h"
#include "irq_user.h"
#include "os.h"
Expand Down
15 changes: 3 additions & 12 deletions trunk/arch/um/kernel/trap.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static void bad_segv(struct faultinfo fi, unsigned long ip)
force_sig_info(SIGSEGV, &si, current);
}

static void segv_handler(int sig, struct uml_pt_regs *regs)
void segv_handler(int sig, struct uml_pt_regs *regs)
{
struct faultinfo * fi = UPT_FAULTINFO(regs);

Expand Down Expand Up @@ -229,27 +229,18 @@ void relay_signal(int sig, struct uml_pt_regs *regs)
force_sig(sig, current);
}

static void bus_handler(int sig, struct uml_pt_regs *regs)
void bus_handler(int sig, struct uml_pt_regs *regs)
{
if (current->thread.fault_catcher != NULL)
UML_LONGJMP(current->thread.fault_catcher, 1);
else relay_signal(sig, regs);
}

static void winch(int sig, struct uml_pt_regs *regs)
void winch(int sig, struct uml_pt_regs *regs)
{
do_IRQ(WINCH_IRQ, regs);
}

const struct kern_handlers handlinfo_kern = {
.relay_signal = relay_signal,
.winch = winch,
.bus_handler = bus_handler,
.page_fault = segv_handler,
.sigio_handler = sigio_handler,
.timer_handler = timer_handler
};

void trap_init(void)
{
}
6 changes: 1 addition & 5 deletions trunk/arch/um/kernel/um_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "as-layout.h"
#include "init.h"
#include "kern.h"
#include "kern_util.h"
#include "mem_user.h"
#include "os.h"
#include "skas.h"
Expand Down Expand Up @@ -280,11 +281,6 @@ int __init linux_main(int argc, char **argv)

host_task_size = set_task_sizes_skas(&task_size);

/*
* Setting up handlers to 'sig_info' struct
*/
os_fill_handlinfo(handlinfo_kern);

brk_start = (unsigned long) sbrk(0);

/*
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/um/os-Linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
#

obj-y = aio.o elf_aux.o execvp.o file.o helper.o irq.o main.o mem.o process.o \
registers.o sigio.o signal.o start_up.o time.o trap.o tty.o uaccess.o \
registers.o sigio.o signal.o start_up.o time.o tty.o uaccess.o \
umid.o tls.o user_syms.o util.o drivers/ sys-$(SUBARCH)/ skas/

obj-$(CONFIG_TTY_LOG) += tty_log.o
user-objs-$(CONFIG_TTY_LOG) += tty_log.o

USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \
main.o mem.o process.o registers.o sigio.o signal.o start_up.o time.o \
trap.o tty.o tls.o uaccess.o umid.o util.o
tty.o tls.o uaccess.o umid.o util.o

CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH)

Expand Down
1 change: 1 addition & 0 deletions trunk/arch/um/os-Linux/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "aio.h"
#include "init.h"
#include "kern_constants.h"
#include "kern_util.h"
#include "os.h"
#include "user.h"

Expand Down
1 change: 1 addition & 0 deletions trunk/arch/um/os-Linux/drivers/tuntap_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <sys/wait.h>
#include <sys/uio.h>
#include "kern_constants.h"
#include "kern_util.h"
#include "os.h"
#include "tuntap.h"
#include "user.h"
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/um/os-Linux/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <sys/uio.h>
#include "os.h"
#include "user.h"
#include "kern_util.h"

static void copy_stat(struct uml_stat *dst, const struct stat64 *src)
{
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/um/os-Linux/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <sys/poll.h>
#include <sys/types.h>
#include <sys/time.h>
#include "kern_util.h"
#include "user.h"
#include "process.h"
#include "sigio.h"
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/um/os-Linux/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/statfs.h>
#include "kern_util.h"
#include "user.h"
#include "mem_user.h"
#include "init.h"
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/um/os-Linux/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <errno.h>
#include <signal.h>
#include <strings.h>
#include "kern_util.h"
#include "os.h"
#include "sysdep/barrier.h"
#include "sysdep/sigcontext.h"
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/um/os-Linux/skas/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "as-layout.h"
#include "chan_user.h"
#include "kern_constants.h"
#include "kern_util.h"
#include "mem.h"
#include "os.h"
#include "process.h"
Expand Down
18 changes: 11 additions & 7 deletions trunk/arch/um/os-Linux/skas/trap.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@
* Licensed under the GPL
*/

#if 0
#include "kern_util.h"
#include "skas.h"
#include "ptrace_user.h"
#include "sysdep/ptrace_user.h"
#endif

#include <errno.h>
#include <signal.h>
#include "sysdep/ptrace.h"
#include "kern_constants.h"
#include "as-layout.h"
#include "kern_util.h"
#include "os.h"
#include "sigcontext.h"
#include "task.h"

void (*sig_info[NSIG])(int, struct uml_pt_regs *) = {
[SIGTRAP] = relay_signal,
[SIGFPE] = relay_signal,
[SIGILL] = relay_signal,
[SIGWINCH] = winch,
[SIGBUS] = bus_handler,
[SIGSEGV] = segv_handler,
[SIGIO] = sigio_handler,
[SIGVTALRM] = timer_handler };

static struct uml_pt_regs ksig_regs[UM_NR_CPUS];

void sig_handler_common_skas(int sig, void *sc_ptr)
Expand Down
Loading

0 comments on commit cb19e7e

Please sign in to comment.