misc: Remove unnecessary ifdefs added in previous commits

This commit is contained in:
mintsuki 2023-10-05 07:25:02 -05:00
parent b474b6bad0
commit c1f5b21177
5 changed files with 3 additions and 15 deletions

View File

@ -36,8 +36,6 @@ struct file_handle *fopen(struct volume *part, const char *filename);
void fread(struct file_handle *fd, void *buf, uint64_t loc, uint64_t count);
void fclose(struct file_handle *fd);
void *freadall(struct file_handle *fd, uint32_t type);
#if defined (__x86_64__) || defined (__aarch64__) || defined (__riscv64)
void *freadall_mode(struct file_handle *fd, uint32_t type, bool allow_high_allocs);
#endif
#endif

View File

@ -96,12 +96,10 @@ void fread(struct file_handle *fd, void *buf, uint64_t loc, uint64_t count) {
}
void *freadall(struct file_handle *fd, uint32_t type) {
#if defined (__x86_64__) || defined (__aarch64__) || defined (__riscv64)
return freadall_mode(fd, type, false);
}
void *freadall_mode(struct file_handle *fd, uint32_t type, bool allow_high_allocs) {
#endif
if (fd->is_memfile) {
if (fd->readall) {
return fd->fd;
@ -110,11 +108,7 @@ void *freadall_mode(struct file_handle *fd, uint32_t type, bool allow_high_alloc
fd->readall = true;
return fd->fd;
} else {
#if defined (__x86_64__) || defined (__aarch64__) || defined (__riscv64)
void *ret = ext_mem_alloc_type_aligned_mode(fd->size, type, 4096, allow_high_allocs);
#else
void *ret = ext_mem_alloc_type_aligned(fd->size, type, 4096);
#endif
fd->read(fd, ret, 0, fd->size);
fd->close(fd);
fd->fd = ret;

View File

@ -56,9 +56,7 @@ void pmm_randomise_memory(void);
void *ext_mem_alloc(size_t count);
void *ext_mem_alloc_type(size_t count, uint32_t type);
void *ext_mem_alloc_type_aligned(size_t count, uint32_t type, size_t alignment);
#if defined (__x86_64__) || defined (__aarch64__) || defined (__riscv64)
void *ext_mem_alloc_type_aligned_mode(size_t count, uint32_t type, size_t alignment, bool allow_high_allocs);
#endif
void *conv_mem_alloc(size_t count);

View File

@ -568,13 +568,15 @@ void *ext_mem_alloc_type(size_t count, uint32_t type) {
}
void *ext_mem_alloc_type_aligned(size_t count, uint32_t type, size_t alignment) {
#if defined (__x86_64__) || defined (__aarch64__) || defined (__riscv64)
return ext_mem_alloc_type_aligned_mode(count, type, alignment, false);
}
// Allocate memory top down.
void *ext_mem_alloc_type_aligned_mode(size_t count, uint32_t type, size_t alignment, bool allow_high_allocs) {
#if !defined (__x86_64__) && !defined (__aarch64__) && !defined (__riscv64)
(void)allow_high_allocs;
#endif
count = ALIGN_UP(count, alignment);
if (allocations_disallowed)

View File

@ -250,11 +250,7 @@ static struct limine_file get_file(struct file_handle *file, char *cmdline) {
ret.path = reported_addr(path);
#if defined (__x86_64__) || defined (__aarch64__) || defined (__riscv64)
ret.address = reported_addr(freadall_mode(file, MEMMAP_KERNEL_AND_MODULES, true));
#else
ret.address = reported_addr(freadall(file, MEMMAP_KERNEL_AND_MODULES));
#endif
ret.size = file->size;
ret.cmdline = reported_addr(cmdline);