hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/arch/arc/kernel/unwind.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
34 * Copyright (C) 2002-2006 Novell, Inc.
45 * 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.
96 *
107 * A simple API for unwinding kernel stacks. This is used for
118 * debugging and error reporting purposes. The kernel doesn't need
....@@ -15,7 +12,7 @@
1512
1613 #include <linux/sched.h>
1714 #include <linux/module.h>
18
-#include <linux/bootmem.h>
15
+#include <linux/memblock.h>
1916 #include <linux/sort.h>
2017 #include <linux/slab.h>
2118 #include <linux/stop_machine.h>
....@@ -45,10 +42,10 @@
4542
4643 #define EXTRA_INFO(f) { \
4744 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)) \
4946 + 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) \
5249 }
5350 #define PTREGS_INFO(f) EXTRA_INFO(regs.f)
5451
....@@ -181,8 +178,7 @@
181178 */
182179 static void *__init unw_hdr_alloc_early(unsigned long sz)
183180 {
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);
186182 }
187183
188184 static void init_unwind_table(struct unwind_table *table, const char *name,
....@@ -576,6 +572,7 @@
576572 #else
577573 BUILD_BUG_ON(sizeof(u32) != sizeof(value));
578574 #endif
575
+ fallthrough;
579576 case DW_EH_PE_native:
580577 if (end < (const void *)(ptr.pul + 1))
581578 return 0;
....@@ -830,7 +827,7 @@
830827 case DW_CFA_def_cfa:
831828 state->cfa.reg = get_uleb128(&ptr.p8, end);
832829 unw_debug("cfa_def_cfa: r%lu ", state->cfa.reg);
833
- /*nobreak*/
830
+ fallthrough;
834831 case DW_CFA_def_cfa_offset:
835832 state->cfa.offs = get_uleb128(&ptr.p8, end);
836833 unw_debug("cfa_def_cfa_offset: 0x%lx ",
....@@ -838,7 +835,7 @@
838835 break;
839836 case DW_CFA_def_cfa_sf:
840837 state->cfa.reg = get_uleb128(&ptr.p8, end);
841
- /*nobreak */
838
+ fallthrough;
842839 case DW_CFA_def_cfa_offset_sf:
843840 state->cfa.offs = get_sleb128(&ptr.p8, end)
844841 * state->dataAlign;
....@@ -1181,11 +1178,9 @@
11811178 #endif
11821179
11831180 /* update frame */
1184
-#ifndef CONFIG_AS_CFI_SIGNAL_FRAME
11851181 if (frame->call_frame
11861182 && !UNW_DEFAULT_RA(state.regs[retAddrReg], state.dataAlign))
11871183 frame->call_frame = 0;
1188
-#endif
11891184 cfa = FRAME_REG(state.cfa.reg, unsigned long) + state.cfa.offs;
11901185 startLoc = min_t(unsigned long, UNW_SP(frame), cfa);
11911186 endLoc = max_t(unsigned long, UNW_SP(frame), cfa);