This repository has been archived on 2024-11-18. You can view files and clone it, but cannot push or open issues or pull requests.
2023-12-03 17:08:00 +08:00
|
|
|
#ifndef UTILS_H
|
|
|
|
#define UTILS_H 1
|
|
|
|
|
|
|
|
#include <types.h>
|
|
|
|
|
|
|
|
#define DISALIGNED __attribute__((packed))
|
|
|
|
|
2024-03-10 01:27:42 +08:00
|
|
|
#define into_bytes(addr) ((u8 *)(addr))
|
|
|
|
#define bytes_into(bytes, type) ((type *)(bytes))
|
|
|
|
|
2024-04-04 22:48:38 +08:00
|
|
|
void pointer_to_string(u64 addr, char *dest);
|
|
|
|
|
|
|
|
typedef struct __va_args
|
|
|
|
{
|
|
|
|
usize length;
|
|
|
|
void *args[0];
|
|
|
|
} va_args;
|
|
|
|
|
|
|
|
#define va_args_gen(result, length) \
|
|
|
|
void *__reserved__[length]; \
|
|
|
|
va_args __va_args__; \
|
|
|
|
result = &__va_args__;
|
|
|
|
|
|
|
|
#define va_args_set(vaargs, index, val) \
|
|
|
|
vaargs->args[index] = &val;
|
2024-03-10 01:27:42 +08:00
|
|
|
|
2023-12-03 17:08:00 +08:00
|
|
|
#endif
|