Skip to content

Commit

Permalink
fs/file: Fix IA-32 highly alloced return when returning a ptr to mem …
Browse files Browse the repository at this point in the history
…file
  • Loading branch information
mintsuki committed Jul 30, 2024
1 parent 52e4b8e commit 9c0229d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions common/fs/file.s2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9c0229d

Please sign in to comment.