gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Dynamic Loadble Plugins

#163711 - hacker013 - Thu Oct 09, 2008 5:15 pm

hey everybody,

I've a question? Is there a way to make dynamic loadble plugins for a nds file, don't mention moonshell pluginsystem or the one from dso because the one from dso don't exists anymore and the moonshell site is offline. Has anybody an idea how to do this?
_________________
Website / Blog

Let the nds be with you.

#163718 - Maxxie - Thu Oct 09, 2008 6:16 pm

The easiest way to implement such should be overlays. There is even overlay support build into the NDS File structure.

http://en.wikipedia.org/wiki/Overlay_(programming) Hmm the forum does not like () in URIs.
_________________
Trying to bring more detail into understanding the wireless hardware

#163720 - hacker013 - Thu Oct 09, 2008 7:06 pm

Maxxie wrote:
The easiest way to implement such should be overlays. There is even overlay support build into the NDS File structure.

http://en.wikipedia.org/wiki/Overlay_(programming) Hmm the forum does not like () in URIs.


This is like DLDI but then in realtime?
_________________
Website / Blog

Let the nds be with you.

#163724 - silent_code - Thu Oct 09, 2008 7:48 pm

No. Although it is in realtime, but it has to be compiled together with the binary, just like regular source code.
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.

#163726 - hacker013 - Thu Oct 09, 2008 8:01 pm

i'm looking more like something that can be loaded from fat and have some functions i can call like plugin_start, plugin_run, plugin_end. And that i can pass some arguments.
_________________
Website / Blog

Let the nds be with you.

#163727 - Maxxie - Thu Oct 09, 2008 8:04 pm

silent_code wrote:
No. Although it is in realtime, but it has to be compiled together with the binary, just like regular source code.


This is not a general requirement. By some implementations of overlay it is but not by the actual principle.

The difference to dldi is beside the time of "loading" an overlay is fix in it's address. That makes it easy to load as you do not have to care about relocation. (which the dldi patcher does)
_________________
Trying to bring more detail into understanding the wireless hardware

#163729 - silent_code - Thu Oct 09, 2008 9:32 pm

I thought we were talking about the NDS' overlay support. Otherwise, you're right. ;^)
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.

#163736 - tepples - Fri Oct 10, 2008 2:15 am

If you are going to be loading overlays dynamically, then it's likely that they will be written by third parties, and they aren't all going to want to have to relink whenever the base address changes from version to version of your application. So -fPIC is your friend because you don't have to make sure that the overlay stays at the same address.

Or you could just require that all overlays be written in Lua.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#163745 - hacker013 - Fri Oct 10, 2008 5:56 am

tepples wrote:
If you are going to be loading overlays dynamically, then it's likely that they will be written by third parties, and they aren't all going to want to have to relink whenever the base address changes from version to version of your application. So -fPIC is your friend because you don't have to make sure that the overlay stays at the same address.

Or you could just require that all overlays be written in Lua.

Can you explane that a little more?
_________________
Website / Blog

Let the nds be with you.

#163750 - tepples - Fri Oct 10, 2008 11:34 am

Explain which a little bit more? Position-independent code (-fPIC), or writing plug-ins in Lua?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#163756 - hacker013 - Fri Oct 10, 2008 3:07 pm

both
_________________
Website / Blog

Let the nds be with you.

#163764 - silent_code - Fri Oct 10, 2008 7:09 pm

I think in this case, Wikipedia is your friend. :^)
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.

#163772 - tepples - Fri Oct 10, 2008 8:32 pm

Position-independent code (PIC) relies on specifying addresses within a program as offsets relative to the program counter (PC-relative addressing). DLDI uses it because the DS has no MMU, and Mac OS Classic used it for the same reason.

MS-DOS handled its lack of an MMU the other way, storing a relocation table at the beginning of each executable. The program loader used this table to rewrite all references to addresses within the program. This is a lot more complicated for the OS to handle than PIC, but it can be efficient on architectures such as x86 that don't have a lot of PC-relative instructions. In this case, your program would stay a .elf file, and your OS would have a .elf loader.

Lua is a scripting language. So are BASIC, JavaScript, and Python. They get relocated whenever they are loaded into RAM as bytecode.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#163783 - chishm - Sat Oct 11, 2008 7:39 am

tepples wrote:
Position-independent code (PIC) relies on specifying addresses within a program as offsets relative to the program counter (PC-relative addressing). DLDI uses it because the DS has no MMU, and Mac OS Classic used it for the same reason.

