Remove alpha-specific stuff.

This commit is contained in:
Ruslan Ermilov 2006-08-23 12:12:56 +00:00
parent 652ae483f8
commit 2d05c776ef
8 changed files with 0 additions and 896 deletions

View File

@ -1,88 +0,0 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/disklabel.h>
#include <paths.h>
#include "libdisk.h"
/*
* XXX: A lot of hardcoded 512s probably should be foo->sector_size;
* I'm not sure which, so I leave it like it worked before. --schweikh
*/
int
Write_Disk(const struct disk *d1)
{
u_char buf[BBSIZE];
char device[64];
struct chunk *c1;
struct disklabel *dl;
void *p;
uint64_t *lp, sum;
int fd, i;
strcpy(device, _PATH_DEV);
strcat(device, d1->name);
fd = open(device, O_RDWR);
if (fd < 0)
return (1);
c1 = d1->chunks->part;
if (!strcmp(c1->name, "X") || c1->type != freebsd) {
close (fd);
return (0);
}
for (i = 0; i < BBSIZE/512; i++) {
if (!(p = read_block(fd, i + c1->offset, 512))) {
close (fd);
return (1);
}
memcpy(buf + 512 * i, p, 512);
free(p);
}
if (d1->boot1)
memcpy(buf + 512, d1->boot1, BBSIZE - 512);
dl = (struct disklabel *)(buf + 512 * LABELSECTOR + LABELOFFSET);
Fill_Disklabel(dl, d1, c1);
/*
* Tell SRM where the bootstrap is.
*/
lp = (uint64_t *)buf;
lp[60] = (BBSIZE - 512) / 512; /* Length */
lp[61] = 1; /* Start */
lp[62] = 0; /* Flags */
/*
* Generate the bootblock checksum for the SRM console.
*/
sum = 0;
for (i = 0; i < 63; i++)
sum += lp[i];
lp[63] = sum;
for (i = 0; i < BBSIZE / 512; i++)
write_block(fd, i + c1->offset, buf + 512 * i, 512);
close(fd);
return (0);
}

View File

