9front - general discussion about 9front
 help / color / mirror / Atom feed
From: cinap_lenrek@felloff.net
To: 9front@9front.org
Subject: Re: [9front] PXE booting Rpi
Date: Thu, 15 Apr 2021 23:15:11 +0200	[thread overview]
Message-ID: <89F2ADFB3FF2879CB6B65BD617ED0601@felloff.net> (raw)
In-Reply-To: <45BD661C-F92C-4005-A71D-68E9CEB99DD6@me.com>

so you confirm that the following patch works? because
i could not reproduce it on the PI3B+ (R2 always 0).

--
cinap

PATCH:

diff -r b4182c0fe4a9 sys/src/9/bcm/armv6.s
--- a/sys/src/9/bcm/armv6.s	Sun Apr 11 23:58:30 2021 +0200
+++ b/sys/src/9/bcm/armv6.s	Thu Apr 15 23:13:36 2021 +0200
@@ -76,6 +76,9 @@
 	MOVW	$1, R1
 	MCR	CpSC, 0, R1, C(CpSPM), C(CpSPMperf), CpSPMctl
 
+	/* first arg to main is saved R2 */
+	MOVW	R10, R0
+
 	/*
 	 * call main and loop forever if it returns
 	 */
diff -r b4182c0fe4a9 sys/src/9/bcm/armv7.s
--- a/sys/src/9/bcm/armv7.s	Sun Apr 11 23:58:30 2021 +0200
+++ b/sys/src/9/bcm/armv7.s	Thu Apr 15 23:13:36 2021 +0200
@@ -126,6 +126,9 @@
 	MOVW	$1, R1
 	MCR	CpSC, 0, R1, C(CpCLD), C(CpCLDena), CpCLDenapmnc
 
+	/* first arg to main is saved R2 */
+	MOVW	R10, R0
+
 	/*
 	 * call main and loop forever if it returns
 	 */
diff -r b4182c0fe4a9 sys/src/9/bcm/bootargs.c
--- a/sys/src/9/bcm/bootargs.c	Sun Apr 11 23:58:30 2021 +0200
+++ b/sys/src/9/bcm/bootargs.c	Thu Apr 15 23:13:36 2021 +0200
@@ -265,7 +265,7 @@
 	uintptr len;
 
 	/*
-	 * kernel gets DTB/ATAGS pointer in R0 on entry
+	 * kernel gets DTB/ATAGS pointer on entry
 	 */
 	if(pa != 0 && (len = cankaddr(pa)) != 0){
 		void *va = KADDR(pa);
diff -r b4182c0fe4a9 sys/src/9/bcm/l.s
--- a/sys/src/9/bcm/l.s	Sun Apr 11 23:58:30 2021 +0200
+++ b/sys/src/9/bcm/l.s	Thu Apr 15 23:13:36 2021 +0200
@@ -10,6 +10,9 @@
  * other cpus enter at cpureset in armv7.s
  */
 TEXT _start(SB), 1, $-4
+	/* save R2 in extern register R10 (Mach *m) */
+	MOVW	R2, R10
+
 	/*
 	 * load physical base for SB addressing while mmu is off
 	 * keep a handy zero in R0 until first function call
diff -r b4182c0fe4a9 sys/src/9/bcm/main.c
--- a/sys/src/9/bcm/main.c	Sun Apr 11 23:58:30 2021 +0200
+++ b/sys/src/9/bcm/main.c	Thu Apr 15 23:13:36 2021 +0200
@@ -75,7 +75,7 @@
 }
 
 void
-main(void)
+main(uintptr arg0)
 {
 	extern char edata[], end[];
 	uint fw, board;
@@ -84,7 +84,7 @@
 	memset(edata, 0, end - edata);	/* clear bss */
 	mach0init();
 	quotefmtinstall();
-	bootargsinit(0);
+	bootargsinit(arg0);
 	confinit();		/* figures out amount of memory */
 	xinit();
 	uartconsinit();
diff -r b4182c0fe4a9 sys/src/9/bcm/rebootcode.s
--- a/sys/src/9/bcm/rebootcode.s	Sun Apr 11 23:58:30 2021 +0200
+++ b/sys/src/9/bcm/rebootcode.s	Thu Apr 15 23:13:36 2021 +0200
@@ -84,6 +84,7 @@
 	BEQ	dowfi		/* if zero, wait again */
 
 bootcpu:
+	MOVW	$0, R2		/* no ATAGS/DTB pointer */
 	BIC	$KSEGM, R8	/* entry to physical */
 	ORR	$PHYSDRAM, R8
 	BL	(R8)


  reply	other threads:[~2021-04-15 21:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 14:05 Daniel Morandini
2021-03-10 17:20 ` cinap_lenrek
2021-03-12 10:36   ` Daniel Morandini
2021-03-25 10:55     ` Daniel Morandini
2021-03-25 18:49       ` Noam Preil
2021-03-25 21:49         ` Noam Preil
2021-04-07  8:39         ` Daniel Morandini
2021-04-08 14:21           ` cinap_lenrek
2021-04-08 15:45             ` Daniel Morandini
2021-04-08 16:12               ` cinap_lenrek
2021-04-11 12:11                 ` cinap_lenrek
2021-04-12  9:04                   ` Daniel Morandini
2021-04-12 10:14                     ` cinap_lenrek
2021-04-12 16:48                       ` Daniel Morandini
2021-04-15 21:15                         ` cinap_lenrek [this message]
2021-04-19  7:53                           ` Daniel Morandini
2021-04-19 16:20                             ` Daniel Morandini

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=89F2ADFB3FF2879CB6B65BD617ED0601@felloff.net \
    --to=cinap_lenrek@felloff.net \
    --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).