.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) |
---|
3 | 4 | * Copyright (C) 2002-2006 Novell, Inc. |
---|
4 | 5 | * Jan Beulich <jbeulich@novell.com> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License version 2 as |
---|
8 | | - * published by the Free Software Foundation. |
---|
9 | 6 | * |
---|
10 | 7 | * A simple API for unwinding kernel stacks. This is used for |
---|
11 | 8 | * debugging and error reporting purposes. The kernel doesn't need |
---|
.. | .. |
---|
15 | 12 | |
---|
16 | 13 | #include <linux/sched.h> |
---|
17 | 14 | #include <linux/module.h> |
---|
18 | | -#include <linux/bootmem.h> |
---|
| 15 | +#include <linux/memblock.h> |
---|
19 | 16 | #include <linux/sort.h> |
---|
20 | 17 | #include <linux/slab.h> |
---|
21 | 18 | #include <linux/stop_machine.h> |
---|
.. | .. |
---|
45 | 42 | |
---|
46 | 43 | #define EXTRA_INFO(f) { \ |
---|
47 | 44 | BUILD_BUG_ON_ZERO(offsetof(struct unwind_frame_info, f) \ |
---|
48 | | - % FIELD_SIZEOF(struct unwind_frame_info, f)) \ |
---|
| 45 | + % sizeof_field(struct unwind_frame_info, f)) \ |
---|
49 | 46 | + offsetof(struct unwind_frame_info, f) \ |
---|
50 | | - / FIELD_SIZEOF(struct unwind_frame_info, f), \ |
---|
51 | | - FIELD_SIZEOF(struct unwind_frame_info, f) \ |
---|
| 47 | + / sizeof_field(struct unwind_frame_info, f), \ |
---|
| 48 | + sizeof_field(struct unwind_frame_info, f) \ |
---|
52 | 49 | } |
---|
53 | 50 | #define PTREGS_INFO(f) EXTRA_INFO(regs.f) |
---|
54 | 51 | |
---|
.. | .. |
---|
181 | 178 | */ |
---|
182 | 179 | static void *__init unw_hdr_alloc_early(unsigned long sz) |
---|
183 | 180 | { |
---|
184 | | - return __alloc_bootmem_nopanic(sz, sizeof(unsigned int), |
---|
185 | | - MAX_DMA_ADDRESS); |
---|
| 181 | + return memblock_alloc_from(sz, sizeof(unsigned int), MAX_DMA_ADDRESS); |
---|
186 | 182 | } |
---|
187 | 183 | |
---|
188 | 184 | static void init_unwind_table(struct unwind_table *table, const char *name, |
---|
.. | .. |
---|
576 | 572 | #else |
---|
577 | 573 | BUILD_BUG_ON(sizeof(u32) != sizeof(value)); |
---|
578 | 574 | #endif |
---|
| 575 | + fallthrough; |
---|
579 | 576 | case DW_EH_PE_native: |
---|
580 | 577 | if (end < (const void *)(ptr.pul + 1)) |
---|
581 | 578 | return 0; |
---|
.. | .. |
---|
830 | 827 | case DW_CFA_def_cfa: |
---|
831 | 828 | state->cfa.reg = get_uleb128(&ptr.p8, end); |
---|
832 | 829 | unw_debug("cfa_def_cfa: r%lu ", state->cfa.reg); |
---|
833 | | - /*nobreak*/ |
---|
| 830 | + fallthrough; |
---|
834 | 831 | case DW_CFA_def_cfa_offset: |
---|
835 | 832 | state->cfa.offs = get_uleb128(&ptr.p8, end); |
---|
836 | 833 | unw_debug("cfa_def_cfa_offset: 0x%lx ", |
---|
.. | .. |
---|
838 | 835 | break; |
---|
839 | 836 | case DW_CFA_def_cfa_sf: |
---|
840 | 837 | state->cfa.reg = get_uleb128(&ptr.p8, end); |
---|
841 | | - /*nobreak */ |
---|
| 838 | + fallthrough; |
---|
842 | 839 | case DW_CFA_def_cfa_offset_sf: |
---|
843 | 840 | state->cfa.offs = get_sleb128(&ptr.p8, end) |
---|
844 | 841 | * state->dataAlign; |
---|
.. | .. |
---|
1181 | 1178 | #endif |
---|
1182 | 1179 | |
---|
1183 | 1180 | /* update frame */ |
---|
1184 | | -#ifndef CONFIG_AS_CFI_SIGNAL_FRAME |
---|
1185 | 1181 | if (frame->call_frame |
---|
1186 | 1182 | && !UNW_DEFAULT_RA(state.regs[retAddrReg], state.dataAlign)) |
---|
1187 | 1183 | frame->call_frame = 0; |
---|
1188 | | -#endif |
---|
1189 | 1184 | cfa = FRAME_REG(state.cfa.reg, unsigned long) + state.cfa.offs; |
---|
1190 | 1185 | startLoc = min_t(unsigned long, UNW_SP(frame), cfa); |
---|
1191 | 1186 | endLoc = max_t(unsigned long, UNW_SP(frame), cfa); |
---|