9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Jacob Moody <moody@mail.posixcafe.org>
To: 9front@9front.org
Subject: [9front] [PATCH] remove hacky /proc/1/regs check in libmach
Date: Tue, 9 May 2023 11:38:13 -0600	[thread overview]
Message-ID: <b954f085-0fe4-e656-e0c1-6fe7ad39dee6@posixcafe.org> (raw)

While reading through this code I noticed what seemed to be this hack.
I would expect libmach to parse binary files on disk the same no matter what the
/proc of the program doing the analysis looks like.

 From my reading of the code, I dont think we still care about the difference
between the 4000 and 3000 chips do we? My quick look did not seem to indicate
we currently have a kernel for it, nor can I see a way to get vc to generate
a binary with this magic anyhow.

diff 090af6255bebf0129c891116b53b31808fe49dc7 uncommitted
--- a/sys/src/libmach/executable.c
+++ b/sys/src/libmach/executable.c
@@ -248,27 +248,6 @@

 Mach	*mach = &mi386;			/* Global current machine table */

-static ExecTable*
-couldbe4k(ExecTable *mp)
-{
-	Dir *d;
-	ExecTable *f;
-
-	if((d=dirstat("/proc/1/regs")) == nil)
-		return mp;
-	if(d->length < 32*8){		/* R3000 */
-		free(d);
-		return mp;
-	}
-	free(d);
-	for (f = exectab; f->magic; f++)
-		if(f->magic == M_MAGIC) {
-			f->name = "mips plan 9 executable on mips2 kernel";
-			return f;
-		}
-	return mp;
-}
-
 int
 crackhdr(int fd, Fhdr *fp)
 {
@@ -301,9 +280,6 @@
 		if(mp->_magic){
 			if(mp->magic != (magic & ~DYN_MAGIC))
 				continue;
-
-			if(mp->magic == V_MAGIC)
-				mp = couldbe4k(mp);

 			if ((magic & DYN_MAGIC) && mp->dlmname != nil)
 				fp->name = mp->dlmname;


                 reply	other threads:[~2023-05-09 17:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=b954f085-0fe4-e656-e0c1-6fe7ad39dee6@posixcafe.org \
    --to=moody@mail.posixcafe.org \
    --cc=9front@9front.org \
    /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).