forked from SerenityOS/serenity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0001-Add-serenity-definitions-for-LibC-includes.patch
102 lines (98 loc) 路 2.82 KB
/
0001-Add-serenity-definitions-for-LibC-includes.patch
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Liav A <[email protected]>
Date: Fri, 21 Jul 2023 10:20:46 +0300
Subject: [PATCH] Add serenity definitions for LibC includes
We use the netbsd "acnetbsd.h" file here as a template.
---
source/include/platform/acenv.h | 3 ++
source/include/platform/acserenity.h | 70 ++++++++++++++++++++++++++++
2 files changed, 73 insertions(+)
create mode 100644 source/include/platform/acserenity.h
diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h
index 1fc692db80309b254aea69f42cf4de39b08b7cc8..5db1ea09a5f6c9748af3ba51eed2c2f30126bfc5 100644
--- a/source/include/platform/acenv.h
+++ b/source/include/platform/acenv.h
@@ -320,6 +320,9 @@
#elif defined(__NetBSD__)
#include "acnetbsd.h"
+#elif defined(__serenity__)
+#include "acserenity.h"
+
#elif defined(__sun)
#include "acsolaris.h"
diff --git a/source/include/platform/acserenity.h b/source/include/platform/acserenity.h
new file mode 100644
index 0000000000000000000000000000000000000000..e17f097c5d6d9c0ac228ae7958f31acbb609c8e0
--- /dev/null
+++ b/source/include/platform/acserenity.h
@@ -0,0 +1,70 @@
+#ifndef __ACSERENITY_H__
+#define __ACSERENITY_H__
+
+#define ACPI_UINTPTR_T uintptr_t
+#define ACPI_USE_LOCAL_CACHE
+#define ACPI_CAST_PTHREAD_T(x) ((ACPI_THREAD_ID) ACPI_TO_INTEGER (x))
+
+#ifdef _LP64
+#define ACPI_MACHINE_WIDTH 64
+#else
+#define ACPI_MACHINE_WIDTH 32
+#endif
+
+#define COMPILER_DEPENDENT_INT64 int64_t
+#define COMPILER_DEPENDENT_UINT64 uint64_t
+
+#if defined(_KERNEL) || defined(_STANDALONE)
+#ifdef _KERNEL_OPT
+#include "opt_acpi.h" /* collect build-time options here */
+#endif /* _KERNEL_OPT */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <machine/stdarg.h>
+#include <machine/acpi_func.h>
+
+#define asm __asm
+
+#define ACPI_USE_NATIVE_DIVIDE
+#define ACPI_USE_NATIVE_MATH64
+
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+#ifdef ACPI_DEBUG
+#define ACPI_DEBUG_OUTPUT
+#define ACPI_DBG_TRACK_ALLOCATIONS
+#ifdef DEBUGGER_THREADING
+#undef DEBUGGER_THREADING
+#endif /* DEBUGGER_THREADING */
+#define DEBUGGER_THREADING 0 /* integrated with DDB */
+#include "opt_ddb.h"
+#ifdef DDB
+#define ACPI_DISASSEMBLER
+#define ACPI_DEBUGGER
+#endif /* DDB */
+#endif /* ACPI_DEBUG */
+
+#else /* defined(_KERNEL) || defined(_STANDALONE) */
+
+#include <ctype.h>
+#include <stdint.h>
+
+/* Not building kernel code, so use libc */
+#define ACPI_USE_STANDARD_HEADERS
+
+#define __cli()
+#define __sti()
+#define __cdecl
+
+#endif /* defined(_KERNEL) || defined(_STANDALONE) */
+
+/* Always use NetBSD code over our local versions */
+#define ACPI_USE_SYSTEM_CLIBRARY
+#define ACPI_USE_NATIVE_DIVIDE
+#define ACPI_USE_NATIVE_MATH64
+
+#endif /* __ACSERENITY_H__ */