-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.h
More file actions
38 lines (30 loc) · 1.14 KB
/
Copy pathcommon.h
File metadata and controls
38 lines (30 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once
#define va_list __builtin_va_list
#define va_start __builtin_va_start
#define va_end __builtin_va_end
#define va_arg __builtin_va_arg
typedef int bool;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
typedef uint32_t size_t;
typedef uint32_t vaddr_t;
typedef uint32_t paddr_t;
// paddr_t is a type representing physical memory addresses.
// vaddr_t is for Virtual memory == uintprt_t in STL
#define true 1
#define false 0
#define NULL ((void*)0)
#define align_up(value, align) __builtin_align_up(value, align)
#define offset_of(type, member) __builtin_offsetof(type, member)
#define is_aligned(value, align) __builtin_is_aligned(value, align)
#define PAGE_SIZE 4096
// align_up rounds up to nearsert multiple of align. (2)
// is_aligned checks if value is a multiple of align.
// offsetof returns the offset of a member within a structure.
void *memset(void *buf, char c,size_t n);
void *memcpy(void *dst, const void *src, size_t n);
char *strcpy(char *dst, const char *src);
int strcmp(const char *s1, const char* s2);
void printf(const char *fmt, ...);