9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: [9fans] libmach x86 botch
Date: Sun,  4 Sep 2011 13:33:10 -0400	[thread overview]
Message-ID: <8c848edf90f1e3e201a3b225f3969c91@ladd.quanstro.net> (raw)

it appers that either i386das and i386inst are misnamed, or they
are listed incorrectly in /sys/src/libmach/8db.c.  since at least [v7]db
follow the same pattern, i'm pretty sure the header file is wrong.
 also i believe the setting of errstr() in i386das and i386inst is incorrect.
(for a demonstration, try asm(stackaddress) on a running 386 executable.
you'll get a few bytes of unprintable garbage.)

- erik


Machdata i386mach =
{
	{0xCC, 0, 0, 0},	/* break point: INT 3 */
	1,			/* break point size */

	leswab,			/* convert short to local byte order */
	leswal,			/* convert long to local byte order */
	leswav,			/* convert vlong to local byte order */
	i386trace,		/* C traceback */
	i386frame,		/* frame finder */
	i386excep,		/* print exception */
	0,			/* breakpoint fixup */
	leieeesftos,		/* single precision float printer */
	leieeedftos,		/* double precision float printer */
	i386foll,		/* following addresses */
>>	i386inst,		/* print instruction */
>>	i386das,		/* dissembler */
	i386instlen,		/* instruction size calculation */
};

yet

/sys/include/mach.h:202,219
struct	Machdata {		/* Machine-dependent debugger support */
	uchar	bpinst[4];			/* break point instr. */
	short	bpsize;				/* size of break point instr. */

	ushort	(*swab)(ushort);		/* ushort to local byte order */
	ulong	(*swal)(ulong);			/* ulong to local byte order */
	uvlong	(*swav)(uvlong);		/* uvlong to local byte order */
	int	(*ctrace)(Map*, uvlong, uvlong, uvlong, Tracer); /* C traceback */
	uvlong	(*findframe)(Map*, uvlong, uvlong, uvlong, uvlong);/* frame finder */
	char*	(*excep)(Map*, Rgetter);	/* last exception */
	ulong	(*bpfix)(uvlong);		/* breakpoint fixup */
	int	(*sftos)(char*, int, void*);	/* single precision float */
	int	(*dftos)(char*, int, void*);	/* double precision float */
	int	(*foll)(Map*, uvlong, Rgetter, uvlong*);/* follow set */
>>	int	(*das)(Map*, uvlong, char, char*, int);	/* symbolic disassembly */
>>	int	(*hexinst)(Map*, uvlong, char*, int); 	/* hex disassembly */
	int	(*instsize)(Map*, uvlong);	/* instruction size */
};



             reply	other threads:[~2011-09-04 17:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-04 17:33 erik quanstrom [this message]
2011-09-04 17:38 ` erik quanstrom
2011-09-04 18:32 ` Russ Cox
     [not found] ` <CADSkJJUnyBgoCt7bek6482BJ2SZ7vh=DbaFwNLNcY36qj994+g@mail.gmail.c>
2011-09-04 18:36   ` erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8c848edf90f1e3e201a3b225f3969c91@ladd.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).