@ -1,213 +0,0 @@
/* $NetBSD: kvm_alpha.c,v 1.7.2.1 1997/11/02 20:34:26 mellon Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/user.h>
#include <sys/proc.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include <nlist.h>
#include <kvm.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <limits.h>
#include <stdlib.h>
#include <machine/pmap.h>
#include "kvm_private.h"
static off_t _kvm_pa2off(kvm_t *kd, u_long pa);
struct vmstate {
u_int64_t lev1map_pa; /* PA of Lev1map */
u_int64_t page_size; /* Page size */
u_int64_t nmemsegs; /* Number of RAM segm */
};
void
_kvm_freevtop(kd)
kvm_t *kd;
{
/* Not actually used for anything right now, but safe. */
if (kd->vmst != 0)
free(kd->vmst);
}
int
_kvm_initvtop(kd)
kvm_t *kd;
{
struct vmstate *vm;
struct nlist nlist[2];
u_long pa;
vm = (struct vmstate *)_kvm_malloc(kd, sizeof(*vm));
if (vm == 0) {
_kvm_err(kd, kd->program, "cannot allocate vm");
return (-1);
}
kd->vmst = vm;
vm->page_size = ALPHA_PGBYTES;
nlist[0].n_name = "_Lev1map";
nlist[1].n_name = 0;
if (kvm_nlist(kd, nlist) != 0) {
_kvm_err(kd, kd->program, "bad namelist");
return (-1);
}
if(!ISALIVE(kd)) {
if (kvm_read(kd, (nlist[0].n_value), &pa, sizeof(pa)) != sizeof(pa)) {
_kvm_err(kd, kd->program, "cannot read Lev1map");
return (-1);
}
} else
if (kvm_read(kd, (nlist[0].n_value), &pa, sizeof(pa)) != sizeof(pa)) {
_kvm_err(kd, kd->program, "cannot read Lev1map");
return (-1);
}
vm->lev1map_pa = pa;
return (0);
}
int
_kvm_kvatop(kd, va, pa)
kvm_t *kd;
u_long va;
off_t *pa;
{
u_int64_t lev1map_pa; /* PA of Lev1map */
u_int64_t page_size;
int rv, page_off;
alpha_pt_entry_t pte;
off_t pteoff;
struct vmstate *vm;
vm = kd->vmst ;
if (ISALIVE(kd)) {
_kvm_err(kd, 0, "vatop called in live kernel!");
return(0);
}
lev1map_pa = vm->lev1map_pa;
page_size = vm->page_size;
page_off = va & (page_size - 1);
if (va >= ALPHA_K0SEG_BASE && va <= ALPHA_K0SEG_END) {
/*
* Direct-mapped address: just convert it.
*/
*pa = ALPHA_K0SEG_TO_PHYS(va);
rv = page_size - page_off;
} else if (va >= ALPHA_K1SEG_BASE && va <= ALPHA_K1SEG_END) {
/*
* Real kernel virtual address: do the translation.
*/
#define PTMASK ((1 << ALPHA_PTSHIFT) - 1)
#define pmap_lev1_index(va) (((va) >> ALPHA_L1SHIFT) & PTMASK)
#define pmap_lev2_index(va) (((va) >> ALPHA_L2SHIFT) & PTMASK)
#define pmap_lev3_index(va) (((va) >> ALPHA_L3SHIFT) & PTMASK)
/* Find and read the L1 PTE. */
pteoff = lev1map_pa +
pmap_lev1_index(va) * sizeof(alpha_pt_entry_t);
if (lseek(kd->pmfd, _kvm_pa2off(kd, pteoff), 0) == -1 ||
read(kd->pmfd, (char *)&pte, sizeof(pte)) != sizeof(pte)) {
_kvm_syserr(kd, 0, "could not read L1 PTE");
goto lose;
}
/* Find and read the L2 PTE. */
if ((pte & ALPHA_PTE_VALID) == 0) {
_kvm_err(kd, 0, "invalid translation (invalid L1 PTE)");
goto lose;
}
pteoff = ALPHA_PTE_TO_PFN(pte) * page_size +
pmap_lev2_index(va) * sizeof(alpha_pt_entry_t);
if (lseek(kd->pmfd, _kvm_pa2off(kd, pteoff), 0) == -1 ||
read(kd->pmfd, (char *)&pte, sizeof(pte)) != sizeof(pte)) {
_kvm_syserr(kd, 0, "could not read L2 PTE");
goto lose;
}
/* Find and read the L3 PTE. */
if ((pte & ALPHA_PTE_VALID) == 0) {
_kvm_err(kd, 0, "invalid translation (invalid L2 PTE)");
goto lose;
}
pteoff = ALPHA_PTE_TO_PFN(pte) * page_size +
pmap_lev3_index(va) * sizeof(alpha_pt_entry_t);
if (lseek(kd->pmfd, _kvm_pa2off(kd, pteoff), 0) == -1 ||
read(kd->pmfd, (char *)&pte, sizeof(pte)) != sizeof(pte)) {
_kvm_syserr(kd, 0, "could not read L3 PTE");
goto lose;
}
/* Fill in the PA. */
if ((pte & ALPHA_PTE_VALID) == 0) {
_kvm_err(kd, 0, "invalid translation (invalid L3 PTE)");
goto lose;
}
*pa = ALPHA_PTE_TO_PFN(pte) * page_size + page_off;
rv = page_size - page_off;
} else {
/*
* Bogus address (not in KV space): punt.
*/
_kvm_err(kd, 0, "invalid kernel virtual address");
lose:
*pa = -1;
rv = 0;
}
return (rv);
}
/*
* Translate a physical address to a file-offset in the crash-dump.
*/
off_t
_kvm_pa2off(kd, pa)
kvm_t *kd;
u_long pa;
{
return ALPHA_K0SEG_TO_PHYS(pa);
}

View File

