📄 resourcelock.cod
字号:
|??_C@_0DF@CCLAEEHA@RM_AcquireLock?$CI?$CFu?0x?$CF08x?0?$CFu?$CJ?5owne@| DCB "R"
DCB "M_AcquireLock(%u,x%08x,%u) owner=x%08x, count=>%u", 0xd, 0xa
DCB 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0DK@JIPOKLCL@RM_AcquireLock?$CI?$CFu?0x?$CF08x?0?$CFu?$CJ?3?5Una@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0DK@JIPOKLCL@RM_AcquireLock?$CI?$CFu?0x?$CF08x?0?$CFu?$CJ?3?5Una@| DCB "R"
DCB "M_AcquireLock(%u,x%08x,%u): Unable to default threadid", 0xd
DCB 0xa, 0x0 ; `string'
; Function compile flags: /Ogsy
00000 AREA |.text| { |RM_AcquireLock| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |RM_AcquireLock| PROC
; 217 : {
00000 |$L1542|
00000 e92d41f0 stmdb sp!, {r4 - r8, lr}
00004 e24dd00c sub sp, sp, #0xC
00008 |$M1540|
00008 e1a08002 mov r8, r2
0000c e1a05001 mov r5, r1
00010 e1a07000 mov r7, r0
; 218 : int LockIndex;
; 219 : LOCK_STRUCT_T *plock;
; 220 : RM_STATUS_T ret = RM_STATUS_SUCCESS;
; 221 :
; 222 : DBGMSG(("RM_AcquireLock(%u,x%08x,%u)\r\n", ResourceID, threadid, timeout_in_ms));
; 223 : LockIndex = RID2Index(ResourceID);
00014 e2573001 subs r3, r7, #1
; 224 : if ((LockIndex < 0) || (LockIndex >= DIMENSION(LockDB)))
00018 4a000056 bmi |$L1361|
0001c e353005d cmp r3, #0x5D
00020 2a000054 bcs |$L1361|
; 229 : }
; 230 : plock = &(LockDB[LockIndex]);
00024 e59f218c ldr r2, [pc, #0x18C]
00028 e0833083 add r3, r3, r3, lsl #1
; 231 : if (!service_initialized)
0002c e592e45c ldr lr, [r2, #0x45C]
00030 e0826103 add r6, r2, r3, lsl #2
00034 e35e0000 cmp lr, #0
; 232 : {
; 233 : DBGMSG(("RM_AcquireLock(%u,x%08x,%u): Implicit Service Initialization\r\n",
; 234 : ResourceID, threadid, timeout_in_ms));
; 235 : RM_InitService();
00038 03a03001 moveq r3, #1
0003c 0582345c streq r3, [r2, #0x45C]
; 236 : }
; 237 : DBGMSG(("RM_AcquireLock: Lock[%u]@x%08x: rid=%u, lock=x%08x, owner=x%08x, count=%u\r\n",
; 238 : LockIndex, &LockDB[LockIndex], ResourceID, LockDB[LockIndex].lock, LockDB[LockIndex].owner, LockDB[LockIndex].owner_count));
; 239 :
; 240 : if (threadid == 0)
00040 e3550000 cmp r5, #0
00044 1a000009 bne |$L1370|
; 241 : {
; 242 : RM_THREADID_T tid;
; 243 : tid = OSDS_GetCurrentThreadID();
00048 eb000000 bl OSDS_GetCurrentThreadID
0004c e3500000 cmp r0, #0
; 244 : if (tid == 0)
00050 1a000005 bne |$L1367|
; 245 : {
; 246 : LOGMSG(("RM_AcquireLock(%u,x%08x,%u): Unable to default threadid\r\n", ResourceID, threadid, timeout_in_ms));
00054 e59f0158 ldr r0, [pc, #0x158]
00058 e1a03008 mov r3, r8
0005c e3a02000 mov r2, #0
00060 e1a01007 mov r1, r7
00064 eb000000 bl xllp_LogMessage
; 247 : ret = (RM_STATUS_ERROR);
; 248 : goto AcquireLock_end;
00068 ea000036 b |$L1538|
0006c |$L1367|
; 249 : }
; 250 : else
; 251 : {
; 252 : DBGMSG(("RM_AcquireLock(%u,x%08x,%u): threadid=>x%08x\r\n", ResourceID, threadid, timeout_in_ms, tid));
; 253 : threadid = tid;
0006c e1a05000 mov r5, r0
00070 |$L1370|
; 254 : }
; 255 : }
; 256 : if (plock->lock == (RM_LOCK_HANDLE_T)0)
00070 e5963000 ldr r3, [r6]
00074 e3530000 cmp r3, #0
00078 1a000008 bne |$L1374|
; 257 : {
; 258 : // not initialized
; 259 : ret = RM_InitLock(ResourceID, threadid, timeout_in_ms); // also aquires the lock is init successful
0007c e1a02008 mov r2, r8
00080 e1a01005 mov r1, r5
00084 e1a00007 mov r0, r7
00088 eb000000 bl RM_InitLock
0008c e1b04000 movs r4, r0
; 260 : // Init will usually return with the lock owned by the current thread.
; 261 : // The only reasons it won't is if collision occurs during Init or an error occurred.
; 262 : if (ret != RM_STATUS_SUCCESS)
00090 1a00002d bne |$AcquireLock_end$1369|
; 263 : goto AcquireLock_end;
; 264 : if (plock->owner == threadid)
00094 e5963004 ldr r3, [r6, #4]
00098 e1530005 cmp r3, r5
0009c 0a00003b beq |$L1354|
000a0 |$L1374|
; 265 : {
; 266 : DBGMSG(("RM_AcquireLock(%u,x%08x,%u): Locked by Init - owner=x%08x, count=%u\r\n",
; 267 : (int)ResourceID, threadid, timeout_in_ms, plock->owner, plock->owner_count));
; 268 : goto AcquireLock_end;
; 269 : }
; 270 : }
; 271 :
; 272 : if (plock->owner == threadid)
000a0 e5963004 ldr r3, [r6, #4]
000a4 e1530005 cmp r3, r5
000a8 1a00000d bne |$L1375|
; 273 : {
; 274 : plock->owner_count++;
000ac e5962008 ldr r2, [r6, #8]
; 275 : LOGMSG(("RM_AcquireLock(%u,x%08x,%u) owner=x%08x, count=>%u\r\n",
; 276 : (int)ResourceID, threadid, timeout_in_ms, plock->owner, plock->owner_count));
000b0 e59f00f8 ldr r0, [pc, #0xF8]
000b4 e1a03008 mov r3, r8
000b8 e2822001 add r2, r2, #1
000bc e5862008 str r2, [r6, #8]
000c0 e5964008 ldr r4, [r6, #8]
000c4 e596e004 ldr lr, [r6, #4]
000c8 e1a02005 mov r2, r5
000cc e1a01007 mov r1, r7
000d0 e58de000 str lr, [sp]
000d4 e58d4004 str r4, [sp, #4]
000d8 eb000000 bl xllp_LogMessage
; 277 : ret = (RM_STATUS_SUCCESS);
000dc e3a04000 mov r4, #0
; 278 : goto AcquireLock_end;
000e0 ea00002a b |$L1354|
000e4 |$L1375|
; 279 : }
; 280 :
; 281 : ret = OSDS_AcquireLock(plock->lock, timeout_in_ms);
000e4 e5960000 ldr r0, [r6]
000e8 e1a01008 mov r1, r8
000ec eb000000 bl OSDS_AcquireLock
000f0 e1b0e000 movs lr, r0
; 282 : if (ret == OSDS_STATUS_SUCCESS)
; 283 : {
; 284 : plock->owner = threadid;
; 285 : plock->owner_count = 1;
000f4 03a03001 moveq r3, #1
000f8 05865004 streq r5, [r6, #4]
000fc 05863008 streq r3, [r6, #8]
00100 03a04000 moveq r4, #0
00104 0a000021 beq |$L1354|
; 286 : DBGMSG(("RM_AcquireLock(%u,x%08x,%u): Lock acquired\r\n",
; 287 : ResourceID, threadid, timeout_in_ms));
; 288 : ret = RM_STATUS_SUCCESS;
; 289 : }
; 290 : else
; 291 : if (ret == OSDS_STATUS_TIMEOUT)
; 292 : {
; 293 : LOGMSG(("RM_AcquireLock(%u,x%08x,%u): TIMEOUT acquiring x%08x\r\n",
; 294 : ResourceID, threadid, timeout_in_ms, plock->lock));
00108 e5962000 ldr r2, [r6]
0010c e35e0001 cmp lr, #1
00110 e1a03008 mov r3, r8
00114 e1a01007 mov r1, r7
00118 1a000005 bne |$L1380|
0011c e59f0088 ldr r0, [pc, #0x88]
00120 e58d2000 str r2, [sp]
00124 e1a02005 mov r2, r5
00128 eb000000 bl xllp_LogMessage
; 295 : ret = RM_STATUS_TIMEOUT;
0012c e3a04001 mov r4, #1
; 296 : }
; 297 : else
00130 ea000005 b |$AcquireLock_end$1369|
00134 |$L1380|
; 298 : {
; 299 : LOGMSG(("RM_AcquireLock(%u,x%08x,%u): ERROR x%08x acquiring x%08x\r\n",
; 300 : ResourceID, threadid, timeout_in_ms, ret, plock->lock));
00134 e59f006c ldr r0, [pc, #0x6C]
00138 e58d2004 str r2, [sp, #4]
0013c e1a02005 mov r2, r5
00140 e58de000 str lr, [sp]
00144 eb000000 bl xllp_LogMessage
00148 |$L1538|
; 301 : ret = RM_STATUS_ERROR;
00148 e3a04004 mov r4, #4
0014c |$AcquireLock_end$1369|
; 302 : }
; 303 : //--------------
; 304 : AcquireLock_end:
; 305 : //--------------
; 306 : if (ret != RM_STATUS_SUCCESS)
; 307 : LOGMSG(("RM_AcquireLock(%u,x%08x,%u) returning x%08x (FAIL) owner=x%08x, count=%u\r\n",
; 308 : ResourceID, threadid, timeout_in_ms, ret, plock->owner, plock->owner_count));
0014c e596e008 ldr lr, [r6, #8]
00150 e5962004 ldr r2, [r6, #4]
00154 e59f0048 ldr r0, [pc, #0x48]
00158 e1a03008 mov r3, r8
0015c e58d2004 str r2, [sp, #4]
00160 e1a02005 mov r2, r5
00164 e1a01007 mov r1, r7
00168 e58de008 str lr, [sp, #8]
0016c e58d4000 str r4, [sp]
00170 eb000000 bl xllp_LogMessage
; 309 : else
; 310 : DBGMSG(("RM_AcquireLock(%u,x%08x,%u) returning x%08x (success) owner=x%08x, count=%u\r\n",
; 311 : ResourceID, threadid, timeout_in_ms, ret, plock->owner, plock->owner_count));
; 312 : return(ret);
00174 ea000005 b |$L1354|
00178 |$L1361|
; 225 : {
; 226 : LOGMSG(("RM_AcquireLock(%u,x%08x,%u): ResourceID invalid\r\n",
; 227 : (int)ResourceID, threadid, timeout_in_ms));
00178 e59f0020 ldr r0, [pc, #0x20]
0017c e1a03008 mov r3, r8
00180 e1a02005 mov r2, r5
00184 e1a01007 mov r1, r7
00188 eb000000 bl xllp_LogMessage
; 228 : return(RM_STATUS_INVALID_ARGUMENT);
0018c e3a04003 mov r4, #3
00190 |$L1354|
; 309 : else
; 310 : DBGMSG(("RM_AcquireLock(%u,x%08x,%u) returning x%08x (success) owner=x%08x, count=%u\r\n",
; 311 : ResourceID, threadid, timeout_in_ms, ret, plock->owner, plock->owner_count));
; 312 : return(ret);
00190 e1a00004 mov r0, r4
; 313 : } // RM_AcquireLock
00194 e28dd00c add sp, sp, #0xC
00198 e8bd41f0 ldmia sp!, {r4 - r8, lr}
0019c e12fff1e bx lr
001a0 |$L1545|
001a0 00000000 DCD |??_C@_0DC@PKHJPFLI@RM_AcquireLock?$CI?$CFu?0x?$CF08x?0?$CFu?$CJ?3?5Res@|
001a4 00000000 DCD |??_C@_0EL@JPPLNKFL@RM_AcquireLock?$CI?$CFu?0x?$CF08x?0?$CFu?$CJ?5retu@|
001a8 00000000 DCD |??_C@_0DL@LEBBLINE@RM_AcquireLock?$CI?$CFu?0x?$CF08x?0?$CFu?$CJ?3?5ERR@|
001ac 00000000 DCD |??_C@_0DH@BCEOFBJ@RM_AcquireLock?$CI?$CFu?0x?$CF08x?0?$CFu?$CJ?3?5TIM@|
001b0 00000000 DCD |??_C@_0DF@CCLAEEHA@RM_AcquireLock?$CI?$CFu?0x?$CF08x?0?$CFu?$CJ?5owne@|
001b4 00000000 DCD |??_C@_0DK@JIPOKLCL@RM_AcquireLock?$CI?$CFu?0x?$CF08x?0?$CFu?$CJ?3?5Una@|
001b8 00000000 DCD |LockDB|
001bc |$M1541|
ENDP ; |RM_AcquireLock|
EXPORT |RM_ReleaseLock|
EXPORT |??_C@_0CP@NGBKNBFM@RM_ReleaseLock?$CI?$CFu?0x?$CF08x?$CJ?3?5Resour@| [ DATA ] ; `string'
EXPORT |??_C@_0DH@COMHCCMO@RM_ReleaseLock?$CI?$CFu?0x?$CF08x?$CJ?3?5Unable@| [ DATA ] ; `string'
EXPORT |??_C@_0DA@JBMNCEMD@RM_ReleaseLock?$CI?$CFu?0x?$CF08x?$CJ?3?5lock?5h@| [ DATA ] ; `string'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -