|
@@ -338,14 +338,16 @@ int Process::do_exec(String path, Vector<String> arguments, Vector<String> envir
|
|
loader.map_section_hook = [&] (LinearAddress laddr, size_t size, size_t alignment, size_t offset_in_image, bool is_readable, bool is_writable, const String& name) {
|
|
loader.map_section_hook = [&] (LinearAddress laddr, size_t size, size_t alignment, size_t offset_in_image, bool is_readable, bool is_writable, const String& name) {
|
|
ASSERT(size);
|
|
ASSERT(size);
|
|
ASSERT(alignment == PAGE_SIZE);
|
|
ASSERT(alignment == PAGE_SIZE);
|
|
- size = ((size / 4096) + 1) * 4096; // FIXME: Use ceil_div?
|
|
|
|
|
|
+ size = ceil_div(size, PAGE_SIZE) * PAGE_SIZE;
|
|
(void) allocate_region_with_vmo(laddr, size, vmo.copy_ref(), offset_in_image, String(name), is_readable, is_writable);
|
|
(void) allocate_region_with_vmo(laddr, size, vmo.copy_ref(), offset_in_image, String(name), is_readable, is_writable);
|
|
return laddr.as_ptr();
|
|
return laddr.as_ptr();
|
|
};
|
|
};
|
|
loader.alloc_section_hook = [&] (LinearAddress laddr, size_t size, size_t alignment, bool is_readable, bool is_writable, const String& name) {
|
|
loader.alloc_section_hook = [&] (LinearAddress laddr, size_t size, size_t alignment, bool is_readable, bool is_writable, const String& name) {
|
|
ASSERT(size);
|
|
ASSERT(size);
|
|
ASSERT(alignment == PAGE_SIZE);
|
|
ASSERT(alignment == PAGE_SIZE);
|
|
- size = ((size / 4096) + 1) * 4096; // FIXME: Use ceil_div?
|
|
|
|
|
|
+ size += laddr.get() & 0xfff;
|
|
|
|
+ laddr.mask(0xffff000);
|
|
|
|
+ size = ceil_div(size, PAGE_SIZE) * PAGE_SIZE;
|
|
(void) allocate_region(laddr, size, String(name), is_readable, is_writable);
|
|
(void) allocate_region(laddr, size, String(name), is_readable, is_writable);
|
|
return laddr.as_ptr();
|
|
return laddr.as_ptr();
|
|
};
|
|
};
|