@ -1,73 +0,0 @@
/*
* Copyright (c) 2004 Marcel Moolenaar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/procfs.h>
#include <machine/setjmp.h>
void
libc_r_md_getgregs(jmp_buf jb, prgregset_t r)
{
r->r_regs[R_V0] = jb->_jb[4];
r->r_regs[R_T0] = jb->_jb[5];
r->r_regs[R_T1] = jb->_jb[6];
r->r_regs[R_T2] = jb->_jb[7];
r->r_regs[R_T3] = jb->_jb[8];
r->r_regs[R_T4] = jb->_jb[9];
r->r_regs[R_T5] = jb->_jb[10];
r->r_regs[R_T6] = jb->_jb[11];
r->r_regs[R_T7] = jb->_jb[12];
r->r_regs[R_S0] = jb->_jb[13];
r->r_regs[R_S1] = jb->_jb[14];
r->r_regs[R_S2] = jb->_jb[15];
r->r_regs[R_S3] = jb->_jb[16];
r->r_regs[R_S4] = jb->_jb[17];
r->r_regs[R_S5] = jb->_jb[18];
r->r_regs[R_S6] = jb->_jb[19];
r->r_regs[R_A0] = jb->_jb[20];
r->r_regs[R_A1] = jb->_jb[21];
r->r_regs[R_A2] = jb->_jb[22];
r->r_regs[R_A3] = jb->_jb[23];
r->r_regs[R_A4] = jb->_jb[24];
r->r_regs[R_A5] = jb->_jb[25];
r->r_regs[R_T8] = jb->_jb[26];
r->r_regs[R_T9] = jb->_jb[27];
r->r_regs[R_T10] = jb->_jb[28];
r->r_regs[R_T11] = jb->_jb[29];
r->r_regs[R_RA] = jb->_jb[30];
r->r_regs[R_T12] = jb->_jb[31];
r->r_regs[R_AT] = jb->_jb[32];
r->r_regs[R_GP] = jb->_jb[33];
r->r_regs[R_SP] = jb->_jb[34];
r->r_regs[R_ZERO] = jb->_jb[35];
}
void
libc_r_md_getfpregs(jmp_buf jb, prfpregset_t *r)
{
}

View File

@ -1,62 +0,0 @@
/*
* Copyright (c) 2004 Marcel Moolenaar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/procfs.h>
#include <ucontext.h>
void
pt_reg_to_ucontext(const struct reg *r, ucontext_t *uc)
{
}
void
pt_ucontext_to_reg(const ucontext_t *uc, struct reg *r)
{
}
void
pt_fpreg_to_ucontext(const struct fpreg* r, ucontext_t *uc)
{
}
void
pt_ucontext_to_fpreg(const ucontext_t *uc, struct fpreg *r)
{
}
void
pt_md_init(void)
{
}
int
pt_reg_sstep(struct reg *reg, int step)
{
return (0);
}

View File

@ -1,44 +0,0 @@
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)i386.h 8.1 (Berkeley) 6/6/93
* $FreeBSD$
*/
/*
* offset (in bytes) of the code from the entry address of a routine.
* (see asgnsamples for use and explanation.)
*/
#define OFFSET_OF_CODE 0
enum opermodes { dummy };
typedef enum opermodes operandenum;

View File

@ -41,9 +41,6 @@
#include <stdio.h>
#include <stdlib.h>
#if __alpha__
# include "alpha.h"
#endif
#if __amd64__
# include "amd64.h"
#endif

View File