DLDI also needs to do some fix-ups of addresses, since some drivers are linked to code not compiled with -fPIC (libnds), and GCC produces a GOT (global offset table) when linking.
_________________
http://chishm.drunkencoders.com
http://dldi.drunkencoders.com

#163918 - elhobbs - Wed Oct 15, 2008 2:38 am

I brazenly reused most of the code from the dlditool source code as well as the dldi template and created a fairly simple interface for loading a dldi clone library that I called DSLI (DS Library Interface). It is not a fully featured interface but it is functional. right now the code just uses malloc to allocate memory to load the code, though I am sure it could be easily modifed to support a custom allocator. the dsli file only exports three functions startup,shutdown,and getaddress. the first two are self explanatory. the getaddress function takes one parameter and can be used to return data from the library(function pointers etc.) - sort of like getprocaddress in windows.

I am not sure how to proceed with the license bit since the code is mostly from the dlditool source code. Do I need to get chishm's permission before I share it with anyone? right now the main loader file still has the license text from dlditool. does that need to stay in place?

#164046 - chishm - Sun Oct 19, 2008 11:38 am

elhobbs wrote:
I am not sure how to proceed with the license bit since the code is mostly from the dlditool source code. Do I need to get chishm's permission before I share it with anyone? right now the main loader file still has the license text from dlditool. does that need to stay in place?

The DLDI patcher is licensed under the GPL v2, as specified in the license text. You are free to modify and distribute it as long as all derivative works are also licensed under GPL v2 or later, and you make available the source code for anything you release (if you don't release anything, you don't need to release source).

The DLDI template is released under a more permissive license which doesn't require the distribution of derivative source code.
_________________
http://chishm.drunkencoders.com
http://dldi.drunkencoders.com

#164057 - hacker013 - Sun Oct 19, 2008 8:27 pm

elhobbs wrote:
I brazenly reused most of the code from the dlditool source code as well as the dldi template and created a fairly simple interface for loading a dldi clone library that I called DSLI (DS Library Interface). It is not a fully featured interface but it is functional. right now the code just uses malloc to allocate memory to load the code, though I am sure it could be easily modifed to support a custom allocator. the dsli file only exports three functions startup,shutdown,and getaddress. the first two are self explanatory. the getaddress function takes one parameter and can be used to return data from the library(function pointers etc.) - sort of like getprocaddress in windows.

I am not sure how to proceed with the license bit since the code is mostly from the dlditool source code. Do I need to get chishm's permission before I share it with anyone? right now the main loader file still has the license text from dlditool. does that need to stay in place?


Can you release it??
_________________
Website / Blog

Let the nds be with you.

#164283 - elhobbs - Sun Oct 26, 2008 1:01 am

here is the proof of concept code
http://rapidshare.com/files/157557695/dsli.zip.html

unlike the dlditool this is not a standalone program that runs on an nds file. this code loads a library file at runtime. as such the loader code needs to be compiled into a project. since it is based on dlditool the code also falls under the gnu 2 license.

there are two projects:
dsli - a sample library
dsli_test - sample program that loads the sample library

the intent is for the the dsli library to implement the getaddress function to return either a function pointer or data based on the parameter passed.

there is not a lot of error detection code in place so beware. also, since the code is relocated at runtime it can be a little tricky trying to debug the library ;)

#166179 - hacker013 - Sun Feb 01, 2009 3:09 pm

can i use this with out releasing all my source? that i only release the source where i use dsli?
_________________
Website / Blog

Let the nds be with you.

#166182 - kusma - Sun Feb 01, 2009 3:47 pm

hacker013 wrote:
can i use this with out releasing all my source? that i only release the source where i use dsli?

No. It falls under the GPL2 license, and it requires you to give full modification-rights to your users.

#166194 - elhobbs - Sun Feb 01, 2009 7:20 pm

I do not believe that the code you put in your "dsli library" needs to be released. It is based on dldi which has a more permissive license as chism put it - see earlier in this post.

the source code in the main nds does fall under GPL v2 since it is based on the dlditool source code.

I wrote this before chism exposed dldiLoadFromFile in libfat, or at least before it was released in the latest libnds update. I think you may be able to use that instead.

#166201 - kusma - Sun Feb 01, 2009 9:10 pm

