diff --git a/src/kernel/apps/rld/rldelf.c b/src/kernel/apps/rld/rldelf.c index e97c7aef78..0bb30e753e 100644 --- a/src/kernel/apps/rld/rldelf.c +++ b/src/kernel/apps/rld/rldelf.c @@ -50,6 +50,8 @@ #define PAGE_BASE(x) ((x) & ~(PAGE_MASK)) #define TO_PAGE_SIZE(x) ((x + (PAGE_MASK)) & ~(PAGE_MASK)) +#define RLD_PROGRAM_BASE 0x00200000 + /* keep in sync with app ldscript */ enum { RFLAG_RW = 0x0001, @@ -563,23 +565,17 @@ map_image(int fd, char const *path, image_t *image, bool fixed) baseName, i, (image->regions[i].flags & RFLAG_RW) ? "rw" : "ro"); if (image->dynamic_ptr && !fixed) { - /* - * relocatable image... we can afford to place wherever - */ + // relocatable image... we can afford to place wherever if (i == 0) { - /* - * but only the first segment gets a free ride - */ - loadAddress = 0; - addressSpecifier = B_ANY_ADDRESS; + // but only the first segment gets a free ride + loadAddress = RLD_PROGRAM_BASE; + addressSpecifier = B_BASE_ADDRESS; } else { loadAddress = image->regions[i].vmstart + image->regions[i-1].delta; addressSpecifier = B_EXACT_ADDRESS; } } else { - /* - * not relocatable, put it where it asks or die trying - */ + // not relocatable, put it where it asks or die trying loadAddress = image->regions[i].vmstart; addressSpecifier = B_EXACT_ADDRESS; } @@ -608,9 +604,7 @@ map_image(int fd, char const *path, image_t *image, bool fixed) image->regions[i].delta = loadAddress - image->regions[i].vmstart; image->regions[i].vmstart = loadAddress; - /* - * handle trailer bits in data segment - */ + // handle trailer bits in data segment if (image->regions[i].flags & RFLAG_RW) { addr_t startClearing; addr_t toClear; diff --git a/src/kernel/apps/rld/rldheap.c b/src/kernel/apps/rld/rldheap.c index e2a4949e1d..8b066ddaa6 100644 --- a/src/kernel/apps/rld/rldheap.c +++ b/src/kernel/apps/rld/rldheap.c @@ -10,13 +10,10 @@ #define RLD_SCRATCH_SIZE 65536 -#define RLD_PROGRAM_BASE 0x00200000 /* keep in sync with app ldscript */ static area_id rld_region; -static area_id rld_region_2; static char *rld_base; -static char *rld_base_2; static char *rld_ptr; @@ -27,18 +24,6 @@ rldheap_init(void) (void **)&rld_base, B_ANY_ADDRESS, RLD_SCRATCH_SIZE, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); - /* - * Fill in the gap upto RLD_PROGRAM_BASE, - * - * NOTE: this will be required only untile the vm finally - * support REGION_ADDR_ANY_ABOVE and REGION_ADDR_ANY_BELOW. - * Not doing these leads to some funny troubles with some - * libraries. - */ - rld_region_2 = _kern_create_area("RLD_padding", (void **)&rld_base_2, - B_ANY_ADDRESS, RLD_PROGRAM_BASE - (uint32)(rld_base + RLD_SCRATCH_SIZE), - B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); - rld_ptr = rld_base; }