1 /* 2 * Copyright 2019 The Hafnium Authors. 3 * 4 * Use of this source code is governed by a BSD-style 5 * license that can be found in the LICENSE file or at 6 * https://opensource.org/licenses/BSD-3-Clause. 7 */ 8 9 #include "hf/panic.h" 10 11 #include <stdarg.h> 12 13 #include "hf/abort.h" 14 #include "hf/dlog.h" 15 16 /** 17 * Logs a reason before calling abort. 18 * 19 * TODO: Determine if we want to omit strings on non-debug builds. 20 */ panic(const char * fmt,...)21noreturn void panic(const char *fmt, ...) 22 { 23 va_list args; 24 25 dlog("Panic: "); 26 27 va_start(args, fmt); 28 vdlog(fmt, args); 29 va_end(args); 30 31 dlog("\n"); 32 33 abort(); 34 } 35