Skip to content

Commit 681857e

Browse files
committed
Merge branch 'parisc-4.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parisc updates from Helge Deller: - fix panic when halting system via "shutdown -h now" - drop own coding in favour of generic CONFIG_COMPAT_BINFMT_ELF implementation - add FPE_CONDTRAP constant: last outstanding parisc-specific cleanup for Eric Biedermans siginfo patches - move some functions to .init and some to .text.hot linker sections * 'parisc-4.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: Prevent panic at system halt parisc: Switch to generic COMPAT_BINFMT_ELF parisc: Move cache flush functions into .text.hot section parisc/signal: Add FPE_CONDTRAP for conditional trap handling
2 parents 80aa76b + 6769828 commit 681857e

File tree

11 files changed

+60
-157
lines changed

11 files changed

+60
-157
lines changed

arch/parisc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ source "mm/Kconfig"
338338
config COMPAT
339339
def_bool y
340340
depends on 64BIT
341+
select COMPAT_BINFMT_ELF if BINFMT_ELF
341342

342343
config SYSVIPC_COMPAT
343344
def_bool y

arch/parisc/include/asm/compat.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ struct compat_shmid64_ds {
192192
compat_ulong_t __unused6;
193193
};
194194

195+
/*
196+
* The type of struct elf_prstatus.pr_reg in compatible core dumps.
197+
*/
198+
#define COMPAT_ELF_NGREG 80
199+
typedef compat_ulong_t compat_elf_gregset_t[COMPAT_ELF_NGREG];
200+
195201
/*
196202
* A pointer passed in from user mode. This should not
197203
* be used for syscall parameters, just declare them

arch/parisc/include/asm/elf.h

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* ELF register definitions..
77
*/
88

9-
#include <asm/ptrace.h>
9+
#include <linux/types.h>
1010

1111
#define EM_PARISC 15
1212

@@ -169,16 +169,12 @@ typedef struct elf64_fdesc {
169169
__u64 gp;
170170
} Elf64_Fdesc;
171171

172-
#ifdef __KERNEL__
173-
174172
#ifdef CONFIG_64BIT
175173
#define Elf_Fdesc Elf64_Fdesc
176174
#else
177175
#define Elf_Fdesc Elf32_Fdesc
178176
#endif /*CONFIG_64BIT*/
179177

180-
#endif /*__KERNEL__*/
181-
182178
/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */
183179