elhobbs wrote:
I do not believe that the code you put in your "dsli library" needs to be released. It is based on dldi which has a more permissive license as chism put it - see earlier in this post.

This is not the case. GPL does not differentiate between static or dynamic linkage, and it does not care which "way" you link. GPL code and code released under an GPL-incompatible license cannot be linked together without violating the GPL-license.

#166208 - elhobbs - Sun Feb 01, 2009 11:10 pm

kusma wrote:
elhobbs wrote:
I do not believe that the code you put in your "dsli library" needs to be released. It is based on dldi which has a more permissive license as chism put it - see earlier in this post.

This is not the case. GPL does not differentiate between static or dynamic linkage, and it does not care which "way" you link. GPL code and code released under an GPL-incompatible license cannot be linked together without violating the GPL-license.
so, am I misinterpreting chishm's response? or, is he incorrect when he says:
chishm wrote:
The DLDI template is released under a more permissive license which doesn't require the distribution of derivative source code.
so, how would this be different than a windows program that links to kernel32.dll? or an open source plugin for visual studio? that does not sound correct to me...

#166210 - kusma - Mon Feb 02, 2009 1:39 am

elhobbs wrote:
so, am I misinterpreting chishm's response? or, is he incorrect when he says:
chishm wrote:
The DLDI template is released under a more permissive license which doesn't require the distribution of derivative source code.
so, how would this be different than a windows program that links to kernel32.dll? or an open source plugin for visual studio? that does not sound correct to me...

Here's what FSF has to say on the matter. GPL has an exception for system libraries, to make it possible to produce hosted binaries on non-free operating systems. The exact wording of this in GPL2 is this:
Quote:
However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

I hope this answers your questions.
edit: changed one of the link to an answer that is even clearer.


Last edited by kusma on Mon Feb 02, 2009 2:17 am; edited 1 time in total

#166211 - elhobbs - Mon Feb 02, 2009 2:11 am

so, in that light I guess you would be better off using dldiLoadFromFile from libnds. even though it is from dlditool, but I guess chishm can do what ever he likes with his own code ;)

then again you could just release the code... since the stuff you are writing would not be possible unless other people had released their code...but, obviously, do as you see fit.

kusma, thanks for the info.

#166877 - hacker013 - Sat Feb 21, 2009 7:57 pm

wth, why don't work the staments like if, for anymore and also += and -= don't work anymore?
_________________
Website / Blog

Let the nds be with you.

#166903 - elhobbs - Mon Feb 23, 2009 8:39 pm

hacker013 wrote:
wth, why don't work the staments like if, for anymore and also += and -= don't work anymore?
I have no idea what you are trying to say. Are you asking a question?

#166904 - hacker013 - Mon Feb 23, 2009 9:02 pm

yes,

Why don't work the statments like:
if
for
while

and things like:
+=
-=
++
--

anymore?
_________________
Website / Blog

Let the nds be with you.

#166905 - elhobbs - Mon Feb 23, 2009 9:16 pm

where are you trying to use them? they work just fine for me in C/C++ source files. Are your source files failing to compile? If so, do you have any error messages that you can share?

#166931 - hacker013 - Tue Feb 24, 2009 10:29 am

My errorlog when I wanna compile my source to a .dsli file.

