forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Big Buffer in Kernel & Service mode

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
FaderX



Joined: 01 Mar 2008
Posts: 28

PostPosted: Sat Jun 21, 2008 3:06 pm    Post subject: Big Buffer in Kernel & Service mode Reply with quote

OK,

im trying to do some stuff with a psar and i need to load it & im having trouble with buffers in kernel mode. Every other mode works, vsh, user etc. just not kernel.


here's what im using...or tried using,

Code:

static u8 g_dataPSAR[23*1000*1000] __attribute__((aligned(64)));
static u8 g_dataOut[30*1000*1000] __attribute__((aligned(0x40)));
static u8 *g_dataOut2;


Code:

static u8 g_dataPSAR[23*1024*1024] __attribute__((aligned(64)));
static u8 *g_dataOut;[30*1024*1024] __attribute__((aligned(0x40)));
static u8 *g_dataOut2;


Code:

u8  g_dataPSAR[10*1024*1024] __attribute__((aligned(64)));
u8  g_dataOut[3*1024*1024] __attribute__((aligned(64)));
u8  g_dataOut2[3*1024*1024] __attribute__((aligned(64)));


Code:

u8  g_dataPSAR[23*1024*1024] __attribute__((aligned(64)));
u8  g_dataOut[3*1024*1024] __attribute__((aligned(64)));
u8  g_dataOut2[3*1024*1024] __attribute__((aligned(64)));


Code:

u8  g_dataPSAR[23*1024*1024] __attribute__((aligned(64)));
u8  g_dataOut[30*1024*1024] __attribute__((aligned(64)));
u8  g_dataOut2[3*1024*1024] __attribute__((aligned(64)));


Code:

static u8 g_dataPSAR[20500000] __attribute__((aligned(64)));
static u8 g_dataOut[3000000] __attribute__((aligned(0x40)));
static u8 *g_dataOut2;



then i try this,
Code:

static u8 *g_dataPSAR;
static u8 *g_dataOut;
static u8 *g_dataOut2;


and it works until it gets to the function that uses the buffs then i get i nice little crash. argh

I'm required to use kernel as well because nearly all the functs can't be put in a prx. :s

If you have any idea about what may be wrong (don't say me, don't say me) please tell me.

Once again Cheers,
FX
Back to top
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Sat Jun 21, 2008 4:31 pm    Post subject: Reply with quote

pretty insane I must say what you are doing and not shameful you are. If you PRX is loaded in a kernel partition, it wouldn't be able to fit your data size requirements : 24 MB + 30 MB ! Kernel partition can only be 8 MB at most.
Back to top
View user's profile Send private message
FaderX



Joined: 01 Mar 2008
Posts: 28

PostPosted: Sun Jun 22, 2008 2:34 pm    Post subject: Reply with quote

hlide wrote:
pretty insane I must say what you are doing and not shameful you are. If you PRX is loaded in a kernel partition, it wouldn't be able to fit your data size requirements : 24 MB + 30 MB ! Kernel partition can only be 8 MB at most.


I'm booting straight into a elf that hasn't loaded any other prx's yet and it won't work.

Should i add a PSP_HEAP_SIZE_MAX(); thing to it?? *fairly sure that won't work after what you have said*

or what do you think i should do?
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sun Jun 22, 2008 3:08 pm    Post subject: Reply with quote

The KERNEL partition is 8MB max PERIOD. All the rest of the memory is the user partition. You can't change that. The heap size only tells how much the app will take from the user partition.
Back to top
View user's profile Send private message AIM Address
FaderX



Joined: 01 Mar 2008
Posts: 28

PostPosted: Sun Jun 22, 2008 3:46 pm    Post subject: Reply with quote

J.F. wrote:
The KERNEL partition is 8MB max PERIOD. All the rest of the memory is the user partition. You can't change that. The heap size only tells how much the app will take from the user partition.


oh, now i know what you's mean,

So is there a way to use the user portion to use the buffers, like a user mode prx?
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sun Jun 22, 2008 4:23 pm    Post subject: Reply with quote

Instead of trying to embed huge arrays in your thingy, you should instead be trying to allocate the memory. There are routines for allocating memory from the various partitions... consult the docs or look at existing source.
Back to top
View user's profile Send private message AIM Address
FaderX



Joined: 01 Mar 2008
Posts: 28

PostPosted: Sun Jun 22, 2008 4:55 pm    Post subject: Reply with quote

J.F. wrote:
Instead of trying to embed huge arrays in your thingy, you should instead be trying to allocate the memory. There are routines for allocating memory from the various partitions... consult the docs or look at existing source.


Code:

void allocatmemory(void)
{
     g_dataPSAR = (u8 *)memalign(64, 20500000); //Did have 0x44 but still didn't work
     if (!g_dataPSAR) { printf("Cannot allocate memory for PSAR data.... (0x%08x)\n", (int)g_dataPSAR); }
   
     g_dataOut = (u8 *)memalign(0x40,  2000000);
     if (!g_dataOut) { printf("Cannot allocate memory for buffer 1.... (0x%08x)\n", (int)g_dataOut); } 


Thats what im trying now......crash lol :(

Is it to do with the size, idk
Back to top
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Sun Jun 22, 2008 8:53 pm    Post subject: Reply with quote

again, don't ever ask a question if you couldn't provide enough source for us to check. And please no source à la Ne0h.

1) why on earth do you need to have such big arrays ?

2) what is the source dealing with those arrays ?

3) are you creating a kernel pluggin only for slim version (because an overall of 24 MB is max on fat version !) ?
Back to top
View user's profile Send private message
jas0nuk



Joined: 27 Apr 2006
Posts: 137

PostPosted: Sun Jun 22, 2008 9:21 pm    Post subject: Reply with quote

Looks like he's wanting to extract PSARs (which can be up to 22mb), but it'd be better to stream them. :/
Back to top
View user's profile Send private message
FaderX



Joined: 01 Mar 2008
Posts: 28

PostPosted: Thu Jun 26, 2008 7:00 pm    Post subject: Reply with quote

hlide wrote:
again, don't ever ask a question if you couldn't provide enough source for us to check. And please no source à la Ne0h.

1) why on earth do you need to have such big arrays ?

2) what is the source dealing with those arrays ?

3) are you creating a kernel pluggin only for slim version (because an overall of 24 MB is max on fat version !) ?


Yes thats what im doing jas0nuk,

oh hlide how much of the src should you need

p.s. its based off RS psar dumper.


thx
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Thu Jun 26, 2008 7:21 pm    Post subject: Reply with quote

psar dumper has to be changed to allow streaming and not a full load, not just for cases like this, but also because the fat is almost running out of memory to hold lates updatest, a bit more and it will be impossible to hold it.
I was planning to do it if they changed encryption in 4.00... but they didn't.
Back to top
View user's profile Send private message
FaderX



Joined: 01 Mar 2008
Posts: 28

PostPosted: Thu Jun 26, 2008 7:38 pm    Post subject: Reply with quote

moonlight wrote:
psar dumper has to be changed to allow streaming and not a full load, not just for cases like this, but also because the fat is almost running out of memory to hold lates updatest, a bit more and it will be impossible to hold it.
I was planning to do it if they changed encryption in 4.00... but they didn't.


Ohhh, thanks man,
this is because the fat has only 32mb & the slim has 64mb isnt it? oh and arent you getting rid of the 1.50 kernel coz of space, like flash space?


Thanks. :)
Back to top
View user's profile Send private message
Hellcat



Joined: 24 Jan 2007
Posts: 84

PostPosted: Fri Jun 27, 2008 2:55 pm    Post subject: Reply with quote

FaderX wrote:
the slim has 64mb isnt it?

IIRC even on the Slim, those 64MB are split up into two partitions (apart from the other partitions, the memory is broken into), and are not "in one pice".

So, even on the Slim you can't do a malloc() of 60MB, or such thing....
Back to top
View user's profile Send private message
FaderX



Joined: 01 Mar 2008
Posts: 28

PostPosted: Fri Jun 27, 2008 4:08 pm    Post subject: Reply with quote

Hellcat wrote:

IIRC even on the Slim, those 64MB are split up into two partitions (apart from the other partitions, the memory is broken into), and are not "in one pice".

So, even on the Slim you can't do a malloc() of 60MB, or such thing....

yea, i get what you mean, thx
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Sat Jun 28, 2008 12:55 am    Post subject: Reply with quote

Hellcat wrote:
FaderX wrote:
the slim has 64mb isnt it?

IIRC even on the Slim, those 64MB are split up into two partitions (apart from the other partitions, the memory is broken into), and are not "in one pice".

So, even on the Slim you can't do a malloc() of 60MB, or such thing....


I haven't tried allocating 56MB (available user space on slim) in one go, but I HAVE been able to gradually use up the entire 56MB until there was just a few KB left, without any problems.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group