{"id":633,"date":"2010-11-23T10:32:58","date_gmt":"2010-11-23T00:32:58","guid":{"rendered":"http:\/\/brnz.org\/hbr\/?p=633"},"modified":"2010-11-23T10:32:58","modified_gmt":"2010-11-23T00:32:58","slug":"assembly-primer-part-2-memory-organisation-spu","status":"publish","type":"post","link":"https:\/\/brnz.org\/hbr\/?p=633","title":{"rendered":"Assembly Primer Part 2 &#8212; Memory Organisation &#8212; SPU"},"content":{"rendered":"<p>These are my notes for where I can see SPU varying from ia32, as presented in the video\u00a0<a href=\"http:\/\/www.securitytube.net\/Assembly-Primer-for-Hackers-%28Part-2%29-Virtual-Memory-Organization-video.aspx\">Part 2 &#8212; Virtual Memory Organization<\/a>.<\/p>\n<p>(I didn&#8217;t notice see any significant differences between the presented information for ia32 and PPC &#8212; apart from what was noted from the first presentation &#8212; so there&#8217;s no separate post for that arch).<\/p>\n<p>To compile <a href=\"http:\/\/code.securitytube.net\/SimpleDemo.c\">SimpleDemo.c<\/a> to examine on the SPU, you&#8217;ll need to add the -mstdmain option to spu-gcc (or spu-elf-gcc) so that the program will correctly receive the command line options.<\/p>\n<p>If you examine the \/proc\/$PID\/maps file when running a standalone SPU program, you&#8217;ll see something like this:<\/p>\n<pre>00100000-00120000 r-xp 00000000 00:00 0       [vdso]\r\n0fd70000-0fd90000 r-xp 00000000 fe:02 1590608 \/lib\/libgcc_s.so.1\r\n0fd90000-0fda0000 rw-p 00010000 fe:02 1590608 \/lib\/libgcc_s.so.1\r\n0fdb0000-0fdd0000 r-xp 00000000 fe:02 292441  \/lib\/libpthread-2.11.2.so\r\n0fdd0000-0fde0000 rw-p 00010000 fe:02 292441  \/lib\/libpthread-2.11.2.so\r\n0fdf0000-0fe00000 r-xp 00000000 fe:02 292418  \/lib\/librt-2.11.2.so\r\n0fe00000-0fe10000 rw-p 00000000 fe:02 292418  \/lib\/librt-2.11.2.so\r\n0fe20000-0ff90000 r-xp 00000000 fe:02 292437  \/lib\/libc-2.11.2.so\r\n0ff90000-0ffa0000 rw-p 00160000 fe:02 292437  \/lib\/libc-2.11.2.so\r\n0ffa0000-0ffb0000 rw-p 00000000 00:00 0\r\n0ffc0000-0ffe0000 r-xp 00000000 fe:02 1590211 \/usr\/lib\/libspe2.so.2.2.80\r\n0ffe0000-0fff0000 rw-p 00010000 fe:02 1590211 \/usr\/lib\/libspe2.so.2.2.80\r\n10000000-10010000 r-xp 00000000 fe:02 1821445 \/usr\/bin\/elfspe\r\n10010000-10020000 rw-p 00000000 fe:02 1821445 \/usr\/bin\/elfspe\r\n10020000-10050000 rwxp 00000000 00:00 0       [heap]\r\nf7f60000-f7f70000 rw-p 00000000 00:00 0\r\nf7f70000-f7fb0000 rw-s 00000000 00:13 9086\r\n                                       \/spu\/spethread-2971-268566640\/mem\r\nf7fb0000-f7fc0000 rw-p 00000000 fe:02 1463963\r\n                     \/home\/jonathan\/AssemblyLanguagePrimer\/SimpleDemoSPU\r\nf7fc0000-f7fe0000 r-xp 00000000 fe:02 292430  \/lib\/ld-2.11.2.so\r\nf7fe0000-f7ff0000 rw-p 00020000 fe:02 292430  \/lib\/ld-2.11.2.so\r\nffea0000-ffff0000 rw-p 00000000 00:00 0       [stack]<\/pre>\n<p>This is the information for the elfspe loader for the SPU program.<\/p>\n<p>(The SPU&#8217;s local store is mapped into elfspe&#8217;s address space at 0xf7f7000. \u00a0This is with randomize_va_space set to zero, so it should always be in that location. This is possibly useful&#8230;)<\/p>\n<p>There is no equivalent of this for the SPU program itself as there is no virtual memory mapping required (or possible) within the local store. \u00a0The state of the SPU&#8217;s memory state may be examined externally through the spufs interface provided (in this case, the file \/spu\/spethread-2971-268566640\/mem from the above listing may be used to access the current SPU LS state). Or, of course, using gdb.<\/p>\n<h3>Previous assembly primer notes&#8230;<\/h3>\n<p>Part 1 &#8212; System Organization &#8212; <a href=\"https:\/\/brnz.org\/hbr\/?p=631\">PPC<\/a> &#8212; <a href=\"https:\/\/brnz.org\/hbr\/?p=632\">SPU<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>These are my notes for where I can see SPU varying from ia32, as presented in the video\u00a0Part 2 &#8212; Virtual Memory Organization. (I didn&#8217;t notice see any significant differences between the presented information for ia32 and PPC &#8212; apart from what was noted from the first presentation &#8212; so there&#8217;s no separate post for &hellip; <a href=\"https:\/\/brnz.org\/hbr\/?p=633\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Assembly Primer Part 2 &#8212; Memory Organisation &#8212; SPU&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,26],"tags":[38,40],"_links":{"self":[{"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=\/wp\/v2\/posts\/633"}],"collection":[{"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=633"}],"version-history":[{"count":13,"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=\/wp\/v2\/posts\/633\/revisions"}],"predecessor-version":[{"id":673,"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=\/wp\/v2\/posts\/633\/revisions\/673"}],"wp:attachment":[{"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}