184180
#define PT_HP_TLS (PT_LOOS + 0x0)
@@ -212,45 +208,45 @@ typedef struct elf64_fdesc {
212208
#define PF_HP_LAZYSWAP 0x04000000
213209
#define PF_HP_SBP 0x08000000
214210

211+
/*
212+
* This yields a string that ld.so will use to load implementation
213+
* specific libraries for optimization. This is more specific in
214+
* intent than poking at uname or /proc/cpuinfo.
215+
*/
216+
217+
#define ELF_PLATFORM ("PARISC")
218+
215219
/*
216220
* The following definitions are those for 32-bit ELF binaries on a 32-bit
217221
* kernel and for 64-bit binaries on a 64-bit kernel. To run 32-bit binaries
218-
* on a 64-bit kernel, arch/parisc/kernel/binfmt_elf32.c defines these
219-
* macros appropriately and then #includes binfmt_elf.c, which then includes
220-
* this file.
222+
* on a 64-bit kernel, fs/compat_binfmt_elf.c defines ELF_CLASS and then
223+
* #includes binfmt_elf.c, which then includes this file.
221224
*/
222225
#ifndef ELF_CLASS
223226

224-
/*
225-
* This is used to ensure we don't load something for the wrong architecture.
226-
*
227-
* Note that this header file is used by default in fs/binfmt_elf.c. So
228-
* the following macros are for the default case. However, for the 64
229-
* bit kernel we also support 32 bit parisc binaries. To do that
230-
* arch/parisc/kernel/binfmt_elf32.c defines its own set of these
231-
* macros, and then it includes fs/binfmt_elf.c to provide an alternate
232-
* elf binary handler for 32 bit binaries (on the 64 bit kernel).
233-
*/
234227
#ifdef CONFIG_64BIT
235-
#define ELF_CLASS ELFCLASS64
228+
#define ELF_CLASS ELFCLASS64
236229
#else
237230
#define ELF_CLASS ELFCLASS32
238231
#endif
239232

240233
typedef unsigned long elf_greg_t;
241234

242-
/*
243-
* This yields a string that ld.so will use to load implementation
244-
* specific libraries for optimization. This is more specific in
245-
* intent than poking at uname or /proc/cpuinfo.
246-
*/
247-
248-
#define ELF_PLATFORM ("PARISC\0")
249-
250235
#define SET_PERSONALITY(ex) \
236+
({ \
251237
set_personality((current->personality & ~PER_MASK) | PER_LINUX); \
252238
current->thread.map_base = DEFAULT_MAP_BASE; \
253-
current->thread.task_size = DEFAULT_TASK_SIZE \
239+
current->thread.task_size = DEFAULT_TASK_SIZE; \
240+
})
241+
242+
#endif /* ! ELF_CLASS */
243+
244+
#define COMPAT_SET_PERSONALITY(ex) \
245+
({ \
246+
set_thread_flag(TIF_32BIT); \
247+
current->thread.map_base = DEFAULT_MAP_BASE32; \
248+
current->thread.task_size = DEFAULT_TASK_SIZE32; \
249+
})
254250

255251
/*
256252
* Fill in general registers in a core dump. This saves pretty
@@ -277,10 +273,12 @@ typedef unsigned long elf_greg_t;
277273

278274
#define ELF_CORE_COPY_REGS(dst, pt) \
279275
memset(dst, 0, sizeof(dst)); /* don't leak any "random" bits */ \
280-
memcpy(dst + 0, pt->gr, 32 * sizeof(elf_greg_t)); \
281-
memcpy(dst + 32, pt->sr, 8 * sizeof(elf_greg_t)); \
282-
memcpy(dst + 40, pt->iaoq, 2 * sizeof(elf_greg_t)); \
283-
memcpy(dst + 42, pt->iasq, 2 * sizeof(elf_greg_t)); \
276+
{ int i; \
277+
for (i = 0; i < 32; i++) dst[i] = pt->gr[i]; \
278+
for (i = 0; i < 8; i++) dst[32 + i] = pt->sr[i]; \
279+
} \
280+
dst[40] = pt->iaoq[0]; dst[41] = pt->iaoq[1]; \
281+
dst[42] = pt->iasq[0]; dst[43] = pt->iasq[1]; \
284282
dst[44] = pt->sar; dst[45] = pt->iir; \
285283
dst[46] = pt->isr; dst[47] = pt->ior; \
286284
dst[48] = mfctl(22); dst[49] = mfctl(0); \
@@ -292,7 +290,7 @@ typedef unsigned long elf_greg_t;
292290
dst[60] = mfctl(12); dst[61] = mfctl(13); \
293291
dst[62] = mfctl(10); dst[63] = mfctl(15);
294292

295-
#endif /* ! ELF_CLASS */
293+
#define CORE_DUMP_USE_REGSET
296294

297295
#define ELF_NGREG 80 /* We only need 64 at present, but leave space
298296
for expansion. */
@@ -310,7 +308,10 @@ extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
310308
struct pt_regs; /* forward declaration... */
311309

312310

313-
#define elf_check_arch(x) ((x)->e_machine == EM_PARISC && (x)->e_ident[EI_CLASS] == ELF_CLASS)
311+
#define elf_check_arch(x) \
312+
((x)->e_machine == EM_PARISC && (x)->e_ident[EI_CLASS] == ELF_CLASS)
313+
#define compat_elf_check_arch(x) \
314+
((x)->e_machine == EM_PARISC && (x)->e_ident[EI_CLASS] == ELFCLASS32)
314315

315316
/*
316317
* These are used to set parameters in the core dumps.

arch/parisc/include/uapi/asm/siginfo.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,4 @@
88

99
#include <asm-generic/siginfo.h>
1010

11-
/*
12-
* SIGFPE si_codes
13-
*/
14-
#ifdef __KERNEL__
15-
#define FPE_FIXME 0 /* Broken dup of SI_USER */
16-
#endif /* __KERNEL__ */
17-
1811
#endif

arch/parisc/kernel/binfmt_elf32.c

Lines changed: 0 additions & 98 deletions
This file was deleted.

arch/parisc/kernel/cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ parisc_cache_init(void)
254254
}
255255
}
256256

