9front - general discussion about 9front
 help / color / mirror / Atom feed
From: adventures in9 <adventuresin9@gmail.com>
To: 9front@9front.org
Subject: [9front] [PATCH] strchr.s for spim
Date: Thu, 20 Oct 2022 17:03:50 -0700	[thread overview]
Message-ID: <CAPfmpJAGvSZhTC33OGzGhfEY9rq0eYqKorOZHkBiJRf2fubXuw@mail.gmail.com> (raw)

I finally found the time to get the kernel working for the Mediatek
mt7688.  Just the uart works now, so I still need to do the ethernet
and hopefully wifi and other stuff.  But it boots all the way to the
bootargs ask, and then running !rc lets you run rc in paqfs.

https://github.com/adventuresin9/9front-mt7688

I had a heck of a time getting it to work at first, till I tracked
down an issue in strlen, that comes from the strchr code.  Lots of
stuff broke, and this bug also meant error messages wouldn't print
properly.

running this on the mt7688;
    int n1, n2, n3, n4, n5, n6;
    char *a1, *a2, *a3, *a4, *a5, *a6;

    a1 = "\0";
    a2 = "A";
    a3 = "AA";
    a4 = "AAA";
    a5 = "AAAA";
    a6 = "AAAAA";

    n1 = strlen(a1);
    n2 = strlen(a2);
    n3 = strlen(a3);
    n4 = strlen(a4);
    n5 = strlen(a5);
    n6 = strlen(a6);

    iprint("STRLEN %d %d %d %d %d %d\n", n1, n2, n3, n4, n5, n6);

would get ;
STRLEN 0 1 1 2 1 6

and now it gets;
STRLEN 0 1 2 3 4 5

Also, to just get the world built for spim,
/spim/include/ape, needs the files copied over from mips
/sys/src/ape/lib/9/spim, also needs the files copied over from mips.

This boots and runs on the last release, but when setting up an
updated system to run diff for the patch, I found that Proc has been
changed in a few ways that breaks it.

-------
diff 2cd313668cea156fd13b54873d7934d9b15d8081 uncommitted
--- a/sys/src/libc/spim/strchr.s
+++ b/sys/src/libc/spim/strchr.s
@@ -34,12 +34,12 @@
 l4:
     MOVW    (R3), R5
     ADDU    $4, R3
-    AND    R6,R5, R1
-    AND    R7,R5, R2
+    AND    $0xff,R5, R1
+    AND    $0xff00,R5, R2
     BEQ    R1, b0
-    AND    $0xff00,R5, R1
+    AND    R7,R5, R1
     BEQ    R2, b1
-    AND    $0xff,R5, R2
+    AND    R6,R5, R2
     BEQ    R1, b2
     BNE    R2, l4

                 reply	other threads:[~2022-10-21  0:05 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=CAPfmpJAGvSZhTC33OGzGhfEY9rq0eYqKorOZHkBiJRf2fubXuw@mail.gmail.com \
    --to=adventuresin9@gmail.com \
    --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).