X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=savezelda.git;a=blobdiff_plain;f=lego%2Fexploit.s;fp=lego%2Fexploit.s;h=acc423c74fef8e5220ca486d12f8a66eea9a9cfd;hp=0000000000000000000000000000000000000000;hb=e1ede7aa2cb1840add9ba88901c7495deb2b37e3;hpb=15edfaae0fe106910d059e91f8cb4f691cc50da4;ds=sidebyside diff --git a/lego/exploit.s b/lego/exploit.s new file mode 100644 index 0000000..acc423c --- /dev/null +++ b/lego/exploit.s @@ -0,0 +1,31 @@ +# Copyright 2008-2009 Segher Boessenkool +# This code is licensed to you under the terms of the GNU GPL, version 2; +# see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt + + .section .start,"ax" + +start: + # Set up a stack frame. + lis 1,0x8080 ; li 0,0 ; stwu 0,-64(1) + + # Stop audio and video. + lis 0,audio_stop@h ; ori 0,0,audio_stop@l ; mtctr 0 ; bctrl + lis 0,video_stop@h ; ori 0,0,video_stop@l ; mtctr 0 ; bctrl + + # Move code into place; a generous 32kB, starting at 64kB in + # the save file. + + lis 3,main@h ; ori 3,3,main@l ; addi 5,3,-4 + lis 4,0x806c ; lwz 4,0xdc48-0x10000(4) ; addi 4,4,-4 + addis 4,4,1 ; addi 4,4,end-start + li 0,0x2000 ; mtctr 0 +0: lwzu 0,4(4) ; stwu 0,4(5) ; bdnz 0b + + # Sync caches on it. + li 0,0x0400 ; mtctr 0 ; mr 5,3 +0: dcbst 0,5 ; sync ; icbi 0,5 ; addi 5,5,0x20 ; bdnz 0b + sync ; isync + + # Go for it! + mtctr 3 ; bctr +end: