diff options
Diffstat (limited to 'arch/mn10300/kernel')
-rw-r--r-- | arch/mn10300/kernel/init_task.c | 39 | ||||
-rw-r--r-- | arch/mn10300/kernel/kernel_execve.S | 37 | ||||
-rw-r--r-- | arch/mn10300/kernel/kthread.S | 31 |
3 files changed, 107 insertions, 0 deletions
diff --git a/arch/mn10300/kernel/init_task.c b/arch/mn10300/kernel/init_task.c new file mode 100644 index 00000000000..a481b043bea --- /dev/null +++ b/arch/mn10300/kernel/init_task.c | |||
@@ -0,0 +1,39 @@ | |||
1 | /* MN10300 Initial task definitions | ||
2 | * | ||
3 | * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. | ||
4 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | #include <linux/mm.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/sched.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/init_task.h> | ||
16 | #include <linux/fs.h> | ||
17 | #include <linux/mqueue.h> | ||
18 | #include <asm/uaccess.h> | ||
19 | #include <asm/pgtable.h> | ||
20 | |||
21 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
22 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
23 | /* | ||
24 | * Initial thread structure. | ||
25 | * | ||
26 | * We need to make sure that this is THREAD_SIZE aligned due to the | ||
27 | * way process stacks are handled. This is done by having a special | ||
28 | * "init_task" linker map entry.. | ||
29 | */ | ||
30 | union thread_union init_thread_union __init_task_data = | ||
31 | { INIT_THREAD_INFO(init_task) }; | ||
32 | |||
33 | /* | ||
34 | * Initial task structure. | ||
35 | * | ||
36 | * All other task structs will be allocated on slabs in fork.c | ||
37 | */ | ||
38 | struct task_struct init_task = INIT_TASK(init_task); | ||
39 | EXPORT_SYMBOL(init_task); | ||
diff --git a/arch/mn10300/kernel/kernel_execve.S b/arch/mn10300/kernel/kernel_execve.S new file mode 100644 index 00000000000..86039f10526 --- /dev/null +++ b/arch/mn10300/kernel/kernel_execve.S | |||
@@ -0,0 +1,37 @@ | |||
1 | /* MN10300 In-kernel program execution | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | #include <linux/linkage.h> | ||
12 | #include <asm/unistd.h> | ||
13 | |||
14 | ############################################################################### | ||
15 | # | ||
16 | # Do a system call from kernel instead of calling sys_execve so we end up with | ||
17 | # proper pt_regs. | ||
18 | # | ||
19 | # int kernel_execve(const char *filename, char *const argv[], | ||
20 | # char *const envp[]) | ||
21 | # | ||
22 | # On entry: D0/D1/8(SP): arguments to function | ||
23 | # On return: D0: syscall return. | ||
24 | # | ||
25 | ############################################################################### | ||
26 | .globl kernel_execve | ||
27 | .type kernel_execve,@function | ||
28 | kernel_execve: | ||
29 | mov a3,a1 | ||
30 | mov d0,a0 | ||
31 | mov (12,sp),a3 | ||
32 | mov +__NR_execve,d0 | ||
33 | syscall 0 | ||
34 | mov a1,a3 | ||
35 | rets | ||
36 | |||
37 | .size kernel_execve,.-kernel_execve | ||
diff --git a/arch/mn10300/kernel/kthread.S b/arch/mn10300/kernel/kthread.S new file mode 100644 index 00000000000..b5ae467ac5e --- /dev/null +++ b/arch/mn10300/kernel/kthread.S | |||
@@ -0,0 +1,31 @@ | |||
1 | /* MN10300 Kernel thread trampoline function | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by Mark Salter (msalter@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | .text | ||
12 | |||
13 | ############################################################################### | ||
14 | # | ||
15 | # kernel_thread_helper - trampoline for kernel_thread() | ||
16 | # | ||
17 | # On entry: | ||
18 | # A2 = address of function to call | ||
19 | # D2 = function argument | ||
20 | # | ||
21 | ############################################################################### | ||
22 | .globl kernel_thread_helper | ||
23 | .type kernel_thread_helper,@function | ||
24 | kernel_thread_helper: | ||
25 | mov do_exit,d1 | ||
26 | mov d1,(sp) | ||
27 | mov d1,mdr | ||
28 | mov d2,d0 | ||
29 | jmp (a2) | ||
30 | |||
31 | .size kernel_thread_helper,.-kernel_thread_helper | ||