From 061ebd0b15145c9cda0d5952dacd12900deac396 Mon Sep 17 00:00:00 2001 From: Liav A Date: Fri, 14 Jul 2023 16:13:55 +0300 Subject: [PATCH] Ports: Update acpica-tools to use other upstream Also, update it to the latest revision, which makes it possible to build without most of the patches we needed before, but now we need our own definitions for LibC includes and to disable errors for the warning bad-function-cast. --- Ports/AvailablePorts.md | 2 +- Ports/acpica-tools/package.sh | 6 +- ...ompiler-warnings-on-dangling-pointer.patch | 14 ++- ...renity-definitions-for-LibC-includes.patch | 102 ++++++++++++++++++ ...debug-message-with-formatting-issues.patch | 26 ----- ...arnings-for-Werror-bad-function-cast.patch | 21 ++++ ...-Fix-printf-bad-specifier-formatting.patch | 33 ------ Ports/acpica-tools/patches/ReadMe.md | 19 ++-- 8 files changed, 141 insertions(+), 82 deletions(-) create mode 100644 Ports/acpica-tools/patches/0002-Add-serenity-definitions-for-LibC-includes.patch delete mode 100644 Ports/acpica-tools/patches/0002-Disable-sprintf-debug-message-with-formatting-issues.patch create mode 100644 Ports/acpica-tools/patches/0003-Disable-warnings-for-Werror-bad-function-cast.patch delete mode 100644 Ports/acpica-tools/patches/0003-Fix-printf-bad-specifier-formatting.patch diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index 0d2551f702f..7e84ca3a75c 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -7,7 +7,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | Port | Name | Version | Website | |-----------------------------------------------------|-----------------------------------------------------------------|---------------------------|--------------------------------------------------------------------------------| | [`aclock`](aclock/) | aclock | 2.3 | https://github.com/tenox7/aclock | -| [`acpica-tools`](acpica-tools/) | ACPI Component Architecture Project Userspace Utilities | 20220331 | https://acpica.org/downloads | +| [`acpica-tools`](acpica-tools/) | ACPI Component Architecture Project Userspace Utilities | R06_28_23 | https://github.com/acpica/acpica | | [`alpine`](alpine/) | Alpine Email Client | 2.26 | https://alpineapp.email | | [`angband`](angband/) | Angband | 4.2.4 | https://rephial.org | | [`Another-World`](Another-World/) | Another World Bytecode Interpreter | | https://github.com/fabiensanglard/Another-World-Bytecode-Interpreter | diff --git a/Ports/acpica-tools/package.sh b/Ports/acpica-tools/package.sh index 36676f8b492..ff117049749 100755 --- a/Ports/acpica-tools/package.sh +++ b/Ports/acpica-tools/package.sh @@ -1,8 +1,8 @@ #!/usr/bin/env -S bash ../.port_include.sh port=acpica-tools -version=20220331 -workdir="acpica-unix-${version}" -files="https://acpica.org/sites/acpica/files/acpica-unix-${version}.tar.gz acpica-unix-${version}.tar.gz acaff68b14f1e0804ebbfc4b97268a4ccbefcfa053b02ed9924f2b14d8a98e21" +version='R06_28_23' +workdir="acpica-${version}" +files="https://github.com/acpica/acpica/archive/refs/tags/${version}.tar.gz acpica-${version}.tar.gz 2248799b7ca08a7711ac87d31924354ed49047507607d033bd327ba861ec4d31" build() { diff --git a/Ports/acpica-tools/patches/0001-Stop-compiler-warnings-on-dangling-pointer.patch b/Ports/acpica-tools/patches/0001-Stop-compiler-warnings-on-dangling-pointer.patch index 72e8ccfd0f4..a2ed157395e 100644 --- a/Ports/acpica-tools/patches/0001-Stop-compiler-warnings-on-dangling-pointer.patch +++ b/Ports/acpica-tools/patches/0001-Stop-compiler-warnings-on-dangling-pointer.patch @@ -1,16 +1,14 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Liav A -Date: Fri, 27 May 2022 10:18:35 +0300 +Date: Fri, 14 Jul 2023 16:05:27 +0300 Subject: [PATCH] Stop compiler warnings on dangling pointer -Use static variable to prevent using a dangling pointer from a previous -stack trace. --- - source/components/utilities/utdebug.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + source/components/utilities/utdebug.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/components/utilities/utdebug.c b/source/components/utilities/utdebug.c -index f789e68..fd18f5c 100644 +index 82e8a62050beec30d3b067a8516bb23f3808182a..f4b40bb5b10e8e3d9bf3d60b7332ba70aa40a2c6 100644 --- a/source/components/utilities/utdebug.c +++ b/source/components/utilities/utdebug.c @@ -182,7 +182,7 @@ void @@ -21,8 +19,8 @@ index f789e68..fd18f5c 100644 + static ACPI_SIZE CurrentSp; - AcpiGbl_EntryStackPointer = &CurrentSp; -@@ -205,7 +205,7 @@ void + #pragma GCC diagnostic push +@@ -210,7 +210,7 @@ void AcpiUtTrackStackPtr ( void) { diff --git a/Ports/acpica-tools/patches/0002-Add-serenity-definitions-for-LibC-includes.patch b/Ports/acpica-tools/patches/0002-Add-serenity-definitions-for-LibC-includes.patch new file mode 100644 index 00000000000..427d3426bd2 --- /dev/null +++ b/Ports/acpica-tools/patches/0002-Add-serenity-definitions-for-LibC-includes.patch @@ -0,0 +1,102 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Liav A +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 ++#include ++#include ++#include ++ ++#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 ++#include ++ ++/* 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__ */ diff --git a/Ports/acpica-tools/patches/0002-Disable-sprintf-debug-message-with-formatting-issues.patch b/Ports/acpica-tools/patches/0002-Disable-sprintf-debug-message-with-formatting-issues.patch deleted file mode 100644 index 5123068e780..00000000000 --- a/Ports/acpica-tools/patches/0002-Disable-sprintf-debug-message-with-formatting-issues.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Liav A -Date: Fri, 27 May 2022 10:19:35 +0300 -Subject: [PATCH] Disable sprintf debug message with formatting issues - ---- - source/compiler/dtfield.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/source/compiler/dtfield.c b/source/compiler/dtfield.c -index f931631..f9fb310 100644 ---- a/source/compiler/dtfield.c -+++ b/source/compiler/dtfield.c -@@ -280,9 +280,9 @@ DtCompileString ( - - if (Length > ByteLength) - { -- sprintf (AslGbl_MsgBuffer, -- "Maximum %u characters, found %u characters [%s]", -- ByteLength, Length, Field->Value); -+ //sprintf (AslGbl_MsgBuffer, -+ // "Maximum %u characters, found %u characters [%s]", -+ // ByteLength, Length, Field->Value); - DtError (ASL_ERROR, ASL_MSG_STRING_LENGTH, Field, AslGbl_MsgBuffer); - Length = ByteLength; - } diff --git a/Ports/acpica-tools/patches/0003-Disable-warnings-for-Werror-bad-function-cast.patch b/Ports/acpica-tools/patches/0003-Disable-warnings-for-Werror-bad-function-cast.patch new file mode 100644 index 00000000000..84d94d397c7 --- /dev/null +++ b/Ports/acpica-tools/patches/0003-Disable-warnings-for-Werror-bad-function-cast.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Liav A +Date: Fri, 21 Jul 2023 10:27:26 +0300 +Subject: [PATCH] Disable warnings for Werror=bad-function-cast + +--- + generate/unix/Makefile.config | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/generate/unix/Makefile.config b/generate/unix/Makefile.config +index 0deeb14115c1473ef0e1b55f6e174122ae52633d..0374e09d880f0ecec165acc32e7b30a4dbb0c8cc 100644 +--- a/generate/unix/Makefile.config ++++ b/generate/unix/Makefile.config +@@ -202,6 +202,7 @@ CWARNINGFLAGS = \ + -std=c99\ + -Wall\ + -Wbad-function-cast\ ++ -Wno-error=bad-function-cast\ + -Wdeclaration-after-statement\ + -Wformat=2\ + -Wmissing-declarations\ diff --git a/Ports/acpica-tools/patches/0003-Fix-printf-bad-specifier-formatting.patch b/Ports/acpica-tools/patches/0003-Fix-printf-bad-specifier-formatting.patch deleted file mode 100644 index c79c60efbc3..00000000000 --- a/Ports/acpica-tools/patches/0003-Fix-printf-bad-specifier-formatting.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Liav A -Date: Fri, 27 May 2022 22:00:38 +0300 -Subject: [PATCH] Fix printf bad specifier formatting - -Fix sprintf specifier being written in a bad format leading to iASL to -crash. ---- - source/common/dmtable.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/source/common/dmtable.c b/source/common/dmtable.c -index 440c5fb..d722e3d 100644 ---- a/source/common/dmtable.c -+++ b/source/common/dmtable.c -@@ -977,7 +977,7 @@ AcpiDmLineHeader ( - { - if (ByteLength) - { -- AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ", -+ AcpiOsPrintf ("[%3.3Xh %4.4d %4d] %28s : ", - Offset, Offset, ByteLength, Name); - } - else -@@ -1011,7 +1011,7 @@ AcpiDmLineHeader2 ( - } - else - { -- AcpiOsPrintf ("%36s % 3d : ", -+ AcpiOsPrintf ("%36s %3d : ", - Name, Value); - } - } diff --git a/Ports/acpica-tools/patches/ReadMe.md b/Ports/acpica-tools/patches/ReadMe.md index 583cd026a97..e481996e9e6 100644 --- a/Ports/acpica-tools/patches/ReadMe.md +++ b/Ports/acpica-tools/patches/ReadMe.md @@ -4,18 +4,15 @@ Stop compiler warnings on dangling pointer -Use static variable to prevent using a dangling pointer from a previous -stack trace. -## `0002-Disable-sprintf-debug-message-with-formatting-issues.patch` +## `0002-Add-serenity-definitions-for-LibC-includes.patch` -Disable sprintf debug message with formatting issues +Add serenity definitions for LibC includes + +We use the netbsd "acnetbsd.h" file here as a template. + +## `0003-Disable-warnings-for-Werror-bad-function-cast.patch` + +Disable warnings for Werror=bad-function-cast -## `0003-Fix-printf-bad-specifier-formatting.patch` - -Fix printf bad specifier formatting - -Fix sprintf specifier being written in a bad format leading to iASL to -crash. -