WARNS'fy sources which are left for reference.

src/usr.sbin/mdsetimage has been superseded by src/gnu/usr.sbin/mdsetimage
for toolchain to handle cross build binaries, but these old sources for
local executable binaries still can be used for tools to patch binaries,
like binpatch utility in sys/arch/amiga/stand and sys/arch/atari/stand.
This commit is contained in:
tsutsui 2009-07-30 15:16:37 +00:00
parent 7d100c1859
commit fcb0df9205
5 changed files with 37 additions and 37 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: exec_aout.c,v 1.6 2001/10/01 23:32:34 cgd Exp $ */
/* $NetBSD: exec_aout.c,v 1.7 2009/07/30 15:16:37 tsutsui Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: exec_aout.c,v 1.6 2001/10/01 23:32:34 cgd Exp $");
__RCSID("$NetBSD: exec_aout.c,v 1.7 2009/07/30 15:16:37 tsutsui Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -53,14 +53,14 @@ check_aout(mappedfile, mappedsize)
const char *mappedfile;
size_t mappedsize;
{
struct exec *execp;
const struct exec *execp;
int rv;
rv = 0;
if (check(0, sizeof *execp))
BAD;
execp = (struct exec *)&mappedfile[0];
execp = (const struct exec *)&mappedfile[0];
if (N_BADMAG(*execp))
BAD;
@ -75,11 +75,11 @@ findoff_aout(mappedfile, mappedsize, vmaddr, fileoffp)
size_t mappedsize, *fileoffp;
u_long vmaddr;
{
struct exec *execp;
const struct exec *execp;
int rv;
rv = 0;
execp = (struct exec *)&mappedfile[0];
execp = (const struct exec *)&mappedfile[0];
if (N_TXTADDR(*execp) + (execp->a_entry & (N_PAGSIZ(*execp)-1)) !=
execp->a_entry)

View File

@ -1,4 +1,4 @@
/* $NetBSD: exec_coff.c,v 1.5 2001/10/01 23:32:34 cgd Exp $ */
/* $NetBSD: exec_coff.c,v 1.6 2009/07/30 15:16:37 tsutsui Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: exec_coff.c,v 1.5 2001/10/01 23:32:34 cgd Exp $");
__RCSID("$NetBSD: exec_coff.c,v 1.6 2009/07/30 15:16:37 tsutsui Exp $");
#endif /* not lint */
#include <sys/param.h>
@ -53,14 +53,14 @@ check_coff(mappedfile, mappedsize)
const char *mappedfile;
size_t mappedsize;
{
struct coff_exechdr *exechdrp;
const struct coff_exechdr *exechdrp;
int rv;
rv = 0;
if (check(0, sizeof *exechdrp))
BAD;
exechdrp = (struct coff_exechdr *)&mappedfile[0];
exechdrp = (const struct coff_exechdr *)&mappedfile[0];
if (COFF_BADMAG(&(exechdrp->f)))
BAD;
@ -75,11 +75,11 @@ findoff_coff(mappedfile, mappedsize, vmaddr, fileoffp)
size_t mappedsize, *fileoffp;
u_long vmaddr;
{
struct coff_exechdr *exechdrp;
const struct coff_exechdr *exechdrp;
int rv;
rv = 0;
exechdrp = (struct coff_exechdr *)&mappedfile[0];
exechdrp = (const struct coff_exechdr *)&mappedfile[0];
#define COFF_TXTOFF_XXX(fp, ap) \
(COFF_ROUND(COFF_HDR_SIZE + (fp)->f_nscns * \
@ -89,12 +89,12 @@ findoff_coff(mappedfile, mappedsize, vmaddr, fileoffp)
#define COFF_DATOFF_XXX(fp, ap) \
(COFF_TXTOFF_XXX(fp, ap) + (ap)->a_tsize)
if (exechdrp->a.a_tstart <= vmaddr &&
vmaddr < (exechdrp->a.a_tstart + exechdrp->a.a_tsize))
if ((u_long)exechdrp->a.a_tstart <= vmaddr &&
vmaddr < (u_long)(exechdrp->a.a_tstart + exechdrp->a.a_tsize))
*fileoffp = vmaddr - exechdrp->a.a_tstart +
COFF_TXTOFF(&exechdrp->f, &(exechdrp->a));
else if (exechdrp->a.a_dstart <= vmaddr &&
vmaddr < (exechdrp->a.a_dstart + exechdrp->a.a_dsize))
else if ((u_long)exechdrp->a.a_dstart <= vmaddr &&
vmaddr < (u_long)(exechdrp->a.a_dstart + exechdrp->a.a_dsize))
*fileoffp = vmaddr - exechdrp->a.a_dstart +
COFF_DATOFF_XXX(&exechdrp->f, &(exechdrp->a));
else

View File

@ -1,4 +1,4 @@
/* $NetBSD: exec_ecoff.c,v 1.5 2001/10/01 23:32:34 cgd Exp $ */
/* $NetBSD: exec_ecoff.c,v 1.6 2009/07/30 15:16:37 tsutsui Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: exec_ecoff.c,v 1.5 2001/10/01 23:32:34 cgd Exp $");
__RCSID("$NetBSD: exec_ecoff.c,v 1.6 2009/07/30 15:16:37 tsutsui Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -50,14 +50,14 @@ check_ecoff(mappedfile, mappedsize)
const char *mappedfile;
size_t mappedsize;
{
struct ecoff_exechdr *exechdrp;
const struct ecoff_exechdr *exechdrp;
int rv;
rv = 0;
if (check(0, sizeof *exechdrp))
BAD;
exechdrp = (struct ecoff_exechdr *)&mappedfile[0];
exechdrp = (const struct ecoff_exechdr *)&mappedfile[0];
if (ECOFF_BADMAG(exechdrp))
BAD;
@ -72,11 +72,11 @@ findoff_ecoff(mappedfile, mappedsize, vmaddr, fileoffp)
size_t mappedsize, *fileoffp;
u_long vmaddr;
{
struct ecoff_exechdr *exechdrp;
const struct ecoff_exechdr *exechdrp;
int rv;
rv = 0;
exechdrp = (struct ecoff_exechdr *)&mappedfile[0];
exechdrp = (const struct ecoff_exechdr *)&mappedfile[0];
if (exechdrp->a.text_start <= vmaddr &&
vmaddr < (exechdrp->a.text_start + exechdrp->a.tsize))

View File

@ -1,4 +1,4 @@
/* $NetBSD: exec_elf32.c,v 1.9 2001/10/01 23:32:34 cgd Exp $ */
/* $NetBSD: exec_elf32.c,v 1.10 2009/07/30 15:16:38 tsutsui Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: exec_elf32.c,v 1.9 2001/10/01 23:32:34 cgd Exp $");
__RCSID("$NetBSD: exec_elf32.c,v 1.10 2009/07/30 15:16:38 tsutsui Exp $");
#endif /* not lint */
#ifndef ELFSIZE
@ -58,14 +58,14 @@ ELFNAMEEND(check)(mappedfile, mappedsize)
const char *mappedfile;
size_t mappedsize;
{
Elf_Ehdr *ehdrp;
const Elf_Ehdr *ehdrp;
int rv;
rv = 0;
if (check(0, sizeof *ehdrp))
BAD;
ehdrp = (Elf_Ehdr *)&mappedfile[0];
ehdrp = (const Elf_Ehdr *)&mappedfile[0];
if (memcmp(ehdrp->e_ident, ELFMAG, SELFMAG) != 0 ||
ehdrp->e_ident[EI_CLASS] != ELFCLASS)
@ -88,8 +88,8 @@ ELFNAMEEND(findoff)(mappedfile, mappedsize, vmaddr, fileoffp)
size_t mappedsize, *fileoffp;
u_long vmaddr;
{
Elf_Ehdr *ehdrp;
Elf_Shdr *shdrp;
const Elf_Ehdr *ehdrp;
const Elf_Shdr *shdrp;
Elf_Off shdr_off;
Elf_Word shdr_size;
#if (ELFSIZE == 32)
@ -101,15 +101,15 @@ ELFNAMEEND(findoff)(mappedfile, mappedsize, vmaddr, fileoffp)
rv = 0;
ehdrp = (Elf_Ehdr *)&mappedfile[0];
ehdrp = (const Elf_Ehdr *)&mappedfile[0];
nshdr = ehdrp->e_shnum;
shdr_off = ehdrp->e_shoff;
shdr_size = ehdrp->e_shentsize * nshdr;
if (check(shdr_off, shdr_size) ||
if (check(0, shdr_size + shdr_off) ||
(sizeof *shdrp != ehdrp->e_shentsize))
BAD;
shdrp = (Elf_Shdr *)&mappedfile[shdr_off];
shdrp = (const Elf_Shdr *)&mappedfile[shdr_off];
for (i = 0; i < nshdr; i++) {
if (shdrp[i].sh_addr <= vmaddr &&

View File

@ -1,4 +1,4 @@
/* $NetBSD: mdsetimage.c,v 1.18 2008/07/21 13:36:59 lukem Exp $ */
/* $NetBSD: mdsetimage.c,v 1.19 2009/07/30 15:16:38 tsutsui Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou
@ -36,7 +36,7 @@ __COPYRIGHT("@(#) Copyright (c) 1996\
#endif /* not lint */
#ifndef lint
__RCSID("$NetBSD: mdsetimage.c,v 1.18 2008/07/21 13:36:59 lukem Exp $");
__RCSID("$NetBSD: mdsetimage.c,v 1.19 2009/07/30 15:16:38 tsutsui Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -60,10 +60,10 @@ static int find_md_root __P((const char *, const char *, size_t,
static struct nlist md_root_nlist[] = {
#define X_MD_ROOT_IMAGE 0
{ "_md_root_image" },
{ "_md_root_image", 0, 0, 0, 0 },
#define X_MD_ROOT_SIZE 1
{ "_md_root_size" },
{ NULL }
{ "_md_root_size", 0, 0, 0, 0 },
{ NULL, 0, 0, 0, 0 }
};
int verbose;
@ -245,7 +245,7 @@ find_md_root(fname, mappedfile, mappedsize, nl, rootoffp, rootsizep)
fprintf(stderr, "%s is at offset %#lx in %s\n",
nl[X_MD_ROOT_SIZE].n_name,
(unsigned long)rootsizeoff, fname);
*rootsizep = *(u_int32_t *)&mappedfile[rootsizeoff];
*rootsizep = *(const u_int32_t *)&mappedfile[rootsizeoff];
if (verbose)
fprintf(stderr, "%s has value %#x\n",
nl[X_MD_ROOT_SIZE].n_name, *rootsizep);