9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] [PATCH] remove hacky /proc/1/regs check in libmach
@ 2023-05-09 17:38 Jacob Moody
  0 siblings, 0 replies; only message in thread
From: Jacob Moody @ 2023-05-09 17:38 UTC (permalink / raw)
  To: 9front

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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-09 17:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-09 17:38 [9front] [PATCH] remove hacky /proc/1/regs check in libmach Jacob Moody

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).