serenity/Ports/acpica-tools/patches/0001-Add-serenity-definitions-for-LibC-includes.patch
Tim Schumacher 1875d373e5 Ports/acpica-tools: Don't treat warnings as errors
This also removes existing patches that were trying to fix warnings
one-by-one.

Note that the patch making `CurrentSp` static was incorrect, the
variable needs to be on the stack for us to retrieve the current stack
address.
2023-09-09 11:28:59 -06:00

102 lines
2.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Liav A <liavalb@gmail.com>
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__ */