Skip to content

Commit 6ae4f46

Browse files
committed
Extend the memory main pool to that of a 64-bit system
1 parent 07359de commit 6ae4f46

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

include/platform_info.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#define IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
1111
#endif
1212

13-
#define DOUBLE_SIZE_ON_64_BIT(size) ((size) * (sizeof(void *) / 4))
13+
// Using 8 here instead of sizeof(size_t) to ensure compatibility
14+
#define SIZEOF_POINTER (size_t)8
15+
#define DOUBLE_SIZE_ON_64_BIT(size) ((size) * (SIZEOF_POINTER / 4))
1416

1517
#endif // PLATFORM_INFO_H

src/pc/pc_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ void main_func(void) {
159159
WHBLogPrint("Exception handler initialized.");
160160
#endif
161161

162-
static u64 pool[0x165000/8 / 4 * sizeof(void *)];
163-
main_pool_init(pool, pool + sizeof(pool) / sizeof(pool[0]));
162+
static u8 pool[DOUBLE_SIZE_ON_64_BIT(0x165000)] __attribute__ ((aligned(16)));
163+
main_pool_init(pool, pool + sizeof(pool));
164164
gEffectsMemoryPool = mem_pool_init(0x4000, MEMORY_POOL_LEFT);
165165

166166
configfile_load(CONFIG_FILE);

0 commit comments

Comments
 (0)