PERFORCE change 31224 for review

Marcel Moolenaar marcel at FreeBSD.org
Thu May 15 00:55:40 PDT 2003


http://perforce.freebsd.org/chv.cgi?CH=31224

Change 31224 by marcel at marcel_nfs on 2003/05/15 00:55:00

	Glue the contributed unwinder into the build and fix the
	kernel debugger. Enable the debugger by default for SKI.

Affected files ...

.. //depot/projects/ia64_epc/sys/conf/Makefile.ia64#4 edit
.. //depot/projects/ia64_epc/sys/conf/files.ia64#13 edit
.. //depot/projects/ia64_epc/sys/ia64/conf/SKI#7 edit
.. //depot/projects/ia64_epc/sys/ia64/ia64/db_trace.c#4 edit
.. //depot/projects/ia64_epc/sys/ia64/ia64/unwind.c#4 edit
.. //depot/projects/ia64_epc/sys/ia64/include/unwind.h#4 edit

Differences ...

==== //depot/projects/ia64_epc/sys/conf/Makefile.ia64#4 (text+ko) ====

@@ -32,6 +32,8 @@
 .endif
 .include "$S/conf/kern.pre.mk"
 
+INCLUDES+= -I$S/contrib/ia64/libuwx/src
+
 CFLAGS+= -mconstant-gp
 
 ASM_CFLAGS= -x assembler-with-cpp -Wa,-x -DLOCORE ${CFLAGS}

==== //depot/projects/ia64_epc/sys/conf/files.ia64#13 (text+ko) ====

@@ -18,6 +18,19 @@
 	no-obj no-implicit-rule before-depend				\
 	clean		"atkbdmap.h"
 #
+contrib/ia64/libuwx/src/uwx_bstream.c		standard
+contrib/ia64/libuwx/src/uwx_context.c		standard
+contrib/ia64/libuwx/src/uwx_env.c		standard
+contrib/ia64/libuwx/src/uwx_scoreboard.c	standard
+#contrib/ia64/libuwx/src/uwx_self.c		standard
+#contrib/ia64/libuwx/src/uwx_self_context.s	standard
+contrib/ia64/libuwx/src/uwx_step.c		standard
+contrib/ia64/libuwx/src/uwx_str.c		standard
+contrib/ia64/libuwx/src/uwx_swap.c		standard
+contrib/ia64/libuwx/src/uwx_trace.c		standard
+#contrib/ia64/libuwx/src/uwx_ttrace.c		standard
+contrib/ia64/libuwx/src/uwx_uinfo.c		standard
+contrib/ia64/libuwx/src/uwx_utable.c		standard
 crypto/blowfish/bf_enc.c	optional	crypto
 crypto/blowfish/bf_enc.c	optional	ipsec ipsec_esp
 crypto/des/des_enc.c		optional	crypto

==== //depot/projects/ia64_epc/sys/ia64/conf/SKI#7 (text+ko) ====

@@ -30,6 +30,7 @@
 makeoptions	NO_MODULES=yes		#Ignore any x86 CPUTYPE
 
 options 	COMPAT_43		#Compatible with BSD 4.3 [KEEP THIS!]
+options 	DDB
 options 	FFS			#Berkeley Fast Filesystem
 options 	INET			#InterNETworking
 options 	INET6			#IPv6 communications protocols

==== //depot/projects/ia64_epc/sys/ia64/ia64/db_trace.c#4 (text+ko) ====

@@ -44,76 +44,61 @@
 int  db_md_clr_watchpoint(db_expr_t addr, db_expr_t size);
 void db_md_list_watchpoints(void);
 
-extern char ia64_vector_table[], do_syscall[], do_syscall_end[];
-
 void
