diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2005-01-14 15:32:45 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2005-01-14 15:32:45 +0000 |
commit | 551a3f4ee04e914f83789e94c86d53517d73ab92 (patch) | |
tree | 384ef0894c0e900668d597e4e59d5847afd752ab /distrib/common/elfrdsetroot.c | |
parent | 69a83df7bdf09a74883d4e163cd25b9318dfec75 (diff) |
Allows for VA!=PA addresses in the kernel. ok deraadt@
Diffstat (limited to 'distrib/common/elfrdsetroot.c')
-rw-r--r-- | distrib/common/elfrdsetroot.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/distrib/common/elfrdsetroot.c b/distrib/common/elfrdsetroot.c index 2d8c5b56e37..1ea4f36c009 100644 --- a/distrib/common/elfrdsetroot.c +++ b/distrib/common/elfrdsetroot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: elfrdsetroot.c,v 1.8 2005/01/14 08:27:22 deraadt Exp $ */ +/* $OpenBSD: elfrdsetroot.c,v 1.9 2005/01/14 15:32:44 drahn Exp $ */ /* $NetBSD: rdsetroot.c,v 1.2 1995/10/13 16:38:39 gwr Exp $ */ /* @@ -221,11 +221,19 @@ find_rd_root_image(file, eh, ph) kernel_start = ph->p_paddr; kernel_size = ph->p_filesz; - rd_root_size_off = wantsyms[0].n_value - kernel_start; - rd_root_image_off = wantsyms[1].n_value - kernel_start; + rd_root_size_off = wantsyms[0].n_value - kernel_start; + rd_root_size_off -= (ph->p_vaddr - ph->p_paddr); + rd_root_image_off = wantsyms[1].n_value - kernel_start; + rd_root_image_off -= (ph->p_vaddr - ph->p_paddr); #ifdef DEBUG printf("rd_root_size_off = 0x%x\n", rd_root_size_off); + if ((ph->p_vaddr - ph->p_paddr) != 0) + printf("root_off v %x p %x, diff %x altered %x\n", + ph->p_vaddr, ph->p_paddr, + (ph->p_vaddr - ph->p_paddr), + rd_root_size_off - (ph->p_vaddr - ph->p_paddr)); + printf("rd_root_image_off = 0x%x\n", rd_root_image_off); #endif |