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 

USBGDB Patch for Slim Memory

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> Patch Submissions
View previous topic :: View next topic  
Author Message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Mon Feb 16, 2009 4:08 am    Post subject: USBGDB Patch for Slim Memory Reply with quote

I can't be arsed to find my password these days and don't even have a toolchain installed on this machine so someone else can commit this fix for psplinkusb/usbgdb/main.c which dynamically modifies its memory ranges if you are on a slim with large memory support.

Code:
--- main.c   (revision 2452)
+++ main.c   (working copy)
@@ -34,12 +34,15 @@
 DebugEventHandler g_handler;
 struct GdbContext g_context;
 SceUID g_thid = -1;
+unsigned int userbase = 0x08800000;
+unsigned int usertop =  0x0A000000;
 
 int initialise(SceSize args, void *argp)
 {
    int len;
    int fd;
    Elf32_Ehdr hdr;
+   PspSysmemPartitionInfo info;
 
    memset(&g_context, 0, sizeof(g_context));
    if(argp == NULL)
@@ -58,6 +61,14 @@
    g_context.argp = argp;
    g_context.args = args;
 
+   memset(&info, 0, sizeof(info));
+   info.size = sizeof(info);
+   if(sceKernelQueryMemoryPartitionInfo(2, &info) == 0)
+   {
+      userbase = info.startaddr;
+      usertop = info.startaddr + info.memsize;
+   }
+
    fd = sceIoOpen((char*) argp, PSP_O_RDONLY, 0777);
    if(fd < 0)
    {
@@ -125,7 +136,7 @@
    nibble = addr >> 28;
    addr &= 0x0FFFFFFF;
 
-   if((addr >= 0x08800000) && (addr < 0x0A000000))
+   if((addr >= userbase) && (addr < usertop))
    {
       if((nibble == 0) || (nibble == 4) || (nibble == 8) || (nibble == 10))
       {
@@ -160,7 +171,7 @@
    nibble = addr >> 28;
    addr &= 0x0FFFFFFF;
 
-   if((addr >= 0x08800000) && (addr < 0x0A000000))
+   if((addr >= userbase) && (addr < usertop))
    {
       if((nibble == 0) || (nibble == 4) || (nibble == 8) || (nibble == 10))
       {
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Thu Feb 26, 2009 4:33 pm    Post subject: Reply with quote

Code:
Sending        usbgdb/main.c
Transmitting file data .
Committed revision 2453.

although I had to patch by hand, so no promises!
Back to top
View user's profile Send private message
hnaves



Joined: 03 Feb 2009
Posts: 30

PostPosted: Sat Feb 28, 2009 6:10 am    Post subject: Reply with quote

You forgot to include

Code:
#include <pspsysmem_kernel.h>
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Wed Mar 04, 2009 8:01 am    Post subject: Reply with quote

Fixed in rev 2455, thanks
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Wed Mar 04, 2009 3:50 pm    Post subject: Reply with quote

Ooops, my bad obviously :)
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 -> Patch Submissions 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