 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
LEROY
Joined: 07 May 2006 Posts: 2
|
Posted: Thu May 10, 2007 6:31 am Post subject: Bug in psploadcore.h ? |
|
|
Hi everyboady.
I'm just wondering is there is a (small) bug in psploadcore.h / sceModule definition.
Here is an extract of my code
| Code: |
SceUID ids[512];
memset(ids, 0, 512 * sizeof(SceUID));
result = sceKernelGetModuleIdList(ids, 512 * sizeof(SceUID), &count);
if(result < 0) return result;
for(p = 0; p < count; p++)
{
SceModule* mod = sceKernelFindModuleByUID(ids[p]);
if(mod)
{
pspDebugScreenSetTextColor(0x000000FF);
fdprintf(log_fd, "sceModule #%3d , @ %p, %s\n", p, mod, mod->modname);
pspDebugScreenSetTextColor(0x0000FF00);
fdprintf(log_fd, "\tnext : %p\n", mod->next);
fdprintf(log_fd, "\tattribute : %04X\n", mod->attribute);
fdprintf(log_fd, "\tversion %02X/%02X\n", mod->version[0], mod->version[1]);
fdprintf(log_fd, "\tmodname : %s\n", mod->modname);
fdprintf(log_fd, "\tterminal %2X\n", mod->terminal);
fdprintf(log_fd, "\tmodid : %#010X\n", mod->modid);
fdprintf(log_fd, "\tent_top : %p\n", mod->ent_top);
fdprintf(log_fd, "\tent_size : %d\n", mod->ent_size);
fdprintf(log_fd, "\tstub_top : %p\n", mod->stub_top);
fdprintf(log_fd, "\tstub_size : %d\n", mod->stub_size);
fdprintf(log_fd, "\tentry_addr : %#010X\n", mod->entry_addr);
fdprintf(log_fd, "\tgp_value : %#010X\n", mod->gp_value);
fdprintf(log_fd, "\ttext_addr : %#010X\n", mod->text_addr);
fdprintf(log_fd, "\ttext_size : %#010X\n", mod->text_size);
fdprintf(log_fd, "\tdata_size : %#010X\n", mod->data_size);
fdprintf(log_fd, "\tbss_size : %#010X\n", mod->bss_size);
fdprintf(log_fd, "\tnsegment : %#010X\n", mod->nsegment);
...
|
And here is the result
sceModule # 0 , @ 88011794, sceSystemMemoryManager
next : 8801169c
attribute : 1007
version 02/01
modname : sceSystemMemoryManager
terminal 0
modid : 0X0022EF33
ent_top : 8800d474
ent_size : 112
stub_top : 8800d4ec
stub_size : 0
entry_addr : 0XFFFFFFFF
gp_value : 0X8800B6A8
text_addr : 0X88017860
text_size : 0X88000000
data_size : 0X0000F338
bss_size : 0X0000052C
nsegment : 0X000005A8
segmentaddr[0] : 0X00000002
segmentsize[0] : 0000000000
segmentaddr[1] : 0X88000000
segmentsize[1] : 0X0000F340
segmentaddr[2] : 0X8800F340
segmentsize[2] : 0X0000052C
segmentaddr[3] : 0000000000
segmentsize[3] : 0000000000
segmentaddr[4] : 0000000000
segmentsize[4] : 0000000000
Rather strange, isn't it ? Looks like there is a 4 bytes shift somewhere. Looking at sceModule definition in psploadcore.h
| Code: |
/** Describes a module. This structure could change in future firmware revisions. */
typedef struct SceModule {
struct SceModule *next;
unsigned short attribute;
unsigned char version[2];
char modname[27];
char terminal;
unsigned int unknown1;
unsigned int unknown2;
SceUID modid;
unsigned int unknown3[4];
void * ent_top;
unsigned int ent_size;
void * stub_top;
unsigned int stub_size;
unsigned int unknown4[4];
unsigned int entry_addr;
unsigned int gp_value;
unsigned int text_addr;
unsigned int text_size;
unsigned int data_size;
unsigned int bss_size;
unsigned int nsegment;
unsigned int segmentaddr[4];
unsigned int segmentsize[4];
} SceModule;
|
If I change unsigned int unknown4[4] to unknown4[5], I get a definitely better result.
sceModule # 0 , @ 88011794, sceSystemMemoryManager
next : 8801169c
attribute : 1007
version 02/01
modname : sceSystemMemoryManager
terminal 0
modid : 0X0022EF33
ent_top : 8800d474
ent_size : 112
stub_top : 8800d4ec
stub_size : 0
entry_addr : 0X8800B6A8
gp_value : 0X88017860
text_addr : 0X88000000
text_size : 0X0000F338
data_size : 0X0000052C
bss_size : 0X000005A8
nsegment : 0X00000002
segmentaddr[0] : 0X88000000
segmentsize[0] : 0X0000F340
segmentaddr[1] : 0X8800F340
segmentsize[1] : 0X0000052C
Sounds like something is wrong in psploadcore or am I missing something ?
Thanks
LEROY |
|
| Back to top |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Thu May 10, 2007 3:55 pm Post subject: |
|
|
Yes, you are missing the | Code: | | This structure could change in future firmware revisions. | comment. :) What firmware are you using? See SceKernelThreadKInfo for an example of adding firmware-dependent fields. |
|
| Back to top |
|
 |
LEROY
Joined: 07 May 2006 Posts: 2
|
Posted: Thu May 10, 2007 4:26 pm Post subject: |
|
|
| jimparis wrote: | Yes, you are missing the | Code: | | This structure could change in future firmware revisions. | comment. :) What firmware are you using? See SceKernelThreadKInfo for an example of adding firmware-dependent fields. |
You're right, I just missed that part :P
I'm on 1.5.
Thanks for the advice. I'll check SceKernelThreadKInfo.
LEROY |
|
| Back to top |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Fri May 11, 2007 1:27 am Post subject: |
|
|
If you're on 1.5, it might just be a bug in the header.
Anyone else come across this before? |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Sat May 12, 2007 7:14 am Post subject: |
|
|
That header was actually determined in the 1.0 era and has not changed since. Normally it isn't a good idea to use it other than to map names/addresses etc to a UID (as the modid field doesn't seem to have ever moved in location). You can then use the UID to determine the information you want through the published API.
As with alot of the internal kernel structures they are there because at some point someone worked out the structure, it is questionable whether it is really important to track them in every firmware version as even with the FW versioning in the SDK you are still limited by the fact that once it is built it is static. |
|
| Back to top |
|
 |
|
|
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
|