⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 atapipci.cod

📁 windows CE 的BSP开发包.包含众多的驱动程序和OAL层的开发代码
💻 COD
📖 第 1 页 / 共 5 页
字号:
  001dc	0a0000d7	 beq         |$L32222|
  001e0	e3a0b008	 mov         r11, #8
  001e4	e24bbc35	 sub         r11, r11, #0x35, 24
  001e8		 |$L32220|

; 597  : 
; 598  :             // Map address and check for security violation
; 599  :             LPBYTE pBuffer = (LPBYTE)MapCallerPtr((LPVOID)pSgBuf[iBuffer].sb_buf, pSgBuf[iBuffer].sb_len);

  001e8	e5981004	 ldr         r1, [r8, #4]
  001ec	e5980000	 ldr         r0, [r8]
  001f0	eb000000	 bl          MapCallerPtr

; 600  :             if (pSgBuf[iBuffer].sb_buf != NULL && pBuffer == NULL) {

  001f4	e5983000	 ldr         r3, [r8]
  001f8	e1a06000	 mov         r6, r0
  001fc	e3530000	 cmp         r3, #0
  00200	0a000001	 beq         |$L32226|
  00204	e3560000	 cmp         r6, #0
  00208	0a0000d6	 beq         |$ExitFailure$32138|
  0020c		 |$L32226|

; 601  :                 // security violation
; 602  :                 DEBUGMSG(ZONE_ERROR, (TEXT(
; 603  :                     "Atapi!CPCIDisk::SetupDMA> Failed to map pointer to caller\r\n"
; 604  :                     )));
; 605  :                 goto ExitFailure;
; 606  :             }
; 607  : 
; 608  :             // determine the number of bytes remaining to be placed in PRD
; 609  :             dwTotalBytes = pSgBuf[iBuffer].sb_len;
; 610  :             if (!LockPages (
; 611  :                 pBuffer,
; 612  :                 dwTotalBytes,
; 613  :                 m_pPFNs,
; 614  :                 fRead ? LOCKFLAG_WRITE : LOCKFLAG_READ)
; 615  :             ) {

  0020c	e59d3008	 ldr         r3, [sp, #8]
  00210	e5985004	 ldr         r5, [r8, #4]
  00214	e3530000	 cmp         r3, #0
  00218	0a000080	 beq         |$L32598|
  0021c	e3a03001	 mov         r3, #1
  00220	ea00007f	 b           |$L32599|
  00224		 |$L32610|

; 510  :             fUnalign = TRUE;
; 511  :             break;
; 512  :         }
; 513  :     }
; 514  : 
; 515  :     if (fUnalign) {
; 516  : 
; 517  :         DWORD dwCurPageOffset = 0;
; 518  : 
; 519  :         for (iBuffer = 0; iBuffer < dwSgCount; iBuffer++) {

  00224	e24a3001	 sub         r3, r10, #1
  00228	e58d3010	 str         r3, [sp, #0x10]
  0022c	e3a04000	 mov         r4, #0
  00230	e3a0b000	 mov         r11, #0
  00234		 |$L32182|

; 520  : 
; 521  :             // Map address and check for security violation
; 522  :             LPBYTE pBuffer = (LPBYTE)MapCallerPtr((LPVOID)pSgBuf[iBuffer].sb_buf, pSgBuf[iBuffer].sb_len);

  00234	e5981004	 ldr         r1, [r8, #4]
  00238	e5980000	 ldr         r0, [r8]
  0023c	eb000000	 bl          MapCallerPtr

; 523  :             if (pSgBuf[iBuffer].sb_buf != NULL && pBuffer == NULL) {

  00240	e5983000	 ldr         r3, [r8]
  00244	e1a0e000	 mov         lr, r0
  00248	e58de000	 str         lr, [sp]
  0024c	e3530000	 cmp         r3, #0
  00250	0a000001	 beq         |$L32188|
  00254	e35e0000	 cmp         lr, #0
  00258	0a0000c2	 beq         |$ExitFailure$32138|
  0025c		 |$L32188|

; 524  :                 // security violation
; 525  :                 DEBUGMSG(ZONE_ERROR, (TEXT(
; 526  :                     "Atapi!CPCIDisk::SetupDMA> Failed to map pointer to caller\r\n"
; 527  :                     )));
; 528  :                 goto ExitFailure;
; 529  :             }
; 530  : 
; 531  :             DWORD dwBufferLeft = pSgBuf[iBuffer].sb_len;

  0025c	e5983004	 ldr         r3, [r8, #4]
  00260	e1b06003	 movs        r6, r3

; 532  :             while (dwBufferLeft) {

  00264	0a000063	 beq         |$L32183|
  00268		 |$L32193|

; 533  : 
; 534  :                 DWORD dwBytesInCurPage = UserKInfo[KINX_PAGESIZE] - dwCurPageOffset;

  00268	e5993000	 ldr         r3, [r9]
  0026c	e043a004	 sub         r10, r3, r4

; 535  :                 DWORD dwBytesToTransfer = (dwBufferLeft > dwBytesInCurPage) ? dwBytesInCurPage : dwBufferLeft;

  00270	e156000a	 cmp         r6, r10
  00274	81a0500a	 movhi       r5, r10
  00278	91a05006	 movls       r5, r6

; 536  : 
; 537  :                 // allocate a new page, if necessary
; 538  :                 if ((dwCurPageOffset == 0) && (m_dwPhysCount >= MIN_PHYS_PAGES)) {

  0027c	e3540000	 cmp         r4, #0
  00280	1a000019	 bne         |$L32205|
  00284	e5973764	 ldr         r3, [r7, #0x764]
  00288	e3530004	 cmp         r3, #4
  0028c	3a000016	 bcc         |$L32205|

; 539  :                     PHYSICAL_ADDRESS PhysicalAddress = {0};

  00290	e3a03000	 mov         r3, #0
  00294	e58d3018	 str         r3, [sp, #0x18]
  00298	e3a03000	 mov         r3, #0
  0029c	e58d301c	 str         r3, [sp, #0x1C]

; 540  :                     m_pPhysList[m_dwPhysCount].pVirtualAddress = (LPBYTE)HalAllocateCommonBuffer(
; 541  :                         &Adapter, UserKInfo[KINX_PAGESIZE], &PhysicalAddress, FALSE);

  002a0	e5991000	 ldr         r1, [r9]
  002a4	e3a03000	 mov         r3, #0
  002a8	e28d2018	 add         r2, sp, #0x18
  002ac	e28d0020	 add         r0, sp, #0x20
  002b0	eb000000	 bl          HalAllocateCommonBuffer
  002b4	e5972764	 ldr         r2, [r7, #0x764]
  002b8	e5973750	 ldr         r3, [r7, #0x750]
  002bc	e7830182	 str         r0, [r3, +r2, lsl #3]

; 542  :                     m_pPhysList[m_dwPhysCount].pPhysicalAddress = (LPBYTE)PhysicalAddress.QuadPart;

  002c0	e5971764	 ldr         r1, [r7, #0x764]
  002c4	e5973750	 ldr         r3, [r7, #0x750]
  002c8	e59d2018	 ldr         r2, [sp, #0x18]
  002cc	e0833181	 add         r3, r3, r1, lsl #3
  002d0	e5832004	 str         r2, [r3, #4]

; 543  :                     if (!m_pPhysList[m_dwPhysCount].pVirtualAddress) {

  002d4	e5972764	 ldr         r2, [r7, #0x764]
  002d8	e5973750	 ldr         r3, [r7, #0x750]
  002dc	e7933182	 ldr         r3, [r3, +r2, lsl #3]
  002e0	e3530000	 cmp         r3, #0
  002e4	0a00009f	 beq         |$ExitFailure$32138|

; 581  :                 }
; 582  : 
; 583  :                 // update transfer
; 584  :                 dwBufferLeft -= dwBytesToTransfer;
; 585  :                 pBuffer += dwBytesToTransfer;

  002e8	e59de000	 ldr         lr, [sp]
  002ec		 |$L32205|

; 544  :                         goto ExitFailure;
; 545  :                     }
; 546  :                 }
; 547  : 
; 548  :                 if (fRead) {

  002ec	e59d3008	 ldr         r3, [sp, #8]

; 549  : 
; 550  :                     // prepare a scatter/gather copy entry on read, so we can
; 551  :                     // copy data from the DMA buffer to the scatter/gather
; 552  :                     // buffer after this DMA transfer is complete
; 553  : 
; 554  :                     m_pSGCopy[m_dwSGCount].pSrcAddress = m_pPhysList[m_dwPhysCount].pVirtualAddress + dwCurPageOffset;

  002f0	e5970764	 ldr         r0, [r7, #0x764]
  002f4	e3530000	 cmp         r3, #0
  002f8	e5973750	 ldr         r3, [r7, #0x750]
  002fc	0a000013	 beq         |$L32207|
  00300	e597275c	 ldr         r2, [r7, #0x75C]
  00304	e5971754	 ldr         r1, [r7, #0x754]
  00308	e7930180	 ldr         r0, [r3, +r0, lsl #3]
  0030c	e0823082	 add         r3, r2, r2, lsl #1
  00310	e0812103	 add         r2, r1, r3, lsl #2
  00314	e0803004	 add         r3, r0, r4
  00318	e5823004	 str         r3, [r2, #4]

; 555  :                     m_pSGCopy[m_dwSGCount].pDstAddress = pBuffer;

  0031c	e597375c	 ldr         r3, [r7, #0x75C]
  00320	e5972754	 ldr         r2, [r7, #0x754]
  00324	e0833083	 add         r3, r3, r3, lsl #1
  00328	e782e103	 str         lr, [r2, +r3, lsl #2]

; 556  :                     m_pSGCopy[m_dwSGCount].dwSize = dwBytesToTransfer;

  0032c	e597375c	 ldr         r3, [r7, #0x75C]
  00330	e5972754	 ldr         r2, [r7, #0x754]
  00334	e0833083	 add         r3, r3, r3, lsl #1
  00338	e0823103	 add         r3, r2, r3, lsl #2
  0033c	e5835008	 str         r5, [r3, #8]

; 557  :                     m_dwSGCount++;

  00340	e597375c	 ldr         r3, [r7, #0x75C]
  00344	e2833001	 add         r3, r3, #1
  00348	e587375c	 str         r3, [r7, #0x75C]

; 558  : 
; 559  :                 }
; 560  :                 else {

  0034c	ea000005	 b           |$L32208|
  00350		 |$L32207|

; 561  :                     memcpy(m_pPhysList[m_dwPhysCount].pVirtualAddress + dwCurPageOffset, pBuffer, dwBytesToTransfer);

  00350	e7933180	 ldr         r3, [r3, +r0, lsl #3]
  00354	e1a02005	 mov         r2, r5
  00358	e1a0100e	 mov         r1, lr
  0035c	e0830004	 add         r0, r3, r4
  00360	eb000000	 bl          memcpy

; 581  :                 }
; 582  : 
; 583  :                 // update transfer
; 584  :                 dwBufferLeft -= dwBytesToTransfer;
; 585  :                 pBuffer += dwBytesToTransfer;

  00364	e59de000	 ldr         lr, [sp]
  00368		 |$L32208|
  00368	e156000a	 cmp         r6, r10
  0036c	23a04000	 movcs       r4, #0
  00370	2a000004	 bcs         |$L32212|

; 562  :                 }
; 563  : 
; 564  :                 // if this buffer is larger than the space remaining on the page,
; 565  :                 // then finish processing this page by setting @dwCurPageOffset<-0
; 566  : 
; 567  :                 if (dwBufferLeft >= dwBytesInCurPage) {
; 568  :                     dwCurPageOffset = 0;
; 569  :                 }
; 570  :                 else {
; 571  :                     dwCurPageOffset += dwBytesToTransfer;

  00374	e0944005	 adds        r4, r4, r5

; 572  :                 }
; 573  : 
; 574  :                 // have we finished a page? (i.e., offset was reset or this is the last buffer)
; 575  :                 if ((dwCurPageOffset == 0) || (iBuffer == (dwSgCount - 1))) {

  00378	0a000002	 beq         |$L32212|
  0037c	e59d3010	 ldr         r3, [sp, #0x10]
  00380	e15b0003	 cmp         r11, r3
  00384	1a000016	 bne         |$L32211|
  00388		 |$L32212|

; 576  :                     // add this to the PRD table
; 577  :                     m_pPRD[m_dwPhysCount].physAddr = (DWORD)m_pPhysList[m_dwPhysCount].pPhysicalAddress;

  00388	e5971764	 ldr         r1, [r7, #0x764]
  0038c	e5973750	 ldr         r3, [r7, #0x750]
  00390	e597274c	 ldr         r2, [r7, #0x74C]

; 578  :                     m_pPRD[m_dwPhysCount].size = dwCurPageOffset ? (USHORT)dwCurPageOffset : (USHORT)UserKInfo[KINX_PAGESIZE];

  00394	e3540000	 cmp         r4, #0
  00398	e0833181	 add         r3, r3, r1, lsl #3
  0039c	e5933004	 ldr         r3, [r3, #4]
  003a0	e7823181	 str         r3, [r2, +r1, lsl #3]
  003a4	05993000	 ldreq       r3, [r9]
  003a8	11a01804	 movne       r1, r4, lsl #16
  003ac	e5972764	 ldr         r2, [r7, #0x764]
  003b0	01a01803	 moveq       r1, r3, lsl #16
  003b4	e597374c	 ldr         r3, [r7, #0x74C]
  003b8	e1a01821	 mov         r1, r1, lsr #16
  003bc	e0833182	 add         r3, r3, r2, lsl #3
  003c0	e1c310b4	 strh        r1, [r3, #4]

; 579  :                     m_pPRD[m_dwPhysCount].EOTpad = 0;

  003c4	e5972764	 ldr         r2, [r7, #0x764]
  003c8	e597374c	 ldr         r3, [r7, #0x74C]
  003cc	e0833182	 add         r3, r3, r2, lsl #3
  003d0	e3a02000	 mov         r2, #0
  003d4	e1c320b6	 strh        r2, [r3, #6]

; 580  :                     m_dwPhysCount++;

  003d8	e5973764	 ldr         r3, [r7, #0x764]
  003dc	e2833001	 add         r3, r3, #1
  003e0	e5873764	 str         r3, [r7, #0x764]
  003e4		 |$L32211|

; 581  :                 }
; 582  : 
; 583  :                 // update transfer
; 584  :                 dwBufferLeft -= dwBytesToTransfer;
; 585  :                 pBuffer += dwBytesToTransfer;

  003e4	e08ee005	 add         lr, lr, r5
  003e8	e58de000	 str         lr, [sp]
  003ec	e0566005	 subs        r6, r6, r5
  003f0	1affff9c	 bne         |$L32193|

; 426  : {

  003f4	e59da004	 ldr         r10, [sp, #4]
  003f8		 |$L32183|

; 510  :             fUnalign = TRUE;
; 511  :             break;
; 512  :         }
; 513  :     }
; 514  : 
; 515  :     if (fUnalign) {
; 516  : 
; 517  :         DWORD dwCurPageOffset = 0;
; 518  : 
; 519  :         for (iBuffer = 0; iBuffer < dwSgCount; iBuffer++) {

  003f8	e28bb001	 add         r11, r11, #1
  003fc	e15b000a	 cmp         r11, r10
  00400	e2888008	 add         r8, r8, #8
  00404	3affff8a	 bcc         |$L32182|

; 586  :            }
; 587  :         }
; 588  : 
; 589  :         m_pPRD[m_dwPhysCount - 1].EOTpad = 0x8000;

  00408	e5972764	 ldr         r2, [r7, #0x764]
  0040c	e597374c	 ldr         r3, [r7, #0x74C]
  00410	e3a01902	 mov         r1, #2, 18
  00414	e0833182	 add         r3, r3, r2, lsl #3
  00418	e14310b2	 strh        r1, [r3, #-2]

; 590  : 
; 591  :     }
; 592  :     else {

  0041c	ea00004d	 b           |$L32218|
  00420		 |$L32598|

; 601  :                 // security violation
; 602  :                 DEBUGMSG(ZONE_ERROR, (TEXT(
; 603  :                     "Atapi!CPCIDisk::SetupDMA> Failed to map pointer to caller\r\n"
; 604  :                     )));
; 605  :                 goto ExitFailure;
; 606  :             }
; 607  : 
; 608  :             // determine the number of bytes remaining to be placed in PRD
; 609  :             dwTotalBytes = pSgBuf[iBuffer].sb_len;
; 610  :             if (!LockPages (
; 611  :                 pBuffer,
; 612  :                 dwTotalBytes,
; 613  :                 m_pPFNs,
; 614  :                 fRead ? LOCKFLAG_WRITE : LOCKFLAG_READ)
; 615  :             ) {

  00420	e3a03004	 mov         r3, #4
  0042

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -