Subversion Repositories ps3ware

Rev

Rev 213 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 213 Rev 214
Line 27... Line 27...
27
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
 */
31
 */
-
 
32
#include "shared_functions.h"
-
 
33
#include <malloc.h>
-
 
34
#include <stdio.h>
32
#include "spe_loader.h"
35
#include <spu_mfcio.h>
33
-
 
-
 
36
#include <spu_intrinsics.h>
34
37
35
int main(unsigned long long speid, unsigned long long argp, unsigned long long envp)
38
int main(unsigned long long speid, unsigned long long argp, unsigned long long envp)
36
{
39
{
37
        arg_t *args = memalign(128, envp);
40
        arg_t *args =(arg_t *) memalign(128, (envp +15)&~15);
38
       
41
       
39
        dmaGetnWait(args,argp,(envp +15)&~15,1);
42
        dmaGetnWait(args,argp,(envp +15)&~15,1);
40
       
43
-
 
44
        printf("spu: Dma of args complete\n");
-
 
45
-
 
46
        printf("spu: filesize is %d\n",(int)args->fsize);
-
 
47
        printf("spu: file is located at h:%x\tl:%x\n",(unsigned int)(args->fileaddr>>32),(unsigned int)args->fileaddr);
41
       
48
-
 
49
        //args->argument=1337;
-
 
50
        printf("spu: args argument is %d\n",args->argument);
42
        ///fetch the executable code as data
51
        ///fetch the executable code as data
-
 
52
-
 
53
       
43
        char *data=(char*)memalign(128,(args->fsize +15)&~15);
54
        char *data=(char*)memalign(128,(args->fsize +15)&~15);
-
 
55
44
        dmaGetnWait(data,argp,(args->fsize +15)&~15,1);
56
        dmaGetnWait(data,args->fileaddr,(args->fsize +15)&~15,1);
-
 
57
-
 
58
        printf("spu: Dma of Data(program) complete\n");
45
       
59
       
46
        ///setting up some functions to share
60
        ///setting up some functions to share
47
        functions_t *functions;
61
        functions_t functions;
48
       
-
 
49
        functions=memalign(128,sizeof(functions_t));
-
 
50
       
62
       
51
        functions->dmaGetnWait=dmaGetnWait;
63
        functions.dmaGetnWait=dmaGetnWait;
52
       
64
       
53
        functions->printint=printint;
65
        functions.printint=printint;
-
 
66
-
 
67
        while (spu_stat_out_mbox() == 0);
-
 
68
        int result=1337;
-
 
69
        spu_write_out_mbox(result);
54
       
70
       
55
        int (*runme)(functions_t *func,arg_t *arg);
71
        int (*runme)(functions_t *func,arg_t *arg);
56
       
72
-
 
73
        printf("spu: byte 0:%1x 1:%1x 2:%1x 3:%1x\n",data[0],data[1],data[2],data[3]);
57
        runme=data;
74
        runme=(void*)data;
-
 
75
58
        printf("attemting to run spe from spe\n ");
76
        printf("spu: attemting to run spe as data from spe\n");
59
        int result=runme(functions,args);
77
        result=runme(&functions,args);
60
        printf("spe from spe completed with results %d " , result );
78
        printf("spu: spe from spe completed with results %d \n" , result );
61
       
79
       
62
        while (spu_stat_out_mbox() == 0);
80
        while (spu_stat_out_mbox() == 0);
63
       
81
       
64
        spu_write_out_mbox(result);
82
        spu_write_out_mbox(result);
65
        return result;
83
        return result;