64 bit powerpc

classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|

64 bit powerpc

Peter J. Philipp-3
Hi,

This week I bought a used G5 PowerMac7,3 with 4 GB RAM and dual PowerPC
970FX cpu's.  I didn't buy it because I miss the macppc all that much
but because I want to test the water of creating a 64 bit port that goes
onward to perhaps support IBM POWER5+ CPU's.  It seems Linux and FreeBSD
are already there or on their way.

Since I'm a fan of OpenBSD I want an OpenBSD 64 bit Power(PC) port, and
asking if anyone has experience to make this happen? What are hints that
you can give?  Is it possible to just port over FreeBSD's low kernel
routines and get OpenBSD/powerpc64 working that way?

My use of OpenBSD/powerpc goes back to 2.9/3.0 days (when the macppc
port came), I had some time then and created some manpages for Dale Rahn
for the macppc system (which are probably in the attic by now).  I love
working with kernel code but I largely don't know what I'm doing.  My
programming experience is limited, I program a DNS authoritative server.

At my last job I was an AIX sysadmin (in training) and worked on a POWER
7 machine running AIX 7.2.  I left that job though so I can't use that
hardware to test a 64 bit port.  It left an impression on me though.

Regards,

-peter

Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Theo de Raadt-2
Peter J. Philipp <[hidden email]> wrote:

> Hi,
>
> This week I bought a used G5 PowerMac7,3 with 4 GB RAM and dual
> PowerPC 970FX cpu's.  I didn't buy it because I miss the macppc all
> that much but because I want to test the water of creating a 64 bit
> port that goes onward to perhaps support IBM POWER5+ CPU's.  It seems
> Linux and FreeBSD are already there or on their way.
>
> Since I'm a fan of OpenBSD I want an OpenBSD 64 bit Power(PC) port,
> and asking if anyone has experience to make this happen? What are
> hints that you can give?  Is it possible to just port over FreeBSD's
> low kernel routines and get OpenBSD/powerpc64 working that way?
>
> My use of OpenBSD/powerpc goes back to 2.9/3.0 days (when the macppc
> port came), I had some time then and created some manpages for Dale
> Rahn for the macppc system (which are probably in the attic by now). 
> I love working with kernel code but I largely don't know what I'm
> doing.  My programming experience is limited, I program a DNS
> authoritative server.
>
> At my last job I was an AIX sysadmin (in training) and worked on a
> POWER 7 machine running AIX 7.2.  I left that job though so I can't
> use that hardware to test a 64 bit port.  It left an impression on me
> though.

60% of the work is in pmap.c, 20% of the work in trap.c, and 20%
of the work is elsewhere.



Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Rino Rondan
In reply to this post by Peter J. Philipp-3
Hi Peter,
I moved to Openbsd or I’m in the transition to move because Im still testing some hardware. I bought     some powermac to test.

64 bit:
Powermac11,2 dual core 2.0
Powermac8,2 Imac one core 2.0

In both case I have issues with ide disk , i tested with 6.2 , the driver is not working properly , a friend did a test reducing the velocity with jumper in a new ide disk and works, I need to do more research and documentation. With FreeBSD works fine but you do not have  binary at all, with Ubuntu works nice but I do not want Ubuntu :( .. 64 bit arch from my side need more research maybe someone can tell me their experience.
With 32 bit arch it works awesome !! I use a Mac mini 1.42ghz g4 as a desktop  with 6.3 , the unique problem is browser but I do not care about that for the moment , just only using it with classical apps to work as sysadmin and some devel. Also I tested in PowerBook g4 and same awesome result.
I’m want to say thanks to all people make all works to get working ppc in openbsd , I wish to help by some way :)

Rondan Rino

On Thu, Jul 5, 2018 at 2:08 AM, Peter J. Philipp <[hidden email]> wrote:

> Hi, This week I bought a used G5 PowerMac7,3 with 4 GB RAM and dual PowerPC 970FX cpu's.  I didn't buy it because I miss the macppc all that much but because I want to test the water of creating a 64 bit port that goes onward to perhaps support IBM POWER5+ CPU's.  It seems Linux and FreeBSD are already there or on their way. Since I'm a fan of OpenBSD I want an OpenBSD 64 bit Power(PC) port, and asking if anyone has experience to make this happen? What are hints that you can give?  Is it possible to just port over FreeBSD's low kernel routines and get OpenBSD/powerpc64 working that way? My use of OpenBSD/powerpc goes back to 2.9/3.0 days (when the macppc port came), I had some time then and created some manpages for Dale Rahn for the macppc system (which are probably in the attic by now).  I love working with kernel code but I largely don't know what I'm doing.  My programming experience is limited, I program a DNS authoritative server. At my last job I was an AIX sysadmin (in training) and worked on a POWER 7 machine running AIX 7.2.  I left that job though so I can't use that hardware to test a 64 bit port.  It left an impression on me though. Regards, -peter
Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Peter J. Philipp-3
On Thu, Jul 05, 2018 at 07:30:28AM -0400, Rino Rondan wrote:

> Hi Peter,
> I moved to Openbsd or I???m in the transition to move because Im still testing some hardware. I bought     some powermac to test.
>
> 64 bit:
> Powermac11,2 dual core 2.0
> Powermac8,2 Imac one core 2.0
>
> In both case I have issues with ide disk , i tested with 6.2 , the driver is not working properly , a friend did a test reducing the velocity with jumper in a new ide disk and works, I need to do more research and documentation. With FreeBSD works fine but you do not have  binary at all, with Ubuntu works nice but I do not want Ubuntu :( .. 64 bit arch from my side need more research maybe someone can tell me their experience.
> With 32 bit arch it works awesome !! I use a Mac mini 1.42ghz g4 as a desktop  with 6.3 , the unique problem is browser but I do not care about that for the moment , just only using it with classical apps to work as sysadmin and some devel. Also I tested in PowerBook g4 and same awesome result.
> I???m want to say thanks to all people make all works to get working ppc in openbsd , I wish to help by some way :)
>
> Rondan Rino

Hi Rondan Rino,

