Cast u_longs to uintptr_t before casting them to pointers. Don't

attempt to even partially support systems with function pointers
larger than object pointers.
This commit is contained in:
Bruce Evans 1998-07-15 05:00:26 +00:00
parent 6a206dd96a
commit 7cd99438f8
3 changed files with 14 additions and 12 deletions

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: imgact_aout.c,v 1.39 1998/02/03 21:41:12 bde Exp $
* $Id: imgact_aout.c,v 1.40 1998/02/20 13:11:48 bde Exp $
*/
#include <sys/param.h>
@ -187,8 +187,9 @@ exec_aout_imgact(imgp)
/* Fill in process VM information */
vmspace->vm_tsize = a_out->a_text >> PAGE_SHIFT;
vmspace->vm_dsize = (a_out->a_data + bss_size) >> PAGE_SHIFT;
vmspace->vm_taddr = (caddr_t) virtual_offset;
vmspace->vm_daddr = (caddr_t) virtual_offset + a_out->a_text;
vmspace->vm_taddr = (caddr_t) (uintptr_t) virtual_offset;
vmspace->vm_daddr = (caddr_t) (uintptr_t)
(virtual_offset + a_out->a_text);
/* Fill in image_params */
imgp->interpreted = 0;

View File

@ -26,7 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: imgact_elf.c,v 1.26 1998/06/08 09:19:35 dfr Exp $
* $Id: imgact_elf.c,v 1.27 1998/07/11 10:28:47 bde Exp $
*/
#include "opt_rlimit.h"
@ -533,9 +533,9 @@ exec_elf_imgact(struct image_params *imgp)
}
vmspace->vm_tsize = text_size >> PAGE_SHIFT;
vmspace->vm_taddr = (caddr_t)text_addr;
vmspace->vm_taddr = (caddr_t)(uintptr_t)text_addr;
vmspace->vm_dsize = data_size >> PAGE_SHIFT;
vmspace->vm_daddr = (caddr_t)data_addr;
vmspace->vm_daddr = (caddr_t)(uintptr_t)data_addr;
addr = 2L*MAXDSIZ; /* May depend on OS type XXX */

View File

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: imgact_gzip.c,v 1.32 1997/12/14 19:36:24 jdp Exp $
* $Id: imgact_gzip.c,v 1.33 1998/06/16 14:36:40 bde Exp $
*
* This module handles execution of a.out files which have been run through
* "gzip". This saves diskspace, but wastes cpu-cycles and VM.
@ -260,8 +260,9 @@ do_aout_hdr(struct imgact_gzip * gz)
/* Fill in process VM information */
vmspace->vm_tsize = gz->a_out.a_text >> PAGE_SHIFT;
vmspace->vm_dsize = (gz->a_out.a_data + gz->bss_size) >> PAGE_SHIFT;
vmspace->vm_taddr = (caddr_t) gz->virtual_offset;
vmspace->vm_daddr = (caddr_t) gz->virtual_offset + gz->a_out.a_text;
vmspace->vm_taddr = (caddr_t) (uintptr_t) gz->virtual_offset;
vmspace->vm_daddr = (caddr_t) (uintptr_t)
(gz->virtual_offset + gz->a_out.a_text);
/* Fill in image_params */
gz->ip->interpreted = 0;
@ -340,7 +341,7 @@ Flush(void *vp, u_char * ptr, u_long siz)
return ENOEXEC;
}
if (gz->file_offset == 0) {
q = (u_char *) gz->virtual_offset;
q = (u_char *) (uintptr_t) gz->virtual_offset;
copyout(&gz->a_out, q, sizeof gz->a_out);
}
}
@ -355,8 +356,8 @@ Flush(void *vp, u_char * ptr, u_long siz)
}
if (gz->output >= gz->file_offset && gz->output < gz->file_end) {
i = min(siz, gz->file_end - gz->output);
q = (u_char *) gz->virtual_offset +
gz->output - gz->file_offset;
q = (u_char *) (uintptr_t)
(gz->virtual_offset + gz->output - gz->file_offset);
copyout(p, q, i);
gz->output += i;
p += i;