 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
m0skit0
Joined: 02 Jun 2009 Posts: 226
|
Posted: Wed Jan 20, 2010 4:50 am Post subject: Weird behaviour with SceModule struct |
|
|
I'm working on a PSP 2000 TA85v1 with 5.00 M33-4, using PSPSDK.
Here's my code:
| Code: | fileio_module = sceKernelFindModuleByName("sceIOFileManager");
[...]
sceIoWrite(fd, &(fileio_module->text_addr), sizeof(u32)); |
I check the value written in the file, and found it is 0x8805EFC0. But psplink, on the same run, gives me this:
| Code: | ms0:/> modinfo 0x00943901
UID: 0x00943901 Attr: 0007 - Name: sceIOFileManager
Entry: 0x880540F8 - GP: 0x8805EFC0 - TextAddr: 0x88050800 |
So text_addr is 0x88050800 (which is the correct value), not 0x8805EFC0, which is in fact the GP. But if I change my code to
| Code: | | sceIoWrite(fd, &(fileio_module->text_size), sizeof(u32)); |
Now in fact I'm writing the text_addr struct member. So obviously there's a 4 byte shift missing there.
Any clues why is this happening? _________________
| The Incredible Bill Gates wrote: | | The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers. |
|
|
| Back to top |
|
 |
Davee
Joined: 22 Jun 2009 Posts: 59
|
Posted: Thu Jan 21, 2010 2:42 am Post subject: |
|
|
SceModule structure has always been incorrect.
| Code: | typedef struct
{
SceModule * next; //0, 0x00
u16 attribute; //4, 0x04
u8 version[2]; //6, 0x06
char modname[27]; //8, 0x08
char terminal; //35, 0x23
u16 status; //36, 0x24 (AND 0x100 ? (usermodule) | (kernelmodule))
u16 padding; //38, 0x26
u32 unk_28; //40, 0x28
SceUID modid; //44, 0x2C
SceUID usermod_thid; //48, 0x30
SceUID memid; //52, 0x34
SceUID mpidtext; //56, 0x38
SceUID mpiddata; //60, 0x3C
void * ent_top; //64, 0x40
u32 ent_size; //68, 0x44
void * stub_top; //72, 0x48
u32 stub_size; //76, 0x4C
int (* module_start)(SceSize, void *); //80, 0x50
int (* module_stop)(SceSize, void *); //84, 0x54
int (* module_bootstart)(SceSize, void *); //88, 0x58
int (* module_reboot_before)(SceSize, void *); //92, 0x5C
int (* module_reboot_phase)(SceSize, void *); //96, 0x60
u32 entry_addr; //100, 0x64(seems to be repeated)
u32 gp_value; //104, 0x68
u32 text_addr; //108, 0x6C
u32 text_size; //112, 0x70
u32 data_size; //116, 0x74
u32 bss_size; //120, 0x78
u8 nsegment; //124, 0x7C
u8 padding[3]; //125, 0x7D
u32 segmentaddr[4]; //128, 0x80
u32 segmentsize[4]; //144, 0x90
int module_start_thread_priority; //160, 0xA0
SceSize module_start_thread_stacksize; //164, 0xA4
SceUInt module_start_thread_attr; //168, 0xA8
int module_stop_thread_priority; //172, 0xAC
SceSize module_stop_thread_stacksize; //176, 0xB0
SceUInt module_stop_thread_attr; //180, 0xB4
int module_reboot_before_thread_priority; //184, 0xB8
SceSize module_reboot_before_thread_stacksize; //188, 0xBC
SceUInt module_reboot_before_thread_attr; //192, 0xC0
} SceModule; |
Thats the one I reversed from 1.50. It's changed a little recently adding new things, but thats the most upto date version. |
|
| Back to top |
|
 |
Coldbird

Joined: 08 Feb 2007 Posts: 155
|
Posted: Thu Jan 28, 2010 7:13 am Post subject: |
|
|
SDK submit - nao! _________________ Been gone for some time. Now I'm back. Someone mind getting me up-2-date? |
|
| 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
|