I found a gem (and not just the ethernet driver) :-) it's the OpenBSD ppc
archives at https://marc.info.  One person posted their blog entry there
about netbooting on a G4 Cube.  The info was good for my G5 machine as well.
I personally thanked him with an email.  

I too want to thank all people making macppc what it is.  Having a lot of
fun with this lately.  And if you've been following bugs@ I have already
issues that I need fixed.  Much thanks to people who replied there.

Regards,
-peter

Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Peter J. Philipp-3
In reply to this post by Theo de Raadt-2
On Thu, Jul 05, 2018 at 12:12:45AM -0600, Theo de Raadt wrote:

> Peter J. Philipp <[hidden email]> wrote:
>
> > Hi,
> >
> > This week I bought a used G5 PowerMac7,3 with 4 GB RAM and dual
> > PowerPC 970FX cpu's.?? I didn't buy it because I miss the macppc all
> > that much but because I want to test the water of creating a 64 bit
> > port that goes onward to perhaps support IBM POWER5+ CPU's.?? It seems
> > Linux and FreeBSD are already there or on their way.
> >
> > Since I'm a fan of OpenBSD I want an OpenBSD 64 bit Power(PC) port,
> > and asking if anyone has experience to make this happen? What are
> > hints that you can give??? Is it possible to just port over FreeBSD's
> > low kernel routines and get OpenBSD/powerpc64 working that way?
> >
> > My use of OpenBSD/powerpc goes back to 2.9/3.0 days (when the macppc
> > port came), I had some time then and created some manpages for Dale
> > Rahn for the macppc system (which are probably in the attic by now).??
> > I love working with kernel code but I largely don't know what I'm
> > doing.?? My programming experience is limited, I program a DNS
> > authoritative server.
> >
> > At my last job I was an AIX sysadmin (in training) and worked on a
> > POWER 7 machine running AIX 7.2.?? I left that job though so I can't
> > use that hardware to test a 64 bit port.?? It left an impression on me
> > though.
>
> 60% of the work is in pmap.c, 20% of the work in trap.c, and 20%
> of the work is elsewhere.

Well I got started.  Since I've never done a port to any architecture, I did
not know where to begin.  I felt the header files needed work first especially
_types.h.  This is taking a long time and it's in the
"20% of the work is elsewhere" category.  I did about 6 header files
this morning, this morning was rare that I had time, I don't always have this
much time.  In order to not duplicate work of other people attempting a port
I put my files in my cvsweb on my vps.

We can share if you're working on this too.  And if I give up then the work is
not in vain.  The URL to this repo is:

http://centroid.eu/cgi-bin/cvsweb/powerpc64/

The reason I decided to reuse the header files from the powerpc arch is that
this is what FreeBSD is doing... this way I don't have to convert FreeBSD's
stuff to OpenBSD semantics, I just change it all to 64 bit and hope it'll work.

I did my best converting the ASM in atomic.h to 64 bit instructions with help
of an IBM programmers guide and the FreeBSD repo for hints.

I'll keep going when I find more time :-).  Crontab to sync this repo to my
vps's repo is set at hourly.

Regards,
-peter

Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Brandon Bergren
I'm also interested in 64 bit PPC, as I have a Talos II (dual POWER9) and have a second machine coming soon for driver debugging work (Talos II Lite "special developer system" -- https://secure.raptorcs.com/content/TLSDS1/intro.html )

I'm currently spending time doing driver debugging on FreeBSD, but would prefer using OpenBSD. I don't have an actual background in driver/kernel development but I'm starting to learn.


On Fri, Jul 6, 2018, at 3:43 AM, Peter J. Philipp wrote:
> Well I got started.  Since I've never done a port to any architecture, I did
> not know where to begin.  I felt the header files needed work first especially
> _types.h.  This is taking a long time and it's in the
> "20% of the work is elsewhere" category.  I did about 6 header files
> this morning, this morning was rare that I had time, I don't always have this
> much time.  In order to not duplicate work of other people attempting a port
> I put my files in my cvsweb on my vps.

Regarding porting resources, there are several presentations listed on the events and papers page ( https://www.openbsd.org/events.html ) that describe other people's experiences in porting OpenBSD to new platforms and CPUs. Grep for "porting".

> We can share if you're working on this too.  And if I give up then the work is
> not in vain.  The URL to this repo is:
>
> http://centroid.eu/cgi-bin/cvsweb/powerpc64/
>
> The reason I decided to reuse the header files from the powerpc arch is that
> this is what FreeBSD is doing... this way I don't have to convert FreeBSD's
> stuff to OpenBSD semantics, I just change it all to 64 bit and hope it'll work.
>
> I did my best converting the ASM in atomic.h to 64 bit instructions with help
> of an IBM programmers guide and the FreeBSD repo for hints.
>
> I'll keep going when I find more time :-).  Crontab to sync this repo to my
> vps's repo is set at hourly.
>
> Regards,
> -peter
>


--
  Brandon Bergren
  Technical Generalist

Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Peter J. Philipp-3
On Fri, Jul 06, 2018 at 12:15:02PM -0500, Brandon Bergren wrote:
> I'm also interested in 64 bit PPC, as I have a Talos II (dual POWER9) and have a second machine coming soon for driver debugging work (Talos II Lite "special developer system" -- https://secure.raptorcs.com/content/TLSDS1/intro.html )
>
> I'm currently spending time doing driver debugging on FreeBSD, but would prefer using OpenBSD. I don't have an actual background in driver/kernel development but I'm starting to learn.

I've had my eyes on such a system in the past (one can only dream).  As far as
I can remember Linux is using it in Little Endian byte order, and I don't
know what FreeBSD is doing.  I think up to POWER8 or something you should only
go Big Endian byte order.  I'm sticking with Big Endian byte order for now as
that's what's in powerpc arch.

I must say I learned a whole lot today working on this.  Hopefully I won't get
confused.

Nice system you have!

-peter

Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Brandon Bergren
Actually you can do both BE and LE Linux on them, it's just that IBM is pushing development towards LE at the moment. I suppose it's a plan to make it easier for X86 developers to migrate over and/or encourage movement to POWER8+.

FreeBSD only supports BE on POWER.

POWER9 is slightly biased towards BE but has a toggle at the logical partition level for BE vs LE so it works well either way. There are only a few instructions that don't work in LE mode (load/store multiple, move-assist).

On Fri, Jul 6, 2018, at 12:25 PM, Peter J. Philipp wrote:

> On Fri, Jul 06, 2018 at 12:15:02PM -0500, Brandon Bergren wrote:
> > I'm also interested in 64 bit PPC, as I have a Talos II (dual POWER9) and have a second machine coming soon for driver debugging work (Talos II Lite "special developer system" -- https://secure.raptorcs.com/content/TLSDS1/intro.html )
> >
> > I'm currently spending time doing driver debugging on FreeBSD, but would prefer using OpenBSD. I don't have an actual background in driver/kernel development but I'm starting to learn.
>
> I've had my eyes on such a system in the past (one can only dream).  As far as
> I can remember Linux is using it in Little Endian byte order, and I don't
> know what FreeBSD is doing.  I think up to POWER8 or something you should only
> go Big Endian byte order.  I'm sticking with Big Endian byte order for now as
> that's what's in powerpc arch.
>
> I must say I learned a whole lot today working on this.  Hopefully I won't get
> confused.
>
> Nice system you have!
>
> -peter


--
  Brandon Bergren
  Technical Generalist

Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Peter J. Philipp-3
In reply to this post by Peter J. Philipp-3
On Fri, Jul 06, 2018 at 10:43:44AM +0200, Peter J. Philipp wrote:

> On Thu, Jul 05, 2018 at 12:12:45AM -0600, Theo de Raadt wrote:
> > Peter J. Philipp <[hidden email]> wrote:
> >
> > > Hi,
> > >
> > > This week I bought a used G5 PowerMac7,3 with 4 GB RAM and dual
> > > PowerPC 970FX cpu's.?? I didn't buy it because I miss the macppc all
> > > that much but because I want to test the water of creating a 64 bit
> > > port that goes onward to perhaps support IBM POWER5+ CPU's.?? It seems
> > > Linux and FreeBSD are already there or on their way.
> > >
> > > Since I'm a fan of OpenBSD I want an OpenBSD 64 bit Power(PC) port,
> > > and asking if anyone has experience to make this happen? What are
> > > hints that you can give??? Is it possible to just port over FreeBSD's
> > > low kernel routines and get OpenBSD/powerpc64 working that way?
> > >
> > > My use of OpenBSD/powerpc goes back to 2.9/3.0 days (when the macppc
> > > port came), I had some time then and created some manpages for Dale
> > > Rahn for the macppc system (which are probably in the attic by now).??
> > > I love working with kernel code but I largely don't know what I'm
> > > doing.?? My programming experience is limited, I program a DNS
> > > authoritative server.
> > >
> > > At my last job I was an AIX sysadmin (in training) and worked on a
> > > POWER 7 machine running AIX 7.2.?? I left that job though so I can't
> > > use that hardware to test a 64 bit port.?? It left an impression on me
> > > though.
> >
> > 60% of the work is in pmap.c, 20% of the work in trap.c, and 20%
> > of the work is elsewhere.
>
> Well I got started.  Since I've never done a port to any architecture, I did
> not know where to begin.  I felt the header files needed work first especially
> _types.h.  This is taking a long time and it's in the
> "20% of the work is elsewhere" category.  I did about 6 header files
> this morning, this morning was rare that I had time, I don't always have this
> much time.  In order to not duplicate work of other people attempting a port
> I put my files in my cvsweb on my vps.
>
> We can share if you're working on this too.  And if I give up then the work is
> not in vain.  The URL to this repo is:
>
> http://centroid.eu/cgi-bin/cvsweb/powerpc64/
>
> The reason I decided to reuse the header files from the powerpc arch is that
> this is what FreeBSD is doing... this way I don't have to convert FreeBSD's
> stuff to OpenBSD semantics, I just change it all to 64 bit and hope it'll work.
>
> I did my best converting the ASM in atomic.h to 64 bit instructions with help
> of an IBM programmers guide and the FreeBSD repo for hints.
>
> I'll keep going when I find more time :-).  Crontab to sync this repo to my
> vps's repo is set at hourly.
>
> Regards,
> -peter

Hi,

It's 9 days later since my last post and I haven't gotten far, even though I've
been investing a lot of time in this (I feel).  I'm mostly still working on
pmap.c and it'll take a while yet before I'm satisfied to go on.  I believe I'll
have most of august to work on this while I wait to be accepted to a grant for
another project of mine, maybe by the end of august I'll be ready with pmap.c,
but who knows?  I've been reading a little about pmap.c in the DAIOT44BOS, to
help guide me, and I've been reading through the FreeBSD/powerpc sources as
well.  I took 3 files from FreeBSD already to help me, otherwise I feel that
much of the powerpc arch is already 64 bit ready and I can work with that.

If I may dream a little I'd like to call the 64 bit powerpc arch powerpc64,
the 64 bit mac arch I want to call aim64 (after AIM alliance) and if we ever
get to boot aim64, I want to work on POWER ports.. think OpenBSD/power has a
nice look to it even though the backend is powerpc64.

To the things that I'll need for day X when I boot the kernel in 64 bit mode
is a 64 bit loader (perhaps a hack to ofwboot), and another challenge will be
setting up the cross compiler to compile a first kernel.  So far it's just me
doing the work, and I'm impressed by it all.  And I know so little.

So where am I with pmap.c?  FreeBSD has a slab cache implementation of the SLB
routines for the PV lookup functions, if I'm not mistaken.  I found a very
early version of this that uses SPLAY trees and I thought that's a good
starting point.  It can always be updated in time (perhaps after the system
runs).  I'm taking all the SR_* and sr stuff out as I believe that's 32 bit and
it won't work with the slb stuff.  I've been changing some types in functions
in pmap.c (but have to revert stuff I did this weekend) as well.  Anything with
function32() I've shamelessly removed.  I've also gotten rid of any 32 bit code
that I saw, perhaps carelessly but if I need it to reference I can look at the
powerpc sources again and copy it back.   Can't wait for day X when I compile
and it catches #error's I've sprayed around the source of it.  

Thanks!

-peter

Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Peter J. Philipp-3
On Sun, Jul 15, 2018 at 06:02:22PM +0200, Peter J. Philipp wrote:
> > > 60% of the work is in pmap.c, 20% of the work in trap.c, and 20%
> > > of the work is elsewhere.

Hi,

I've been working hard at this most of the week and I'm at a point now where
I'm sick of eyeballing the code and doing theoretical changes.  I need a
compiler to do a second look for me.  Although this is the core powerpc64
stuff, there is still the macppc stuff to port and I'll call those aim64.

For a snapshot of what I've done:

http://centroid.eu/private/powerpc64.tgz

For the CVS repo:

http://centroid.eu/cgi-bin/cvsweb/powerpc64/

And look for aim64 which will have a path such as:

http://centroid.eu/cgi-bin/cvsweb/aim64/

There is still lots of hurdles but when I finish the aim64 stuff, I'll be
looking for two things.

1) A cross-compiler with powerpc64 support
2) a 64-bit loader (like ofwboot)

