On Fri, Aug 21, 2015 at 5:12 PM, tim Rowledge tim@rowledge.org wrote:
On 21-08-2015, at 4:58 PM, Chris Cunningham cunningham.cb@gmail.com wrote:
Yes. I had loaded the VMMaker to look at the ARM jit code (I'm working
on an ARM simulator - fun project),
Do tell...
A colleague ran across http://gedrap.github.io/xs-vm/ and coded it in his language, and challenged me to do it in Squeak as well. So I did. And was then inspired to take it further and visualize what was going in the CPU while it was happening.
The ASM isn't really finished, nor is the viewer, but it will handle a variety of aSM code listings I've seen for learning ARM ASM. What I have now parses the code into objects, and will then simulate running the code, and showing the 'state' of the CPU while running, like: [image: Inline image 1] It's not really ready to announce yet, but if you are interested, it is at: MCHttpRepository location: 'http://www.smalltalkhub.com/mc/cbc/ARMAssembler/main' user: '' password: '' load both XS-ArmAsmVm and Armvm viewer.
Use: vm := XSVM new. "GCD via Euclid" vm assemble: ' MOV R0, #40 ; R0 is a MOV R1, #25 ; R1 is b again CMP R0, R1 SUBGT R0, R0, R1 SUBLT R1, R1, R0 BNE again halt SWI #0'
vm view. vm prepForStep. vm step. "once for each instruction step, or vm run to just run until end"
My current struggle is to remember (or re-learn) how registers handle carry and overflow, and how to get Squeak to simulate that. It's a little challenging with just Integers.
-cbc
Oh my, that is quite lovely.
For workings of ARM you could worse than look at the original basic book by my old colleague Pete Cockerell (http://www.peter-cockerell.net/aalp/) and then maybe if you’re very brave, the interior of the gdb ARM simulator. We have a massively hacked up copy at http://www.squeakvm.org/cgi-bin/viewvc.cgi/squeak/branches/Cog/processors/AR... mostly hacked to remove extraneous other architectures - I mean, who the hell cares about MIPS any more? Let alone ns32000 or clipper or alpha.
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Cashew: nut that makes you sneeze
vm-dev@lists.squeakfoundation.org