{"id":59,"date":"2010-07-20T15:01:29","date_gmt":"2010-07-20T15:01:29","guid":{"rendered":"https:\/\/blogs.scummvm.org\/toneman\/?p=59"},"modified":"2022-05-21T21:58:58","modified_gmt":"2022-05-21T21:58:58","slug":"good-news-for-the-ds-port","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/toneman\/2010\/07\/20\/good-news-for-the-ds-port\/","title":{"rendered":"Good News for the DS port"},"content":{"rendered":"<p>Last week, I restructured the DS loader to use a SeekableReadStream for file reading. Once that was in place and working, I restructured the PS2 loader to use a SeekableReadStream as well and tested it (this needed to be done anyway and it helped me ensure there was nothing inherently wrong with the way I was using SeekableReadStream in the DS loader).<\/p>\n<p>I then had problems reading the symbol table in successfully. After some wasted time :P, I realized it was just a silly mistake. I had neglected to initialize\u00a0<span class=\"Apple-style-span\">_symtab_sect<\/span>\u00a0to anything in dsloader.h and the value of uninitialized ints is undefined in C++. Thus, the loader was detecting, from the value that _symtab_sect had, that the symbol table was already read in when it wasn&#8217;t.<\/p>\n<p>At this point the loader was getting to the point where I had to deal with the relocations. I used consolePrintfs to make sure that the relocation types the loader was detecting were the same as the ones detected by arm-eabi-objdump (they were). I then began coding for these relocations. After a day of work on the relocations with no success as far as getting games to run with dynamic plugins enabled on the DS, I decided to disable the thumb-interworking on the ds temporarily so I could work on getting the DS with plugins in a runnable state without having to deal with the complication of thumb instructions\/relocations.<\/p>\n<p>I worked further on the relocations yesterday; I started dumping the instructions to be relocated and immediately noticed a MAJOR problem. Every instruction was 0x00000000! The addresses of the instructions seemed reasonable, though, so I suspected it had something to do with how the plugins were being built and not how I was retrieving target addresses. I dumped Mapfiles with &#8220;-Map&#8221; during plugin linking and discovered that whole input sections were being discarded, among other problems. After switching out the linker script for a modified version of the default &#8220;arm-eabi-ld&#8221; linker script, these problems seemed to be fixed, perhaps because the modified linker script I was using (based on the script used by the main executable) used the MEMORY command to map out different blocks of memory but I was trying to force the start address of the &#8220;.text&#8221; section to be 0. I am not sure whether switching out this linker script will cause problems.<\/p>\n<p>I then did a fair bit of reading on the ARM instruction set and continued tweaking\/testing the relocation code. Things still weren&#8217;t working like they should have. Yotam suggested comparing completely unrelocated code and semi-relocated code to see what ld was already doing for me, and through a few dumps, I realized I was trying to do A LOT that ld already did redundantly and thus messing up things that were already fixed! After removing this redundant code, I got Beneath a Steel Sky to run successfully with Dynamic Plugins enabled on the DS!<\/p>\n<p>My next order of business, then, is to test the rest of the engines (some of which have relocation types I still haven&#8217;t dealt with). Then, I&#8217;ll reintegrate the thumb-interworking and deal with any major complications that brings (if any :D).<\/p>\n<p>~Tony<\/p>\n<p>Also, I plan to update my wiki schedule shortly:\u00a0<a href=\"http:\/\/wiki.scummvm.org\/index.php\/User:Toneman\">http:\/\/wiki.scummvm.org\/index.php\/User:Toneman<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week, I restructured the DS loader to use a SeekableReadStream for file reading. Once that was in place and working, I restructured the PS2 loader to use a SeekableReadStream as well and tested it (this needed to be done anyway and it helped me ensure there was nothing inherently wrong with the way I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-59","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/posts\/59","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/comments?post=59"}],"version-history":[{"count":1,"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/posts\/59\/revisions"}],"predecessor-version":[{"id":60,"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/posts\/59\/revisions\/60"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/media?parent=59"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/categories?post=59"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/tags?post=59"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}