On 28/09/2021 21:30, Bobby Eshleman wrote: > This commit allows non-x86 architecture to omit the file asm/debugger.h > if they do not require it. It changes debugger.h to be a general > xen/debugger.h which, if CONFIG_CRASH_DEBUG, resolves to include > asm/debugger.h. > > It also changes all asm/debugger.h includes to xen/debugger.h. > > Because it is no longer required, arm/debugger.h is removed. > > Signed-off-by: Bobby Eshleman <bobby.eshle...@gmail.com>
Julien also acked this patch. > diff --git a/xen/include/xen/debugger.h b/xen/include/xen/debugger.h > new file mode 100644 > index 0000000000..ddaa4a938b > --- /dev/null > +++ b/xen/include/xen/debugger.h > @@ -0,0 +1,51 @@ > +/****************************************************************************** > + * Generic hooks into arch-dependent Xen. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program; If not, see <http://www.gnu.org/licenses/>. > + * > + * Each debugger should define two functions here: > + * > + * 1. debugger_trap_fatal(): > + * Called when Xen is about to give up and crash. Typically you will use > this > + * hook to drop into a debug session. It can also be used to hook off > + * deliberately caused traps (which you then handle and return non-zero). > + * > + * 2. debugger_trap_immediate(): > + * Called if we want to drop into a debugger now. This is essentially the > + * same as debugger_trap_fatal, except that we use the current register > state > + * rather than the state which was in effect when we took the trap. > + * For example: if we're dying because of an unhandled exception, we call > + * debugger_trap_fatal; if we're dying because of a panic() we call > + * debugger_trap_immediate(). This comment is now duplicated in x86's asm/debugger.h. The x86 copy wants deleting as part of this move. > + */ > + > +#ifndef __XEN_DEBUGGER_H__ > +#define __XEN_DEBUGGER_H__ > + > +#ifdef CONFIG_CRASH_DEBUG > + > +#include <asm/debugger.h> > + > +#else #include <xen/types.h> because you need bool and false to make this compile. ~Andrew > + > +struct cpu_user_regs; > + > +static inline bool debugger_trap_fatal( > + unsigned int vector, const struct cpu_user_regs *regs) > +{ > + return false; > +} > + > +static inline void debugger_trap_immediate(void) > +{ > +} > + > +#endif /* CONFIG_CRASH_DEBUG */ > + > +#endif /* __XEN_DEBUGGER_H__ */