Quote:
E:\UZProject\UZEngine\splashscreen>make
linking splashscreen.elf
iointerface.o: In function `DrawDownLogo':
e:/UZProject/UZEngine/splashscreen/source/iointerface.c:60: undefined reference
to `__aeabi_dcmplt'
iointerface.o: In function `showSplashScreens':
e:/UZProject/UZEngine/splashscreen/source/iointerface.c:98: undefined reference
to `__aeabi_dcmple'
e:/UZProject/UZEngine/splashscreen/source/iointerface.c:100: undefined reference
to `__aeabi_dadd'
e:/UZProject/UZEngine/splashscreen/source/iointerface.c:110: undefined reference
to `__aeabi_dsub'
e:/UZProject/UZEngine/splashscreen/source/iointerface.c:110: undefined reference
to `__aeabi_dcmpgt'
collect2: ld returned 1 exit status
make[1]: *** [/e/UZProject/UZEngine/splashscreen/splashscreen.elf] Error 1
make: *** [build] Error 2

_________________
Website / Blog

Let the nds be with you.

#166937 - elhobbs - Tue Feb 24, 2009 2:36 pm

hacker013 wrote:
My errorlog when I wanna compile my source to a .dsli file.

Quote:
E:\UZProject\UZEngine\splashscreen>make
linking splashscreen.elf
iointerface.o: In function `DrawDownLogo':
e:/UZProject/UZEngine/splashscreen/source/iointerface.c:60: undefined reference
to `__aeabi_dcmplt'
iointerface.o: In function `showSplashScreens':
e:/UZProject/UZEngine/splashscreen/source/iointerface.c:98: undefined reference
to `__aeabi_dcmple'
e:/UZProject/UZEngine/splashscreen/source/iointerface.c:100: undefined reference
to `__aeabi_dadd'
e:/UZProject/UZEngine/splashscreen/source/iointerface.c:110: undefined reference
to `__aeabi_dsub'
e:/UZProject/UZEngine/splashscreen/source/iointerface.c:110: undefined reference
to `__aeabi_dcmpgt'
collect2: ld returned 1 exit status
make[1]: *** [/e/UZProject/UZEngine/splashscreen/splashscreen.elf] Error 1
make: *** [build] Error 2
I am not quite certain how you got
Quote:
wth, why don't work the staments like if, for anymore and also += and -= don't work anymore?
from these error messages. these error messages indicate that you are using floating point calculations in your code. you are better off not doing this on the ds. all floating point code is emulated and very slow. these error messages are linking errors. the linker is looking to for the emulated floating point functions that are provided by libgcc.

#166939 - hacker013 - Tue Feb 24, 2009 3:30 pm

I don't use any floating points i you don't beleave me please look at the my code below:

Code:

/*

 This file was modified by Eric Hobbs

   iointerface.c template
   
 This file is a derivative work of the dldi template.
 Copyright (c) 2006 Michael "Chishm" Chisholm
   
 Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met:

  1. All derivative works must be clearly marked as such. Derivatives of this file
    must have the author of the derivative indicated within the source. 
  2. The name of the author may not be used to endorse or promote products derived
     from this software without specific prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/


// When compiling for NDS, make sure NDS is defined
#ifndef NDS
 #if defined ARM9 || defined ARM7
  #define NDS
 #endif
#endif

#ifdef NDS
 #include <nds/jtypes.h>
#else
 #include "gba_types.h"
#endif
//#include <stdio.h>
#include "dsli.h"

//#include <nds.h>

DSLI dsli;

double alpha = 0;
   
NE_Material * MaterialGameLogo;
NE_Material * MaterialNDSLogo;

void DrawTopLogo(){
dsli.NE_2DViewInit();
dsli.NE_2DDrawTexturedQuadAlpha(0,0,256,192,1,MaterialGameLogo,alpha,1);
}
void DrawDownLogo(){
dsli.NE_2DViewInit();
if(alpha<31)
{
   dsli.NE_2DDrawTexturedQuadAlpha(0,0,256,192,1,MaterialNDSLogo,alpha,1);
} else {
   /* Draw BG */
   dsli.NE_2DDrawQuad(0,0,256,192,1,NE_Black);
   /* Draw Credits */
   dsli.NE_TextPrint(0,1,0,NE_White,"Maintainer: Hedzer Oosterwal");
   dsli.NE_TextPrint(0,1,1,NE_White,"Modeller: Thomas");
   dsli.NE_TextPrint(0,1,3,NE_White,"Credits: ");
   dsli.NE_TextPrint(0,1,4,NE_White," - libfat / DLDI (Chism)");
   dsli.NE_TextPrint(0,1,5,NE_White," - Libpicture (DragonMinded)");
   dsli.NE_TextPrint(0,1,6,NE_White," - LibINI (DragonMinded)");
   dsli.NE_TextPrint(0,1,7,NE_White," - Wav Streamer (DiscoStew)");
   dsli.NE_TextPrint(0,1,8,NE_White," - Nitro Engine (AntonioND)");
   dsli.NE_TextPrint(0,1,9,NE_White," - DevkitARM (WinterMute)");
   dsli.NE_TextPrint(0,1,10,NE_White," - LibNDS (Dovoto)");
}
}

/*int strcmp(const char *s1, const char *s2)
{
  int ret = 0;
  while (!(ret = *(unsigned char *) s1 - *(unsigned char *) s2) && *s2) ++s1, ++s2;

  if (ret < 0)
    ret = -1;
  else if (ret > 0)
    ret = 1 ;

  return ret;
}*/

