preliminary (WORKING) Large Model Kernel - and dumb test program
Bill Henning
Posts: 6,445
Hi guys,
Here is a (mostly) working Large Model Kernel, with a really pathetic test program. Spin is NOT well suited to writing LMM code!
fjump, fcall, fret, fcache, fyield have been tested
New, untested extensions for better compiler support:
fldi - load immediate into R0
fpushi - push immediate onto the stack
fpush - push R0 onto the stack
fpop - pop top of stack into R0
fhalt - halt the kernel on the current cog
unimplemented & reserved
fsvc - future use - call OS service routine
flib - future use - call shared library
I welcome your questions & suggestions!
---
v0.51 - fixes fcache bug & extra pc+4 in start method that Mike pointed out - thanks Mike!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com - a new blog about microcontrollers
Post Edited (Bill Henning) : 11/30/2007 6:57:26 AM GMT
Here is a (mostly) working Large Model Kernel, with a really pathetic test program. Spin is NOT well suited to writing LMM code!
fjump, fcall, fret, fcache, fyield have been tested
New, untested extensions for better compiler support:
fldi - load immediate into R0
fpushi - push immediate onto the stack
fpush - push R0 onto the stack
fpop - pop top of stack into R0
fhalt - halt the kernel on the current cog
unimplemented & reserved
fsvc - future use - call OS service routine
flib - future use - call shared library
I welcome your questions & suggestions!
---
v0.51 - fixes fcache bug & extra pc+4 in start method that Mike pointed out - thanks Mike!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com - a new blog about microcontrollers
Post Edited (Bill Henning) : 11/30/2007 6:57:26 AM GMT
Comments
2) In the kernel start, you set the pc to addr+4. Why? You already increment the pc
by 4 in the initialize routine. It would make more sense to just pass the actual initial
pc rather than providing in the initialization routine for a single long parameter for some
purpose. You could always access the parameter(s) at negative offsets from the initial pc
or at positive offsets from the start of the memory block (which so far isn't used).
1) good catch, an edit killed it - rdl gets re-initialized before jmp #next_op
2) I was thinking of prefixing each large model program by an long, which would be the number of longs in that memory block; sp could then be computed, which would help with the multi-threaded kernel; however I can serve the same purpose by fetching that long from a negative offset as you suggest, so I can kill that add pc,#4
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com - a new blog about microcontrollers
For documentation purposes, you should use "icache" instead of "$80" in FCACHEX.
Post Edited (Mike Green) : 11/30/2007 6:36:40 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com - a new blog about microcontrollers
I'm also starting to give some thought to an overlay manager; my initial inclination is to keep it simple and just essentially "chain" replacing all of the code, but keeping the stack and global variables - but it may be worthwhile to have a a slightly more sophisticated approach that would allow for some shared code (perhaps application specific common functions) and chaining just modules after the common code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com - a new blog about microcontrollers
Post Edited (Bill Henning) : 11/30/2007 6:53:13 AM GMT
There's something screwy going on with your editing process. In the version you just corrected, there's a blank line where you should be initializing k_pc in the start routine. Also, you have to change your demo program so the initial pc points to the first instruction (@code+4).
I uploaded the code tonight because Ale needed a kernel to test against; normally I would have waited until I had a better demo
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com - a new blog about microcontrollers
Post Edited (Bill Henning) : 11/30/2007 7:00:12 AM GMT
I have to make a description of how everything fits together with this model having a look at yours to see if merging our ideas can give a better kernel
I do no have experience with old systems (from the 60s and 70s) but this looks quite alike in some ways.
ok. I read your code, I'll explain my ideas shortly. This is exciting !
I used my old convention - the one I designed when I came up with the large memory model over a year ago you might want to read that original thread as it explains my kernel.
I only took a quick peek at what you've done - will take a longer look when time permits - my philosophy is to have a VERY minimal kernel, using only $90 (142) longs of cog memory.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com - a new blog about microcontrollers