summaryrefslogtreecommitdiffstats
path: root/usr.bin/truss
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2003-08-02 22:29:10 +0000
committermarcel <marcel@FreeBSD.org>2003-08-02 22:29:10 +0000
commit07563cc68f400138b2d6221044f0661630af42e1 (patch)
treeea08b23083b37192dbb145e962cbe7b030390759 /usr.bin/truss
parentdef68bc11e39f3806179b380ef1e5938049e5526 (diff)
downloadFreeBSD-src-07563cc68f400138b2d6221044f0661630af42e1.zip
FreeBSD-src-07563cc68f400138b2d6221044f0661630af42e1.tar.gz
Fix truss on ia64. The syscall arguments are written to the trap
frame, occupying scratch registers r16 and up. We don't have to save any scratch registers for syscalls, so we have plenty of room there. Consequently, when we fetch the registers from the process, we automaticly have all the arguments and don't need to read them seperately.
Diffstat (limited to 'usr.bin/truss')
-rw-r--r--usr.bin/truss/ia64-fbsd.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/usr.bin/truss/ia64-fbsd.c b/usr.bin/truss/ia64-fbsd.c
index 9f065a1..c7d61b9 100644
--- a/usr.bin/truss/ia64-fbsd.c
+++ b/usr.bin/truss/ia64-fbsd.c
@@ -117,7 +117,7 @@ ia64_syscall_entry(struct trussinfo *trussinfo, int nargs) {
struct reg regs;
int syscall_num;
int i;
- unsigned int parm_offset;
+ unsigned long *parm_offset;
struct syscall *sc;
if (fd == -1 || trussinfo->pid != cpid) {
@@ -136,7 +136,7 @@ ia64_syscall_entry(struct trussinfo *trussinfo, int nargs) {
fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
return;
}
- parm_offset = regs.r_special.sp + 16;
+ parm_offset = &regs.r_scratch.gr16;
/*
* FreeBSD has two special kinds of system call redirctions --
@@ -144,18 +144,8 @@ ia64_syscall_entry(struct trussinfo *trussinfo, int nargs) {
* routine, basicly; the latter is for quad-aligned arguments.
*/
syscall_num = regs.r_scratch.gr15; /* XXX double-check. */
- switch (syscall_num) {
- case SYS_syscall:
- lseek(Procfd, parm_offset, SEEK_SET);
- read(Procfd, &syscall_num, sizeof(int));
- parm_offset += sizeof(int);
- break;
- case SYS___syscall:
- lseek(Procfd, parm_offset, SEEK_SET);
- read(Procfd, &syscall_num, sizeof(int));
- parm_offset += sizeof(quad_t);
- break;
- }
+ if (syscall_num == SYS_syscall || syscall_num == SYS___syscall)
+ syscall_num = (int)*parm_offset++;
fsc.number = syscall_num;
fsc.name = (syscall_num < 0 || syscall_num > nsyscalls)
@@ -176,9 +166,7 @@ ia64_syscall_entry(struct trussinfo *trussinfo, int nargs) {
return;
fsc.args = malloc((1+nargs) * sizeof(unsigned long));
- lseek(Procfd, parm_offset, SEEK_SET);
- if (read(Procfd, fsc.args, nargs * sizeof(unsigned long)) == -1)
- return;
+ memcpy(fsc.args, parm_offset, nargs * sizeof(long));
sc = get_syscall(fsc.name);
if (sc) {
OpenPOWER on IntegriCloud