Date: Mon, 25 Jan 1999 21:18:45 +0900 From: Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp> To: freebsd-alpha@FreeBSD.ORG Subject: ktrace fix Message-ID: <19990125211845Q.simokawa@sat.t.u-tokyo.ac.jp>
next in thread | raw e-mail | index | archive | help
Current ktrace doesn't trace syscalls on alpha. Here is a fix for that. The only problem is that I have to bloat struct ktr_syscall to avoid alignment problem. Is this acceptable for i386? /\ Hidetoshi Shimokawa \/ simokawa@sat.t.u-tokyo.ac.jp PGP public key: finger -l simokawa@sat.t.u-tokyo.ac.jp Index: sys/kern/kern_ktrace.c =================================================================== RCS file: /pub/FreeBSD-CVS/src/sys/kern/kern_ktrace.c,v retrieving revision 1.25 diff -u -u -r1.25 kern_ktrace.c --- kern_ktrace.c 1998/12/10 01:47:41 1.25 +++ kern_ktrace.c 1999/01/23 19:43:35 @@ -78,20 +78,22 @@ void ktrsyscall(vp, code, narg, args) struct vnode *vp; - int code, narg, args[]; + int code, narg; + register_t args[]; { struct ktr_header *kth; struct ktr_syscall *ktp; - register int len = sizeof(struct ktr_syscall) + (narg * sizeof(int)); + register int len = sizeof(struct ktr_syscall) + (narg * sizeof(register_t)); struct proc *p = curproc; /* XXX */ - int *argp, i; + register_t *argp; + int i; p->p_traceflag |= KTRFAC_ACTIVE; kth = ktrgetheader(KTR_SYSCALL); MALLOC(ktp, struct ktr_syscall *, len, M_KTRACE, M_WAITOK); ktp->ktr_code = code; ktp->ktr_narg = narg; - argp = (int *)((char *)ktp + sizeof(struct ktr_syscall)); + argp = (register_t *)((char *)ktp + sizeof(struct ktr_syscall)); for (i = 0; i < narg; i++) *argp++ = args[i]; kth->ktr_buf = (caddr_t)ktp; Index: sys/sys/ktrace.h =================================================================== RCS file: /pub/FreeBSD-CVS/src/sys/sys/ktrace.h,v retrieving revision 1.12 diff -u -u -r1.12 ktrace.h --- ktrace.h 1997/02/22 09:45:26 1.12 +++ ktrace.h 1999/01/24 00:32:11 @@ -76,10 +76,10 @@ */ #define KTR_SYSCALL 1 struct ktr_syscall { - short ktr_code; /* syscall number */ - short ktr_narg; /* number of arguments */ + int ktr_code; /* syscall number */ + int ktr_narg; /* number of arguments */ /* - * followed by ktr_narg ints + * followed by ktr_narg register_t */ }; @@ -160,7 +160,7 @@ void ktrcsw __P((struct vnode *,int,int)); void ktrpsig __P((struct vnode *,int, sig_t, int, int)); void ktrgenio __P((struct vnode *,int, enum uio_rw,struct iovec *,int,int)); -void ktrsyscall __P((struct vnode *, int, int narg, int args[])); +void ktrsyscall __P((struct vnode *, int, int narg, register_t args[])); void ktrsysret __P((struct vnode *, int, int, int)); #else /* KERNEL */ Index: sys/alpha/alpha/trap.c =================================================================== RCS file: /pub/FreeBSD-CVS/src/sys/alpha/alpha/trap.c,v retrieving revision 1.10 diff -u -u -r1.10 trap.c --- trap.c 1998/12/30 10:38:58 1.10 +++ trap.c 1999/01/23 21:42:12 @@ -31,6 +31,7 @@ /* #include "opt_fix_unaligned_vax_fp.h" */ #include "opt_ddb.h" #include "opt_simos.h" +#include "opt_ktrace.h" #include <sys/param.h> #include <sys/systm.h> @@ -63,6 +64,11 @@ #include <ddb/ddb.h> #endif +#ifdef KTRACE +#include <sys/uio.h> +#include <sys/ktrace.h> +#endif + struct proc *fpcurproc; /* current user of the FPU */ void userret __P((struct proc *, u_int64_t, u_quad_t)); @@ -652,7 +658,7 @@ userret(p, framep->tf_regs[FRAME_PC], sticks); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) - ktrsysret(p->p_tracep, code, error, rval[0]); + ktrsysret(p->p_tracep, code, error, p->p_retval[0]); #endif /* Index: usr.bin/kdump/kdump.c =================================================================== RCS file: /pub/FreeBSD-CVS/src/usr.bin/kdump/kdump.c,v retrieving revision 1.11 diff -u -u -r1.11 kdump.c --- kdump.c 1997/07/16 06:49:49 1.11 +++ kdump.c 1999/01/24 01:03:46 @@ -240,14 +240,14 @@ register struct ktr_syscall *ktr; { register narg = ktr->ktr_narg; - register int *ip; + register_t *ip; char *ioctlname(); if (ktr->ktr_code >= nsyscalls || ktr->ktr_code < 0) (void)printf("[%d]", ktr->ktr_code); else (void)printf("%s", syscallnames[ktr->ktr_code]); - ip = (int *)((char *)ktr + sizeof(struct ktr_syscall)); + ip = (register_t *)((char *)ktr + sizeof(struct ktr_syscall)); if (narg) { char c = '('; if (fancy) { @@ -414,8 +414,8 @@ if (psig->action == SIG_DFL) (void)printf("SIG_DFL\n"); else - (void)printf("caught handler=0x%x mask=0x%x code=0x%x\n", - (u_int)psig->action, psig->mask, psig->code); + (void)printf("caught handler=0x%lx mask=0x%x code=0x%x\n", + psig->action, psig->mask, psig->code); } ktrcsw(cs) Index: usr.bin/kdump/mkioctls =================================================================== RCS file: /pub/FreeBSD-CVS/src/usr.bin/kdump/mkioctls,v retrieving revision 1.6 diff -u -r1.6 mkioctls --- mkioctls 1998/10/16 15:33:17 1.6 +++ mkioctls 1999/01/24 00:58:56 @@ -49,6 +49,7 @@ print "" print "char *" print "ioctlname(val)" + print "\tu_long val;" print "{" print "" generate_case_statement = 0 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990125211845Q.simokawa>