// SPDX-License-Identifier: GPL-2.01/*2* Callers outside of misc.c need access to the error reporting routines,3* but the *_putstr() functions need to stay in misc.c because of how4* memcpy() and memmove() are defined for the compressed boot environment.5*/6#include "misc.h"7#include "error.h"89void warn(const char *m)10{11error_putstr("\n\n");12error_putstr(m);13error_putstr("\n\n");14}1516void error(char *m)17{18warn(m);19error_putstr(" -- System halted");2021while (1)22asm("hlt");23}2425/* EFI libstub provides vsnprintf() */26#ifdef CONFIG_EFI_STUB27void panic(const char *fmt, ...)28{29static char buf[1024];30va_list args;31int len;3233va_start(args, fmt);34len = vsnprintf(buf, sizeof(buf), fmt, args);35va_end(args);3637if (len && buf[len - 1] == '\n')38buf[len - 1] = '\0';3940error(buf);41}42#endif434445