git: ace710d002f0 - stable/12 - stand/ficl 64-bit compatibility

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Fri, 08 Oct 2021 16:08:55 UTC
The branch stable/12 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=ace710d002f0353a401d9b68661861e2fbdc2f89

commit ace710d002f0353a401d9b68661861e2fbdc2f89
Author:     Brandon Bergren <bdragon@FreeBSD.org>
AuthorDate: 2020-09-14 15:48:30 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-10-08 07:59:34 +0000

    stand/ficl 64-bit compatibility
    
    Currently, the only thing that prevents a functioning 64-bit FICL build is
    a few integer types that were intended to be fixed-width.
    
    Changing them to C99 integer types allows building a functioning 64-bit
    FICL.
    
    While this isn't applicable to the default settings of any in-tree loaders,
    it is necessary for a future Petitboot loader, due to the requirement that
    it be compiled as a 64-bit program.
    
    (cherry picked from commit 9e4c35f867aca020df8d01fb7371bf5ae1cc8a2d)
    (cherry picked from commit 0ebbda971890c149c5028066fc5ed7ea72228d87)
---
 stand/ficl/ficl.h           | 2 +-
 stand/ficl/powerpc/sysdep.h | 9 ++++++---
 stand/powerpc/ofw/main.c    | 2 +-
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/stand/ficl/ficl.h b/stand/ficl/ficl.h
index a6f8f03c5732..97cf00b0dff3 100644
--- a/stand/ficl/ficl.h
+++ b/stand/ficl/ficl.h
@@ -249,7 +249,7 @@ typedef struct ficl_system_info FICL_SYSTEM_INFO;
 ** complement of false... that unifies logical and bitwise operations
 ** nicely.
 */
-#define FICL_TRUE  ((unsigned long)~(0L))
+#define FICL_TRUE  (~(FICL_UNS)0)
 #define FICL_FALSE (0)
 #define FICL_BOOL(x) ((x) ? FICL_TRUE : FICL_FALSE)
 
diff --git a/stand/ficl/powerpc/sysdep.h b/stand/ficl/powerpc/sysdep.h
index 3ae748e259c7..b31625e18649 100644
--- a/stand/ficl/powerpc/sysdep.h
+++ b/stand/ficl/powerpc/sysdep.h
@@ -79,15 +79,15 @@
 ** System dependent data type declarations...
 */
 #if !defined INT32
-#define INT32 int
+#define INT32 int32_t
 #endif
 
 #if !defined UNS32
-#define UNS32 unsigned int
+#define UNS32 uint32_t
 #endif
 
 #if !defined UNS16
-#define UNS16 unsigned short
+#define UNS16 uint16_t
 #endif
 
 #if !defined UNS8
@@ -367,6 +367,9 @@ typedef struct
 */
 #if !defined FICL_ALIGN
 #define FICL_ALIGN 2
+#endif
+
+#if !defined FICL_ALIGN_ADD
 #define FICL_ALIGN_ADD ((1 << FICL_ALIGN) - 1)
 #endif
 
diff --git a/stand/powerpc/ofw/main.c b/stand/powerpc/ofw/main.c
index 93a439f8f609..4803cb06d376 100644
--- a/stand/powerpc/ofw/main.c
+++ b/stand/powerpc/ofw/main.c
@@ -63,7 +63,7 @@ init_heap(void)
 {
 	bzero(heap, HEAP_SIZE);
 
-	setheap(heap, (void *)((int)heap + HEAP_SIZE));
+	setheap(heap, (void *)((uintptr_t)heap + HEAP_SIZE));
 }
 
 uint64_t