/*
 * Copyright (c) 2026, Chloe M.
 * Provided under the BSD-3 clause.
 *
 * Description: Bugcheck interface
 * Author:      Chloe M.
 */

#ifndef _KE_BUGCHECK_H_
#define _KE_BUGCHECK_H_ 1

#include <ptdef.h>

/*
 * A list of reasons to why a bug check can happen
 *
 * @BUGCHECK_MISC:              Misc reason
 * @BUGCHECK_OOM:               Out of memory during critical operation
 * @BUGCHECK_IO_ERROR:          Fatal I/O error
 * @BUGCHECK_UNBOUND_RESRC:     Fatal unbound resource
 * @BUGCHECK_EXCEPTION:         Fatal exception
 * @BUGCHECK_IRQL_NOT_GTE:      IRQL not greater than or equal
 * @BUGCHECK_IRQL_NOT_LTE:      IRQL not less than or equal
 * @BUGCHECK_BAD_FREE:          Bad free operation
 * @BUGCHECK_BAD_CHECKSUM:      Bad checksum
 * @BUGCHECK_MISSING_HARDWARE:  Missing hardware
 * @BUGCHECK_SYSTEMPROC_KILLED: Critical system process killed
 */
typedef enum {
    BUGCHECK_MISC,
    BUGCHECK_OOM,
    BUGCHECK_IO_ERROR,
    BUGCHECK_UNBOUND_RESRC,
    BUGCHECK_EXCEPTION,
    BUGCHECK_IRQL_NOT_GTE,
    BUGCHECK_IRQL_NOT_LTE,
    BUGCHECK_BAD_FREE,
    BUGCHECK_BAD_CHECKSUM,
    BUGCHECK_MISSING_HARDWARE,
    BUGCHECK_SYSTEMPROC_KILLED
} BUGCHECK_REASON;

/*
 * Signal to the user that something has gone terribly wrong
 * during system operation and that the machine needs to come to
 * a screetching halt.
 *
 * @Reason: Broad reason of bugcheck
 * @Fmt:    Format specifier
 * @<...>:  Variadic arguments
 */
NO_RETURN VOID KeBugCheck(BUGCHECK_REASON Reason, const CHAR *Fmt, ...);

#endif  /* !_KE_BUGCHECK_H_ */
