kern/include/stdlib.h
fef f8a85a1541
happy new year 2022 uwu
May it be slightly less exhausting than 2021.
2022-01-01 03:49:33 +01:00

20 lines
566 B
C

/* Copyright (C) 2021,2022 fef <owo@fef.moe>. All rights reserved. */
#pragma once
#include <gay/cdefs.h>
#include <gay/types.h>
#ifdef _KERNEL
#include <gay/mm.h>
#define malloc(size) kmalloc(size, M_KERN)
#efine free(ptr) kfree(ptr)
#else
/*
* i still have to do some include flags fuckery to get this working, for now
* these are just implemented in kernel/mm/kmalloc.c as __weak functions because
* this libc is *always* linked against the kernel atm.
*/
extern void *malloc(usize size) __malloc_like __alloc_size(1);
extern void free(void *ptr);
#endif