From owner-p4-projects@FreeBSD.ORG Fri Oct 10 16:33:46 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C2F0516A4C0; Fri, 10 Oct 2003 16:33:45 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9A75616A4B3 for ; Fri, 10 Oct 2003 16:33:45 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2224143F75 for ; Fri, 10 Oct 2003 16:33:44 -0700 (PDT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h9ANXiXJ034895 for ; Fri, 10 Oct 2003 16:33:44 -0700 (PDT) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h9ANXhii034892 for perforce@freebsd.org; Fri, 10 Oct 2003 16:33:43 -0700 (PDT) (envelope-from sam@freebsd.org) Date: Fri, 10 Oct 2003 16:33:43 -0700 (PDT) Message-Id: <200310102333.h9ANXhii034892@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 39479 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2003 23:33:46 -0000 http://perforce.freebsd.org/chv.cgi?CH=39479 Change 39479 by sam@sam_ebb on 2003/10/10 16:32:52 IFC @ 39478 Affected files ... .. //depot/projects/netperf/sys/alpha/alpha/trap.c#3 integrate .. //depot/projects/netperf/sys/amd64/amd64/trap.c#4 integrate .. //depot/projects/netperf/sys/contrib/ia64/libuwx/src/Makefile#2 integrate .. //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx.h#2 integrate .. //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_context.c#2 integrate .. //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_env.h#2 integrate .. //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_scoreboard.c#2 integrate .. //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_self.c#2 integrate .. //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_step.c#2 integrate .. //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_step.h#1 branch .. //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_trace.c#2 integrate .. //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_trace.h#2 integrate .. //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_ttrace.c#2 integrate .. //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_uinfo.c#2 integrate .. //depot/projects/netperf/sys/crypto/cast128/cast128.c#2 integrate .. //depot/projects/netperf/sys/crypto/cast128/cast128.h#2 integrate .. //depot/projects/netperf/sys/crypto/cast128/cast128_subkey.h#2 delete .. //depot/projects/netperf/sys/crypto/cast128/cast128sb.h#1 branch .. //depot/projects/netperf/sys/dev/amr/amr.c#4 integrate .. //depot/projects/netperf/sys/dev/amr/amr_disk.c#3 integrate .. //depot/projects/netperf/sys/dev/amr/amrvar.h#2 integrate .. //depot/projects/netperf/sys/dev/ata/ata-all.c#7 integrate .. //depot/projects/netperf/sys/dev/ata/ata-lowlevel.c#7 integrate .. //depot/projects/netperf/sys/dev/em/if_em.c#7 edit .. //depot/projects/netperf/sys/dev/em/if_em.h#7 edit .. //depot/projects/netperf/sys/dev/usb/usbdevs#6 integrate .. //depot/projects/netperf/sys/dev/usb/usbdevs.h#6 integrate .. //depot/projects/netperf/sys/dev/usb/usbdevs_data.h#6 integrate .. //depot/projects/netperf/sys/i386/i386/machdep.c#6 integrate .. //depot/projects/netperf/sys/i386/i386/trap.c#4 integrate .. //depot/projects/netperf/sys/ia64/ia64/trap.c#6 integrate .. //depot/projects/netperf/sys/ia64/ia64/unwind.c#2 integrate .. //depot/projects/netperf/sys/kern/sys_process.c#5 integrate .. //depot/projects/netperf/sys/kern/vfs_bio.c#8 integrate .. //depot/projects/netperf/sys/netinet6/esp_core.c#3 integrate .. //depot/projects/netperf/sys/netinet6/icmp6.c#6 integrate .. //depot/projects/netperf/sys/netinet6/in6.c#7 integrate .. //depot/projects/netperf/sys/netinet6/in6_gif.c#4 integrate .. //depot/projects/netperf/sys/netinet6/in6_ifattach.c#8 integrate .. //depot/projects/netperf/sys/netinet6/ip6_forward.c#7 integrate .. //depot/projects/netperf/sys/netinet6/ip6_input.c#9 integrate .. //depot/projects/netperf/sys/netinet6/ip6_output.c#13 integrate .. //depot/projects/netperf/sys/netinet6/ipcomp_input.c#3 integrate .. //depot/projects/netperf/sys/netinet6/mld6.c#2 integrate .. //depot/projects/netperf/sys/netinet6/mld6_var.h#2 integrate .. //depot/projects/netperf/sys/netinet6/nd6.c#9 integrate .. //depot/projects/netperf/sys/netinet6/nd6.h#3 integrate .. //depot/projects/netperf/sys/netinet6/nd6_nbr.c#3 integrate .. //depot/projects/netperf/sys/netinet6/nd6_rtr.c#6 integrate .. //depot/projects/netperf/sys/netinet6/raw_ip6.c#3 integrate .. //depot/projects/netperf/sys/netinet6/scope6.c#3 integrate .. //depot/projects/netperf/sys/netinet6/scope6_var.h#2 integrate .. //depot/projects/netperf/sys/netinet6/udp6_usrreq.c#3 integrate .. //depot/projects/netperf/sys/pci/if_ti.c#4 integrate .. //depot/projects/netperf/sys/sparc64/sparc64/trap.c#3 integrate .. //depot/projects/netperf/sys/sys/ptrace.h#3 integrate Differences ... ==== //depot/projects/netperf/sys/alpha/alpha/trap.c#3 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/alpha/alpha/trap.c,v 1.116 2003/08/22 07:20:25 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/alpha/trap.c,v 1.117 2003/10/09 10:17:15 robert Exp $"); /* #include "opt_fix_unaligned_vax_fp.h" */ #include "opt_ddb.h" @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -729,6 +730,8 @@ STOPEVENT(p, S_SCE, (callp->sy_narg & SYF_ARGMASK)); + PTRACESTOP_SC(p, td, S_PT_SCE); + error = (*callp->sy_call)(td, args + hidden); } @@ -775,6 +778,8 @@ */ STOPEVENT(p, S_SCX, code); + PTRACESTOP_SC(p, td, S_PT_SCX); + #ifdef DIAGNOSTIC cred_free_thread(td); #endif ==== //depot/projects/netperf/sys/amd64/amd64/trap.c#4 (text+ko) ==== @@ -38,7 +38,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/trap.c,v 1.264 2003/09/22 22:52:46 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/trap.c,v 1.265 2003/10/09 10:17:16 robert Exp $"); /* * AMD64 Trap and System call handling @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -740,6 +741,8 @@ STOPEVENT(p, S_SCE, narg); + PTRACESTOP_SC(p, td, S_PT_SCE); + error = (*callp->sy_call)(td, argp); } @@ -808,6 +811,8 @@ */ STOPEVENT(p, S_SCX, code); + PTRACESTOP_SC(p, td, S_PT_SCX); + #ifdef DIAGNOSTIC cred_free_thread(td); #endif ==== //depot/projects/netperf/sys/contrib/ia64/libuwx/src/Makefile#2 (text+ko) ==== @@ -8,11 +8,11 @@ AR = ar RANLIB = : +OTHERCFLAGS = # OTHERCFLAGS = -DUWX_TRACE_ENABLE # Enables trace output # OTHERCFLAGS = +DD64 # Builds 64-bit library -OTHERCFLAGS = -CFLAGS = +W944 -O $(OTHERCFLAGS) +CFLAGS = -O $(OTHERCFLAGS) OBJS = uwx_bstream.o uwx_context.o uwx_env.o uwx_scoreboard.o \ uwx_step.o uwx_str.o uwx_swap.o uwx_trace.o uwx_uinfo.o \ @@ -36,7 +36,7 @@ uwx_bstream.o: uwx.h uwx_env.h uwx_bstream.h -uwx_context.o: uwx.h uwx_env.h uwx_scoreboard.h uwx_trace.h +uwx_context.o: uwx.h uwx_env.h uwx_scoreboard.h uwx_step.h uwx_trace.h uwx_env.o: uwx.h uwx_env.h uwx_scoreboard.h uwx_str.h uwx_trace.h ==== //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx.h#2 (text+ko) ==== @@ -208,18 +208,26 @@ #define UWX_REG_CFM 3 /* cfm (no spill info) */ #define UWX_REG_RP 4 /* rp (pseudo-register) */ #define UWX_REG_PSP 5 /* psp (pseudo-register) */ -#define UWX_REG_PFS 6 /* ar.pfs */ +#define UWX_REG_PFS 6 /* pfs (pseudo-register) */ #define UWX_REG_PREDS 7 /* p0 - p63 */ #define UWX_REG_PRIUNAT 8 /* primary unat (pseudo-register) */ -#define UWX_REG_BSPSTORE 9 /* ar.bspstore */ -#define UWX_REG_RNAT 10 /* ar.rnat */ -#define UWX_REG_UNAT 11 /* ar.unat */ -#define UWX_REG_FPSR 12 /* ar.fpsr */ -#define UWX_REG_LC 13 /* ar.lc */ +#define UWX_REG_AR_PFS 9 /* ar.pfs */ +#define UWX_REG_AR_BSPSTORE 10 /* ar.bspstore */ +#define UWX_REG_AR_RNAT 11 /* ar.rnat */ +#define UWX_REG_AR_UNAT 12 /* ar.unat */ +#define UWX_REG_AR_FPSR 13 /* ar.fpsr */ +#define UWX_REG_AR_LC 14 /* ar.lc */ #define UWX_REG_GR(gr) (0x100 | (gr)) #define UWX_REG_FR(fr) (0x200 | (fr)) #define UWX_REG_BR(br) (0x300 | (br)) +/* for backwards compatibility with previous releases... */ +#define UWX_REG_BSPSTORE UWX_REG_AR_BSPSTORE +#define UWX_REG_RNAT UWX_REG_AR_RNAT +#define UWX_REG_UNAT UWX_REG_AR_UNAT +#define UWX_REG_FPSR UWX_REG_AR_FPSR +#define UWX_REG_LC UWX_REG_AR_LC + /* Values corresponding to UWX_KEY_SPILL keys indicate the disposition */ /* of the spilled register -- either in the memory stack or in another */ /* register. The PSP register may also have a disposition of "SPPLUS", */ ==== //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_context.c#2 (text+ko) ==== @@ -23,6 +23,7 @@ #include "uwx_env.h" #include "uwx_context.h" #include "uwx_scoreboard.h" +#include "uwx_step.h" #include "uwx_trace.h" int uwx_init_context( @@ -46,6 +47,7 @@ for (i = 0; i < NPRESERVEDGR; i++) env->context.gr[i] = 0; env->context.valid_regs = VALID_BASIC4; + env->context.valid_frs = 0; env->rstate = 0; (void)uwx_init_history(env); return UWX_OK; @@ -64,8 +66,17 @@ status = UWX_OK; + if (regid == UWX_REG_GR(12)) + regid = UWX_REG_SP; if (regid < NSPECIALREG && (env->context.valid_regs & (1 << regid))) *valp = env->context.special[regid]; + else if (regid == UWX_REG_PSP || regid == UWX_REG_RP || + regid == UWX_REG_PFS) { + status = uwx_restore_markers(env); + if (status != UWX_OK) + return status; + *valp = env->context.special[regid]; + } else if (regid >= UWX_REG_GR(4) && regid <= UWX_REG_GR(7) && (env->context.valid_regs & (1 << (regid - UWX_REG_GR(4) + VALID_GR_SHIFT))) ) @@ -94,13 +105,13 @@ (env->context.valid_regs & (1 << (regid - UWX_REG_BR(1) + VALID_BR_SHIFT))) ) *valp = env->context.br[regid - UWX_REG_BR(1)]; - else if (regid >= UWX_REG_FR(2) && regid <= UWX_REG_BR(5) && - (env->context.valid_frs & (1 << (regid - UWX_REG_FR(2)))) ) { + else if (regid >= UWX_REG_FR(2) && regid <= UWX_REG_FR(5) && + (env->context.valid_frs & (1 << (regid - UWX_REG_FR(2)))) ) { valp[0] = env->context.fr[regid - UWX_REG_FR(2)].part0; valp[1] = env->context.fr[regid - UWX_REG_FR(2)].part1; } - else if (regid >= UWX_REG_FR(16) && regid <= UWX_REG_BR(31) && - (env->context.valid_frs & (1 << (regid - UWX_REG_FR(2)))) ) { + else if (regid >= UWX_REG_FR(16) && regid <= UWX_REG_FR(31) && + (env->context.valid_frs & (1 << (regid - UWX_REG_FR(16) + 4))) ) { valp[0] = env->context.fr[regid - UWX_REG_FR(16) + 4].part0; valp[1] = env->context.fr[regid - UWX_REG_FR(16) + 4].part1; } @@ -114,7 +125,7 @@ if (n != DWORDSZ) status = UWX_ERR_COPYIN_REG; } - else if (regid >= UWX_REG_FR(2) && regid <= UWX_REG_BR(127)) { + else if (regid >= UWX_REG_FR(2) && regid <= UWX_REG_FR(127)) { if (env->copyin == 0) return UWX_ERR_NOCALLBACKS; n = (*env->copyin)(UWX_COPYIN_REG, (char *)valp, @@ -170,7 +181,7 @@ natcollp = bsp | 0x01f8; if (natcollp >= bsp) n = (*env->copyin)(UWX_COPYIN_REG, (char *)&natcoll, - (uint64_t)UWX_REG_RNAT, DWORDSZ, env->cb_token); + (uint64_t)UWX_REG_AR_RNAT, DWORDSZ, env->cb_token); else n = (*env->copyin)(UWX_COPYIN_RSTACK, (char *)&natcoll, bsp, DWORDSZ, env->cb_token); @@ -197,6 +208,8 @@ status = UWX_OK; + if (regid == UWX_REG_GR(12)) + regid = UWX_REG_SP; if (regid < NSPECIALREG) *dispp = env->history.special[regid]; else if (regid >= UWX_REG_GR(4) && regid <= UWX_REG_GR(7)) @@ -233,6 +246,8 @@ if (env == 0) return UWX_ERR_NOENV; + if (regid == UWX_REG_GR(12)) + regid = UWX_REG_SP; if (regid < NSPECIALREG) { env->context.special[regid] = val; env->context.valid_regs |= 1 << regid; ==== //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_env.h#2 (text+ko) ==== @@ -39,7 +39,7 @@ #define NSCOREBOARDS 8 /* Initial allocation of scoreboards */ -#define NSPECIALREG 14 +#define NSPECIALREG 16 /* Must be even, so FRs are aligned */ #define NPRESERVEDGR 4 #define NPRESERVEDBR 5 #define NPRESERVEDFR 20 @@ -61,7 +61,8 @@ #define VALID_GR_SHIFT NSPECIALREG #define VALID_BR_SHIFT (NSPECIALREG + NPRESERVEDGR) -#define VALID_BASIC4 0x0f /* IP, SP, BSP, PFS */ +#define VALID_BASIC4 0x0f /* IP, SP, BSP, CFM */ +#define VALID_MARKERS 0x70 /* RP, PSP, PFS */ struct uwx_history { uint64_t special[NSPECIALREG]; ==== //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_scoreboard.c#2 (text+ko) ==== @@ -63,8 +63,8 @@ sb->rstate[i] = UWX_DISP_NONE; sb->rstate[SBREG_RP] = UWX_DISP_REG(UWX_REG_BR(0)); sb->rstate[SBREG_PSP] = UWX_DISP_SPPLUS(0); - sb->rstate[SBREG_PFS] = UWX_DISP_REG(UWX_REG_PFS); - sb->rstate[SBREG_PRIUNAT] = UWX_DISP_REG(UWX_REG_UNAT); + sb->rstate[SBREG_PFS] = UWX_DISP_REG(UWX_REG_AR_PFS); + sb->rstate[SBREG_PRIUNAT] = UWX_DISP_REG(UWX_REG_AR_UNAT); sb->label = 0; return sb; } ==== //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_self.c#2 (text+ko) ==== @@ -91,18 +91,33 @@ uint64_t cfm; unsigned int nat; uint64_t ec; + int adj; info->ucontext = ucontext; status = __uc_get_reason(ucontext, &reason); status = __uc_get_ip(ucontext, &ip); status = __uc_get_grs(ucontext, 12, 1, &sp, &nat); + status = __uc_get_cfm(ucontext, &cfm); +#ifdef NEW_UC_GET_AR + status = __uc_get_ar_bsp(ucontext, &bsp); + status = __uc_get_ar_bspstore(ucontext, &info->bspstore); + status = __uc_get_ar_ec(ucontext, &ec); +#else status = __uc_get_ar(ucontext, 17, &bsp); status = __uc_get_ar(ucontext, 18, &info->bspstore); status = __uc_get_ar(ucontext, 66, &ec); - status = __uc_get_cfm(ucontext, &cfm); +#endif + /* The returned bsp needs to be adjusted. */ + /* For interrupt frames, where bsp was advanced by a cover */ + /* instruction, subtract sof (size of frame). For non-interrupt */ + /* frames, where bsp was advanced by br.call, subtract sol */ + /* (size of locals). */ + if (reason != 0) + adj = (unsigned int)cfm & 0x7f; /* interrupt frame */ + else + adj = ((unsigned int)cfm >> 7) & 0x7f; /* non-interrupt frame */ + bsp = uwx_add_to_bsp(bsp, -adj); cfm |= ec << 52; - if (reason != 0) - bsp = uwx_add_to_bsp(bsp, -((unsigned int)cfm & 0x7f)); uwx_init_context(env, ip, sp, bsp, cfm); return UWX_OK; } @@ -171,22 +186,22 @@ regid = (int)rem; if (rem < UWX_REG_GR(0)) { switch (regid) { - case UWX_REG_PFS: - status = __uc_get_ar(info->ucontext, 64, dp); - break; case UWX_REG_PREDS: status = __uc_get_prs(info->ucontext, dp); break; - case UWX_REG_RNAT: + case UWX_REG_AR_PFS: + status = __uc_get_ar(info->ucontext, 64, dp); + break; + case UWX_REG_AR_RNAT: status = __uc_get_ar(info->ucontext, 19, dp); break; - case UWX_REG_UNAT: + case UWX_REG_AR_UNAT: status = __uc_get_ar(info->ucontext, 36, dp); break; - case UWX_REG_FPSR: + case UWX_REG_AR_FPSR: status = __uc_get_ar(info->ucontext, 40, dp); break; - case UWX_REG_LC: + case UWX_REG_AR_LC: status = __uc_get_ar(info->ucontext, 65, dp); break; default: ==== //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_step.c#2 (text+ko) ==== @@ -26,6 +26,7 @@ #include "uwx_uinfo.h" #include "uwx_scoreboard.h" #include "uwx_str.h" +#include "uwx_step.h" #include "uwx_trace.h" /* @@ -44,6 +45,8 @@ int uwx_decode_uvec(struct uwx_env *env, uint64_t *uvec, uint64_t **rstate); int uwx_restore_reg(struct uwx_env *env, uint64_t rstate, uint64_t *valp, uint64_t *histp); +int uwx_restore_freg(struct uwx_env *env, uint64_t rstate, + uint64_t *valp, uint64_t *histp); int uwx_restore_nat(struct uwx_env *env, uint64_t rstate, int unat); @@ -59,12 +62,8 @@ struct uwx_utable_entry uentry; uint64_t uvecout[4]; - if (env == 0) - return UWX_ERR_NOENV; if (env->copyin == 0 || env->lookupip == 0) return UWX_ERR_NOCALLBACKS; - if ((env->context.valid_regs & VALID_BASIC4) != VALID_BASIC4) - return UWX_ERR_NOCONTEXT; env->function_offset = -1LL; env->function_name = 0; @@ -131,7 +130,63 @@ } +/* uwx_restore_markers: Restores the stack markers -- PSP, RP, PFS */ + +int uwx_restore_markers(struct uwx_env *env) +{ + int status; + uint64_t val; + uint64_t hist; + + if ((env->context.valid_regs & VALID_BASIC4) != VALID_BASIC4) + return UWX_ERR_NOCONTEXT; + + /* If we haven't already obtained the frame info for the */ + /* current frame, get it now. */ + + if (env->rstate == 0) { + status = uwx_get_frame_info(env); + if (status != UWX_OK) + return status; + } + + TRACE_S_STEP(env->rstate) + + if (env->rstate[SBREG_PSP] != UWX_DISP_NONE) { + status = uwx_restore_reg(env, env->rstate[SBREG_PSP], &val, &hist); + if (status != UWX_OK) + return status; + env->context.special[UWX_REG_PSP] = val; + env->history.special[UWX_REG_PSP] = hist; + env->context.valid_regs |= 1 << UWX_REG_PSP; + TRACE_S_RESTORE_REG("PSP", env->rstate[SBREG_PSP], val) + } + + if (env->rstate[SBREG_RP] != UWX_DISP_NONE) { + status = uwx_restore_reg(env, env->rstate[SBREG_RP], &val, &hist); + if (status != UWX_OK) + return status; + env->context.special[UWX_REG_RP] = val; + env->history.special[UWX_REG_RP] = hist; + env->context.valid_regs |= 1 << UWX_REG_RP; + TRACE_S_RESTORE_REG("RP", env->rstate[SBREG_RP], val) + } + + if (env->rstate[SBREG_PFS] != UWX_DISP_NONE) { + status = uwx_restore_reg(env, env->rstate[SBREG_PFS], &val, &hist); + if (status != UWX_OK) + return status; + env->context.special[UWX_REG_PFS] = val; + env->history.special[UWX_REG_PFS] = hist; + env->context.valid_regs |= 1 << UWX_REG_PFS; + TRACE_S_RESTORE_REG("PFS", env->rstate[SBREG_PFS], val) + } + + return UWX_OK; +} + /* uwx_get_sym_info: Gets symbolic info from current frame */ + int uwx_get_sym_info( struct uwx_env *env, char **modp, @@ -147,10 +202,6 @@ if (env == 0) return UWX_ERR_NOENV; - if (env->copyin == 0 || env->lookupip == 0) - return UWX_ERR_NOCALLBACKS; - if ((env->context.valid_regs & VALID_BASIC4) != VALID_BASIC4) - return UWX_ERR_NOCONTEXT; /* If we haven't already obtained the frame info for the */ /* current frame, get it now. */ @@ -221,48 +272,15 @@ if (env == 0) return UWX_ERR_NOENV; - if (env->copyin == 0 || env->lookupip == 0) - return UWX_ERR_NOCALLBACKS; - if ((env->context.valid_regs & VALID_BASIC4) != VALID_BASIC4) - return UWX_ERR_NOCONTEXT; - - /* If we haven't already obtained the frame info for the */ - /* current frame, get it now. */ - - if (env->rstate == 0) { - status = uwx_get_frame_info(env); - if (status != UWX_OK) - return status; - } - - TRACE_S_STEP(env->rstate) /* Complete the current context by restoring the current values */ /* of psp, rp, and pfs. */ - if (env->rstate[SBREG_PSP] != UWX_DISP_NONE) { - status = uwx_restore_reg(env, env->rstate[SBREG_PSP], &val, &hist); + if (env->rstate == 0 || + (env->context.valid_regs & VALID_MARKERS) != VALID_MARKERS) { + status = uwx_restore_markers(env); if (status != UWX_OK) return status; - env->context.special[UWX_REG_PSP] = val; - env->history.special[UWX_REG_PSP] = hist; - TRACE_S_RESTORE_REG("PSP", env->rstate[SBREG_PSP], val) - } - if (env->rstate[SBREG_RP] != UWX_DISP_NONE) { - status = uwx_restore_reg(env, env->rstate[SBREG_RP], &val, &hist); - if (status != UWX_OK) - return status; - env->context.special[UWX_REG_RP] = val; - env->history.special[UWX_REG_RP] = hist; - TRACE_S_RESTORE_REG("RP", env->rstate[SBREG_RP], val) - } - if (env->rstate[SBREG_PFS] != UWX_DISP_NONE) { - status = uwx_restore_reg(env, env->rstate[SBREG_PFS], &val, &hist); - if (status != UWX_OK) - return status; - env->context.special[UWX_REG_PFS] = val; - env->history.special[UWX_REG_PFS] = hist; - TRACE_S_RESTORE_REG("PFS", env->rstate[SBREG_PFS], val) } /* Check for bottom of stack (rp == 0). */ @@ -336,7 +354,7 @@ if (env->nsbreg == NSBREG) { for (i = 0; i < NSB_FR; i++) { if (env->rstate[SBREG_FR + i] != UWX_DISP_NONE) { - status = uwx_restore_reg(env, + status = uwx_restore_freg(env, env->rstate[SBREG_FR + i], fval, &hist); if (status != UWX_OK) return status; @@ -364,36 +382,36 @@ status = uwx_restore_reg(env, env->rstate[SBREG_RNAT], &val, &hist); if (status != UWX_OK) return status; - env->context.special[UWX_REG_RNAT] = val; - env->history.special[UWX_REG_RNAT] = hist; - env->context.valid_regs |= 1 << UWX_REG_RNAT; + env->context.special[UWX_REG_AR_RNAT] = val; + env->history.special[UWX_REG_AR_RNAT] = hist; + env->context.valid_regs |= 1 << UWX_REG_AR_RNAT; TRACE_S_RESTORE_REG("RNAT", env->rstate[SBREG_RNAT], val) } if (env->rstate[SBREG_UNAT] != UWX_DISP_NONE) { status = uwx_restore_reg(env, env->rstate[SBREG_UNAT], &val, &hist); if (status != UWX_OK) return status; - env->context.special[UWX_REG_UNAT] = val; - env->history.special[UWX_REG_UNAT] = hist; - env->context.valid_regs |= 1 << UWX_REG_UNAT; + env->context.special[UWX_REG_AR_UNAT] = val; + env->history.special[UWX_REG_AR_UNAT] = hist; + env->context.valid_regs |= 1 << UWX_REG_AR_UNAT; TRACE_S_RESTORE_REG("UNAT", env->rstate[SBREG_UNAT], val) } if (env->rstate[SBREG_FPSR] != UWX_DISP_NONE) { status = uwx_restore_reg(env, env->rstate[SBREG_FPSR], &val, &hist); if (status != UWX_OK) return status; - env->context.special[UWX_REG_FPSR] = val; - env->history.special[UWX_REG_FPSR] = hist; - env->context.valid_regs |= 1 << UWX_REG_FPSR; + env->context.special[UWX_REG_AR_FPSR] = val; + env->history.special[UWX_REG_AR_FPSR] = hist; + env->context.valid_regs |= 1 << UWX_REG_AR_FPSR; TRACE_S_RESTORE_REG("FPSR", env->rstate[SBREG_FPSR], val) } if (env->rstate[SBREG_LC] != UWX_DISP_NONE) { status = uwx_restore_reg(env, env->rstate[SBREG_LC], &val, &hist); if (status != UWX_OK) return status; - env->context.special[UWX_REG_LC] = val; - env->history.special[UWX_REG_LC] = hist; - env->context.valid_regs |= 1 << UWX_REG_LC; + env->context.special[UWX_REG_AR_LC] = val; + env->history.special[UWX_REG_AR_LC] = hist; + env->context.valid_regs |= 1 << UWX_REG_AR_LC; TRACE_S_RESTORE_REG("LC", env->rstate[SBREG_LC], val) } @@ -426,6 +444,7 @@ /* The frame info for the new frame isn't yet available. */ env->rstate = 0; + env->context.valid_regs &= ~VALID_MARKERS; return UWX_OK; } @@ -497,6 +516,50 @@ return status; } +#define COPYIN_MSTACK_16(dest, src) \ + (env->remote? \ + (*env->copyin)(UWX_COPYIN_MSTACK, (dest), (src), \ + 2*DWORDSZ, env->cb_token) : \ + (*(uint64_t *)(dest) = *(uint64_t *)(src), \ + *(uint64_t *)((dest)+8) = *(uint64_t *)((src)+8), \ + 2*DWORDSZ) ) + +int uwx_restore_freg(struct uwx_env *env, uint64_t rstate, + uint64_t *valp, uint64_t *histp) +{ + int status; + uint64_t p; + int n; + int regid; + + status = UWX_OK; + + switch (UWX_GET_DISP_CODE(rstate)) { + case UWX_DISP_SPREL(0): + p = env->context.special[UWX_REG_SP] + + UWX_GET_DISP_OFFSET(rstate); + n = COPYIN_MSTACK_16((char *)valp, p); + if (n != 2*DWORDSZ) + status = UWX_ERR_COPYIN_MSTK; + *histp = UWX_DISP_MSTK(p); + break; + case UWX_DISP_PSPREL(0): + p = env->context.special[UWX_REG_PSP] + 16 - + UWX_GET_DISP_OFFSET(rstate); + n = COPYIN_MSTACK_16((char *)valp, p); + if (n != 2*DWORDSZ) + status = UWX_ERR_COPYIN_MSTK; + *histp = UWX_DISP_MSTK(p); + break; + case UWX_DISP_REG(0): + regid = UWX_GET_DISP_REGID(rstate); + status = uwx_get_reg(env, regid, valp); + (void) uwx_get_spill_loc(env, regid, histp); + break; + } + return status; +} + /* uwx_restore_nat: Returns the saved NaT bit for a preserved GR */ int uwx_restore_nat(struct uwx_env *env, uint64_t rstate, int unat) ==== //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_trace.c#2 (text+ko) ==== @@ -98,9 +98,9 @@ break; case UWX_DISP_REG(0): reg = UWX_GET_DISP_REGID(rstate); - if (reg == UWX_REG_PFS) + if (reg == UWX_REG_AR_PFS) printf(" [AR.PFS]\n"); - else if (reg == UWX_REG_UNAT) + else if (reg == UWX_REG_AR_UNAT) printf(" [AR.UNAT]\n"); else if (reg >= UWX_REG_GR(0) && reg < UWX_REG_GR(128)) printf(" [GR%d]\n", reg - UWX_REG_GR(0)); ==== //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_trace.h#2 (text+ko) ==== @@ -29,55 +29,8 @@ #define UWX_TRACE_COPYIN 64 /* UWX_TRACE=C: copyin callback */ #define UWX_TRACE_LOOKUPIP 128 /* UWX_TRACE=L: lookupip callback */ -#ifndef UWX_TRACE_ENABLE - -#define TRACE_INIT -#define TRACE_B_REUSE(id) -#define TRACE_B_ALLOC(id) -#define TRACE_B_POP(id) -#define TRACE_B_LABEL(label) -#define TRACE_B_LABEL_COPY(id) -#define TRACE_B_LABEL_REVERSE(back, new) -#define TRACE_B_COPY(label, id) -#define TRACE_B_COPY_FREE(id) -#define TRACE_B_COPY_FOUND(id) -#define TRACE_B_COPY_COPY(id) -#define TRACE_B_COPY_REVERSE(back, new) -#define TRACE_B_FREE(id) -#define TRACE_I_DECODE_RHDR_1(name, b0) -#define TRACE_I_DECODE_RHDR_1L(name, b0, val) -#define TRACE_I_DECODE_RHDR_2L(name, b0, b1, val) -#define TRACE_I_DECODE_PROLOGUE_1(name, b0) -#define TRACE_I_DECODE_PROLOGUE_1L(name, b0, val) -#define TRACE_I_DECODE_PROLOGUE_1LL(name, b0, val1, val2) -#define TRACE_I_DECODE_PROLOGUE_2(name, b0, b1) -#define TRACE_I_DECODE_PROLOGUE_2L(name, b0, b1, parm1) -#define TRACE_I_DECODE_PROLOGUE_3(name, b0, b1, b2) -#define TRACE_I_DECODE_PROLOGUE_4(name, b0, b1, b2, b3) -#define TRACE_I_DECODE_PROLOGUE_SPILL_BASE(spill_base) -#define TRACE_I_DECODE_PROLOGUE_MASKS(gr_mem_mask, gr_gr_mask) -#define TRACE_I_DECODE_PROLOGUE_NSPILL(ngr) -#define TRACE_I_DECODE_BODY_1(name, b0) -#define TRACE_I_DECODE_BODY_1L(name, b0, parm1) -#define TRACE_I_DECODE_BODY_1LL(name, b0, parm1, parm2) -#define TRACE_R_UIB(uentry, ulen) -#define TRACE_R_DUMP_SB(scoreboard, rhdr, cur_slot, ip_slot) -#define TRACE_S_STEP(rstate) -#define TRACE_S_RESTORE_REG(regname, rstate, val) -#define TRACE_S_RESTORE_GR(regid, rstate, val) -#define TRACE_S_RESTORE_BR(regid, rstate, val) -#define TRACE_S_RESTORE_FR(regid, rstate, val) -#define TRACE_T_SEARCH32(ip) -#define TRACE_T_BINSEARCH32(lb, ub, mid, code_start, code_end) -#define TRACE_C_GET_REG(regid, bsp) -#define TRACE_C_ROTATE_GR(regid, sor, rrb_gr, newregid) -#define TRACE_SELF_COPYIN4(rem, len, wp) -#define TRACE_SELF_COPYIN8(rem, len, dp) -#define TRACE_SELF_LOOKUP(ip) -#define TRACE_SELF_LOOKUP_DESC(text_base, unwind_base) +#ifdef UWX_TRACE_ENABLE -#else /* !UWX_TRACE_ENABLE */ - extern void uwx_trace_init(struct uwx_env *env); extern void uwx_dump_rstate(int regid, uint64_t rstate); @@ -235,7 +188,7 @@ #define TRACE_S_STEP(rstate) \ if (env->trace & UWX_TRACE_STEP) { \ - printf("uwx_step:\n"); \ + printf("uwx_restore_markers:\n"); \ uwx_dump_rstate(SBREG_RP, (rstate)[SBREG_RP]); \ uwx_dump_rstate(SBREG_PSP, (rstate)[SBREG_PSP]); \ uwx_dump_rstate(SBREG_PFS, (rstate)[SBREG_PFS]); \ @@ -344,5 +297,52 @@ (unsigned int) ((text_base)+(unwind_base)[2])); \ } -#endif /* !UWX_TRACE_ENABLE */ +#else /* !UWX_TRACE_ENABLE */ + +#define TRACE_INIT +#define TRACE_B_REUSE(id) +#define TRACE_B_ALLOC(id) +#define TRACE_B_POP(id) +#define TRACE_B_LABEL(label) +#define TRACE_B_LABEL_COPY(id) +#define TRACE_B_LABEL_REVERSE(back, new) +#define TRACE_B_COPY(label, id) +#define TRACE_B_COPY_FREE(id) +#define TRACE_B_COPY_FOUND(id) +#define TRACE_B_COPY_COPY(id) +#define TRACE_B_COPY_REVERSE(back, new) +#define TRACE_B_FREE(id) +#define TRACE_I_DECODE_RHDR_1(name, b0) +#define TRACE_I_DECODE_RHDR_1L(name, b0, val) +#define TRACE_I_DECODE_RHDR_2L(name, b0, b1, val) +#define TRACE_I_DECODE_PROLOGUE_1(name, b0) +#define TRACE_I_DECODE_PROLOGUE_1L(name, b0, val) +#define TRACE_I_DECODE_PROLOGUE_1LL(name, b0, val1, val2) +#define TRACE_I_DECODE_PROLOGUE_2(name, b0, b1) +#define TRACE_I_DECODE_PROLOGUE_2L(name, b0, b1, parm1) +#define TRACE_I_DECODE_PROLOGUE_3(name, b0, b1, b2) +#define TRACE_I_DECODE_PROLOGUE_4(name, b0, b1, b2, b3) +#define TRACE_I_DECODE_PROLOGUE_SPILL_BASE(spill_base) +#define TRACE_I_DECODE_PROLOGUE_MASKS(gr_mem_mask, gr_gr_mask) +#define TRACE_I_DECODE_PROLOGUE_NSPILL(ngr) +#define TRACE_I_DECODE_BODY_1(name, b0) +#define TRACE_I_DECODE_BODY_1L(name, b0, parm1) +#define TRACE_I_DECODE_BODY_1LL(name, b0, parm1, parm2) +#define TRACE_R_UIB(uentry, ulen) +#define TRACE_R_DUMP_SB(scoreboard, rhdr, cur_slot, ip_slot) +#define TRACE_S_STEP(rstate) +#define TRACE_S_RESTORE_REG(regname, rstate, val) +#define TRACE_S_RESTORE_GR(regid, rstate, val) +#define TRACE_S_RESTORE_BR(regid, rstate, val) +#define TRACE_S_RESTORE_FR(regid, rstate, val) +#define TRACE_T_SEARCH32(ip) +#define TRACE_T_BINSEARCH32(lb, ub, mid, code_start, code_end) +#define TRACE_C_GET_REG(regid, bsp) +#define TRACE_C_ROTATE_GR(regid, sor, rrb_gr, newregid) +#define TRACE_SELF_COPYIN4(rem, len, wp) +#define TRACE_SELF_COPYIN8(rem, len, dp) +#define TRACE_SELF_LOOKUP(ip) +#define TRACE_SELF_LOOKUP_DESC(text_base, unwind_base) + +#endif /* UWX_TRACE_ENABLE */ ==== //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_ttrace.c#2 (text+ko) ==== @@ -249,22 +249,22 @@ if (info->have_ucontext) { if (regid < UWX_REG_GR(0)) { switch (regid) { - case UWX_REG_PFS: - status = __uc_get_ar(&info->ucontext, 64, dp); - break; case UWX_REG_PREDS: status = __uc_get_prs(&info->ucontext, dp); break; - case UWX_REG_RNAT: + case UWX_REG_AR_PFS: + status = __uc_get_ar(&info->ucontext, 64, dp); + break; + case UWX_REG_AR_RNAT: status = __uc_get_ar(&info->ucontext, 19, dp); break; - case UWX_REG_UNAT: + case UWX_REG_AR_UNAT: status = __uc_get_ar(&info->ucontext, 36, dp); break; - case UWX_REG_FPSR: + case UWX_REG_AR_FPSR: status = __uc_get_ar(&info->ucontext, 40, dp); break; - case UWX_REG_LC: + case UWX_REG_AR_LC: status = __uc_get_ar(&info->ucontext, 65, dp); break; default: @@ -283,22 +283,22 @@ else { if (regid < UWX_REG_GR(0)) { switch (regid) { - case UWX_REG_PFS: - ttreg = __ar_pfs; - break; case UWX_REG_PREDS: ttreg = __pr; break; - case UWX_REG_RNAT: + case UWX_REG_AR_PFS: + ttreg = __ar_pfs; + break; + case UWX_REG_AR_RNAT: ttreg = __ar_rnat; break; - case UWX_REG_UNAT: + case UWX_REG_AR_UNAT: ttreg = __ar_unat; break; - case UWX_REG_FPSR: + case UWX_REG_AR_FPSR: ttreg = __ar_fpsr; break; - case UWX_REG_LC: + case UWX_REG_AR_LC: ttreg = __ar_lc; break; default: ==== //depot/projects/netperf/sys/contrib/ia64/libuwx/src/uwx_uinfo.c#2 (text+ko) ==== @@ -232,7 +232,8 @@ if ((b0 & 0x20) == 0) { TRACE_I_DECODE_RHDR_1("(R1) prologue", b0) rhdr->is_prologue = 1; - } else { + } + else { TRACE_I_DECODE_RHDR_1("(R1) body", b0) } rhdr->rlen = b0 & 0x1f; @@ -263,7 +264,8 @@ if ((b0 & 0x03) == 0) { TRACE_I_DECODE_RHDR_1L("(R3) prologue", b0, val) rhdr->is_prologue = 1; - } else { + } + else { TRACE_I_DECODE_RHDR_1L("(R3) body", b0, val) } rhdr->rlen = (unsigned int) val; @@ -863,7 +865,7 @@ if (fr_mem_mask & 1) { newrstate[SBREG_FR + i] = UWX_DISP_PSPREL(fr_base); tspill[SBREG_FR + i] = 0; - fr_base -= 8; + fr_base -= 16; nfr--; } fr_mem_mask = fr_mem_mask >> 1; ==== //depot/projects/netperf/sys/crypto/cast128/cast128.c#2 (text+ko) ==== @@ -1,890 +1,247 @@ -/* $KAME: cast128.c,v 1.5 2001/11/27 09:47:32 sakane Exp $ */ +/* $NetBSD: cast128.c,v 1.7 2003/08/26 20:03:57 thorpej Exp $ */ +/* $OpenBSD: cast.c,v 1.2 2000/06/06 06:49:47 deraadt Exp $ */ /* - * heavily modified by Tomomi Suzuki - */ - -/* - * The CAST-128 Encryption Algorithm (RFC 2144) - * - * original implementation - * 1997/08/21 - */ -/* - * Copyright (C) 1997 Hideo "Sir MANMOS" Morishita - * 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 Hideo "Sir MaNMOS" Morishita ``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 Hideo "Sir MaNMOS" Morishita 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. + * CAST-128 in C + * Written by Steve Reid + * 100% Public Domain - no warranty + * Released 1997.10.11 */ #include -__FBSDID("$FreeBSD: src/sys/crypto/cast128/cast128.c,v 1.6 2003/06/10 21:39:41 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/crypto/cast128/cast128.c,v 1.7 2003/10/10 15:06:16 ume Exp $"); -#include -#include +#include #include -#include +#include +/* Macros to access 8-bit bytes out of a 32-bit word */ +#define U_INT8_Ta(x) ( (u_int8_t) (x>>24) ) +#define U_INT8_Tb(x) ( (u_int8_t) ((x>>16)&255) ) +#define U_INT8_Tc(x) ( (u_int8_t) ((x>>8)&255) ) +#define U_INT8_Td(x) ( (u_int8_t) ((x)&255) ) -static u_int32_t S1[]; -static u_int32_t S2[]; -static u_int32_t S3[]; -static u_int32_t S4[]; -static u_int32_t S5[]; -static u_int32_t S6[]; -static u_int32_t S7[]; -static u_int32_t S8[]; +/* Circular left shift */ +#define ROL(x, n) ( ((x)<<(n)) | ((x)>>(32-(n))) ) +/* CAST-128 uses three different round functions */ +#define F1(l, r, i) \ + t = ROL(key->xkey[i] + r, key->xkey[i+16]); \ + l ^= ((cast_sbox1[U_INT8_Ta(t)] ^ cast_sbox2[U_INT8_Tb(t)]) - \ + cast_sbox3[U_INT8_Tc(t)]) + cast_sbox4[U_INT8_Td(t)]; +#define F2(l, r, i) \ + t = ROL(key->xkey[i] ^ r, key->xkey[i+16]); \ + l ^= ((cast_sbox1[U_INT8_Ta(t)] - cast_sbox2[U_INT8_Tb(t)]) + \ + cast_sbox3[U_INT8_Tc(t)]) ^ cast_sbox4[U_INT8_Td(t)]; +#define F3(l, r, i) \ + t = ROL(key->xkey[i] - r, key->xkey[i+16]); \ + l ^= ((cast_sbox1[U_INT8_Ta(t)] + cast_sbox2[U_INT8_Tb(t)]) ^ \ + cast_sbox3[U_INT8_Tc(t)]) - cast_sbox4[U_INT8_Td(t)]; -/* >>> TRUNCATED FOR MAIL (1000 lines) <<<