:: commit 717af1ff8791ec4676a2522641ace2720a7be08f

mintsuki <mintsuki@protonmail.com> — 2021-01-02 22:05

parents: 79a9f31ceb

file: Make sure file buffers are aligned and of the right type

diff --git a/limine-pxe.bin b/limine-pxe.bin
index 024e20c7..8d2e26d5 100644
Binary files a/limine-pxe.bin and b/limine-pxe.bin differ
diff --git a/limine.bin b/limine.bin
index 774e3217..ef6639b2 100644
Binary files a/limine.bin and b/limine.bin differ
diff --git a/stage2.map b/stage2.map
index c996646c..d9c5f4ff 100644
Binary files a/stage2.map and b/stage2.map differ
diff --git a/stage2/fs/file.c b/stage2/fs/file.c
index 6606e3cf..491fdde5 100644
--- a/stage2/fs/file.c
+++ b/stage2/fs/file.c
@@ -81,7 +81,7 @@ void *freadall(struct file_handle *fd, uint32_t type) {
         memmap_alloc_range((uint64_t)(size_t)fd->fd, fd->size, type, false);
         return fd->fd;
     } else {
-        void *ret = ext_mem_alloc(fd->size);
+        void *ret = ext_mem_alloc_aligned_type(fd->size, 4096, type);
         if (fd->read(fd->fd, ret, 0, fd->size)) {
             panic("freadall error");
         }
diff --git a/stage2/lib/uri.c b/stage2/lib/uri.c
index 56f3167b..bb88e4f2 100644
--- a/stage2/lib/uri.c
+++ b/stage2/lib/uri.c
@@ -209,7 +209,7 @@ bool uri_open(struct file_handle *fd, char *uri) {
     if (compressed && ret) {
         struct file_handle compressed_fd = {0};
         fread(fd, &compressed_fd.size, fd->size - 4, sizeof(uint32_t));
-        compressed_fd.fd = ext_mem_alloc(compressed_fd.size);
+        compressed_fd.fd = ext_mem_alloc_aligned(compressed_fd.size, 4096);
         void *src = ext_mem_alloc(fd->size);
         fread(fd, src, 0, fd->size);
         if (tinf_gzip_uncompress(compressed_fd.fd, src, fd->size))
tab: 248 wrap: offon