Sparc kernel help needed

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
cb88
Member
Member
Posts: 38
Joined: Sun Mar 07, 2010 4:06 pm

Sparc kernel help needed

Post by cb88 »

I'd like to port/write something similar to xv6 for Sparc http://pdos.csail.mit.edu/6.828/xv6/ at some point but the Sparc section of the wiki isn't much help and nether is this IMO http://www.cheesecake.org/sac/os-supp/ quite frankly but its better than nothing.

So is there anyone in the forum that could help me get as far as getting a kernel running in qemu? There just aren't any tutorials on the topic besides that one and it is quite old and requires that uboot think which I do not believe is even releated to the modern uboot.

I suppose the silo source code is somewhat useful from what I can tell the only useful assemblers around for sparc is the one on solaris and gas correct me if I am wrong on that. I mean there just isn't much info at all on the topic and specifics of gas with regard to sparc and the sun assembler isn't really an option (though I do have solaris 2.6 7 8 and 10 I just don't want to go that route). I have quite a few SparcStations 32 bit and 64 I can test code on. I lean toward the 32 bit ones though and anything I write in 32 bit would run on either so I plan on sticking to 32bit for simplicity.

I did find this so it should get me going on GNU as to begin with
http://www.cs.unm.edu/~maccabe/classes/ ... abman.html

I'll eventually just give in and start reading Linux/BSD code to figure out how its done but I really wouldn't mind some help. I see it as a sort of needed thing to as there aren't any really simple Sparc kernels out there.

qemu-system-sparc!
20Mhz SS2
40Mhz SS2 weitek upgrade
50, 2x50 or 60Mhz SS10
70Mhz SS5.
167Mhz Ultra 1E
and a 440Mhz ultra 10 which is actually rather nice.
I also have a hacked up 411 Scsi cdrom drive housing the drive out of the Ultra1 in a rather cramped but highly functional manner if I ever want to test boot cds.

And yes I am just learning kernel programing and in my free time at that but just have no motivation to learn about x86
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Sparc kernel help needed

Post by JamesM »

cb88 wrote:I'd like to port/write something similar to xv6 for Sparc http://pdos.csail.mit.edu/6.828/xv6/ at some point but the Sparc section of the wiki isn't much help and nether is this IMO http://www.cheesecake.org/sac/os-supp/ quite frankly but its better than nothing.

So is there anyone in the forum that could help me get as far as getting a kernel running in qemu? There just aren't any tutorials on the topic besides that one and it is quite old and requires that uboot think which I do not believe is even releated to the modern uboot.

I suppose the silo source code is somewhat useful from what I can tell the only useful assemblers around for sparc is the one on solaris and gas correct me if I am wrong on that. I mean there just isn't much info at all on the topic and specifics of gas with regard to sparc and the sun assembler isn't really an option (though I do have solaris 2.6 7 8 and 10 I just don't want to go that route). I have quite a few SparcStations 32 bit and 64 I can test code on. I lean toward the 32 bit ones though and anything I write in 32 bit would run on either so I plan on sticking to 32bit for simplicity.

I did find this so it should get me going on GNU as to begin with
http://www.cs.unm.edu/~maccabe/classes/ ... abman.html

I'll eventually just give in and start reading Linux/BSD code to figure out how its done but I really wouldn't mind some help. I see it as a sort of needed thing to as there aren't any really simple Sparc kernels out there.

qemu-system-sparc!
20Mhz SS2
40Mhz SS2 weitek upgrade
50, 2x50 or 60Mhz SS10
70Mhz SS5.
167Mhz Ultra 1E
and a 440Mhz ultra 10 which is actually rather nice.
I also have a hacked up 411 Scsi cdrom drive housing the drive out of the Ultra1 in a rather cramped but highly functional manner if I ever want to test boot cds.

And yes I am just learning kernel programing and in my free time at that but just have no motivation to learn about x86
Serial device is a SAB82532. Datasheet available on google. It's located at a fixed address, but it's through a bus bridge so is slightly tenuous to calculate (offset X inside bridge, means you need to add the bridge window Y to access its registers). Best way to get that is the SILO code.

Watch out for linux' interrupt code, it'll handle interrupts by re-raising them as softints then iretting immediately. Bit of a weird way to do it. Also, linux' TLB insert code assumes that the MMU automatically clears the lowest 12 bits - shouldn't be relied upon, is hardware specific.

Solaris would be better to look at, tbh.

</someone who was helping to write a SPARC emulator as a job>
cb88
Member
Member
Posts: 38
Joined: Sun Mar 07, 2010 4:06 pm

Re: Sparc kernel help needed

Post by cb88 »

@JamesM cool thats very helpful thanks for the tips ... I'll probably be leaning more on BSD code than Linux though if I can its not like am more familiar with either one source wise.

I get the impression that people don't like gnu as syntax but what ever it doesn't look that much different but perhaps a bit more verbose... I might change my mind later on though heh. you never know it probably wouldn't be hard to write a front end to make the gas syntax nice
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Sparc kernel help needed

Post by Combuster »

cb88 wrote:I get the impression that people don't like gnu as syntax
Actually, people don't like gnu x86 syntax because it shows no resemblance to the original manufacturer's syntax, yielding two camps and the occasional religious debate. For most other architectures, gas' syntax is pretty close to the syntax shown in the architecture/processor manual and the problem does not arise, and I haven't seen any indication that sparc is another exception.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Sparc kernel help needed

Post by JamesM »

For most other architectures, gas' syntax is pretty close to the syntax shown in the architecture/processor manual and the problem does not arise, and I haven't seen any indication that sparc is another exception.
ARM is another exception.
cb88
Member
Member
Posts: 38
Joined: Sun Mar 07, 2010 4:06 pm

Re: Sparc kernel help needed

Post by cb88 »

I see so it really just isn't that big a deal for Sparc but for the Arm and x86 examples it is rather different hmm.
cb88
Member
Member
Posts: 38
Joined: Sun Mar 07, 2010 4:06 pm

Re: Sparc kernel help needed

Post by cb88 »

About the serial chip... actually the sun4m and sun4c seem to uses the Zilog 8530 ... as do the earlier Sun Ultras. I acutally only have 1 the U10 which doesn't use the Zilog 8530 .... I imagine that qemu also uses it as it emulates the sparcstation 5.

The netbsd driver is called zs. Also the zilog datasheets http://zilog.com/index.php?option=com_doc&Itemid=99

Found a mailing list post too that tells a bit about the hardware. http://lkml.indiana.edu/hypermail/linux ... /0297.html

Edit also this Alan Cox on the Z3530 probably x86 but still should be helpful:
http://kernelbook.sourceforge.net/z8530book.pdf
cb88
Member
Member
Posts: 38
Joined: Sun Mar 07, 2010 4:06 pm

Re: Sparc kernel help needed

Post by cb88 »

openbios-sparc32 built from r1044 with crosstool-ng ... I had to rename some of the compiler binaries from sparc-unkown-elf-* to spar-elf-* to get it to detect the compiler when building the prom

http://webpages.uncc.edu/~carayfie/open ... -r1044.bz2

drop it in your qemu bios path or put it whereever and set the path with qemu-system-sparc -L /some/path

for example qemu-system-sparc -L . assuming the prom is in your working directory.
Post Reply