From 6a48d31676e3d36c231cd532873e6d3678445f6d Mon Sep 17 00:00:00 2001 From: manu Date: Sun, 10 Mar 2002 19:03:08 +0000 Subject: [PATCH] Fix a bug in the way syssgi(MAPELF) handles relocation: we are supposed to look for a block of free virtual memory big enough to hold all sections. The blocks starts at the beginning of the first section and ends at the end of the last section. In the previous version the block ended at the beginning of the last section, hence creating situations where there was not enough free space to map the section. --- sys/compat/irix/irix_syssgi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/compat/irix/irix_syssgi.c b/sys/compat/irix/irix_syssgi.c index aa11efc1defc..cf4fa26508a7 100644 --- a/sys/compat/irix/irix_syssgi.c +++ b/sys/compat/irix/irix_syssgi.c @@ -1,4 +1,4 @@ -/* $NetBSD: irix_syssgi.c,v 1.17 2002/02/23 22:35:15 manu Exp $ */ +/* $NetBSD: irix_syssgi.c,v 1.18 2002/03/10 19:03:08 manu Exp $ */ /*- * Copyright (c) 2001-2002 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: irix_syssgi.c,v 1.17 2002/02/23 22:35:15 manu Exp $"); +__KERNEL_RCSID(0, "$NetBSD: irix_syssgi.c,v 1.18 2002/03/10 19:03:08 manu Exp $"); #include "opt_ddb.h" @@ -281,8 +281,8 @@ irix_syssgi_mapelf(fd, ph, count, p, retval) * (And also that the sections are not overlapping) */ pht--; - size = (pht->p_vaddr & ~(pht->p_align - 1)) + pht->p_align - - kph->p_vaddr; + size = ELF_ROUND((pht->p_vaddr + pht->p_memsz), pht->p_align) - + ELF_TRUNC(kph->p_vaddr, kph->p_align); /* Find a free place for the sections */ ret = uvm_map_findspace(&p->p_vmspace->vm_map,