9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Jacob Moody <moody@mail.posixcafe.org>
To: 9front@9front.org
Subject: Re: [9front] Re: [PATCH] game boy advance header target for 5l
Date: Fri, 3 Mar 2023 14:18:29 -0700	[thread overview]
Message-ID: <cc0b0481-8a24-3025-8fa3-7153a4207e55@posixcafe.org> (raw)
In-Reply-To: <859F297B22C45B7453E14CCF75E203C8@felloff.net>

On 3/3/23 13:59, cinap_lenrek@felloff.net wrote:
>> I dont want to do relocation, I just want to know
>> why external programs that only work under assumptions
>> of how the a.out was linked are preferable to just
>> having the linker output correct files.
> 
> Sorry, then i must have misundersood you.
> 
>> If everyone else is in agreement that this kind of header
>> code should only be done in external programs, should that
>> code also be moved to be external or deleted?
> 
> I do not see a need to be dogmatic about this at all
> or force a decision.
> 
> I do not have any skin in this game nor do i have a gameboy.
> 
> Was just pointing out why an external tool would only solve
> half the problem in this case. But i think we agree here.
> 
> A external tool made perfect sense for uimage as we want to
> generate both an a.out (for debugger and /dev/reboot) and a
> uimage for uboot. Linking is quite expensive compared to just
> writing out a header and copying some data out of a file and
> calculating a checksum.
> 
> For the gameboy rom image problem, my first guess would be to
> just generate the header using the assembler and pass that
> as the first object to the linker and have the linker geneate
> headerless image.


I ended up writing an aout2gba that does work as intended. I think
this may still be quite useful, I am considering teaching games/gba
how to load a gba a.out file (for debug info), so being able to
generate both may be useful.

In porting a more complicated rom, I realized that plan9 specific
init code is unavoidable anyway due to needing to setup R12:

	MOVW	$setR12(SB), R12		/* load the SB */

Somehow I had missed that this preamble would be needed. Given that
we need an l.s entrypoint for this anyway, I can just stuff the header
in there and encode the entry point manually to just jump down after the
header as we discussed. I am working on a /sys/src/cmd/mkone equivalent
and some plumbing, I'll post another diff soon.

Thanks,
moody


  reply	other threads:[~2023-03-03 21:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02  6:56 [9front] " Jacob Moody
2023-03-02 11:15 ` [9front] " Anthony Martin
2023-03-02 16:08   ` Jacob Moody
2023-03-02 17:33     ` cinap_lenrek
2023-03-02 17:50       ` Jacob Moody
2023-03-03 20:59         ` cinap_lenrek
2023-03-03 21:18           ` Jacob Moody [this message]
2023-03-04 15:53             ` cinap_lenrek

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=cc0b0481-8a24-3025-8fa3-7153a4207e55@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).