file: Make sure file buffers are aligned and of the right type
This commit is contained in:
parent
79a9f31ceb
commit
717af1ff87
BIN
limine-pxe.bin
BIN
limine-pxe.bin
Binary file not shown.
BIN
limine.bin
BIN
limine.bin
Binary file not shown.
BIN
stage2.map
BIN
stage2.map
Binary file not shown.
@ -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);
|
memmap_alloc_range((uint64_t)(size_t)fd->fd, fd->size, type, false);
|
||||||
return fd->fd;
|
return fd->fd;
|
||||||
} else {
|
} 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)) {
|
if (fd->read(fd->fd, ret, 0, fd->size)) {
|
||||||
panic("freadall error");
|
panic("freadall error");
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ bool uri_open(struct file_handle *fd, char *uri) {
|
|||||||
if (compressed && ret) {
|
if (compressed && ret) {
|
||||||
struct file_handle compressed_fd = {0};
|
struct file_handle compressed_fd = {0};
|
||||||
fread(fd, &compressed_fd.size, fd->size - 4, sizeof(uint32_t));
|
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);
|
void *src = ext_mem_alloc(fd->size);
|
||||||
fread(fd, src, 0, fd->size);
|
fread(fd, src, 0, fd->size);
|
||||||
if (tinf_gzip_uncompress(compressed_fd.fd, src, fd->size))
|
if (tinf_gzip_uncompress(compressed_fd.fd, src, fd->size))
|
||||||
|
Loading…
Reference in New Issue
Block a user