From 30763b1e79a0f31aadf100b38e6c4782dda92b0f Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Fri, 10 Jun 2022 13:38:08 -0400 Subject: [PATCH] freebsd_network: Rewrite bus/vm headers to use Haiku phys_addr types directly. Instead of redeclaring them, which it did so incorrectly on systems with PAE in some cases. May fix problems on some 32-bit systems. --- .../freebsd_network/compat/machine/_bus.h | 22 +++------------- .../freebsd_network/compat/machine/x86/bus.h | 4 +++ .../compat/freebsd_network/compat/vm/vm.h | 25 ++++++------------- 3 files changed, 14 insertions(+), 37 deletions(-) diff --git a/src/libs/compat/freebsd_network/compat/machine/_bus.h b/src/libs/compat/freebsd_network/compat/machine/_bus.h index aa577d760b..cac4ad62a9 100644 --- a/src/libs/compat/freebsd_network/compat/machine/_bus.h +++ b/src/libs/compat/freebsd_network/compat/machine/_bus.h @@ -1,6 +1,5 @@ /* - * Copyright 2009, Colin Günther. All Rights Reserved. - * Copyright 2007, Hugo Santos. All Rights Reserved. + * Copyright 2022, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _FBSD_COMPAT_MACHINE__BUS_H_ @@ -11,6 +10,8 @@ typedef phys_addr_t bus_addr_t; +typedef phys_size_t bus_size_t; +typedef addr_t bus_space_handle_t; typedef int bus_space_tag_t; @@ -24,21 +25,4 @@ enum { }; -#ifdef B_HAIKU_64_BIT - -typedef uint64_t bus_size_t; -typedef uint64_t bus_space_handle_t; - -#else - -typedef uint32_t bus_size_t; -typedef unsigned int bus_space_handle_t; - -#if defined(__HAIKU_ARCH_PHYSICAL_64_BIT) && defined(__i386__) -#define PAE 1 -#endif - -#endif - - #endif /* _FBSD_COMPAT_MACHINE__BUS_H_ */ diff --git a/src/libs/compat/freebsd_network/compat/machine/x86/bus.h b/src/libs/compat/freebsd_network/compat/machine/x86/bus.h index 099c142be9..cecde55767 100644 --- a/src/libs/compat/freebsd_network/compat/machine/x86/bus.h +++ b/src/libs/compat/freebsd_network/compat/machine/x86/bus.h @@ -117,6 +117,10 @@ #define BUS_SPACE_MAXSIZE 0xFFFFFFFF #define BUS_SPACE_MAXADDR_24BIT 0xFFFFFF #define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF + +#if defined(__HAIKU_ARCH_PHYSICAL_64_BIT) && defined(__i386__) +#define PAE 1 +#endif #if defined(__amd64__) || defined(PAE) #define BUS_SPACE_MAXADDR 0xFFFFFFFFFFFFFFFFULL #else diff --git a/src/libs/compat/freebsd_network/compat/vm/vm.h b/src/libs/compat/freebsd_network/compat/vm/vm.h index 56eef91da4..90ab6dffe9 100644 --- a/src/libs/compat/freebsd_network/compat/vm/vm.h +++ b/src/libs/compat/freebsd_network/compat/vm/vm.h @@ -1,36 +1,25 @@ /* - * Copyright 2007, Hugo Santos. All Rights Reserved. + * Copyright 2022, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _FBSD_COMPAT_VM_VM_H_ #define _FBSD_COMPAT_VM_VM_H_ -#include #include -#ifdef B_HAIKU_64_BIT +typedef phys_addr_t vm_paddr_t; +typedef addr_t vm_offset_t; -typedef uint64_t vm_offset_t; -typedef uint64_t vm_paddr_t; - -#else - -typedef uint32_t vm_offset_t; -typedef uint32_t vm_paddr_t; - -#endif - -typedef void *pmap_t; - - -#define vmspace_pmap(...) NULL -#define pmap_extract(...) NULL +typedef void* pmap_t; vm_paddr_t pmap_kextract(vm_offset_t virtualAddress); #define vtophys(virtualAddress) pmap_kextract((vm_offset_t)(virtualAddress)) +#define vmspace_pmap(...) NULL +#define pmap_extract(...) NULL + #endif /* _FBSD_COMPAT_VM_VM_H_ */