void showSplashScreens()
{
   while(1)
   {
      scanKeys();
      if(alpha<=31)
      {
         alpha+=0.5;
      }
      if(keysHeld() & KEY_TOUCH)
      {
         break;
      }
      dsli.NE_ProcessDual(DrawTopLogo,DrawDownLogo);
      dsli.NE_WaitForVBL(NE_UPDATE_NORMAL);
   }
   // -- Fade them out
   for(alpha=31;alpha>0;alpha-=0.5)
   {
      dsli.NE_ProcessDual(DrawTopLogo,DrawDownLogo);
      dsli.NE_WaitForVBL(NE_UPDATE_NORMAL);
   }
}

/*-----------------------------------------------------------------
startUp
Initialize the interface, geting it into an idle, ready state
returns true if successful, otherwise returns false
-----------------------------------------------------------------*/
bool startup(void * addr) {
   //dsli.iprintf("startup(%x)...",addr);
   //glInit();
   MaterialGameLogo = dsli.NE_MaterialCreate();
   MaterialNDSLogo = dsli.NE_MaterialCreate();
   //PaletteNDSLogo = dsli.NE_PaletteCreate();
   dsli.NE_FATMaterialTexLoadBMPtoRGBA(MaterialGameLogo, "/urazelda/logo.bmp",0);
   dsli.NE_FATMaterialTexLoadBMPtoRGBA/*256*/(MaterialNDSLogo/*, PaletteNDSLogo*/, "/urazelda/ndslogo.bmp", 0);
   return false;
}



/*-----------------------------------------------------------------
readSectors
Read "numSectors" 512-byte sized sectors from the card into "buffer",
starting at "sector".
The buffer may be unaligned, and the driver must deal with this correctly.
return true if it was successful, false if it failed for any reason
-----------------------------------------------------------------*/
u32 getaddress (char *name) {
   return (u32)showSplashScreens;
}



/*-----------------------------------------------------------------
shutdown
shutdown the card, performing any needed cleanup operations
Don't expect this function to be called before power off,
it is merely for disabling the card.
return true if the card is no longer active
-----------------------------------------------------------------*/
bool shutdown(void) {
   //dsli.iprintf("shutdown()...");
   dsli.NE_MaterialDelete(MaterialGameLogo);
   dsli.NE_MaterialDelete(MaterialNDSLogo);
   //dsli.NE_PaletteDelete(PaletteNDSLogo);
   return false;
}

_________________
Website / Blog

Let the nds be with you.

#166940 - kusma - Tue Feb 24, 2009 3:48 pm

hacker013 wrote:
I don't use any floating points


hacker013 wrote:

double alpha = 0;
[...]
alpha+=0.5;
[...]
for(alpha=31;alpha>0;alpha-=0.5)

#166941 - elwing - Tue Feb 24, 2009 3:49 pm

if(alpha<=31)
{
alpha+=0.5;
}

that really look like float in my opinion... and there's also a += there...


edit: doh, too slow....

#166942 - elhobbs - Tue Feb 24, 2009 3:52 pm

Code:
double alpha = 0;

and
Code:
if(alpha<31)

and
Code:

      if(alpha<=31)
      {
         alpha+=0.5;
      }

and
Code:
   // -- Fade them out
   for(alpha=31;alpha>0;alpha-=0.5)
   {
      dsli.NE_ProcessDual(DrawTopLogo,DrawDownLogo);
      dsli.NE_WaitForVBL(NE_UPDATE_NORMAL);
   }

"double" and "float" are both floating point numbers. "double" is a double precision floating point number."float" is 32 bit and "double" is 64bit (or maybe 80bit, I do not remember - you could look it up though). also, the compiler is asking for these functions which it uses for floating point operations - it does not ask for them unless it needs them. although it is not the case here - they could have been unresolved references from another library that you are using.

EDIT: even slower

#166943 - kusma - Tue Feb 24, 2009 3:54 pm

I'd just like to add that I object to the "never use floating point numbers on the DS"-argument. Just don't use them in performance-critical code. Using it for fades, as you seem to do here is perfectly fine. But you'll have to link to libgcc.

#166944 - hacker013 - Tue Feb 24, 2009 3:55 pm

srry, i didn't know that doubles also were floats.
_________________
Website / Blog

Let the nds be with you.

#166945 - elhobbs - Tue Feb 24, 2009 4:17 pm