257-
void disable_sr_hashing(void)
257+
void __init disable_sr_hashing(void)
258258
{
259259
int srhash_type, retval;
260260
unsigned long space_bits;

arch/parisc/kernel/pacache.S

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@
3838
#include <asm/cache.h>
3939
#include <asm/ldcw.h>
4040
#include <linux/linkage.h>
41+
#include <linux/init.h>
4142

42-
.text
43-
.align 128
43+
.section .text.hot
44+
.align 16
4445

4546
ENTRY_CFI(flush_tlb_all_local)
4647
.proc
@@ -328,8 +329,6 @@ fdsync:
328329
.procend
329330
ENDPROC_CFI(flush_data_cache_local)
330331

331-
.align 16
332-
333332
/* Macros to serialize TLB purge operations on SMP. */
334333

335334
.macro tlb_lock la,flags,tmp
@@ -1216,6 +1215,8 @@ ENTRY_CFI(flush_kernel_icache_range_asm)
12161215
.procend
12171216
ENDPROC_CFI(flush_kernel_icache_range_asm)
12181217

1218+
__INIT
1219+
12191220
/* align should cover use of rfi in disable_sr_hashing_asm and
12201221
* srdis_done.
12211222
*/

arch/parisc/kernel/process.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,6 @@ void machine_restart(char *cmd)
112112

113113
}
114114

115-
void machine_halt(void)
116-
{
117-
/*
118-
** The LED/ChassisCodes are updated by the led_halt()
119-
** function, called by the reboot notifier chain.
120-
*/
121-
}
122-
123115
void (*chassis_power_off)(void);
124116

125117
/*
@@ -158,6 +150,11 @@ void machine_power_off(void)
158150
void (*pm_power_off)(void);
159151
EXPORT_SYMBOL(pm_power_off);
160152

153+
void machine_halt(void)
154+
{
155+
machine_power_off();
156+
}
157+
161158
void flush_thread(void)
162159
{
163160
/* Only needs to handle fpu stuff or perf monitors.

arch/parisc/kernel/traps.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -627,9 +627,10 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
627627
on condition */
628628
if(user_mode(regs)){
629629
si.si_signo = SIGFPE;
630-
/* Set to zero, and let the userspace app figure it out from
631-
the insn pointed to by si_addr */
632-
si.si_code = FPE_FIXME;
630+
/* Let userspace app figure it out from the insn pointed
631+
* to by si_addr.
632+
*/
633+
si.si_code = FPE_CONDTRAP;
633634
si.si_addr = (void __user *) regs->iaoq[0];
634635
force_sig_info(SIGFPE, &si, current);
635636
return;

arch/x86/kernel/signal_compat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static inline void signal_compat_build_tests(void)
2626
* new fields are handled in copy_siginfo_to_user32()!
2727
*/
2828
BUILD_BUG_ON(NSIGILL != 11);
29-
BUILD_BUG_ON(NSIGFPE != 14);
29+
BUILD_BUG_ON(NSIGFPE != 15);
3030
BUILD_BUG_ON(NSIGSEGV != 7);
3131
BUILD_BUG_ON(NSIGBUS != 5);
3232
BUILD_BUG_ON(NSIGTRAP != 4);

include/uapi/asm-generic/siginfo.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ typedef struct siginfo {
211211
#define __FPE_INVASC 12 /* invalid ASCII digit */
212212
#define __FPE_INVDEC 13 /* invalid decimal digit */
213213
#define FPE_FLTUNK 14 /* undiagnosed floating-point exception */
214-
#define NSIGFPE 14
214+
#define FPE_CONDTRAP 15 /* trap on condition */
215+
#define NSIGFPE 15
215216

216217
/*
217218
* SIGSEGV si_codes

0 commit comments

Comments
 (0)