Skip to content

Boot OOM

include/mem/alloc_or_die.h View source View on GitHub
#define alloc_or_die(expr) \
    ({ \
        if (global.current_bootstage >= BOOTSTAGE_COMPLETE) \
            log_warn_once("alloc_or_die invoked after boot"); \
        __typeof__(expr) _p_ = (expr); \
        if (unlikely(!_p_)) \
            panic("OOM: %s == NULL, stage: %s", #expr, \
                  bootstage_str[global.current_bootstage]); \
        _p_; \
    })
#define kmalloc_or_die(...) alloc_or_die(kmalloc(__VA_ARGS__))