If you know an easier way to get a 64 bit loader other than hacking on ofwboot
let me know.  Or if there is no easier way perhaps someone wants to help me
with this?  Working on a 64 bit loader would be awesome then I have to do less
work and we meet in the middle.

I know the code as is won't compile, but I'm willing to give it a pass and
work on fixing the errors that the compiler gives me.  Given that, booting a
first kernel will likely panic() it at boot, if it doesn't panic then I'm
extremely lucky.  Or it's gonna be really slow as I screwed up on the Segment
Lookaside Buffer or TLB cache or something.  I'd like to see the day :-).

Now I want to give everyone who worked on this code before me mad props!  The
code was pretty much almost 64 bit ready and I did a bit of cutting out, and
pulling stuff in from FreeBSD and comparing with the PEM guide from IBM.
Thanks so far!  Also thanks for FreeBSD who trailblazed my efforts and gave me
somethign to work with.

Here is a list of things that I did a visual inspection on and possibly
changes.  What's not checked needs immediate attention still.


file first pass (eyes only) second pass (compiler)
-------------------------------+-----------------------+-----------------------
powerpc64/bus_dma.c X
powerpc64/bus_space.c X
powerpc64/copystr.c X
powerpc64/cpu_subr.c X
powerpc64/fpu.c X
powerpc64/genassym.cf X
powerpc64/in_cksum.c X
powerpc64/intr.c X
powerpc64/lock_machdep.c X
powerpc64/pmap.c X
powerpc64/process_machdep.c X
powerpc64/setjmp.S
powerpc64/softintr.c X
powerpc64/sys_machdep.c X
powerpc64/trap.c
powerpc64/vm_machdep.c
powerpc64/copyinout.c X
powerpc64/slb.c X

ddb/db_disasm.c X
ddb/db_interface.c X
ddb/db_memrw.c X
ddb/db_trace.c X

