lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Technically you could add this code to buildvm_ppc.dasc as
> ->vm_sync_ppc and call it (with a proper declaration in lj_vm.h)
> as lj_vm_sync_ppc() from inside lj_mcode_sync(). Use 'r0' instead of '0' in dcbst and icbi.

Awesome, that worked; thank you for such good direction! I had to use srw.
instead of srwi. And I switched the bdnz branch to use the < and > symbols, but that's about it other than what you mentioned.  Here is the function I
added below, in case it will help anyone else in the future that searches
the list.

|//-----------------------------------------------------------------------
|//-- Miscellaneous functions --------------------------------------------
|//-----------------------------------------------------------------------
|
|->vm_sync_ppc:
| mr r11,r3
| li r7,32
| addi r5,r7,-1
| andc r6,r3,r5	// round low to line bdy
| subf r8,r6,r4	// compute length
| add r8,r8,r5	// ensure we get enough
| li r9,5
| srw. r8,r8,r9	// compute line count
| crclr 4*cr0+so
| beqlr			// nothing to do?
| mtctr r8
|1: 	
| dcbst r0,r6
| add r6,r6,r7
| bdnz <1
| sync
| // Now invalidate the instruction cache
| li r7,32
| addi r5,r7,-1
| andc r6,r11,r5     // round low to line bdy
| subf r8,r6,r4      // compute length
| add r8,r8,r5
| li r9,5
| srw. r8,r8,r9      // compute line count
| crclr 4*cr0+so
| beqlr              // nothing to do?
| mtctr r8
| 2: 
| icbi r0,r6
| add r6,r6,r7
| bdnz <2
| isync
| li r3,0
| blr

~Jeff