@ -1,360 +0,0 @@
/*
* Copryight 1998 Sean Eric Fagan
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Sean Eric Fagan
* 4. Neither the name of the author may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef lint
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
/*
* FreeBSD/alpha-specific system call handling. This is probably the most
* complex part of the entire truss program, although I've got lots of
* it handled relatively cleanly now. The system call names are generated
* automatically, thanks to /usr/src/sys/kern/syscalls.master. The
* names used for the various structures are confusing, I sadly admit.
*
* This file is almost nothing more than a slightly-edited i386-fbsd.c.
*/
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/pioctl.h>
#include <sys/syscall.h>
#include <machine/reg.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include "truss.h"
#include "syscall.h"
#include "extern.h"
static int fd = -1;
static int cpid = -1;
#include "syscalls.h"
static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
/*
* This is what this particular file uses to keep track of a system call.
* It is probably not quite sufficient -- I can probably use the same
* structure for the various syscall personalities, and I also probably
* need to nest system calls (for signal handlers).
*
* 'struct syscall' describes the system call; it may be NULL, however,
* if we don't know about this particular system call yet.
*/
static struct freebsd_syscall {
struct syscall *sc;
const char *name;
int number;
unsigned long *args;
int nargs; /* number of arguments -- *not* number of words! */
char **s_args; /* the printable arguments */
} fsc;
/* Clear up and free parts of the fsc structure. */
static __inline void
clear_fsc(void) {
if (fsc.args) {
free(fsc.args);
}
if (fsc.s_args) {
int i;
for (i = 0; i < fsc.nargs; i++)
if (fsc.s_args[i])
free(fsc.s_args[i]);
free(fsc.s_args);
}
memset(&fsc, 0, sizeof(fsc));
}
/*
* Called when a process has entered a system call. nargs is the
* number of words, not number of arguments (a necessary distinction
* in some cases). Note that if the STOPEVENT() code in alpha/alpha/trap.c
* is ever changed these functions need to keep up.
*/
void
alpha_syscall_entry(struct trussinfo *trussinfo, int nargs) {
char buf[32];
struct reg regs;
int syscall_num;
int i;
unsigned int parm_offset;
struct syscall *sc;
int indir = 0; /* indirect system call */
if (fd == -1 || trussinfo->pid != cpid) {
sprintf(buf, "/proc/%d/regs", trussinfo->pid);
fd = open(buf, O_RDWR);
if (fd == -1) {
fprintf(trussinfo->outfile, "-- CANNOT OPEN REGISTERS --\n");
return;
}
cpid = trussinfo->pid;
}
clear_fsc();
lseek(fd, 0L, 0);
if (read(fd, &regs, sizeof(regs)) != sizeof(regs)) {
fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
return;
}
parm_offset = regs.r_regs[R_SP] + sizeof(int);
/*
* FreeBSD has two special kinds of system call redirctions --
* SYS_syscall, and SYS___syscall. The former is the old syscall()
* routine, basicly; the latter is for quad-aligned arguments.
*/
syscall_num = regs.r_regs[R_V0];
if (syscall_num == SYS_syscall || syscall_num == SYS___syscall) {
indir = 1;
syscall_num = regs.r_regs[R_A0];
}
fsc.number = syscall_num;
fsc.name =
(syscall_num < 0 || syscall_num > nsyscalls) ? NULL : syscallnames[syscall_num];
if (!fsc.name) {
fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
}
if (fsc.name && (trussinfo->flags & FOLLOWFORKS)
&& ((!strcmp(fsc.name, "fork")
|| !strcmp(fsc.name, "rfork")
|| !strcmp(fsc.name, "vfork"))))
{
trussinfo->in_fork = 1;
}
if (nargs == 0)
return;
fsc.args = malloc((1+nargs) * sizeof(unsigned long));
switch (nargs) {
default:
/*
* The OS doesn't seem to allow more than 10 words of
* parameters (yay!). So we shouldn't be here.
*/
warn("More than 10 words (%d) of arguments!\n", nargs);
break;
case 10: case 9: case 8: case 7:
/*
* If there are 7-10 words of arguments, they are placed
* on the stack, as is normal for other processors.
* The fall-through for all of these is deliberate!!!
*/
lseek(Procfd, regs.r_regs[R_SP], SEEK_SET);
read(fd, &fsc.args[6], (nargs - 6) * sizeof(fsc.args[0]));
case 6: fsc.args[5] = regs.r_regs[R_A5];
case 5: fsc.args[4] = regs.r_regs[R_A4];
case 4: fsc.args[3] = regs.r_regs[R_A3];
case 3: fsc.args[2] = regs.r_regs[R_A2];
case 2: fsc.args[1] = regs.r_regs[R_A1];
case 1: fsc.args[0] = regs.r_regs[R_A0];
case 0:
break;
}
if (indir) {
memmove(&fsc.args[0], &fsc.args[1], (nargs-1) * sizeof(fsc.args[0]));
}
sc = get_syscall(fsc.name);
if (sc) {
fsc.nargs = sc->nargs;
} else {
#if DEBUG
fprintf(trussinfo->outfile, "unknown syscall %s -- setting args to %d\n",
fsc.name, nargs);
#endif
fsc.nargs = nargs;
}
fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*));
memset(fsc.s_args, 0, fsc.nargs * sizeof(char*));
fsc.sc = sc;
/*
* At this point, we set up the system call arguments.
* We ignore any OUT ones, however -- those are arguments that
* are set by the system call, and so are probably meaningless
* now. This doesn't currently support arguments that are
* passed in *and* out, however.
*/
if (fsc.name) {
#if DEBUG
fprintf(stderr, "syscall %s(", fsc.name);
#endif
for (i = 0; i < fsc.nargs; i++) {
#if DEBUG
fprintf(stderr, "0x%x%s",
sc
? fsc.args[sc->args[i].offset]
: fsc.args[i],
i < (fsc.nargs - 1) ? "," : "");
#endif
if (sc && !(sc->args[i].type & OUT)) {
fsc.s_args[i] = print_arg(Procfd, &sc->args[i], fsc.args, 0, trussinfo);
}
}
#if DEBUG
fprintf(stderr, ")\n");
#endif
}
#if DEBUG
fprintf(trussinfo->outfile, "\n");
#endif
/*
* Some system calls should be printed out before they are done --
* execve() and exit(), for example, never return. Possibly change
* this to work for any system call that doesn't have an OUT
* parameter?
*/
if (!strcmp(fsc.name, "execve") || !strcmp(fsc.name, "exit")) {
/* XXX
* This could be done in a more general
* manner but it still wouldn't be very pretty.
*/
if (!strcmp(fsc.name, "execve")) {
if ((trussinfo->flags & EXECVEARGS) == 0)
if (fsc.s_args[1]) {
free(fsc.s_args[1]);
fsc.s_args[1] = NULL;
}
if ((trussinfo->flags & EXECVEENVS) == 0)
if (fsc.s_args[2]) {
free(fsc.s_args[2]);
fsc.s_args[2] = NULL;
}
}
print_syscall(trussinfo, fsc.name, fsc.nargs, fsc.s_args);
fprintf(trussinfo->outfile, "\n");
}
return;
}
/*
* And when the system call is done, we handle it here.
* Currently, no attempt is made to ensure that the system calls
* match -- this needs to be fixed (and is, in fact, why S_SCX includes
* the sytem call number instead of, say, an error status).
*/
long
alpha_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused)
{
char buf[32];
struct reg regs;
long retval;
int i;
int errorp;
struct syscall *sc;
if (fd == -1 || trussinfo->pid != cpid) {
sprintf(buf, "/proc/%d/regs", trussinfo->pid);
fd = open(buf, O_RDONLY);
if (fd == -1) {
fprintf(trussinfo->outfile, "-- CANNOT OPEN REGISTERS --\n");
return (-1);
}
cpid = trussinfo->pid;
}
lseek(fd, 0L, 0);
if (read(fd, &regs, sizeof(regs)) != sizeof(regs)) {
fprintf(trussinfo->outfile, "\n");
return (-1);
}
retval = regs.r_regs[R_V0];
errorp = !!(regs.r_regs[R_A3]);
/*
* This code, while simpler than the initial versions I used, could
* stand some significant cleaning.
*/
sc = fsc.sc;
if (!sc) {
for (i = 0; i < fsc.nargs; i++)
asprintf(&fsc.s_args[i], "0x%lx", fsc.args[i]);
} else {
/*
* Here, we only look for arguments that have OUT masked in --
* otherwise, they were handled in the syscall_entry function.
*/
for (i = 0; i < sc->nargs; i++) {
char *temp;
if (sc->args[i].type & OUT) {
/*
* If an error occurred, than don't bothe getting the data;
* it may not be valid.
*/
if (errorp)
asprintf(&temp, "0x%lx", fsc.args[sc->args[i].offset]);
else
temp = print_arg(Procfd, &sc->args[i], fsc.args, retval, trussinfo);
fsc.s_args[i] = temp;
}
}
}
/*
* It would probably be a good idea to merge the error handling,
* but that complicates things considerably.
*/
print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, retval);
clear_fsc();
return (retval);
}

View File

@ -1,53 +0,0 @@
/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:18 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Jochen Pohl for
* The NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Machine-dependent target parameters for lint1.
*/
#include "lp64.h"
/*
* Should be set to 1 if the difference of two pointers is of type long
* or the value of sizeof is of type unsigned long. Note this MUST be
* kept in sync with the compiler!
*/
#define PTRDIFF_IS_LONG 1
#define SIZEOF_IS_ULONG 1
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (8 * CHAR_BIT)
#define ENUM_SIZE (4 * CHAR_BIT)