Advertisement
GeeckoDev

sceGe_lazy_31129B95 reverse

Mar 11th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.61 KB | None | 0 0
  1. s32 sceGe_lazy_31129B95(s32 dlId, void *stall)
  2. {
  3.     s32 tmp0;
  4.     s32 tmp1;
  5.     s32 ret;
  6.  
  7.     if (dlId == g_lazy.dlId) {
  8.         g_lazy.stall = stall;
  9.  
  10.         if (stall != NULL) {
  11.             g_lazy.count++;
  12.  
  13.             if (g_lazy.count < g_lazy.max) {
  14.                 return 0;
  15.             }
  16.         }
  17.     }
  18.  
  19.     if (g_lazy.dlId < 0) {
  20.         goto loc_000001C0;
  21.     }
  22.  
  23.     do {
  24.         /* begin atomic RMW */
  25.         asm __volatile__(
  26.             "ll %0, (%1)"
  27.             : "=r" (tmp0)
  28.             : "r" (&g_lazy.dlId)
  29.         );
  30.  
  31.         tmp1 = -1;
  32.  
  33.         if (tmp0 != g_lazy.dlId) {
  34.             goto loc_000001C0;
  35.         }
  36.  
  37.         /* end atomic RMW */
  38.         /* if an atomic update as occured, %0 will be set to 1 */
  39.         asm __volatile__(
  40.             "sc %0, (%1)"
  41.             : "=r" (tmp1)
  42.             : "r" (&g_lazy.dlId)
  43.         );
  44.     } while (!tmp1);
  45.  
  46.     sub_00000208(tmp0, g_lazy.stall);
  47.  
  48. loc_000001C0:
  49.  
  50.     ret = sub_00000208(dlId, stall);
  51.  
  52.     if (ret < 0) {
  53.         return ret;
  54.     }
  55.  
  56.     do {
  57.         /* begin atomic RMW */
  58.         asm __volatile__(
  59.             "ll %0, (%1)"
  60.             : "=r" (tmp0)
  61.             : "r" (&g_lazy.dlId)
  62.         );
  63.  
  64.         tmp1 = dlId;
  65.  
  66.         if (tmp0 >= 0) {
  67.             return ret;
  68.         }
  69.  
  70.         /* end atomic RMW */
  71.         /* if an atomic update as occured, %0 will be set to 1 */
  72.         asm __volatile__(
  73.             "sc %0, (%1)"
  74.             : "=r" (tmp1)
  75.             : "r" (&g_lazy.dlId)
  76.         );
  77.     } while (!tmp1);
  78.  
  79.     g_lazy.stall = stall;
  80.     g_lazy.count = 0;
  81.    
  82.     return ret;
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement