📄 diskio.cod
字号:
; Function compile flags: /Ogsy
00000 AREA |.text| { |MMCWRITE| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 00000000 DCD |__C_specific_handler|
00004 00000000 DCD |$T37074|
00008 |MMCWRITE| PROC
; 262 : {
00008 e1a0c00d mov r12, sp
0000c e92d0001 stmdb sp!, {r0}
00010 e92d5ff0 stmdb sp!, {r4 - r12, lr}
00014 e28db028 add r11, sp, #0x28
00018 e24dd038 sub sp, sp, #0x38
0001c |$L37072|
0001c e1a09000 mov r9, r0
00020 e1a04001 mov r4, r1
; 263 :
; 264 : DWORD i;
; 265 : DWORD num_sg;
; 266 : DWORD bytes_this_int;
; 267 : DWORD bytes_this_sg;
; 268 : PSG_BUF pSg;
; 269 : PUSHORT pBuf16;
; 270 : DWORD sectno;
; 271 : DWORD endsect;
; 272 : DWORD error;
; 273 :
; 274 :
; 275 : num_sg = pSgr->sr_num_sg;
00024 e594a008 ldr r10, [r4, #8]
00028 e50ba060 str r10, [r11, #-0x60]
0002c e50ba05c str r10, [r11, #-0x5C]
; 276 : pSg = &(pSgr->sr_sglist[0]);
00030 e2842014 add r2, r4, #0x14
00034 e50b2058 str r2, [r11, #-0x58]
00038 e50b2054 str r2, [r11, #-0x54]
; 277 : bytes_this_sg = pSg->sb_len;
0003c e5921004 ldr r1, [r2, #4]
00040 e50b1050 str r1, [r11, #-0x50]
00044 e50b104c str r1, [r11, #-0x4C]
; 278 : bytes_this_int = pDisk->d_DiskInfo.di_bytes_per_sect;
; 279 : pBuf16 = (PUSHORT) MapPtrToProcess((LPVOID)pSg->sb_buf, GetCallerProcess());
00048 eb000000 bl GetCallerProcess
0004c e1a01000 mov r1, r0
00050 e51b2058 ldr r2, [r11, #-0x58]
00054 e5920000 ldr r0, [r2]
00058 eb000000 bl MapPtrToProcess
0005c e50b0048 str r0, [r11, #-0x48]
00060 e50b0044 str r0, [r11, #-0x44]
; 280 :
; 281 : sectno = pSgr->sr_start;
00064 e5947000 ldr r7, [r4]
; 282 : endsect = sectno + pSgr->sr_num_sec;
00068 e5940004 ldr r0, [r4, #4]
; 280 :
; 281 : sectno = pSgr->sr_start;
0006c e50b7040 str r7, [r11, #-0x40]
; 282 : endsect = sectno + pSgr->sr_num_sec;
00070 e0806007 add r6, r0, r7
00074 e50b603c str r6, [r11, #-0x3C]
00078 e3a0501d mov r5, #0x1D
0007c e3a08000 mov r8, #0
00080 ea000000 b |$L36746|
00084 |$L37070|
; 263 :
; 264 : DWORD i;
; 265 : DWORD num_sg;
; 266 : DWORD bytes_this_int;
; 267 : DWORD bytes_this_sg;
; 268 : PSG_BUF pSg;
; 269 : PUSHORT pBuf16;
; 270 : DWORD sectno;
; 271 : DWORD endsect;
; 272 : DWORD error;
; 273 :
; 274 :
; 275 : num_sg = pSgr->sr_num_sg;
00084 e51ba060 ldr r10, [r11, #-0x60]
00088 |$L36746|
; 283 : error = ERROR_SUCCESS;
; 284 :
; 285 :
; 286 :
; 287 :
; 288 :
; 289 : while (num_sg) {
00088 e35a0000 cmp r10, #0
0008c 0a00005b beq |$L36747|
00090 |$L37040|
; 290 :
; 291 : try {
; 292 : error = CheckMedia(pDisk);
00090 e1a00009 mov r0, r9
00094 eb000000 bl CheckMedia
00098 e1a0a000 mov r10, r0
0009c e50ba038 str r10, [r11, #-0x38]
; 293 :
; 294 : if ( error == ERROR_SUCCESS)
000a0 e35a0000 cmp r10, #0
000a4 1a000007 bne |$L37041|
; 295 :
; 296 : #if (USE_SPI || USE_SPI_EMULATION)
; 297 :
; 298 : if (spi_write(0, sectno, (UTINY *) pBuf16 , 1) == 0)
; 299 : error = ERROR_WRITE_FAULT;
; 300 :
; 301 : #else
; 302 : if (mmc_write(0, sectno, (UTINY *) pBuf16 , 1) == 0)
000a8 e3a03001 mov r3, #1
000ac e51b2048 ldr r2, [r11, #-0x48]
000b0 e1a01007 mov r1, r7
000b4 e3a00000 mov r0, #0
000b8 eb000000 bl mmc_write
000bc e3500000 cmp r0, #0
; 303 : error = ERROR_WRITE_FAULT;
000c0 01a0a005 moveq r10, r5
000c4 050ba038 streq r10, [r11, #-0x38]
000c8 |$L37041|
; 357 : bytes_this_sg = pSg->sb_len;
000c8 e51b1050 ldr r1, [r11, #-0x50]
000cc e51b2058 ldr r2, [r11, #-0x58]
000d0 ea00000d b |$L37042|
000d4 |$L37037|
; 308 : error = ERROR_WRITE_FAULT;
000d4 e3a0501d mov r5, #0x1D
000d8 e1a0a005 mov r10, r5
000dc e3a08000 mov r8, #0
000e0 e59b9000 ldr r9, [r11]
000e4 e51b005c ldr r0, [r11, #-0x5C]
000e8 e50b0060 str r0, [r11, #-0x60]
000ec e51b2054 ldr r2, [r11, #-0x54]
000f0 e50b2058 str r2, [r11, #-0x58]
000f4 e51b104c ldr r1, [r11, #-0x4C]
000f8 e50b1050 str r1, [r11, #-0x50]
000fc e51b0044 ldr r0, [r11, #-0x44]
00100 e50b0048 str r0, [r11, #-0x48]
00104 e51b7040 ldr r7, [r11, #-0x40]
00108 e51b603c ldr r6, [r11, #-0x3C]
0010c |$L37042|
; 309 : }
; 310 : if (error != ERROR_SUCCESS) {
0010c e35a0000 cmp r10, #0
; 311 : return GetDiskStateError(pDisk->d_DiskCardState);
00110 1599001c ldrne r0, [r9, #0x1C]
; 309 : }
; 310 : if (error != ERROR_SUCCESS) {
00114 1a00002f bne |$L37071|
; 312 : }
; 313 :
; 314 : sectno++;
00118 e2877001 add r7, r7, #1
0011c e50b7040 str r7, [r11, #-0x40]
; 315 : bytes_this_int = pDisk->d_DiskInfo.di_bytes_per_sect;
00120 e5994024 ldr r4, [r9, #0x24]
00124 |$aw_continue_sector$36754|
; 316 :
; 317 : aw_continue_sector:
; 318 : i = (bytes_this_sg < bytes_this_int) ? bytes_this_sg : bytes_this_int;
00124 e1510004 cmp r1, r4
00128 e1a00001 mov r0, r1
0012c 21a00004 movcs r0, r4
; 319 : bytes_this_sg -= i;
00130 e0411000 sub r1, r1, r0
00134 e50b1050 str r1, [r11, #-0x50]
00138 e50b104c str r1, [r11, #-0x4C]
; 320 : bytes_this_int -= i;
0013c e0444000 sub r4, r4, r0
00140 e50b4034 str r4, [r11, #-0x34]
00144 |$L37047|
; 321 :
; 322 : try {
; 323 : i = (i+1) / 2;
00144 e2800001 add r0, r0, #1
00148 e1a010a0 mov r1, r0, lsr #1
0014c e50b1030 str r1, [r11, #-0x30]
; 324 :
; 325 : if (i >= 256) i -=256;
00150 e3510c01 cmp r1, #1, 24
00154 22410c01 subcs r0, r1, #1, 24
00158 250b0030 strcs r0, [r11, #-0x30]
; 326 : else
; 327 : i=0;
0015c 350b8030 strcc r8, [r11, #-0x30]
; 328 :
; 329 : pBuf16 += 256;
00160 e51b0048 ldr r0, [r11, #-0x48]
00164 e2800c02 add r0, r0, #2, 24
00168 e50b0048 str r0, [r11, #-0x48]
0016c e50b0044 str r0, [r11, #-0x44]
00170 |$L37048|
; 333 : error = GetDiskStateError(pDisk->d_DiskCardState);
00170 e51b1050 ldr r1, [r11, #-0x50]
00174 ea000010 b |$L37049|
00178 |$L37044|
00178 e59b9000 ldr r9, [r11]
0017c e599001c ldr r0, [r9, #0x1C]
00180 eb000000 bl GetDiskStateError
00184 e1a0a000 mov r10, r0
00188 e3a0501d mov r5, #0x1D
0018c e3a08000 mov r8, #0
00190 e51b005c ldr r0, [r11, #-0x5C]
00194 e50b0060 str r0, [r11, #-0x60]
00198 e51b2054 ldr r2, [r11, #-0x54]
0019c e50b2058 str r2, [r11, #-0x58]
001a0 e51b104c ldr r1, [r11, #-0x4C]
001a4 e50b1050 str r1, [r11, #-0x50]
001a8 e51b4034 ldr r4, [r11, #-0x34]
001ac e51b0044 ldr r0, [r11, #-0x44]
001b0 e50b0048 str r0, [r11, #-0x48]
001b4 e51b7040 ldr r7, [r11, #-0x40]
001b8 e51b603c ldr r6, [r11, #-0x3C]
001bc |$L37049|
; 334 : }
; 335 : if (error != ERROR_SUCCESS) {
001bc e35a0000 cmp r10, #0
; 336 : return error;
001c0 1a000020 bne |$L36733|
; 337 : }
; 338 :
; 339 : if (bytes_this_int == 0) {
001c4 e3540000 cmp r4, #0
001c8 1a000007 bne |$L36762|
; 340 : if (pDisk->d_DiskCardState != STATE_OPENED) {
001cc e599001c ldr r0, [r9, #0x1C]
001d0 e3500003 cmp r0, #3
001d4 0a000002 beq |$L36761|
001d8 |$L37071|
; 341 : return GetDiskStateError(pDisk->d_DiskCardState);
001d8 eb000000 bl GetDiskStateError
001dc e1a0a000 mov r10, r0
001e0 ea000018 b |$L36733|
001e4 |$L36761|
; 342 : }
; 343 : if (sectno < endsect) {
001e4 e1570006 cmp r7, r6
001e8 3affffa5 bcc |$L37070|
001ec |$L36762|
; 344 : continue;
; 345 : }
; 346 : }
; 347 :
; 348 :
; 349 :
; 350 :
; 351 : num_sg--;
001ec e51b0060 ldr r0, [r11, #-0x60]
001f0 e2500001 subs r0, r0, #1
001f4 e50b0060 str r0, [r11, #-0x60]
001f8 e50b005c str r0, [r11, #-0x5C]
; 352 : if (num_sg == 0) {
001fc 1a000001 bne |$L36763|
00200 |$L36747|
; 362 :
; 363 : return 0;
00200 e1a0a008 mov r10, r8
00204 ea00000f b |$L36733|
00208 |$L36763|
; 353 : break;
; 354 : }
; 355 : pSg++;
; 356 : pBuf16 = (PUSHORT) MapPtrToProcess((LPVOID)pSg->sb_buf, GetCallerProcess());
00208 eb000000 bl GetCallerProcess
0020c e1a01000 mov r1, r0
00210 e51b2058 ldr r2, [r11, #-0x58]
00214 e5b20008 ldr r0, [r2, #8]!
00218 e50b2058 str r2, [r11, #-0x58]
0021c e50b2054 str r2, [r11, #-0x54]
00220 eb000000 bl MapPtrToProcess
00224 e50b0048 str r0, [r11, #-0x48]
00228 e50b0044 str r0, [r11, #-0x44]
; 357 : bytes_this_sg = pSg->sb_len;
0022c e51b2058 ldr r2, [r11, #-0x58]
00230 e5921004 ldr r1, [r2, #4]
00234 e50b1050 str r1, [r11, #-0x50]
00238 e50b104c str r1, [r11, #-0x4C]
; 358 : if (bytes_this_int) {
0023c e3540000 cmp r4, #0
00240 1affffb7 bne |$aw_continue_sector$36754|
; 359 : goto aw_continue_sector;
; 360 : }
; 361 : }
00244 eaffff8e b |$L37070|
00248 |$L36733|
; 311 : return GetDiskStateError(pDisk->d_DiskCardState);
00248 e1a0000a mov r0, r10
; 364 : }
0024c e91baff0 ldmdb r11, {r4 - r11, sp, pc}
ENDP ; |MMCWRITE|
00250 |$L37046|
00250 |$L37073|
00250 |$L37043|
; 330 :
; 331 : } except (GetExceptionCode() == STATUS_ACCESS_VIOLATION ?
; 332 : EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
00250 e5901000 ldr r1, [r0]
00254 e5912000 ldr r2, [r1]
00258 e3520117 cmp r2, #0x17, 2
0025c e3a00001 mov r0, #1
00260 13a00000 movne r0, #0
00264 |$L37045|
00264 e1a0f00e mov pc, lr
00268 |$L37039|
00268 |$L37076|
00268 |$L37036|
; 304 : #endif
; 305 :
; 306 : } except (GetExceptionCode() == STATUS_ACCESS_VIOLATION ?
; 307 : EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
00268 e5901000 ldr r1, [r0]
0026c e5912000 ldr r2, [r1]
00270 e3520117 cmp r2, #0x17, 2
00274 e3a00001 mov r0, #1
00278 13a00000 movne r0, #0
0027c |$L37038|
0027c e1a0f00e mov pc, lr
00280 |$L37078|
EXPORT |??_C@_1GA@LHAD@?$AAM?$AAM?$AAC?$AAD?$AAI?$AAS?$AAK?$AA?3?$AAD?$AAo?$AAD?$AAi?$AAs?$AAk?$AAI?$AAO?$AA?5?$AA?9?$AA?5?$AAC@| [ DATA ] ; `string'
EXPORT |DoDiskIO|
IMPORT |NKDbgPrintfW|
00000 AREA |.text| { |DoDiskIO| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$DoDiskIO|, PDATA, SELECTION=5, ASSOC=|.text| { |DoDiskIO| } ; comdat associative
|$T37094| DCD |DoDiskIO|
DCD 0x40003901
00000 AREA |.rdata| { |??_C@_1GA@LHAD@?$AAM?$AAM?$AAC?$AAD?$AAI?$AAS?$AAK?$AA?3?$AAD?$AAo?$AAD?$AAi?$AAs?$AAk?$AAI?$AAO?$AA?5?$AA?9?$AA?5?$AAC@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_1GA@LHAD@?$AAM?$AAM?$AAC?$AAD?$AAI?$AAS?$AAK?$AA?3?$AAD?$AAo?$AAD?$AAi?$AAs?$AAk?$AAI?$AAO?$AA?5?$AA?9?$AA?5?$AAC@| DCB "M"
DCB 0x0, "M", 0x0, "C", 0x0, "D", 0x0, "I", 0x0, "S", 0x0, "K"
DCB 0x0, ":", 0x0, "D", 0x0, "o", 0x0, "D", 0x0, "i", 0x0, "s"
DCB 0x0, "k", 0x0, "I", 0x0, "O", 0x0, " ", 0x0, "-", 0x0, " "
DCB 0x0, "C", 0x0, "F", 0x0, " ", 0x0, "C", 0x0, "a", 0x0, "r"
DCB 0x0, "d", 0x0, " ", 0x0, "n", 0x0, "o", 0x0, " ", 0x0, "l"
DCB 0x0, "o", 0x0, "n", 0x0, "g", 0x0, "e", 0x0, "r", 0x0, " "
DCB 0x0, "p", 0x0, "r", 0x0, "e", 0x0, "s", 0x0, "e", 0x0, "n"
DCB 0x0, "t", 0x0, "!", 0x0, 0xd, 0x0, 0xa, 0x0, 0x0, 0x0 ; `string'
; Function compile flags: /Ogsy
00000 AREA |.text| { |DoDiskIO| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |DoDiskIO| PROC
; 377 : {
00000 e92d40f0 stmdb sp!, {r4 - r7, lr}
00004 |$M37092|
00004 e1a06000 mov r6, r0
00008 e1a05001 mov r5, r1
0000c e1a07002 mov r7, r2
; 378 : DWORD status;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -