:: commit 9c0229dcf1c051badb34d634689cb41f7cd7b456

mintsuki <mintsuki@protonmail.com> — 2024-07-30 10:00

parents: 52e4b8e25c

fs/file: Fix IA-32 highly alloced return when returning a ptr to mem file

diff --git a/common/fs/file.s2.c b/common/fs/file.s2.c
index 2b9b251c..356654a3 100644
--- a/common/fs/file.s2.c
+++ b/common/fs/file.s2.c
@@ -118,10 +118,22 @@ void *freadall_mode(struct file_handle *fd, uint32_t type, bool allow_high_alloc
 
     if (fd->is_memfile) {
         if (fd->readall) {
+#if defined (__i386__)
+            if (allow_high_allocs == true) {
+                high_ret = (uintptr_t)fd->fd;
+                return &high_ret;
+            }
+#endif
             return fd->fd;
         }
         memmap_alloc_range((uint64_t)(size_t)fd->fd, ALIGN_UP(fd->size, 4096), type, 0, true, false, false);
         fd->readall = true;
+#if defined (__i386__)
+        if (allow_high_allocs == true) {
+            high_ret = (uintptr_t)fd->fd;
+            return &high_ret;
+        }
+#endif
         return fd->fd;
     } else {
         void *ret = ext_mem_alloc_type_aligned_mode(fd->size, type, 4096, allow_high_allocs);
tab: 248 wrap: offon