9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Charles Forsyth <charles.forsyth@gmail.com>
To: 9fans <9fans@9fans.net>
Subject: Re: [9fans] risc-v port progress at IWP9
Date: Thu, 29 May 2025 22:55:39 +0100	[thread overview]
Message-ID: <CAOw7k5gD=hC+=rV0SUuWns=u=m2aCjgrJ3MDPoRu5mNRJt1_-w@mail.gmail.com> (raw)
In-Reply-To: <CAOw7k5jhcwmNdYuFn4NGOAN9vwQe0e=+UnHcu9Z+T5D0-rfX_g@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1756 bytes --]

copy attached
uncluttered by extensions
apparently ken thompson did the C version for unix (i just added the types),
which makes it an appropriate test for a new compiler and then kernel port.


On Thu, 29 May 2025 at 22:35, Charles Forsyth <charles.forsyth@gmail.com>
wrote:

> that reminds me that the first kernel-level program i ran on new ports was
> wump (hunt the wumpus),
> partly to debug similar effects, but also because it's fun if not just
> silly
>
> On Thu, 29 May 2025 at 22:05, Ron Minnich <rminnich@p9f.org> wrote:
>
>> Daniel and Shawn made good progress on the risc-v port, and their
>> experience reminded me of a standard test I used to use while doing
>> ports.
>> 
>> long story short, for blue gene and other ports (early amd64) we added
>> this test in main
>> 
>> ulong x = 0x12345678;
>> 
>> main()
>> {
>>     if (x != 0x12345678) panic("unaligned data"):
>> 
>> ...
>> 
>> how can this test fail? x is in the data segment, but the immediate in
>> the test is in the text segment. This test is a quick and easy way to
>> check if your data segment is correctly loaded in memory.
>> 
>> In some ports, the data is aligned by code in l.s that moves it.
>> 
>> There are some really nasty, confusing errors that will arise in a
>> seemingly working kernel if data is not aligned.
>> 
>> I always add this test when I'm doing a port. It catches a problem
>> that is otherwise very confusing, and presents as strings  not set up
>> right, variables wrong, etc.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T2fa5d9bbce09411d-M20971a617edcf1e37d4cf92f
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #1.2: Type: text/html, Size: 3410 bytes --]

[-- Attachment #2: wump.c.gz --]
[-- Type: application/gzip, Size: 2562 bytes --]

  reply	other threads:[~2025-05-30  4:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-29 20:35 Ron Minnich
2025-05-29 21:35 ` Charles Forsyth
2025-05-29 21:55   ` Charles Forsyth [this message]
     [not found] <CAJCpOFzvXMtXdg1nyb8-8ZoGcCb2bS8G2r-p7pXVXLNLCSWayg@mail.gmail.com>
     [not found] ` <2B0932F6-351C-44D3-B04A-3CD7F2BC225E@ecloud.org>
     [not found]   ` <CAJCpOFzF2e=CyQc9aib+kJtCvQYgOQ5KrrnQ75=svhYFencXgw@mail.gmail.com>
     [not found]     ` <3e20d00c-81a2-4219-8eab-ddee1780d45c@fjrhome.net>
2025-06-06  0:48       ` Romano
2025-06-06  7:44       ` Maht Lawless via 9fans

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='CAOw7k5gD=hC+=rV0SUuWns=u=m2aCjgrJ3MDPoRu5mNRJt1_-w@mail.gmail.com' \
    --to=charles.forsyth@gmail.com \
    --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).