include/*.h X

Best Regards,
-peter

Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Matthias Freitag
nice, i have two spare G5 Powermacs at home that i will test this on!

On Fri, 20 Jul 2018 at 16:58, Peter J. Philipp <[hidden email]> wrote:

> On Sun, Jul 15, 2018 at 06:02:22PM +0200, Peter J. Philipp wrote:
> > > > 60% of the work is in pmap.c, 20% of the work in trap.c, and 20%
> > > > of the work is elsewhere.
>
> Hi,
>
> I've been working hard at this most of the week and I'm at a point now
> where
> I'm sick of eyeballing the code and doing theoretical changes.  I need a
> compiler to do a second look for me.  Although this is the core powerpc64
> stuff, there is still the macppc stuff to port and I'll call those aim64.
>
> For a snapshot of what I've done:
>
> http://centroid.eu/private/powerpc64.tgz
>
> For the CVS repo:
>
> http://centroid.eu/cgi-bin/cvsweb/powerpc64/
>
> And look for aim64 which will have a path such as:
>
> http://centroid.eu/cgi-bin/cvsweb/aim64/
>
> There is still lots of hurdles but when I finish the aim64 stuff, I'll be
> looking for two things.
>
> 1) A cross-compiler with powerpc64 support
> 2) a 64-bit loader (like ofwboot)
>
> If you know an easier way to get a 64 bit loader other than hacking on
> ofwboot
> let me know.  Or if there is no easier way perhaps someone wants to help me
> with this?  Working on a 64 bit loader would be awesome then I have to do
> less
> work and we meet in the middle.
>
> I know the code as is won't compile, but I'm willing to give it a pass and
> work on fixing the errors that the compiler gives me.  Given that, booting
> a
> first kernel will likely panic() it at boot, if it doesn't panic then I'm
> extremely lucky.  Or it's gonna be really slow as I screwed up on the
> Segment
> Lookaside Buffer or TLB cache or something.  I'd like to see the day :-).
>
> Now I want to give everyone who worked on this code before me mad props!
> The
> code was pretty much almost 64 bit ready and I did a bit of cutting out,
> and
> pulling stuff in from FreeBSD and comparing with the PEM guide from IBM.
> Thanks so far!  Also thanks for FreeBSD who trailblazed my efforts and
> gave me
> somethign to work with.
>
> Here is a list of things that I did a visual inspection on and possibly
> changes.  What's not checked needs immediate attention still.
>
>
> file                            first pass (eyes only)  second pass
> (compiler)
>
> -------------------------------+-----------------------+-----------------------
> powerpc64/bus_dma.c                     X
> powerpc64/bus_space.c                   X
> powerpc64/copystr.c                     X
> powerpc64/cpu_subr.c                    X
> powerpc64/fpu.c                         X
> powerpc64/genassym.cf                   X
> powerpc64/in_cksum.c                    X
> powerpc64/intr.c                        X
> powerpc64/lock_machdep.c                X
> powerpc64/pmap.c                        X
> powerpc64/process_machdep.c             X
> powerpc64/setjmp.S
> powerpc64/softintr.c                    X
> powerpc64/sys_machdep.c                 X
> powerpc64/trap.c
> powerpc64/vm_machdep.c
> powerpc64/copyinout.c                   X
> powerpc64/slb.c                         X
>
> ddb/db_disasm.c                         X
> ddb/db_interface.c                      X
> ddb/db_memrw.c                          X
> ddb/db_trace.c                          X
>
> include/*.h                             X
>
> Best Regards,
> -peter
>
>
Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Peter J. Philipp-3
On Fri, Jul 27, 2018 at 10:12:30AM +0200, Matthias Freitag wrote:
> nice, i have two spare G5 Powermacs at home that i will test this on!

awesome!  While building the cross-compiler this week I realised I really
need to get the cross-includes complete meaning I have to get aim64 arch
completed.  I think powerpc64 is completely in place.  This will possibly
go into next week (when I hope it's cooler).

The idea is sorta like macppc on powerpc where the hierarchy is:

                Architecture Hierarchies in OpenBSD

 socppc         macppc  I want it to be:   aim64        power
    \             /                           \          /
     \           /                             \        /
      \         /                               \      /
        powerpc                                 powerpc64

aim64 will solely be G5 Macs (PowerPC 970 based), power would be IBM Power.
AIM stands for Apple, IBM, Motorola which formed the AIM Alliance in the 90's.

I'll put a new snapshot of powerpc64 and aim64 from /usr/src/sys/arch out
soon, then hopefully you'll be able to make a cross-includes (which I tested
last night).  One hint to do that is to do it in a vmm on amd64, that way if
you mess up the system by mistyping you don't have to reinstall a possibly
valuable system.  A vmm is disposable.

Regards,
-peter

> On Fri, 20 Jul 2018 at 16:58, Peter J. Philipp <[hidden email]> wrote:
>
> > On Sun, Jul 15, 2018 at 06:02:22PM +0200, Peter J. Philipp wrote:
> > > > > 60% of the work is in pmap.c, 20% of the work in trap.c, and 20%
> > > > > of the work is elsewhere.
> >
> > Hi,
> >
> > I've been working hard at this most of the week and I'm at a point now
> > where
> > I'm sick of eyeballing the code and doing theoretical changes.  I need a
> > compiler to do a second look for me.  Although this is the core powerpc64
> > stuff, there is still the macppc stuff to port and I'll call those aim64.
> >
> > For a snapshot of what I've done:
> >
> > http://centroid.eu/private/powerpc64.tgz
> >
> > For the CVS repo:
> >
> > http://centroid.eu/cgi-bin/cvsweb/powerpc64/
> >
> > And look for aim64 which will have a path such as:
> >
> > http://centroid.eu/cgi-bin/cvsweb/aim64/
> >
> > There is still lots of hurdles but when I finish the aim64 stuff, I'll be
> > looking for two things.
> >
> > 1) A cross-compiler with powerpc64 support
> > 2) a 64-bit loader (like ofwboot)
> >
> > If you know an easier way to get a 64 bit loader other than hacking on
> > ofwboot
> > let me know.  Or if there is no easier way perhaps someone wants to help me
> > with this?  Working on a 64 bit loader would be awesome then I have to do
> > less
> > work and we meet in the middle.
> >
> > I know the code as is won't compile, but I'm willing to give it a pass and
> > work on fixing the errors that the compiler gives me.  Given that, booting
> > a
> > first kernel will likely panic() it at boot, if it doesn't panic then I'm
> > extremely lucky.  Or it's gonna be really slow as I screwed up on the
> > Segment
> > Lookaside Buffer or TLB cache or something.  I'd like to see the day :-).
> >
> > Now I want to give everyone who worked on this code before me mad props!
> > The
> > code was pretty much almost 64 bit ready and I did a bit of cutting out,
> > and
> > pulling stuff in from FreeBSD and comparing with the PEM guide from IBM.
> > Thanks so far!  Also thanks for FreeBSD who trailblazed my efforts and
> > gave me
> > somethign to work with.
> >
> > Here is a list of things that I did a visual inspection on and possibly
> > changes.  What's not checked needs immediate attention still.
> >
> >
> > file                            first pass (eyes only)  second pass
> > (compiler)
> >
> > -------------------------------+-----------------------+-----------------------
> > powerpc64/bus_dma.c                     X
> > powerpc64/bus_space.c                   X
> > powerpc64/copystr.c                     X
> > powerpc64/cpu_subr.c                    X
> > powerpc64/fpu.c                         X
> > powerpc64/genassym.cf                   X
> > powerpc64/in_cksum.c                    X
> > powerpc64/intr.c                        X
> > powerpc64/lock_machdep.c                X
> > powerpc64/pmap.c                        X
> > powerpc64/process_machdep.c             X
> > powerpc64/setjmp.S
> > powerpc64/softintr.c                    X
> > powerpc64/sys_machdep.c                 X
> > powerpc64/trap.c
> > powerpc64/vm_machdep.c
> > powerpc64/copyinout.c                   X
> > powerpc64/slb.c                         X
> >
> > ddb/db_disasm.c                         X
> > ddb/db_interface.c                      X
> > ddb/db_memrw.c                          X
> > ddb/db_trace.c                          X
> >
> > include/*.h                             X
> >
> > Best Regards,
> > -peter
> >
> >

Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Peter J. Philipp-3
BTW I'm actively looking for PowerPC64 literature.  I don't mean the
.pdf's provided by IBM but a real book.  If you know of any send me the
ISBN, sometimes these books hide under names that aren't really leading
toward "powerpc".

I have in the last 2 weeks bought one book off Amazon.  It's 32-bit
PowerPC specific called "Newnes PowerPC Programming Pocket Book" by
Steve Heath.  Great pocket book!  I love that he has 2 pages in the
appendix covering 64 Bit PowerPC!  What's astonishing is that he covers
the basics of 64 bit powerpc and the book is from 1995!  I don't mind
buying this because I'm taking the 32 bit powerpc arch and pretty well
hacking on it to make it 64-bit.  I don't know if my approach is
orthodox, but when I saw FreeBSD's code it dawned on me I could do this.

Another book I have is Computer Organization and Design Risc-V edition
by Hennessy and Patterson.  In the index in the back of the book they
describe that PowerPC is covered in Appendix D section which this book
is missing (doh!).  Well I can't always get lucky *grin*.

Regards,
-peter

On 07/27/18 10:44, Peter J. Philipp wrote:

> On Fri, Jul 27, 2018 at 10:12:30AM +0200, Matthias Freitag wrote:
>> nice, i have two spare G5 Powermacs at home that i will test this on!
> awesome!  While building the cross-compiler this week I realised I really
> need to get the cross-includes complete meaning I have to get aim64 arch
> completed.  I think powerpc64 is completely in place.  This will possibly
> go into next week (when I hope it's cooler).
>
> The idea is sorta like macppc on powerpc where the hierarchy is:
>
>        Architecture Hierarchies in OpenBSD
>
>   socppc         macppc  I want it to be:   aim64        power
>      \             /                           \          /
>       \           /                             \        /
>        \         /                               \      /
>          powerpc                                 powerpc64
>
> aim64 will solely be G5 Macs (PowerPC 970 based), power would be IBM Power.
> AIM stands for Apple, IBM, Motorola which formed the AIM Alliance in the 90's.
>
> I'll put a new snapshot of powerpc64 and aim64 from /usr/src/sys/arch out
> soon, then hopefully you'll be able to make a cross-includes (which I tested
> last night).  One hint to do that is to do it in a vmm on amd64, that way if
> you mess up the system by mistyping you don't have to reinstall a possibly
> valuable system.  A vmm is disposable.
>
> Regards,
> -peter
>
>> On Fri, 20 Jul 2018 at 16:58, Peter J. Philipp <[hidden email]> wrote:
>>
>>> On Sun, Jul 15, 2018 at 06:02:22PM +0200, Peter J. Philipp wrote:
>>>>>> 60% of the work is in pmap.c, 20% of the work in trap.c, and 20%
>>>>>> of the work is elsewhere.
>>> Hi,
>>>
>>> I've been working hard at this most of the week and I'm at a point now
>>> where
>>> I'm sick of eyeballing the code and doing theoretical changes.  I need a
>>> compiler to do a second look for me.  Although this is the core powerpc64
>>> stuff, there is still the macppc stuff to port and I'll call those aim64.
>>>
>>> For a snapshot of what I've done:
>>>
>>> http://centroid.eu/private/powerpc64.tgz
>>>
>>> For the CVS repo:
>>>
>>> http://centroid.eu/cgi-bin/cvsweb/powerpc64/
>>>
>>> And look for aim64 which will have a path such as:
>>>
>>> http://centroid.eu/cgi-bin/cvsweb/aim64/
>>>
>>> There is still lots of hurdles but when I finish the aim64 stuff, I'll be
>>> looking for two things.
>>>
>>> 1) A cross-compiler with powerpc64 support
>>> 2) a 64-bit loader (like ofwboot)
>>>
>>> If you know an easier way to get a 64 bit loader other than hacking on
>>> ofwboot
>>> let me know.  Or if there is no easier way perhaps someone wants to help me
>>> with this?  Working on a 64 bit loader would be awesome then I have to do
>>> less
>>> work and we meet in the middle.
>>>
>>> I know the code as is won't compile, but I'm willing to give it a pass and
>>> work on fixing the errors that the compiler gives me.  Given that, booting
>>> a
>>> first kernel will likely panic() it at boot, if it doesn't panic then I'm
>>> extremely lucky.  Or it's gonna be really slow as I screwed up on the
>>> Segment
>>> Lookaside Buffer or TLB cache or something.  I'd like to see the day :-).
>>>
>>> Now I want to give everyone who worked on this code before me mad props!
>>> The
>>> code was pretty much almost 64 bit ready and I did a bit of cutting out,
>>> and
>>> pulling stuff in from FreeBSD and comparing with the PEM guide from IBM.
>>> Thanks so far!  Also thanks for FreeBSD who trailblazed my efforts and
>>> gave me
>>> somethign to work with.
>>>
>>> Here is a list of things that I did a visual inspection on and possibly
>>> changes.  What's not checked needs immediate attention still.
>>>
>>>
>>> file                            first pass (eyes only)  second pass
>>> (compiler)
>>>
>>> -------------------------------+-----------------------+-----------------------
>>> powerpc64/bus_dma.c                     X
>>> powerpc64/bus_space.c                   X
>>> powerpc64/copystr.c                     X
>>> powerpc64/cpu_subr.c                    X
>>> powerpc64/fpu.c                         X
>>> powerpc64/genassym.cf                   X
>>> powerpc64/in_cksum.c                    X
>>> powerpc64/intr.c                        X
>>> powerpc64/lock_machdep.c                X
>>> powerpc64/pmap.c                        X
>>> powerpc64/process_machdep.c             X
>>> powerpc64/setjmp.S
>>> powerpc64/softintr.c                    X
>>> powerpc64/sys_machdep.c                 X
>>> powerpc64/trap.c
>>> powerpc64/vm_machdep.c
>>> powerpc64/copyinout.c                   X
>>> powerpc64/slb.c                         X
>>>
>>> ddb/db_disasm.c                         X
>>> ddb/db_interface.c                      X
>>> ddb/db_memrw.c                          X
>>> ddb/db_trace.c                          X
>>>
>>> include/*.h                             X
>>>
>>> Best Regards,
>>> -peter
>>>
>>>

Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Peter J. Philipp-3
Hi,

I've started a diary of sorts for this porting effort:

http://enhancedrisc.de/

Feel free to take a look if you're interested in helping.  The lowest part
is most recent.  I was pleasantly surprised someone provided a patch for me
over night for building openbsd binutils-2.17 with clang!  I'm going to
check that out today and I'll be likely busy with pmap.c and co.  the rest
of the week.

Regards,
-peter


On Fri, Jul 27, 2018 at 11:36:13AM +0200, Peter J. Philipp wrote:

> BTW I'm actively looking for PowerPC64 literature.?? I don't mean the .pdf's
> provided by IBM but a real book.?? If you know of any send me the ISBN,
> sometimes these books hide under names that aren't really leading toward
> "powerpc".
>
> I have in the last 2 weeks bought one book off Amazon.?? It's 32-bit PowerPC
> specific called "Newnes PowerPC Programming Pocket Book" by Steve Heath.??
> Great pocket book!?? I love that he has 2 pages in the appendix covering 64
> Bit PowerPC!?? What's astonishing is that he covers the basics of 64 bit
> powerpc and the book is from 1995!?? I don't mind buying this because I'm
> taking the 32 bit powerpc arch and pretty well hacking on it to make it
> 64-bit.?? I don't know if my approach is orthodox, but when I saw FreeBSD's
> code it dawned on me I could do this.
>
> Another book I have is Computer Organization and Design Risc-V edition by
> Hennessy and Patterson.?? In the index in the back of the book they describe
> that PowerPC is covered in Appendix D section which this book is missing
> (doh!).?? Well I can't always get lucky *grin*.
>
> Regards,
> -peter
>
> On 07/27/18 10:44, Peter J. Philipp wrote:
> > On Fri, Jul 27, 2018 at 10:12:30AM +0200, Matthias Freitag wrote:
> > > nice, i have two spare G5 Powermacs at home that i will test this on!
> > awesome!  While building the cross-compiler this week I realised I really
> > need to get the cross-includes complete meaning I have to get aim64 arch
> > completed.  I think powerpc64 is completely in place.  This will possibly
> > go into next week (when I hope it's cooler).
> >
> > The idea is sorta like macppc on powerpc where the hierarchy is:
> >
> >        Architecture Hierarchies in OpenBSD
> >
> >   socppc         macppc  I want it to be:   aim64        power
> >      \             /                           \          /
> >       \           /                             \        /
> >        \         /                               \      /
> >          powerpc                                 powerpc64
> >
> > aim64 will solely be G5 Macs (PowerPC 970 based), power would be IBM Power.
> > AIM stands for Apple, IBM, Motorola which formed the AIM Alliance in the 90's.
> >
> > I'll put a new snapshot of powerpc64 and aim64 from /usr/src/sys/arch out
> > soon, then hopefully you'll be able to make a cross-includes (which I tested
> > last night).  One hint to do that is to do it in a vmm on amd64, that way if
> > you mess up the system by mistyping you don't have to reinstall a possibly
> > valuable system.  A vmm is disposable.
> >
> > Regards,
> > -peter
> >
> > > On Fri, 20 Jul 2018 at 16:58, Peter J. Philipp <[hidden email]> wrote:
> > >
> > > > On Sun, Jul 15, 2018 at 06:02:22PM +0200, Peter J. Philipp wrote:
> > > > > > > 60% of the work is in pmap.c, 20% of the work in trap.c, and 20%
> > > > > > > of the work is elsewhere.
> > > > Hi,
> > > >
> > > > I've been working hard at this most of the week and I'm at a point now
> > > > where
> > > > I'm sick of eyeballing the code and doing theoretical changes.  I need a
> > > > compiler to do a second look for me.  Although this is the core powerpc64
> > > > stuff, there is still the macppc stuff to port and I'll call those aim64.
> > > >
> > > > For a snapshot of what I've done:
> > > >
> > > > http://centroid.eu/private/powerpc64.tgz
> > > >
> > > > For the CVS repo:
> > > >
> > > > http://centroid.eu/cgi-bin/cvsweb/powerpc64/
> > > >
> > > > And look for aim64 which will have a path such as:
> > > >
> > > > http://centroid.eu/cgi-bin/cvsweb/aim64/
> > > >
> > > > There is still lots of hurdles but when I finish the aim64 stuff, I'll be
> > > > looking for two things.
> > > >
> > > > 1) A cross-compiler with powerpc64 support
> > > > 2) a 64-bit loader (like ofwboot)
> > > >
> > > > If you know an easier way to get a 64 bit loader other than hacking on
> > > > ofwboot
> > > > let me know.  Or if there is no easier way perhaps someone wants to help me
> > > > with this?  Working on a 64 bit loader would be awesome then I have to do
> > > > less
> > > > work and we meet in the middle.
> > > >
> > > > I know the code as is won't compile, but I'm willing to give it a pass and
> > > > work on fixing the errors that the compiler gives me.  Given that, booting
> > > > a
> > > > first kernel will likely panic() it at boot, if it doesn't panic then I'm
> > > > extremely lucky.  Or it's gonna be really slow as I screwed up on the
> > > > Segment
> > > > Lookaside Buffer or TLB cache or something.  I'd like to see the day :-).
> > > >
> > > > Now I want to give everyone who worked on this code before me mad props!
> > > > The
> > > > code was pretty much almost 64 bit ready and I did a bit of cutting out,
> > > > and
> > > > pulling stuff in from FreeBSD and comparing with the PEM guide from IBM.
> > > > Thanks so far!  Also thanks for FreeBSD who trailblazed my efforts and
> > > > gave me
> > > > somethign to work with.
> > > >
> > > > Here is a list of things that I did a visual inspection on and possibly
> > > > changes.  What's not checked needs immediate attention still.
> > > >
> > > >
> > > > file                            first pass (eyes only)  second pass
> > > > (compiler)
> > > >
> > > > -------------------------------+-----------------------+-----------------------
> > > > powerpc64/bus_dma.c                     X
> > > > powerpc64/bus_space.c                   X
> > > > powerpc64/copystr.c                     X
> > > > powerpc64/cpu_subr.c                    X
> > > > powerpc64/fpu.c                         X
> > > > powerpc64/genassym.cf                   X
> > > > powerpc64/in_cksum.c                    X
> > > > powerpc64/intr.c                        X
> > > > powerpc64/lock_machdep.c                X
> > > > powerpc64/pmap.c                        X
> > > > powerpc64/process_machdep.c             X
> > > > powerpc64/setjmp.S
> > > > powerpc64/softintr.c                    X
> > > > powerpc64/sys_machdep.c                 X
> > > > powerpc64/trap.c
> > > > powerpc64/vm_machdep.c
> > > > powerpc64/copyinout.c                   X
> > > > powerpc64/slb.c                         X
> > > >
> > > > ddb/db_disasm.c                         X
> > > > ddb/db_interface.c                      X
> > > > ddb/db_memrw.c                          X
> > > > ddb/db_trace.c                          X
> > > >
> > > > include/*.h                             X
> > > >
> > > > Best Regards,
> > > > -peter
> > > >
> > > >

Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Peter J. Philipp-3
In reply to this post by Peter J. Philipp-3
Hi OpenBSD PPC Community,

if you haven't read the news from 14th of september
(http://enhancedrisc.de/#20180914) I'm stuck with the asm in locore0.S. 
I've been in contact with someone who said I should look at NetBSD's ps3
page, but I can't reach their source code, (ftp times out)
http://www.psdevwiki.com/ps3/NetBSD_on_PS3
so that led nowhere.

I thought I'd query the community if they had any more hints, as my time
is running low as I'm picking up more things that work towards an
income.  I'm sorry it hasn't been the best last month, and I'm worried I
may not produce what I had intended to produce.  If there is nothing by
christmas of this year then there is no hope from anything from me.

Regards,
-peter

Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Peter J. Philipp-3
On Tue, Sep 18, 2018 at 10:04:01AM +0200, Peter J. Philipp wrote:
> Hi OpenBSD PPC Community,

Hi again!  I've managed to get a bit further.  I'm a step away from linking
the kernel for the first time, but I have error messages and it seems to come
from the linker.  I'm a bit dumb about this right now so I thought I'd ask if
you guys can make out what the error wants me to do.

http://enhancedrisc.de/#20181014

Regards,
-peter

Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Mark Kettenis
> Date: Sun, 14 Oct 2018 17:43:47 +0200
> From: "Peter J. Philipp" <[hidden email]>
>
> On Tue, Sep 18, 2018 at 10:04:01AM +0200, Peter J. Philipp wrote:
> > Hi OpenBSD PPC Community,
>
> Hi again!  I've managed to get a bit further.  I'm a step away from linking
> the kernel for the first time, but I have error messages and it seems to come
> from the linker.  I'm a bit dumb about this right now so I thought I'd ask if
> you guys can make out what the error wants me to do.
>
> http://enhancedrisc.de/#20181014

The instructions you use in locore0.S to refer to fwargsave, esym and
proc0paddr only have limited range and when the final link is done
these symbols are put at an offset that is to large.  You probably
have to rewrite the bits of code in locore0.S that deal with the
global variables to use instruction sequences that can reach larger
offsets.

Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Peter J. Philipp-3
On Sun, Oct 14, 2018 at 06:38:53PM +0200, Mark Kettenis wrote:

> > Date: Sun, 14 Oct 2018 17:43:47 +0200
> > From: "Peter J. Philipp" <[hidden email]>
> >
> > On Tue, Sep 18, 2018 at 10:04:01AM +0200, Peter J. Philipp wrote:
> > > Hi OpenBSD PPC Community,
> >
> > Hi again!  I've managed to get a bit further.  I'm a step away from linking
> > the kernel for the first time, but I have error messages and it seems to come
> > from the linker.  I'm a bit dumb about this right now so I thought I'd ask if
> > you guys can make out what the error wants me to do.
> >
> > http://enhancedrisc.de/#20181014
>
> The instructions you use in locore0.S to refer to fwargsave, esym and
> proc0paddr only have limited range and when the final link is done
> these symbols are put at an offset that is to large.  You probably
> have to rewrite the bits of code in locore0.S that deal with the
> global variables to use instruction sequences that can reach larger
> offsets.

Awesome explanation thanks!  And I noticed I strayed too far from the
example given to me by the 32 bit macppc code.  I corrected that and I got
this:

...
ld -N -Ttext 100114 -e start --warn-common -nopie -o bsd ${SYSTEM_HEAD} vers.o ${OBJS}
text    data    bss     dec     hex
6367624 2074912 671936  9114472 8b1368
mv bsd bsd.gdb
ctfstrip -S -o bsd bsd.gdb
ct4#

So the very first cross-compiled kernel.  I doubt it works but its so tempting
to put it on.  I need a 64 bit loader anyhow so I'll work on that for a bit,
I hope I can reuse the macppc loader.  Finally I'm able to test code with the
compiler!  This is often a great help to me.

I've committed everything that wasn't committed in my aim64 and powerpc64 tree
and with this change which I'll commit in a sec there should be at least the
compilable sources (buggy or not).

Best Regards,
-peter

Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Peter J. Philipp-3
On Sun, Oct 14, 2018 at 07:39:09PM +0200, Peter J. Philipp wrote:
> So the very first cross-compiled kernel.  I doubt it works but its so tempting
> to put it on.  I need a 64 bit loader anyhow so I'll work on that for a bit,

Hi,

This is a question for those familiar with the PowerMac.  In the macppc port
right now a mac.boot binary is produced in XCOFF32 format and then run through
a program called fixup.  I got to the fixup part, but noticed I had produced
XCOFF64 binaries (0767 magic), would a mac even be able to boot an XCOFF64
binary?  I'm asking because before I hack on fixup to make it XCOFF64 capable
I'd rather know.  I can always produce a XCOFF32 format binary on the G5 in
32 bit macppc arch, and set the processor to 64 bits inside it.  I think that
would work right?  Although I think I need to be careful with this I think.

I'd rather ask before going back and redoing lots of work.

Regards,
-peter

Reply | Threaded
Open this post in threaded view
|

Re: 64 bit powerpc

Peter J. Philipp-3
On Mon, Oct 15, 2018 at 09:04:53AM +0200, Peter J. Philipp wrote:

> This is a question for those familiar with the PowerMac.  In the macppc port
> right now a mac.boot binary is produced in XCOFF32 format and then run through
> a program called fixup.  I got to the fixup part, but noticed I had produced
> XCOFF64 binaries (0767 magic), would a mac even be able to boot an XCOFF64
> binary?  I'm asking because before I hack on fixup to make it XCOFF64 capable
> I'd rather know.  I can always produce a XCOFF32 format binary on the G5 in
> 32 bit macppc arch, and set the processor to 64 bits inside it.  I think that
> would work right?  Although I think I need to be careful with this I think.
>
> I'd rather ask before going back and redoing lots of work.
>
> Regards,
> -peter

Hi, so I found out that Apple is not using a 64 bit loader in BootX which I
found from the Tiger install media.  In order to keep it short I'll refer what
I found in this message http://enhancedrisc.de/#20181015 .  So now I'll look
at producing 32 bit output to the cross-compiler and if it doesn't work, I'll
probably build this from the macppc arch subtree.

Regards,
-peter

12