-db_stack_trace_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, char *modif)
+db_stack_trace_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count,
+    char *modif)
 {
-#if 0
-	struct ia64_unwind_state *us;
+	struct unw_regstate rs;
+	const char *name;
+	db_expr_t offset;
+	uint64_t bsp, cfm, ip, pfs, reg;
+	c_db_sym_t sym;
+	int args, error, i;
 
-	if (count == -1)
-		count = 65535;
+	error = unw_create(&rs, &ddb_regs);
+	while (!error && count--) {
+		error = unw_get_cfm(&rs, &cfm);
+		if (!error)
+			error = unw_get_bsp(&rs, &bsp);
+		if (!error)
+			error = unw_get_ip(&rs, &ip);
+		if (error)
+			break;
 
-	if (!have_addr) {
-		us = ia64_create_unwind_state(&ddb_regs);
-	} else {
-		return;		/* XXX */
-	}
+		args = (cfm >> 7) & 0x7f;
+		if (args > 8)
+			args = 8;
 
-	if (!us) {
-		db_printf("db_stack_trace_cmd: can't create unwind state\n");
-		return;
-	}
+		error = unw_step(&rs);
+		if (!error) {
+			error = unw_get_cfm(&rs, &pfs);
+			if (!error) {
+				i = (pfs & 0x7f) - ((pfs >> 7) & 0x7f);
+				if (args > i)
+					args = i;
+			}
+		}
 
-	while (count--) {
-		const char *	name;
-		db_expr_t	ip;
-		db_expr_t	offset;
-		c_db_sym_t	sym;
-		int		cfm, sof, sol, nargs, i;
-		u_int64_t	*bsp;
-		u_int64_t	*p, reg;
-
-		ip = ia64_unwind_state_get_ip(us);
-		cfm = ia64_unwind_state_get_cfm(us);
-		bsp = ia64_unwind_state_get_bsp(us);
-		sof = cfm & 0x7f;
-		sol = (cfm >> 7) & 0x7f;
-
 		sym = db_search_symbol(ip, DB_STGY_ANY, &offset);
 		db_symbol_values(sym, &name, NULL);
-
 		db_printf("%s(", name);
-
-		nargs = sof - sol;
-		if (nargs > 8)
-			nargs = 8;
-		if (bsp >= (u_int64_t *)IA64_RR_BASE(5)) {
-			for (i = 0; i < nargs; i++) {
-				p = ia64_rse_register_address(bsp, 32 + i);
-				db_read_bytes((vm_offset_t) p, sizeof(reg),
-					      (caddr_t) &reg);
+		if (bsp >= IA64_RR_BASE(5)) {
+			for (i = 0; i < args; i++) {
+				if ((bsp & 0x1ff) == 0x1f8)
+					bsp += 8;
+				db_read_bytes(bsp, sizeof(reg), (void*)&reg);
 				if (i > 0)
 					db_printf(", ");
 				db_printf("0x%lx", reg);
+				bsp += 8;
 			}
-		}
+		} else
+			db_printf("...");
 		db_printf(") at ");
 
 		db_printsym(ip, DB_STGY_PROC);
 		db_printf("\n");
-
-		if (ia64_unwind_state_previous_frame(us))
-			break;
-
-		ip = ia64_unwind_state_get_ip(us);
-		if (!ip)
-			break;
 	}
-
-	ia64_free_unwind_state(us);
-#endif
 }
 
 void
@@ -144,4 +129,3 @@
 {
 	return;
 }
-

==== //depot/projects/ia64_epc/sys/ia64/ia64/unwind.c#4 (text+ko) ====

@@ -32,16 +32,12 @@
 #include <sys/malloc.h>
 #include <sys/queue.h>
 
-#include <machine/pcb.h>
+#include <machine/frame.h>
 #include <machine/unwind.h>
 
-#ifdef UNWIND_DEBUG
-#define DPF(x)	printf x
-#else
-#define DPF(x)
-#endif
+#include <uwx.h>
 
-MALLOC_DEFINE(M_UNWIND, "Unwind table", "Unwind table information");
+MALLOC_DEFINE(M_UNWIND, "Unwind", "Unwind information");
 
 struct unw_entry {
 	uint64_t	ue_start;	/* procedure start */
@@ -61,15 +57,21 @@
 
 static struct unw_table_list unw_tables;
 
+static void *
+unw_alloc(size_t sz)
+{
+
+	return (malloc(sz, M_UNWIND, M_WAITOK));
+}
+
 static void
-unw_initialize(void *dummy __unused)
+unw_free(void *p)
 {
 
-	LIST_INIT(&unw_tables);
+	free(p, M_UNWIND);
 }
-SYSINIT(unwind, SI_SUB_KMEM, SI_ORDER_ANY, unw_initialize, 0);
 
-#if NOTYET
+#if 0
 static struct unw_entry *
 unw_entry_lookup(struct unw_table *ut, uint64_t ip)
 {
@@ -103,1284 +105,203 @@
 	return (NULL);
 }
 
-static __inline void
-unw_set_loc(void *rs, void *pcb, int sz)
+static int
+unw_cb_copyin(int req, char *to, uint64_t from, int len, intptr_t tok)
 {
-	while (sz > 0) {
-		*((uint64_t*)rs) = (uint64_t)pcb;
-		((uint64_t*)pcb)++, ((uint64_t*)rs)++;
-		sz -= sizeof(uint64_t);
-	}
-}
+	struct unw_regstate *rs = (void*)tok;
+	int reg;
 
-int
-unw_state_create(struct unw_regstate *rs, struct pcb *pcb)
-{
-	uint64_t *fp;
+	switch (req) {
+	case UWX_COPYIN_UINFO:
+		break;
+	case UWX_COPYIN_MSTACK:
+		*((uint64_t*)to) = *((uint64_t*)from);
+		return (8);
+	case UWX_COPYIN_RSTACK:
+		*((uint64_t*)to) = *((uint64_t*)from);
+		return (8);
+	case UWX_COPYIN_REG:
+		if (from == UWX_REG_PFS)
+			from = rs->frame->tf_special.pfs;
+		else if (from == UWX_REG_PREDS)
+			from = rs->frame->tf_special.pr;
+		else if (from == UWX_REG_RNAT)
+			from = rs->frame->tf_special.rnat;
+		else if (from == UWX_REG_UNAT)
+			from = rs->frame->tf_special.unat;
+		else if (from >= UWX_REG_GR(0) && from <= UWX_REG_GR(127)) {
+			reg = from - UWX_REG_GR(0);
+			if (reg == 1)
+				from = rs->frame->tf_special.gp;
+			else if (reg == 12)
+				from = rs->frame->tf_special.sp;
+			else if (reg == 13)
+				from = rs->frame->tf_special.tp;
+			else if (reg >= 2 && reg <= 3)
+				from = (&rs->frame->tf_scratch.gr2)[reg - 2];
+			else if (reg >= 8 && reg <= 11)
+				from = (&rs->frame->tf_scratch.gr8)[reg - 8];
+			else if (reg >= 14 && reg <= 31)
+				from = (&rs->frame->tf_scratch.gr14)[reg - 14];
+			else
+				goto oops;
+		} else if (from >= UWX_REG_BR(0) && from <= UWX_REG_BR(7)) {
+			reg = from - UWX_REG_BR(0);
+			if (reg == 0)
+				from = rs->frame->tf_special.rp;
+			else if (reg >= 6 && reg <= 7)
+				from = (&rs->frame->tf_scratch.br6)[reg - 6];
+			else
+				goto oops;
+		} else
+			goto oops;
 
-	/* Set the current IP to the code address of savectx. */
-	fp = (void*)savectx;
-	rs->rs_val.special.iip = *fp;
-	/* Cache the values. */
-	rs->rs_val.special = pcb->pcb_special;
-	rs->rs_val.preserved = pcb->pcb_preserved;
-	rs->rs_val.preserved_fp = pcb->pcb_preserved_fp;
-	/* Set the location to the memory address in the PCB. */
-	unw_set_loc(&rs->rs_loc.special, &pcb->pcb_special,
-	    sizeof(rs->rs_loc.special));
-	unw_set_loc(&rs->rs_loc.preserved, &pcb->pcb_preserved,
-	    sizeof(rs->rs_loc.preserved));
-	unw_set_loc(&rs->rs_loc.preserved_fp, &pcb->pcb_preserved_fp,
-	    sizeof(rs->rs_loc.preserved_fp));
-	return (0);
-}
+		*((uint64_t*)to) = from;
+		return (len);
+	}
 
-int
-unw_table_add(uint64_t base, uint64_t start, uint64_t end)
-{
-	struct unw_table *ut;
+ oops:
+	printf("UNW: %s(%d, %p, %lx, %d, %lx)\n", __func__, req, to, from,
+	    len, tok);
 
-	ut = malloc(sizeof(struct unw_table), M_UNWIND, M_NOWAIT);
-	if (ut == NULL)
-		return (ENOMEM);
-
-	ut->ut_base = base;
-	ut->ut_start = (struct unw_entry*)start;
-	ut->ut_end = (struct unw_entry*)end;
-	ut->ut_limit = base + ut->ut_end[-1].ue_end;
-	LIST_INSERT_HEAD(&unw_tables, ut, ut_link);
-
-	if (bootverbose)
-		printf("UNWIND: table added: base=%lx, start=%lx, end=%lx\n",
-		    base, start, end);
-
 	return (0);
 }
 
-void
-unw_table_remove(uint64_t base)
+static int
+unw_cb_lookup(int req, uint64_t ip, intptr_t tok, uint64_t **vec)
 {
+	struct unw_regstate *rs = (void*)tok;
 	struct unw_table *ut;
 
-	ut = unw_table_lookup(base);
-	if (ut != NULL) {
-		LIST_REMOVE(ut, ut_link);
-		free(ut, M_UNWIND);
-		if (bootverbose)
-			printf("UNWIND: table removed: base=%lx\n", base);
+	switch (req) {
+	case UWX_LKUP_LOOKUP:
+		ut = unw_table_lookup(ip);
+		if (ut == NULL)
+			return (UWX_LKUP_NOTFOUND);
+		rs->keyval[0] = UWX_KEY_TBASE;
+		rs->keyval[1] = ut->ut_base;
+		rs->keyval[2] = UWX_KEY_USTART;
+		rs->keyval[3] = (intptr_t)ut->ut_start;
+		rs->keyval[4] = UWX_KEY_UEND;
+		rs->keyval[5] = (intptr_t)ut->ut_end;
+		rs->keyval[6] = 0;
+		rs->keyval[7] = 0;
+		*vec = rs->keyval;
+		return (UWX_LKUP_UTABLE);
+	case UWX_LKUP_FREE:
+		return (0);
 	}
-}
 
-#if 0
-static u_int64_t
-read_uleb128(u_int8_t **pp)
-{
-	u_int8_t *p = *pp;
-	u_int8_t b;
-	u_int64_t res;
-
-	res = 0;
-	do {
-		b = *p++;
-		res = (res << 7) | (b & 0x7f);
-	} while (b & (1 << 7));
-
-	*pp = p;
-	return res;
+	return (UWX_LKUP_ERR);
 }
 
-#define PROCESS_WHEN(us, reg, t)				\
-do {								\
-	DPF(("register %s was saved at offset %d\n",		\
-	     #reg, t));						\
-	us->us_regs.rs_##reg.ur_when = t;			\
-} while (0)
-
-#define PROCESS_GR(us, reg, gr)					\
-do {								\
-	DPF(("save location for %s at r%d\n", #reg, gr));	\
-	us->us_regs.rs_##reg.ur_save = find_gr(us, gr);		\
-} while (0)							\
-
-#define PROCESS_BR(us, reg, br)					\
-do {								\
-	DPF(("save location for %s at b%d\n", #reg, br));	\
-	us->us_regs.rs_##reg.ur_save =				\
-		&us->us_regs.rs_br[br].ur_value;		\
-} while (0)
-
-#define PROCESS_GRMEM(us, reg)					\
-do {								\
-	DPF(("save location for %s at spill+%d\n",		\
-	     #reg, us->us_spilloff));				\
-	us->us_regs.rs_##reg.ur_save =				\
-		&us->us_spill[us->us_spilloff];			\
-	us->us_spilloff += 8;					\
-} while (0)
-
-#define PROCESS_FRMEM(us, reg)					\
-do {								\
-	DPF(("save location for %s at spill+%d\n",		\
-	     #reg, us->us_spilloff));				\
-	us->us_regs.rs_##reg.ur_save =				\
-		(struct ia64_fpreg *)				\
-		&us->us_spill[us->us_spilloff];			\
-	us->us_spilloff += 16;					\
-} while (0)
-
-#define PROCESS_SPREL(us, reg, spoff)				\
-do {								\
-	DPF(("save location for %s at sp+%d\n",			\
-	     #reg, 4*spoff));					\
-	us->us_regs.rs_##reg.ur_save = (u_int64_t *)		\
-		(us->us_regs.rs_gr[12].ur_value + 4*spoff);	\
-} while (0)
-
-#define PROCESS_SPREL_WHEN(us, reg, spoff, t)			\
-do {								\
-	PROCESS_SPREL(us, reg, spoff);				\
-	PROCESS_WHEN(us, reg, t);				\
-} while (0)
-
-#define PROCESS_PSPREL(us, reg, pspoff)				\
-do {								\
-	DPF(("save location for %s at psp+%d\n",		\
-	     #reg, 16-4*pspoff));				\
-	us->us_regs.rs_##reg.ur_save = (u_int64_t *)		\
-		(us->us_regs.rs_psp.ur_value + 16-4*pspoff);	\
-} while (0)
-
-#define PROCESS_PSPREL_WHEN(us, reg, pspoff, t)			\
-do {								\
-	PROCESS_PSPREL(us, reg, pspoff);			\
-	PROCESS_WHEN(us, reg, t);				\
-} while (0)
-
-static u_int64_t *
-find_gr(struct ia64_unwind_state *us, int gr)
+int
+unw_create(struct unw_regstate *rs, struct trapframe *tf)
 {
-	if (gr < 32)
-		return &us->us_regs.rs_gr[gr].ur_value;
-	else
-		return ia64_rse_register_address(us->us_bsp, gr);
-}
+	struct unw_table *ut;
+	uint64_t bsp;
+	int nats, sof, uwxerr;
 
-static void
-parse_prologue(struct ia64_unwind_state *us, int rlen)
-{
-}
+	ut = unw_table_lookup(tf->tf_special.iip);
+	if (ut == NULL)
+		return (ENOENT);
 
-static void
-parse_prologue_gr(struct ia64_unwind_state *us, int rlen,
-		  int mask, int grsave)
-{
-	if (mask & 8) {
-		PROCESS_GR(us, br[0], grsave);
-		grsave++;
-	}
-	if (mask & 4) {
-		PROCESS_GR(us, pfs, grsave);
-		grsave++;
-	}
-	if (mask & 2) {
-		PROCESS_GR(us, psp, grsave);
-		grsave++;
-	}
-	if (mask & 1) {
-		PROCESS_GR(us, preds, grsave);
-		grsave++;
-	}
-}
+	rs->frame = tf;
+	rs->env = uwx_init();
+	if (rs->env == NULL)
+		return (ENOMEM);
 
-static void
-parse_mem_stack_f(struct ia64_unwind_state *us, int t, int size)
-{
-	DPF(("restore value for psp is sp+%d at offset %d\n",
-	     16*size, t));
-	us->us_regs.rs_psp.ur_when = t;
-	us->us_regs.rs_stack_size = 16*size;
-}
+	uwxerr = uwx_register_callbacks(rs->env, (intptr_t)rs,
+	    unw_cb_copyin, unw_cb_lookup);
+	if (uwxerr)
+		return (EINVAL);		/* XXX */
 
-static void
-parse_mem_stack_v(struct ia64_unwind_state *us, int t)
-{
-	PROCESS_WHEN(us, psp, t);
-}
+	bsp = tf->tf_special.bspstore + tf->tf_special.ndirty;
+	sof = (int)(tf->tf_special.cfm & 0x7f);
+	nats = (sof + 63 - ((int)(bsp >> 3) & 0x3f)) / 63;
+	uwxerr = uwx_init_context(rs->env, tf->tf_special.iip,
+	    tf->tf_special.sp, bsp - ((sof + nats) << 3), tf->tf_special.cfm);
 
-static void
-parse_psp_gr(struct ia64_unwind_state *us, int gr)
-{
-	PROCESS_GR(us, psp, gr);
+	return ((uwxerr) ? EINVAL : 0);		/* XXX */
 }
 
-static void
-parse_psp_sprel(struct ia64_unwind_state *us, int spoff)
+int
+unw_step(struct unw_regstate *rs)
 {
-	PROCESS_SPREL(us, psp, spoff);
-}
+	int uwxerr;
 
-static void
-parse_rp_when(struct ia64_unwind_state *us, int t)
-{
-	PROCESS_WHEN(us, br[0], t);
+	uwxerr = uwx_step(rs->env);
+	return ((uwxerr) ? EINVAL : 0);		/* XXX */
 }
 
-static void
-parse_rp_gr(struct ia64_unwind_state *us, int gr)
+int
+unw_get_bsp(struct unw_regstate *s, uint64_t *r)
 {
-	PROCESS_GR(us, br[0], gr);
-}
+	int uwxerr;
 
-static void
-parse_rp_br(struct ia64_unwind_state *us, int br)
-{
-	PROCESS_BR(us, br[0], br);
+	uwxerr = uwx_get_reg(s->env, UWX_REG_BSP, r);
+	return ((uwxerr) ? EINVAL : 0); 	/* XXX */
 }
 
-static void
-parse_rp_psprel(struct ia64_unwind_state *us, int pspoff)
+int
+unw_get_cfm(struct unw_regstate *s, uint64_t *r)
 {
-	PROCESS_PSPREL(us, br[0], pspoff);
-}
+	int uwxerr;
 
-static void
-parse_rp_sprel(struct ia64_unwind_state *us, int spoff)
-{
-	PROCESS_SPREL(us, br[0], spoff);
+	uwxerr = uwx_get_reg(s->env, UWX_REG_CFM, r);
+	return ((uwxerr) ? EINVAL : 0); 	/* XXX */
 }
 
-static void
-parse_pfs_when(struct ia64_unwind_state *us, int t)
+int
+unw_get_ip(struct unw_regstate *s, uint64_t *r)
 {
-	PROCESS_WHEN(us, pfs, t);
-}
+	int uwxerr;
 
-static void
-parse_pfs_gr(struct ia64_unwind_state *us, int gr)
-{
-	PROCESS_GR(us, pfs, gr);
+	uwxerr = uwx_get_reg(s->env, UWX_REG_IP, r);
+	return ((uwxerr) ? EINVAL : 0); 	/* XXX */
 }
 
-static void
-parse_pfs_psprel(struct ia64_unwind_state *us, int pspoff)
+int
+unw_table_add(uint64_t base, uint64_t start, uint64_t end)
 {
-	PROCESS_PSPREL(us, pfs, pspoff);
-}
+	struct unw_table *ut;
 
-static void
-parse_pfs_sprel(struct ia64_unwind_state *us, int spoff)
-{
-	PROCESS_SPREL(us, pfs, spoff);
-}
+	ut = malloc(sizeof(struct unw_table), M_UNWIND, M_NOWAIT);
+	if (ut == NULL)
+		return (ENOMEM);
 
-static void
-parse_preds_when(struct ia64_unwind_state *us, int t)
-{
-	PROCESS_WHEN(us, preds, t);
-}
+	ut->ut_base = base;
+	ut->ut_start = (struct unw_entry*)start;
+	ut->ut_end = (struct unw_entry*)end;
+	ut->ut_limit = base + ut->ut_end[-1].ue_end;
+	LIST_INSERT_HEAD(&unw_tables, ut, ut_link);
 
-static void
-parse_preds_gr(struct ia64_unwind_state *us, int gr)
-{
-	PROCESS_GR(us, preds, gr);
-}
+	if (bootverbose)
+		printf("UNWIND: table added: base=%lx, start=%lx, end=%lx\n",
+		    base, start, end);
 
-static void
-parse_preds_psprel(struct ia64_unwind_state *us, int pspoff)
-{
-	PROCESS_PSPREL(us, preds, pspoff);
+	return (0);
 }
 
-static void
-parse_preds_sprel(struct ia64_unwind_state *us, int spoff)
+void
+unw_table_remove(uint64_t base)
 {
-	PROCESS_SPREL(us, preds, spoff);
-}
+	struct unw_table *ut;
 
-static void
-parse_fr_mem(struct ia64_unwind_state *us, int frmask)
-{
-	us->us_frmask = frmask;
-}
-
-static void
-parse_frgr_mem(struct ia64_unwind_state *us, int grmask, int frmask)
-{
-	us->us_grmask = grmask;
-	if (grmask & 1)
-		PROCESS_GRMEM(us, gr[4]);
-	if (grmask & 2)
-		PROCESS_GRMEM(us, gr[5]);
-	if (grmask & 4)
-		PROCESS_GRMEM(us, gr[6]);
-	if (grmask & 8)
-		PROCESS_GRMEM(us, gr[7]);
-
-	us->us_frmask = frmask;
-	if (frmask & 1)
-		PROCESS_FRMEM(us, fr[2]);
-	if (frmask & 2)
-		PROCESS_FRMEM(us, fr[3]);
-	if (frmask & 4)
-		PROCESS_FRMEM(us, fr[4]);
-	if (frmask & 8)
-		PROCESS_FRMEM(us, fr[5]);
-	if (frmask & 16)
-		PROCESS_FRMEM(us, fr[16]);
-	if (frmask & 32)
-		PROCESS_FRMEM(us, fr[17]);
-	if (frmask & 64)
-		PROCESS_FRMEM(us, fr[18]);
-	if (frmask & 128)
-		PROCESS_FRMEM(us, fr[19]);
-	if (frmask & 256)
-		PROCESS_FRMEM(us, fr[20]);
-	if (frmask & 512)
-		PROCESS_FRMEM(us, fr[21]);
-	if (frmask & 1024)
-		PROCESS_FRMEM(us, fr[22]);
-	if (frmask & 2048)
-		PROCESS_FRMEM(us, fr[24]);
-	if (frmask & 4096)
-		PROCESS_FRMEM(us, fr[25]);
-	if (frmask & 8192)
-		PROCESS_FRMEM(us, fr[26]);
-	if (frmask & 16384)
-		PROCESS_FRMEM(us, fr[27]);
-	if (frmask & 32768)
-		PROCESS_FRMEM(us, fr[28]);
-	if (frmask & 65536)
-		PROCESS_FRMEM(us, fr[29]);
-	if (frmask & 131072)
-		PROCESS_FRMEM(us, fr[30]);
-	if (frmask & 262144)
-		PROCESS_FRMEM(us, fr[31]);
-}
-
-static void
-parse_gr_gr(struct ia64_unwind_state *us, int grmask, int gr)
-{
-	us->us_grmask = grmask;
-	if (grmask & 1) {
-		PROCESS_GR(us, gr[4], gr);
-		gr++;
+	ut = unw_table_lookup(base);
+	if (ut != NULL) {
+		LIST_REMOVE(ut, ut_link);
+		free(ut, M_UNWIND);
+		if (bootverbose)
+			printf("UNWIND: table removed: base=%lx\n", base);
 	}
-	if (grmask & 2) {
-		PROCESS_GR(us, gr[5], gr);
-		gr++;
-	}
-	if (grmask & 4) {
-		PROCESS_GR(us, gr[6], gr);
-		gr++;
-	}
-	if (grmask & 8) {
-		PROCESS_GR(us, gr[7], gr);
-		gr++;
-	}
 }
 
 static void
-parse_gr_mem(struct ia64_unwind_state *us, int grmask)
+unw_initialize(void *dummy __unused)
 {
-	us->us_grmask = grmask;
-	if (grmask & 1)
-		PROCESS_GRMEM(us, gr[4]);
-	if (grmask & 2)
-		PROCESS_GRMEM(us, gr[5]);
-	if (grmask & 4)
-		PROCESS_GRMEM(us, gr[6]);
-	if (grmask & 8)
-		PROCESS_GRMEM(us, gr[7]);
-}
 
-static void
-parse_br_mem(struct ia64_unwind_state *us, int brmask)
-{
-	us->us_brmask = brmask;
-	if (brmask & 1)
-		PROCESS_GRMEM(us, br[1]);
-	if (brmask & 2)
-		PROCESS_GRMEM(us, br[2]);
-	if (brmask & 4)
-		PROCESS_GRMEM(us, br[3]);
-	if (brmask & 8)
-		PROCESS_GRMEM(us, br[4]);
-	if (brmask & 16)
-		PROCESS_GRMEM(us, br[5]);
+	LIST_INIT(&unw_tables);
+	uwx_register_alloc_cb(unw_alloc, unw_free);
 }
-
-static void
-parse_br_gr(struct ia64_unwind_state *us, int brmask, int gr)
-{
-	us->us_brmask = brmask;
-	if (brmask & 1) {
-		PROCESS_GR(us, br[1], gr);
-		gr++;
-	}
-	if (brmask & 2) {
-		PROCESS_GR(us, br[2], gr);
-		gr++;
-	}
-	if (brmask & 4) {
-		PROCESS_GR(us, br[3], gr);
-		gr++;
-	}
-	if (brmask & 8) {
-		PROCESS_GR(us, br[4], gr);
-		gr++;
-	}
-	if (brmask & 16) {
-		PROCESS_GR(us, br[5], gr);
-		gr++;
-	}
-}
-
-static void
-parse_spill_base(struct ia64_unwind_state *us, int pspoff)
-{
-	DPF(("base of spill area at psp+%d\n", 16 - 4*pspoff));
-	us->us_spill = (u_int64_t *)
-		(us->us_regs.rs_psp.ur_value + 16 - 4*pspoff);
-}
-
-static void
-parse_spill_mask(struct ia64_unwind_state *us, int rlen, u_int8_t *imask)
-{
-	int i, reg;
-	u_int8_t b;
-	static int frno[] = {
-		2, 3, 4, 5, 16, 17, 18, 19, 20, 21, 22,
-		23, 24, 25, 26, 27, 28, 29, 30, 31
-	};
-
-	for (i = 0; i < rlen; i++) {
-		b = imask[i / 4];
-		b = (b >> (2 * (3-(i & 3)))) & 3;
-		switch (b) {
-		case 0:
-			break;
-		case 1:
-			reg = frno[ffs(us->us_frmask) - 1];
-			DPF(("restoring fr[%d] at offset %d\n", reg, i));
-			us->us_regs.rs_fr[reg].ur_when = i;
-			break;
-		case 2:
-			reg = ffs(us->us_grmask) - 1 + 4;
-			DPF(("restoring gr[%d] at offset %d\n", reg, i));
-			us->us_regs.rs_gr[reg].ur_when = i;
-			break;
-		case 3:
-			reg = ffs(us->us_brmask) - 1 + 1;
-			DPF(("restoring br[%d] at offset %d\n", reg, i));
-			us->us_regs.rs_gr[reg].ur_when = i;
-			break;
-		}
-	}
-}
-
-static void
-parse_unat_when(struct ia64_unwind_state *us, int t)
-{
-	PROCESS_WHEN(us, unat, t);
-}
-
-static void
-parse_unat_gr(struct ia64_unwind_state *us, int gr)
-{
-	PROCESS_GR(us, unat, gr);
-}
-
-static void
-parse_unat_psprel(struct ia64_unwind_state *us, int pspoff)
-{
-	PROCESS_PSPREL(us, unat, pspoff);
-}
-
-static void
-parse_unat_sprel(struct ia64_unwind_state *us, int spoff)
-{
-	PROCESS_SPREL(us, unat, spoff);
-}
-
-static void
-parse_lc_when(struct ia64_unwind_state *us, int t)
-{
-	PROCESS_WHEN(us, lc, t);
-}
-
-static void
-parse_lc_gr(struct ia64_unwind_state *us, int gr)
-{
-	PROCESS_GR(us, lc, gr);
-}
-
-static void
-parse_lc_psprel(struct ia64_unwind_state *us, int pspoff)
-{
-	PROCESS_PSPREL(us, lc, pspoff);
-}
-
-static void
-parse_lc_sprel(struct ia64_unwind_state *us, int spoff)
-{
-	PROCESS_SPREL(us, lc, spoff);
-}
-
-static void
-parse_fpsr_when(struct ia64_unwind_state *us, int t)
-{
-	PROCESS_WHEN(us, fpsr, t);
-}
-
-static void
-parse_fpsr_gr(struct ia64_unwind_state *us, int gr)
-{
-	PROCESS_GR(us, fpsr, gr);
-}
-
-static void
-parse_fpsr_psprel(struct ia64_unwind_state *us, int pspoff)
-{
-	PROCESS_PSPREL(us, fpsr, pspoff);
-}
-
-static void
-parse_fpsr_sprel(struct ia64_unwind_state *us, int spoff)
-{
-	PROCESS_SPREL(us, fpsr, spoff);
-}
-
-static void
-parse_priunat_when_gr(struct ia64_unwind_state *us, int t)
-{
-	PROCESS_WHEN(us, priunat, t);
-}
-
-static void
-parse_priunat_when_mem(struct ia64_unwind_state *us, int t)
-{
-	PROCESS_WHEN(us, priunat, t);
-}
-
-static void
-parse_priunat_gr(struct ia64_unwind_state *us, int gr)
-{
-	PROCESS_GR(us, priunat, gr);
-}
-
-static void
-parse_priunat_psprel(struct ia64_unwind_state *us, int pspoff)
-{
-	PROCESS_PSPREL(us, priunat, pspoff);
-}
-
-static void
-parse_priunat_sprel(struct ia64_unwind_state *us, int spoff)
-{
-	PROCESS_SPREL(us, priunat, spoff);
-}
-
-static void
-parse_bsp_when(struct ia64_unwind_state *us, int t)
-{
-	PROCESS_WHEN(us, bsp, t);
-}
-
-static void
-parse_bsp_gr(struct ia64_unwind_state *us, int gr)
-{
-	PROCESS_GR(us, bsp, gr);
-}
-
-static void
-parse_bsp_psprel(struct ia64_unwind_state *us, int pspoff)
-{
-	PROCESS_PSPREL(us, bsp, pspoff);
-}
-
-static void
-parse_bsp_sprel(struct ia64_unwind_state *us, int spoff)
-{
-	PROCESS_SPREL(us, bsp, spoff);
-}
-
-static void
-parse_bspstore_when(struct ia64_unwind_state *us, int t)
-{
-	PROCESS_WHEN(us, bspstore, t);
-}
-
-static void
-parse_bspstore_gr(struct ia64_unwind_state *us, int gr)
-{
-	PROCESS_GR(us, bspstore, gr);
-}
-
-static void
-parse_bspstore_psprel(struct ia64_unwind_state *us, int pspoff)
-{
-	PROCESS_PSPREL(us, bspstore, pspoff);
-}
-
-static void

>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list