Deleted Added
full compact
ia64-fbsd.c (111176) ia64-fbsd.c (115084)
1/*
2 * Copryight 1997 Sean Eric Fagan
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 17 unchanged lines hidden (view full) ---

26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32#ifndef lint
33static const char rcsid[] =
1/*
2 * Copryight 1997 Sean Eric Fagan
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 17 unchanged lines hidden (view full) ---

26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32#ifndef lint
33static const char rcsid[] =
34 "$FreeBSD: head/usr.bin/truss/ia64-fbsd.c 111176 2003-02-20 15:05:39Z ru $";
34 "$FreeBSD: head/usr.bin/truss/ia64-fbsd.c 115084 2003-05-16 21:26:42Z marcel $";
35#endif /* not lint */
36
37/*
38 * FreeBSD/ia64-specific system call handling. This is probably the most
39 * complex part of the entire truss program, although I've got lots of
40 * it handled relatively cleanly now. The system call names are generated
41 * automatically, thanks to /usr/src/sys/kern/syscalls.master. The
42 * names used for the various structures are confusing, I sadly admit.

--- 88 unchanged lines hidden (view full) ---

131 }
132
133 clear_fsc();
134 lseek(fd, 0L, 0);
135 if (read(fd, &regs, sizeof(regs)) != sizeof(regs)) {
136 fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
137 return;
138 }
35#endif /* not lint */
36
37/*
38 * FreeBSD/ia64-specific system call handling. This is probably the most
39 * complex part of the entire truss program, although I've got lots of
40 * it handled relatively cleanly now. The system call names are generated
41 * automatically, thanks to /usr/src/sys/kern/syscalls.master. The
42 * names used for the various structures are confusing, I sadly admit.

--- 88 unchanged lines hidden (view full) ---

131 }
132
133 clear_fsc();
134 lseek(fd, 0L, 0);
135 if (read(fd, &regs, sizeof(regs)) != sizeof(regs)) {
136 fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
137 return;
138 }
139 parm_offset = regs.r_gr[12] + 16;
139 parm_offset = regs.r_special.sp + 16;
140
141 /*
142 * FreeBSD has two special kinds of system call redirctions --
143 * SYS_syscall, and SYS___syscall. The former is the old syscall()
144 * routine, basicly; the latter is for quad-aligned arguments.
145 */
140
141 /*
142 * FreeBSD has two special kinds of system call redirctions --
143 * SYS_syscall, and SYS___syscall. The former is the old syscall()
144 * routine, basicly; the latter is for quad-aligned arguments.
145 */
146 syscall_num = regs.r_gr[15];
146 syscall_num = regs.r_scratch.gr15; /* XXX double-check. */
147 switch (syscall_num) {
148 case SYS_syscall:
149 lseek(Procfd, parm_offset, SEEK_SET);
150 read(Procfd, &syscall_num, sizeof(int));
151 parm_offset += sizeof(int);
152 break;
153 case SYS___syscall:
154 lseek(Procfd, parm_offset, SEEK_SET);

--- 133 unchanged lines hidden (view full) ---

288 cpid = trussinfo->pid;
289 }
290
291 lseek(fd, 0L, 0);
292 if (read(fd, &regs, sizeof(regs)) != sizeof(regs)) {
293 fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
294 return (-1);
295 }
147 switch (syscall_num) {
148 case SYS_syscall:
149 lseek(Procfd, parm_offset, SEEK_SET);
150 read(Procfd, &syscall_num, sizeof(int));
151 parm_offset += sizeof(int);
152 break;
153 case SYS___syscall:
154 lseek(Procfd, parm_offset, SEEK_SET);

--- 133 unchanged lines hidden (view full) ---

288 cpid = trussinfo->pid;
289 }
290
291 lseek(fd, 0L, 0);
292 if (read(fd, &regs, sizeof(regs)) != sizeof(regs)) {
293 fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
294 return (-1);
295 }
296 retval = regs.r_gr[8];
297 errorp = (regs.r_gr[10] != 0) ? 1 : 0;
296 retval = regs.r_scratch.gr8;
297 errorp = (regs.r_scratch.gr10 != 0) ? 1 : 0;
298
299 /*
300 * This code, while simpler than the initial versions I used, could
301 * stand some significant cleaning.
302 */
303
304 sc = fsc.sc;
305 if (!sc) {

--- 37 unchanged lines hidden ---
298
299 /*
300 * This code, while simpler than the initial versions I used, could
301 * stand some significant cleaning.
302 */
303
304 sc = fsc.sc;
305 if (!sc) {

--- 37 unchanged lines hidden ---