From: Jacob Moody <moody@mail.posixcafe.org>
To: 9front@9front.org
Subject: [9front] ppc kernel attempt
Date: Mon, 10 Apr 2023 21:43:59 -0600 [thread overview]
Message-ID: <2c69120e-eb07-5f03-7c5d-c9fcbef86bf6@posixcafe.org> (raw)
Out of curiosity I got the ppc kernel to build.
I tried getting it to run in qemu-ppc(emulating a g4 mac)
but I could not get past open firmware. I'll admit that I've
since lost interest. Before I delete these changes from my
tree I figure I would offer it up to someone else.
Asking around I am not quite sure anyone has had evidence
of this working. Perhaps it may be better to delete this?
Thanks,
moody
diff 26e42d115979009c9fe144e1c28f740485537674 uncommitted
--- a//sys/src/9/ppc/blast
+++ b//sys/src/9/ppc/blast
@@ -13,6 +13,7 @@
kprof
uart
irq
+ shr
ether netif
ip arp chandial ip ipv6 ipaux iproute netif netlog nullmedium pktmedium inferno
--- a//sys/src/9/ppc/blast.h
+++ b//sys/src/9/ppc/blast.h
@@ -40,6 +40,7 @@
#define MEM2SIZE 0
#define FPGABASE 0xe0000000
#define FPGASIZE 0x01000000
+#define PTECACHED 0
#define PLAN9INI 0x00460000
--- a//sys/src/9/ppc/clock.c
+++ b//sys/src/9/ppc/clock.c
@@ -86,3 +86,9 @@
{
return (ulong)fastticks(nil);
}
+
+ulong
+µs(void)
+{
+ return fastticks2us(fastticks(nil));
+}
--- a//sys/src/9/ppc/dat.h
+++ b//sys/src/9/ppc/dat.h
@@ -37,6 +37,7 @@
ulong sr;
ulong pc;
Proc *p;
+ Mach *m;
ulong pid;
ushort isilock;
};
--- a//sys/src/9/ppc/devirq.c
+++ b//sys/src/9/ppc/devirq.c
@@ -302,7 +302,7 @@
iomem->simr_h, iomem->simr_l,
iomem->sipnr_h, iomem->sipnr_l,
iomem->siexr, iomem->siprr);
- dumpvno();
+ /* dumpvno(); */
}
poperror();
free(cb);
--- a//sys/src/9/ppc/fns.h
+++ b//sys/src/9/ppc/fns.h
@@ -1,5 +1,8 @@
#include "../port/portfns.h"
+ulong cankaddr(ulong);
+int (*cmpswap)(long*, long, long);
+int cmpswapppc(long*,long,long);
void clockinit(void);
void clockintr(Ureg*);
void cpuidprint(void);
--- a//sys/src/9/ppc/l.s
+++ b//sys/src/9/ppc/l.s
@@ -1014,3 +1014,22 @@
MOVW R12, 4(R3)
MOVW R13, 0(R3)
RETURN
+
+TEXT cmpswapppc+0(SB),0,$0
+ MOVW ov+4(FP),R4
+ MOVW nv+8(FP),R8
+ LWAR (R3),R5
+ CMP R5,R4
+ BNE fail
+ DCBT (R3) /* fix 405 errata cpu_210 */
+ STWCCC R8,(R3)
+ BNE fail1
+ MOVW $1,R3
+ RETURN
+fail:
+ DCBT (R3) /* fix 405 errata cpu_210 */
+ STWCCC R5,(R3) /* give up exclusive access */
+fail1:
+ MOVW R0,R3
+ RETURN
+ END
--- a//sys/src/9/ppc/m8260.c
+++ b//sys/src/9/ppc/m8260.c
@@ -131,6 +131,7 @@
m->imap = (Imap*)INTMEM;
m->loopconst = 1096;
+ cmpswap = cmpswapppc;
/* Make sure Ethernet is disabled (boot code may have buffers allocated anywhere in memory) */
iomem->fcc[0].gfmr &= ~(BIT(27)|BIT(26));
@@ -398,7 +399,7 @@
}
void
-timerset(uvlong next)
+timerset(Tval next)
{
long offset;
uvlong now;
--- a//sys/src/9/ppc/mem.h
+++ b//sys/src/9/ppc/mem.h
@@ -225,3 +225,5 @@
#define IOMEM (INTMEM+0x10000)
#define getpgcolor(a) 0
+#define MIN(a, b) ((a) < (b)? (a): (b))
+#define MS2HZ (1000/HZ) /* millisec per clock tick */
--- a//sys/src/9/ppc/mkfile
+++ b//sys/src/9/ppc/mkfile
@@ -33,6 +33,7 @@
segment.$O\
sysfile.$O\
sysproc.$O\
+ userinit.$O\
taslock.$O\
tod.$O\
xalloc.$O\
@@ -60,6 +61,7 @@
/$objtype/lib/libmemlayer.a\
/$objtype/lib/libmemdraw.a\
/$objtype/lib/libdraw.a\
+ /$objtype/lib/libip.a\
/$objtype/lib/libc.a\
/$objtype/lib/libsec.a\
--- a//sys/src/9/ppc/msaturn.c
+++ b//sys/src/9/ppc/msaturn.c
@@ -117,6 +117,7 @@
m->imap = (Imap*)INTMEM;
m->loopconst = 1096;
+ cmpswap = cmpswapppc;
rrate = (*(ushort*)Syscfg >> 6) & 3;
switch(rrate){
--- a//sys/src/9/ppc/saturntimer.c
+++ b//sys/src/9/ppc/saturntimer.c
@@ -72,7 +72,7 @@
}
void
-timerset(uvlong next)
+timerset(Tval next)
{
ulong offset;
uvlong now;
--- a//sys/src/9/ppc/trap.c
+++ b//sys/src/9/ppc/trap.c
@@ -153,8 +153,10 @@
ecode = (ureg->cause >> 8) & 0xff;
switch(ecode) {
case CEI:
+ /* External interrupt - FIXME
m->intr++;
intr(ureg);
+ */
break;
case CDEC:
clockintr(ureg);
--- a//sys/src/9/ppc/ucu
+++ b//sys/src/9/ppc/ucu
@@ -10,10 +10,11 @@
cap
kprof
uart
+ shr
+ swap
ether netif
ip arp chandial ip ipv6 ipaux iproute netif netlog nullmedium pktmedium inferno
- ce
link
ethersaturn
@@ -31,6 +32,7 @@
ipifc
icmp
icmp6
+ netlog
port
int cpuserver = 1;
reply other threads:[~2023-04-11 3:46 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=2c69120e-eb07-5f03-7c5d-c9fcbef86bf6@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).