You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
138 lines
3.0 KiB
C
138 lines
3.0 KiB
C
/* Copyright (C) 2021,2022 fef <owo@fef.moe>. All rights reserved. */
|
|
|
|
#pragma once
|
|
|
|
#include <gay/_null.h>
|
|
#include <arch/_types.h>
|
|
|
|
#ifndef _BOOL_DECLARED
|
|
# define _BOOL_DECLARED 1
|
|
# ifndef __cplusplus
|
|
# if __STDC_VERSION__ >= 199901L
|
|
typedef _Bool bool;
|
|
# else
|
|
typedef __uint8_t bool;
|
|
# endif
|
|
# define true ((bool)1)
|
|
# define false ((bool)0)
|
|
# endif /* not __cplusplus */
|
|
#endif /* not _BOOL_DECLARED */
|
|
|
|
typedef unsigned char u_char;
|
|
typedef unsigned short u_short;
|
|
typedef unsigned int u_int;
|
|
typedef unsigned long u_long;
|
|
|
|
typedef __int8_t i8;
|
|
typedef __uint8_t u8;
|
|
|
|
typedef __int16_t i16;
|
|
typedef __uint16_t u16;
|
|
|
|
typedef __int32_t i32;
|
|
typedef __uint32_t u32;
|
|
|
|
typedef __int64_t i64;
|
|
typedef __uint64_t u64;
|
|
|
|
typedef __ssize_t isize;
|
|
typedef __size_t usize;
|
|
|
|
typedef __register_t word_t;
|
|
typedef __u_register_t uword_t;
|
|
|
|
typedef __vm_paddr_t vm_paddr_t;
|
|
typedef __vm_offset_t vm_offset_t;
|
|
typedef __vm_size_t vm_size_t;
|
|
|
|
#ifndef _SIZE_T_DECLARED
|
|
#define _SIZE_T_DECLARED 1
|
|
typedef __size_t size_t;
|
|
#endif /* not _SIZE_T_DECLARED */
|
|
|
|
#ifndef _PTRDIFF_T_DECLARED
|
|
#define _PTRDIFF_T_DECLARED 1
|
|
typedef __ptrdiff_t ptrdiff_t;
|
|
#endif /* not _PTRDIFF_T_DECLARED */
|
|
|
|
#ifndef _INTPTR_T_DECLARED
|
|
#define _INTPTR_T_DECLARED 1
|
|
typedef __intptr_t intptr_t;
|
|
#endif /* not _INTPTR_T_DECLARED */
|
|
|
|
#ifndef _UINTPTR_T_DECLARED
|
|
#define _UINTPTR_T_DECLARED 1
|
|
typedef __uintptr_t uintptr_t;
|
|
#endif /* not _UINTPTR_T_DECLARED */
|
|
|
|
#ifndef _SSIZE_T_DECLARED
|
|
#define _SSIZE_T_DECLARED 1
|
|
typedef __ssize_t ssize_t;
|
|
#endif /* not _SSIZE_T_DECLARED */
|
|
|
|
#ifndef _INTMAX_T_DECLARED
|
|
#define _INTMAX_T_DECLARED 1
|
|
typedef __intmax_t intmax_t;
|
|
#endif /* not _INTMAX_T_DECLARED */
|
|
|
|
#ifndef _UINTMAX_T_DECLARED
|
|
#define _UINTMAX_T_DECLARED 1
|
|
typedef __uintmax_t uintmax_t;
|
|
#endif /* not _UINTMAX_T_DECLARED */
|
|
|
|
#ifndef _WCHAR_T_DECLARED
|
|
#define _WCHAR_T_DECLARED 1
|
|
typedef ___wchar_t wchar_t;
|
|
#endif /* not _WCHAR_T_DECLARED */
|
|
|
|
#ifndef _WINT_T_DECLARED
|
|
#define _WINT_T_DECLARED 1
|
|
typedef __WINT_TYPE__ wint_t;
|
|
#endif /* not _WINT_T_DECLARED */
|
|
|
|
#ifndef _REGISTER_T_DECLARED
|
|
#define _REGISTER_T_DECLARED 1
|
|
typedef __register_t register_t;
|
|
#endif /* not _REGISTER_T_DECLARED */
|
|
|
|
#ifndef _U_REGISTER_T_DECLARED
|
|
#define _U_REGISTER_T_DECLARED 1
|
|
typedef __u_register_t u_register_t;
|
|
#endif /* not _U_REGISTER_T_DECLARED */
|
|
|
|
/**
|
|
* @brief The primitive atomic integral type.
|
|
* For use with the APIs defined in `arch/atom.h`.
|
|
*/
|
|
typedef struct {
|
|
volatile int _value;
|
|
} atom_t;
|
|
|
|
/** @brief Atom definition body for static initialization of higher level components. */
|
|
#define ATOM_DEFINE(val) { ._value = (val) }
|
|
|
|
/**
|
|
* @brief A long, but atomic.
|
|
* For use with the APIs defined in `arch/atom.h`.
|
|
*/
|
|
typedef struct {
|
|
volatile long _value;
|
|
} latom_t;
|
|
|
|
#define LATOM_DEFINE(val) { ._value = (val) }
|
|
|
|
/**
|
|
* @brief A pointer, but atomic.
|
|
* For use with the APIs defined in `arch/atom.h`.
|
|
*/
|
|
typedef struct {
|
|
void *volatile _ptr;
|
|
} patom_t;
|
|
|
|
#define PATOM_DEFINE(ptr) { ._ptr = (ptr) }
|
|
|
|
#ifndef _PID_T_DECLARED
|
|
#define _PID_T_DECLARED 1
|
|
typedef int pid_t;
|
|
#endif /* not _PID_T_DECLARED */
|