bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/5] acpica: Add config for GNU


From: Samuel Thibault
Subject: Re: [PATCH 2/5] acpica: Add config for GNU
Date: Wed, 31 Mar 2021 23:53:01 +0200
User-agent: NeoMutt/20170609 (1.8.3)

Damien Zammit, le jeu. 01 avril 2021 00:23:27 +1100, a ecrit:
> +++ b/libacpica/acpi/platform/acgnu.h

Note that since this file includes code from other files, it *has* to
carry the license notice of the files the code comes from. See the
licensing terms of those files.

I'm wondering whether this should rather be called acposix? Or at least
an acposix.h file be created to hold everything that is not specific to
GNU/Hurd? Notably

> +#include <pthread.h>
> +#include <stdint.h>
> +#include <malloc.h>
> +#include <string.h>
> +#include <ctype.h>
> +typedef uint8_t u8;
> +typedef uint16_t u16;
> +typedef uint32_t u32;
> +typedef uint64_t u64;
> +typedef int8_t s8;
> +typedef int16_t s16;
> +typedef int32_t s32;
> +typedef int64_t s64;


> +/* Host-dependent types and defines for in-kernel ACPICA */
> +
> +#if defined(__ia64__) || (defined(__x86_64__) && !defined(__ILP32__))

Replace it with #if INTPTR_MAX == 9223372036854775807L

> +#define ACPI_MACHINE_WIDTH          64
> +#else
> +#define ACPI_MACHINE_WIDTH          32
> +#endif



> +#if defined(__ia64__)    || (defined(__x86_64__) && !defined(__ILP32__)) ||\
> +     defined(__aarch64__) || defined(__PPC64__) ||\
> +     defined(__s390x__)

Ditto.

> +++ b/libacpica/acpi/platform/acgnuex.h

Similarly, parts of these could go to an acposix.h

> +#define acpi_os_create_lock(__handle) \
> +     ({ \
> +             pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; \
> +             *(__handle) = lock; \

Rather call pthread_mutex_init(), it will be less eye-frowning.

> +static inline void *acpi_os_allocate_zeroed(acpi_size size)
> +{
> +     void *mem = malloc (size);
> +     memset (mem, 0, size);
> +     return mem;
> +}

Rather use calloc, which can optimize it for large allocations.

> +static inline acpi_thread_id acpi_os_get_thread_id(void)
> +{
> +     // FIXME
> +     return 0;
> +}

You can use pthread_self().

> +static inline u8 acpi_os_readable(void *pointer, acpi_size length)
> +{
> +     return TRUE;

Strictly speaking, you can use vm_region to get VM information on a
given address range.

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]