diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /arch/s390/kernel | |
parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) |
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r-- | arch/s390/kernel/crash.c | 16 | ||||
-rw-r--r-- | arch/s390/kernel/init_task.c | 38 | ||||
-rw-r--r-- | arch/s390/kernel/switch_cpu.S | 58 | ||||
-rw-r--r-- | arch/s390/kernel/switch_cpu64.S | 51 |
4 files changed, 163 insertions, 0 deletions
diff --git a/arch/s390/kernel/crash.c b/arch/s390/kernel/crash.c new file mode 100644 index 00000000000..8cc7c9fa64f --- /dev/null +++ b/arch/s390/kernel/crash.c | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * arch/s390/kernel/crash.c | ||
3 | * | ||
4 | * (C) Copyright IBM Corp. 2005 | ||
5 | * | ||
6 | * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com> | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #include <linux/threads.h> | ||
11 | #include <linux/kexec.h> | ||
12 | #include <linux/reboot.h> | ||
13 | |||
14 | void machine_crash_shutdown(struct pt_regs *regs) | ||
15 | { | ||
16 | } | ||
diff --git a/arch/s390/kernel/init_task.c b/arch/s390/kernel/init_task.c new file mode 100644 index 00000000000..4d1c9fb0b54 --- /dev/null +++ b/arch/s390/kernel/init_task.c | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * arch/s390/kernel/init_task.c | ||
3 | * | ||
4 | * S390 version | ||
5 | * | ||
6 | * Derived from "arch/i386/kernel/init_task.c" | ||
7 | */ | ||
8 | |||
9 | #include <linux/mm.h> | ||
10 | #include <linux/fs.h> | ||
11 | #include <linux/module.h> | ||
12 | #include <linux/sched.h> | ||
13 | #include <linux/init_task.h> | ||
14 | #include <linux/mqueue.h> | ||
15 | |||
16 | #include <asm/uaccess.h> | ||
17 | #include <asm/pgtable.h> | ||
18 | |||
19 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
20 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
21 | /* | ||
22 | * Initial thread structure. | ||
23 | * | ||
24 | * We need to make sure that this is THREAD_SIZE aligned due to the | ||
25 | * way process stacks are handled. This is done by having a special | ||
26 | * "init_task" linker map entry.. | ||
27 | */ | ||
28 | union thread_union init_thread_union __init_task_data = | ||
29 | { INIT_THREAD_INFO(init_task) }; | ||
30 | |||
31 | /* | ||
32 | * Initial task structure. | ||
33 | * | ||
34 | * All other task structs will be allocated on slabs in fork.c | ||
35 | */ | ||
36 | struct task_struct init_task = INIT_TASK(init_task); | ||
37 | |||
38 | EXPORT_SYMBOL(init_task); | ||
diff --git a/arch/s390/kernel/switch_cpu.S b/arch/s390/kernel/switch_cpu.S new file mode 100644 index 00000000000..bfe070bc765 --- /dev/null +++ b/arch/s390/kernel/switch_cpu.S | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * 31-bit switch cpu code | ||
3 | * | ||
4 | * Copyright IBM Corp. 2009 | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #include <linux/linkage.h> | ||
9 | #include <asm/asm-offsets.h> | ||
10 | #include <asm/ptrace.h> | ||
11 | |||
12 | # smp_switch_to_cpu switches to destination cpu and executes the passed function | ||
13 | # Parameter: %r2 - function to call | ||
14 | # %r3 - function parameter | ||
15 | # %r4 - stack poiner | ||
16 | # %r5 - current cpu | ||
17 | # %r6 - destination cpu | ||
18 | |||
19 | .section .text | ||
20 | ENTRY(smp_switch_to_cpu) | ||
21 | stm %r6,%r15,__SF_GPRS(%r15) | ||
22 | lr %r1,%r15 | ||
23 | ahi %r15,-STACK_FRAME_OVERHEAD | ||
24 | st %r1,__SF_BACKCHAIN(%r15) | ||
25 | basr %r13,0 | ||
26 | 0: la %r1,.gprregs_addr-0b(%r13) | ||
27 | l %r1,0(%r1) | ||
28 | stm %r0,%r15,0(%r1) | ||
29 | 1: sigp %r0,%r6,__SIGP_RESTART /* start destination CPU */ | ||
30 | brc 2,1b /* busy, try again */ | ||
31 | 2: sigp %r0,%r5,__SIGP_STOP /* stop current CPU */ | ||
32 | brc 2,2b /* busy, try again */ | ||
33 | 3: j 3b | ||
34 | |||
35 | ENTRY(smp_restart_cpu) | ||
36 | basr %r13,0 | ||
37 | 0: la %r1,.gprregs_addr-0b(%r13) | ||
38 | l %r1,0(%r1) | ||
39 | lm %r0,%r15,0(%r1) | ||
40 | 1: sigp %r0,%r5,__SIGP_SENSE /* Wait for calling CPU */ | ||
41 | brc 10,1b /* busy, accepted (status 0), running */ | ||
42 | tmll %r0,0x40 /* Test if calling CPU is stopped */ | ||
43 | jz 1b | ||
44 | ltr %r4,%r4 /* New stack ? */ | ||
45 | jz 1f | ||
46 | lr %r15,%r4 | ||
47 | 1: lr %r14,%r2 /* r14: Function to call */ | ||
48 | lr %r2,%r3 /* r2 : Parameter for function*/ | ||
49 | basr %r14,%r14 /* Call function */ | ||
50 | |||
51 | .gprregs_addr: | ||
52 | .long .gprregs | ||
53 | |||
54 | .section .data,"aw",@progbits | ||
55 | .gprregs: | ||
56 | .rept 16 | ||
57 | .long 0 | ||
58 | .endr | ||
diff --git a/arch/s390/kernel/switch_cpu64.S b/arch/s390/kernel/switch_cpu64.S new file mode 100644 index 00000000000..fcc42d799e4 --- /dev/null +++ b/arch/s390/kernel/switch_cpu64.S | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * 64-bit switch cpu code | ||
3 | * | ||
4 | * Copyright IBM Corp. 2009 | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #include <linux/linkage.h> | ||
9 | #include <asm/asm-offsets.h> | ||
10 | #include <asm/ptrace.h> | ||
11 | |||
12 | # smp_switch_to_cpu switches to destination cpu and executes the passed function | ||
13 | # Parameter: %r2 - function to call | ||
14 | # %r3 - function parameter | ||
15 | # %r4 - stack poiner | ||
16 | # %r5 - current cpu | ||
17 | # %r6 - destination cpu | ||
18 | |||
19 | .section .text | ||
20 | ENTRY(smp_switch_to_cpu) | ||
21 | stmg %r6,%r15,__SF_GPRS(%r15) | ||
22 | lgr %r1,%r15 | ||
23 | aghi %r15,-STACK_FRAME_OVERHEAD | ||
24 | stg %r1,__SF_BACKCHAIN(%r15) | ||
25 | larl %r1,.gprregs | ||
26 | stmg %r0,%r15,0(%r1) | ||
27 | 1: sigp %r0,%r6,__SIGP_RESTART /* start destination CPU */ | ||
28 | brc 2,1b /* busy, try again */ | ||
29 | 2: sigp %r0,%r5,__SIGP_STOP /* stop current CPU */ | ||
30 | brc 2,2b /* busy, try again */ | ||
31 | 3: j 3b | ||
32 | |||
33 | ENTRY(smp_restart_cpu) | ||
34 | larl %r1,.gprregs | ||
35 | lmg %r0,%r15,0(%r1) | ||
36 | 1: sigp %r0,%r5,__SIGP_SENSE /* Wait for calling CPU */ | ||
37 | brc 10,1b /* busy, accepted (status 0), running */ | ||
38 | tmll %r0,0x40 /* Test if calling CPU is stopped */ | ||
39 | jz 1b | ||
40 | ltgr %r4,%r4 /* New stack ? */ | ||
41 | jz 1f | ||
42 | lgr %r15,%r4 | ||
43 | 1: lgr %r14,%r2 /* r14: Function to call */ | ||
44 | lgr %r2,%r3 /* r2 : Parameter for function*/ | ||
45 | basr %r14,%r14 /* Call function */ | ||
46 | |||
47 | .section .data,"aw",@progbits | ||
48 | .gprregs: | ||
49 | .rept 16 | ||
50 | .quad 0 | ||
51 | .endr | ||