diff options
Diffstat (limited to 'arch/s390')
27 files changed, 2256 insertions, 843 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 0f293aa7b0fa..e6ec418093e5 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -41,6 +41,11 @@ config GENERIC_HWEIGHT | |||
41 | config GENERIC_TIME | 41 | config GENERIC_TIME |
42 | def_bool y | 42 | def_bool y |
43 | 43 | ||
44 | config GENERIC_BUG | ||
45 | bool | ||
46 | depends on BUG | ||
47 | default y | ||
48 | |||
44 | config NO_IOMEM | 49 | config NO_IOMEM |
45 | def_bool y | 50 | def_bool y |
46 | 51 | ||
@@ -514,6 +519,14 @@ config KEXEC | |||
514 | current kernel, and to start another kernel. It is like a reboot | 519 | current kernel, and to start another kernel. It is like a reboot |
515 | but is independent of hardware/microcode support. | 520 | but is independent of hardware/microcode support. |
516 | 521 | ||
522 | config ZFCPDUMP | ||
523 | tristate "zfcpdump support" | ||
524 | select SMP | ||
525 | default n | ||
526 | help | ||
527 | Select this option if you want to build an zfcpdump enabled kernel. | ||
528 | Refer to "Documentation/s390/zfcpdump.txt" for more details on this. | ||
529 | |||
517 | endmenu | 530 | endmenu |
518 | 531 | ||
519 | source "net/Kconfig" | 532 | source "net/Kconfig" |
diff --git a/arch/s390/Makefile b/arch/s390/Makefile index b1e558496469..68441e0e74b6 100644 --- a/arch/s390/Makefile +++ b/arch/s390/Makefile | |||
@@ -67,8 +67,10 @@ endif | |||
67 | 67 | ||
68 | ifeq ($(call cc-option-yn,-mstack-size=8192 -mstack-guard=128),y) | 68 | ifeq ($(call cc-option-yn,-mstack-size=8192 -mstack-guard=128),y) |
69 | cflags-$(CONFIG_CHECK_STACK) += -mstack-size=$(STACK_SIZE) | 69 | cflags-$(CONFIG_CHECK_STACK) += -mstack-size=$(STACK_SIZE) |
70 | ifneq ($(call cc-option-yn,-mstack-size=8192),y) | ||
70 | cflags-$(CONFIG_CHECK_STACK) += -mstack-guard=$(CONFIG_STACK_GUARD) | 71 | cflags-$(CONFIG_CHECK_STACK) += -mstack-guard=$(CONFIG_STACK_GUARD) |
71 | endif | 72 | endif |
73 | endif | ||
72 | 74 | ||
73 | ifeq ($(call cc-option-yn,-mwarn-dynamicstack),y) | 75 | ifeq ($(call cc-option-yn,-mwarn-dynamicstack),y) |
74 | cflags-$(CONFIG_WARN_STACK) += -mwarn-dynamicstack | 76 | cflags-$(CONFIG_WARN_STACK) += -mwarn-dynamicstack |
@@ -103,6 +105,9 @@ install: vmlinux | |||
103 | image: vmlinux | 105 | image: vmlinux |
104 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ | 106 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ |
105 | 107 | ||
108 | zfcpdump: | ||
109 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ | ||
110 | |||
106 | archclean: | 111 | archclean: |
107 | $(Q)$(MAKE) $(clean)=$(boot) | 112 | $(Q)$(MAKE) $(clean)=$(boot) |
108 | 113 | ||
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c index 0c3cf4b16ae4..ee89b33145d5 100644 --- a/arch/s390/appldata/appldata_base.c +++ b/arch/s390/appldata/appldata_base.c | |||
@@ -668,45 +668,7 @@ EXPORT_SYMBOL_GPL(appldata_register_ops); | |||
668 | EXPORT_SYMBOL_GPL(appldata_unregister_ops); | 668 | EXPORT_SYMBOL_GPL(appldata_unregister_ops); |
669 | EXPORT_SYMBOL_GPL(appldata_diag); | 669 | EXPORT_SYMBOL_GPL(appldata_diag); |
670 | 670 | ||
671 | #ifdef MODULE | ||
672 | /* | ||
673 | * Kernel symbols needed by appldata_mem and appldata_os modules. | ||
674 | * However, if this file is compiled as a module (for testing only), these | ||
675 | * symbols are not exported. In this case, we define them locally and export | ||
676 | * those. | ||
677 | */ | ||
678 | void si_swapinfo(struct sysinfo *val) | ||
679 | { | ||
680 | val->freeswap = -1ul; | ||
681 | val->totalswap = -1ul; | ||
682 | } | ||
683 | |||
684 | unsigned long avenrun[3] = {-1 - FIXED_1/200, -1 - FIXED_1/200, | ||
685 | -1 - FIXED_1/200}; | ||
686 | int nr_threads = -1; | ||
687 | |||
688 | void get_full_page_state(struct page_state *ps) | ||
689 | { | ||
690 | memset(ps, -1, sizeof(struct page_state)); | ||
691 | } | ||
692 | |||
693 | unsigned long nr_running(void) | ||
694 | { | ||
695 | return -1; | ||
696 | } | ||
697 | |||
698 | unsigned long nr_iowait(void) | ||
699 | { | ||
700 | return -1; | ||
701 | } | ||
702 | |||
703 | /*unsigned long nr_context_switches(void) | ||
704 | { | ||
705 | return -1; | ||
706 | }*/ | ||
707 | #endif /* MODULE */ | ||
708 | EXPORT_SYMBOL_GPL(si_swapinfo); | 671 | EXPORT_SYMBOL_GPL(si_swapinfo); |
709 | EXPORT_SYMBOL_GPL(nr_threads); | 672 | EXPORT_SYMBOL_GPL(nr_threads); |
710 | EXPORT_SYMBOL_GPL(nr_running); | 673 | EXPORT_SYMBOL_GPL(nr_running); |
711 | EXPORT_SYMBOL_GPL(nr_iowait); | 674 | EXPORT_SYMBOL_GPL(nr_iowait); |
712 | //EXPORT_SYMBOL_GPL(nr_context_switches); | ||
diff --git a/arch/s390/crypto/sha1_s390.c b/arch/s390/crypto/sha1_s390.c index 969639f31977..af4460ec381f 100644 --- a/arch/s390/crypto/sha1_s390.c +++ b/arch/s390/crypto/sha1_s390.c | |||
@@ -25,99 +25,100 @@ | |||
25 | */ | 25 | */ |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/mm.h> | ||
29 | #include <linux/crypto.h> | 28 | #include <linux/crypto.h> |
30 | #include <asm/scatterlist.h> | 29 | |
31 | #include <asm/byteorder.h> | ||
32 | #include "crypt_s390.h" | 30 | #include "crypt_s390.h" |
33 | 31 | ||
34 | #define SHA1_DIGEST_SIZE 20 | 32 | #define SHA1_DIGEST_SIZE 20 |
35 | #define SHA1_BLOCK_SIZE 64 | 33 | #define SHA1_BLOCK_SIZE 64 |
36 | 34 | ||
37 | struct crypt_s390_sha1_ctx { | 35 | struct s390_sha1_ctx { |
38 | u64 count; | 36 | u64 count; /* message length */ |
39 | u32 state[5]; | 37 | u32 state[5]; |
40 | u32 buf_len; | 38 | u8 buf[2 * SHA1_BLOCK_SIZE]; |
41 | u8 buffer[2 * SHA1_BLOCK_SIZE]; | ||
42 | }; | 39 | }; |
43 | 40 | ||
44 | static void sha1_init(struct crypto_tfm *tfm) | 41 | static void sha1_init(struct crypto_tfm *tfm) |
45 | { | 42 | { |
46 | struct crypt_s390_sha1_ctx *ctx = crypto_tfm_ctx(tfm); | 43 | struct s390_sha1_ctx *sctx = crypto_tfm_ctx(tfm); |
47 | 44 | ||
48 | ctx->state[0] = 0x67452301; | 45 | sctx->state[0] = 0x67452301; |
49 | ctx->state[1] = 0xEFCDAB89; | 46 | sctx->state[1] = 0xEFCDAB89; |
50 | ctx->state[2] = 0x98BADCFE; | 47 | sctx->state[2] = 0x98BADCFE; |
51 | ctx->state[3] = 0x10325476; | 48 | sctx->state[3] = 0x10325476; |
52 | ctx->state[4] = 0xC3D2E1F0; | 49 | sctx->state[4] = 0xC3D2E1F0; |
53 | 50 | sctx->count = 0; | |
54 | ctx->count = 0; | ||
55 | ctx->buf_len = 0; | ||
56 | } | 51 | } |
57 | 52 | ||
58 | static void sha1_update(struct crypto_tfm *tfm, const u8 *data, | 53 | static void sha1_update(struct crypto_tfm *tfm, const u8 *data, |
59 | unsigned int len) | 54 | unsigned int len) |
60 | { | 55 | { |
61 | struct crypt_s390_sha1_ctx *sctx; | 56 | struct s390_sha1_ctx *sctx = crypto_tfm_ctx(tfm); |
62 | long imd_len; | 57 | unsigned int index; |
63 | 58 | int ret; | |
64 | sctx = crypto_tfm_ctx(tfm); | 59 | |
65 | sctx->count += len * 8; /* message bit length */ | 60 | /* how much is already in the buffer? */ |
66 | 61 | index = sctx->count & 0x3f; | |
67 | /* anything in buffer yet? -> must be completed */ | 62 | |
68 | if (sctx->buf_len && (sctx->buf_len + len) >= SHA1_BLOCK_SIZE) { | 63 | sctx->count += len; |
69 | /* complete full block and hash */ | 64 | |
70 | memcpy(sctx->buffer + sctx->buf_len, data, | 65 | if (index + len < SHA1_BLOCK_SIZE) |
71 | SHA1_BLOCK_SIZE - sctx->buf_len); | 66 | goto store; |
72 | crypt_s390_kimd(KIMD_SHA_1, sctx->state, sctx->buffer, | 67 | |
73 | SHA1_BLOCK_SIZE); | 68 | /* process one stored block */ |
74 | data += SHA1_BLOCK_SIZE - sctx->buf_len; | 69 | if (index) { |
75 | len -= SHA1_BLOCK_SIZE - sctx->buf_len; | 70 | memcpy(sctx->buf + index, data, SHA1_BLOCK_SIZE - index); |
76 | sctx->buf_len = 0; | 71 | ret = crypt_s390_kimd(KIMD_SHA_1, sctx->state, sctx->buf, |
72 | SHA1_BLOCK_SIZE); | ||
73 | BUG_ON(ret != SHA1_BLOCK_SIZE); | ||
74 | data += SHA1_BLOCK_SIZE - index; | ||
75 | len -= SHA1_BLOCK_SIZE - index; | ||
77 | } | 76 | } |
78 | 77 | ||
79 | /* rest of data contains full blocks? */ | 78 | /* process as many blocks as possible */ |
80 | imd_len = len & ~0x3ful; | 79 | if (len >= SHA1_BLOCK_SIZE) { |
81 | if (imd_len) { | 80 | ret = crypt_s390_kimd(KIMD_SHA_1, sctx->state, data, |
82 | crypt_s390_kimd(KIMD_SHA_1, sctx->state, data, imd_len); | 81 | len & ~(SHA1_BLOCK_SIZE - 1)); |
83 | data += imd_len; | 82 | BUG_ON(ret != (len & ~(SHA1_BLOCK_SIZE - 1))); |
84 | len -= imd_len; | 83 | data += ret; |
84 | len -= ret; | ||
85 | } | 85 | } |
86 | /* anything left? store in buffer */ | ||
87 | if (len) { | ||
88 | memcpy(sctx->buffer + sctx->buf_len , data, len); | ||
89 | sctx->buf_len += len; | ||
90 | } | ||
91 | } | ||
92 | 86 | ||
87 | store: | ||
88 | /* anything left? */ | ||
89 | if (len) | ||
90 | memcpy(sctx->buf + index , data, len); | ||
91 | } | ||
93 | 92 | ||
94 | static void pad_message(struct crypt_s390_sha1_ctx* sctx) | 93 | /* Add padding and return the message digest. */ |
94 | static void sha1_final(struct crypto_tfm *tfm, u8 *out) | ||
95 | { | 95 | { |
96 | int index; | 96 | struct s390_sha1_ctx *sctx = crypto_tfm_ctx(tfm); |
97 | u64 bits; | ||
98 | unsigned int index, end; | ||
99 | int ret; | ||
100 | |||
101 | /* must perform manual padding */ | ||
102 | index = sctx->count & 0x3f; | ||
103 | end = (index < 56) ? SHA1_BLOCK_SIZE : (2 * SHA1_BLOCK_SIZE); | ||
97 | 104 | ||
98 | index = sctx->buf_len; | ||
99 | sctx->buf_len = (sctx->buf_len < 56) ? | ||
100 | SHA1_BLOCK_SIZE:2 * SHA1_BLOCK_SIZE; | ||
101 | /* start pad with 1 */ | 105 | /* start pad with 1 */ |
102 | sctx->buffer[index] = 0x80; | 106 | sctx->buf[index] = 0x80; |
107 | |||
103 | /* pad with zeros */ | 108 | /* pad with zeros */ |
104 | index++; | 109 | index++; |
105 | memset(sctx->buffer + index, 0x00, sctx->buf_len - index); | 110 | memset(sctx->buf + index, 0x00, end - index - 8); |
106 | /* append length */ | ||
107 | memcpy(sctx->buffer + sctx->buf_len - 8, &sctx->count, | ||
108 | sizeof sctx->count); | ||
109 | } | ||
110 | 111 | ||
111 | /* Add padding and return the message digest. */ | 112 | /* append message length */ |
112 | static void sha1_final(struct crypto_tfm *tfm, u8 *out) | 113 | bits = sctx->count * 8; |
113 | { | 114 | memcpy(sctx->buf + end - 8, &bits, sizeof(bits)); |
114 | struct crypt_s390_sha1_ctx *sctx = crypto_tfm_ctx(tfm); | 115 | |
116 | ret = crypt_s390_kimd(KIMD_SHA_1, sctx->state, sctx->buf, end); | ||
117 | BUG_ON(ret != end); | ||
115 | 118 | ||
116 | /* must perform manual padding */ | ||
117 | pad_message(sctx); | ||
118 | crypt_s390_kimd(KIMD_SHA_1, sctx->state, sctx->buffer, sctx->buf_len); | ||
119 | /* copy digest to out */ | 119 | /* copy digest to out */ |
120 | memcpy(out, sctx->state, SHA1_DIGEST_SIZE); | 120 | memcpy(out, sctx->state, SHA1_DIGEST_SIZE); |
121 | |||
121 | /* wipe context */ | 122 | /* wipe context */ |
122 | memset(sctx, 0, sizeof *sctx); | 123 | memset(sctx, 0, sizeof *sctx); |
123 | } | 124 | } |
@@ -128,7 +129,7 @@ static struct crypto_alg alg = { | |||
128 | .cra_priority = CRYPT_S390_PRIORITY, | 129 | .cra_priority = CRYPT_S390_PRIORITY, |
129 | .cra_flags = CRYPTO_ALG_TYPE_DIGEST, | 130 | .cra_flags = CRYPTO_ALG_TYPE_DIGEST, |
130 | .cra_blocksize = SHA1_BLOCK_SIZE, | 131 | .cra_blocksize = SHA1_BLOCK_SIZE, |
131 | .cra_ctxsize = sizeof(struct crypt_s390_sha1_ctx), | 132 | .cra_ctxsize = sizeof(struct s390_sha1_ctx), |
132 | .cra_module = THIS_MODULE, | 133 | .cra_module = THIS_MODULE, |
133 | .cra_list = LIST_HEAD_INIT(alg.cra_list), | 134 | .cra_list = LIST_HEAD_INIT(alg.cra_list), |
134 | .cra_u = { .digest = { | 135 | .cra_u = { .digest = { |
diff --git a/arch/s390/crypto/sha256_s390.c b/arch/s390/crypto/sha256_s390.c index 78436c696d37..2ced3330bce0 100644 --- a/arch/s390/crypto/sha256_s390.c +++ b/arch/s390/crypto/sha256_s390.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #define SHA256_BLOCK_SIZE 64 | 26 | #define SHA256_BLOCK_SIZE 64 |
27 | 27 | ||
28 | struct s390_sha256_ctx { | 28 | struct s390_sha256_ctx { |
29 | u64 count; | 29 | u64 count; /* message length */ |
30 | u32 state[8]; | 30 | u32 state[8]; |
31 | u8 buf[2 * SHA256_BLOCK_SIZE]; | 31 | u8 buf[2 * SHA256_BLOCK_SIZE]; |
32 | }; | 32 | }; |
@@ -54,10 +54,9 @@ static void sha256_update(struct crypto_tfm *tfm, const u8 *data, | |||
54 | int ret; | 54 | int ret; |
55 | 55 | ||
56 | /* how much is already in the buffer? */ | 56 | /* how much is already in the buffer? */ |
57 | index = sctx->count / 8 & 0x3f; | 57 | index = sctx->count & 0x3f; |
58 | 58 | ||
59 | /* update message bit length */ | 59 | sctx->count += len; |
60 | sctx->count += len * 8; | ||
61 | 60 | ||
62 | if ((index + len) < SHA256_BLOCK_SIZE) | 61 | if ((index + len) < SHA256_BLOCK_SIZE) |
63 | goto store; | 62 | goto store; |
@@ -87,12 +86,17 @@ store: | |||
87 | memcpy(sctx->buf + index , data, len); | 86 | memcpy(sctx->buf + index , data, len); |
88 | } | 87 | } |
89 | 88 | ||
90 | static void pad_message(struct s390_sha256_ctx* sctx) | 89 | /* Add padding and return the message digest */ |
90 | static void sha256_final(struct crypto_tfm *tfm, u8 *out) | ||
91 | { | 91 | { |
92 | int index, end; | 92 | struct s390_sha256_ctx *sctx = crypto_tfm_ctx(tfm); |
93 | u64 bits; | ||
94 | unsigned int index, end; | ||
95 | int ret; | ||
93 | 96 | ||
94 | index = sctx->count / 8 & 0x3f; | 97 | /* must perform manual padding */ |
95 | end = index < 56 ? SHA256_BLOCK_SIZE : 2 * SHA256_BLOCK_SIZE; | 98 | index = sctx->count & 0x3f; |
99 | end = (index < 56) ? SHA256_BLOCK_SIZE : (2 * SHA256_BLOCK_SIZE); | ||
96 | 100 | ||
97 | /* start pad with 1 */ | 101 | /* start pad with 1 */ |
98 | sctx->buf[index] = 0x80; | 102 | sctx->buf[index] = 0x80; |
@@ -102,21 +106,11 @@ static void pad_message(struct s390_sha256_ctx* sctx) | |||
102 | memset(sctx->buf + index, 0x00, end - index - 8); | 106 | memset(sctx->buf + index, 0x00, end - index - 8); |
103 | 107 | ||
104 | /* append message length */ | 108 | /* append message length */ |
105 | memcpy(sctx->buf + end - 8, &sctx->count, sizeof sctx->count); | 109 | bits = sctx->count * 8; |
106 | 110 | memcpy(sctx->buf + end - 8, &bits, sizeof(bits)); | |
107 | sctx->count = end * 8; | ||
108 | } | ||
109 | |||
110 | /* Add padding and return the message digest */ | ||
111 | static void sha256_final(struct crypto_tfm *tfm, u8 *out) | ||
112 | { | ||
113 | struct s390_sha256_ctx *sctx = crypto_tfm_ctx(tfm); | ||
114 | |||
115 | /* must perform manual padding */ | ||
116 | pad_message(sctx); | ||
117 | 111 | ||
118 | crypt_s390_kimd(KIMD_SHA_256, sctx->state, sctx->buf, | 112 | ret = crypt_s390_kimd(KIMD_SHA_256, sctx->state, sctx->buf, end); |
119 | sctx->count / 8); | 113 | BUG_ON(ret != end); |
120 | 114 | ||
121 | /* copy digest to out */ | 115 | /* copy digest to out */ |
122 | memcpy(out, sctx->state, SHA256_DIGEST_SIZE); | 116 | memcpy(out, sctx->state, SHA256_DIGEST_SIZE); |
diff --git a/arch/s390/defconfig b/arch/s390/defconfig index 741d2bbb2b37..0e4da8a7d826 100644 --- a/arch/s390/defconfig +++ b/arch/s390/defconfig | |||
@@ -12,6 +12,7 @@ CONFIG_RWSEM_XCHGADD_ALGORITHM=y | |||
12 | # CONFIG_ARCH_HAS_ILOG2_U64 is not set | 12 | # CONFIG_ARCH_HAS_ILOG2_U64 is not set |
13 | CONFIG_GENERIC_HWEIGHT=y | 13 | CONFIG_GENERIC_HWEIGHT=y |
14 | CONFIG_GENERIC_TIME=y | 14 | CONFIG_GENERIC_TIME=y |
15 | CONFIG_GENERIC_BUG=y | ||
15 | CONFIG_NO_IOMEM=y | 16 | CONFIG_NO_IOMEM=y |
16 | CONFIG_S390=y | 17 | CONFIG_S390=y |
17 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | 18 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" |
@@ -166,6 +167,7 @@ CONFIG_NO_IDLE_HZ=y | |||
166 | CONFIG_NO_IDLE_HZ_INIT=y | 167 | CONFIG_NO_IDLE_HZ_INIT=y |
167 | CONFIG_S390_HYPFS_FS=y | 168 | CONFIG_S390_HYPFS_FS=y |
168 | CONFIG_KEXEC=y | 169 | CONFIG_KEXEC=y |
170 | # CONFIG_ZFCPDUMP is not set | ||
169 | 171 | ||
170 | # | 172 | # |
171 | # Networking | 173 | # Networking |
@@ -705,6 +707,7 @@ CONFIG_DEBUG_MUTEXES=y | |||
705 | CONFIG_DEBUG_SPINLOCK_SLEEP=y | 707 | CONFIG_DEBUG_SPINLOCK_SLEEP=y |
706 | # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set | 708 | # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set |
707 | # CONFIG_DEBUG_KOBJECT is not set | 709 | # CONFIG_DEBUG_KOBJECT is not set |
710 | CONFIG_DEBUG_BUGVERBOSE=y | ||
708 | # CONFIG_DEBUG_INFO is not set | 711 | # CONFIG_DEBUG_INFO is not set |
709 | # CONFIG_DEBUG_VM is not set | 712 | # CONFIG_DEBUG_VM is not set |
710 | # CONFIG_DEBUG_LIST is not set | 713 | # CONFIG_DEBUG_LIST is not set |
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile index 5492d25d7d69..3195d375bd51 100644 --- a/arch/s390/kernel/Makefile +++ b/arch/s390/kernel/Makefile | |||
@@ -6,7 +6,7 @@ EXTRA_AFLAGS := -traditional | |||
6 | 6 | ||
7 | obj-y := bitmap.o traps.o time.o process.o base.o early.o \ | 7 | obj-y := bitmap.o traps.o time.o process.o base.o early.o \ |
8 | setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \ | 8 | setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \ |
9 | semaphore.o s390_ext.o debug.o irq.o ipl.o | 9 | semaphore.o s390_ext.o debug.o irq.o ipl.o dis.o |
10 | 10 | ||
11 | obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o) | 11 | obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o) |
12 | obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o) | 12 | obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o) |
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c index 664c669b1856..5236fdb17fcb 100644 --- a/arch/s390/kernel/compat_linux.c +++ b/arch/s390/kernel/compat_linux.c | |||
@@ -495,29 +495,34 @@ sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo) | |||
495 | * sys32_execve() executes a new program after the asm stub has set | 495 | * sys32_execve() executes a new program after the asm stub has set |
496 | * things up for us. This should basically do what I want it to. | 496 | * things up for us. This should basically do what I want it to. |
497 | */ | 497 | */ |
498 | asmlinkage long | 498 | asmlinkage long sys32_execve(void) |
499 | sys32_execve(struct pt_regs regs) | ||
500 | { | 499 | { |
501 | int error; | 500 | struct pt_regs *regs = task_pt_regs(current); |
502 | char * filename; | 501 | char *filename; |
502 | unsigned long result; | ||
503 | int rc; | ||
503 | 504 | ||
504 | filename = getname(compat_ptr(regs.orig_gpr2)); | 505 | filename = getname(compat_ptr(regs->orig_gpr2)); |
505 | error = PTR_ERR(filename); | 506 | if (IS_ERR(filename)) { |
506 | if (IS_ERR(filename)) | 507 | result = PTR_ERR(filename); |
507 | goto out; | 508 | goto out; |
508 | error = compat_do_execve(filename, compat_ptr(regs.gprs[3]), | ||
509 | compat_ptr(regs.gprs[4]), ®s); | ||
510 | if (error == 0) | ||
511 | { | ||
512 | task_lock(current); | ||
513 | current->ptrace &= ~PT_DTRACE; | ||
514 | task_unlock(current); | ||
515 | current->thread.fp_regs.fpc=0; | ||
516 | asm volatile("sfpc %0,0" : : "d" (0)); | ||
517 | } | 509 | } |
510 | rc = compat_do_execve(filename, compat_ptr(regs->gprs[3]), | ||
511 | compat_ptr(regs->gprs[4]), regs); | ||
512 | if (rc) { | ||
513 | result = rc; | ||
514 | goto out_putname; | ||
515 | } | ||
516 | task_lock(current); | ||
517 | current->ptrace &= ~PT_DTRACE; | ||
518 | task_unlock(current); | ||
519 | current->thread.fp_regs.fpc=0; | ||
520 | asm volatile("sfpc %0,0" : : "d" (0)); | ||
521 | result = regs->gprs[2]; | ||
522 | out_putname: | ||
518 | putname(filename); | 523 | putname(filename); |
519 | out: | 524 | out: |
520 | return error; | 525 | return result; |
521 | } | 526 | } |
522 | 527 | ||
523 | 528 | ||
@@ -918,19 +923,20 @@ asmlinkage long sys32_write(unsigned int fd, char __user * buf, size_t count) | |||
918 | return sys_write(fd, buf, count); | 923 | return sys_write(fd, buf, count); |
919 | } | 924 | } |
920 | 925 | ||
921 | asmlinkage long sys32_clone(struct pt_regs regs) | 926 | asmlinkage long sys32_clone(void) |
922 | { | 927 | { |
923 | unsigned long clone_flags; | 928 | struct pt_regs *regs = task_pt_regs(current); |
924 | unsigned long newsp; | 929 | unsigned long clone_flags; |
930 | unsigned long newsp; | ||
925 | int __user *parent_tidptr, *child_tidptr; | 931 | int __user *parent_tidptr, *child_tidptr; |
926 | 932 | ||
927 | clone_flags = regs.gprs[3] & 0xffffffffUL; | 933 | clone_flags = regs->gprs[3] & 0xffffffffUL; |
928 | newsp = regs.orig_gpr2 & 0x7fffffffUL; | 934 | newsp = regs->orig_gpr2 & 0x7fffffffUL; |
929 | parent_tidptr = compat_ptr(regs.gprs[4]); | 935 | parent_tidptr = compat_ptr(regs->gprs[4]); |
930 | child_tidptr = compat_ptr(regs.gprs[5]); | 936 | child_tidptr = compat_ptr(regs->gprs[5]); |
931 | if (!newsp) | 937 | if (!newsp) |
932 | newsp = regs.gprs[15]; | 938 | newsp = regs->gprs[15]; |
933 | return do_fork(clone_flags, newsp, ®s, 0, | 939 | return do_fork(clone_flags, newsp, regs, 0, |
934 | parent_tidptr, child_tidptr); | 940 | parent_tidptr, child_tidptr); |
935 | } | 941 | } |
936 | 942 | ||
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c index 887a9881d0d0..80a54a0149ab 100644 --- a/arch/s390/kernel/compat_signal.c +++ b/arch/s390/kernel/compat_signal.c | |||
@@ -255,9 +255,9 @@ sys32_rt_sigaction(int sig, const struct sigaction32 __user *act, | |||
255 | } | 255 | } |
256 | 256 | ||
257 | asmlinkage long | 257 | asmlinkage long |
258 | sys32_sigaltstack(const stack_t32 __user *uss, stack_t32 __user *uoss, | 258 | sys32_sigaltstack(const stack_t32 __user *uss, stack_t32 __user *uoss) |
259 | struct pt_regs *regs) | ||
260 | { | 259 | { |
260 | struct pt_regs *regs = task_pt_regs(current); | ||
261 | stack_t kss, koss; | 261 | stack_t kss, koss; |
262 | unsigned long ss_sp; | 262 | unsigned long ss_sp; |
263 | int ret, err = 0; | 263 | int ret, err = 0; |
@@ -344,8 +344,9 @@ static int restore_sigregs32(struct pt_regs *regs,_sigregs32 __user *sregs) | |||
344 | return 0; | 344 | return 0; |
345 | } | 345 | } |
346 | 346 | ||
347 | asmlinkage long sys32_sigreturn(struct pt_regs *regs) | 347 | asmlinkage long sys32_sigreturn(void) |
348 | { | 348 | { |
349 | struct pt_regs *regs = task_pt_regs(current); | ||
349 | sigframe32 __user *frame = (sigframe32 __user *)regs->gprs[15]; | 350 | sigframe32 __user *frame = (sigframe32 __user *)regs->gprs[15]; |
350 | sigset_t set; | 351 | sigset_t set; |
351 | 352 | ||
@@ -370,8 +371,9 @@ badframe: | |||
370 | return 0; | 371 | return 0; |
371 | } | 372 | } |
372 | 373 | ||
373 | asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs) | 374 | asmlinkage long sys32_rt_sigreturn(void) |
374 | { | 375 | { |
376 | struct pt_regs *regs = task_pt_regs(current); | ||
375 | rt_sigframe32 __user *frame = (rt_sigframe32 __user *)regs->gprs[15]; | 377 | rt_sigframe32 __user *frame = (rt_sigframe32 __user *)regs->gprs[15]; |
376 | sigset_t set; | 378 | sigset_t set; |
377 | stack_t st; | 379 | stack_t st; |
@@ -407,8 +409,8 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs) | |||
407 | return regs->gprs[2]; | 409 | return regs->gprs[2]; |
408 | 410 | ||
409 | badframe: | 411 | badframe: |
410 | force_sig(SIGSEGV, current); | 412 | force_sig(SIGSEGV, current); |
411 | return 0; | 413 | return 0; |
412 | } | 414 | } |
413 | 415 | ||
414 | /* | 416 | /* |
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c new file mode 100644 index 000000000000..dabaf98943d0 --- /dev/null +++ b/arch/s390/kernel/dis.c | |||
@@ -0,0 +1,1278 @@ | |||
1 | /* | ||
2 | * arch/s390/kernel/dis.c | ||
3 | * | ||
4 | * Disassemble s390 instructions. | ||
5 | * | ||
6 | * Copyright IBM Corp. 2007 | ||
7 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), | ||
8 | */ | ||
9 | |||
10 | #include <linux/sched.h> | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/string.h> | ||
13 | #include <linux/errno.h> | ||
14 | #include <linux/ptrace.h> | ||
15 | #include <linux/timer.h> | ||
16 | #include <linux/mm.h> | ||
17 | #include <linux/smp.h> | ||
18 | #include <linux/smp_lock.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/delay.h> | ||
22 | #include <linux/module.h> | ||
23 | #include <linux/kallsyms.h> | ||
24 | #include <linux/reboot.h> | ||
25 | #include <linux/kprobes.h> | ||
26 | |||
27 | #include <asm/system.h> | ||
28 | #include <asm/uaccess.h> | ||
29 | #include <asm/io.h> | ||
30 | #include <asm/atomic.h> | ||
31 | #include <asm/mathemu.h> | ||
32 | #include <asm/cpcmd.h> | ||
33 | #include <asm/s390_ext.h> | ||
34 | #include <asm/lowcore.h> | ||
35 | #include <asm/debug.h> | ||
36 | #include <asm/kdebug.h> | ||
37 | |||
38 | #ifndef CONFIG_64BIT | ||
39 | #define ONELONG "%08lx: " | ||
40 | #else /* CONFIG_64BIT */ | ||
41 | #define ONELONG "%016lx: " | ||
42 | #endif /* CONFIG_64BIT */ | ||
43 | |||
44 | #define OPERAND_GPR 0x1 /* Operand printed as %rx */ | ||
45 | #define OPERAND_FPR 0x2 /* Operand printed as %fx */ | ||
46 | #define OPERAND_AR 0x4 /* Operand printed as %ax */ | ||
47 | #define OPERAND_CR 0x8 /* Operand printed as %cx */ | ||
48 | #define OPERAND_DISP 0x10 /* Operand printed as displacement */ | ||
49 | #define OPERAND_BASE 0x20 /* Operand printed as base register */ | ||
50 | #define OPERAND_INDEX 0x40 /* Operand printed as index register */ | ||
51 | #define OPERAND_PCREL 0x80 /* Operand printed as pc-relative symbol */ | ||
52 | #define OPERAND_SIGNED 0x100 /* Operand printed as signed value */ | ||
53 | #define OPERAND_LENGTH 0x200 /* Operand printed as length (+1) */ | ||
54 | |||
55 | enum { | ||
56 | UNUSED, /* Indicates the end of the operand list */ | ||
57 | R_8, /* GPR starting at position 8 */ | ||
58 | R_12, /* GPR starting at position 12 */ | ||
59 | R_16, /* GPR starting at position 16 */ | ||
60 | R_20, /* GPR starting at position 20 */ | ||
61 | R_24, /* GPR starting at position 24 */ | ||
62 | R_28, /* GPR starting at position 28 */ | ||
63 | R_32, /* GPR starting at position 32 */ | ||
64 | F_8, /* FPR starting at position 8 */ | ||
65 | F_12, /* FPR starting at position 12 */ | ||
66 | F_16, /* FPR starting at position 16 */ | ||
67 | F_20, /* FPR starting at position 16 */ | ||
68 | F_24, /* FPR starting at position 24 */ | ||
69 | F_28, /* FPR starting at position 28 */ | ||
70 | F_32, /* FPR starting at position 32 */ | ||
71 | A_8, /* Access reg. starting at position 8 */ | ||
72 | A_12, /* Access reg. starting at position 12 */ | ||
73 | A_24, /* Access reg. starting at position 24 */ | ||
74 | A_28, /* Access reg. starting at position 28 */ | ||
75 | C_8, /* Control reg. starting at position 8 */ | ||
76 | C_12, /* Control reg. starting at position 12 */ | ||
77 | B_16, /* Base register starting at position 16 */ | ||
78 | B_32, /* Base register starting at position 32 */ | ||
79 | X_12, /* Index register starting at position 12 */ | ||
80 | D_20, /* Displacement starting at position 20 */ | ||
81 | D_36, /* Displacement starting at position 36 */ | ||
82 | D20_20, /* 20 bit displacement starting at 20 */ | ||
83 | L4_8, /* 4 bit length starting at position 8 */ | ||
84 | L4_12, /* 4 bit length starting at position 12 */ | ||
85 | L8_8, /* 8 bit length starting at position 8 */ | ||
86 | U4_8, /* 4 bit unsigned value starting at 8 */ | ||
87 | U4_12, /* 4 bit unsigned value starting at 12 */ | ||
88 | U4_16, /* 4 bit unsigned value starting at 16 */ | ||
89 | U4_20, /* 4 bit unsigned value starting at 20 */ | ||
90 | U8_8, /* 8 bit unsigned value starting at 8 */ | ||
91 | U8_16, /* 8 bit unsigned value starting at 16 */ | ||
92 | I16_16, /* 16 bit signed value starting at 16 */ | ||
93 | U16_16, /* 16 bit unsigned value starting at 16 */ | ||
94 | J16_16, /* PC relative jump offset at 16 */ | ||
95 | J32_16, /* PC relative long offset at 16 */ | ||
96 | I32_16, /* 32 bit signed value starting at 16 */ | ||
97 | U32_16, /* 32 bit unsigned value starting at 16 */ | ||
98 | M_16, /* 4 bit optional mask starting at 16 */ | ||
99 | RO_28, /* optional GPR starting at position 28 */ | ||
100 | }; | ||
101 | |||
102 | /* | ||
103 | * Enumeration of the different instruction formats. | ||
104 | * For details consult the principles of operation. | ||
105 | */ | ||
106 | enum { | ||
107 | INSTR_INVALID, | ||
108 | INSTR_E, INSTR_RIE_RRP, INSTR_RIL_RI, INSTR_RIL_RP, INSTR_RIL_RU, | ||
109 | INSTR_RIL_UP, INSTR_RI_RI, INSTR_RI_RP, INSTR_RI_RU, INSTR_RI_UP, | ||
110 | INSTR_RRE_00, INSTR_RRE_0R, INSTR_RRE_AA, INSTR_RRE_AR, INSTR_RRE_F0, | ||
111 | INSTR_RRE_FF, INSTR_RRE_R0, INSTR_RRE_RA, INSTR_RRE_RF, INSTR_RRE_RR, | ||
112 | INSTR_RRE_RR_OPT, INSTR_RRF_F0FF, INSTR_RRF_FUFF, INSTR_RRF_M0RR, | ||
113 | INSTR_RRF_R0RR, INSTR_RRF_RURR, INSTR_RRF_U0FF, INSTR_RRF_U0RF, | ||
114 | INSTR_RR_FF, INSTR_RR_R0, INSTR_RR_RR, INSTR_RR_U0, INSTR_RR_UR, | ||
115 | INSTR_RSE_CCRD, INSTR_RSE_RRRD, INSTR_RSE_RURD, INSTR_RSI_RRP, | ||
116 | INSTR_RSL_R0RD, INSTR_RSY_AARD, INSTR_RSY_CCRD, INSTR_RSY_RRRD, | ||
117 | INSTR_RSY_RURD, INSTR_RS_AARD, INSTR_RS_CCRD, INSTR_RS_R0RD, | ||
118 | INSTR_RS_RRRD, INSTR_RS_RURD, INSTR_RXE_FRRD, INSTR_RXE_RRRD, | ||
119 | INSTR_RXF_FRRDF, INSTR_RXY_FRRD, INSTR_RXY_RRRD, INSTR_RX_FRRD, | ||
120 | INSTR_RX_RRRD, INSTR_RX_URRD, INSTR_SIY_URD, INSTR_SI_URD, | ||
121 | INSTR_SSE_RDRD, INSTR_SSF_RRDRD, INSTR_SS_L0RDRD, INSTR_SS_LIRDRD, | ||
122 | INSTR_SS_LLRDRD, INSTR_SS_RRRDRD, INSTR_SS_RRRDRD2, INSTR_SS_RRRDRD3, | ||
123 | INSTR_S_00, INSTR_S_RD, | ||
124 | }; | ||
125 | |||
126 | struct operand { | ||
127 | int bits; /* The number of bits in the operand. */ | ||
128 | int shift; /* The number of bits to shift. */ | ||
129 | int flags; /* One bit syntax flags. */ | ||
130 | }; | ||
131 | |||
132 | struct insn { | ||
133 | const char name[5]; | ||
134 | unsigned char opfrag; | ||
135 | unsigned char format; | ||
136 | }; | ||
137 | |||
138 | static const struct operand operands[] = | ||
139 | { | ||
140 | [UNUSED] = { 0, 0, 0 }, | ||
141 | [R_8] = { 4, 8, OPERAND_GPR }, | ||
142 | [R_12] = { 4, 12, OPERAND_GPR }, | ||
143 | [R_16] = { 4, 16, OPERAND_GPR }, | ||
144 | [R_20] = { 4, 20, OPERAND_GPR }, | ||
145 | [R_24] = { 4, 24, OPERAND_GPR }, | ||
146 | [R_28] = { 4, 28, OPERAND_GPR }, | ||
147 | [R_32] = { 4, 32, OPERAND_GPR }, | ||
148 | [F_8] = { 4, 8, OPERAND_FPR }, | ||
149 | [F_12] = { 4, 12, OPERAND_FPR }, | ||
150 | [F_16] = { 4, 16, OPERAND_FPR }, | ||
151 | [F_20] = { 4, 16, OPERAND_FPR }, | ||
152 | [F_24] = { 4, 24, OPERAND_FPR }, | ||
153 | [F_28] = { 4, 28, OPERAND_FPR }, | ||
154 | [F_32] = { 4, 32, OPERAND_FPR }, | ||
155 | [A_8] = { 4, 8, OPERAND_AR }, | ||
156 | [A_12] = { 4, 12, OPERAND_AR }, | ||
157 | [A_24] = { 4, 24, OPERAND_AR }, | ||
158 | [A_28] = { 4, 28, OPERAND_AR }, | ||
159 | [C_8] = { 4, 8, OPERAND_CR }, | ||
160 | [C_12] = { 4, 12, OPERAND_CR }, | ||
161 | [B_16] = { 4, 16, OPERAND_BASE | OPERAND_GPR }, | ||
162 | [B_32] = { 4, 32, OPERAND_BASE | OPERAND_GPR }, | ||
163 | [X_12] = { 4, 12, OPERAND_INDEX | OPERAND_GPR }, | ||
164 | [D_20] = { 12, 20, OPERAND_DISP }, | ||
165 | [D_36] = { 12, 36, OPERAND_DISP }, | ||
166 | [D20_20] = { 20, 20, OPERAND_DISP | OPERAND_SIGNED }, | ||
167 | [L4_8] = { 4, 8, OPERAND_LENGTH }, | ||
168 | [L4_12] = { 4, 12, OPERAND_LENGTH }, | ||
169 | [L8_8] = { 8, 8, OPERAND_LENGTH }, | ||
170 | [U4_8] = { 4, 8, 0 }, | ||
171 | [U4_12] = { 4, 12, 0 }, | ||
172 | [U4_16] = { 4, 16, 0 }, | ||
173 | [U4_20] = { 4, 20, 0 }, | ||
174 | [U8_8] = { 8, 8, 0 }, | ||
175 | [U8_16] = { 8, 16, 0 }, | ||
176 | [I16_16] = { 16, 16, OPERAND_SIGNED }, | ||
177 | [U16_16] = { 16, 16, 0 }, | ||
178 | [J16_16] = { 16, 16, OPERAND_PCREL }, | ||
179 | [J32_16] = { 32, 16, OPERAND_PCREL }, | ||
180 | [I32_16] = { 32, 16, OPERAND_SIGNED }, | ||
181 | [U32_16] = { 32, 16, 0 }, | ||
182 | [M_16] = { 4, 16, 0 }, | ||
183 | [RO_28] = { 4, 28, OPERAND_GPR } | ||
184 | }; | ||
185 | |||
186 | static const unsigned char formats[][7] = { | ||
187 | [INSTR_E] = { 0xff, 0,0,0,0,0,0 }, /* e.g. pr */ | ||
188 | [INSTR_RIE_RRP] = { 0xff, R_8,R_12,J16_16,0,0,0 }, /* e.g. brxhg */ | ||
189 | [INSTR_RIL_RP] = { 0x0f, R_8,J32_16,0,0,0,0 }, /* e.g. brasl */ | ||
190 | [INSTR_RIL_UP] = { 0x0f, U4_8,J32_16,0,0,0,0 }, /* e.g. brcl */ | ||
191 | [INSTR_RIL_RI] = { 0x0f, R_8,I32_16,0,0,0,0 }, /* e.g. afi */ | ||
192 | [INSTR_RIL_RU] = { 0x0f, R_8,U32_16,0,0,0,0 }, /* e.g. alfi */ | ||
193 | [INSTR_RI_RI] = { 0x0f, R_8,I16_16,0,0,0,0 }, /* e.g. ahi */ | ||
194 | [INSTR_RI_RP] = { 0x0f, R_8,J16_16,0,0,0,0 }, /* e.g. brct */ | ||
195 | [INSTR_RI_RU] = { 0x0f, R_8,U16_16,0,0,0,0 }, /* e.g. tml */ | ||
196 | [INSTR_RI_UP] = { 0x0f, U4_8,J16_16,0,0,0,0 }, /* e.g. brc */ | ||
197 | [INSTR_RRE_00] = { 0xff, 0,0,0,0,0,0 }, /* e.g. palb */ | ||
198 | [INSTR_RRE_0R] = { 0xff, R_28,0,0,0,0,0 }, /* e.g. tb */ | ||
199 | [INSTR_RRE_AA] = { 0xff, A_24,A_28,0,0,0,0 }, /* e.g. cpya */ | ||
200 | [INSTR_RRE_AR] = { 0xff, A_24,R_28,0,0,0,0 }, /* e.g. sar */ | ||
201 | [INSTR_RRE_F0] = { 0xff, F_24,0,0,0,0,0 }, /* e.g. sqer */ | ||
202 | [INSTR_RRE_FF] = { 0xff, F_24,F_28,0,0,0,0 }, /* e.g. debr */ | ||
203 | [INSTR_RRE_R0] = { 0xff, R_24,0,0,0,0,0 }, /* e.g. ipm */ | ||
204 | [INSTR_RRE_RA] = { 0xff, R_24,A_28,0,0,0,0 }, /* e.g. ear */ | ||
205 | [INSTR_RRE_RF] = { 0xff, R_24,F_28,0,0,0,0 }, /* e.g. cefbr */ | ||
206 | [INSTR_RRE_RR] = { 0xff, R_24,R_28,0,0,0,0 }, /* e.g. lura */ | ||
207 | [INSTR_RRE_RR_OPT]= { 0xff, R_24,RO_28,0,0,0,0 }, /* efpc, sfpc */ | ||
208 | [INSTR_RRF_F0FF] = { 0xff, F_16,F_24,F_28,0,0,0 }, /* e.g. madbr */ | ||
209 | [INSTR_RRF_FUFF] = { 0xff, F_24,F_16,F_28,U4_20,0,0 },/* e.g. didbr */ | ||
210 | [INSTR_RRF_RURR] = { 0xff, R_24,R_28,R_16,U4_20,0,0 },/* e.g. .insn */ | ||
211 | [INSTR_RRF_R0RR] = { 0xff, R_24,R_28,R_16,0,0,0 }, /* e.g. idte */ | ||
212 | [INSTR_RRF_U0FF] = { 0xff, F_24,U4_16,F_28,0,0,0 }, /* e.g. fixr */ | ||
213 | [INSTR_RRF_U0RF] = { 0xff, R_24,U4_16,F_28,0,0,0 }, /* e.g. cfebr */ | ||
214 | [INSTR_RRF_M0RR] = { 0xff, R_24,R_28,M_16,0,0,0 }, /* e.g. sske */ | ||
215 | [INSTR_RR_FF] = { 0xff, F_8,F_12,0,0,0,0 }, /* e.g. adr */ | ||
216 | [INSTR_RR_R0] = { 0xff, R_8, 0,0,0,0,0 }, /* e.g. spm */ | ||
217 | [INSTR_RR_RR] = { 0xff, R_8,R_12,0,0,0,0 }, /* e.g. lr */ | ||
218 | [INSTR_RR_U0] = { 0xff, U8_8, 0,0,0,0,0 }, /* e.g. svc */ | ||
219 | [INSTR_RR_UR] = { 0xff, U4_8,R_12,0,0,0,0 }, /* e.g. bcr */ | ||
220 | [INSTR_RSE_RRRD] = { 0xff, R_8,R_12,D_20,B_16,0,0 }, /* e.g. lmh */ | ||
221 | [INSTR_RSE_CCRD] = { 0xff, C_8,C_12,D_20,B_16,0,0 }, /* e.g. lmh */ | ||
222 | [INSTR_RSE_RURD] = { 0xff, R_8,U4_12,D_20,B_16,0,0 }, /* e.g. icmh */ | ||
223 | [INSTR_RSL_R0RD] = { 0xff, R_8,D_20,B_16,0,0,0 }, /* e.g. tp */ | ||
224 | [INSTR_RSI_RRP] = { 0xff, R_8,R_12,J16_16,0,0,0 }, /* e.g. brxh */ | ||
225 | [INSTR_RSY_RRRD] = { 0xff, R_8,R_12,D20_20,B_16,0,0 },/* e.g. stmy */ | ||
226 | [INSTR_RSY_RURD] = { 0xff, R_8,U4_12,D20_20,B_16,0,0 }, | ||
227 | /* e.g. icmh */ | ||
228 | [INSTR_RSY_AARD] = { 0xff, A_8,A_12,D20_20,B_16,0,0 },/* e.g. lamy */ | ||
229 | [INSTR_RSY_CCRD] = { 0xff, C_8,C_12,D20_20,B_16,0,0 },/* e.g. lamy */ | ||
230 | [INSTR_RS_AARD] = { 0xff, A_8,A_12,D_20,B_16,0,0 }, /* e.g. lam */ | ||
231 | [INSTR_RS_CCRD] = { 0xff, C_8,C_12,D_20,B_16,0,0 }, /* e.g. lctl */ | ||
232 | [INSTR_RS_R0RD] = { 0xff, R_8,D_20,B_16,0,0,0 }, /* e.g. sll */ | ||
233 | [INSTR_RS_RRRD] = { 0xff, R_8,R_12,D_20,B_16,0,0 }, /* e.g. cs */ | ||
234 | [INSTR_RS_RURD] = { 0xff, R_8,U4_12,D_20,B_16,0,0 }, /* e.g. icm */ | ||
235 | [INSTR_RXE_FRRD] = { 0xff, F_8,D_20,X_12,B_16,0,0 }, /* e.g. axbr */ | ||
236 | [INSTR_RXE_RRRD] = { 0xff, R_8,D_20,X_12,B_16,0,0 }, /* e.g. lg */ | ||
237 | [INSTR_RXF_FRRDF] = { 0xff, F_32,F_8,D_20,X_12,B_16,0 }, | ||
238 | /* e.g. madb */ | ||
239 | [INSTR_RXY_RRRD] = { 0xff, R_8,D20_20,X_12,B_16,0,0 },/* e.g. ly */ | ||
240 | [INSTR_RXY_FRRD] = { 0xff, F_8,D20_20,X_12,B_16,0,0 },/* e.g. ley */ | ||
241 | [INSTR_RX_FRRD] = { 0xff, F_8,D_20,X_12,B_16,0,0 }, /* e.g. ae */ | ||
242 | [INSTR_RX_RRRD] = { 0xff, R_8,D_20,X_12,B_16,0,0 }, /* e.g. l */ | ||
243 | [INSTR_RX_URRD] = { 0x00, U4_8,D_20,X_12,B_16,0,0 }, /* e.g. bc */ | ||
244 | [INSTR_SI_URD] = { 0x00, D_20,B_16,U8_8,0,0,0 }, /* e.g. cli */ | ||
245 | [INSTR_SIY_URD] = { 0xff, D20_20,B_16,U8_8,0,0,0 }, /* e.g. tmy */ | ||
246 | [INSTR_SSE_RDRD] = { 0xff, D_20,B_16,D_36,B_32,0,0 }, /* e.g. mvsdk */ | ||
247 | [INSTR_SS_L0RDRD] = { 0xff, D_20,L8_8,B_16,D_36,B_32,0 }, | ||
248 | /* e.g. mvc */ | ||
249 | [INSTR_SS_LIRDRD] = { 0xff, D_20,L4_8,B_16,D_36,B_32,U4_12 }, | ||
250 | /* e.g. srp */ | ||
251 | [INSTR_SS_LLRDRD] = { 0xff, D_20,L4_8,B_16,D_36,L4_12,B_32 }, | ||
252 | /* e.g. pack */ | ||
253 | [INSTR_SS_RRRDRD] = { 0xff, D_20,R_8,B_16,D_36,B_32,R_12 }, | ||
254 | /* e.g. mvck */ | ||
255 | [INSTR_SS_RRRDRD2]= { 0xff, R_8,D_20,B_16,R_12,D_36,B_32 }, | ||
256 | /* e.g. plo */ | ||
257 | [INSTR_SS_RRRDRD3]= { 0xff, R_8,R_12,D_20,B_16,D_36,B_32 }, | ||
258 | /* e.g. lmd */ | ||
259 | [INSTR_S_00] = { 0xff, 0,0,0,0,0,0 }, /* e.g. hsch */ | ||
260 | [INSTR_S_RD] = { 0xff, D_20,B_16,0,0,0,0 }, /* e.g. lpsw */ | ||
261 | [INSTR_SSF_RRDRD] = { 0x00, D_20,B_16,D_36,B_32,R_8,0 }, | ||
262 | /* e.g. mvcos */ | ||
263 | }; | ||
264 | |||
265 | static struct insn opcode[] = { | ||
266 | #ifdef CONFIG_64BIT | ||
267 | { "lmd", 0xef, INSTR_SS_RRRDRD3 }, | ||
268 | #endif | ||
269 | { "spm", 0x04, INSTR_RR_R0 }, | ||
270 | { "balr", 0x05, INSTR_RR_RR }, | ||
271 | { "bctr", 0x06, INSTR_RR_RR }, | ||
272 | { "bcr", 0x07, INSTR_RR_UR }, | ||
273 | { "svc", 0x0a, INSTR_RR_U0 }, | ||
274 | { "bsm", 0x0b, INSTR_RR_RR }, | ||
275 | { "bassm", 0x0c, INSTR_RR_RR }, | ||
276 | { "basr", 0x0d, INSTR_RR_RR }, | ||
277 | { "mvcl", 0x0e, INSTR_RR_RR }, | ||
278 | { "clcl", 0x0f, INSTR_RR_RR }, | ||
279 | { "lpr", 0x10, INSTR_RR_RR }, | ||
280 | { "lnr", 0x11, INSTR_RR_RR }, | ||
281 | { "ltr", 0x12, INSTR_RR_RR }, | ||
282 | { "lcr", 0x13, INSTR_RR_RR }, | ||
283 | { "nr", 0x14, INSTR_RR_RR }, | ||
284 | { "clr", 0x15, INSTR_RR_RR }, | ||
285 | { "or", 0x16, INSTR_RR_RR }, | ||
286 | { "xr", 0x17, INSTR_RR_RR }, | ||
287 | { "lr", 0x18, INSTR_RR_RR }, | ||
288 | { "cr", 0x19, INSTR_RR_RR }, | ||
289 | { "ar", 0x1a, INSTR_RR_RR }, | ||
290 | { "sr", 0x1b, INSTR_RR_RR }, | ||
291 | { "mr", 0x1c, INSTR_RR_RR }, | ||
292 | { "dr", 0x1d, INSTR_RR_RR }, | ||
293 | { "alr", 0x1e, INSTR_RR_RR }, | ||
294 | { "slr", 0x1f, INSTR_RR_RR }, | ||
295 | { "lpdr", 0x20, INSTR_RR_FF }, | ||
296 | { "lndr", 0x21, INSTR_RR_FF }, | ||
297 | { "ltdr", 0x22, INSTR_RR_FF }, | ||
298 | { "lcdr", 0x23, INSTR_RR_FF }, | ||
299 | { "hdr", 0x24, INSTR_RR_FF }, | ||
300 | { "ldxr", 0x25, INSTR_RR_FF }, | ||
301 | { "lrdr", 0x25, INSTR_RR_FF }, | ||
302 | { "mxr", 0x26, INSTR_RR_FF }, | ||
303 | { "mxdr", 0x27, INSTR_RR_FF }, | ||
304 | { "ldr", 0x28, INSTR_RR_FF }, | ||
305 | { "cdr", 0x29, INSTR_RR_FF }, | ||
306 | { "adr", 0x2a, INSTR_RR_FF }, | ||
307 | { "sdr", 0x2b, INSTR_RR_FF }, | ||
308 | { "mdr", 0x2c, INSTR_RR_FF }, | ||
309 | { "ddr", 0x2d, INSTR_RR_FF }, | ||
310 | { "awr", 0x2e, INSTR_RR_FF }, | ||
311 | { "swr", 0x2f, INSTR_RR_FF }, | ||
312 | { "lper", 0x30, INSTR_RR_FF }, | ||
313 | { "lner", 0x31, INSTR_RR_FF }, | ||
314 | { "lter", 0x32, INSTR_RR_FF }, | ||
315 | { "lcer", 0x33, INSTR_RR_FF }, | ||
316 | { "her", 0x34, INSTR_RR_FF }, | ||
317 | { "ledr", 0x35, INSTR_RR_FF }, | ||
318 | { "lrer", 0x35, INSTR_RR_FF }, | ||
319 | { "axr", 0x36, INSTR_RR_FF }, | ||
320 | { "sxr", 0x37, INSTR_RR_FF }, | ||
321 | { "ler", 0x38, INSTR_RR_FF }, | ||
322 | { "cer", 0x39, INSTR_RR_FF }, | ||
323 | { "aer", 0x3a, INSTR_RR_FF }, | ||
324 | { "ser", 0x3b, INSTR_RR_FF }, | ||
325 | { "mder", 0x3c, INSTR_RR_FF }, | ||
326 | { "mer", 0x3c, INSTR_RR_FF }, | ||
327 | { "der", 0x3d, INSTR_RR_FF }, | ||
328 | { "aur", 0x3e, INSTR_RR_FF }, | ||
329 | { "sur", 0x3f, INSTR_RR_FF }, | ||
330 | { "sth", 0x40, INSTR_RX_RRRD }, | ||
331 | { "la", 0x41, INSTR_RX_RRRD }, | ||
332 | { "stc", 0x42, INSTR_RX_RRRD }, | ||
333 | { "ic", 0x43, INSTR_RX_RRRD }, | ||
334 | { "ex", 0x44, INSTR_RX_RRRD }, | ||
335 | { "bal", 0x45, INSTR_RX_RRRD }, | ||
336 | { "bct", 0x46, INSTR_RX_RRRD }, | ||
337 | { "bc", 0x47, INSTR_RX_URRD }, | ||
338 | { "lh", 0x48, INSTR_RX_RRRD }, | ||
339 | { "ch", 0x49, INSTR_RX_RRRD }, | ||
340 | { "ah", 0x4a, INSTR_RX_RRRD }, | ||
341 | { "sh", 0x4b, INSTR_RX_RRRD }, | ||
342 | { "mh", 0x4c, INSTR_RX_RRRD }, | ||
343 | { "bas", 0x4d, INSTR_RX_RRRD }, | ||
344 | { "cvd", 0x4e, INSTR_RX_RRRD }, | ||
345 | { "cvb", 0x4f, INSTR_RX_RRRD }, | ||
346 | { "st", 0x50, INSTR_RX_RRRD }, | ||
347 | { "lae", 0x51, INSTR_RX_RRRD }, | ||
348 | { "n", 0x54, INSTR_RX_RRRD }, | ||
349 | { "cl", 0x55, INSTR_RX_RRRD }, | ||
350 | { "o", 0x56, INSTR_RX_RRRD }, | ||
351 | { "x", 0x57, INSTR_RX_RRRD }, | ||
352 | { "l", 0x58, INSTR_RX_RRRD }, | ||
353 | { "c", 0x59, INSTR_RX_RRRD }, | ||
354 | { "a", 0x5a, INSTR_RX_RRRD }, | ||
355 | { "s", 0x5b, INSTR_RX_RRRD }, | ||
356 | { "m", 0x5c, INSTR_RX_RRRD }, | ||
357 | { "d", 0x5d, INSTR_RX_RRRD }, | ||
358 | { "al", 0x5e, INSTR_RX_RRRD }, | ||
359 | { "sl", 0x5f, INSTR_RX_RRRD }, | ||
360 | { "std", 0x60, INSTR_RX_FRRD }, | ||
361 | { "mxd", 0x67, INSTR_RX_FRRD }, | ||
362 | { "ld", 0x68, INSTR_RX_FRRD }, | ||
363 | { "cd", 0x69, INSTR_RX_FRRD }, | ||
364 | { "ad", 0x6a, INSTR_RX_FRRD }, | ||
365 | { "sd", 0x6b, INSTR_RX_FRRD }, | ||
366 | { "md", 0x6c, INSTR_RX_FRRD }, | ||
367 | { "dd", 0x6d, INSTR_RX_FRRD }, | ||
368 | { "aw", 0x6e, INSTR_RX_FRRD }, | ||
369 | { "sw", 0x6f, INSTR_RX_FRRD }, | ||
370 | { "ste", 0x70, INSTR_RX_FRRD }, | ||
371 | { "ms", 0x71, INSTR_RX_RRRD }, | ||
372 | { "le", 0x78, INSTR_RX_FRRD }, | ||
373 | { "ce", 0x79, INSTR_RX_FRRD }, | ||
374 | { "ae", 0x7a, INSTR_RX_FRRD }, | ||
375 | { "se", 0x7b, INSTR_RX_FRRD }, | ||
376 | { "mde", 0x7c, INSTR_RX_FRRD }, | ||
377 | { "me", 0x7c, INSTR_RX_FRRD }, | ||
378 | { "de", 0x7d, INSTR_RX_FRRD }, | ||
379 | { "au", 0x7e, INSTR_RX_FRRD }, | ||
380 | { "su", 0x7f, INSTR_RX_FRRD }, | ||
381 | { "ssm", 0x80, INSTR_S_RD }, | ||
382 | { "lpsw", 0x82, INSTR_S_RD }, | ||
383 | { "diag", 0x83, INSTR_RS_RRRD }, | ||
384 | { "brxh", 0x84, INSTR_RSI_RRP }, | ||
385 | { "brxle", 0x85, INSTR_RSI_RRP }, | ||
386 | { "bxh", 0x86, INSTR_RS_RRRD }, | ||
387 | { "bxle", 0x87, INSTR_RS_RRRD }, | ||
388 | { "srl", 0x88, INSTR_RS_R0RD }, | ||
389 | { "sll", 0x89, INSTR_RS_R0RD }, | ||
390 | { "sra", 0x8a, INSTR_RS_R0RD }, | ||
391 | { "sla", 0x8b, INSTR_RS_R0RD }, | ||
392 | { "srdl", 0x8c, INSTR_RS_R0RD }, | ||
393 | { "sldl", 0x8d, INSTR_RS_R0RD }, | ||
394 | { "srda", 0x8e, INSTR_RS_R0RD }, | ||
395 | { "slda", 0x8f, INSTR_RS_R0RD }, | ||
396 | { "stm", 0x90, INSTR_RS_RRRD }, | ||
397 | { "tm", 0x91, INSTR_SI_URD }, | ||
398 | { "mvi", 0x92, INSTR_SI_URD }, | ||
399 | { "ts", 0x93, INSTR_S_RD }, | ||
400 | { "ni", 0x94, INSTR_SI_URD }, | ||
401 | { "cli", 0x95, INSTR_SI_URD }, | ||
402 | { "oi", 0x96, INSTR_SI_URD }, | ||
403 | { "xi", 0x97, INSTR_SI_URD }, | ||
404 | { "lm", 0x98, INSTR_RS_RRRD }, | ||
405 | { "trace", 0x99, INSTR_RS_RRRD }, | ||
406 | { "lam", 0x9a, INSTR_RS_AARD }, | ||
407 | { "stam", 0x9b, INSTR_RS_AARD }, | ||
408 | { "mvcle", 0xa8, INSTR_RS_RRRD }, | ||
409 | { "clcle", 0xa9, INSTR_RS_RRRD }, | ||
410 | { "stnsm", 0xac, INSTR_SI_URD }, | ||
411 | { "stosm", 0xad, INSTR_SI_URD }, | ||
412 | { "sigp", 0xae, INSTR_RS_RRRD }, | ||
413 | { "mc", 0xaf, INSTR_SI_URD }, | ||
414 | { "lra", 0xb1, INSTR_RX_RRRD }, | ||
415 | { "stctl", 0xb6, INSTR_RS_CCRD }, | ||
416 | { "lctl", 0xb7, INSTR_RS_CCRD }, | ||
417 | { "cs", 0xba, INSTR_RS_RRRD }, | ||
418 | { "cds", 0xbb, INSTR_RS_RRRD }, | ||
419 | { "clm", 0xbd, INSTR_RS_RURD }, | ||
420 | { "stcm", 0xbe, INSTR_RS_RURD }, | ||
421 | { "icm", 0xbf, INSTR_RS_RURD }, | ||
422 | { "mvn", 0xd1, INSTR_SS_L0RDRD }, | ||
423 | { "mvc", 0xd2, INSTR_SS_L0RDRD }, | ||
424 | { "mvz", 0xd3, INSTR_SS_L0RDRD }, | ||
425 | { "nc", 0xd4, INSTR_SS_L0RDRD }, | ||
426 | { "clc", 0xd5, INSTR_SS_L0RDRD }, | ||
427 | { "oc", 0xd6, INSTR_SS_L0RDRD }, | ||
428 | { "xc", 0xd7, INSTR_SS_L0RDRD }, | ||
429 | { "mvck", 0xd9, INSTR_SS_RRRDRD }, | ||
430 | { "mvcp", 0xda, INSTR_SS_RRRDRD }, | ||
431 | { "mvcs", 0xdb, INSTR_SS_RRRDRD }, | ||
432 | { "tr", 0xdc, INSTR_SS_L0RDRD }, | ||
433 | { "trt", 0xdd, INSTR_SS_L0RDRD }, | ||
434 | { "ed", 0xde, INSTR_SS_L0RDRD }, | ||
435 | { "edmk", 0xdf, INSTR_SS_L0RDRD }, | ||
436 | { "pku", 0xe1, INSTR_SS_L0RDRD }, | ||
437 | { "unpku", 0xe2, INSTR_SS_L0RDRD }, | ||
438 | { "mvcin", 0xe8, INSTR_SS_L0RDRD }, | ||
439 | { "pka", 0xe9, INSTR_SS_L0RDRD }, | ||
440 | { "unpka", 0xea, INSTR_SS_L0RDRD }, | ||
441 | { "plo", 0xee, INSTR_SS_RRRDRD2 }, | ||
442 | { "srp", 0xf0, INSTR_SS_LIRDRD }, | ||
443 | { "mvo", 0xf1, INSTR_SS_LLRDRD }, | ||
444 | { "pack", 0xf2, INSTR_SS_LLRDRD }, | ||
445 | { "unpk", 0xf3, INSTR_SS_LLRDRD }, | ||
446 | { "zap", 0xf8, INSTR_SS_LLRDRD }, | ||
447 | { "cp", 0xf9, INSTR_SS_LLRDRD }, | ||
448 | { "ap", 0xfa, INSTR_SS_LLRDRD }, | ||
449 | { "sp", 0xfb, INSTR_SS_LLRDRD }, | ||
450 | { "mp", 0xfc, INSTR_SS_LLRDRD }, | ||
451 | { "dp", 0xfd, INSTR_SS_LLRDRD }, | ||
452 | { "", 0, INSTR_INVALID } | ||
453 | }; | ||
454 | |||
455 | static struct insn opcode_01[] = { | ||
456 | #ifdef CONFIG_64BIT | ||
457 | { "sam64", 0x0e, INSTR_E }, | ||
458 | #endif | ||
459 | { "pr", 0x01, INSTR_E }, | ||
460 | { "upt", 0x02, INSTR_E }, | ||
461 | { "sckpf", 0x07, INSTR_E }, | ||
462 | { "tam", 0x0b, INSTR_E }, | ||
463 | { "sam24", 0x0c, INSTR_E }, | ||
464 | { "sam31", 0x0d, INSTR_E }, | ||
465 | { "trap2", 0xff, INSTR_E }, | ||
466 | { "", 0, INSTR_INVALID } | ||
467 | }; | ||
468 | |||
469 | static struct insn opcode_a5[] = { | ||
470 | #ifdef CONFIG_64BIT | ||
471 | { "iihh", 0x00, INSTR_RI_RU }, | ||
472 | { "iihl", 0x01, INSTR_RI_RU }, | ||
473 | { "iilh", 0x02, INSTR_RI_RU }, | ||
474 | { "iill", 0x03, INSTR_RI_RU }, | ||
475 | { "nihh", 0x04, INSTR_RI_RU }, | ||
476 | { "nihl", 0x05, INSTR_RI_RU }, | ||
477 | { "nilh", 0x06, INSTR_RI_RU }, | ||
478 | { "nill", 0x07, INSTR_RI_RU }, | ||
479 | { "oihh", 0x08, INSTR_RI_RU }, | ||
480 | { "oihl", 0x09, INSTR_RI_RU }, | ||
481 | { "oilh", 0x0a, INSTR_RI_RU }, | ||
482 | { "oill", 0x0b, INSTR_RI_RU }, | ||
483 | { "llihh", 0x0c, INSTR_RI_RU }, | ||
484 | { "llihl", 0x0d, INSTR_RI_RU }, | ||
485 | { "llilh", 0x0e, INSTR_RI_RU }, | ||
486 | { "llill", 0x0f, INSTR_RI_RU }, | ||
487 | #endif | ||
488 | { "", 0, INSTR_INVALID } | ||
489 | }; | ||
490 | |||
491 | static struct insn opcode_a7[] = { | ||
492 | #ifdef CONFIG_64BIT | ||
493 | { "tmhh", 0x02, INSTR_RI_RU }, | ||
494 | { "tmhl", 0x03, INSTR_RI_RU }, | ||
495 | { "brctg", 0x07, INSTR_RI_RP }, | ||
496 | { "lghi", 0x09, INSTR_RI_RI }, | ||
497 | { "aghi", 0x0b, INSTR_RI_RI }, | ||
498 | { "mghi", 0x0d, INSTR_RI_RI }, | ||
499 | { "cghi", 0x0f, INSTR_RI_RI }, | ||
500 | #endif | ||
501 | { "tmlh", 0x00, INSTR_RI_RU }, | ||
502 | { "tmll", 0x01, INSTR_RI_RU }, | ||
503 | { "brc", 0x04, INSTR_RI_UP }, | ||
504 | { "bras", 0x05, INSTR_RI_RP }, | ||
505 | { "brct", 0x06, INSTR_RI_RP }, | ||
506 | { "lhi", 0x08, INSTR_RI_RI }, | ||
507 | { "ahi", 0x0a, INSTR_RI_RI }, | ||
508 | { "mhi", 0x0c, INSTR_RI_RI }, | ||
509 | { "chi", 0x0e, INSTR_RI_RI }, | ||
510 | { "", 0, INSTR_INVALID } | ||
511 | }; | ||
512 | |||
513 | static struct insn opcode_b2[] = { | ||
514 | #ifdef CONFIG_64BIT | ||
515 | { "sske", 0x2b, INSTR_RRF_M0RR }, | ||
516 | { "stckf", 0x7c, INSTR_S_RD }, | ||
517 | { "cu21", 0xa6, INSTR_RRF_M0RR }, | ||
518 | { "cuutf", 0xa6, INSTR_RRF_M0RR }, | ||
519 | { "cu12", 0xa7, INSTR_RRF_M0RR }, | ||
520 | { "cutfu", 0xa7, INSTR_RRF_M0RR }, | ||
521 | { "stfle", 0xb0, INSTR_S_RD }, | ||
522 | { "lpswe", 0xb2, INSTR_S_RD }, | ||
523 | #endif | ||
524 | { "stidp", 0x02, INSTR_S_RD }, | ||
525 | { "sck", 0x04, INSTR_S_RD }, | ||
526 | { "stck", 0x05, INSTR_S_RD }, | ||
527 | { "sckc", 0x06, INSTR_S_RD }, | ||
528 | { "stckc", 0x07, INSTR_S_RD }, | ||
529 | { "spt", 0x08, INSTR_S_RD }, | ||
530 | { "stpt", 0x09, INSTR_S_RD }, | ||
531 | { "spka", 0x0a, INSTR_S_RD }, | ||
532 | { "ipk", 0x0b, INSTR_S_00 }, | ||
533 | { "ptlb", 0x0d, INSTR_S_00 }, | ||
534 | { "spx", 0x10, INSTR_S_RD }, | ||
535 | { "stpx", 0x11, INSTR_S_RD }, | ||
536 | { "stap", 0x12, INSTR_S_RD }, | ||
537 | { "sie", 0x14, INSTR_S_RD }, | ||
538 | { "pc", 0x18, INSTR_S_RD }, | ||
539 | { "sac", 0x19, INSTR_S_RD }, | ||
540 | { "cfc", 0x1a, INSTR_S_RD }, | ||
541 | { "ipte", 0x21, INSTR_RRE_RR }, | ||
542 | { "ipm", 0x22, INSTR_RRE_R0 }, | ||
543 | { "ivsk", 0x23, INSTR_RRE_RR }, | ||
544 | { "iac", 0x24, INSTR_RRE_R0 }, | ||
545 | { "ssar", 0x25, INSTR_RRE_R0 }, | ||
546 | { "epar", 0x26, INSTR_RRE_R0 }, | ||
547 | { "esar", 0x27, INSTR_RRE_R0 }, | ||
548 | { "pt", 0x28, INSTR_RRE_RR }, | ||
549 | { "iske", 0x29, INSTR_RRE_RR }, | ||
550 | { "rrbe", 0x2a, INSTR_RRE_RR }, | ||
551 | { "sske", 0x2b, INSTR_RRE_RR }, | ||
552 | { "tb", 0x2c, INSTR_RRE_0R }, | ||
553 | { "dxr", 0x2d, INSTR_RRE_F0 }, | ||
554 | { "pgin", 0x2e, INSTR_RRE_RR }, | ||
555 | { "pgout", 0x2f, INSTR_RRE_RR }, | ||
556 | { "csch", 0x30, INSTR_S_00 }, | ||
557 | { "hsch", 0x31, INSTR_S_00 }, | ||
558 | { "msch", 0x32, INSTR_S_RD }, | ||
559 | { "ssch", 0x33, INSTR_S_RD }, | ||
560 | { "stsch", 0x34, INSTR_S_RD }, | ||
561 | { "tsch", 0x35, INSTR_S_RD }, | ||
562 | { "tpi", 0x36, INSTR_S_RD }, | ||
563 | { "sal", 0x37, INSTR_S_00 }, | ||
564 | { "rsch", 0x38, INSTR_S_00 }, | ||
565 | { "stcrw", 0x39, INSTR_S_RD }, | ||
566 | { "stcps", 0x3a, INSTR_S_RD }, | ||
567 | { "rchp", 0x3b, INSTR_S_00 }, | ||
568 | { "schm", 0x3c, INSTR_S_00 }, | ||
569 | { "bakr", 0x40, INSTR_RRE_RR }, | ||
570 | { "cksm", 0x41, INSTR_RRE_RR }, | ||
571 | { "sqdr", 0x44, INSTR_RRE_F0 }, | ||
572 | { "sqer", 0x45, INSTR_RRE_F0 }, | ||
573 | { "stura", 0x46, INSTR_RRE_RR }, | ||
574 | { "msta", 0x47, INSTR_RRE_R0 }, | ||
575 | { "palb", 0x48, INSTR_RRE_00 }, | ||
576 | { "ereg", 0x49, INSTR_RRE_RR }, | ||
577 | { "esta", 0x4a, INSTR_RRE_RR }, | ||
578 | { "lura", 0x4b, INSTR_RRE_RR }, | ||
579 | { "tar", 0x4c, INSTR_RRE_AR }, | ||
580 | { "cpya", INSTR_RRE_AA }, | ||
581 | { "sar", 0x4e, INSTR_RRE_AR }, | ||
582 | { "ear", 0x4f, INSTR_RRE_RA }, | ||
583 | { "csp", 0x50, INSTR_RRE_RR }, | ||
584 | { "msr", 0x52, INSTR_RRE_RR }, | ||
585 | { "mvpg", 0x54, INSTR_RRE_RR }, | ||
586 | { "mvst", 0x55, INSTR_RRE_RR }, | ||
587 | { "cuse", 0x57, INSTR_RRE_RR }, | ||
588 | { "bsg", 0x58, INSTR_RRE_RR }, | ||
589 | { "bsa", 0x5a, INSTR_RRE_RR }, | ||
590 | { "clst", 0x5d, INSTR_RRE_RR }, | ||
591 | { "srst", 0x5e, INSTR_RRE_RR }, | ||
592 | { "cmpsc", 0x63, INSTR_RRE_RR }, | ||
593 | { "cmpsc", 0x63, INSTR_RRE_RR }, | ||
594 | { "siga", 0x74, INSTR_S_RD }, | ||
595 | { "xsch", 0x76, INSTR_S_00 }, | ||
596 | { "rp", 0x77, INSTR_S_RD }, | ||
597 | { "stcke", 0x78, INSTR_S_RD }, | ||
598 | { "sacf", 0x79, INSTR_S_RD }, | ||
599 | { "stsi", 0x7d, INSTR_S_RD }, | ||
600 | { "srnm", 0x99, INSTR_S_RD }, | ||
601 | { "stfpc", 0x9c, INSTR_S_RD }, | ||
602 | { "lfpc", 0x9d, INSTR_S_RD }, | ||
603 | { "tre", 0xa5, INSTR_RRE_RR }, | ||
604 | { "cuutf", 0xa6, INSTR_RRE_RR }, | ||
605 | { "cutfu", 0xa7, INSTR_RRE_RR }, | ||
606 | { "stfl", 0xb1, INSTR_S_RD }, | ||
607 | { "trap4", 0xff, INSTR_S_RD }, | ||
608 | { "", 0, INSTR_INVALID } | ||
609 | }; | ||
610 | |||
611 | static struct insn opcode_b3[] = { | ||
612 | #ifdef CONFIG_64BIT | ||
613 | { "maylr", 0x38, INSTR_RRF_F0FF }, | ||
614 | { "mylr", 0x39, INSTR_RRF_F0FF }, | ||
615 | { "mayr", 0x3a, INSTR_RRF_F0FF }, | ||
616 | { "myr", 0x3b, INSTR_RRF_F0FF }, | ||
617 | { "mayhr", 0x3c, INSTR_RRF_F0FF }, | ||
618 | { "myhr", 0x3d, INSTR_RRF_F0FF }, | ||
619 | { "cegbr", 0xa4, INSTR_RRE_RR }, | ||
620 | { "cdgbr", 0xa5, INSTR_RRE_RR }, | ||
621 | { "cxgbr", 0xa6, INSTR_RRE_RR }, | ||
622 | { "cgebr", 0xa8, INSTR_RRF_U0RF }, | ||
623 | { "cgdbr", 0xa9, INSTR_RRF_U0RF }, | ||
624 | { "cgxbr", 0xaa, INSTR_RRF_U0RF }, | ||
625 | { "cfer", 0xb8, INSTR_RRF_U0RF }, | ||
626 | { "cfdr", 0xb9, INSTR_RRF_U0RF }, | ||
627 | { "cfxr", 0xba, INSTR_RRF_U0RF }, | ||
628 | { "cegr", 0xc4, INSTR_RRE_RR }, | ||
629 | { "cdgr", 0xc5, INSTR_RRE_RR }, | ||
630 | { "cxgr", 0xc6, INSTR_RRE_RR }, | ||
631 | { "cger", 0xc8, INSTR_RRF_U0RF }, | ||
632 | { "cgdr", 0xc9, INSTR_RRF_U0RF }, | ||
633 | { "cgxr", 0xca, INSTR_RRF_U0RF }, | ||
634 | #endif | ||
635 | { "lpebr", 0x00, INSTR_RRE_FF }, | ||
636 | { "lnebr", 0x01, INSTR_RRE_FF }, | ||
637 | { "ltebr", 0x02, INSTR_RRE_FF }, | ||
638 | { "lcebr", 0x03, INSTR_RRE_FF }, | ||
639 | { "ldebr", 0x04, INSTR_RRE_FF }, | ||
640 | { "lxdbr", 0x05, INSTR_RRE_FF }, | ||
641 | { "lxebr", 0x06, INSTR_RRE_FF }, | ||
642 | { "mxdbr", 0x07, INSTR_RRE_FF }, | ||
643 | { "kebr", 0x08, INSTR_RRE_FF }, | ||
644 | { "cebr", 0x09, INSTR_RRE_FF }, | ||
645 | { "aebr", 0x0a, INSTR_RRE_FF }, | ||
646 | { "sebr", 0x0b, INSTR_RRE_FF }, | ||
647 | { "mdebr", 0x0c, INSTR_RRE_FF }, | ||
648 | { "debr", 0x0d, INSTR_RRE_FF }, | ||
649 | { "maebr", 0x0e, INSTR_RRF_F0FF }, | ||
650 | { "msebr", 0x0f, INSTR_RRF_F0FF }, | ||
651 | { "lpdbr", 0x10, INSTR_RRE_FF }, | ||
652 | { "lndbr", 0x11, INSTR_RRE_FF }, | ||
653 | { "ltdbr", 0x12, INSTR_RRE_FF }, | ||
654 | { "lcdbr", 0x13, INSTR_RRE_FF }, | ||
655 | { "sqebr", 0x14, INSTR_RRE_FF }, | ||
656 | { "sqdbr", 0x15, INSTR_RRE_FF }, | ||
657 | { "sqxbr", 0x16, INSTR_RRE_FF }, | ||
658 | { "meebr", 0x17, INSTR_RRE_FF }, | ||
659 | { "kdbr", 0x18, INSTR_RRE_FF }, | ||
660 | { "cdbr", 0x19, INSTR_RRE_FF }, | ||
661 | { "adbr", 0x1a, INSTR_RRE_FF }, | ||
662 | { "sdbr", 0x1b, INSTR_RRE_FF }, | ||
663 | { "mdbr", 0x1c, INSTR_RRE_FF }, | ||
664 | { "ddbr", 0x1d, INSTR_RRE_FF }, | ||
665 | { "madbr", 0x1e, INSTR_RRF_F0FF }, | ||
666 | { "msdbr", 0x1f, INSTR_RRF_F0FF }, | ||
667 | { "lder", 0x24, INSTR_RRE_FF }, | ||
668 | { "lxdr", 0x25, INSTR_RRE_FF }, | ||
669 | { "lxer", 0x26, INSTR_RRE_FF }, | ||
670 | { "maer", 0x2e, INSTR_RRF_F0FF }, | ||
671 | { "mser", 0x2f, INSTR_RRF_F0FF }, | ||
672 | { "sqxr", 0x36, INSTR_RRE_FF }, | ||
673 | { "meer", 0x37, INSTR_RRE_FF }, | ||
674 | { "madr", 0x3e, INSTR_RRF_F0FF }, | ||
675 | { "msdr", 0x3f, INSTR_RRF_F0FF }, | ||
676 | { "lpxbr", 0x40, INSTR_RRE_FF }, | ||
677 | { "lnxbr", 0x41, INSTR_RRE_FF }, | ||
678 | { "ltxbr", 0x42, INSTR_RRE_FF }, | ||
679 | { "lcxbr", 0x43, INSTR_RRE_FF }, | ||
680 | { "ledbr", 0x44, INSTR_RRE_FF }, | ||
681 | { "ldxbr", 0x45, INSTR_RRE_FF }, | ||
682 | { "lexbr", 0x46, INSTR_RRE_FF }, | ||
683 | { "fixbr", 0x47, INSTR_RRF_U0FF }, | ||
684 | { "kxbr", 0x48, INSTR_RRE_FF }, | ||
685 | { "cxbr", 0x49, INSTR_RRE_FF }, | ||
686 | { "axbr", 0x4a, INSTR_RRE_FF }, | ||
687 | { "sxbr", 0x4b, INSTR_RRE_FF }, | ||
688 | { "mxbr", 0x4c, INSTR_RRE_FF }, | ||
689 | { "dxbr", 0x4d, INSTR_RRE_FF }, | ||
690 | { "tbedr", 0x50, INSTR_RRF_U0FF }, | ||
691 | { "tbdr", 0x51, INSTR_RRF_U0FF }, | ||
692 | { "diebr", 0x53, INSTR_RRF_FUFF }, | ||
693 | { "fiebr", 0x57, INSTR_RRF_U0FF }, | ||
694 | { "thder", 0x58, INSTR_RRE_RR }, | ||
695 | { "thdr", 0x59, INSTR_RRE_RR }, | ||
696 | { "didbr", 0x5b, INSTR_RRF_FUFF }, | ||
697 | { "fidbr", 0x5f, INSTR_RRF_U0FF }, | ||
698 | { "lpxr", 0x60, INSTR_RRE_FF }, | ||
699 | { "lnxr", 0x61, INSTR_RRE_FF }, | ||
700 | { "ltxr", 0x62, INSTR_RRE_FF }, | ||
701 | { "lcxr", 0x63, INSTR_RRE_FF }, | ||
702 | { "lxr", 0x65, INSTR_RRE_RR }, | ||
703 | { "lexr", 0x66, INSTR_RRE_FF }, | ||
704 | { "fixr", 0x67, INSTR_RRF_U0FF }, | ||
705 | { "cxr", 0x69, INSTR_RRE_FF }, | ||
706 | { "lzer", 0x74, INSTR_RRE_R0 }, | ||
707 | { "lzdr", 0x75, INSTR_RRE_R0 }, | ||
708 | { "lzxr", 0x76, INSTR_RRE_R0 }, | ||
709 | { "fier", 0x77, INSTR_RRF_U0FF }, | ||
710 | { "fidr", 0x7f, INSTR_RRF_U0FF }, | ||
711 | { "sfpc", 0x84, INSTR_RRE_RR_OPT }, | ||
712 | { "efpc", 0x8c, INSTR_RRE_RR_OPT }, | ||
713 | { "cefbr", 0x94, INSTR_RRE_RF }, | ||
714 | { "cdfbr", 0x95, INSTR_RRE_RF }, | ||
715 | { "cxfbr", 0x96, INSTR_RRE_RF }, | ||
716 | { "cfebr", 0x98, INSTR_RRF_U0RF }, | ||
717 | { "cfdbr", 0x99, INSTR_RRF_U0RF }, | ||
718 | { "cfxbr", 0x9a, INSTR_RRF_U0RF }, | ||
719 | { "cefr", 0xb4, INSTR_RRE_RF }, | ||
720 | { "cdfr", 0xb5, INSTR_RRE_RF }, | ||
721 | { "cxfr", 0xb6, INSTR_RRE_RF }, | ||
722 | { "", 0, INSTR_INVALID } | ||
723 | }; | ||
724 | |||
725 | static struct insn opcode_b9[] = { | ||
726 | #ifdef CONFIG_64BIT | ||
727 | { "lpgr", 0x00, INSTR_RRE_RR }, | ||
728 | { "lngr", 0x01, INSTR_RRE_RR }, | ||
729 | { "ltgr", 0x02, INSTR_RRE_RR }, | ||
730 | { "lcgr", 0x03, INSTR_RRE_RR }, | ||
731 | { "lgr", 0x04, INSTR_RRE_RR }, | ||
732 | { "lurag", 0x05, INSTR_RRE_RR }, | ||
733 | { "lgbr", 0x06, INSTR_RRE_RR }, | ||
734 | { "lghr", 0x07, INSTR_RRE_RR }, | ||
735 | { "agr", 0x08, INSTR_RRE_RR }, | ||
736 | { "sgr", 0x09, INSTR_RRE_RR }, | ||
737 | { "algr", 0x0a, INSTR_RRE_RR }, | ||
738 | { "slgr", 0x0b, INSTR_RRE_RR }, | ||
739 | { "msgr", 0x0c, INSTR_RRE_RR }, | ||
740 | { "dsgr", 0x0d, INSTR_RRE_RR }, | ||
741 | { "eregg", 0x0e, INSTR_RRE_RR }, | ||
742 | { "lrvgr", 0x0f, INSTR_RRE_RR }, | ||
743 | { "lpgfr", 0x10, INSTR_RRE_RR }, | ||
744 | { "lngfr", 0x11, INSTR_RRE_RR }, | ||
745 | { "ltgfr", 0x12, INSTR_RRE_RR }, | ||
746 | { "lcgfr", 0x13, INSTR_RRE_RR }, | ||
747 | { "lgfr", 0x14, INSTR_RRE_RR }, | ||
748 | { "llgfr", 0x16, INSTR_RRE_RR }, | ||
749 | { "llgtr", 0x17, INSTR_RRE_RR }, | ||
750 | { "agfr", 0x18, INSTR_RRE_RR }, | ||
751 | { "sgfr", 0x19, INSTR_RRE_RR }, | ||
752 | { "algfr", 0x1a, INSTR_RRE_RR }, | ||
753 | { "slgfr", 0x1b, INSTR_RRE_RR }, | ||
754 | { "msgfr", 0x1c, INSTR_RRE_RR }, | ||
755 | { "dsgfr", 0x1d, INSTR_RRE_RR }, | ||
756 | { "cgr", 0x20, INSTR_RRE_RR }, | ||
757 | { "clgr", 0x21, INSTR_RRE_RR }, | ||
758 | { "sturg", 0x25, INSTR_RRE_RR }, | ||
759 | { "lbr", 0x26, INSTR_RRE_RR }, | ||
760 | { "lhr", 0x27, INSTR_RRE_RR }, | ||
761 | { "cgfr", 0x30, INSTR_RRE_RR }, | ||
762 | { "clgfr", 0x31, INSTR_RRE_RR }, | ||
763 | { "bctgr", 0x46, INSTR_RRE_RR }, | ||
764 | { "ngr", 0x80, INSTR_RRE_RR }, | ||
765 | { "ogr", 0x81, INSTR_RRE_RR }, | ||
766 | { "xgr", 0x82, INSTR_RRE_RR }, | ||
767 | { "flogr", 0x83, INSTR_RRE_RR }, | ||
768 | { "llgcr", 0x84, INSTR_RRE_RR }, | ||
769 | { "llghr", 0x85, INSTR_RRE_RR }, | ||
770 | { "mlgr", 0x86, INSTR_RRE_RR }, | ||
771 | { "dlgr", 0x87, INSTR_RRE_RR }, | ||
772 | { "alcgr", 0x88, INSTR_RRE_RR }, | ||
773 | { "slbgr", 0x89, INSTR_RRE_RR }, | ||
774 | { "cspg", 0x8a, INSTR_RRE_RR }, | ||
775 | { "idte", 0x8e, INSTR_RRF_R0RR }, | ||
776 | { "llcr", 0x94, INSTR_RRE_RR }, | ||
777 | { "llhr", 0x95, INSTR_RRE_RR }, | ||
778 | { "esea", 0x9d, INSTR_RRE_R0 }, | ||
779 | { "lptea", 0xaa, INSTR_RRF_RURR }, | ||
780 | { "cu14", 0xb0, INSTR_RRF_M0RR }, | ||
781 | { "cu24", 0xb1, INSTR_RRF_M0RR }, | ||
782 | { "cu41", 0xb2, INSTR_RRF_M0RR }, | ||
783 | { "cu42", 0xb3, INSTR_RRF_M0RR }, | ||
784 | #endif | ||
785 | { "kmac", 0x1e, INSTR_RRE_RR }, | ||
786 | { "lrvr", 0x1f, INSTR_RRE_RR }, | ||
787 | { "km", 0x2e, INSTR_RRE_RR }, | ||
788 | { "kmc", 0x2f, INSTR_RRE_RR }, | ||
789 | { "kimd", 0x3e, INSTR_RRE_RR }, | ||
790 | { "klmd", 0x3f, INSTR_RRE_RR }, | ||
791 | { "epsw", 0x8d, INSTR_RRE_RR }, | ||
792 | { "trtt", 0x90, INSTR_RRE_RR }, | ||
793 | { "trtt", 0x90, INSTR_RRF_M0RR }, | ||
794 | { "trto", 0x91, INSTR_RRE_RR }, | ||
795 | { "trto", 0x91, INSTR_RRF_M0RR }, | ||
796 | { "trot", 0x92, INSTR_RRE_RR }, | ||
797 | { "trot", 0x92, INSTR_RRF_M0RR }, | ||
798 | { "troo", 0x93, INSTR_RRE_RR }, | ||
799 | { "troo", 0x93, INSTR_RRF_M0RR }, | ||
800 | { "mlr", 0x96, INSTR_RRE_RR }, | ||
801 | { "dlr", 0x97, INSTR_RRE_RR }, | ||
802 | { "alcr", 0x98, INSTR_RRE_RR }, | ||
803 | { "slbr", 0x99, INSTR_RRE_RR }, | ||
804 | { "", 0, INSTR_INVALID } | ||
805 | }; | ||
806 | |||
807 | static struct insn opcode_c0[] = { | ||
808 | #ifdef CONFIG_64BIT | ||
809 | { "lgfi", 0x01, INSTR_RIL_RI }, | ||
810 | { "xihf", 0x06, INSTR_RIL_RU }, | ||
811 | { "xilf", 0x07, INSTR_RIL_RU }, | ||
812 | { "iihf", 0x08, INSTR_RIL_RU }, | ||
813 | { "iilf", 0x09, INSTR_RIL_RU }, | ||
814 | { "nihf", 0x0a, INSTR_RIL_RU }, | ||
815 | { "nilf", 0x0b, INSTR_RIL_RU }, | ||
816 | { "oihf", 0x0c, INSTR_RIL_RU }, | ||
817 | { "oilf", 0x0d, INSTR_RIL_RU }, | ||
818 | { "llihf", 0x0e, INSTR_RIL_RU }, | ||
819 | { "llilf", 0x0f, INSTR_RIL_RU }, | ||
820 | #endif | ||
821 | { "larl", 0x00, INSTR_RIL_RP }, | ||
822 | { "brcl", 0x04, INSTR_RIL_UP }, | ||
823 | { "brasl", 0x05, INSTR_RIL_RP }, | ||
824 | { "", 0, INSTR_INVALID } | ||
825 | }; | ||
826 | |||
827 | static struct insn opcode_c2[] = { | ||
828 | #ifdef CONFIG_64BIT | ||
829 | { "slgfi", 0x04, INSTR_RIL_RU }, | ||
830 | { "slfi", 0x05, INSTR_RIL_RU }, | ||
831 | { "agfi", 0x08, INSTR_RIL_RI }, | ||
832 | { "afi", 0x09, INSTR_RIL_RI }, | ||
833 | { "algfi", 0x0a, INSTR_RIL_RU }, | ||
834 | { "alfi", 0x0b, INSTR_RIL_RU }, | ||
835 | { "cgfi", 0x0c, INSTR_RIL_RI }, | ||
836 | { "cfi", 0x0d, INSTR_RIL_RI }, | ||
837 | { "clgfi", 0x0e, INSTR_RIL_RU }, | ||
838 | { "clfi", 0x0f, INSTR_RIL_RU }, | ||
839 | #endif | ||
840 | { "", 0, INSTR_INVALID } | ||
841 | }; | ||
842 | |||
843 | static struct insn opcode_c8[] = { | ||
844 | #ifdef CONFIG_64BIT | ||
845 | { "mvcos", 0x00, INSTR_SSF_RRDRD }, | ||
846 | #endif | ||
847 | { "", 0, INSTR_INVALID } | ||
848 | }; | ||
849 | |||
850 | static struct insn opcode_e3[] = { | ||
851 | #ifdef CONFIG_64BIT | ||
852 | { "ltg", 0x02, INSTR_RXY_RRRD }, | ||
853 | { "lrag", 0x03, INSTR_RXY_RRRD }, | ||
854 | { "lg", 0x04, INSTR_RXY_RRRD }, | ||
855 | { "cvby", 0x06, INSTR_RXY_RRRD }, | ||
856 | { "ag", 0x08, INSTR_RXY_RRRD }, | ||
857 | { "sg", 0x09, INSTR_RXY_RRRD }, | ||
858 | { "alg", 0x0a, INSTR_RXY_RRRD }, | ||
859 | { "slg", 0x0b, INSTR_RXY_RRRD }, | ||
860 | { "msg", 0x0c, INSTR_RXY_RRRD }, | ||
861 | { "dsg", 0x0d, INSTR_RXY_RRRD }, | ||
862 | { "cvbg", 0x0e, INSTR_RXY_RRRD }, | ||
863 | { "lrvg", 0x0f, INSTR_RXY_RRRD }, | ||
864 | { "lt", 0x12, INSTR_RXY_RRRD }, | ||
865 | { "lray", 0x13, INSTR_RXY_RRRD }, | ||
866 | { "lgf", 0x14, INSTR_RXY_RRRD }, | ||
867 | { "lgh", 0x15, INSTR_RXY_RRRD }, | ||
868 | { "llgf", 0x16, INSTR_RXY_RRRD }, | ||
869 | { "llgt", 0x17, INSTR_RXY_RRRD }, | ||
870 | { "agf", 0x18, INSTR_RXY_RRRD }, | ||
871 | { "sgf", 0x19, INSTR_RXY_RRRD }, | ||
872 | { "algf", 0x1a, INSTR_RXY_RRRD }, | ||
873 | { "slgf", 0x1b, INSTR_RXY_RRRD }, | ||
874 | { "msgf", 0x1c, INSTR_RXY_RRRD }, | ||
875 | { "dsgf", 0x1d, INSTR_RXY_RRRD }, | ||
876 | { "cg", 0x20, INSTR_RXY_RRRD }, | ||
877 | { "clg", 0x21, INSTR_RXY_RRRD }, | ||
878 | { "stg", 0x24, INSTR_RXY_RRRD }, | ||
879 | { "cvdy", 0x26, INSTR_RXY_RRRD }, | ||
880 | { "cvdg", 0x2e, INSTR_RXY_RRRD }, | ||
881 | { "strvg", 0x2f, INSTR_RXY_RRRD }, | ||
882 | { "cgf", 0x30, INSTR_RXY_RRRD }, | ||
883 | { "clgf", 0x31, INSTR_RXY_RRRD }, | ||
884 | { "strvh", 0x3f, INSTR_RXY_RRRD }, | ||
885 | { "bctg", 0x46, INSTR_RXY_RRRD }, | ||
886 | { "sty", 0x50, INSTR_RXY_RRRD }, | ||
887 | { "msy", 0x51, INSTR_RXY_RRRD }, | ||
888 | { "ny", 0x54, INSTR_RXY_RRRD }, | ||
889 | { "cly", 0x55, INSTR_RXY_RRRD }, | ||
890 | { "oy", 0x56, INSTR_RXY_RRRD }, | ||
891 | { "xy", 0x57, INSTR_RXY_RRRD }, | ||
892 | { "ly", 0x58, INSTR_RXY_RRRD }, | ||
893 | { "cy", 0x59, INSTR_RXY_RRRD }, | ||
894 | { "ay", 0x5a, INSTR_RXY_RRRD }, | ||
895 | { "sy", 0x5b, INSTR_RXY_RRRD }, | ||
896 | { "aly", 0x5e, INSTR_RXY_RRRD }, | ||
897 | { "sly", 0x5f, INSTR_RXY_RRRD }, | ||
898 | { "sthy", 0x70, INSTR_RXY_RRRD }, | ||
899 | { "lay", 0x71, INSTR_RXY_RRRD }, | ||
900 | { "stcy", 0x72, INSTR_RXY_RRRD }, | ||
901 | { "icy", 0x73, INSTR_RXY_RRRD }, | ||
902 | { "lb", 0x76, INSTR_RXY_RRRD }, | ||
903 | { "lgb", 0x77, INSTR_RXY_RRRD }, | ||
904 | { "lhy", 0x78, INSTR_RXY_RRRD }, | ||
905 | { "chy", 0x79, INSTR_RXY_RRRD }, | ||
906 | { "ahy", 0x7a, INSTR_RXY_RRRD }, | ||
907 | { "shy", 0x7b, INSTR_RXY_RRRD }, | ||
908 | { "ng", 0x80, INSTR_RXY_RRRD }, | ||
909 | { "og", 0x81, INSTR_RXY_RRRD }, | ||
910 | { "xg", 0x82, INSTR_RXY_RRRD }, | ||
911 | { "mlg", 0x86, INSTR_RXY_RRRD }, | ||
912 | { "dlg", 0x87, INSTR_RXY_RRRD }, | ||
913 | { "alcg", 0x88, INSTR_RXY_RRRD }, | ||
914 | { "slbg", 0x89, INSTR_RXY_RRRD }, | ||
915 | { "stpq", 0x8e, INSTR_RXY_RRRD }, | ||
916 | { "lpq", 0x8f, INSTR_RXY_RRRD }, | ||
917 | { "llgc", 0x90, INSTR_RXY_RRRD }, | ||
918 | { "llgh", 0x91, INSTR_RXY_RRRD }, | ||
919 | { "llc", 0x94, INSTR_RXY_RRRD }, | ||
920 | { "llh", 0x95, INSTR_RXY_RRRD }, | ||
921 | #endif | ||
922 | { "lrv", 0x1e, INSTR_RXY_RRRD }, | ||
923 | { "lrvh", 0x1f, INSTR_RXY_RRRD }, | ||
924 | { "strv", 0x3e, INSTR_RXY_RRRD }, | ||
925 | { "ml", 0x96, INSTR_RXY_RRRD }, | ||
926 | { "dl", 0x97, INSTR_RXY_RRRD }, | ||
927 | { "alc", 0x98, INSTR_RXY_RRRD }, | ||
928 | { "slb", 0x99, INSTR_RXY_RRRD }, | ||
929 | { "", 0, INSTR_INVALID } | ||
930 | }; | ||
931 | |||
932 | static struct insn opcode_e5[] = { | ||
933 | #ifdef CONFIG_64BIT | ||
934 | { "strag", 0x02, INSTR_SSE_RDRD }, | ||
935 | #endif | ||
936 | { "lasp", 0x00, INSTR_SSE_RDRD }, | ||
937 | { "tprot", 0x01, INSTR_SSE_RDRD }, | ||
938 | { "mvcsk", 0x0e, INSTR_SSE_RDRD }, | ||
939 | { "mvcdk", 0x0f, INSTR_SSE_RDRD }, | ||
940 | { "", 0, INSTR_INVALID } | ||
941 | }; | ||
942 | |||
943 | static struct insn opcode_eb[] = { | ||
944 | #ifdef CONFIG_64BIT | ||
945 | { "lmg", 0x04, INSTR_RSY_RRRD }, | ||
946 | { "srag", 0x0a, INSTR_RSY_RRRD }, | ||
947 | { "slag", 0x0b, INSTR_RSY_RRRD }, | ||
948 | { "srlg", 0x0c, INSTR_RSY_RRRD }, | ||
949 | { "sllg", 0x0d, INSTR_RSY_RRRD }, | ||
950 | { "tracg", 0x0f, INSTR_RSY_RRRD }, | ||
951 | { "csy", 0x14, INSTR_RSY_RRRD }, | ||
952 | { "rllg", 0x1c, INSTR_RSY_RRRD }, | ||
953 | { "clmh", 0x20, INSTR_RSY_RURD }, | ||
954 | { "clmy", 0x21, INSTR_RSY_RURD }, | ||
955 | { "stmg", 0x24, INSTR_RSY_RRRD }, | ||
956 | { "stctg", 0x25, INSTR_RSY_CCRD }, | ||
957 | { "stmh", 0x26, INSTR_RSY_RRRD }, | ||
958 | { "stcmh", 0x2c, INSTR_RSY_RURD }, | ||
959 | { "stcmy", 0x2d, INSTR_RSY_RURD }, | ||
960 | { "lctlg", 0x2f, INSTR_RSY_CCRD }, | ||
961 | { "csg", 0x30, INSTR_RSY_RRRD }, | ||
962 | { "cdsy", 0x31, INSTR_RSY_RRRD }, | ||
963 | { "cdsg", 0x3e, INSTR_RSY_RRRD }, | ||
964 | { "bxhg", 0x44, INSTR_RSY_RRRD }, | ||
965 | { "bxleg", 0x45, INSTR_RSY_RRRD }, | ||
966 | { "tmy", 0x51, INSTR_SIY_URD }, | ||
967 | { "mviy", 0x52, INSTR_SIY_URD }, | ||
968 | { "niy", 0x54, INSTR_SIY_URD }, | ||
969 | { "cliy", 0x55, INSTR_SIY_URD }, | ||
970 | { "oiy", 0x56, INSTR_SIY_URD }, | ||
971 | { "xiy", 0x57, INSTR_SIY_URD }, | ||
972 | { "icmh", 0x80, INSTR_RSE_RURD }, | ||
973 | { "icmh", 0x80, INSTR_RSY_RURD }, | ||
974 | { "icmy", 0x81, INSTR_RSY_RURD }, | ||
975 | { "clclu", 0x8f, INSTR_RSY_RRRD }, | ||
976 | { "stmy", 0x90, INSTR_RSY_RRRD }, | ||
977 | { "lmh", 0x96, INSTR_RSY_RRRD }, | ||
978 | { "lmy", 0x98, INSTR_RSY_RRRD }, | ||
979 | { "lamy", 0x9a, INSTR_RSY_AARD }, | ||
980 | { "stamy", 0x9b, INSTR_RSY_AARD }, | ||
981 | #endif | ||
982 | { "rll", 0x1d, INSTR_RSY_RRRD }, | ||
983 | { "mvclu", 0x8e, INSTR_RSY_RRRD }, | ||
984 | { "tp", 0xc0, INSTR_RSL_R0RD }, | ||
985 | { "", 0, INSTR_INVALID } | ||
986 | }; | ||
987 | |||
988 | static struct insn opcode_ec[] = { | ||
989 | #ifdef CONFIG_64BIT | ||
990 | { "brxhg", 0x44, INSTR_RIE_RRP }, | ||
991 | { "brxlg", 0x45, INSTR_RIE_RRP }, | ||
992 | #endif | ||
993 | { "", 0, INSTR_INVALID } | ||
994 | }; | ||
995 | |||
996 | static struct insn opcode_ed[] = { | ||
997 | #ifdef CONFIG_64BIT | ||
998 | { "mayl", 0x38, INSTR_RXF_FRRDF }, | ||
999 | { "myl", 0x39, INSTR_RXF_FRRDF }, | ||
1000 | { "may", 0x3a, INSTR_RXF_FRRDF }, | ||
1001 | { "my", 0x3b, INSTR_RXF_FRRDF }, | ||
1002 | { "mayh", 0x3c, INSTR_RXF_FRRDF }, | ||
1003 | { "myh", 0x3d, INSTR_RXF_FRRDF }, | ||
1004 | { "ley", 0x64, INSTR_RXY_FRRD }, | ||
1005 | { "ldy", 0x65, INSTR_RXY_FRRD }, | ||
1006 | { "stey", 0x66, INSTR_RXY_FRRD }, | ||
1007 | { "stdy", 0x67, INSTR_RXY_FRRD }, | ||
1008 | #endif | ||
1009 | { "ldeb", 0x04, INSTR_RXE_FRRD }, | ||
1010 | { "lxdb", 0x05, INSTR_RXE_FRRD }, | ||
1011 | { "lxeb", 0x06, INSTR_RXE_FRRD }, | ||
1012 | { "mxdb", 0x07, INSTR_RXE_FRRD }, | ||
1013 | { "keb", 0x08, INSTR_RXE_FRRD }, | ||
1014 | { "ceb", 0x09, INSTR_RXE_FRRD }, | ||
1015 | { "aeb", 0x0a, INSTR_RXE_FRRD }, | ||
1016 | { "seb", 0x0b, INSTR_RXE_FRRD }, | ||
1017 | { "mdeb", 0x0c, INSTR_RXE_FRRD }, | ||
1018 | { "deb", 0x0d, INSTR_RXE_FRRD }, | ||
1019 | { "maeb", 0x0e, INSTR_RXF_FRRDF }, | ||
1020 | { "mseb", 0x0f, INSTR_RXF_FRRDF }, | ||
1021 | { "tceb", 0x10, INSTR_RXE_FRRD }, | ||
1022 | { "tcdb", 0x11, INSTR_RXE_FRRD }, | ||
1023 | { "tcxb", 0x12, INSTR_RXE_FRRD }, | ||
1024 | { "sqeb", 0x14, INSTR_RXE_FRRD }, | ||
1025 | { "sqdb", 0x15, INSTR_RXE_FRRD }, | ||
1026 | { "meeb", 0x17, INSTR_RXE_FRRD }, | ||
1027 | { "kdb", 0x18, INSTR_RXE_FRRD }, | ||
1028 | { "cdb", 0x19, INSTR_RXE_FRRD }, | ||
1029 | { "adb", 0x1a, INSTR_RXE_FRRD }, | ||
1030 | { "sdb", 0x1b, INSTR_RXE_FRRD }, | ||
1031 | { "mdb", 0x1c, INSTR_RXE_FRRD }, | ||
1032 | { "ddb", 0x1d, INSTR_RXE_FRRD }, | ||
1033 | { "madb", 0x1e, INSTR_RXF_FRRDF }, | ||
1034 | { "msdb", 0x1f, INSTR_RXF_FRRDF }, | ||
1035 | { "lde", 0x24, INSTR_RXE_FRRD }, | ||
1036 | { "lxd", 0x25, INSTR_RXE_FRRD }, | ||
1037 | { "lxe", 0x26, INSTR_RXE_FRRD }, | ||
1038 | { "mae", 0x2e, INSTR_RXF_FRRDF }, | ||
1039 | { "mse", 0x2f, INSTR_RXF_FRRDF }, | ||
1040 | { "sqe", 0x34, INSTR_RXE_FRRD }, | ||
1041 | { "mee", 0x37, INSTR_RXE_FRRD }, | ||
1042 | { "mad", 0x3e, INSTR_RXF_FRRDF }, | ||
1043 | { "msd", 0x3f, INSTR_RXF_FRRDF }, | ||
1044 | { "", 0, INSTR_INVALID } | ||
1045 | }; | ||
1046 | |||
1047 | /* Extracts an operand value from an instruction. */ | ||
1048 | static unsigned int extract_operand(unsigned char *code, | ||
1049 | const struct operand *operand) | ||
1050 | { | ||
1051 | unsigned int val; | ||
1052 | int bits; | ||
1053 | |||
1054 | /* Extract fragments of the operand byte for byte. */ | ||
1055 | code += operand->shift / 8; | ||
1056 | bits = (operand->shift & 7) + operand->bits; | ||
1057 | val = 0; | ||
1058 | do { | ||
1059 | val <<= 8; | ||
1060 | val |= (unsigned int) *code++; | ||
1061 | bits -= 8; | ||
1062 | } while (bits > 0); | ||
1063 | val >>= -bits; | ||
1064 | val &= ((1U << (operand->bits - 1)) << 1) - 1; | ||
1065 | |||
1066 | /* Check for special long displacement case. */ | ||
1067 | if (operand->bits == 20 && operand->shift == 20) | ||
1068 | val = (val & 0xff) << 12 | (val & 0xfff00) >> 8; | ||
1069 | |||
1070 | /* Sign extend value if the operand is signed or pc relative. */ | ||
1071 | if ((operand->flags & (OPERAND_SIGNED | OPERAND_PCREL)) && | ||
1072 | (val & (1U << (operand->bits - 1)))) | ||
1073 | val |= (-1U << (operand->bits - 1)) << 1; | ||
1074 | |||
1075 | /* Double value if the operand is pc relative. */ | ||
1076 | if (operand->flags & OPERAND_PCREL) | ||
1077 | val <<= 1; | ||
1078 | |||
1079 | /* Length x in an instructions has real length x + 1. */ | ||
1080 | if (operand->flags & OPERAND_LENGTH) | ||
1081 | val++; | ||
1082 | return val; | ||
1083 | } | ||
1084 | |||
1085 | static inline int insn_length(unsigned char code) | ||
1086 | { | ||
1087 | return ((((int) code + 64) >> 7) + 1) << 1; | ||
1088 | } | ||
1089 | |||
1090 | static struct insn *find_insn(unsigned char *code) | ||
1091 | { | ||
1092 | unsigned char opfrag = code[1]; | ||
1093 | unsigned char opmask; | ||
1094 | struct insn *table; | ||
1095 | |||
1096 | switch (code[0]) { | ||
1097 | case 0x01: | ||
1098 | table = opcode_01; | ||
1099 | break; | ||
1100 | case 0xa5: | ||
1101 | table = opcode_a5; | ||
1102 | break; | ||
1103 | case 0xa7: | ||
1104 | table = opcode_a7; | ||
1105 | break; | ||
1106 | case 0xb2: | ||
1107 | table = opcode_b2; | ||
1108 | break; | ||
1109 | case 0xb3: | ||
1110 | table = opcode_b3; | ||
1111 | break; | ||
1112 | case 0xb9: | ||
1113 | table = opcode_b9; | ||
1114 | break; | ||
1115 | case 0xc0: | ||
1116 | table = opcode_c0; | ||
1117 | break; | ||
1118 | case 0xc2: | ||
1119 | table = opcode_c2; | ||
1120 | break; | ||
1121 | case 0xc8: | ||
1122 | table = opcode_c8; | ||
1123 | break; | ||
1124 | case 0xe3: | ||
1125 | table = opcode_e3; | ||
1126 | opfrag = code[5]; | ||
1127 | break; | ||
1128 | case 0xe5: | ||
1129 | table = opcode_e5; | ||
1130 | break; | ||
1131 | case 0xeb: | ||
1132 | table = opcode_eb; | ||
1133 | opfrag = code[5]; | ||
1134 | break; | ||
1135 | case 0xec: | ||
1136 | table = opcode_ec; | ||
1137 | opfrag = code[5]; | ||
1138 | break; | ||
1139 | case 0xed: | ||
1140 | table = opcode_ed; | ||
1141 | opfrag = code[5]; | ||
1142 | break; | ||
1143 | default: | ||
1144 | table = opcode; | ||
1145 | opfrag = code[0]; | ||
1146 | break; | ||
1147 | } | ||
1148 | while (table->format != INSTR_INVALID) { | ||
1149 | opmask = formats[table->format][0]; | ||
1150 | if (table->opfrag == (opfrag & opmask)) | ||
1151 | return table; | ||
1152 | table++; | ||
1153 | } | ||
1154 | return NULL; | ||
1155 | } | ||
1156 | |||
1157 | static int print_insn(char *buffer, unsigned char *code, unsigned long addr) | ||
1158 | { | ||
1159 | struct insn *insn; | ||
1160 | const unsigned char *ops; | ||
1161 | const struct operand *operand; | ||
1162 | unsigned int value; | ||
1163 | char separator; | ||
1164 | char *ptr; | ||
1165 | |||
1166 | ptr = buffer; | ||
1167 | insn = find_insn(code); | ||
1168 | if (insn) { | ||
1169 | ptr += sprintf(ptr, "%.5s\t", insn->name); | ||
1170 | /* Extract the operands. */ | ||
1171 | separator = 0; | ||
1172 | for (ops = formats[insn->format] + 1; *ops != 0; ops++) { | ||
1173 | operand = operands + *ops; | ||
1174 | value = extract_operand(code, operand); | ||
1175 | if ((operand->flags & OPERAND_INDEX) && value == 0) | ||
1176 | continue; | ||
1177 | if ((operand->flags & OPERAND_BASE) && | ||
1178 | value == 0 && separator == '(') { | ||
1179 | separator = ','; | ||
1180 | continue; | ||
1181 | } | ||
1182 | if (separator) | ||
1183 | ptr += sprintf(ptr, "%c", separator); | ||
1184 | if (operand->flags & OPERAND_GPR) | ||
1185 | ptr += sprintf(ptr, "%%r%i", value); | ||
1186 | else if (operand->flags & OPERAND_FPR) | ||
1187 | ptr += sprintf(ptr, "%%f%i", value); | ||
1188 | else if (operand->flags & OPERAND_AR) | ||
1189 | ptr += sprintf(ptr, "%%a%i", value); | ||
1190 | else if (operand->flags & OPERAND_CR) | ||
1191 | ptr += sprintf(ptr, "%%c%i", value); | ||
1192 | else if (operand->flags & OPERAND_PCREL) | ||
1193 | ptr += sprintf(ptr, "%lx", value + addr); | ||
1194 | else if (operand->flags & OPERAND_SIGNED) | ||
1195 | ptr += sprintf(ptr, "%i", value); | ||
1196 | else | ||
1197 | ptr += sprintf(ptr, "%u", value); | ||
1198 | if (operand->flags & OPERAND_DISP) | ||
1199 | separator = '('; | ||
1200 | else if (operand->flags & OPERAND_BASE) { | ||
1201 | ptr += sprintf(ptr, ")"); | ||
1202 | separator = ','; | ||
1203 | } else | ||
1204 | separator = ','; | ||
1205 | } | ||
1206 | } else | ||
1207 | ptr += sprintf(ptr, "unknown"); | ||
1208 | return (int) (ptr - buffer); | ||
1209 | } | ||
1210 | |||
1211 | void show_code(struct pt_regs *regs) | ||
1212 | { | ||
1213 | char *mode = (regs->psw.mask & PSW_MASK_PSTATE) ? "User" : "Krnl"; | ||
1214 | unsigned char code[64]; | ||
1215 | char buffer[64], *ptr; | ||
1216 | mm_segment_t old_fs; | ||
1217 | unsigned long addr; | ||
1218 | int start, end, opsize, hops, i; | ||
1219 | |||
1220 | /* Get a snapshot of the 64 bytes surrounding the fault address. */ | ||
1221 | old_fs = get_fs(); | ||
1222 | set_fs((regs->psw.mask & PSW_MASK_PSTATE) ? USER_DS : KERNEL_DS); | ||
1223 | for (start = 32; start && regs->psw.addr >= 34 - start; start -= 2) { | ||
1224 | addr = regs->psw.addr - 34 + start; | ||
1225 | if (__copy_from_user(code + start - 2, | ||
1226 | (char __user *) addr, 2)) | ||
1227 | break; | ||
1228 | } | ||
1229 | for (end = 32; end < 64; end += 2) { | ||
1230 | addr = regs->psw.addr + end - 32; | ||
1231 | if (__copy_from_user(code + end, | ||
1232 | (char __user *) addr, 2)) | ||
1233 | break; | ||
1234 | } | ||
1235 | set_fs(old_fs); | ||
1236 | /* Code snapshot useable ? */ | ||
1237 | if ((regs->psw.addr & 1) || start >= end) { | ||
1238 | printk("%s Code: Bad PSW.\n", mode); | ||
1239 | return; | ||
1240 | } | ||
1241 | /* Find a starting point for the disassembly. */ | ||
1242 | while (start < 32) { | ||
1243 | hops = 0; | ||
1244 | for (i = 0, hops = 0; start + i < 32 && hops < 3; hops++) { | ||
1245 | if (!find_insn(code + start + i)) | ||
1246 | break; | ||
1247 | i += insn_length(code[start + i]); | ||
1248 | } | ||
1249 | if (start + i == 32) | ||
1250 | /* Looks good, sequence ends at PSW. */ | ||
1251 | break; | ||
1252 | start += 2; | ||
1253 | } | ||
1254 | /* Decode the instructions. */ | ||
1255 | ptr = buffer; | ||
1256 | ptr += sprintf(ptr, "%s Code:", mode); | ||
1257 | hops = 0; | ||
1258 | while (start < end && hops < 8) { | ||
1259 | *ptr++ = (start == 32) ? '>' : ' '; | ||
1260 | addr = regs->psw.addr + start - 32; | ||
1261 | ptr += sprintf(ptr, ONELONG, addr); | ||
1262 | opsize = insn_length(code[start]); | ||
1263 | if (start + opsize >= end) | ||
1264 | break; | ||
1265 | for (i = 0; i < opsize; i++) | ||
1266 | ptr += sprintf(ptr, "%02x", code[start + i]); | ||
1267 | *ptr++ = '\t'; | ||
1268 | if (i < 6) | ||
1269 | *ptr++ = '\t'; | ||
1270 | ptr += print_insn(ptr, code + start, addr); | ||
1271 | start += opsize; | ||
1272 | printk(buffer); | ||
1273 | ptr = buffer; | ||
1274 | ptr += sprintf(ptr, "\n "); | ||
1275 | hops++; | ||
1276 | } | ||
1277 | printk("\n"); | ||
1278 | } | ||
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c index 5e47936573f2..50538e545618 100644 --- a/arch/s390/kernel/early.c +++ b/arch/s390/kernel/early.c | |||
@@ -253,11 +253,10 @@ static noinline __init void find_memory_chunks(unsigned long memsize) | |||
253 | break; | 253 | break; |
254 | #endif | 254 | #endif |
255 | /* | 255 | /* |
256 | * Finish memory detection at the first hole, unless | 256 | * Finish memory detection at the first hole |
257 | * - we reached the hsa -> skip it. | 257 | * if storage size is unknown. |
258 | * - we know there must be more. | ||
259 | */ | 258 | */ |
260 | if (cc == -1UL && !memsize && old_addr != ADDR2G) | 259 | if (cc == -1UL && !memsize) |
261 | break; | 260 | break; |
262 | if (memsize && addr >= memsize) | 261 | if (memsize && addr >= memsize) |
263 | break; | 262 | break; |
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S index dddc3de30401..c8a2212014e0 100644 --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S | |||
@@ -249,8 +249,6 @@ sysc_do_restart: | |||
249 | bnz BASED(sysc_tracesys) | 249 | bnz BASED(sysc_tracesys) |
250 | basr %r14,%r8 # call sys_xxxx | 250 | basr %r14,%r8 # call sys_xxxx |
251 | st %r2,SP_R2(%r15) # store return value (change R2 on stack) | 251 | st %r2,SP_R2(%r15) # store return value (change R2 on stack) |
252 | # ATTENTION: check sys_execve_glue before | ||
253 | # changing anything here !! | ||
254 | 252 | ||
255 | sysc_return: | 253 | sysc_return: |
256 | tm SP_PSW+1(%r15),0x01 # returning to user ? | 254 | tm SP_PSW+1(%r15),0x01 # returning to user ? |
@@ -381,50 +379,37 @@ ret_from_fork: | |||
381 | b BASED(sysc_return) | 379 | b BASED(sysc_return) |
382 | 380 | ||
383 | # | 381 | # |
384 | # clone, fork, vfork, exec and sigreturn need glue, | 382 | # kernel_execve function needs to deal with pt_regs that is not |
385 | # because they all expect pt_regs as parameter, | 383 | # at the usual place |
386 | # but are called with different parameter. | ||
387 | # return-address is set up above | ||
388 | # | 384 | # |
389 | sys_clone_glue: | 385 | .globl kernel_execve |
390 | la %r2,SP_PTREGS(%r15) # load pt_regs | 386 | kernel_execve: |
391 | l %r1,BASED(.Lclone) | 387 | stm %r12,%r15,48(%r15) |
392 | br %r1 # branch to sys_clone | 388 | lr %r14,%r15 |
393 | 389 | l %r13,__LC_SVC_NEW_PSW+4 | |
394 | sys_fork_glue: | 390 | s %r15,BASED(.Lc_spsize) |
395 | la %r2,SP_PTREGS(%r15) # load pt_regs | 391 | st %r14,__SF_BACKCHAIN(%r15) |
396 | l %r1,BASED(.Lfork) | 392 | la %r12,SP_PTREGS(%r15) |
397 | br %r1 # branch to sys_fork | 393 | xc 0(__PT_SIZE,%r12),0(%r12) |
398 | 394 | l %r1,BASED(.Ldo_execve) | |
399 | sys_vfork_glue: | 395 | lr %r5,%r12 |
400 | la %r2,SP_PTREGS(%r15) # load pt_regs | 396 | basr %r14,%r1 |
401 | l %r1,BASED(.Lvfork) | 397 | ltr %r2,%r2 |
402 | br %r1 # branch to sys_vfork | 398 | be BASED(0f) |
403 | 399 | a %r15,BASED(.Lc_spsize) | |
404 | sys_execve_glue: | 400 | lm %r12,%r15,48(%r15) |
405 | la %r2,SP_PTREGS(%r15) # load pt_regs | 401 | br %r14 |
406 | l %r1,BASED(.Lexecve) | 402 | # execve succeeded. |
407 | lr %r12,%r14 # save return address | 403 | 0: stnsm __SF_EMPTY(%r15),0xfc # disable interrupts |
408 | basr %r14,%r1 # call sys_execve | 404 | l %r15,__LC_KERNEL_STACK # load ksp |
409 | ltr %r2,%r2 # check if execve failed | 405 | s %r15,BASED(.Lc_spsize) # make room for registers & psw |
410 | bnz 0(%r12) # it did fail -> store result in gpr2 | 406 | l %r9,__LC_THREAD_INFO |
411 | b 4(%r12) # SKIP ST 2,SP_R2(15) after BASR 14,8 | 407 | mvc SP_PTREGS(__PT_SIZE,%r15),0(%r12) # copy pt_regs |
412 | # in system_call/sysc_tracesys | 408 | xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) |
413 | 409 | stosm __SF_EMPTY(%r15),0x03 # reenable interrupts | |
414 | sys_sigreturn_glue: | 410 | l %r1,BASED(.Lexecve_tail) |
415 | la %r2,SP_PTREGS(%r15) # load pt_regs as parameter | 411 | basr %r14,%r1 |
416 | l %r1,BASED(.Lsigreturn) | 412 | b BASED(sysc_return) |
417 | br %r1 # branch to sys_sigreturn | ||
418 | |||
419 | sys_rt_sigreturn_glue: | ||
420 | la %r2,SP_PTREGS(%r15) # load pt_regs as parameter | ||
421 | l %r1,BASED(.Lrt_sigreturn) | ||
422 | br %r1 # branch to sys_sigreturn | ||
423 | |||
424 | sys_sigaltstack_glue: | ||
425 | la %r4,SP_PTREGS(%r15) # load pt_regs as parameter | ||
426 | l %r1,BASED(.Lsigaltstack) | ||
427 | br %r1 # branch to sys_sigreturn | ||
428 | 413 | ||
429 | /* | 414 | /* |
430 | * Program check handler routine | 415 | * Program check handler routine |
@@ -1031,19 +1016,11 @@ cleanup_io_leave_insn: | |||
1031 | .Ldo_extint: .long do_extint | 1016 | .Ldo_extint: .long do_extint |
1032 | .Ldo_signal: .long do_signal | 1017 | .Ldo_signal: .long do_signal |
1033 | .Lhandle_per: .long do_single_step | 1018 | .Lhandle_per: .long do_single_step |
1019 | .Ldo_execve: .long do_execve | ||
1020 | .Lexecve_tail: .long execve_tail | ||
1034 | .Ljump_table: .long pgm_check_table | 1021 | .Ljump_table: .long pgm_check_table |
1035 | .Lschedule: .long schedule | 1022 | .Lschedule: .long schedule |
1036 | .Lclone: .long sys_clone | ||
1037 | .Lexecve: .long sys_execve | ||
1038 | .Lfork: .long sys_fork | ||
1039 | .Lrt_sigreturn: .long sys_rt_sigreturn | ||
1040 | .Lrt_sigsuspend: | ||
1041 | .long sys_rt_sigsuspend | ||
1042 | .Lsigreturn: .long sys_sigreturn | ||
1043 | .Lsigsuspend: .long sys_sigsuspend | ||
1044 | .Lsigaltstack: .long sys_sigaltstack | ||
1045 | .Ltrace: .long syscall_trace | 1023 | .Ltrace: .long syscall_trace |
1046 | .Lvfork: .long sys_vfork | ||
1047 | .Lschedtail: .long schedule_tail | 1024 | .Lschedtail: .long schedule_tail |
1048 | .Lsysc_table: .long sys_call_table | 1025 | .Lsysc_table: .long sys_call_table |
1049 | #ifdef CONFIG_TRACE_IRQFLAGS | 1026 | #ifdef CONFIG_TRACE_IRQFLAGS |
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S index 0f758c329a5d..93745fd8f555 100644 --- a/arch/s390/kernel/entry64.S +++ b/arch/s390/kernel/entry64.S | |||
@@ -244,8 +244,6 @@ sysc_noemu: | |||
244 | jnz sysc_tracesys | 244 | jnz sysc_tracesys |
245 | basr %r14,%r8 # call sys_xxxx | 245 | basr %r14,%r8 # call sys_xxxx |
246 | stg %r2,SP_R2(%r15) # store return value (change R2 on stack) | 246 | stg %r2,SP_R2(%r15) # store return value (change R2 on stack) |
247 | # ATTENTION: check sys_execve_glue before | ||
248 | # changing anything here !! | ||
249 | 247 | ||
250 | sysc_return: | 248 | sysc_return: |
251 | tm SP_PSW+1(%r15),0x01 # returning to user ? | 249 | tm SP_PSW+1(%r15),0x01 # returning to user ? |
@@ -371,77 +369,35 @@ ret_from_fork: | |||
371 | j sysc_return | 369 | j sysc_return |
372 | 370 | ||
373 | # | 371 | # |
374 | # clone, fork, vfork, exec and sigreturn need glue, | 372 | # kernel_execve function needs to deal with pt_regs that is not |
375 | # because they all expect pt_regs as parameter, | 373 | # at the usual place |
376 | # but are called with different parameter. | ||
377 | # return-address is set up above | ||
378 | # | 374 | # |
379 | sys_clone_glue: | 375 | .globl kernel_execve |
380 | la %r2,SP_PTREGS(%r15) # load pt_regs | 376 | kernel_execve: |
381 | jg sys_clone # branch to sys_clone | 377 | stmg %r12,%r15,96(%r15) |
382 | 378 | lgr %r14,%r15 | |
383 | #ifdef CONFIG_COMPAT | 379 | aghi %r15,-SP_SIZE |
384 | sys32_clone_glue: | 380 | stg %r14,__SF_BACKCHAIN(%r15) |
385 | la %r2,SP_PTREGS(%r15) # load pt_regs | 381 | la %r12,SP_PTREGS(%r15) |
386 | jg sys32_clone # branch to sys32_clone | 382 | xc 0(__PT_SIZE,%r12),0(%r12) |
387 | #endif | 383 | lgr %r5,%r12 |
388 | 384 | brasl %r14,do_execve | |
389 | sys_fork_glue: | 385 | ltgfr %r2,%r2 |
390 | la %r2,SP_PTREGS(%r15) # load pt_regs | 386 | je 0f |
391 | jg sys_fork # branch to sys_fork | 387 | aghi %r15,SP_SIZE |
392 | 388 | lmg %r12,%r15,96(%r15) | |
393 | sys_vfork_glue: | 389 | br %r14 |
394 | la %r2,SP_PTREGS(%r15) # load pt_regs | 390 | # execve succeeded. |
395 | jg sys_vfork # branch to sys_vfork | 391 | 0: stnsm __SF_EMPTY(%r15),0xfc # disable interrupts |
396 | 392 | lg %r15,__LC_KERNEL_STACK # load ksp | |
397 | sys_execve_glue: | 393 | aghi %r15,-SP_SIZE # make room for registers & psw |
398 | la %r2,SP_PTREGS(%r15) # load pt_regs | 394 | lg %r13,__LC_SVC_NEW_PSW+8 |
399 | lgr %r12,%r14 # save return address | 395 | lg %r9,__LC_THREAD_INFO |
400 | brasl %r14,sys_execve # call sys_execve | 396 | mvc SP_PTREGS(__PT_SIZE,%r15),0(%r12) # copy pt_regs |
401 | ltgr %r2,%r2 # check if execve failed | 397 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) |
402 | bnz 0(%r12) # it did fail -> store result in gpr2 | 398 | stosm __SF_EMPTY(%r15),0x03 # reenable interrupts |
403 | b 6(%r12) # SKIP STG 2,SP_R2(15) in | 399 | brasl %r14,execve_tail |
404 | # system_call/sysc_tracesys | 400 | j sysc_return |
405 | #ifdef CONFIG_COMPAT | ||
406 | sys32_execve_glue: | ||
407 | la %r2,SP_PTREGS(%r15) # load pt_regs | ||
408 | lgr %r12,%r14 # save return address | ||
409 | brasl %r14,sys32_execve # call sys32_execve | ||
410 | ltgr %r2,%r2 # check if execve failed | ||
411 | bnz 0(%r12) # it did fail -> store result in gpr2 | ||
412 | b 6(%r12) # SKIP STG 2,SP_R2(15) in | ||
413 | # system_call/sysc_tracesys | ||
414 | #endif | ||
415 | |||
416 | sys_sigreturn_glue: | ||
417 | la %r2,SP_PTREGS(%r15) # load pt_regs as parameter | ||
418 | jg sys_sigreturn # branch to sys_sigreturn | ||
419 | |||
420 | #ifdef CONFIG_COMPAT | ||
421 | sys32_sigreturn_glue: | ||
422 | la %r2,SP_PTREGS(%r15) # load pt_regs as parameter | ||
423 | jg sys32_sigreturn # branch to sys32_sigreturn | ||
424 | #endif | ||
425 | |||
426 | sys_rt_sigreturn_glue: | ||
427 | la %r2,SP_PTREGS(%r15) # load pt_regs as parameter | ||
428 | jg sys_rt_sigreturn # branch to sys_sigreturn | ||
429 | |||
430 | #ifdef CONFIG_COMPAT | ||
431 | sys32_rt_sigreturn_glue: | ||
432 | la %r2,SP_PTREGS(%r15) # load pt_regs as parameter | ||
433 | jg sys32_rt_sigreturn # branch to sys32_sigreturn | ||
434 | #endif | ||
435 | |||
436 | sys_sigaltstack_glue: | ||
437 | la %r4,SP_PTREGS(%r15) # load pt_regs as parameter | ||
438 | jg sys_sigaltstack # branch to sys_sigreturn | ||
439 | |||
440 | #ifdef CONFIG_COMPAT | ||
441 | sys32_sigaltstack_glue: | ||
442 | la %r4,SP_PTREGS(%r15) # load pt_regs as parameter | ||
443 | jg sys32_sigaltstack_wrapper # branch to sys_sigreturn | ||
444 | #endif | ||
445 | 401 | ||
446 | /* | 402 | /* |
447 | * Program check handler routine | 403 | * Program check handler routine |
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S index 37010709fe68..a87b1976d409 100644 --- a/arch/s390/kernel/head64.S +++ b/arch/s390/kernel/head64.S | |||
@@ -39,7 +39,69 @@ startup_continue: | |||
39 | basr %r13,0 # get base | 39 | basr %r13,0 # get base |
40 | .LPG1: sll %r13,1 # remove high order bit | 40 | .LPG1: sll %r13,1 # remove high order bit |
41 | srl %r13,1 | 41 | srl %r13,1 |
42 | lhi %r1,1 # mode 1 = esame | 42 | |
43 | #ifdef CONFIG_ZFCPDUMP | ||
44 | |||
45 | # check if we have been ipled using zfcp dump: | ||
46 | |||
47 | tm 0xb9,0x01 # test if subchannel is enabled | ||
48 | jno .nodump # subchannel disabled | ||
49 | l %r1,0xb8 | ||
50 | la %r5,.Lipl_schib-.LPG1(%r13) | ||
51 | stsch 0(%r5) # get schib of subchannel | ||
52 | jne .nodump # schib not available | ||
53 | tm 5(%r5),0x01 # devno valid? | ||
54 | jno .nodump | ||
55 | tm 4(%r5),0x80 # qdio capable device? | ||
56 | jno .nodump | ||
57 | l %r2,20(%r0) # address of ipl parameter block | ||
58 | lhi %r3,0 | ||
59 | ic %r3,0x148(%r2) # get opt field | ||
60 | chi %r3,0x20 # load with dump? | ||
61 | jne .nodump | ||
62 | |||
63 | # store all prefix registers in case of load with dump: | ||
64 | |||
65 | la %r7,0 # base register for 0 page | ||
66 | la %r8,0 # first cpu | ||
67 | l %r11,.Lpref_arr_ptr-.LPG1(%r13) # address of prefix array | ||
68 | ahi %r11,4 # skip boot cpu | ||
69 | lr %r12,%r11 | ||
70 | ahi %r12,(CONFIG_NR_CPUS*4) # end of prefix array | ||
71 | stap .Lcurrent_cpu+2-.LPG1(%r13) # store current cpu addr | ||
72 | 1: | ||
73 | cl %r8,.Lcurrent_cpu-.LPG1(%r13) # is ipl cpu ? | ||
74 | je 4f # if yes get next cpu | ||
75 | 2: | ||
76 | lr %r9,%r7 | ||
77 | sigp %r9,%r8,0x9 # stop & store status of cpu | ||
78 | brc 8,3f # accepted | ||
79 | brc 4,4f # status stored: next cpu | ||
80 | brc 2,2b # busy: try again | ||
81 | brc 1,4f # not op: next cpu | ||
82 | 3: | ||
83 | mvc 0(4,%r11),264(%r7) # copy prefix register to prefix array | ||
84 | ahi %r11,4 # next element in prefix array | ||
85 | clr %r11,%r12 | ||
86 | je 5f # no more space in prefix array | ||
87 | 4: | ||
88 | ahi %r8,1 # next cpu (r8 += 1) | ||
89 | cl %r8,.Llast_cpu-.LPG1(%r13) # is last possible cpu ? | ||
90 | jl 1b # jump if not last cpu | ||
91 | 5: | ||
92 | lhi %r1,2 # mode 2 = esame (dump) | ||
93 | j 6f | ||
94 | .align 4 | ||
95 | .Lipl_schib: | ||
96 | .rept 13 | ||
97 | .long 0 | ||
98 | .endr | ||
99 | .nodump: | ||
100 | lhi %r1,1 # mode 1 = esame (normal ipl) | ||
101 | 6: | ||
102 | #else | ||
103 | lhi %r1,1 # mode 1 = esame (normal ipl) | ||
104 | #endif /* CONFIG_ZFCPDUMP */ | ||
43 | mvi __LC_AR_MODE_ID,1 # set esame flag | 105 | mvi __LC_AR_MODE_ID,1 # set esame flag |
44 | slr %r0,%r0 # set cpuid to zero | 106 | slr %r0,%r0 # set cpuid to zero |
45 | sigp %r1,%r0,0x12 # switch to esame mode | 107 | sigp %r1,%r0,0x12 # switch to esame mode |
@@ -149,6 +211,14 @@ startup_continue: | |||
149 | .L4malign:.quad 0xffffffffffc00000 | 211 | .L4malign:.quad 0xffffffffffc00000 |
150 | .Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8 | 212 | .Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8 |
151 | .Lnop: .long 0x07000700 | 213 | .Lnop: .long 0x07000700 |
214 | #ifdef CONFIG_ZFCPDUMP | ||
215 | .Lcurrent_cpu: | ||
216 | .long 0x0 | ||
217 | .Llast_cpu: | ||
218 | .long 0x0000ffff | ||
219 | .Lpref_arr_ptr: | ||
220 | .long zfcpdump_prefix_array | ||
221 | #endif /* CONFIG_ZFCPDUMP */ | ||
152 | .Lparmaddr: | 222 | .Lparmaddr: |
153 | .quad PARMAREA | 223 | .quad PARMAREA |
154 | .align 64 | 224 | .align 64 |
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c index f731185bf2bd..06833ac2b115 100644 --- a/arch/s390/kernel/ipl.c +++ b/arch/s390/kernel/ipl.c | |||
@@ -29,36 +29,21 @@ | |||
29 | #define SCCB_LOADPARM (&s390_readinfo_sccb.loadparm) | 29 | #define SCCB_LOADPARM (&s390_readinfo_sccb.loadparm) |
30 | #define SCCB_FLAG (s390_readinfo_sccb.flags) | 30 | #define SCCB_FLAG (s390_readinfo_sccb.flags) |
31 | 31 | ||
32 | enum ipl_type { | 32 | #define IPL_UNKNOWN_STR "unknown" |
33 | IPL_TYPE_NONE = 1, | 33 | #define IPL_CCW_STR "ccw" |
34 | IPL_TYPE_UNKNOWN = 2, | 34 | #define IPL_FCP_STR "fcp" |
35 | IPL_TYPE_CCW = 4, | 35 | #define IPL_FCP_DUMP_STR "fcp_dump" |
36 | IPL_TYPE_FCP = 8, | 36 | #define IPL_NSS_STR "nss" |
37 | IPL_TYPE_NSS = 16, | ||
38 | }; | ||
39 | |||
40 | #define IPL_NONE_STR "none" | ||
41 | #define IPL_UNKNOWN_STR "unknown" | ||
42 | #define IPL_CCW_STR "ccw" | ||
43 | #define IPL_FCP_STR "fcp" | ||
44 | #define IPL_NSS_STR "nss" | ||
45 | |||
46 | /* | ||
47 | * Must be in data section since the bss section | ||
48 | * is not cleared when these are accessed. | ||
49 | */ | ||
50 | u16 ipl_devno __attribute__((__section__(".data"))) = 0; | ||
51 | u32 ipl_flags __attribute__((__section__(".data"))) = 0; | ||
52 | 37 | ||
53 | static char *ipl_type_str(enum ipl_type type) | 38 | static char *ipl_type_str(enum ipl_type type) |
54 | { | 39 | { |
55 | switch (type) { | 40 | switch (type) { |
56 | case IPL_TYPE_NONE: | ||
57 | return IPL_NONE_STR; | ||
58 | case IPL_TYPE_CCW: | 41 | case IPL_TYPE_CCW: |
59 | return IPL_CCW_STR; | 42 | return IPL_CCW_STR; |
60 | case IPL_TYPE_FCP: | 43 | case IPL_TYPE_FCP: |
61 | return IPL_FCP_STR; | 44 | return IPL_FCP_STR; |
45 | case IPL_TYPE_FCP_DUMP: | ||
46 | return IPL_FCP_DUMP_STR; | ||
62 | case IPL_TYPE_NSS: | 47 | case IPL_TYPE_NSS: |
63 | return IPL_NSS_STR; | 48 | return IPL_NSS_STR; |
64 | case IPL_TYPE_UNKNOWN: | 49 | case IPL_TYPE_UNKNOWN: |
@@ -67,15 +52,55 @@ static char *ipl_type_str(enum ipl_type type) | |||
67 | } | 52 | } |
68 | } | 53 | } |
69 | 54 | ||
55 | enum dump_type { | ||
56 | DUMP_TYPE_NONE = 1, | ||
57 | DUMP_TYPE_CCW = 2, | ||
58 | DUMP_TYPE_FCP = 4, | ||
59 | }; | ||
60 | |||
61 | #define DUMP_NONE_STR "none" | ||
62 | #define DUMP_CCW_STR "ccw" | ||
63 | #define DUMP_FCP_STR "fcp" | ||
64 | |||
65 | static char *dump_type_str(enum dump_type type) | ||
66 | { | ||
67 | switch (type) { | ||
68 | case DUMP_TYPE_NONE: | ||
69 | return DUMP_NONE_STR; | ||
70 | case DUMP_TYPE_CCW: | ||
71 | return DUMP_CCW_STR; | ||
72 | case DUMP_TYPE_FCP: | ||
73 | return DUMP_FCP_STR; | ||
74 | default: | ||
75 | return NULL; | ||
76 | } | ||
77 | } | ||
78 | |||
79 | /* | ||
80 | * Must be in data section since the bss section | ||
81 | * is not cleared when these are accessed. | ||
82 | */ | ||
83 | static u16 ipl_devno __attribute__((__section__(".data"))) = 0; | ||
84 | u32 ipl_flags __attribute__((__section__(".data"))) = 0; | ||
85 | |||
70 | enum ipl_method { | 86 | enum ipl_method { |
71 | IPL_METHOD_NONE, | 87 | REIPL_METHOD_CCW_CIO, |
72 | IPL_METHOD_CCW_CIO, | 88 | REIPL_METHOD_CCW_DIAG, |
73 | IPL_METHOD_CCW_DIAG, | 89 | REIPL_METHOD_CCW_VM, |
74 | IPL_METHOD_CCW_VM, | 90 | REIPL_METHOD_FCP_RO_DIAG, |
75 | IPL_METHOD_FCP_RO_DIAG, | 91 | REIPL_METHOD_FCP_RW_DIAG, |
76 | IPL_METHOD_FCP_RW_DIAG, | 92 | REIPL_METHOD_FCP_RO_VM, |
77 | IPL_METHOD_FCP_RO_VM, | 93 | REIPL_METHOD_FCP_DUMP, |
78 | IPL_METHOD_NSS, | 94 | REIPL_METHOD_NSS, |
95 | REIPL_METHOD_DEFAULT, | ||
96 | }; | ||
97 | |||
98 | enum dump_method { | ||
99 | DUMP_METHOD_NONE, | ||
100 | DUMP_METHOD_CCW_CIO, | ||
101 | DUMP_METHOD_CCW_DIAG, | ||
102 | DUMP_METHOD_CCW_VM, | ||
103 | DUMP_METHOD_FCP_DIAG, | ||
79 | }; | 104 | }; |
80 | 105 | ||
81 | enum shutdown_action { | 106 | enum shutdown_action { |
@@ -107,15 +132,15 @@ static int diag308_set_works = 0; | |||
107 | static int reipl_capabilities = IPL_TYPE_UNKNOWN; | 132 | static int reipl_capabilities = IPL_TYPE_UNKNOWN; |
108 | 133 | ||
109 | static enum ipl_type reipl_type = IPL_TYPE_UNKNOWN; | 134 | static enum ipl_type reipl_type = IPL_TYPE_UNKNOWN; |
110 | static enum ipl_method reipl_method = IPL_METHOD_NONE; | 135 | static enum ipl_method reipl_method = REIPL_METHOD_DEFAULT; |
111 | static struct ipl_parameter_block *reipl_block_fcp; | 136 | static struct ipl_parameter_block *reipl_block_fcp; |
112 | static struct ipl_parameter_block *reipl_block_ccw; | 137 | static struct ipl_parameter_block *reipl_block_ccw; |
113 | 138 | ||
114 | static char reipl_nss_name[NSS_NAME_SIZE + 1]; | 139 | static char reipl_nss_name[NSS_NAME_SIZE + 1]; |
115 | 140 | ||
116 | static int dump_capabilities = IPL_TYPE_NONE; | 141 | static int dump_capabilities = DUMP_TYPE_NONE; |
117 | static enum ipl_type dump_type = IPL_TYPE_NONE; | 142 | static enum dump_type dump_type = DUMP_TYPE_NONE; |
118 | static enum ipl_method dump_method = IPL_METHOD_NONE; | 143 | static enum dump_method dump_method = DUMP_METHOD_NONE; |
119 | static struct ipl_parameter_block *dump_block_fcp; | 144 | static struct ipl_parameter_block *dump_block_fcp; |
120 | static struct ipl_parameter_block *dump_block_ccw; | 145 | static struct ipl_parameter_block *dump_block_ccw; |
121 | 146 | ||
@@ -134,6 +159,7 @@ int diag308(unsigned long subcode, void *addr) | |||
134 | : "d" (subcode) : "cc", "memory"); | 159 | : "d" (subcode) : "cc", "memory"); |
135 | return _rc; | 160 | return _rc; |
136 | } | 161 | } |
162 | EXPORT_SYMBOL_GPL(diag308); | ||
137 | 163 | ||
138 | /* SYSFS */ | 164 | /* SYSFS */ |
139 | 165 | ||
@@ -197,7 +223,7 @@ static void make_attrs_ro(struct attribute **attrs) | |||
197 | * ipl section | 223 | * ipl section |
198 | */ | 224 | */ |
199 | 225 | ||
200 | static enum ipl_type ipl_get_type(void) | 226 | static __init enum ipl_type get_ipl_type(void) |
201 | { | 227 | { |
202 | struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START; | 228 | struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START; |
203 | 229 | ||
@@ -211,12 +237,44 @@ static enum ipl_type ipl_get_type(void) | |||
211 | return IPL_TYPE_UNKNOWN; | 237 | return IPL_TYPE_UNKNOWN; |
212 | if (ipl->hdr.pbt != DIAG308_IPL_TYPE_FCP) | 238 | if (ipl->hdr.pbt != DIAG308_IPL_TYPE_FCP) |
213 | return IPL_TYPE_UNKNOWN; | 239 | return IPL_TYPE_UNKNOWN; |
240 | if (ipl->ipl_info.fcp.opt == DIAG308_IPL_OPT_DUMP) | ||
241 | return IPL_TYPE_FCP_DUMP; | ||
214 | return IPL_TYPE_FCP; | 242 | return IPL_TYPE_FCP; |
215 | } | 243 | } |
216 | 244 | ||
245 | void __init setup_ipl_info(void) | ||
246 | { | ||
247 | ipl_info.type = get_ipl_type(); | ||
248 | switch (ipl_info.type) { | ||
249 | case IPL_TYPE_CCW: | ||
250 | ipl_info.data.ccw.dev_id.devno = ipl_devno; | ||
251 | ipl_info.data.ccw.dev_id.ssid = 0; | ||
252 | break; | ||
253 | case IPL_TYPE_FCP: | ||
254 | case IPL_TYPE_FCP_DUMP: | ||
255 | ipl_info.data.fcp.dev_id.devno = | ||
256 | IPL_PARMBLOCK_START->ipl_info.fcp.devno; | ||
257 | ipl_info.data.fcp.dev_id.ssid = 0; | ||
258 | ipl_info.data.fcp.wwpn = IPL_PARMBLOCK_START->ipl_info.fcp.wwpn; | ||
259 | ipl_info.data.fcp.lun = IPL_PARMBLOCK_START->ipl_info.fcp.lun; | ||
260 | break; | ||
261 | case IPL_TYPE_NSS: | ||
262 | strncpy(ipl_info.data.nss.name, kernel_nss_name, | ||
263 | sizeof(ipl_info.data.nss.name)); | ||
264 | break; | ||
265 | case IPL_TYPE_UNKNOWN: | ||
266 | default: | ||
267 | /* We have no info to copy */ | ||
268 | break; | ||
269 | } | ||
270 | } | ||
271 | |||
272 | struct ipl_info ipl_info; | ||
273 | EXPORT_SYMBOL_GPL(ipl_info); | ||
274 | |||
217 | static ssize_t ipl_type_show(struct subsystem *subsys, char *page) | 275 | static ssize_t ipl_type_show(struct subsystem *subsys, char *page) |
218 | { | 276 | { |
219 | return sprintf(page, "%s\n", ipl_type_str(ipl_get_type())); | 277 | return sprintf(page, "%s\n", ipl_type_str(ipl_info.type)); |
220 | } | 278 | } |
221 | 279 | ||
222 | static struct subsys_attribute sys_ipl_type_attr = __ATTR_RO(ipl_type); | 280 | static struct subsys_attribute sys_ipl_type_attr = __ATTR_RO(ipl_type); |
@@ -225,10 +283,11 @@ static ssize_t sys_ipl_device_show(struct subsystem *subsys, char *page) | |||
225 | { | 283 | { |
226 | struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START; | 284 | struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START; |
227 | 285 | ||
228 | switch (ipl_get_type()) { | 286 | switch (ipl_info.type) { |
229 | case IPL_TYPE_CCW: | 287 | case IPL_TYPE_CCW: |
230 | return sprintf(page, "0.0.%04x\n", ipl_devno); | 288 | return sprintf(page, "0.0.%04x\n", ipl_devno); |
231 | case IPL_TYPE_FCP: | 289 | case IPL_TYPE_FCP: |
290 | case IPL_TYPE_FCP_DUMP: | ||
232 | return sprintf(page, "0.0.%04x\n", ipl->ipl_info.fcp.devno); | 291 | return sprintf(page, "0.0.%04x\n", ipl->ipl_info.fcp.devno); |
233 | default: | 292 | default: |
234 | return 0; | 293 | return 0; |
@@ -485,23 +544,29 @@ static int reipl_set_type(enum ipl_type type) | |||
485 | switch(type) { | 544 | switch(type) { |
486 | case IPL_TYPE_CCW: | 545 | case IPL_TYPE_CCW: |
487 | if (MACHINE_IS_VM) | 546 | if (MACHINE_IS_VM) |
488 | reipl_method = IPL_METHOD_CCW_VM; | 547 | reipl_method = REIPL_METHOD_CCW_VM; |
489 | else | 548 | else |
490 | reipl_method = IPL_METHOD_CCW_CIO; | 549 | reipl_method = REIPL_METHOD_CCW_CIO; |
491 | break; | 550 | break; |
492 | case IPL_TYPE_FCP: | 551 | case IPL_TYPE_FCP: |
493 | if (diag308_set_works) | 552 | if (diag308_set_works) |
494 | reipl_method = IPL_METHOD_FCP_RW_DIAG; | 553 | reipl_method = REIPL_METHOD_FCP_RW_DIAG; |
495 | else if (MACHINE_IS_VM) | 554 | else if (MACHINE_IS_VM) |
496 | reipl_method = IPL_METHOD_FCP_RO_VM; | 555 | reipl_method = REIPL_METHOD_FCP_RO_VM; |
497 | else | 556 | else |
498 | reipl_method = IPL_METHOD_FCP_RO_DIAG; | 557 | reipl_method = REIPL_METHOD_FCP_RO_DIAG; |
558 | break; | ||
559 | case IPL_TYPE_FCP_DUMP: | ||
560 | reipl_method = REIPL_METHOD_FCP_DUMP; | ||
499 | break; | 561 | break; |
500 | case IPL_TYPE_NSS: | 562 | case IPL_TYPE_NSS: |
501 | reipl_method = IPL_METHOD_NSS; | 563 | reipl_method = REIPL_METHOD_NSS; |
564 | break; | ||
565 | case IPL_TYPE_UNKNOWN: | ||
566 | reipl_method = REIPL_METHOD_DEFAULT; | ||
502 | break; | 567 | break; |
503 | default: | 568 | default: |
504 | reipl_method = IPL_METHOD_NONE; | 569 | BUG(); |
505 | } | 570 | } |
506 | reipl_type = type; | 571 | reipl_type = type; |
507 | return 0; | 572 | return 0; |
@@ -579,22 +644,22 @@ static struct attribute_group dump_ccw_attr_group = { | |||
579 | 644 | ||
580 | /* dump type */ | 645 | /* dump type */ |
581 | 646 | ||
582 | static int dump_set_type(enum ipl_type type) | 647 | static int dump_set_type(enum dump_type type) |
583 | { | 648 | { |
584 | if (!(dump_capabilities & type)) | 649 | if (!(dump_capabilities & type)) |
585 | return -EINVAL; | 650 | return -EINVAL; |
586 | switch(type) { | 651 | switch(type) { |
587 | case IPL_TYPE_CCW: | 652 | case DUMP_TYPE_CCW: |
588 | if (MACHINE_IS_VM) | 653 | if (MACHINE_IS_VM) |
589 | dump_method = IPL_METHOD_CCW_VM; | 654 | dump_method = DUMP_METHOD_CCW_VM; |
590 | else | 655 | else |
591 | dump_method = IPL_METHOD_CCW_CIO; | 656 | dump_method = DUMP_METHOD_CCW_CIO; |
592 | break; | 657 | break; |
593 | case IPL_TYPE_FCP: | 658 | case DUMP_TYPE_FCP: |
594 | dump_method = IPL_METHOD_FCP_RW_DIAG; | 659 | dump_method = DUMP_METHOD_FCP_DIAG; |
595 | break; | 660 | break; |
596 | default: | 661 | default: |
597 | dump_method = IPL_METHOD_NONE; | 662 | dump_method = DUMP_METHOD_NONE; |
598 | } | 663 | } |
599 | dump_type = type; | 664 | dump_type = type; |
600 | return 0; | 665 | return 0; |
@@ -602,7 +667,7 @@ static int dump_set_type(enum ipl_type type) | |||
602 | 667 | ||
603 | static ssize_t dump_type_show(struct subsystem *subsys, char *page) | 668 | static ssize_t dump_type_show(struct subsystem *subsys, char *page) |
604 | { | 669 | { |
605 | return sprintf(page, "%s\n", ipl_type_str(dump_type)); | 670 | return sprintf(page, "%s\n", dump_type_str(dump_type)); |
606 | } | 671 | } |
607 | 672 | ||
608 | static ssize_t dump_type_store(struct subsystem *subsys, const char *buf, | 673 | static ssize_t dump_type_store(struct subsystem *subsys, const char *buf, |
@@ -610,12 +675,12 @@ static ssize_t dump_type_store(struct subsystem *subsys, const char *buf, | |||
610 | { | 675 | { |
611 | int rc = -EINVAL; | 676 | int rc = -EINVAL; |
612 | 677 | ||
613 | if (strncmp(buf, IPL_NONE_STR, strlen(IPL_NONE_STR)) == 0) | 678 | if (strncmp(buf, DUMP_NONE_STR, strlen(DUMP_NONE_STR)) == 0) |
614 | rc = dump_set_type(IPL_TYPE_NONE); | 679 | rc = dump_set_type(DUMP_TYPE_NONE); |
615 | else if (strncmp(buf, IPL_CCW_STR, strlen(IPL_CCW_STR)) == 0) | 680 | else if (strncmp(buf, DUMP_CCW_STR, strlen(DUMP_CCW_STR)) == 0) |
616 | rc = dump_set_type(IPL_TYPE_CCW); | 681 | rc = dump_set_type(DUMP_TYPE_CCW); |
617 | else if (strncmp(buf, IPL_FCP_STR, strlen(IPL_FCP_STR)) == 0) | 682 | else if (strncmp(buf, DUMP_FCP_STR, strlen(DUMP_FCP_STR)) == 0) |
618 | rc = dump_set_type(IPL_TYPE_FCP); | 683 | rc = dump_set_type(DUMP_TYPE_FCP); |
619 | return (rc != 0) ? rc : len; | 684 | return (rc != 0) ? rc : len; |
620 | } | 685 | } |
621 | 686 | ||
@@ -664,14 +729,14 @@ void do_reipl(void) | |||
664 | char loadparm[LOADPARM_LEN + 1]; | 729 | char loadparm[LOADPARM_LEN + 1]; |
665 | 730 | ||
666 | switch (reipl_method) { | 731 | switch (reipl_method) { |
667 | case IPL_METHOD_CCW_CIO: | 732 | case REIPL_METHOD_CCW_CIO: |
668 | devid.devno = reipl_block_ccw->ipl_info.ccw.devno; | 733 | devid.devno = reipl_block_ccw->ipl_info.ccw.devno; |
669 | if (ipl_get_type() == IPL_TYPE_CCW && devid.devno == ipl_devno) | 734 | if (ipl_info.type == IPL_TYPE_CCW && devid.devno == ipl_devno) |
670 | diag308(DIAG308_IPL, NULL); | 735 | diag308(DIAG308_IPL, NULL); |
671 | devid.ssid = 0; | 736 | devid.ssid = 0; |
672 | reipl_ccw_dev(&devid); | 737 | reipl_ccw_dev(&devid); |
673 | break; | 738 | break; |
674 | case IPL_METHOD_CCW_VM: | 739 | case REIPL_METHOD_CCW_VM: |
675 | reipl_get_ascii_loadparm(loadparm); | 740 | reipl_get_ascii_loadparm(loadparm); |
676 | if (strlen(loadparm) == 0) | 741 | if (strlen(loadparm) == 0) |
677 | sprintf(buf, "IPL %X", | 742 | sprintf(buf, "IPL %X", |
@@ -681,30 +746,32 @@ void do_reipl(void) | |||
681 | reipl_block_ccw->ipl_info.ccw.devno, loadparm); | 746 | reipl_block_ccw->ipl_info.ccw.devno, loadparm); |
682 | __cpcmd(buf, NULL, 0, NULL); | 747 | __cpcmd(buf, NULL, 0, NULL); |
683 | break; | 748 | break; |
684 | case IPL_METHOD_CCW_DIAG: | 749 | case REIPL_METHOD_CCW_DIAG: |
685 | diag308(DIAG308_SET, reipl_block_ccw); | 750 | diag308(DIAG308_SET, reipl_block_ccw); |
686 | diag308(DIAG308_IPL, NULL); | 751 | diag308(DIAG308_IPL, NULL); |
687 | break; | 752 | break; |
688 | case IPL_METHOD_FCP_RW_DIAG: | 753 | case REIPL_METHOD_FCP_RW_DIAG: |
689 | diag308(DIAG308_SET, reipl_block_fcp); | 754 | diag308(DIAG308_SET, reipl_block_fcp); |
690 | diag308(DIAG308_IPL, NULL); | 755 | diag308(DIAG308_IPL, NULL); |
691 | break; | 756 | break; |
692 | case IPL_METHOD_FCP_RO_DIAG: | 757 | case REIPL_METHOD_FCP_RO_DIAG: |
693 | diag308(DIAG308_IPL, NULL); | 758 | diag308(DIAG308_IPL, NULL); |
694 | break; | 759 | break; |
695 | case IPL_METHOD_FCP_RO_VM: | 760 | case REIPL_METHOD_FCP_RO_VM: |
696 | __cpcmd("IPL", NULL, 0, NULL); | 761 | __cpcmd("IPL", NULL, 0, NULL); |
697 | break; | 762 | break; |
698 | case IPL_METHOD_NSS: | 763 | case REIPL_METHOD_NSS: |
699 | sprintf(buf, "IPL %s", reipl_nss_name); | 764 | sprintf(buf, "IPL %s", reipl_nss_name); |
700 | __cpcmd(buf, NULL, 0, NULL); | 765 | __cpcmd(buf, NULL, 0, NULL); |
701 | break; | 766 | break; |
702 | case IPL_METHOD_NONE: | 767 | case REIPL_METHOD_DEFAULT: |
703 | default: | ||
704 | if (MACHINE_IS_VM) | 768 | if (MACHINE_IS_VM) |
705 | __cpcmd("IPL", NULL, 0, NULL); | 769 | __cpcmd("IPL", NULL, 0, NULL); |
706 | diag308(DIAG308_IPL, NULL); | 770 | diag308(DIAG308_IPL, NULL); |
707 | break; | 771 | break; |
772 | case REIPL_METHOD_FCP_DUMP: | ||
773 | default: | ||
774 | break; | ||
708 | } | 775 | } |
709 | signal_processor(smp_processor_id(), sigp_stop_and_store_status); | 776 | signal_processor(smp_processor_id(), sigp_stop_and_store_status); |
710 | } | 777 | } |
@@ -715,28 +782,28 @@ static void do_dump(void) | |||
715 | static char buf[100]; | 782 | static char buf[100]; |
716 | 783 | ||
717 | switch (dump_method) { | 784 | switch (dump_method) { |
718 | case IPL_METHOD_CCW_CIO: | 785 | case DUMP_METHOD_CCW_CIO: |
719 | smp_send_stop(); | 786 | smp_send_stop(); |
720 | devid.devno = dump_block_ccw->ipl_info.ccw.devno; | 787 | devid.devno = dump_block_ccw->ipl_info.ccw.devno; |
721 | devid.ssid = 0; | 788 | devid.ssid = 0; |
722 | reipl_ccw_dev(&devid); | 789 | reipl_ccw_dev(&devid); |
723 | break; | 790 | break; |
724 | case IPL_METHOD_CCW_VM: | 791 | case DUMP_METHOD_CCW_VM: |
725 | smp_send_stop(); | 792 | smp_send_stop(); |
726 | sprintf(buf, "STORE STATUS"); | 793 | sprintf(buf, "STORE STATUS"); |
727 | __cpcmd(buf, NULL, 0, NULL); | 794 | __cpcmd(buf, NULL, 0, NULL); |
728 | sprintf(buf, "IPL %X", dump_block_ccw->ipl_info.ccw.devno); | 795 | sprintf(buf, "IPL %X", dump_block_ccw->ipl_info.ccw.devno); |
729 | __cpcmd(buf, NULL, 0, NULL); | 796 | __cpcmd(buf, NULL, 0, NULL); |
730 | break; | 797 | break; |
731 | case IPL_METHOD_CCW_DIAG: | 798 | case DUMP_METHOD_CCW_DIAG: |
732 | diag308(DIAG308_SET, dump_block_ccw); | 799 | diag308(DIAG308_SET, dump_block_ccw); |
733 | diag308(DIAG308_DUMP, NULL); | 800 | diag308(DIAG308_DUMP, NULL); |
734 | break; | 801 | break; |
735 | case IPL_METHOD_FCP_RW_DIAG: | 802 | case DUMP_METHOD_FCP_DIAG: |
736 | diag308(DIAG308_SET, dump_block_fcp); | 803 | diag308(DIAG308_SET, dump_block_fcp); |
737 | diag308(DIAG308_DUMP, NULL); | 804 | diag308(DIAG308_DUMP, NULL); |
738 | break; | 805 | break; |
739 | case IPL_METHOD_NONE: | 806 | case DUMP_METHOD_NONE: |
740 | default: | 807 | default: |
741 | return; | 808 | return; |
742 | } | 809 | } |
@@ -777,12 +844,13 @@ static int __init ipl_init(void) | |||
777 | rc = firmware_register(&ipl_subsys); | 844 | rc = firmware_register(&ipl_subsys); |
778 | if (rc) | 845 | if (rc) |
779 | return rc; | 846 | return rc; |
780 | switch (ipl_get_type()) { | 847 | switch (ipl_info.type) { |
781 | case IPL_TYPE_CCW: | 848 | case IPL_TYPE_CCW: |
782 | rc = sysfs_create_group(&ipl_subsys.kset.kobj, | 849 | rc = sysfs_create_group(&ipl_subsys.kset.kobj, |
783 | &ipl_ccw_attr_group); | 850 | &ipl_ccw_attr_group); |
784 | break; | 851 | break; |
785 | case IPL_TYPE_FCP: | 852 | case IPL_TYPE_FCP: |
853 | case IPL_TYPE_FCP_DUMP: | ||
786 | rc = ipl_register_fcp_files(); | 854 | rc = ipl_register_fcp_files(); |
787 | break; | 855 | break; |
788 | case IPL_TYPE_NSS: | 856 | case IPL_TYPE_NSS: |
@@ -852,7 +920,7 @@ static int __init reipl_ccw_init(void) | |||
852 | /* FIXME: check for diag308_set_works when enabling diag ccw reipl */ | 920 | /* FIXME: check for diag308_set_works when enabling diag ccw reipl */ |
853 | if (!MACHINE_IS_VM) | 921 | if (!MACHINE_IS_VM) |
854 | sys_reipl_ccw_loadparm_attr.attr.mode = S_IRUGO; | 922 | sys_reipl_ccw_loadparm_attr.attr.mode = S_IRUGO; |
855 | if (ipl_get_type() == IPL_TYPE_CCW) | 923 | if (ipl_info.type == IPL_TYPE_CCW) |
856 | reipl_block_ccw->ipl_info.ccw.devno = ipl_devno; | 924 | reipl_block_ccw->ipl_info.ccw.devno = ipl_devno; |
857 | reipl_capabilities |= IPL_TYPE_CCW; | 925 | reipl_capabilities |= IPL_TYPE_CCW; |
858 | return 0; | 926 | return 0; |
@@ -862,9 +930,9 @@ static int __init reipl_fcp_init(void) | |||
862 | { | 930 | { |
863 | int rc; | 931 | int rc; |
864 | 932 | ||
865 | if ((!diag308_set_works) && (ipl_get_type() != IPL_TYPE_FCP)) | 933 | if ((!diag308_set_works) && (ipl_info.type != IPL_TYPE_FCP)) |
866 | return 0; | 934 | return 0; |
867 | if ((!diag308_set_works) && (ipl_get_type() == IPL_TYPE_FCP)) | 935 | if ((!diag308_set_works) && (ipl_info.type == IPL_TYPE_FCP)) |
868 | make_attrs_ro(reipl_fcp_attrs); | 936 | make_attrs_ro(reipl_fcp_attrs); |
869 | 937 | ||
870 | reipl_block_fcp = (void *) get_zeroed_page(GFP_KERNEL); | 938 | reipl_block_fcp = (void *) get_zeroed_page(GFP_KERNEL); |
@@ -875,7 +943,7 @@ static int __init reipl_fcp_init(void) | |||
875 | free_page((unsigned long)reipl_block_fcp); | 943 | free_page((unsigned long)reipl_block_fcp); |
876 | return rc; | 944 | return rc; |
877 | } | 945 | } |
878 | if (ipl_get_type() == IPL_TYPE_FCP) { | 946 | if (ipl_info.type == IPL_TYPE_FCP) { |
879 | memcpy(reipl_block_fcp, IPL_PARMBLOCK_START, PAGE_SIZE); | 947 | memcpy(reipl_block_fcp, IPL_PARMBLOCK_START, PAGE_SIZE); |
880 | } else { | 948 | } else { |
881 | reipl_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN; | 949 | reipl_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN; |
@@ -909,7 +977,7 @@ static int __init reipl_init(void) | |||
909 | rc = reipl_nss_init(); | 977 | rc = reipl_nss_init(); |
910 | if (rc) | 978 | if (rc) |
911 | return rc; | 979 | return rc; |
912 | rc = reipl_set_type(ipl_get_type()); | 980 | rc = reipl_set_type(ipl_info.type); |
913 | if (rc) | 981 | if (rc) |
914 | return rc; | 982 | return rc; |
915 | return 0; | 983 | return 0; |
@@ -931,7 +999,7 @@ static int __init dump_ccw_init(void) | |||
931 | dump_block_ccw->hdr.version = IPL_PARM_BLOCK_VERSION; | 999 | dump_block_ccw->hdr.version = IPL_PARM_BLOCK_VERSION; |
932 | dump_block_ccw->hdr.blk0_len = IPL_PARM_BLK0_CCW_LEN; | 1000 | dump_block_ccw->hdr.blk0_len = IPL_PARM_BLK0_CCW_LEN; |
933 | dump_block_ccw->hdr.pbt = DIAG308_IPL_TYPE_CCW; | 1001 | dump_block_ccw->hdr.pbt = DIAG308_IPL_TYPE_CCW; |
934 | dump_capabilities |= IPL_TYPE_CCW; | 1002 | dump_capabilities |= DUMP_TYPE_CCW; |
935 | return 0; | 1003 | return 0; |
936 | } | 1004 | } |
937 | 1005 | ||
@@ -956,7 +1024,7 @@ static int __init dump_fcp_init(void) | |||
956 | dump_block_fcp->hdr.blk0_len = IPL_PARM_BLK0_FCP_LEN; | 1024 | dump_block_fcp->hdr.blk0_len = IPL_PARM_BLK0_FCP_LEN; |
957 | dump_block_fcp->hdr.pbt = DIAG308_IPL_TYPE_FCP; | 1025 | dump_block_fcp->hdr.pbt = DIAG308_IPL_TYPE_FCP; |
958 | dump_block_fcp->ipl_info.fcp.opt = DIAG308_IPL_OPT_DUMP; | 1026 | dump_block_fcp->ipl_info.fcp.opt = DIAG308_IPL_OPT_DUMP; |
959 | dump_capabilities |= IPL_TYPE_FCP; | 1027 | dump_capabilities |= DUMP_TYPE_FCP; |
960 | return 0; | 1028 | return 0; |
961 | } | 1029 | } |
962 | 1030 | ||
@@ -995,7 +1063,7 @@ static int __init dump_init(void) | |||
995 | rc = dump_fcp_init(); | 1063 | rc = dump_fcp_init(); |
996 | if (rc) | 1064 | if (rc) |
997 | return rc; | 1065 | return rc; |
998 | dump_set_type(IPL_TYPE_NONE); | 1066 | dump_set_type(DUMP_TYPE_NONE); |
999 | return 0; | 1067 | return 0; |
1000 | } | 1068 | } |
1001 | 1069 | ||
@@ -1038,6 +1106,27 @@ static int __init s390_ipl_init(void) | |||
1038 | 1106 | ||
1039 | __initcall(s390_ipl_init); | 1107 | __initcall(s390_ipl_init); |
1040 | 1108 | ||
1109 | void __init ipl_save_parameters(void) | ||
1110 | { | ||
1111 | struct cio_iplinfo iplinfo; | ||
1112 | unsigned int *ipl_ptr; | ||
1113 | void *src, *dst; | ||
1114 | |||
1115 | if (cio_get_iplinfo(&iplinfo)) | ||
1116 | return; | ||
1117 | |||
1118 | ipl_devno = iplinfo.devno; | ||
1119 | ipl_flags |= IPL_DEVNO_VALID; | ||
1120 | if (!iplinfo.is_qdio) | ||
1121 | return; | ||
1122 | ipl_flags |= IPL_PARMBLOCK_VALID; | ||
1123 | ipl_ptr = (unsigned int *)__LC_IPL_PARMBLOCK_PTR; | ||
1124 | src = (void *)(unsigned long)*ipl_ptr; | ||
1125 | dst = (void *)IPL_PARMBLOCK_ORIGIN; | ||
1126 | memmove(dst, src, PAGE_SIZE); | ||
1127 | *ipl_ptr = IPL_PARMBLOCK_ORIGIN; | ||
1128 | } | ||
1129 | |||
1041 | static LIST_HEAD(rcall); | 1130 | static LIST_HEAD(rcall); |
1042 | static DEFINE_MUTEX(rcall_mutex); | 1131 | static DEFINE_MUTEX(rcall_mutex); |
1043 | 1132 | ||
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c index 39d1dd752529..59b4e796680a 100644 --- a/arch/s390/kernel/module.c +++ b/arch/s390/kernel/module.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/string.h> | 31 | #include <linux/string.h> |
32 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
33 | #include <linux/moduleloader.h> | 33 | #include <linux/moduleloader.h> |
34 | #include <linux/bug.h> | ||
34 | 35 | ||
35 | #if 0 | 36 | #if 0 |
36 | #define DEBUGP printk | 37 | #define DEBUGP printk |
@@ -398,9 +399,10 @@ int module_finalize(const Elf_Ehdr *hdr, | |||
398 | struct module *me) | 399 | struct module *me) |
399 | { | 400 | { |
400 | vfree(me->arch.syminfo); | 401 | vfree(me->arch.syminfo); |
401 | return 0; | 402 | return module_bug_finalize(hdr, sechdrs, me); |
402 | } | 403 | } |
403 | 404 | ||
404 | void module_arch_cleanup(struct module *mod) | 405 | void module_arch_cleanup(struct module *mod) |
405 | { | 406 | { |
407 | module_bug_cleanup(mod); | ||
406 | } | 408 | } |
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index 5acfac654f9d..11d9b0197626 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c | |||
@@ -280,24 +280,26 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp, | |||
280 | return 0; | 280 | return 0; |
281 | } | 281 | } |
282 | 282 | ||
283 | asmlinkage long sys_fork(struct pt_regs regs) | 283 | asmlinkage long sys_fork(void) |
284 | { | 284 | { |
285 | return do_fork(SIGCHLD, regs.gprs[15], ®s, 0, NULL, NULL); | 285 | struct pt_regs *regs = task_pt_regs(current); |
286 | return do_fork(SIGCHLD, regs->gprs[15], regs, 0, NULL, NULL); | ||
286 | } | 287 | } |
287 | 288 | ||
288 | asmlinkage long sys_clone(struct pt_regs regs) | 289 | asmlinkage long sys_clone(void) |
289 | { | 290 | { |
290 | unsigned long clone_flags; | 291 | struct pt_regs *regs = task_pt_regs(current); |
291 | unsigned long newsp; | 292 | unsigned long clone_flags; |
293 | unsigned long newsp; | ||
292 | int __user *parent_tidptr, *child_tidptr; | 294 | int __user *parent_tidptr, *child_tidptr; |
293 | 295 | ||
294 | clone_flags = regs.gprs[3]; | 296 | clone_flags = regs->gprs[3]; |
295 | newsp = regs.orig_gpr2; | 297 | newsp = regs->orig_gpr2; |
296 | parent_tidptr = (int __user *) regs.gprs[4]; | 298 | parent_tidptr = (int __user *) regs->gprs[4]; |
297 | child_tidptr = (int __user *) regs.gprs[5]; | 299 | child_tidptr = (int __user *) regs->gprs[5]; |
298 | if (!newsp) | 300 | if (!newsp) |
299 | newsp = regs.gprs[15]; | 301 | newsp = regs->gprs[15]; |
300 | return do_fork(clone_flags, newsp, ®s, 0, | 302 | return do_fork(clone_flags, newsp, regs, 0, |
301 | parent_tidptr, child_tidptr); | 303 | parent_tidptr, child_tidptr); |
302 | } | 304 | } |
303 | 305 | ||
@@ -311,40 +313,52 @@ asmlinkage long sys_clone(struct pt_regs regs) | |||
311 | * do not have enough call-clobbered registers to hold all | 313 | * do not have enough call-clobbered registers to hold all |
312 | * the information you need. | 314 | * the information you need. |
313 | */ | 315 | */ |
314 | asmlinkage long sys_vfork(struct pt_regs regs) | 316 | asmlinkage long sys_vfork(void) |
315 | { | 317 | { |
318 | struct pt_regs *regs = task_pt_regs(current); | ||
316 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, | 319 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, |
317 | regs.gprs[15], ®s, 0, NULL, NULL); | 320 | regs->gprs[15], regs, 0, NULL, NULL); |
321 | } | ||
322 | |||
323 | asmlinkage void execve_tail(void) | ||
324 | { | ||
325 | task_lock(current); | ||
326 | current->ptrace &= ~PT_DTRACE; | ||
327 | task_unlock(current); | ||
328 | current->thread.fp_regs.fpc = 0; | ||
329 | if (MACHINE_HAS_IEEE) | ||
330 | asm volatile("sfpc %0,%0" : : "d" (0)); | ||
318 | } | 331 | } |
319 | 332 | ||
320 | /* | 333 | /* |
321 | * sys_execve() executes a new program. | 334 | * sys_execve() executes a new program. |
322 | */ | 335 | */ |
323 | asmlinkage long sys_execve(struct pt_regs regs) | 336 | asmlinkage long sys_execve(void) |
324 | { | 337 | { |
325 | int error; | 338 | struct pt_regs *regs = task_pt_regs(current); |
326 | char * filename; | 339 | char *filename; |
327 | 340 | unsigned long result; | |
328 | filename = getname((char __user *) regs.orig_gpr2); | 341 | int rc; |
329 | error = PTR_ERR(filename); | 342 | |
330 | if (IS_ERR(filename)) | 343 | filename = getname((char __user *) regs->orig_gpr2); |
331 | goto out; | 344 | if (IS_ERR(filename)) { |
332 | error = do_execve(filename, (char __user * __user *) regs.gprs[3], | 345 | result = PTR_ERR(filename); |
333 | (char __user * __user *) regs.gprs[4], ®s); | 346 | goto out; |
334 | if (error == 0) { | ||
335 | task_lock(current); | ||
336 | current->ptrace &= ~PT_DTRACE; | ||
337 | task_unlock(current); | ||
338 | current->thread.fp_regs.fpc = 0; | ||
339 | if (MACHINE_HAS_IEEE) | ||
340 | asm volatile("sfpc %0,%0" : : "d" (0)); | ||
341 | } | 347 | } |
342 | putname(filename); | 348 | rc = do_execve(filename, (char __user * __user *) regs->gprs[3], |
349 | (char __user * __user *) regs->gprs[4], regs); | ||
350 | if (rc) { | ||
351 | result = rc; | ||
352 | goto out_putname; | ||
353 | } | ||
354 | execve_tail(); | ||
355 | result = regs->gprs[2]; | ||
356 | out_putname: | ||
357 | putname(filename); | ||
343 | out: | 358 | out: |
344 | return error; | 359 | return result; |
345 | } | 360 | } |
346 | 361 | ||
347 | |||
348 | /* | 362 | /* |
349 | * fill in the FPU structure for a core dump. | 363 | * fill in the FPU structure for a core dump. |
350 | */ | 364 | */ |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 863c8d08c026..3dfd0985861c 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -285,6 +285,26 @@ static void __init conmode_default(void) | |||
285 | } | 285 | } |
286 | } | 286 | } |
287 | 287 | ||
288 | #if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_ZFCPDUMP_MODULE) | ||
289 | static void __init setup_zfcpdump(unsigned int console_devno) | ||
290 | { | ||
291 | static char str[64]; | ||
292 | |||
293 | if (ipl_info.type != IPL_TYPE_FCP_DUMP) | ||
294 | return; | ||
295 | if (console_devno != -1) | ||
296 | sprintf(str, "cio_ignore=all,!0.0.%04x,!0.0.%04x", | ||
297 | ipl_info.data.fcp.dev_id.devno, console_devno); | ||
298 | else | ||
299 | sprintf(str, "cio_ignore=all,!0.0.%04x", | ||
300 | ipl_info.data.fcp.dev_id.devno); | ||
301 | strcat(COMMAND_LINE, str); | ||
302 | console_loglevel = 2; | ||
303 | } | ||
304 | #else | ||
305 | static inline void setup_zfcpdump(unsigned int console_devno) {} | ||
306 | #endif /* CONFIG_ZFCPDUMP */ | ||
307 | |||
288 | #ifdef CONFIG_SMP | 308 | #ifdef CONFIG_SMP |
289 | void (*_machine_restart)(char *command) = machine_restart_smp; | 309 | void (*_machine_restart)(char *command) = machine_restart_smp; |
290 | void (*_machine_halt)(void) = machine_halt_smp; | 310 | void (*_machine_halt)(void) = machine_halt_smp; |
@@ -586,13 +606,20 @@ setup_resources(void) | |||
586 | } | 606 | } |
587 | } | 607 | } |
588 | 608 | ||
609 | unsigned long real_memory_size; | ||
610 | EXPORT_SYMBOL_GPL(real_memory_size); | ||
611 | |||
589 | static void __init setup_memory_end(void) | 612 | static void __init setup_memory_end(void) |
590 | { | 613 | { |
591 | unsigned long real_size, memory_size; | 614 | unsigned long memory_size; |
592 | unsigned long max_mem, max_phys; | 615 | unsigned long max_mem, max_phys; |
593 | int i; | 616 | int i; |
594 | 617 | ||
595 | memory_size = real_size = 0; | 618 | #if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_ZFCPDUMP_MODULE) |
619 | if (ipl_info.type == IPL_TYPE_FCP_DUMP) | ||
620 | memory_end = ZFCPDUMP_HSA_SIZE; | ||
621 | #endif | ||
622 | memory_size = 0; | ||
596 | max_phys = VMALLOC_END_INIT - VMALLOC_MIN_SIZE; | 623 | max_phys = VMALLOC_END_INIT - VMALLOC_MIN_SIZE; |
597 | memory_end &= PAGE_MASK; | 624 | memory_end &= PAGE_MASK; |
598 | 625 | ||
@@ -601,7 +628,8 @@ static void __init setup_memory_end(void) | |||
601 | for (i = 0; i < MEMORY_CHUNKS; i++) { | 628 | for (i = 0; i < MEMORY_CHUNKS; i++) { |
602 | struct mem_chunk *chunk = &memory_chunk[i]; | 629 | struct mem_chunk *chunk = &memory_chunk[i]; |
603 | 630 | ||
604 | real_size = max(real_size, chunk->addr + chunk->size); | 631 | real_memory_size = max(real_memory_size, |
632 | chunk->addr + chunk->size); | ||
605 | if (chunk->addr >= max_mem) { | 633 | if (chunk->addr >= max_mem) { |
606 | memset(chunk, 0, sizeof(*chunk)); | 634 | memset(chunk, 0, sizeof(*chunk)); |
607 | continue; | 635 | continue; |
@@ -765,6 +793,7 @@ setup_arch(char **cmdline_p) | |||
765 | 793 | ||
766 | parse_early_param(); | 794 | parse_early_param(); |
767 | 795 | ||
796 | setup_ipl_info(); | ||
768 | setup_memory_end(); | 797 | setup_memory_end(); |
769 | setup_addressing_mode(); | 798 | setup_addressing_mode(); |
770 | setup_memory(); | 799 | setup_memory(); |
@@ -782,6 +811,9 @@ setup_arch(char **cmdline_p) | |||
782 | 811 | ||
783 | /* Setup default console */ | 812 | /* Setup default console */ |
784 | conmode_default(); | 813 | conmode_default(); |
814 | |||
815 | /* Setup zfcpdump support */ | ||
816 | setup_zfcpdump(console_devno); | ||
785 | } | 817 | } |
786 | 818 | ||
787 | void print_cpu_info(struct cpuinfo_S390 *cpuinfo) | 819 | void print_cpu_info(struct cpuinfo_S390 *cpuinfo) |
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c index 554f9cf7499c..3c41907799a1 100644 --- a/arch/s390/kernel/signal.c +++ b/arch/s390/kernel/signal.c | |||
@@ -102,9 +102,9 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, | |||
102 | } | 102 | } |
103 | 103 | ||
104 | asmlinkage long | 104 | asmlinkage long |
105 | sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | 105 | sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss) |
106 | struct pt_regs *regs) | ||
107 | { | 106 | { |
107 | struct pt_regs *regs = task_pt_regs(current); | ||
108 | return do_sigaltstack(uss, uoss, regs->gprs[15]); | 108 | return do_sigaltstack(uss, uoss, regs->gprs[15]); |
109 | } | 109 | } |
110 | 110 | ||
@@ -163,8 +163,9 @@ static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs) | |||
163 | return 0; | 163 | return 0; |
164 | } | 164 | } |
165 | 165 | ||
166 | asmlinkage long sys_sigreturn(struct pt_regs *regs) | 166 | asmlinkage long sys_sigreturn(void) |
167 | { | 167 | { |
168 | struct pt_regs *regs = task_pt_regs(current); | ||
168 | sigframe __user *frame = (sigframe __user *)regs->gprs[15]; | 169 | sigframe __user *frame = (sigframe __user *)regs->gprs[15]; |
169 | sigset_t set; | 170 | sigset_t set; |
170 | 171 | ||
@@ -189,8 +190,9 @@ badframe: | |||
189 | return 0; | 190 | return 0; |
190 | } | 191 | } |
191 | 192 | ||
192 | asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) | 193 | asmlinkage long sys_rt_sigreturn(void) |
193 | { | 194 | { |
195 | struct pt_regs *regs = task_pt_regs(current); | ||
194 | rt_sigframe __user *frame = (rt_sigframe __user *)regs->gprs[15]; | 196 | rt_sigframe __user *frame = (rt_sigframe __user *)regs->gprs[15]; |
195 | sigset_t set; | 197 | sigset_t set; |
196 | 198 | ||
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 97764f710bb7..3754e2031b39 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * arch/s390/kernel/smp.c | 2 | * arch/s390/kernel/smp.c |
3 | * | 3 | * |
4 | * Copyright (C) IBM Corp. 1999,2006 | 4 | * Copyright IBM Corp. 1999,2007 |
5 | * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), | 5 | * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), |
6 | * Martin Schwidefsky (schwidefsky@de.ibm.com) | 6 | * Martin Schwidefsky (schwidefsky@de.ibm.com) |
7 | * Heiko Carstens (heiko.carstens@de.ibm.com) | 7 | * Heiko Carstens (heiko.carstens@de.ibm.com) |
8 | * | 8 | * |
9 | * based on other smp stuff by | 9 | * based on other smp stuff by |
10 | * (c) 1995 Alan Cox, CymruNET Ltd <alan@cymru.net> | 10 | * (c) 1995 Alan Cox, CymruNET Ltd <alan@cymru.net> |
11 | * (c) 1998 Ingo Molnar | 11 | * (c) 1998 Ingo Molnar |
12 | * | 12 | * |
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
32 | #include <linux/cpu.h> | 32 | #include <linux/cpu.h> |
33 | #include <linux/timex.h> | 33 | #include <linux/timex.h> |
34 | #include <linux/bootmem.h> | ||
34 | #include <asm/ipl.h> | 35 | #include <asm/ipl.h> |
35 | #include <asm/setup.h> | 36 | #include <asm/setup.h> |
36 | #include <asm/sigp.h> | 37 | #include <asm/sigp.h> |
@@ -40,17 +41,19 @@ | |||
40 | #include <asm/cpcmd.h> | 41 | #include <asm/cpcmd.h> |
41 | #include <asm/tlbflush.h> | 42 | #include <asm/tlbflush.h> |
42 | #include <asm/timer.h> | 43 | #include <asm/timer.h> |
43 | 44 | #include <asm/lowcore.h> | |
44 | extern volatile int __cpu_logical_map[]; | ||
45 | 45 | ||
46 | /* | 46 | /* |
47 | * An array with a pointer the lowcore of every CPU. | 47 | * An array with a pointer the lowcore of every CPU. |
48 | */ | 48 | */ |
49 | |||
50 | struct _lowcore *lowcore_ptr[NR_CPUS]; | 49 | struct _lowcore *lowcore_ptr[NR_CPUS]; |
50 | EXPORT_SYMBOL(lowcore_ptr); | ||
51 | 51 | ||
52 | cpumask_t cpu_online_map = CPU_MASK_NONE; | 52 | cpumask_t cpu_online_map = CPU_MASK_NONE; |
53 | EXPORT_SYMBOL(cpu_online_map); | ||
54 | |||
53 | cpumask_t cpu_possible_map = CPU_MASK_NONE; | 55 | cpumask_t cpu_possible_map = CPU_MASK_NONE; |
56 | EXPORT_SYMBOL(cpu_possible_map); | ||
54 | 57 | ||
55 | static struct task_struct *current_set[NR_CPUS]; | 58 | static struct task_struct *current_set[NR_CPUS]; |
56 | 59 | ||
@@ -70,7 +73,7 @@ struct call_data_struct { | |||
70 | int wait; | 73 | int wait; |
71 | }; | 74 | }; |
72 | 75 | ||
73 | static struct call_data_struct * call_data; | 76 | static struct call_data_struct *call_data; |
74 | 77 | ||
75 | /* | 78 | /* |
76 | * 'Call function' interrupt callback | 79 | * 'Call function' interrupt callback |
@@ -150,8 +153,8 @@ out: | |||
150 | * | 153 | * |
151 | * Run a function on all other CPUs. | 154 | * Run a function on all other CPUs. |
152 | * | 155 | * |
153 | * You must not call this function with disabled interrupts or from a | 156 | * You must not call this function with disabled interrupts, from a |
154 | * hardware interrupt handler. You may call it from a bottom half. | 157 | * hardware interrupt handler or from a bottom half. |
155 | */ | 158 | */ |
156 | int smp_call_function(void (*func) (void *info), void *info, int nonatomic, | 159 | int smp_call_function(void (*func) (void *info), void *info, int nonatomic, |
157 | int wait) | 160 | int wait) |
@@ -177,11 +180,11 @@ EXPORT_SYMBOL(smp_call_function); | |||
177 | * | 180 | * |
178 | * Run a function on one processor. | 181 | * Run a function on one processor. |
179 | * | 182 | * |
180 | * You must not call this function with disabled interrupts or from a | 183 | * You must not call this function with disabled interrupts, from a |
181 | * hardware interrupt handler. You may call it from a bottom half. | 184 | * hardware interrupt handler or from a bottom half. |
182 | */ | 185 | */ |
183 | int smp_call_function_on(void (*func) (void *info), void *info, int nonatomic, | 186 | int smp_call_function_on(void (*func) (void *info), void *info, int nonatomic, |
184 | int wait, int cpu) | 187 | int wait, int cpu) |
185 | { | 188 | { |
186 | cpumask_t map = CPU_MASK_NONE; | 189 | cpumask_t map = CPU_MASK_NONE; |
187 | 190 | ||
@@ -195,9 +198,9 @@ EXPORT_SYMBOL(smp_call_function_on); | |||
195 | 198 | ||
196 | static void do_send_stop(void) | 199 | static void do_send_stop(void) |
197 | { | 200 | { |
198 | int cpu, rc; | 201 | int cpu, rc; |
199 | 202 | ||
200 | /* stop all processors */ | 203 | /* stop all processors */ |
201 | for_each_online_cpu(cpu) { | 204 | for_each_online_cpu(cpu) { |
202 | if (cpu == smp_processor_id()) | 205 | if (cpu == smp_processor_id()) |
203 | continue; | 206 | continue; |
@@ -209,9 +212,9 @@ static void do_send_stop(void) | |||
209 | 212 | ||
210 | static void do_store_status(void) | 213 | static void do_store_status(void) |
211 | { | 214 | { |
212 | int cpu, rc; | 215 | int cpu, rc; |
213 | 216 | ||
214 | /* store status of all processors in their lowcores (real 0) */ | 217 | /* store status of all processors in their lowcores (real 0) */ |
215 | for_each_online_cpu(cpu) { | 218 | for_each_online_cpu(cpu) { |
216 | if (cpu == smp_processor_id()) | 219 | if (cpu == smp_processor_id()) |
217 | continue; | 220 | continue; |
@@ -219,8 +222,8 @@ static void do_store_status(void) | |||
219 | rc = signal_processor_p( | 222 | rc = signal_processor_p( |
220 | (__u32)(unsigned long) lowcore_ptr[cpu], cpu, | 223 | (__u32)(unsigned long) lowcore_ptr[cpu], cpu, |
221 | sigp_store_status_at_address); | 224 | sigp_store_status_at_address); |
222 | } while(rc == sigp_busy); | 225 | } while (rc == sigp_busy); |
223 | } | 226 | } |
224 | } | 227 | } |
225 | 228 | ||
226 | static void do_wait_for_stop(void) | 229 | static void do_wait_for_stop(void) |
@@ -231,7 +234,7 @@ static void do_wait_for_stop(void) | |||
231 | for_each_online_cpu(cpu) { | 234 | for_each_online_cpu(cpu) { |
232 | if (cpu == smp_processor_id()) | 235 | if (cpu == smp_processor_id()) |
233 | continue; | 236 | continue; |
234 | while(!smp_cpu_not_running(cpu)) | 237 | while (!smp_cpu_not_running(cpu)) |
235 | cpu_relax(); | 238 | cpu_relax(); |
236 | } | 239 | } |
237 | } | 240 | } |
@@ -245,7 +248,7 @@ void smp_send_stop(void) | |||
245 | /* Disable all interrupts/machine checks */ | 248 | /* Disable all interrupts/machine checks */ |
246 | __load_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK); | 249 | __load_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK); |
247 | 250 | ||
248 | /* write magic number to zero page (absolute 0) */ | 251 | /* write magic number to zero page (absolute 0) */ |
249 | lowcore_ptr[smp_processor_id()]->panic_magic = __PANIC_MAGIC; | 252 | lowcore_ptr[smp_processor_id()]->panic_magic = __PANIC_MAGIC; |
250 | 253 | ||
251 | /* stop other processors. */ | 254 | /* stop other processors. */ |
@@ -261,8 +264,7 @@ void smp_send_stop(void) | |||
261 | /* | 264 | /* |
262 | * Reboot, halt and power_off routines for SMP. | 265 | * Reboot, halt and power_off routines for SMP. |
263 | */ | 266 | */ |
264 | 267 | void machine_restart_smp(char *__unused) | |
265 | void machine_restart_smp(char * __unused) | ||
266 | { | 268 | { |
267 | smp_send_stop(); | 269 | smp_send_stop(); |
268 | do_reipl(); | 270 | do_reipl(); |
@@ -293,17 +295,17 @@ void machine_power_off_smp(void) | |||
293 | 295 | ||
294 | static void do_ext_call_interrupt(__u16 code) | 296 | static void do_ext_call_interrupt(__u16 code) |
295 | { | 297 | { |
296 | unsigned long bits; | 298 | unsigned long bits; |
297 | 299 | ||
298 | /* | 300 | /* |
299 | * handle bit signal external calls | 301 | * handle bit signal external calls |
300 | * | 302 | * |
301 | * For the ec_schedule signal we have to do nothing. All the work | 303 | * For the ec_schedule signal we have to do nothing. All the work |
302 | * is done automatically when we return from the interrupt. | 304 | * is done automatically when we return from the interrupt. |
303 | */ | 305 | */ |
304 | bits = xchg(&S390_lowcore.ext_call_fast, 0); | 306 | bits = xchg(&S390_lowcore.ext_call_fast, 0); |
305 | 307 | ||
306 | if (test_bit(ec_call_function, &bits)) | 308 | if (test_bit(ec_call_function, &bits)) |
307 | do_call_function(); | 309 | do_call_function(); |
308 | } | 310 | } |
309 | 311 | ||
@@ -313,11 +315,11 @@ static void do_ext_call_interrupt(__u16 code) | |||
313 | */ | 315 | */ |
314 | static void smp_ext_bitcall(int cpu, ec_bit_sig sig) | 316 | static void smp_ext_bitcall(int cpu, ec_bit_sig sig) |
315 | { | 317 | { |
316 | /* | 318 | /* |
317 | * Set signaling bit in lowcore of target cpu and kick it | 319 | * Set signaling bit in lowcore of target cpu and kick it |
318 | */ | 320 | */ |
319 | set_bit(sig, (unsigned long *) &lowcore_ptr[cpu]->ext_call_fast); | 321 | set_bit(sig, (unsigned long *) &lowcore_ptr[cpu]->ext_call_fast); |
320 | while(signal_processor(cpu, sigp_emergency_signal) == sigp_busy) | 322 | while (signal_processor(cpu, sigp_emergency_signal) == sigp_busy) |
321 | udelay(10); | 323 | udelay(10); |
322 | } | 324 | } |
323 | 325 | ||
@@ -332,7 +334,7 @@ void smp_ptlb_callback(void *info) | |||
332 | 334 | ||
333 | void smp_ptlb_all(void) | 335 | void smp_ptlb_all(void) |
334 | { | 336 | { |
335 | on_each_cpu(smp_ptlb_callback, NULL, 0, 1); | 337 | on_each_cpu(smp_ptlb_callback, NULL, 0, 1); |
336 | } | 338 | } |
337 | EXPORT_SYMBOL(smp_ptlb_all); | 339 | EXPORT_SYMBOL(smp_ptlb_all); |
338 | #endif /* ! CONFIG_64BIT */ | 340 | #endif /* ! CONFIG_64BIT */ |
@@ -344,7 +346,7 @@ EXPORT_SYMBOL(smp_ptlb_all); | |||
344 | */ | 346 | */ |
345 | void smp_send_reschedule(int cpu) | 347 | void smp_send_reschedule(int cpu) |
346 | { | 348 | { |
347 | smp_ext_bitcall(cpu, ec_schedule); | 349 | smp_ext_bitcall(cpu, ec_schedule); |
348 | } | 350 | } |
349 | 351 | ||
350 | /* | 352 | /* |
@@ -358,11 +360,12 @@ struct ec_creg_mask_parms { | |||
358 | /* | 360 | /* |
359 | * callback for setting/clearing control bits | 361 | * callback for setting/clearing control bits |
360 | */ | 362 | */ |
361 | static void smp_ctl_bit_callback(void *info) { | 363 | static void smp_ctl_bit_callback(void *info) |
364 | { | ||
362 | struct ec_creg_mask_parms *pp = info; | 365 | struct ec_creg_mask_parms *pp = info; |
363 | unsigned long cregs[16]; | 366 | unsigned long cregs[16]; |
364 | int i; | 367 | int i; |
365 | 368 | ||
366 | __ctl_store(cregs, 0, 15); | 369 | __ctl_store(cregs, 0, 15); |
367 | for (i = 0; i <= 15; i++) | 370 | for (i = 0; i <= 15; i++) |
368 | cregs[i] = (cregs[i] & pp->andvals[i]) | pp->orvals[i]; | 371 | cregs[i] = (cregs[i] & pp->andvals[i]) | pp->orvals[i]; |
@@ -381,6 +384,7 @@ void smp_ctl_set_bit(int cr, int bit) | |||
381 | parms.orvals[cr] = 1 << bit; | 384 | parms.orvals[cr] = 1 << bit; |
382 | on_each_cpu(smp_ctl_bit_callback, &parms, 0, 1); | 385 | on_each_cpu(smp_ctl_bit_callback, &parms, 0, 1); |
383 | } | 386 | } |
387 | EXPORT_SYMBOL(smp_ctl_set_bit); | ||
384 | 388 | ||
385 | /* | 389 | /* |
386 | * Clear a bit in a control register of all cpus | 390 | * Clear a bit in a control register of all cpus |
@@ -394,13 +398,72 @@ void smp_ctl_clear_bit(int cr, int bit) | |||
394 | parms.andvals[cr] = ~(1L << bit); | 398 | parms.andvals[cr] = ~(1L << bit); |
395 | on_each_cpu(smp_ctl_bit_callback, &parms, 0, 1); | 399 | on_each_cpu(smp_ctl_bit_callback, &parms, 0, 1); |
396 | } | 400 | } |
401 | EXPORT_SYMBOL(smp_ctl_clear_bit); | ||
402 | |||
403 | #if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_ZFCPDUMP_MODULE) | ||
404 | |||
405 | /* | ||
406 | * zfcpdump_prefix_array holds prefix registers for the following scenario: | ||
407 | * 64 bit zfcpdump kernel and 31 bit kernel which is to be dumped. We have to | ||
408 | * save its prefix registers, since they get lost, when switching from 31 bit | ||
409 | * to 64 bit. | ||
410 | */ | ||
411 | unsigned int zfcpdump_prefix_array[NR_CPUS + 1] \ | ||
412 | __attribute__((__section__(".data"))); | ||
413 | |||
414 | static void __init smp_get_save_areas(void) | ||
415 | { | ||
416 | unsigned int cpu, cpu_num, rc; | ||
417 | __u16 boot_cpu_addr; | ||
418 | |||
419 | if (ipl_info.type != IPL_TYPE_FCP_DUMP) | ||
420 | return; | ||
421 | boot_cpu_addr = S390_lowcore.cpu_data.cpu_addr; | ||
422 | cpu_num = 1; | ||
423 | for (cpu = 0; cpu <= 65535; cpu++) { | ||
424 | if ((u16) cpu == boot_cpu_addr) | ||
425 | continue; | ||
426 | __cpu_logical_map[1] = (__u16) cpu; | ||
427 | if (signal_processor(1, sigp_sense) == sigp_not_operational) | ||
428 | continue; | ||
429 | if (cpu_num >= NR_CPUS) { | ||
430 | printk("WARNING: Registers for cpu %i are not " | ||
431 | "saved, since dump kernel was compiled with" | ||
432 | "NR_CPUS=%i!\n", cpu_num, NR_CPUS); | ||
433 | continue; | ||
434 | } | ||
435 | zfcpdump_save_areas[cpu_num] = | ||
436 | alloc_bootmem(sizeof(union save_area)); | ||
437 | while (1) { | ||
438 | rc = signal_processor(1, sigp_stop_and_store_status); | ||
439 | if (rc != sigp_busy) | ||
440 | break; | ||
441 | cpu_relax(); | ||
442 | } | ||
443 | memcpy(zfcpdump_save_areas[cpu_num], | ||
444 | (void *)(unsigned long) store_prefix() + | ||
445 | SAVE_AREA_BASE, SAVE_AREA_SIZE); | ||
446 | #ifdef __s390x__ | ||
447 | /* copy original prefix register */ | ||
448 | zfcpdump_save_areas[cpu_num]->s390x.pref_reg = | ||
449 | zfcpdump_prefix_array[cpu_num]; | ||
450 | #endif | ||
451 | cpu_num++; | ||
452 | } | ||
453 | } | ||
454 | |||
455 | union save_area *zfcpdump_save_areas[NR_CPUS + 1]; | ||
456 | EXPORT_SYMBOL_GPL(zfcpdump_save_areas); | ||
457 | |||
458 | #else | ||
459 | #define smp_get_save_areas() do { } while (0) | ||
460 | #endif | ||
397 | 461 | ||
398 | /* | 462 | /* |
399 | * Lets check how many CPUs we have. | 463 | * Lets check how many CPUs we have. |
400 | */ | 464 | */ |
401 | 465 | ||
402 | static unsigned int | 466 | static unsigned int __init smp_count_cpus(void) |
403 | __init smp_count_cpus(void) | ||
404 | { | 467 | { |
405 | unsigned int cpu, num_cpus; | 468 | unsigned int cpu, num_cpus; |
406 | __u16 boot_cpu_addr; | 469 | __u16 boot_cpu_addr; |
@@ -416,31 +479,30 @@ __init smp_count_cpus(void) | |||
416 | if ((__u16) cpu == boot_cpu_addr) | 479 | if ((__u16) cpu == boot_cpu_addr) |
417 | continue; | 480 | continue; |
418 | __cpu_logical_map[1] = (__u16) cpu; | 481 | __cpu_logical_map[1] = (__u16) cpu; |
419 | if (signal_processor(1, sigp_sense) == | 482 | if (signal_processor(1, sigp_sense) == sigp_not_operational) |
420 | sigp_not_operational) | ||
421 | continue; | 483 | continue; |
422 | num_cpus++; | 484 | num_cpus++; |
423 | } | 485 | } |
424 | 486 | ||
425 | printk("Detected %d CPU's\n",(int) num_cpus); | 487 | printk("Detected %d CPU's\n", (int) num_cpus); |
426 | printk("Boot cpu address %2X\n", boot_cpu_addr); | 488 | printk("Boot cpu address %2X\n", boot_cpu_addr); |
427 | 489 | ||
428 | return num_cpus; | 490 | return num_cpus; |
429 | } | 491 | } |
430 | 492 | ||
431 | /* | 493 | /* |
432 | * Activate a secondary processor. | 494 | * Activate a secondary processor. |
433 | */ | 495 | */ |
434 | int __devinit start_secondary(void *cpuvoid) | 496 | int __devinit start_secondary(void *cpuvoid) |
435 | { | 497 | { |
436 | /* Setup the cpu */ | 498 | /* Setup the cpu */ |
437 | cpu_init(); | 499 | cpu_init(); |
438 | preempt_disable(); | 500 | preempt_disable(); |
439 | /* Enable TOD clock interrupts on the secondary cpu. */ | 501 | /* Enable TOD clock interrupts on the secondary cpu. */ |
440 | init_cpu_timer(); | 502 | init_cpu_timer(); |
441 | #ifdef CONFIG_VIRT_TIMER | 503 | #ifdef CONFIG_VIRT_TIMER |
442 | /* Enable cpu timer interrupts on the secondary cpu. */ | 504 | /* Enable cpu timer interrupts on the secondary cpu. */ |
443 | init_cpu_vtimer(); | 505 | init_cpu_vtimer(); |
444 | #endif | 506 | #endif |
445 | /* Enable pfault pseudo page faults on this cpu. */ | 507 | /* Enable pfault pseudo page faults on this cpu. */ |
446 | pfault_init(); | 508 | pfault_init(); |
@@ -449,11 +511,11 @@ int __devinit start_secondary(void *cpuvoid) | |||
449 | cpu_set(smp_processor_id(), cpu_online_map); | 511 | cpu_set(smp_processor_id(), cpu_online_map); |
450 | /* Switch on interrupts */ | 512 | /* Switch on interrupts */ |
451 | local_irq_enable(); | 513 | local_irq_enable(); |
452 | /* Print info about this processor */ | 514 | /* Print info about this processor */ |
453 | print_cpu_info(&S390_lowcore.cpu_data); | 515 | print_cpu_info(&S390_lowcore.cpu_data); |
454 | /* cpu_idle will call schedule for us */ | 516 | /* cpu_idle will call schedule for us */ |
455 | cpu_idle(); | 517 | cpu_idle(); |
456 | return 0; | 518 | return 0; |
457 | } | 519 | } |
458 | 520 | ||
459 | static void __init smp_create_idle(unsigned int cpu) | 521 | static void __init smp_create_idle(unsigned int cpu) |
@@ -470,56 +532,13 @@ static void __init smp_create_idle(unsigned int cpu) | |||
470 | current_set[cpu] = p; | 532 | current_set[cpu] = p; |
471 | } | 533 | } |
472 | 534 | ||
473 | /* Reserving and releasing of CPUs */ | 535 | static int cpu_stopped(int cpu) |
474 | |||
475 | static DEFINE_SPINLOCK(smp_reserve_lock); | ||
476 | static int smp_cpu_reserved[NR_CPUS]; | ||
477 | |||
478 | int | ||
479 | smp_get_cpu(cpumask_t cpu_mask) | ||
480 | { | ||
481 | unsigned long flags; | ||
482 | int cpu; | ||
483 | |||
484 | spin_lock_irqsave(&smp_reserve_lock, flags); | ||
485 | /* Try to find an already reserved cpu. */ | ||
486 | for_each_cpu_mask(cpu, cpu_mask) { | ||
487 | if (smp_cpu_reserved[cpu] != 0) { | ||
488 | smp_cpu_reserved[cpu]++; | ||
489 | /* Found one. */ | ||
490 | goto out; | ||
491 | } | ||
492 | } | ||
493 | /* Reserve a new cpu from cpu_mask. */ | ||
494 | for_each_cpu_mask(cpu, cpu_mask) { | ||
495 | if (cpu_online(cpu)) { | ||
496 | smp_cpu_reserved[cpu]++; | ||
497 | goto out; | ||
498 | } | ||
499 | } | ||
500 | cpu = -ENODEV; | ||
501 | out: | ||
502 | spin_unlock_irqrestore(&smp_reserve_lock, flags); | ||
503 | return cpu; | ||
504 | } | ||
505 | |||
506 | void | ||
507 | smp_put_cpu(int cpu) | ||
508 | { | ||
509 | unsigned long flags; | ||
510 | |||
511 | spin_lock_irqsave(&smp_reserve_lock, flags); | ||
512 | smp_cpu_reserved[cpu]--; | ||
513 | spin_unlock_irqrestore(&smp_reserve_lock, flags); | ||
514 | } | ||
515 | |||
516 | static int | ||
517 | cpu_stopped(int cpu) | ||
518 | { | 536 | { |
519 | __u32 status; | 537 | __u32 status; |
520 | 538 | ||
521 | /* Check for stopped state */ | 539 | /* Check for stopped state */ |
522 | if (signal_processor_ps(&status, 0, cpu, sigp_sense) == sigp_status_stored) { | 540 | if (signal_processor_ps(&status, 0, cpu, sigp_sense) == |
541 | sigp_status_stored) { | ||
523 | if (status & 0x40) | 542 | if (status & 0x40) |
524 | return 1; | 543 | return 1; |
525 | } | 544 | } |
@@ -528,14 +547,13 @@ cpu_stopped(int cpu) | |||
528 | 547 | ||
529 | /* Upping and downing of CPUs */ | 548 | /* Upping and downing of CPUs */ |
530 | 549 | ||
531 | int | 550 | int __cpu_up(unsigned int cpu) |
532 | __cpu_up(unsigned int cpu) | ||
533 | { | 551 | { |
534 | struct task_struct *idle; | 552 | struct task_struct *idle; |
535 | struct _lowcore *cpu_lowcore; | 553 | struct _lowcore *cpu_lowcore; |
536 | struct stack_frame *sf; | 554 | struct stack_frame *sf; |
537 | sigp_ccode ccode; | 555 | sigp_ccode ccode; |
538 | int curr_cpu; | 556 | int curr_cpu; |
539 | 557 | ||
540 | for (curr_cpu = 0; curr_cpu <= 65535; curr_cpu++) { | 558 | for (curr_cpu = 0; curr_cpu <= 65535; curr_cpu++) { |
541 | __cpu_logical_map[cpu] = (__u16) curr_cpu; | 559 | __cpu_logical_map[cpu] = (__u16) curr_cpu; |
@@ -548,7 +566,7 @@ __cpu_up(unsigned int cpu) | |||
548 | 566 | ||
549 | ccode = signal_processor_p((__u32)(unsigned long)(lowcore_ptr[cpu]), | 567 | ccode = signal_processor_p((__u32)(unsigned long)(lowcore_ptr[cpu]), |
550 | cpu, sigp_set_prefix); | 568 | cpu, sigp_set_prefix); |
551 | if (ccode){ | 569 | if (ccode) { |
552 | printk("sigp_set_prefix failed for cpu %d " | 570 | printk("sigp_set_prefix failed for cpu %d " |
553 | "with condition code %d\n", | 571 | "with condition code %d\n", |
554 | (int) cpu, (int) ccode); | 572 | (int) cpu, (int) ccode); |
@@ -556,9 +574,9 @@ __cpu_up(unsigned int cpu) | |||
556 | } | 574 | } |
557 | 575 | ||
558 | idle = current_set[cpu]; | 576 | idle = current_set[cpu]; |
559 | cpu_lowcore = lowcore_ptr[cpu]; | 577 | cpu_lowcore = lowcore_ptr[cpu]; |
560 | cpu_lowcore->kernel_stack = (unsigned long) | 578 | cpu_lowcore->kernel_stack = (unsigned long) |
561 | task_stack_page(idle) + (THREAD_SIZE); | 579 | task_stack_page(idle) + THREAD_SIZE; |
562 | sf = (struct stack_frame *) (cpu_lowcore->kernel_stack | 580 | sf = (struct stack_frame *) (cpu_lowcore->kernel_stack |
563 | - sizeof(struct pt_regs) | 581 | - sizeof(struct pt_regs) |
564 | - sizeof(struct stack_frame)); | 582 | - sizeof(struct stack_frame)); |
@@ -570,11 +588,11 @@ __cpu_up(unsigned int cpu) | |||
570 | " stam 0,15,0(%0)" | 588 | " stam 0,15,0(%0)" |
571 | : : "a" (&cpu_lowcore->access_regs_save_area) : "memory"); | 589 | : : "a" (&cpu_lowcore->access_regs_save_area) : "memory"); |
572 | cpu_lowcore->percpu_offset = __per_cpu_offset[cpu]; | 590 | cpu_lowcore->percpu_offset = __per_cpu_offset[cpu]; |
573 | cpu_lowcore->current_task = (unsigned long) idle; | 591 | cpu_lowcore->current_task = (unsigned long) idle; |
574 | cpu_lowcore->cpu_data.cpu_nr = cpu; | 592 | cpu_lowcore->cpu_data.cpu_nr = cpu; |
575 | eieio(); | 593 | eieio(); |
576 | 594 | ||
577 | while (signal_processor(cpu,sigp_restart) == sigp_busy) | 595 | while (signal_processor(cpu, sigp_restart) == sigp_busy) |
578 | udelay(10); | 596 | udelay(10); |
579 | 597 | ||
580 | while (!cpu_online(cpu)) | 598 | while (!cpu_online(cpu)) |
@@ -589,6 +607,7 @@ void __init smp_setup_cpu_possible_map(void) | |||
589 | { | 607 | { |
590 | unsigned int phy_cpus, pos_cpus, cpu; | 608 | unsigned int phy_cpus, pos_cpus, cpu; |
591 | 609 | ||
610 | smp_get_save_areas(); | ||
592 | phy_cpus = smp_count_cpus(); | 611 | phy_cpus = smp_count_cpus(); |
593 | pos_cpus = min(phy_cpus + additional_cpus, (unsigned int) NR_CPUS); | 612 | pos_cpus = min(phy_cpus + additional_cpus, (unsigned int) NR_CPUS); |
594 | 613 | ||
@@ -620,18 +639,11 @@ static int __init setup_possible_cpus(char *s) | |||
620 | } | 639 | } |
621 | early_param("possible_cpus", setup_possible_cpus); | 640 | early_param("possible_cpus", setup_possible_cpus); |
622 | 641 | ||
623 | int | 642 | int __cpu_disable(void) |
624 | __cpu_disable(void) | ||
625 | { | 643 | { |
626 | unsigned long flags; | ||
627 | struct ec_creg_mask_parms cr_parms; | 644 | struct ec_creg_mask_parms cr_parms; |
628 | int cpu = smp_processor_id(); | 645 | int cpu = smp_processor_id(); |
629 | 646 | ||
630 | spin_lock_irqsave(&smp_reserve_lock, flags); | ||
631 | if (smp_cpu_reserved[cpu] != 0) { | ||
632 | spin_unlock_irqrestore(&smp_reserve_lock, flags); | ||
633 | return -EBUSY; | ||
634 | } | ||
635 | cpu_clear(cpu, cpu_online_map); | 647 | cpu_clear(cpu, cpu_online_map); |
636 | 648 | ||
637 | /* Disable pfault pseudo page faults on this cpu. */ | 649 | /* Disable pfault pseudo page faults on this cpu. */ |
@@ -642,24 +654,23 @@ __cpu_disable(void) | |||
642 | 654 | ||
643 | /* disable all external interrupts */ | 655 | /* disable all external interrupts */ |
644 | cr_parms.orvals[0] = 0; | 656 | cr_parms.orvals[0] = 0; |
645 | cr_parms.andvals[0] = ~(1<<15 | 1<<14 | 1<<13 | 1<<12 | | 657 | cr_parms.andvals[0] = ~(1 << 15 | 1 << 14 | 1 << 13 | 1 << 12 | |
646 | 1<<11 | 1<<10 | 1<< 6 | 1<< 4); | 658 | 1 << 11 | 1 << 10 | 1 << 6 | 1 << 4); |
647 | /* disable all I/O interrupts */ | 659 | /* disable all I/O interrupts */ |
648 | cr_parms.orvals[6] = 0; | 660 | cr_parms.orvals[6] = 0; |
649 | cr_parms.andvals[6] = ~(1<<31 | 1<<30 | 1<<29 | 1<<28 | | 661 | cr_parms.andvals[6] = ~(1 << 31 | 1 << 30 | 1 << 29 | 1 << 28 | |
650 | 1<<27 | 1<<26 | 1<<25 | 1<<24); | 662 | 1 << 27 | 1 << 26 | 1 << 25 | 1 << 24); |
651 | /* disable most machine checks */ | 663 | /* disable most machine checks */ |
652 | cr_parms.orvals[14] = 0; | 664 | cr_parms.orvals[14] = 0; |
653 | cr_parms.andvals[14] = ~(1<<28 | 1<<27 | 1<<26 | 1<<25 | 1<<24); | 665 | cr_parms.andvals[14] = ~(1 << 28 | 1 << 27 | 1 << 26 | |
666 | 1 << 25 | 1 << 24); | ||
654 | 667 | ||
655 | smp_ctl_bit_callback(&cr_parms); | 668 | smp_ctl_bit_callback(&cr_parms); |
656 | 669 | ||
657 | spin_unlock_irqrestore(&smp_reserve_lock, flags); | ||
658 | return 0; | 670 | return 0; |
659 | } | 671 | } |
660 | 672 | ||
661 | void | 673 | void __cpu_die(unsigned int cpu) |
662 | __cpu_die(unsigned int cpu) | ||
663 | { | 674 | { |
664 | /* Wait until target cpu is down */ | 675 | /* Wait until target cpu is down */ |
665 | while (!smp_cpu_not_running(cpu)) | 676 | while (!smp_cpu_not_running(cpu)) |
@@ -667,13 +678,12 @@ __cpu_die(unsigned int cpu) | |||
667 | printk("Processor %d spun down\n", cpu); | 678 | printk("Processor %d spun down\n", cpu); |
668 | } | 679 | } |
669 | 680 | ||
670 | void | 681 | void cpu_die(void) |
671 | cpu_die(void) | ||
672 | { | 682 | { |
673 | idle_task_exit(); | 683 | idle_task_exit(); |
674 | signal_processor(smp_processor_id(), sigp_stop); | 684 | signal_processor(smp_processor_id(), sigp_stop); |
675 | BUG(); | 685 | BUG(); |
676 | for(;;); | 686 | for (;;); |
677 | } | 687 | } |
678 | 688 | ||
679 | #endif /* CONFIG_HOTPLUG_CPU */ | 689 | #endif /* CONFIG_HOTPLUG_CPU */ |
@@ -686,36 +696,36 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
686 | { | 696 | { |
687 | unsigned long stack; | 697 | unsigned long stack; |
688 | unsigned int cpu; | 698 | unsigned int cpu; |
689 | int i; | 699 | int i; |
690 | 700 | ||
691 | /* request the 0x1201 emergency signal external interrupt */ | 701 | /* request the 0x1201 emergency signal external interrupt */ |
692 | if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0) | 702 | if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0) |
693 | panic("Couldn't request external interrupt 0x1201"); | 703 | panic("Couldn't request external interrupt 0x1201"); |
694 | memset(lowcore_ptr,0,sizeof(lowcore_ptr)); | 704 | memset(lowcore_ptr, 0, sizeof(lowcore_ptr)); |
695 | /* | 705 | /* |
696 | * Initialize prefix pages and stacks for all possible cpus | 706 | * Initialize prefix pages and stacks for all possible cpus |
697 | */ | 707 | */ |
698 | print_cpu_info(&S390_lowcore.cpu_data); | 708 | print_cpu_info(&S390_lowcore.cpu_data); |
699 | 709 | ||
700 | for_each_possible_cpu(i) { | 710 | for_each_possible_cpu(i) { |
701 | lowcore_ptr[i] = (struct _lowcore *) | 711 | lowcore_ptr[i] = (struct _lowcore *) |
702 | __get_free_pages(GFP_KERNEL|GFP_DMA, | 712 | __get_free_pages(GFP_KERNEL | GFP_DMA, |
703 | sizeof(void*) == 8 ? 1 : 0); | 713 | sizeof(void*) == 8 ? 1 : 0); |
704 | stack = __get_free_pages(GFP_KERNEL,ASYNC_ORDER); | 714 | stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER); |
705 | if (lowcore_ptr[i] == NULL || stack == 0ULL) | 715 | if (!lowcore_ptr[i] || !stack) |
706 | panic("smp_boot_cpus failed to allocate memory\n"); | 716 | panic("smp_boot_cpus failed to allocate memory\n"); |
707 | 717 | ||
708 | *(lowcore_ptr[i]) = S390_lowcore; | 718 | *(lowcore_ptr[i]) = S390_lowcore; |
709 | lowcore_ptr[i]->async_stack = stack + (ASYNC_SIZE); | 719 | lowcore_ptr[i]->async_stack = stack + ASYNC_SIZE; |
710 | stack = __get_free_pages(GFP_KERNEL,0); | 720 | stack = __get_free_pages(GFP_KERNEL, 0); |
711 | if (stack == 0ULL) | 721 | if (!stack) |
712 | panic("smp_boot_cpus failed to allocate memory\n"); | 722 | panic("smp_boot_cpus failed to allocate memory\n"); |
713 | lowcore_ptr[i]->panic_stack = stack + (PAGE_SIZE); | 723 | lowcore_ptr[i]->panic_stack = stack + PAGE_SIZE; |
714 | #ifndef CONFIG_64BIT | 724 | #ifndef CONFIG_64BIT |
715 | if (MACHINE_HAS_IEEE) { | 725 | if (MACHINE_HAS_IEEE) { |
716 | lowcore_ptr[i]->extended_save_area_addr = | 726 | lowcore_ptr[i]->extended_save_area_addr = |
717 | (__u32) __get_free_pages(GFP_KERNEL,0); | 727 | (__u32) __get_free_pages(GFP_KERNEL, 0); |
718 | if (lowcore_ptr[i]->extended_save_area_addr == 0) | 728 | if (!lowcore_ptr[i]->extended_save_area_addr) |
719 | panic("smp_boot_cpus failed to " | 729 | panic("smp_boot_cpus failed to " |
720 | "allocate memory\n"); | 730 | "allocate memory\n"); |
721 | } | 731 | } |
@@ -754,34 +764,63 @@ void smp_cpus_done(unsigned int max_cpus) | |||
754 | */ | 764 | */ |
755 | int setup_profiling_timer(unsigned int multiplier) | 765 | int setup_profiling_timer(unsigned int multiplier) |
756 | { | 766 | { |
757 | return 0; | 767 | return 0; |
758 | } | 768 | } |
759 | 769 | ||
760 | static DEFINE_PER_CPU(struct cpu, cpu_devices); | 770 | static DEFINE_PER_CPU(struct cpu, cpu_devices); |
761 | 771 | ||
772 | static ssize_t show_capability(struct sys_device *dev, char *buf) | ||
773 | { | ||
774 | unsigned int capability; | ||
775 | int rc; | ||
776 | |||
777 | rc = get_cpu_capability(&capability); | ||
778 | if (rc) | ||
779 | return rc; | ||
780 | return sprintf(buf, "%u\n", capability); | ||
781 | } | ||
782 | static SYSDEV_ATTR(capability, 0444, show_capability, NULL); | ||
783 | |||
784 | static int __cpuinit smp_cpu_notify(struct notifier_block *self, | ||
785 | unsigned long action, void *hcpu) | ||
786 | { | ||
787 | unsigned int cpu = (unsigned int)(long)hcpu; | ||
788 | struct cpu *c = &per_cpu(cpu_devices, cpu); | ||
789 | struct sys_device *s = &c->sysdev; | ||
790 | |||
791 | switch (action) { | ||
792 | case CPU_ONLINE: | ||
793 | if (sysdev_create_file(s, &attr_capability)) | ||
794 | return NOTIFY_BAD; | ||
795 | break; | ||
796 | case CPU_DEAD: | ||
797 | sysdev_remove_file(s, &attr_capability); | ||
798 | break; | ||
799 | } | ||
800 | return NOTIFY_OK; | ||
801 | } | ||
802 | |||
803 | static struct notifier_block __cpuinitdata smp_cpu_nb = { | ||
804 | .notifier_call = smp_cpu_notify, | ||
805 | }; | ||
806 | |||
762 | static int __init topology_init(void) | 807 | static int __init topology_init(void) |
763 | { | 808 | { |
764 | int cpu; | 809 | int cpu; |
765 | int ret; | 810 | |
811 | register_cpu_notifier(&smp_cpu_nb); | ||
766 | 812 | ||
767 | for_each_possible_cpu(cpu) { | 813 | for_each_possible_cpu(cpu) { |
768 | struct cpu *c = &per_cpu(cpu_devices, cpu); | 814 | struct cpu *c = &per_cpu(cpu_devices, cpu); |
815 | struct sys_device *s = &c->sysdev; | ||
769 | 816 | ||
770 | c->hotpluggable = 1; | 817 | c->hotpluggable = 1; |
771 | ret = register_cpu(c, cpu); | 818 | register_cpu(c, cpu); |
772 | if (ret) | 819 | if (!cpu_online(cpu)) |
773 | printk(KERN_WARNING "topology_init: register_cpu %d " | 820 | continue; |
774 | "failed (%d)\n", cpu, ret); | 821 | s = &c->sysdev; |
822 | sysdev_create_file(s, &attr_capability); | ||
775 | } | 823 | } |
776 | return 0; | 824 | return 0; |
777 | } | 825 | } |
778 | |||
779 | subsys_initcall(topology_init); | 826 | subsys_initcall(topology_init); |
780 | |||
781 | EXPORT_SYMBOL(cpu_online_map); | ||
782 | EXPORT_SYMBOL(cpu_possible_map); | ||
783 | EXPORT_SYMBOL(lowcore_ptr); | ||
784 | EXPORT_SYMBOL(smp_ctl_set_bit); | ||
785 | EXPORT_SYMBOL(smp_ctl_clear_bit); | ||
786 | EXPORT_SYMBOL(smp_get_cpu); | ||
787 | EXPORT_SYMBOL(smp_put_cpu); | ||
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c index 584ed95f3380..3a77c22cda78 100644 --- a/arch/s390/kernel/sys_s390.c +++ b/arch/s390/kernel/sys_s390.c | |||
@@ -266,23 +266,3 @@ s390_fadvise64_64(struct fadvise64_64_args __user *args) | |||
266 | return -EFAULT; | 266 | return -EFAULT; |
267 | return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice); | 267 | return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice); |
268 | } | 268 | } |
269 | |||
270 | /* | ||
271 | * Do a system call from kernel instead of calling sys_execve so we | ||
272 | * end up with proper pt_regs. | ||
273 | */ | ||
274 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | ||
275 | { | ||
276 | register const char *__arg1 asm("2") = filename; | ||
277 | register char *const*__arg2 asm("3") = argv; | ||
278 | register char *const*__arg3 asm("4") = envp; | ||
279 | register long __svcres asm("2"); | ||
280 | asm volatile( | ||
281 | "svc %b1" | ||
282 | : "=d" (__svcres) | ||
283 | : "i" (__NR_execve), | ||
284 | "0" (__arg1), | ||
285 | "d" (__arg2), | ||
286 | "d" (__arg3) : "memory"); | ||
287 | return __svcres; | ||
288 | } | ||
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S index c774f1069e10..cd8d321cd0c2 100644 --- a/arch/s390/kernel/syscalls.S +++ b/arch/s390/kernel/syscalls.S | |||
@@ -10,7 +10,7 @@ | |||
10 | 10 | ||
11 | NI_SYSCALL /* 0 */ | 11 | NI_SYSCALL /* 0 */ |
12 | SYSCALL(sys_exit,sys_exit,sys32_exit_wrapper) | 12 | SYSCALL(sys_exit,sys_exit,sys32_exit_wrapper) |
13 | SYSCALL(sys_fork_glue,sys_fork_glue,sys_fork_glue) | 13 | SYSCALL(sys_fork,sys_fork,sys_fork) |
14 | SYSCALL(sys_read,sys_read,sys32_read_wrapper) | 14 | SYSCALL(sys_read,sys_read,sys32_read_wrapper) |
15 | SYSCALL(sys_write,sys_write,sys32_write_wrapper) | 15 | SYSCALL(sys_write,sys_write,sys32_write_wrapper) |
16 | SYSCALL(sys_open,sys_open,sys32_open_wrapper) /* 5 */ | 16 | SYSCALL(sys_open,sys_open,sys32_open_wrapper) /* 5 */ |
@@ -19,7 +19,7 @@ SYSCALL(sys_restart_syscall,sys_restart_syscall,sys_restart_syscall) | |||
19 | SYSCALL(sys_creat,sys_creat,sys32_creat_wrapper) | 19 | SYSCALL(sys_creat,sys_creat,sys32_creat_wrapper) |
20 | SYSCALL(sys_link,sys_link,sys32_link_wrapper) | 20 | SYSCALL(sys_link,sys_link,sys32_link_wrapper) |
21 | SYSCALL(sys_unlink,sys_unlink,sys32_unlink_wrapper) /* 10 */ | 21 | SYSCALL(sys_unlink,sys_unlink,sys32_unlink_wrapper) /* 10 */ |
22 | SYSCALL(sys_execve_glue,sys_execve_glue,sys32_execve_glue) | 22 | SYSCALL(sys_execve,sys_execve,sys32_execve) |
23 | SYSCALL(sys_chdir,sys_chdir,sys32_chdir_wrapper) | 23 | SYSCALL(sys_chdir,sys_chdir,sys32_chdir_wrapper) |
24 | SYSCALL(sys_time,sys_ni_syscall,sys32_time_wrapper) /* old time syscall */ | 24 | SYSCALL(sys_time,sys_ni_syscall,sys32_time_wrapper) /* old time syscall */ |
25 | SYSCALL(sys_mknod,sys_mknod,sys32_mknod_wrapper) | 25 | SYSCALL(sys_mknod,sys_mknod,sys32_mknod_wrapper) |
@@ -127,8 +127,8 @@ SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper) /* 115 */ | |||
127 | SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper) | 127 | SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper) |
128 | SYSCALL(sys_ipc,sys_ipc,sys32_ipc_wrapper) | 128 | SYSCALL(sys_ipc,sys_ipc,sys32_ipc_wrapper) |
129 | SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper) | 129 | SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper) |
130 | SYSCALL(sys_sigreturn_glue,sys_sigreturn_glue,sys32_sigreturn_glue) | 130 | SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn) |
131 | SYSCALL(sys_clone_glue,sys_clone_glue,sys32_clone_glue) /* 120 */ | 131 | SYSCALL(sys_clone,sys_clone,sys32_clone) /* 120 */ |
132 | SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper) | 132 | SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper) |
133 | SYSCALL(sys_newuname,s390x_newuname,sys32_newuname_wrapper) | 133 | SYSCALL(sys_newuname,s390x_newuname,sys32_newuname_wrapper) |
134 | NI_SYSCALL /* modify_ldt for i386 */ | 134 | NI_SYSCALL /* modify_ldt for i386 */ |
@@ -181,7 +181,7 @@ SYSCALL(sys_nfsservctl,sys_nfsservctl,compat_sys_nfsservctl_wrapper) | |||
181 | SYSCALL(sys_setresgid16,sys_ni_syscall,sys32_setresgid16_wrapper) /* 170 old setresgid16 syscall */ | 181 | SYSCALL(sys_setresgid16,sys_ni_syscall,sys32_setresgid16_wrapper) /* 170 old setresgid16 syscall */ |
182 | SYSCALL(sys_getresgid16,sys_ni_syscall,sys32_getresgid16_wrapper) /* old getresgid16 syscall */ | 182 | SYSCALL(sys_getresgid16,sys_ni_syscall,sys32_getresgid16_wrapper) /* old getresgid16 syscall */ |
183 | SYSCALL(sys_prctl,sys_prctl,sys32_prctl_wrapper) | 183 | SYSCALL(sys_prctl,sys_prctl,sys32_prctl_wrapper) |
184 | SYSCALL(sys_rt_sigreturn_glue,sys_rt_sigreturn_glue,sys32_rt_sigreturn_glue) | 184 | SYSCALL(sys_rt_sigreturn,sys_rt_sigreturn,sys32_rt_sigreturn) |
185 | SYSCALL(sys_rt_sigaction,sys_rt_sigaction,sys32_rt_sigaction_wrapper) | 185 | SYSCALL(sys_rt_sigaction,sys_rt_sigaction,sys32_rt_sigaction_wrapper) |
186 | SYSCALL(sys_rt_sigprocmask,sys_rt_sigprocmask,sys32_rt_sigprocmask_wrapper) /* 175 */ | 186 | SYSCALL(sys_rt_sigprocmask,sys_rt_sigprocmask,sys32_rt_sigprocmask_wrapper) /* 175 */ |
187 | SYSCALL(sys_rt_sigpending,sys_rt_sigpending,sys32_rt_sigpending_wrapper) | 187 | SYSCALL(sys_rt_sigpending,sys_rt_sigpending,sys32_rt_sigpending_wrapper) |
@@ -194,11 +194,11 @@ SYSCALL(sys_chown16,sys_ni_syscall,sys32_chown16_wrapper) /* old chown16 syscall | |||
194 | SYSCALL(sys_getcwd,sys_getcwd,sys32_getcwd_wrapper) | 194 | SYSCALL(sys_getcwd,sys_getcwd,sys32_getcwd_wrapper) |
195 | SYSCALL(sys_capget,sys_capget,sys32_capget_wrapper) | 195 | SYSCALL(sys_capget,sys_capget,sys32_capget_wrapper) |
196 | SYSCALL(sys_capset,sys_capset,sys32_capset_wrapper) /* 185 */ | 196 | SYSCALL(sys_capset,sys_capset,sys32_capset_wrapper) /* 185 */ |
197 | SYSCALL(sys_sigaltstack_glue,sys_sigaltstack_glue,sys32_sigaltstack_glue) | 197 | SYSCALL(sys_sigaltstack,sys_sigaltstack,sys32_sigaltstack) |
198 | SYSCALL(sys_sendfile,sys_sendfile64,sys32_sendfile_wrapper) | 198 | SYSCALL(sys_sendfile,sys_sendfile64,sys32_sendfile_wrapper) |
199 | NI_SYSCALL /* streams1 */ | 199 | NI_SYSCALL /* streams1 */ |
200 | NI_SYSCALL /* streams2 */ | 200 | NI_SYSCALL /* streams2 */ |
201 | SYSCALL(sys_vfork_glue,sys_vfork_glue,sys_vfork_glue) /* 190 */ | 201 | SYSCALL(sys_vfork,sys_vfork,sys_vfork) /* 190 */ |
202 | SYSCALL(sys_getrlimit,sys_getrlimit,compat_sys_getrlimit_wrapper) | 202 | SYSCALL(sys_getrlimit,sys_getrlimit,compat_sys_getrlimit_wrapper) |
203 | SYSCALL(sys_mmap2,sys_mmap2,sys32_mmap2_wrapper) | 203 | SYSCALL(sys_mmap2,sys_mmap2,sys32_mmap2_wrapper) |
204 | SYSCALL(sys_truncate64,sys_ni_syscall,sys32_truncate64_wrapper) | 204 | SYSCALL(sys_truncate64,sys_ni_syscall,sys32_truncate64_wrapper) |
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index e1ad464b6f20..711dae8da7ad 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c | |||
@@ -280,7 +280,6 @@ static void clock_comparator_interrupt(__u16 code) | |||
280 | } | 280 | } |
281 | 281 | ||
282 | static void etr_reset(void); | 282 | static void etr_reset(void); |
283 | static void etr_init(void); | ||
284 | static void etr_ext_handler(__u16); | 283 | static void etr_ext_handler(__u16); |
285 | 284 | ||
286 | /* | 285 | /* |
@@ -355,7 +354,6 @@ void __init time_init(void) | |||
355 | #ifdef CONFIG_VIRT_TIMER | 354 | #ifdef CONFIG_VIRT_TIMER |
356 | vtime_init(); | 355 | vtime_init(); |
357 | #endif | 356 | #endif |
358 | etr_init(); | ||
359 | } | 357 | } |
360 | 358 | ||
361 | /* | 359 | /* |
@@ -426,11 +424,11 @@ static struct etr_aib etr_port1; | |||
426 | static int etr_port1_uptodate; | 424 | static int etr_port1_uptodate; |
427 | static unsigned long etr_events; | 425 | static unsigned long etr_events; |
428 | static struct timer_list etr_timer; | 426 | static struct timer_list etr_timer; |
429 | static struct tasklet_struct etr_tasklet; | ||
430 | static DEFINE_PER_CPU(atomic_t, etr_sync_word); | 427 | static DEFINE_PER_CPU(atomic_t, etr_sync_word); |
431 | 428 | ||
432 | static void etr_timeout(unsigned long dummy); | 429 | static void etr_timeout(unsigned long dummy); |
433 | static void etr_tasklet_fn(unsigned long dummy); | 430 | static void etr_work_fn(struct work_struct *work); |
431 | static DECLARE_WORK(etr_work, etr_work_fn); | ||
434 | 432 | ||
435 | /* | 433 | /* |
436 | * The etr get_clock function. It will write the current clock value | 434 | * The etr get_clock function. It will write the current clock value |
@@ -507,29 +505,31 @@ static void etr_reset(void) | |||
507 | } | 505 | } |
508 | } | 506 | } |
509 | 507 | ||
510 | static void etr_init(void) | 508 | static int __init etr_init(void) |
511 | { | 509 | { |
512 | struct etr_aib aib; | 510 | struct etr_aib aib; |
513 | 511 | ||
514 | if (test_bit(ETR_FLAG_ENOSYS, &etr_flags)) | 512 | if (test_bit(ETR_FLAG_ENOSYS, &etr_flags)) |
515 | return; | 513 | return 0; |
516 | /* Check if this machine has the steai instruction. */ | 514 | /* Check if this machine has the steai instruction. */ |
517 | if (etr_steai(&aib, ETR_STEAI_STEPPING_PORT) == 0) | 515 | if (etr_steai(&aib, ETR_STEAI_STEPPING_PORT) == 0) |
518 | set_bit(ETR_FLAG_STEAI, &etr_flags); | 516 | set_bit(ETR_FLAG_STEAI, &etr_flags); |
519 | setup_timer(&etr_timer, etr_timeout, 0UL); | 517 | setup_timer(&etr_timer, etr_timeout, 0UL); |
520 | tasklet_init(&etr_tasklet, etr_tasklet_fn, 0); | ||
521 | if (!etr_port0_online && !etr_port1_online) | 518 | if (!etr_port0_online && !etr_port1_online) |
522 | set_bit(ETR_FLAG_EACCES, &etr_flags); | 519 | set_bit(ETR_FLAG_EACCES, &etr_flags); |
523 | if (etr_port0_online) { | 520 | if (etr_port0_online) { |
524 | set_bit(ETR_EVENT_PORT0_CHANGE, &etr_events); | 521 | set_bit(ETR_EVENT_PORT0_CHANGE, &etr_events); |
525 | tasklet_hi_schedule(&etr_tasklet); | 522 | schedule_work(&etr_work); |
526 | } | 523 | } |
527 | if (etr_port1_online) { | 524 | if (etr_port1_online) { |
528 | set_bit(ETR_EVENT_PORT1_CHANGE, &etr_events); | 525 | set_bit(ETR_EVENT_PORT1_CHANGE, &etr_events); |
529 | tasklet_hi_schedule(&etr_tasklet); | 526 | schedule_work(&etr_work); |
530 | } | 527 | } |
528 | return 0; | ||
531 | } | 529 | } |
532 | 530 | ||
531 | arch_initcall(etr_init); | ||
532 | |||
533 | /* | 533 | /* |
534 | * Two sorts of ETR machine checks. The architecture reads: | 534 | * Two sorts of ETR machine checks. The architecture reads: |
535 | * "When a machine-check niterruption occurs and if a switch-to-local or | 535 | * "When a machine-check niterruption occurs and if a switch-to-local or |
@@ -549,7 +549,7 @@ void etr_switch_to_local(void) | |||
549 | return; | 549 | return; |
550 | etr_disable_sync_clock(NULL); | 550 | etr_disable_sync_clock(NULL); |
551 | set_bit(ETR_EVENT_SWITCH_LOCAL, &etr_events); | 551 | set_bit(ETR_EVENT_SWITCH_LOCAL, &etr_events); |
552 | tasklet_hi_schedule(&etr_tasklet); | 552 | schedule_work(&etr_work); |
553 | } | 553 | } |
554 | 554 | ||
555 | /* | 555 | /* |
@@ -564,7 +564,7 @@ void etr_sync_check(void) | |||
564 | return; | 564 | return; |
565 | etr_disable_sync_clock(NULL); | 565 | etr_disable_sync_clock(NULL); |
566 | set_bit(ETR_EVENT_SYNC_CHECK, &etr_events); | 566 | set_bit(ETR_EVENT_SYNC_CHECK, &etr_events); |
567 | tasklet_hi_schedule(&etr_tasklet); | 567 | schedule_work(&etr_work); |
568 | } | 568 | } |
569 | 569 | ||
570 | /* | 570 | /* |
@@ -591,13 +591,13 @@ static void etr_ext_handler(__u16 code) | |||
591 | * Both ports are not up-to-date now. | 591 | * Both ports are not up-to-date now. |
592 | */ | 592 | */ |
593 | set_bit(ETR_EVENT_PORT_ALERT, &etr_events); | 593 | set_bit(ETR_EVENT_PORT_ALERT, &etr_events); |
594 | tasklet_hi_schedule(&etr_tasklet); | 594 | schedule_work(&etr_work); |
595 | } | 595 | } |
596 | 596 | ||
597 | static void etr_timeout(unsigned long dummy) | 597 | static void etr_timeout(unsigned long dummy) |
598 | { | 598 | { |
599 | set_bit(ETR_EVENT_UPDATE, &etr_events); | 599 | set_bit(ETR_EVENT_UPDATE, &etr_events); |
600 | tasklet_hi_schedule(&etr_tasklet); | 600 | schedule_work(&etr_work); |
601 | } | 601 | } |
602 | 602 | ||
603 | /* | 603 | /* |
@@ -927,7 +927,7 @@ static struct etr_eacr etr_handle_update(struct etr_aib *aib, | |||
927 | if (!eacr.e0 && !eacr.e1) | 927 | if (!eacr.e0 && !eacr.e1) |
928 | return eacr; | 928 | return eacr; |
929 | 929 | ||
930 | /* Update port0 or port1 with aib stored in etr_tasklet_fn. */ | 930 | /* Update port0 or port1 with aib stored in etr_work_fn. */ |
931 | if (aib->esw.q == 0) { | 931 | if (aib->esw.q == 0) { |
932 | /* Information for port 0 stored. */ | 932 | /* Information for port 0 stored. */ |
933 | if (eacr.p0 && !etr_port0_uptodate) { | 933 | if (eacr.p0 && !etr_port0_uptodate) { |
@@ -1007,7 +1007,7 @@ static void etr_update_eacr(struct etr_eacr eacr) | |||
1007 | * particular this is the only function that calls etr_update_eacr(), | 1007 | * particular this is the only function that calls etr_update_eacr(), |
1008 | * it "controls" the etr control register. | 1008 | * it "controls" the etr control register. |
1009 | */ | 1009 | */ |
1010 | static void etr_tasklet_fn(unsigned long dummy) | 1010 | static void etr_work_fn(struct work_struct *work) |
1011 | { | 1011 | { |
1012 | unsigned long long now; | 1012 | unsigned long long now; |
1013 | struct etr_eacr eacr; | 1013 | struct etr_eacr eacr; |
@@ -1220,13 +1220,13 @@ static ssize_t etr_online_store(struct sys_device *dev, | |||
1220 | return count; /* Nothing to do. */ | 1220 | return count; /* Nothing to do. */ |
1221 | etr_port0_online = value; | 1221 | etr_port0_online = value; |
1222 | set_bit(ETR_EVENT_PORT0_CHANGE, &etr_events); | 1222 | set_bit(ETR_EVENT_PORT0_CHANGE, &etr_events); |
1223 | tasklet_hi_schedule(&etr_tasklet); | 1223 | schedule_work(&etr_work); |
1224 | } else { | 1224 | } else { |
1225 | if (etr_port1_online == value) | 1225 | if (etr_port1_online == value) |
1226 | return count; /* Nothing to do. */ | 1226 | return count; /* Nothing to do. */ |
1227 | etr_port1_online = value; | 1227 | etr_port1_online = value; |
1228 | set_bit(ETR_EVENT_PORT1_CHANGE, &etr_events); | 1228 | set_bit(ETR_EVENT_PORT1_CHANGE, &etr_events); |
1229 | tasklet_hi_schedule(&etr_tasklet); | 1229 | schedule_work(&etr_work); |
1230 | } | 1230 | } |
1231 | return count; | 1231 | return count; |
1232 | } | 1232 | } |
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index f0e5a320e2ec..49dec830373a 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/kallsyms.h> | 30 | #include <linux/kallsyms.h> |
31 | #include <linux/reboot.h> | 31 | #include <linux/reboot.h> |
32 | #include <linux/kprobes.h> | 32 | #include <linux/kprobes.h> |
33 | 33 | #include <linux/bug.h> | |
34 | #include <asm/system.h> | 34 | #include <asm/system.h> |
35 | #include <asm/uaccess.h> | 35 | #include <asm/uaccess.h> |
36 | #include <asm/io.h> | 36 | #include <asm/io.h> |
@@ -188,18 +188,31 @@ void dump_stack(void) | |||
188 | 188 | ||
189 | EXPORT_SYMBOL(dump_stack); | 189 | EXPORT_SYMBOL(dump_stack); |
190 | 190 | ||
191 | static inline int mask_bits(struct pt_regs *regs, unsigned long bits) | ||
192 | { | ||
193 | return (regs->psw.mask & bits) / ((~bits + 1) & bits); | ||
194 | } | ||
195 | |||
191 | void show_registers(struct pt_regs *regs) | 196 | void show_registers(struct pt_regs *regs) |
192 | { | 197 | { |
193 | mm_segment_t old_fs; | ||
194 | char *mode; | 198 | char *mode; |
195 | int i; | ||
196 | 199 | ||
197 | mode = (regs->psw.mask & PSW_MASK_PSTATE) ? "User" : "Krnl"; | 200 | mode = (regs->psw.mask & PSW_MASK_PSTATE) ? "User" : "Krnl"; |
198 | printk("%s PSW : %p %p", | 201 | printk("%s PSW : %p %p", |
199 | mode, (void *) regs->psw.mask, | 202 | mode, (void *) regs->psw.mask, |
200 | (void *) regs->psw.addr); | 203 | (void *) regs->psw.addr); |
201 | print_symbol(" (%s)\n", regs->psw.addr & PSW_ADDR_INSN); | 204 | print_symbol(" (%s)\n", regs->psw.addr & PSW_ADDR_INSN); |
202 | printk("%s GPRS: " FOURLONG, mode, | 205 | printk(" R:%x T:%x IO:%x EX:%x Key:%x M:%x W:%x " |
206 | "P:%x AS:%x CC:%x PM:%x", mask_bits(regs, PSW_MASK_PER), | ||
207 | mask_bits(regs, PSW_MASK_DAT), mask_bits(regs, PSW_MASK_IO), | ||
208 | mask_bits(regs, PSW_MASK_EXT), mask_bits(regs, PSW_MASK_KEY), | ||
209 | mask_bits(regs, PSW_MASK_MCHECK), mask_bits(regs, PSW_MASK_WAIT), | ||
210 | mask_bits(regs, PSW_MASK_PSTATE), mask_bits(regs, PSW_MASK_ASC), | ||
211 | mask_bits(regs, PSW_MASK_CC), mask_bits(regs, PSW_MASK_PM)); | ||
212 | #ifdef CONFIG_64BIT | ||
213 | printk(" EA:%x", mask_bits(regs, PSW_BASE_BITS)); | ||
214 | #endif | ||
215 | printk("\n%s GPRS: " FOURLONG, mode, | ||
203 | regs->gprs[0], regs->gprs[1], regs->gprs[2], regs->gprs[3]); | 216 | regs->gprs[0], regs->gprs[1], regs->gprs[2], regs->gprs[3]); |
204 | printk(" " FOURLONG, | 217 | printk(" " FOURLONG, |
205 | regs->gprs[4], regs->gprs[5], regs->gprs[6], regs->gprs[7]); | 218 | regs->gprs[4], regs->gprs[5], regs->gprs[6], regs->gprs[7]); |
@@ -208,41 +221,7 @@ void show_registers(struct pt_regs *regs) | |||
208 | printk(" " FOURLONG, | 221 | printk(" " FOURLONG, |
209 | regs->gprs[12], regs->gprs[13], regs->gprs[14], regs->gprs[15]); | 222 | regs->gprs[12], regs->gprs[13], regs->gprs[14], regs->gprs[15]); |
210 | 223 | ||
211 | #if 0 | 224 | show_code(regs); |
212 | /* FIXME: this isn't needed any more but it changes the ksymoops | ||
213 | * input. To remove or not to remove ... */ | ||
214 | save_access_regs(regs->acrs); | ||
215 | printk("%s ACRS: %08x %08x %08x %08x\n", mode, | ||
216 | regs->acrs[0], regs->acrs[1], regs->acrs[2], regs->acrs[3]); | ||
217 | printk(" %08x %08x %08x %08x\n", | ||
218 | regs->acrs[4], regs->acrs[5], regs->acrs[6], regs->acrs[7]); | ||
219 | printk(" %08x %08x %08x %08x\n", | ||
220 | regs->acrs[8], regs->acrs[9], regs->acrs[10], regs->acrs[11]); | ||
221 | printk(" %08x %08x %08x %08x\n", | ||
222 | regs->acrs[12], regs->acrs[13], regs->acrs[14], regs->acrs[15]); | ||
223 | #endif | ||
224 | |||
225 | /* | ||
226 | * Print the first 20 byte of the instruction stream at the | ||
227 | * time of the fault. | ||
228 | */ | ||
229 | old_fs = get_fs(); | ||
230 | if (regs->psw.mask & PSW_MASK_PSTATE) | ||
231 | set_fs(USER_DS); | ||
232 | else | ||
233 | set_fs(KERNEL_DS); | ||
234 | printk("%s Code: ", mode); | ||
235 | for (i = 0; i < 20; i++) { | ||
236 | unsigned char c; | ||
237 | if (__get_user(c, (char __user *)(regs->psw.addr + i))) { | ||
238 | printk(" Bad PSW."); | ||
239 | break; | ||
240 | } | ||
241 | printk("%02x ", c); | ||
242 | } | ||
243 | set_fs(old_fs); | ||
244 | |||
245 | printk("\n"); | ||
246 | } | 225 | } |
247 | 226 | ||
248 | /* This is called from fs/proc/array.c */ | 227 | /* This is called from fs/proc/array.c */ |
@@ -318,6 +297,11 @@ report_user_fault(long interruption_code, struct pt_regs *regs) | |||
318 | #endif | 297 | #endif |
319 | } | 298 | } |
320 | 299 | ||
300 | int is_valid_bugaddr(unsigned long addr) | ||
301 | { | ||
302 | return 1; | ||
303 | } | ||
304 | |||
321 | static void __kprobes inline do_trap(long interruption_code, int signr, | 305 | static void __kprobes inline do_trap(long interruption_code, int signr, |
322 | char *str, struct pt_regs *regs, | 306 | char *str, struct pt_regs *regs, |
323 | siginfo_t *info) | 307 | siginfo_t *info) |
@@ -344,8 +328,14 @@ static void __kprobes inline do_trap(long interruption_code, int signr, | |||
344 | fixup = search_exception_tables(regs->psw.addr & PSW_ADDR_INSN); | 328 | fixup = search_exception_tables(regs->psw.addr & PSW_ADDR_INSN); |
345 | if (fixup) | 329 | if (fixup) |
346 | regs->psw.addr = fixup->fixup | PSW_ADDR_AMODE; | 330 | regs->psw.addr = fixup->fixup | PSW_ADDR_AMODE; |
347 | else | 331 | else { |
348 | die(str, regs, interruption_code); | 332 | enum bug_trap_type btt; |
333 | |||
334 | btt = report_bug(regs->psw.addr & PSW_ADDR_INSN); | ||
335 | if (btt == BUG_TRAP_TYPE_WARN) | ||
336 | return; | ||
337 | die(str, regs, interruption_code); | ||
338 | } | ||
349 | } | 339 | } |
350 | } | 340 | } |
351 | 341 | ||
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S index c30716ae130c..418f6426a949 100644 --- a/arch/s390/kernel/vmlinux.lds.S +++ b/arch/s390/kernel/vmlinux.lds.S | |||
@@ -45,6 +45,8 @@ SECTIONS | |||
45 | __ex_table : { *(__ex_table) } | 45 | __ex_table : { *(__ex_table) } |
46 | __stop___ex_table = .; | 46 | __stop___ex_table = .; |
47 | 47 | ||
48 | BUG_TABLE | ||
49 | |||
48 | .data : { /* Data */ | 50 | .data : { /* Data */ |
49 | *(.data) | 51 | *(.data) |
50 | CONSTRUCTORS | 52 | CONSTRUCTORS |
@@ -77,6 +79,12 @@ SECTIONS | |||
77 | *(.init.text) | 79 | *(.init.text) |
78 | _einittext = .; | 80 | _einittext = .; |
79 | } | 81 | } |
82 | /* | ||
83 | * .exit.text is discarded at runtime, not link time, | ||
84 | * to deal with references from __bug_table | ||
85 | */ | ||
86 | .exit.text : { *(.exit.text) } | ||
87 | |||
80 | .init.data : { *(.init.data) } | 88 | .init.data : { *(.init.data) } |
81 | . = ALIGN(256); | 89 | . = ALIGN(256); |
82 | __setup_start = .; | 90 | __setup_start = .; |
@@ -116,7 +124,7 @@ SECTIONS | |||
116 | 124 | ||
117 | /* Sections to be discarded */ | 125 | /* Sections to be discarded */ |
118 | /DISCARD/ : { | 126 | /DISCARD/ : { |
119 | *(.exit.text) *(.exit.data) *(.exitcall.exit) | 127 | *(.exit.data) *(.exitcall.exit) |
120 | } | 128 | } |
121 | 129 | ||
122 | /* Stabs debugging sections. */ | 130 | /* Stabs debugging sections. */ |
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c index 9d5b02801b46..1e1a6ee2cac1 100644 --- a/arch/s390/kernel/vtime.c +++ b/arch/s390/kernel/vtime.c | |||
@@ -128,7 +128,7 @@ static inline void set_vtimer(__u64 expires) | |||
128 | S390_lowcore.last_update_timer = expires; | 128 | S390_lowcore.last_update_timer = expires; |
129 | 129 | ||
130 | /* store expire time for this CPU timer */ | 130 | /* store expire time for this CPU timer */ |
131 | per_cpu(virt_cpu_timer, smp_processor_id()).to_expire = expires; | 131 | __get_cpu_var(virt_cpu_timer).to_expire = expires; |
132 | } | 132 | } |
133 | #else | 133 | #else |
134 | static inline void set_vtimer(__u64 expires) | 134 | static inline void set_vtimer(__u64 expires) |
@@ -137,7 +137,7 @@ static inline void set_vtimer(__u64 expires) | |||
137 | asm volatile ("SPT %0" : : "m" (S390_lowcore.last_update_timer)); | 137 | asm volatile ("SPT %0" : : "m" (S390_lowcore.last_update_timer)); |
138 | 138 | ||
139 | /* store expire time for this CPU timer */ | 139 | /* store expire time for this CPU timer */ |
140 | per_cpu(virt_cpu_timer, smp_processor_id()).to_expire = expires; | 140 | __get_cpu_var(virt_cpu_timer).to_expire = expires; |
141 | } | 141 | } |
142 | #endif | 142 | #endif |
143 | 143 | ||
@@ -145,7 +145,7 @@ static void start_cpu_timer(void) | |||
145 | { | 145 | { |
146 | struct vtimer_queue *vt_list; | 146 | struct vtimer_queue *vt_list; |
147 | 147 | ||
148 | vt_list = &per_cpu(virt_cpu_timer, smp_processor_id()); | 148 | vt_list = &__get_cpu_var(virt_cpu_timer); |
149 | 149 | ||
150 | /* CPU timer interrupt is pending, don't reprogramm it */ | 150 | /* CPU timer interrupt is pending, don't reprogramm it */ |
151 | if (vt_list->idle & 1LL<<63) | 151 | if (vt_list->idle & 1LL<<63) |
@@ -159,7 +159,7 @@ static void stop_cpu_timer(void) | |||
159 | { | 159 | { |
160 | struct vtimer_queue *vt_list; | 160 | struct vtimer_queue *vt_list; |
161 | 161 | ||
162 | vt_list = &per_cpu(virt_cpu_timer, smp_processor_id()); | 162 | vt_list = &__get_cpu_var(virt_cpu_timer); |
163 | 163 | ||
164 | /* nothing to do */ | 164 | /* nothing to do */ |
165 | if (list_empty(&vt_list->list)) { | 165 | if (list_empty(&vt_list->list)) { |
@@ -219,7 +219,7 @@ static void do_callbacks(struct list_head *cb_list) | |||
219 | if (list_empty(cb_list)) | 219 | if (list_empty(cb_list)) |
220 | return; | 220 | return; |
221 | 221 | ||
222 | vt_list = &per_cpu(virt_cpu_timer, smp_processor_id()); | 222 | vt_list = &__get_cpu_var(virt_cpu_timer); |
223 | 223 | ||
224 | list_for_each_entry_safe(event, tmp, cb_list, entry) { | 224 | list_for_each_entry_safe(event, tmp, cb_list, entry) { |
225 | fn = event->function; | 225 | fn = event->function; |
@@ -244,7 +244,6 @@ static void do_callbacks(struct list_head *cb_list) | |||
244 | */ | 244 | */ |
245 | static void do_cpu_timer_interrupt(__u16 error_code) | 245 | static void do_cpu_timer_interrupt(__u16 error_code) |
246 | { | 246 | { |
247 | int cpu; | ||
248 | __u64 next, delta; | 247 | __u64 next, delta; |
249 | struct vtimer_queue *vt_list; | 248 | struct vtimer_queue *vt_list; |
250 | struct vtimer_list *event, *tmp; | 249 | struct vtimer_list *event, *tmp; |
@@ -253,8 +252,7 @@ static void do_cpu_timer_interrupt(__u16 error_code) | |||
253 | struct list_head cb_list; | 252 | struct list_head cb_list; |
254 | 253 | ||
255 | INIT_LIST_HEAD(&cb_list); | 254 | INIT_LIST_HEAD(&cb_list); |
256 | cpu = smp_processor_id(); | 255 | vt_list = &__get_cpu_var(virt_cpu_timer); |
257 | vt_list = &per_cpu(virt_cpu_timer, cpu); | ||
258 | 256 | ||
259 | /* walk timer list, fire all expired events */ | 257 | /* walk timer list, fire all expired events */ |
260 | spin_lock(&vt_list->lock); | 258 | spin_lock(&vt_list->lock); |
@@ -534,7 +532,7 @@ void init_cpu_vtimer(void) | |||
534 | /* enable cpu timer interrupts */ | 532 | /* enable cpu timer interrupts */ |
535 | __ctl_set_bit(0,10); | 533 | __ctl_set_bit(0,10); |
536 | 534 | ||
537 | vt_list = &per_cpu(virt_cpu_timer, smp_processor_id()); | 535 | vt_list = &__get_cpu_var(virt_cpu_timer); |
538 | INIT_LIST_HEAD(&vt_list->list); | 536 | INIT_LIST_HEAD(&vt_list->list); |
539 | spin_lock_init(&vt_list->lock); | 537 | spin_lock_init(&vt_list->lock); |
540 | vt_list->to_expire = 0; | 538 | vt_list->to_expire = 0; |
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index 7462aebd3eb6..2b76a879a7b5 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c | |||
@@ -26,9 +26,9 @@ | |||
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/hardirq.h> | 27 | #include <linux/hardirq.h> |
28 | #include <linux/kprobes.h> | 28 | #include <linux/kprobes.h> |
29 | #include <linux/uaccess.h> | ||
29 | 30 | ||
30 | #include <asm/system.h> | 31 | #include <asm/system.h> |
31 | #include <asm/uaccess.h> | ||
32 | #include <asm/pgtable.h> | 32 | #include <asm/pgtable.h> |
33 | #include <asm/kdebug.h> | 33 | #include <asm/kdebug.h> |
34 | #include <asm/s390_ext.h> | 34 | #include <asm/s390_ext.h> |
@@ -63,21 +63,25 @@ int unregister_page_fault_notifier(struct notifier_block *nb) | |||
63 | return atomic_notifier_chain_unregister(¬ify_page_fault_chain, nb); | 63 | return atomic_notifier_chain_unregister(¬ify_page_fault_chain, nb); |
64 | } | 64 | } |
65 | 65 | ||
66 | static inline int notify_page_fault(enum die_val val, const char *str, | 66 | static int __kprobes __notify_page_fault(struct pt_regs *regs, long err) |
67 | struct pt_regs *regs, long err, int trap, int sig) | ||
68 | { | 67 | { |
69 | struct die_args args = { | 68 | struct die_args args = { .str = "page fault", |
70 | .regs = regs, | 69 | .trapnr = 14, |
71 | .str = str, | 70 | .signr = SIGSEGV }; |
72 | .err = err, | 71 | args.regs = regs; |
73 | .trapnr = trap, | 72 | args.err = err; |
74 | .signr = sig | 73 | return atomic_notifier_call_chain(¬ify_page_fault_chain, |
75 | }; | 74 | DIE_PAGE_FAULT, &args); |
76 | return atomic_notifier_call_chain(¬ify_page_fault_chain, val, &args); | 75 | } |
76 | |||
77 | static inline int notify_page_fault(struct pt_regs *regs, long err) | ||
78 | { | ||
79 | if (unlikely(kprobe_running())) | ||
80 | return __notify_page_fault(regs, err); | ||
81 | return NOTIFY_DONE; | ||
77 | } | 82 | } |
78 | #else | 83 | #else |
79 | static inline int notify_page_fault(enum die_val val, const char *str, | 84 | static inline int notify_page_fault(struct pt_regs *regs, long err) |
80 | struct pt_regs *regs, long err, int trap, int sig) | ||
81 | { | 85 | { |
82 | return NOTIFY_DONE; | 86 | return NOTIFY_DONE; |
83 | } | 87 | } |
@@ -170,74 +174,127 @@ static void do_sigsegv(struct pt_regs *regs, unsigned long error_code, | |||
170 | force_sig_info(SIGSEGV, &si, current); | 174 | force_sig_info(SIGSEGV, &si, current); |
171 | } | 175 | } |
172 | 176 | ||
177 | static void do_no_context(struct pt_regs *regs, unsigned long error_code, | ||
178 | unsigned long address) | ||
179 | { | ||
180 | const struct exception_table_entry *fixup; | ||
181 | |||
182 | /* Are we prepared to handle this kernel fault? */ | ||
183 | fixup = search_exception_tables(regs->psw.addr & __FIXUP_MASK); | ||
184 | if (fixup) { | ||
185 | regs->psw.addr = fixup->fixup | PSW_ADDR_AMODE; | ||
186 | return; | ||
187 | } | ||
188 | |||
189 | /* | ||
190 | * Oops. The kernel tried to access some bad page. We'll have to | ||
191 | * terminate things with extreme prejudice. | ||
192 | */ | ||
193 | if (check_space(current) == 0) | ||
194 | printk(KERN_ALERT "Unable to handle kernel pointer dereference" | ||
195 | " at virtual kernel address %p\n", (void *)address); | ||
196 | else | ||
197 | printk(KERN_ALERT "Unable to handle kernel paging request" | ||
198 | " at virtual user address %p\n", (void *)address); | ||
199 | |||
200 | die("Oops", regs, error_code); | ||
201 | do_exit(SIGKILL); | ||
202 | } | ||
203 | |||
204 | static void do_low_address(struct pt_regs *regs, unsigned long error_code) | ||
205 | { | ||
206 | /* Low-address protection hit in kernel mode means | ||
207 | NULL pointer write access in kernel mode. */ | ||
208 | if (regs->psw.mask & PSW_MASK_PSTATE) { | ||
209 | /* Low-address protection hit in user mode 'cannot happen'. */ | ||
210 | die ("Low-address protection", regs, error_code); | ||
211 | do_exit(SIGKILL); | ||
212 | } | ||
213 | |||
214 | do_no_context(regs, error_code, 0); | ||
215 | } | ||
216 | |||
217 | /* | ||
218 | * We ran out of memory, or some other thing happened to us that made | ||
219 | * us unable to handle the page fault gracefully. | ||
220 | */ | ||
221 | static int do_out_of_memory(struct pt_regs *regs, unsigned long error_code, | ||
222 | unsigned long address) | ||
223 | { | ||
224 | struct task_struct *tsk = current; | ||
225 | struct mm_struct *mm = tsk->mm; | ||
226 | |||
227 | up_read(&mm->mmap_sem); | ||
228 | if (is_init(tsk)) { | ||
229 | yield(); | ||
230 | down_read(&mm->mmap_sem); | ||
231 | return 1; | ||
232 | } | ||
233 | printk("VM: killing process %s\n", tsk->comm); | ||
234 | if (regs->psw.mask & PSW_MASK_PSTATE) | ||
235 | do_exit(SIGKILL); | ||
236 | do_no_context(regs, error_code, address); | ||
237 | return 0; | ||
238 | } | ||
239 | |||
240 | static void do_sigbus(struct pt_regs *regs, unsigned long error_code, | ||
241 | unsigned long address) | ||
242 | { | ||
243 | struct task_struct *tsk = current; | ||
244 | struct mm_struct *mm = tsk->mm; | ||
245 | |||
246 | up_read(&mm->mmap_sem); | ||
247 | /* | ||
248 | * Send a sigbus, regardless of whether we were in kernel | ||
249 | * or user mode. | ||
250 | */ | ||
251 | tsk->thread.prot_addr = address; | ||
252 | tsk->thread.trap_no = error_code; | ||
253 | force_sig(SIGBUS, tsk); | ||
254 | |||
255 | /* Kernel mode? Handle exceptions or die */ | ||
256 | if (!(regs->psw.mask & PSW_MASK_PSTATE)) | ||
257 | do_no_context(regs, error_code, address); | ||
258 | } | ||
259 | |||
173 | #ifdef CONFIG_S390_EXEC_PROTECT | 260 | #ifdef CONFIG_S390_EXEC_PROTECT |
174 | extern long sys_sigreturn(struct pt_regs *regs); | 261 | extern long sys_sigreturn(struct pt_regs *regs); |
175 | extern long sys_rt_sigreturn(struct pt_regs *regs); | 262 | extern long sys_rt_sigreturn(struct pt_regs *regs); |
176 | extern long sys32_sigreturn(struct pt_regs *regs); | 263 | extern long sys32_sigreturn(struct pt_regs *regs); |
177 | extern long sys32_rt_sigreturn(struct pt_regs *regs); | 264 | extern long sys32_rt_sigreturn(struct pt_regs *regs); |
178 | 265 | ||
179 | static inline void do_sigreturn(struct mm_struct *mm, struct pt_regs *regs, | 266 | static int signal_return(struct mm_struct *mm, struct pt_regs *regs, |
180 | int rt) | 267 | unsigned long address, unsigned long error_code) |
181 | { | 268 | { |
269 | u16 instruction; | ||
270 | int rc, compat; | ||
271 | |||
272 | pagefault_disable(); | ||
273 | rc = __get_user(instruction, (u16 __user *) regs->psw.addr); | ||
274 | pagefault_enable(); | ||
275 | if (rc) | ||
276 | return -EFAULT; | ||
277 | |||
182 | up_read(&mm->mmap_sem); | 278 | up_read(&mm->mmap_sem); |
183 | clear_tsk_thread_flag(current, TIF_SINGLE_STEP); | 279 | clear_tsk_thread_flag(current, TIF_SINGLE_STEP); |
184 | #ifdef CONFIG_COMPAT | 280 | #ifdef CONFIG_COMPAT |
185 | if (test_tsk_thread_flag(current, TIF_31BIT)) { | 281 | compat = test_tsk_thread_flag(current, TIF_31BIT); |
186 | if (rt) | 282 | if (compat && instruction == 0x0a77) |
187 | sys32_rt_sigreturn(regs); | 283 | sys32_sigreturn(regs); |
188 | else | 284 | else if (compat && instruction == 0x0aad) |
189 | sys32_sigreturn(regs); | 285 | sys32_rt_sigreturn(regs); |
190 | return; | ||
191 | } | ||
192 | #endif /* CONFIG_COMPAT */ | ||
193 | if (rt) | ||
194 | sys_rt_sigreturn(regs); | ||
195 | else | 286 | else |
287 | #endif | ||
288 | if (instruction == 0x0a77) | ||
196 | sys_sigreturn(regs); | 289 | sys_sigreturn(regs); |
197 | return; | 290 | else if (instruction == 0x0aad) |
198 | } | 291 | sys_rt_sigreturn(regs); |
199 | |||
200 | static int signal_return(struct mm_struct *mm, struct pt_regs *regs, | ||
201 | unsigned long address, unsigned long error_code) | ||
202 | { | ||
203 | pgd_t *pgd; | ||
204 | pmd_t *pmd; | ||
205 | pte_t *pte; | ||
206 | u16 *instruction; | ||
207 | unsigned long pfn, uaddr = regs->psw.addr; | ||
208 | |||
209 | spin_lock(&mm->page_table_lock); | ||
210 | pgd = pgd_offset(mm, uaddr); | ||
211 | if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd))) | ||
212 | goto out_fault; | ||
213 | pmd = pmd_offset(pgd, uaddr); | ||
214 | if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd))) | ||
215 | goto out_fault; | ||
216 | pte = pte_offset_map(pmd_offset(pgd_offset(mm, uaddr), uaddr), uaddr); | ||
217 | if (!pte || !pte_present(*pte)) | ||
218 | goto out_fault; | ||
219 | pfn = pte_pfn(*pte); | ||
220 | if (!pfn_valid(pfn)) | ||
221 | goto out_fault; | ||
222 | spin_unlock(&mm->page_table_lock); | ||
223 | |||
224 | instruction = (u16 *) ((pfn << PAGE_SHIFT) + (uaddr & (PAGE_SIZE-1))); | ||
225 | if (*instruction == 0x0a77) | ||
226 | do_sigreturn(mm, regs, 0); | ||
227 | else if (*instruction == 0x0aad) | ||
228 | do_sigreturn(mm, regs, 1); | ||
229 | else { | 292 | else { |
230 | printk("- XXX - do_exception: task = %s, primary, NO EXEC " | ||
231 | "-> SIGSEGV\n", current->comm); | ||
232 | up_read(&mm->mmap_sem); | ||
233 | current->thread.prot_addr = address; | 293 | current->thread.prot_addr = address; |
234 | current->thread.trap_no = error_code; | 294 | current->thread.trap_no = error_code; |
235 | do_sigsegv(regs, error_code, SEGV_MAPERR, address); | 295 | do_sigsegv(regs, error_code, SEGV_MAPERR, address); |
236 | } | 296 | } |
237 | return 0; | 297 | return 0; |
238 | out_fault: | ||
239 | spin_unlock(&mm->page_table_lock); | ||
240 | return -EFAULT; | ||
241 | } | 298 | } |
242 | #endif /* CONFIG_S390_EXEC_PROTECT */ | 299 | #endif /* CONFIG_S390_EXEC_PROTECT */ |
243 | 300 | ||
@@ -253,49 +310,23 @@ out_fault: | |||
253 | * 3b Region third trans. -> Not present (nullification) | 310 | * 3b Region third trans. -> Not present (nullification) |
254 | */ | 311 | */ |
255 | static inline void | 312 | static inline void |
256 | do_exception(struct pt_regs *regs, unsigned long error_code, int is_protection) | 313 | do_exception(struct pt_regs *regs, unsigned long error_code, int write) |
257 | { | 314 | { |
258 | struct task_struct *tsk; | 315 | struct task_struct *tsk; |
259 | struct mm_struct *mm; | 316 | struct mm_struct *mm; |
260 | struct vm_area_struct * vma; | 317 | struct vm_area_struct *vma; |
261 | unsigned long address; | 318 | unsigned long address; |
262 | const struct exception_table_entry *fixup; | ||
263 | int si_code; | ||
264 | int space; | 319 | int space; |
320 | int si_code; | ||
265 | 321 | ||
266 | tsk = current; | 322 | if (notify_page_fault(regs, error_code) == NOTIFY_STOP) |
267 | mm = tsk->mm; | ||
268 | |||
269 | if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14, | ||
270 | SIGSEGV) == NOTIFY_STOP) | ||
271 | return; | 323 | return; |
272 | 324 | ||
273 | /* | 325 | tsk = current; |
274 | * Check for low-address protection. This needs to be treated | 326 | mm = tsk->mm; |
275 | * as a special case because the translation exception code | ||
276 | * field is not guaranteed to contain valid data in this case. | ||
277 | */ | ||
278 | if (is_protection && !(S390_lowcore.trans_exc_code & 4)) { | ||
279 | |||
280 | /* Low-address protection hit in kernel mode means | ||
281 | NULL pointer write access in kernel mode. */ | ||
282 | if (!(regs->psw.mask & PSW_MASK_PSTATE)) { | ||
283 | address = 0; | ||
284 | space = 0; | ||
285 | goto no_context; | ||
286 | } | ||
287 | |||
288 | /* Low-address protection hit in user mode 'cannot happen'. */ | ||
289 | die ("Low-address protection", regs, error_code); | ||
290 | do_exit(SIGKILL); | ||
291 | } | ||
292 | 327 | ||
293 | /* | 328 | /* get the failing address and the affected space */ |
294 | * get the failing address | 329 | address = S390_lowcore.trans_exc_code & __FAIL_ADDR_MASK; |
295 | * more specific the segment and page table portion of | ||
296 | * the address | ||
297 | */ | ||
298 | address = S390_lowcore.trans_exc_code & __FAIL_ADDR_MASK; | ||
299 | space = check_space(tsk); | 330 | space = check_space(tsk); |
300 | 331 | ||
301 | /* | 332 | /* |
@@ -313,7 +344,7 @@ do_exception(struct pt_regs *regs, unsigned long error_code, int is_protection) | |||
313 | */ | 344 | */ |
314 | local_irq_enable(); | 345 | local_irq_enable(); |
315 | 346 | ||
316 | down_read(&mm->mmap_sem); | 347 | down_read(&mm->mmap_sem); |
317 | 348 | ||
318 | si_code = SEGV_MAPERR; | 349 | si_code = SEGV_MAPERR; |
319 | vma = find_vma(mm, address); | 350 | vma = find_vma(mm, address); |
@@ -330,19 +361,19 @@ do_exception(struct pt_regs *regs, unsigned long error_code, int is_protection) | |||
330 | return; | 361 | return; |
331 | #endif | 362 | #endif |
332 | 363 | ||
333 | if (vma->vm_start <= address) | 364 | if (vma->vm_start <= address) |
334 | goto good_area; | 365 | goto good_area; |
335 | if (!(vma->vm_flags & VM_GROWSDOWN)) | 366 | if (!(vma->vm_flags & VM_GROWSDOWN)) |
336 | goto bad_area; | 367 | goto bad_area; |
337 | if (expand_stack(vma, address)) | 368 | if (expand_stack(vma, address)) |
338 | goto bad_area; | 369 | goto bad_area; |
339 | /* | 370 | /* |
340 | * Ok, we have a good vm_area for this memory access, so | 371 | * Ok, we have a good vm_area for this memory access, so |
341 | * we can handle it.. | 372 | * we can handle it.. |
342 | */ | 373 | */ |
343 | good_area: | 374 | good_area: |
344 | si_code = SEGV_ACCERR; | 375 | si_code = SEGV_ACCERR; |
345 | if (!is_protection) { | 376 | if (!write) { |
346 | /* page not present, check vm flags */ | 377 | /* page not present, check vm flags */ |
347 | if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))) | 378 | if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))) |
348 | goto bad_area; | 379 | goto bad_area; |
@@ -357,7 +388,7 @@ survive: | |||
357 | * make sure we exit gracefully rather than endlessly redo | 388 | * make sure we exit gracefully rather than endlessly redo |
358 | * the fault. | 389 | * the fault. |
359 | */ | 390 | */ |
360 | switch (handle_mm_fault(mm, vma, address, is_protection)) { | 391 | switch (handle_mm_fault(mm, vma, address, write)) { |
361 | case VM_FAULT_MINOR: | 392 | case VM_FAULT_MINOR: |
362 | tsk->min_flt++; | 393 | tsk->min_flt++; |
363 | break; | 394 | break; |
@@ -365,9 +396,12 @@ survive: | |||
365 | tsk->maj_flt++; | 396 | tsk->maj_flt++; |
366 | break; | 397 | break; |
367 | case VM_FAULT_SIGBUS: | 398 | case VM_FAULT_SIGBUS: |
368 | goto do_sigbus; | 399 | do_sigbus(regs, error_code, address); |
400 | return; | ||
369 | case VM_FAULT_OOM: | 401 | case VM_FAULT_OOM: |
370 | goto out_of_memory; | 402 | if (do_out_of_memory(regs, error_code, address)) |
403 | goto survive; | ||
404 | return; | ||
371 | default: | 405 | default: |
372 | BUG(); | 406 | BUG(); |
373 | } | 407 | } |
@@ -385,75 +419,34 @@ survive: | |||
385 | * Fix it, but check if it's kernel or user first.. | 419 | * Fix it, but check if it's kernel or user first.. |
386 | */ | 420 | */ |
387 | bad_area: | 421 | bad_area: |
388 | up_read(&mm->mmap_sem); | 422 | up_read(&mm->mmap_sem); |
389 | 423 | ||
390 | /* User mode accesses just cause a SIGSEGV */ | 424 | /* User mode accesses just cause a SIGSEGV */ |
391 | if (regs->psw.mask & PSW_MASK_PSTATE) { | 425 | if (regs->psw.mask & PSW_MASK_PSTATE) { |
392 | tsk->thread.prot_addr = address; | 426 | tsk->thread.prot_addr = address; |
393 | tsk->thread.trap_no = error_code; | 427 | tsk->thread.trap_no = error_code; |
394 | do_sigsegv(regs, error_code, si_code, address); | 428 | do_sigsegv(regs, error_code, si_code, address); |
395 | return; | 429 | return; |
396 | } | 430 | } |
397 | 431 | ||
398 | no_context: | 432 | no_context: |
399 | /* Are we prepared to handle this kernel fault? */ | 433 | do_no_context(regs, error_code, address); |
400 | fixup = search_exception_tables(regs->psw.addr & __FIXUP_MASK); | ||
401 | if (fixup) { | ||
402 | regs->psw.addr = fixup->fixup | PSW_ADDR_AMODE; | ||
403 | return; | ||
404 | } | ||
405 | |||
406 | /* | ||
407 | * Oops. The kernel tried to access some bad page. We'll have to | ||
408 | * terminate things with extreme prejudice. | ||
409 | */ | ||
410 | if (space == 0) | ||
411 | printk(KERN_ALERT "Unable to handle kernel pointer dereference" | ||
412 | " at virtual kernel address %p\n", (void *)address); | ||
413 | else | ||
414 | printk(KERN_ALERT "Unable to handle kernel paging request" | ||
415 | " at virtual user address %p\n", (void *)address); | ||
416 | |||
417 | die("Oops", regs, error_code); | ||
418 | do_exit(SIGKILL); | ||
419 | |||
420 | |||
421 | /* | ||
422 | * We ran out of memory, or some other thing happened to us that made | ||
423 | * us unable to handle the page fault gracefully. | ||
424 | */ | ||
425 | out_of_memory: | ||
426 | up_read(&mm->mmap_sem); | ||
427 | if (is_init(tsk)) { | ||
428 | yield(); | ||
429 | down_read(&mm->mmap_sem); | ||
430 | goto survive; | ||
431 | } | ||
432 | printk("VM: killing process %s\n", tsk->comm); | ||
433 | if (regs->psw.mask & PSW_MASK_PSTATE) | ||
434 | do_exit(SIGKILL); | ||
435 | goto no_context; | ||
436 | |||
437 | do_sigbus: | ||
438 | up_read(&mm->mmap_sem); | ||
439 | |||
440 | /* | ||
441 | * Send a sigbus, regardless of whether we were in kernel | ||
442 | * or user mode. | ||
443 | */ | ||
444 | tsk->thread.prot_addr = address; | ||
445 | tsk->thread.trap_no = error_code; | ||
446 | force_sig(SIGBUS, tsk); | ||
447 | |||
448 | /* Kernel mode? Handle exceptions or die */ | ||
449 | if (!(regs->psw.mask & PSW_MASK_PSTATE)) | ||
450 | goto no_context; | ||
451 | } | 434 | } |
452 | 435 | ||
453 | void __kprobes do_protection_exception(struct pt_regs *regs, | 436 | void __kprobes do_protection_exception(struct pt_regs *regs, |
454 | unsigned long error_code) | 437 | unsigned long error_code) |
455 | { | 438 | { |
439 | /* Protection exception is supressing, decrement psw address. */ | ||
456 | regs->psw.addr -= (error_code >> 16); | 440 | regs->psw.addr -= (error_code >> 16); |
441 | /* | ||
442 | * Check for low-address protection. This needs to be treated | ||
443 | * as a special case because the translation exception code | ||
444 | * field is not guaranteed to contain valid data in this case. | ||
445 | */ | ||
446 | if (unlikely(!(S390_lowcore.trans_exc_code & 4))) { | ||
447 | do_low_address(regs, error_code); | ||
448 | return; | ||
449 | } | ||
457 | do_exception(regs, 4, 1); | 450 | do_exception(regs, 4, 1); |
458 | } | 451 | } |
459 | 452 | ||