kusma wrote:
I'd just like to add that I object to the "never use floating point numbers on the DS"-argument. Just don't use them in performance-critical code. Using it for fades, as you seem to do here is perfectly fine. But you'll have to link to libgcc.
yeah, I was being a little bit of a hypocrite on that one... I use them in my code. still, being comfortable using fixed point values on the ds is not going to hurt - except for maybe if you quit because you can not figure out how to use them!

#166949 - kusma - Tue Feb 24, 2009 5:15 pm

elhobbs wrote:
still, being comfortable using fixed point values on the ds is not going to hurt - except for maybe if you quit because you can not figure out how to use them!

Sure, but they ARE more error-prone, and a potential source of obscure bugs.

Anyway, I don't think this thread is the right one to have a float vs fixed "war", and I hope hacker013's problem has been solved ;)

#166986 - hacker013 - Wed Feb 25, 2009 2:45 pm

when I use a function define via the dlsi structure and it allocated memory it is trying to do it inside the memory from the dsli file :( so it can't be bigger then 32kb - dsli file size. Whey it doesn't allocated it inside the main memeory?
_________________
Website / Blog

Let the nds be with you.

#166988 - elhobbs - Wed Feb 25, 2009 4:34 pm

hacker013 wrote:
when I use a function define via the dlsi structure and it allocated memory it is trying to do it inside the memory from the dsli file :( so it can't be bigger then 32kb - dsli file size. Whey it doesn't allocated it inside the main memeory?
you are confusing two separate issues. the memory region in the dsli.ld linker script is currently limited to 32k (it was just a proof of concept after all). you can change it by modifying the dsli.ld file from
Code:
   ddmem   : ORIGIN = 0xBF800000, LENGTH = 32K      

to
Code:
   ddmem   : ORIGIN = 0xBF800000, LENGTH = 1M      
this will allow 1MB of code and static data in the dsli file. the function that is imported into the dsli library, which can be referenced as dsli.malloc, in fact does allocate from main memory.

#167096 - elhobbs - Sat Feb 28, 2009 11:52 pm

the dsli library has a serious flaw - it does not allocate memory for the bss section. it does zero out the space where it should be. obviously this could stomp on existing data and the bss region will fall into a memory range that can be used by future mallocs.

#167504 - hacker013 - Sun Mar 15, 2009 9:21 am

Maybe you can update this profe of concept?
_________________
Website / Blog

Let the nds be with you.

#167675 - Emmanuel - Sat Mar 21, 2009 9:35 pm

hacker013 wrote:
Maybe you can update this profe of concept?

And re-upload it... rapidshare erased it...

#167688 - hacker013 - Sun Mar 22, 2009 11:54 am

Here is a mirror:
DLSI Download Mirror
_________________
Website / Blog

Let the nds be with you.

#167695 - Emmanuel - Sun Mar 22, 2009 1:11 pm

hacker013 wrote:
Here is a mirror:
DLSI Download Mirror

Thanks, I'll try this out soon...

#170382 - hacker013 - Sun Sep 20, 2009 7:02 pm

@Elhobbs

Iknow this is a old topic but one little question:

Can you use this dsli thingy for the arm7 or has the pachter/fixer to be rewrited for the offsets for one the arm7 ?

Gr Hacker013
_________________
Website / Blog

Let the nds be with you.

#170403 - elhobbs - Mon Sep 21, 2009 6:00 pm

the relocation code should not need to be changed. but, the file system code is rather tied to the arm9. so, in theory you could have a custom fifo handler on the arm9 that can read the file into memory (main memory) and pass it back to the arm7 which would then need to allocate memory(arm7 memory) copy the code there. then relocate it to this new location.

as a starting point for you:
DSLI_Load is a helper function that reads a file and allocates memory (the version I released does not allocate the correct amount of memory it does not make room for the bss section - you need to read the header). the DSLI_Rebase function assumes that the code has been moved to the desired location and then relocates so that it will, or should hopefully ;) , run correctly from there.

if this is really something you want to do... that is a different question.

#170407 - hacker013 - Mon Sep 21, 2009 8:13 pm

Can you explain me de header because if I see dldi_header.s im confused >.<. And where is bss for O_o ? And why can't a dsli size be bigger then 32kb, because the offset is then messed up if the file is bigger then 32kb? Do you know any way to calculated the new offset if the dsli file is bigger then 32kb ?
_________________
Website / Blog

Let the nds be with you.