diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/ia64/include/asm/futex.h | 9 | ||||
-rw-r--r-- | arch/m68k/configs/m5275evb_defconfig | 1 | ||||
-rw-r--r-- | arch/m68k/platform/527x/config.c | 2 | ||||
-rw-r--r-- | arch/m68k/platform/68EZ328/Makefile | 6 | ||||
-rw-r--r-- | arch/m68k/platform/68VZ328/Makefile | 9 | ||||
-rw-r--r-- | arch/m68k/platform/68VZ328/bootlogo.h (renamed from arch/m68k/platform/68EZ328/bootlogo.h) | 2 | ||||
-rw-r--r-- | arch/m68k/platform/coldfire/device.c | 2 | ||||
-rw-r--r-- | arch/s390/Kconfig | 1 | ||||
-rw-r--r-- | arch/s390/defconfig | 37 | ||||
-rw-r--r-- | arch/s390/include/asm/facility.h | 3 | ||||
-rw-r--r-- | arch/s390/include/asm/pgalloc.h | 3 | ||||
-rw-r--r-- | arch/s390/include/asm/swab.h | 2 | ||||
-rw-r--r-- | arch/s390/include/asm/tlb.h | 22 | ||||
-rw-r--r-- | arch/s390/kernel/head.S | 2 | ||||
-rw-r--r-- | arch/s390/kernel/irq.c | 9 | ||||
-rw-r--r-- | arch/s390/kernel/perf_cpum_cf.c | 4 | ||||
-rw-r--r-- | arch/s390/mm/maccess.c | 27 | ||||
-rw-r--r-- | arch/s390/mm/pgtable.c | 63 | ||||
-rw-r--r-- | arch/x86/kvm/pmu.c | 18 | ||||
-rw-r--r-- | arch/x86/kvm/vmx.c | 5 | ||||
-rw-r--r-- | arch/x86/lib/insn.c | 53 |
21 files changed, 166 insertions, 114 deletions
diff --git a/arch/ia64/include/asm/futex.h b/arch/ia64/include/asm/futex.h index 0ab82cc2dc8f..d2bf1fd5e44f 100644 --- a/arch/ia64/include/asm/futex.h +++ b/arch/ia64/include/asm/futex.h | |||
@@ -106,15 +106,16 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
106 | return -EFAULT; | 106 | return -EFAULT; |
107 | 107 | ||
108 | { | 108 | { |
109 | register unsigned long r8 __asm ("r8") = 0; | 109 | register unsigned long r8 __asm ("r8"); |
110 | unsigned long prev; | 110 | unsigned long prev; |
111 | __asm__ __volatile__( | 111 | __asm__ __volatile__( |
112 | " mf;; \n" | 112 | " mf;; \n" |
113 | " mov ar.ccv=%3;; \n" | 113 | " mov %0=r0 \n" |
114 | "[1:] cmpxchg4.acq %0=[%1],%2,ar.ccv \n" | 114 | " mov ar.ccv=%4;; \n" |
115 | "[1:] cmpxchg4.acq %1=[%2],%3,ar.ccv \n" | ||
115 | " .xdata4 \"__ex_table\", 1b-., 2f-. \n" | 116 | " .xdata4 \"__ex_table\", 1b-., 2f-. \n" |
116 | "[2:]" | 117 | "[2:]" |
117 | : "=r" (prev) | 118 | : "=r" (r8), "=r" (prev) |
118 | : "r" (uaddr), "r" (newval), | 119 | : "r" (uaddr), "r" (newval), |
119 | "rO" ((long) (unsigned) oldval) | 120 | "rO" ((long) (unsigned) oldval) |
120 | : "memory"); | 121 | : "memory"); |
diff --git a/arch/m68k/configs/m5275evb_defconfig b/arch/m68k/configs/m5275evb_defconfig index 33c32aeca12b..a1230e82bb1e 100644 --- a/arch/m68k/configs/m5275evb_defconfig +++ b/arch/m68k/configs/m5275evb_defconfig | |||
@@ -49,7 +49,6 @@ CONFIG_BLK_DEV_RAM=y | |||
49 | CONFIG_NETDEVICES=y | 49 | CONFIG_NETDEVICES=y |
50 | CONFIG_NET_ETHERNET=y | 50 | CONFIG_NET_ETHERNET=y |
51 | CONFIG_FEC=y | 51 | CONFIG_FEC=y |
52 | CONFIG_FEC2=y | ||
53 | # CONFIG_NETDEV_1000 is not set | 52 | # CONFIG_NETDEV_1000 is not set |
54 | # CONFIG_NETDEV_10000 is not set | 53 | # CONFIG_NETDEV_10000 is not set |
55 | CONFIG_PPP=y | 54 | CONFIG_PPP=y |
diff --git a/arch/m68k/platform/527x/config.c b/arch/m68k/platform/527x/config.c index 7ed848c3b848..f91a53294c35 100644 --- a/arch/m68k/platform/527x/config.c +++ b/arch/m68k/platform/527x/config.c | |||
@@ -74,9 +74,7 @@ static void __init m527x_fec_init(void) | |||
74 | writew(par | 0xf00, MCF_IPSBAR + 0x100082); | 74 | writew(par | 0xf00, MCF_IPSBAR + 0x100082); |
75 | v = readb(MCF_IPSBAR + 0x100078); | 75 | v = readb(MCF_IPSBAR + 0x100078); |
76 | writeb(v | 0xc0, MCF_IPSBAR + 0x100078); | 76 | writeb(v | 0xc0, MCF_IPSBAR + 0x100078); |
77 | #endif | ||
78 | 77 | ||
79 | #ifdef CONFIG_FEC2 | ||
80 | /* Set multi-function pins to ethernet mode for fec1 */ | 78 | /* Set multi-function pins to ethernet mode for fec1 */ |
81 | par = readw(MCF_IPSBAR + 0x100082); | 79 | par = readw(MCF_IPSBAR + 0x100082); |
82 | writew(par | 0xa0, MCF_IPSBAR + 0x100082); | 80 | writew(par | 0xa0, MCF_IPSBAR + 0x100082); |
diff --git a/arch/m68k/platform/68EZ328/Makefile b/arch/m68k/platform/68EZ328/Makefile index ee97735a242c..b44d799b1115 100644 --- a/arch/m68k/platform/68EZ328/Makefile +++ b/arch/m68k/platform/68EZ328/Makefile | |||
@@ -3,9 +3,3 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := config.o | 5 | obj-y := config.o |
6 | |||
7 | extra-y := bootlogo.rh | ||
8 | |||
9 | $(obj)/bootlogo.rh: $(src)/bootlogo.h | ||
10 | perl $(src)/../68328/bootlogo.pl < $(src)/bootlogo.h \ | ||
11 | > $(obj)/bootlogo.rh | ||
diff --git a/arch/m68k/platform/68VZ328/Makefile b/arch/m68k/platform/68VZ328/Makefile index 447ffa0fd7c7..a49d75e65489 100644 --- a/arch/m68k/platform/68VZ328/Makefile +++ b/arch/m68k/platform/68VZ328/Makefile | |||
@@ -3,14 +3,9 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := config.o | 5 | obj-y := config.o |
6 | logo-$(UCDIMM) := bootlogo.rh | 6 | extra-$(DRAGEN2):= screen.h |
7 | logo-$(DRAGEN2) := screen.h | ||
8 | extra-y := $(logo-y) | ||
9 | |||
10 | $(obj)/bootlogo.rh: $(src)/../68EZ328/bootlogo.h | ||
11 | perl $(src)/bootlogo.pl < $(src)/../68328/bootlogo.h > $(obj)/bootlogo.rh | ||
12 | 7 | ||
13 | $(obj)/screen.h: $(src)/screen.xbm $(src)/xbm2lcd.pl | 8 | $(obj)/screen.h: $(src)/screen.xbm $(src)/xbm2lcd.pl |
14 | perl $(src)/xbm2lcd.pl < $(src)/screen.xbm > $(obj)/screen.h | 9 | perl $(src)/xbm2lcd.pl < $(src)/screen.xbm > $(obj)/screen.h |
15 | 10 | ||
16 | clean-files := $(obj)/screen.h $(obj)/bootlogo.rh | 11 | clean-files := $(obj)/screen.h |
diff --git a/arch/m68k/platform/68EZ328/bootlogo.h b/arch/m68k/platform/68VZ328/bootlogo.h index e842bdae5839..b38e2b255142 100644 --- a/arch/m68k/platform/68EZ328/bootlogo.h +++ b/arch/m68k/platform/68VZ328/bootlogo.h | |||
@@ -1,6 +1,6 @@ | |||
1 | #define splash_width 640 | 1 | #define splash_width 640 |
2 | #define splash_height 480 | 2 | #define splash_height 480 |
3 | static unsigned char splash_bits[] = { | 3 | unsigned char __attribute__ ((aligned(16))) bootlogo_bits[] = { |
4 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 4 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
5 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 5 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
6 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 6 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
diff --git a/arch/m68k/platform/coldfire/device.c b/arch/m68k/platform/coldfire/device.c index fa50c48292ff..7af97362b95c 100644 --- a/arch/m68k/platform/coldfire/device.c +++ b/arch/m68k/platform/coldfire/device.c | |||
@@ -114,7 +114,7 @@ static struct resource mcf_fec1_resources[] = { | |||
114 | 114 | ||
115 | static struct platform_device mcf_fec1 = { | 115 | static struct platform_device mcf_fec1 = { |
116 | .name = "fec", | 116 | .name = "fec", |
117 | .id = 0, | 117 | .id = 1, |
118 | .num_resources = ARRAY_SIZE(mcf_fec1_resources), | 118 | .num_resources = ARRAY_SIZE(mcf_fec1_resources), |
119 | .resource = mcf_fec1_resources, | 119 | .resource = mcf_fec1_resources, |
120 | }; | 120 | }; |
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 2b7c0fbe578e..9015060919a0 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -90,7 +90,6 @@ config S390 | |||
90 | select HAVE_KERNEL_XZ | 90 | select HAVE_KERNEL_XZ |
91 | select HAVE_ARCH_MUTEX_CPU_RELAX | 91 | select HAVE_ARCH_MUTEX_CPU_RELAX |
92 | select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 | 92 | select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 |
93 | select HAVE_RCU_TABLE_FREE if SMP | ||
94 | select ARCH_SAVE_PAGE_KEYS if HIBERNATION | 93 | select ARCH_SAVE_PAGE_KEYS if HIBERNATION |
95 | select HAVE_MEMBLOCK | 94 | select HAVE_MEMBLOCK |
96 | select HAVE_MEMBLOCK_NODE_MAP | 95 | select HAVE_MEMBLOCK_NODE_MAP |
diff --git a/arch/s390/defconfig b/arch/s390/defconfig index 6cf8e26b3137..1957a9dd256d 100644 --- a/arch/s390/defconfig +++ b/arch/s390/defconfig | |||
@@ -1,8 +1,12 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | 1 | CONFIG_EXPERIMENTAL=y |
2 | CONFIG_SYSVIPC=y | 2 | CONFIG_SYSVIPC=y |
3 | CONFIG_POSIX_MQUEUE=y | 3 | CONFIG_POSIX_MQUEUE=y |
4 | CONFIG_FHANDLE=y | ||
5 | CONFIG_TASKSTATS=y | ||
6 | CONFIG_TASK_DELAY_ACCT=y | ||
7 | CONFIG_TASK_XACCT=y | ||
8 | CONFIG_TASK_IO_ACCOUNTING=y | ||
4 | CONFIG_AUDIT=y | 9 | CONFIG_AUDIT=y |
5 | CONFIG_RCU_TRACE=y | ||
6 | CONFIG_IKCONFIG=y | 10 | CONFIG_IKCONFIG=y |
7 | CONFIG_IKCONFIG_PROC=y | 11 | CONFIG_IKCONFIG_PROC=y |
8 | CONFIG_CGROUPS=y | 12 | CONFIG_CGROUPS=y |
@@ -14,16 +18,22 @@ CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y | |||
14 | CONFIG_CGROUP_SCHED=y | 18 | CONFIG_CGROUP_SCHED=y |
15 | CONFIG_RT_GROUP_SCHED=y | 19 | CONFIG_RT_GROUP_SCHED=y |
16 | CONFIG_BLK_CGROUP=y | 20 | CONFIG_BLK_CGROUP=y |
21 | CONFIG_NAMESPACES=y | ||
17 | CONFIG_BLK_DEV_INITRD=y | 22 | CONFIG_BLK_DEV_INITRD=y |
18 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | 23 | CONFIG_RD_BZIP2=y |
24 | CONFIG_RD_LZMA=y | ||
25 | CONFIG_RD_XZ=y | ||
26 | CONFIG_RD_LZO=y | ||
27 | CONFIG_EXPERT=y | ||
19 | # CONFIG_COMPAT_BRK is not set | 28 | # CONFIG_COMPAT_BRK is not set |
20 | CONFIG_SLAB=y | ||
21 | CONFIG_PROFILING=y | 29 | CONFIG_PROFILING=y |
22 | CONFIG_OPROFILE=y | 30 | CONFIG_OPROFILE=y |
23 | CONFIG_KPROBES=y | 31 | CONFIG_KPROBES=y |
24 | CONFIG_MODULES=y | 32 | CONFIG_MODULES=y |
25 | CONFIG_MODULE_UNLOAD=y | 33 | CONFIG_MODULE_UNLOAD=y |
26 | CONFIG_MODVERSIONS=y | 34 | CONFIG_MODVERSIONS=y |
35 | CONFIG_PARTITION_ADVANCED=y | ||
36 | CONFIG_IBM_PARTITION=y | ||
27 | CONFIG_DEFAULT_DEADLINE=y | 37 | CONFIG_DEFAULT_DEADLINE=y |
28 | CONFIG_NO_HZ=y | 38 | CONFIG_NO_HZ=y |
29 | CONFIG_HIGH_RES_TIMERS=y | 39 | CONFIG_HIGH_RES_TIMERS=y |
@@ -34,18 +44,15 @@ CONFIG_KSM=y | |||
34 | CONFIG_BINFMT_MISC=m | 44 | CONFIG_BINFMT_MISC=m |
35 | CONFIG_CMM=m | 45 | CONFIG_CMM=m |
36 | CONFIG_HZ_100=y | 46 | CONFIG_HZ_100=y |
37 | CONFIG_KEXEC=y | 47 | CONFIG_CRASH_DUMP=y |
38 | CONFIG_PM=y | ||
39 | CONFIG_HIBERNATION=y | 48 | CONFIG_HIBERNATION=y |
40 | CONFIG_PACKET=y | 49 | CONFIG_PACKET=y |
41 | CONFIG_UNIX=y | 50 | CONFIG_UNIX=y |
42 | CONFIG_NET_KEY=y | 51 | CONFIG_NET_KEY=y |
43 | CONFIG_AFIUCV=m | ||
44 | CONFIG_INET=y | 52 | CONFIG_INET=y |
45 | CONFIG_IP_MULTICAST=y | 53 | CONFIG_IP_MULTICAST=y |
46 | # CONFIG_INET_LRO is not set | 54 | # CONFIG_INET_LRO is not set |
47 | CONFIG_IPV6=y | 55 | CONFIG_IPV6=y |
48 | CONFIG_NET_SCTPPROBE=m | ||
49 | CONFIG_L2TP=m | 56 | CONFIG_L2TP=m |
50 | CONFIG_L2TP_DEBUGFS=m | 57 | CONFIG_L2TP_DEBUGFS=m |
51 | CONFIG_VLAN_8021Q=y | 58 | CONFIG_VLAN_8021Q=y |
@@ -84,15 +91,14 @@ CONFIG_SCSI_CONSTANTS=y | |||
84 | CONFIG_SCSI_LOGGING=y | 91 | CONFIG_SCSI_LOGGING=y |
85 | CONFIG_SCSI_SCAN_ASYNC=y | 92 | CONFIG_SCSI_SCAN_ASYNC=y |
86 | CONFIG_ZFCP=y | 93 | CONFIG_ZFCP=y |
87 | CONFIG_ZFCP_DIF=y | ||
88 | CONFIG_NETDEVICES=y | 94 | CONFIG_NETDEVICES=y |
89 | CONFIG_DUMMY=m | ||
90 | CONFIG_BONDING=m | 95 | CONFIG_BONDING=m |
96 | CONFIG_DUMMY=m | ||
91 | CONFIG_EQUALIZER=m | 97 | CONFIG_EQUALIZER=m |
92 | CONFIG_TUN=m | 98 | CONFIG_TUN=m |
93 | CONFIG_NET_ETHERNET=y | ||
94 | CONFIG_VIRTIO_NET=y | 99 | CONFIG_VIRTIO_NET=y |
95 | CONFIG_RAW_DRIVER=m | 100 | CONFIG_RAW_DRIVER=m |
101 | CONFIG_VIRTIO_BALLOON=y | ||
96 | CONFIG_EXT2_FS=y | 102 | CONFIG_EXT2_FS=y |
97 | CONFIG_EXT3_FS=y | 103 | CONFIG_EXT3_FS=y |
98 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | 104 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set |
@@ -103,27 +109,21 @@ CONFIG_PROC_KCORE=y | |||
103 | CONFIG_TMPFS=y | 109 | CONFIG_TMPFS=y |
104 | CONFIG_TMPFS_POSIX_ACL=y | 110 | CONFIG_TMPFS_POSIX_ACL=y |
105 | # CONFIG_NETWORK_FILESYSTEMS is not set | 111 | # CONFIG_NETWORK_FILESYSTEMS is not set |
106 | CONFIG_PARTITION_ADVANCED=y | ||
107 | CONFIG_IBM_PARTITION=y | ||
108 | CONFIG_DLM=m | ||
109 | CONFIG_MAGIC_SYSRQ=y | 112 | CONFIG_MAGIC_SYSRQ=y |
110 | CONFIG_DEBUG_KERNEL=y | ||
111 | CONFIG_TIMER_STATS=y | 113 | CONFIG_TIMER_STATS=y |
112 | CONFIG_PROVE_LOCKING=y | 114 | CONFIG_PROVE_LOCKING=y |
113 | CONFIG_PROVE_RCU=y | 115 | CONFIG_PROVE_RCU=y |
114 | CONFIG_LOCK_STAT=y | 116 | CONFIG_LOCK_STAT=y |
115 | CONFIG_DEBUG_LOCKDEP=y | 117 | CONFIG_DEBUG_LOCKDEP=y |
116 | CONFIG_DEBUG_SPINLOCK_SLEEP=y | ||
117 | CONFIG_DEBUG_LIST=y | 118 | CONFIG_DEBUG_LIST=y |
118 | CONFIG_DEBUG_NOTIFIERS=y | 119 | CONFIG_DEBUG_NOTIFIERS=y |
119 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | 120 | CONFIG_RCU_TRACE=y |
120 | CONFIG_KPROBES_SANITY_TEST=y | 121 | CONFIG_KPROBES_SANITY_TEST=y |
121 | CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y | 122 | CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y |
122 | CONFIG_CPU_NOTIFIER_ERROR_INJECT=m | 123 | CONFIG_CPU_NOTIFIER_ERROR_INJECT=m |
123 | CONFIG_LATENCYTOP=y | 124 | CONFIG_LATENCYTOP=y |
124 | CONFIG_SYSCTL_SYSCALL_CHECK=y | ||
125 | CONFIG_DEBUG_PAGEALLOC=y | 125 | CONFIG_DEBUG_PAGEALLOC=y |
126 | # CONFIG_FTRACE is not set | 126 | CONFIG_BLK_DEV_IO_TRACE=y |
127 | # CONFIG_STRICT_DEVMEM is not set | 127 | # CONFIG_STRICT_DEVMEM is not set |
128 | CONFIG_CRYPTO_NULL=m | 128 | CONFIG_CRYPTO_NULL=m |
129 | CONFIG_CRYPTO_CRYPTD=m | 129 | CONFIG_CRYPTO_CRYPTD=m |
@@ -173,4 +173,3 @@ CONFIG_CRYPTO_SHA512_S390=m | |||
173 | CONFIG_CRYPTO_DES_S390=m | 173 | CONFIG_CRYPTO_DES_S390=m |
174 | CONFIG_CRYPTO_AES_S390=m | 174 | CONFIG_CRYPTO_AES_S390=m |
175 | CONFIG_CRC7=m | 175 | CONFIG_CRC7=m |
176 | CONFIG_VIRTIO_BALLOON=y | ||
diff --git a/arch/s390/include/asm/facility.h b/arch/s390/include/asm/facility.h index 1e5b27edc0c9..2ee66a65f2d4 100644 --- a/arch/s390/include/asm/facility.h +++ b/arch/s390/include/asm/facility.h | |||
@@ -38,12 +38,11 @@ static inline void stfle(u64 *stfle_fac_list, int size) | |||
38 | unsigned long nr; | 38 | unsigned long nr; |
39 | 39 | ||
40 | preempt_disable(); | 40 | preempt_disable(); |
41 | S390_lowcore.stfl_fac_list = 0; | ||
42 | asm volatile( | 41 | asm volatile( |
43 | " .insn s,0xb2b10000,0(0)\n" /* stfl */ | 42 | " .insn s,0xb2b10000,0(0)\n" /* stfl */ |
44 | "0:\n" | 43 | "0:\n" |
45 | EX_TABLE(0b, 0b) | 44 | EX_TABLE(0b, 0b) |
46 | : "=m" (S390_lowcore.stfl_fac_list)); | 45 | : "+m" (S390_lowcore.stfl_fac_list)); |
47 | nr = 4; /* bytes stored by stfl */ | 46 | nr = 4; /* bytes stored by stfl */ |
48 | memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4); | 47 | memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4); |
49 | if (S390_lowcore.stfl_fac_list & 0x01000000) { | 48 | if (S390_lowcore.stfl_fac_list & 0x01000000) { |
diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h index 8eef9b5b3cf4..78e3041919de 100644 --- a/arch/s390/include/asm/pgalloc.h +++ b/arch/s390/include/asm/pgalloc.h | |||
@@ -22,10 +22,7 @@ void crst_table_free(struct mm_struct *, unsigned long *); | |||
22 | 22 | ||
23 | unsigned long *page_table_alloc(struct mm_struct *, unsigned long); | 23 | unsigned long *page_table_alloc(struct mm_struct *, unsigned long); |
24 | void page_table_free(struct mm_struct *, unsigned long *); | 24 | void page_table_free(struct mm_struct *, unsigned long *); |
25 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
26 | void page_table_free_rcu(struct mmu_gather *, unsigned long *); | 25 | void page_table_free_rcu(struct mmu_gather *, unsigned long *); |
27 | void __tlb_remove_table(void *_table); | ||
28 | #endif | ||
29 | 26 | ||
30 | static inline void clear_table(unsigned long *s, unsigned long val, size_t n) | 27 | static inline void clear_table(unsigned long *s, unsigned long val, size_t n) |
31 | { | 28 | { |
diff --git a/arch/s390/include/asm/swab.h b/arch/s390/include/asm/swab.h index 6bdee21c077e..a3e4ebb32090 100644 --- a/arch/s390/include/asm/swab.h +++ b/arch/s390/include/asm/swab.h | |||
@@ -77,7 +77,7 @@ static inline __u16 __arch_swab16p(const __u16 *x) | |||
77 | 77 | ||
78 | asm volatile( | 78 | asm volatile( |
79 | #ifndef __s390x__ | 79 | #ifndef __s390x__ |
80 | " icm %0,2,%O+1(%R1)\n" | 80 | " icm %0,2,%O1+1(%R1)\n" |
81 | " ic %0,%1\n" | 81 | " ic %0,%1\n" |
82 | : "=&d" (result) : "Q" (*x) : "cc"); | 82 | : "=&d" (result) : "Q" (*x) : "cc"); |
83 | #else /* __s390x__ */ | 83 | #else /* __s390x__ */ |
diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h index c687a2c83462..775a5eea8f9e 100644 --- a/arch/s390/include/asm/tlb.h +++ b/arch/s390/include/asm/tlb.h | |||
@@ -30,14 +30,10 @@ | |||
30 | 30 | ||
31 | struct mmu_gather { | 31 | struct mmu_gather { |
32 | struct mm_struct *mm; | 32 | struct mm_struct *mm; |
33 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
34 | struct mmu_table_batch *batch; | 33 | struct mmu_table_batch *batch; |
35 | #endif | ||
36 | unsigned int fullmm; | 34 | unsigned int fullmm; |
37 | unsigned int need_flush; | ||
38 | }; | 35 | }; |
39 | 36 | ||
40 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
41 | struct mmu_table_batch { | 37 | struct mmu_table_batch { |
42 | struct rcu_head rcu; | 38 | struct rcu_head rcu; |
43 | unsigned int nr; | 39 | unsigned int nr; |
@@ -49,7 +45,6 @@ struct mmu_table_batch { | |||
49 | 45 | ||
50 | extern void tlb_table_flush(struct mmu_gather *tlb); | 46 | extern void tlb_table_flush(struct mmu_gather *tlb); |
51 | extern void tlb_remove_table(struct mmu_gather *tlb, void *table); | 47 | extern void tlb_remove_table(struct mmu_gather *tlb, void *table); |
52 | #endif | ||
53 | 48 | ||
54 | static inline void tlb_gather_mmu(struct mmu_gather *tlb, | 49 | static inline void tlb_gather_mmu(struct mmu_gather *tlb, |
55 | struct mm_struct *mm, | 50 | struct mm_struct *mm, |
@@ -57,29 +52,20 @@ static inline void tlb_gather_mmu(struct mmu_gather *tlb, | |||
57 | { | 52 | { |
58 | tlb->mm = mm; | 53 | tlb->mm = mm; |
59 | tlb->fullmm = full_mm_flush; | 54 | tlb->fullmm = full_mm_flush; |
60 | tlb->need_flush = 0; | ||
61 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
62 | tlb->batch = NULL; | 55 | tlb->batch = NULL; |
63 | #endif | ||
64 | if (tlb->fullmm) | 56 | if (tlb->fullmm) |
65 | __tlb_flush_mm(mm); | 57 | __tlb_flush_mm(mm); |
66 | } | 58 | } |
67 | 59 | ||
68 | static inline void tlb_flush_mmu(struct mmu_gather *tlb) | 60 | static inline void tlb_flush_mmu(struct mmu_gather *tlb) |
69 | { | 61 | { |
70 | if (!tlb->need_flush) | ||
71 | return; | ||
72 | tlb->need_flush = 0; | ||
73 | __tlb_flush_mm(tlb->mm); | ||
74 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
75 | tlb_table_flush(tlb); | 62 | tlb_table_flush(tlb); |
76 | #endif | ||
77 | } | 63 | } |
78 | 64 | ||
79 | static inline void tlb_finish_mmu(struct mmu_gather *tlb, | 65 | static inline void tlb_finish_mmu(struct mmu_gather *tlb, |
80 | unsigned long start, unsigned long end) | 66 | unsigned long start, unsigned long end) |
81 | { | 67 | { |
82 | tlb_flush_mmu(tlb); | 68 | tlb_table_flush(tlb); |
83 | } | 69 | } |
84 | 70 | ||
85 | /* | 71 | /* |
@@ -105,10 +91,8 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page) | |||
105 | static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, | 91 | static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, |
106 | unsigned long address) | 92 | unsigned long address) |
107 | { | 93 | { |
108 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
109 | if (!tlb->fullmm) | 94 | if (!tlb->fullmm) |
110 | return page_table_free_rcu(tlb, (unsigned long *) pte); | 95 | return page_table_free_rcu(tlb, (unsigned long *) pte); |
111 | #endif | ||
112 | page_table_free(tlb->mm, (unsigned long *) pte); | 96 | page_table_free(tlb->mm, (unsigned long *) pte); |
113 | } | 97 | } |
114 | 98 | ||
@@ -125,10 +109,8 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, | |||
125 | #ifdef __s390x__ | 109 | #ifdef __s390x__ |
126 | if (tlb->mm->context.asce_limit <= (1UL << 31)) | 110 | if (tlb->mm->context.asce_limit <= (1UL << 31)) |
127 | return; | 111 | return; |
128 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
129 | if (!tlb->fullmm) | 112 | if (!tlb->fullmm) |
130 | return tlb_remove_table(tlb, pmd); | 113 | return tlb_remove_table(tlb, pmd); |
131 | #endif | ||
132 | crst_table_free(tlb->mm, (unsigned long *) pmd); | 114 | crst_table_free(tlb->mm, (unsigned long *) pmd); |
133 | #endif | 115 | #endif |
134 | } | 116 | } |
@@ -146,10 +128,8 @@ static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud, | |||
146 | #ifdef __s390x__ | 128 | #ifdef __s390x__ |
147 | if (tlb->mm->context.asce_limit <= (1UL << 42)) | 129 | if (tlb->mm->context.asce_limit <= (1UL << 42)) |
148 | return; | 130 | return; |
149 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
150 | if (!tlb->fullmm) | 131 | if (!tlb->fullmm) |
151 | return tlb_remove_table(tlb, pud); | 132 | return tlb_remove_table(tlb, pud); |
152 | #endif | ||
153 | crst_table_free(tlb->mm, (unsigned long *) pud); | 133 | crst_table_free(tlb->mm, (unsigned long *) pud); |
154 | #endif | 134 | #endif |
155 | } | 135 | } |
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S index c27a0727f930..adccd908ebc7 100644 --- a/arch/s390/kernel/head.S +++ b/arch/s390/kernel/head.S | |||
@@ -474,9 +474,9 @@ ENTRY(startup_kdump) | |||
474 | stck __LC_LAST_UPDATE_CLOCK | 474 | stck __LC_LAST_UPDATE_CLOCK |
475 | spt 5f-.LPG0(%r13) | 475 | spt 5f-.LPG0(%r13) |
476 | mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13) | 476 | mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13) |
477 | xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST | ||
477 | #ifndef CONFIG_MARCH_G5 | 478 | #ifndef CONFIG_MARCH_G5 |
478 | # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10} | 479 | # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10} |
479 | xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST | ||
480 | .insn s,0xb2b10000,__LC_STFL_FAC_LIST # store facility list | 480 | .insn s,0xb2b10000,__LC_STFL_FAC_LIST # store facility list |
481 | tm __LC_STFL_FAC_LIST,0x01 # stfle available ? | 481 | tm __LC_STFL_FAC_LIST,0x01 # stfle available ? |
482 | jz 0f | 482 | jz 0f |
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c index 1c2cdd59ccd0..8a22c27219dd 100644 --- a/arch/s390/kernel/irq.c +++ b/arch/s390/kernel/irq.c | |||
@@ -118,9 +118,10 @@ asmlinkage void do_softirq(void) | |||
118 | "a" (__do_softirq) | 118 | "a" (__do_softirq) |
119 | : "0", "1", "2", "3", "4", "5", "14", | 119 | : "0", "1", "2", "3", "4", "5", "14", |
120 | "cc", "memory" ); | 120 | "cc", "memory" ); |
121 | } else | 121 | } else { |
122 | /* We are already on the async stack. */ | 122 | /* We are already on the async stack. */ |
123 | __do_softirq(); | 123 | __do_softirq(); |
124 | } | ||
124 | } | 125 | } |
125 | 126 | ||
126 | local_irq_restore(flags); | 127 | local_irq_restore(flags); |
@@ -192,11 +193,12 @@ int unregister_external_interrupt(u16 code, ext_int_handler_t handler) | |||
192 | int index = ext_hash(code); | 193 | int index = ext_hash(code); |
193 | 194 | ||
194 | spin_lock_irqsave(&ext_int_hash_lock, flags); | 195 | spin_lock_irqsave(&ext_int_hash_lock, flags); |
195 | list_for_each_entry_rcu(p, &ext_int_hash[index], entry) | 196 | list_for_each_entry_rcu(p, &ext_int_hash[index], entry) { |
196 | if (p->code == code && p->handler == handler) { | 197 | if (p->code == code && p->handler == handler) { |
197 | list_del_rcu(&p->entry); | 198 | list_del_rcu(&p->entry); |
198 | kfree_rcu(p, rcu); | 199 | kfree_rcu(p, rcu); |
199 | } | 200 | } |
201 | } | ||
200 | spin_unlock_irqrestore(&ext_int_hash_lock, flags); | 202 | spin_unlock_irqrestore(&ext_int_hash_lock, flags); |
201 | return 0; | 203 | return 0; |
202 | } | 204 | } |
@@ -211,9 +213,10 @@ void __irq_entry do_extint(struct pt_regs *regs, struct ext_code ext_code, | |||
211 | 213 | ||
212 | old_regs = set_irq_regs(regs); | 214 | old_regs = set_irq_regs(regs); |
213 | irq_enter(); | 215 | irq_enter(); |
214 | if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) | 216 | if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) { |
215 | /* Serve timer interrupts first. */ | 217 | /* Serve timer interrupts first. */ |
216 | clock_comparator_work(); | 218 | clock_comparator_work(); |
219 | } | ||
217 | kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; | 220 | kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; |
218 | if (ext_code.code != 0x1004) | 221 | if (ext_code.code != 0x1004) |
219 | __get_cpu_var(s390_idle).nohz_delay = 1; | 222 | __get_cpu_var(s390_idle).nohz_delay = 1; |
diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c index 46405086479c..cb019f429e88 100644 --- a/arch/s390/kernel/perf_cpum_cf.c +++ b/arch/s390/kernel/perf_cpum_cf.c | |||
@@ -178,7 +178,7 @@ static void cpumf_pmu_enable(struct pmu *pmu) | |||
178 | err = lcctl(cpuhw->state); | 178 | err = lcctl(cpuhw->state); |
179 | if (err) { | 179 | if (err) { |
180 | pr_err("Enabling the performance measuring unit " | 180 | pr_err("Enabling the performance measuring unit " |
181 | "failed with rc=%lx\n", err); | 181 | "failed with rc=%x\n", err); |
182 | return; | 182 | return; |
183 | } | 183 | } |
184 | 184 | ||
@@ -203,7 +203,7 @@ static void cpumf_pmu_disable(struct pmu *pmu) | |||
203 | err = lcctl(inactive); | 203 | err = lcctl(inactive); |
204 | if (err) { | 204 | if (err) { |
205 | pr_err("Disabling the performance measuring unit " | 205 | pr_err("Disabling the performance measuring unit " |
206 | "failed with rc=%lx\n", err); | 206 | "failed with rc=%x\n", err); |
207 | return; | 207 | return; |
208 | } | 208 | } |
209 | 209 | ||
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c index 7bb15fcca75e..e1335dc2b1b7 100644 --- a/arch/s390/mm/maccess.c +++ b/arch/s390/mm/maccess.c | |||
@@ -61,21 +61,14 @@ long probe_kernel_write(void *dst, const void *src, size_t size) | |||
61 | return copied < 0 ? -EFAULT : 0; | 61 | return copied < 0 ? -EFAULT : 0; |
62 | } | 62 | } |
63 | 63 | ||
64 | /* | 64 | static int __memcpy_real(void *dest, void *src, size_t count) |
65 | * Copy memory in real mode (kernel to kernel) | ||
66 | */ | ||
67 | int memcpy_real(void *dest, void *src, size_t count) | ||
68 | { | 65 | { |
69 | register unsigned long _dest asm("2") = (unsigned long) dest; | 66 | register unsigned long _dest asm("2") = (unsigned long) dest; |
70 | register unsigned long _len1 asm("3") = (unsigned long) count; | 67 | register unsigned long _len1 asm("3") = (unsigned long) count; |
71 | register unsigned long _src asm("4") = (unsigned long) src; | 68 | register unsigned long _src asm("4") = (unsigned long) src; |
72 | register unsigned long _len2 asm("5") = (unsigned long) count; | 69 | register unsigned long _len2 asm("5") = (unsigned long) count; |
73 | unsigned long flags; | ||
74 | int rc = -EFAULT; | 70 | int rc = -EFAULT; |
75 | 71 | ||
76 | if (!count) | ||
77 | return 0; | ||
78 | flags = __arch_local_irq_stnsm(0xf8UL); | ||
79 | asm volatile ( | 72 | asm volatile ( |
80 | "0: mvcle %1,%2,0x0\n" | 73 | "0: mvcle %1,%2,0x0\n" |
81 | "1: jo 0b\n" | 74 | "1: jo 0b\n" |
@@ -86,7 +79,23 @@ int memcpy_real(void *dest, void *src, size_t count) | |||
86 | "+d" (_len2), "=m" (*((long *) dest)) | 79 | "+d" (_len2), "=m" (*((long *) dest)) |
87 | : "m" (*((long *) src)) | 80 | : "m" (*((long *) src)) |
88 | : "cc", "memory"); | 81 | : "cc", "memory"); |
89 | arch_local_irq_restore(flags); | 82 | return rc; |
83 | } | ||
84 | |||
85 | /* | ||
86 | * Copy memory in real mode (kernel to kernel) | ||
87 | */ | ||
88 | int memcpy_real(void *dest, void *src, size_t count) | ||
89 | { | ||
90 | unsigned long flags; | ||
91 | int rc; | ||
92 | |||
93 | if (!count) | ||
94 | return 0; | ||
95 | local_irq_save(flags); | ||
96 | __arch_local_irq_stnsm(0xfbUL); | ||
97 | rc = __memcpy_real(dest, src, count); | ||
98 | local_irq_restore(flags); | ||
90 | return rc; | 99 | return rc; |
91 | } | 100 | } |
92 | 101 | ||
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c index 373adf69b01c..6e765bf00670 100644 --- a/arch/s390/mm/pgtable.c +++ b/arch/s390/mm/pgtable.c | |||
@@ -678,8 +678,6 @@ void page_table_free(struct mm_struct *mm, unsigned long *table) | |||
678 | } | 678 | } |
679 | } | 679 | } |
680 | 680 | ||
681 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
682 | |||
683 | static void __page_table_free_rcu(void *table, unsigned bit) | 681 | static void __page_table_free_rcu(void *table, unsigned bit) |
684 | { | 682 | { |
685 | struct page *page; | 683 | struct page *page; |
@@ -733,7 +731,66 @@ void __tlb_remove_table(void *_table) | |||
733 | free_pages((unsigned long) table, ALLOC_ORDER); | 731 | free_pages((unsigned long) table, ALLOC_ORDER); |
734 | } | 732 | } |
735 | 733 | ||
736 | #endif | 734 | static void tlb_remove_table_smp_sync(void *arg) |
735 | { | ||
736 | /* Simply deliver the interrupt */ | ||
737 | } | ||
738 | |||
739 | static void tlb_remove_table_one(void *table) | ||
740 | { | ||
741 | /* | ||
742 | * This isn't an RCU grace period and hence the page-tables cannot be | ||
743 | * assumed to be actually RCU-freed. | ||
744 | * | ||
745 | * It is however sufficient for software page-table walkers that rely | ||
746 | * on IRQ disabling. See the comment near struct mmu_table_batch. | ||
747 | */ | ||
748 | smp_call_function(tlb_remove_table_smp_sync, NULL, 1); | ||
749 | __tlb_remove_table(table); | ||
750 | } | ||
751 | |||
752 | static void tlb_remove_table_rcu(struct rcu_head *head) | ||
753 | { | ||
754 | struct mmu_table_batch *batch; | ||
755 | int i; | ||
756 | |||
757 | batch = container_of(head, struct mmu_table_batch, rcu); | ||
758 | |||
759 | for (i = 0; i < batch->nr; i++) | ||
760 | __tlb_remove_table(batch->tables[i]); | ||
761 | |||
762 | free_page((unsigned long)batch); | ||
763 | } | ||
764 | |||
765 | void tlb_table_flush(struct mmu_gather *tlb) | ||
766 | { | ||
767 | struct mmu_table_batch **batch = &tlb->batch; | ||
768 | |||
769 | if (*batch) { | ||
770 | __tlb_flush_mm(tlb->mm); | ||
771 | call_rcu_sched(&(*batch)->rcu, tlb_remove_table_rcu); | ||
772 | *batch = NULL; | ||
773 | } | ||
774 | } | ||
775 | |||
776 | void tlb_remove_table(struct mmu_gather *tlb, void *table) | ||
777 | { | ||
778 | struct mmu_table_batch **batch = &tlb->batch; | ||
779 | |||
780 | if (*batch == NULL) { | ||
781 | *batch = (struct mmu_table_batch *) | ||
782 | __get_free_page(GFP_NOWAIT | __GFP_NOWARN); | ||
783 | if (*batch == NULL) { | ||
784 | __tlb_flush_mm(tlb->mm); | ||
785 | tlb_remove_table_one(table); | ||
786 | return; | ||
787 | } | ||
788 | (*batch)->nr = 0; | ||
789 | } | ||
790 | (*batch)->tables[(*batch)->nr++] = table; | ||
791 | if ((*batch)->nr == MAX_TABLE_BATCH) | ||
792 | tlb_table_flush(tlb); | ||
793 | } | ||
737 | 794 | ||
738 | /* | 795 | /* |
739 | * switch on pgstes for its userspace process (for kvm) | 796 | * switch on pgstes for its userspace process (for kvm) |
diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c index 173df38dbda5..2e88438ffd83 100644 --- a/arch/x86/kvm/pmu.c +++ b/arch/x86/kvm/pmu.c | |||
@@ -459,17 +459,17 @@ void kvm_pmu_cpuid_update(struct kvm_vcpu *vcpu) | |||
459 | pmu->available_event_types = ~entry->ebx & ((1ull << bitmap_len) - 1); | 459 | pmu->available_event_types = ~entry->ebx & ((1ull << bitmap_len) - 1); |
460 | 460 | ||
461 | if (pmu->version == 1) { | 461 | if (pmu->version == 1) { |
462 | pmu->global_ctrl = (1 << pmu->nr_arch_gp_counters) - 1; | 462 | pmu->nr_arch_fixed_counters = 0; |
463 | return; | 463 | } else { |
464 | pmu->nr_arch_fixed_counters = min((int)(entry->edx & 0x1f), | ||
465 | X86_PMC_MAX_FIXED); | ||
466 | pmu->counter_bitmask[KVM_PMC_FIXED] = | ||
467 | ((u64)1 << ((entry->edx >> 5) & 0xff)) - 1; | ||
464 | } | 468 | } |
465 | 469 | ||
466 | pmu->nr_arch_fixed_counters = min((int)(entry->edx & 0x1f), | 470 | pmu->global_ctrl = ((1 << pmu->nr_arch_gp_counters) - 1) | |
467 | X86_PMC_MAX_FIXED); | 471 | (((1ull << pmu->nr_arch_fixed_counters) - 1) << X86_PMC_IDX_FIXED); |
468 | pmu->counter_bitmask[KVM_PMC_FIXED] = | 472 | pmu->global_ctrl_mask = ~pmu->global_ctrl; |
469 | ((u64)1 << ((entry->edx >> 5) & 0xff)) - 1; | ||
470 | pmu->global_ctrl_mask = ~(((1 << pmu->nr_arch_gp_counters) - 1) | ||
471 | | (((1ull << pmu->nr_arch_fixed_counters) - 1) | ||
472 | << X86_PMC_IDX_FIXED)); | ||
473 | } | 473 | } |
474 | 474 | ||
475 | void kvm_pmu_init(struct kvm_vcpu *vcpu) | 475 | void kvm_pmu_init(struct kvm_vcpu *vcpu) |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index ad85adfef843..4ff0ab9bc3c8 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -2210,9 +2210,12 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data) | |||
2210 | msr = find_msr_entry(vmx, msr_index); | 2210 | msr = find_msr_entry(vmx, msr_index); |
2211 | if (msr) { | 2211 | if (msr) { |
2212 | msr->data = data; | 2212 | msr->data = data; |
2213 | if (msr - vmx->guest_msrs < vmx->save_nmsrs) | 2213 | if (msr - vmx->guest_msrs < vmx->save_nmsrs) { |
2214 | preempt_disable(); | ||
2214 | kvm_set_shared_msr(msr->index, msr->data, | 2215 | kvm_set_shared_msr(msr->index, msr->data, |
2215 | msr->mask); | 2216 | msr->mask); |
2217 | preempt_enable(); | ||
2218 | } | ||
2216 | break; | 2219 | break; |
2217 | } | 2220 | } |
2218 | ret = kvm_set_msr_common(vcpu, msr_index, data); | 2221 | ret = kvm_set_msr_common(vcpu, msr_index, data); |
diff --git a/arch/x86/lib/insn.c b/arch/x86/lib/insn.c index 25feb1ae71c5..b1e6c4b2e8eb 100644 --- a/arch/x86/lib/insn.c +++ b/arch/x86/lib/insn.c | |||
@@ -379,8 +379,8 @@ err_out: | |||
379 | return; | 379 | return; |
380 | } | 380 | } |
381 | 381 | ||
382 | /* Decode moffset16/32/64 */ | 382 | /* Decode moffset16/32/64. Return 0 if failed */ |
383 | static void __get_moffset(struct insn *insn) | 383 | static int __get_moffset(struct insn *insn) |
384 | { | 384 | { |
385 | switch (insn->addr_bytes) { | 385 | switch (insn->addr_bytes) { |
386 | case 2: | 386 | case 2: |
@@ -397,15 +397,19 @@ static void __get_moffset(struct insn *insn) | |||
397 | insn->moffset2.value = get_next(int, insn); | 397 | insn->moffset2.value = get_next(int, insn); |
398 | insn->moffset2.nbytes = 4; | 398 | insn->moffset2.nbytes = 4; |
399 | break; | 399 | break; |
400 | default: /* opnd_bytes must be modified manually */ | ||
401 | goto err_out; | ||
400 | } | 402 | } |
401 | insn->moffset1.got = insn->moffset2.got = 1; | 403 | insn->moffset1.got = insn->moffset2.got = 1; |
402 | 404 | ||
405 | return 1; | ||
406 | |||
403 | err_out: | 407 | err_out: |
404 | return; | 408 | return 0; |
405 | } | 409 | } |
406 | 410 | ||
407 | /* Decode imm v32(Iz) */ | 411 | /* Decode imm v32(Iz). Return 0 if failed */ |
408 | static void __get_immv32(struct insn *insn) | 412 | static int __get_immv32(struct insn *insn) |
409 | { | 413 | { |
410 | switch (insn->opnd_bytes) { | 414 | switch (insn->opnd_bytes) { |
411 | case 2: | 415 | case 2: |
@@ -417,14 +421,18 @@ static void __get_immv32(struct insn *insn) | |||
417 | insn->immediate.value = get_next(int, insn); | 421 | insn->immediate.value = get_next(int, insn); |
418 | insn->immediate.nbytes = 4; | 422 | insn->immediate.nbytes = 4; |
419 | break; | 423 | break; |
424 | default: /* opnd_bytes must be modified manually */ | ||
425 | goto err_out; | ||
420 | } | 426 | } |
421 | 427 | ||
428 | return 1; | ||
429 | |||
422 | err_out: | 430 | err_out: |
423 | return; | 431 | return 0; |
424 | } | 432 | } |
425 | 433 | ||
426 | /* Decode imm v64(Iv/Ov) */ | 434 | /* Decode imm v64(Iv/Ov), Return 0 if failed */ |
427 | static void __get_immv(struct insn *insn) | 435 | static int __get_immv(struct insn *insn) |
428 | { | 436 | { |
429 | switch (insn->opnd_bytes) { | 437 | switch (insn->opnd_bytes) { |
430 | case 2: | 438 | case 2: |
@@ -441,15 +449,18 @@ static void __get_immv(struct insn *insn) | |||
441 | insn->immediate2.value = get_next(int, insn); | 449 | insn->immediate2.value = get_next(int, insn); |
442 | insn->immediate2.nbytes = 4; | 450 | insn->immediate2.nbytes = 4; |
443 | break; | 451 | break; |
452 | default: /* opnd_bytes must be modified manually */ | ||
453 | goto err_out; | ||
444 | } | 454 | } |
445 | insn->immediate1.got = insn->immediate2.got = 1; | 455 | insn->immediate1.got = insn->immediate2.got = 1; |
446 | 456 | ||
457 | return 1; | ||
447 | err_out: | 458 | err_out: |
448 | return; | 459 | return 0; |
449 | } | 460 | } |
450 | 461 | ||
451 | /* Decode ptr16:16/32(Ap) */ | 462 | /* Decode ptr16:16/32(Ap) */ |
452 | static void __get_immptr(struct insn *insn) | 463 | static int __get_immptr(struct insn *insn) |
453 | { | 464 | { |
454 | switch (insn->opnd_bytes) { | 465 | switch (insn->opnd_bytes) { |
455 | case 2: | 466 | case 2: |
@@ -462,14 +473,17 @@ static void __get_immptr(struct insn *insn) | |||
462 | break; | 473 | break; |
463 | case 8: | 474 | case 8: |
464 | /* ptr16:64 is not exist (no segment) */ | 475 | /* ptr16:64 is not exist (no segment) */ |
465 | return; | 476 | return 0; |
477 | default: /* opnd_bytes must be modified manually */ | ||
478 | goto err_out; | ||
466 | } | 479 | } |
467 | insn->immediate2.value = get_next(unsigned short, insn); | 480 | insn->immediate2.value = get_next(unsigned short, insn); |
468 | insn->immediate2.nbytes = 2; | 481 | insn->immediate2.nbytes = 2; |
469 | insn->immediate1.got = insn->immediate2.got = 1; | 482 | insn->immediate1.got = insn->immediate2.got = 1; |
470 | 483 | ||
484 | return 1; | ||
471 | err_out: | 485 | err_out: |
472 | return; | 486 | return 0; |
473 | } | 487 | } |
474 | 488 | ||
475 | /** | 489 | /** |
@@ -489,7 +503,8 @@ void insn_get_immediate(struct insn *insn) | |||
489 | insn_get_displacement(insn); | 503 | insn_get_displacement(insn); |
490 | 504 | ||
491 | if (inat_has_moffset(insn->attr)) { | 505 | if (inat_has_moffset(insn->attr)) { |
492 | __get_moffset(insn); | 506 | if (!__get_moffset(insn)) |
507 | goto err_out; | ||
493 | goto done; | 508 | goto done; |
494 | } | 509 | } |
495 | 510 | ||
@@ -517,16 +532,20 @@ void insn_get_immediate(struct insn *insn) | |||
517 | insn->immediate2.nbytes = 4; | 532 | insn->immediate2.nbytes = 4; |
518 | break; | 533 | break; |
519 | case INAT_IMM_PTR: | 534 | case INAT_IMM_PTR: |
520 | __get_immptr(insn); | 535 | if (!__get_immptr(insn)) |
536 | goto err_out; | ||
521 | break; | 537 | break; |
522 | case INAT_IMM_VWORD32: | 538 | case INAT_IMM_VWORD32: |
523 | __get_immv32(insn); | 539 | if (!__get_immv32(insn)) |
540 | goto err_out; | ||
524 | break; | 541 | break; |
525 | case INAT_IMM_VWORD: | 542 | case INAT_IMM_VWORD: |
526 | __get_immv(insn); | 543 | if (!__get_immv(insn)) |
544 | goto err_out; | ||
527 | break; | 545 | break; |
528 | default: | 546 | default: |
529 | break; | 547 | /* Here, insn must have an immediate, but failed */ |
548 | goto err_out; | ||
530 | } | 549 | } |
531 | if (inat_has_second_immediate(insn->attr)) { | 550 | if (inat_has_second_immediate(insn->attr)) { |
532 | insn->immediate2.value = get_next(char, insn); | 551 | insn->immediate2.value = get_next(char, insn); |