Check out my first novel, midnight's simulacra!

Libcudest: Difference between revisions

From dankwiki
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
Reverse engineering of the [[CUDA]] system. CUDA primarily communicates with the NVIDIA closed-source driver via several dozen undocumented ioctl()s. My open source implementation, libcudest, is located at [http://github.com/dankamongmen/libcudest GitHub]. It began as a project for Hyesoon Kim's [[Grad school|CS4803DGC]] at the Georgia Institute of Technology.
__INDEX__
Reverse engineering of the [[CUDA]] system. CUDA primarily communicates with the NVIDIA closed-source driver via several dozen undocumented ioctl()s. My open source implementation, libcudest, is located at [http://github.com/dankamongmen/libcudest GitHub]. Sundry utilities for reverse engineering are also within this repository, though recent modifications to [http://kadu.net/~joi/valgrind-mmt.git/ valgrind-mmt] have rather superseded my tools.
 
libcudest began as a project for Hyesoon Kim's [[Grad school|CS4803DGC]] at the Georgia Institute of Technology.
==Driver versions==
==Driver versions==
Newer drivers can be used with older CUDA versions, but the converse is not true. The "CUDA macroversion" listed below is the first CUDA release designed explicitly for use with the listed drivers.
Newer drivers can be used with older CUDA versions, but the converse is not true. The "CUDA macroversion" listed below is the first CUDA release designed explicitly for use with the listed drivers.
Line 335: Line 338:
| cuInit
| cuInit
|
|
* Inputs:
* [[#GPU methods|GPU method]] invocation. Second and third words specify the method being called. Fifth and sixth specify the address being passed; seventh and eighth the size thereof.
Sample inputs:
<pre>0x7fffffffd310: 3251635025 3251635025 533 0
<pre>0x7fffffffd310: 3251635025 3251635025 533 0
0x7fffffffd320: 4294955888 32767 132 0</pre>
0x7fffffffd320: 4294955888 32767 132 0</pre>
* Outputs are unchanged
* First and second words are *not* always equivalent.
* Outputs are usually unchanged, but not always:
<pre>ioctl 2a, 32-byte param, fd 3 0xc1d04214 0x5c000002 0x2080012f 0x00000000
0x0010 0x950713f0 0x00007fff 0x000000a8 0x00000000
GPU method 0x5c000002:2080012f 0x00000000 0x00000000 0x00000000 0x00000000
0x0010 0x00000000 0x00000000 0x00000000 0x00000000
0x0020 0x00000000 0x00000000 0x00000000 0x00000000
0x0030 0x00000000 0x00000000 0x00000000 0x00000000
0x0040 0x00000000 0x00000000 0x00000000 0x00000000
0x0050 0x00000000 0x00000000 0x00000000 0x00000000
0x0060 0x00000000 0x00000000 0x00000000 0x00000000
0x0070 0x00000000 0x00000000 0x00000000 0x00000000
0x0080 0x00000000 0x00000000 0x00000000 0x00000000
0x0090 0x00000000 0x00000000 0x00000000 0x00000000
0x00a0 0x00000000 0x00000000
RESULT: 0 0xc1d04214 0x5c000002 0x2080012f 0x00000000
0x0010 0x950713f0 0x00007fff 0x000000a8 0x00000029
GPU method 0x5c000002:2080012f **************MODIFICATION FROM CALL
0x00000000 0x00000000 0x00000000 0x00000000
0x0010 0x00000000 0x00000000 0x00000000 0x00000000
0x0020 0x00000000 0x00000000 0x00000000 0x00000000
0x0030 0x00000000 0x00000000 0x00000000 0x00000000
0x0040 0x00000000 0x00000000 0x00000000 0x00000000
0x0050 0x00000000 0x00000000 0x00000000 0x00000000
0x0060 0x00000000 0x00000000 0x00000000 0x00000000
0x0070 0x00000000 0x00000000 0x00000000 0x00000000
0x0080 0x00000000 0x00000000 0x00000000 0x00000000
0x0090 0x00000000 0x00000000 0x00000000 0x00000000
0x00a0 0x00000000 0x00000000 </pre>
|-
|-
| 0x2b
| 0x2b
Line 345: Line 377:
| cuInit
| cuInit
|
|
* GPU object creation(?)
|-
|-
| 0x4d
| 0x4d
Line 416: Line 449:
|-
|-
|}
|}
 
==GPU methods==
==disassembly==
This disassembly makes use of <tt>libcuda.so.195.36.15</tt> (0867d66be617faab3782fa0ba19ec9ba, 7404990 bytes). Symbols were extracted via <tt>objdump -T</tt>.
AMD64 ABI:
* Integer arguments via RDI, RSI, RDX, RCX, R8 and R9, then stack
* FP arguments in XMM0..XMM7, then stack
* Return value in RAX
{| border="1" class="sortable"
{| border="1" class="sortable"
! location (.text is 000000000007fd10)
! Code
! length
! Param size
! symbol
! Notes
! notes
|-
| ebce0
|
|
|<code>
  ebce0: 41 55                push  %r13
  ebce2: 49 89 fd            mov    %rdi,%r13
  ebce5: 41 54                push  %r12
  ebce7: 49 89 f4            mov    %rsi,%r12
  ebcea: 55                  push  %rbp
  ebceb: 53                  push  %rbx
  ebcec: 48 83 ec 08          sub    $0x8,%rsp
  ebcf0: 8b 35 2a 49 72 00    mov    0x72492a(%rip),%esi        # 810620 <__isinff@plt+0x790920>
  ebcf6: 85 f6                test  %esi,%esi
  ebcf8: 0f 84 16 01 00 00    je    ebe14 <__isinff@plt+0x6c114>
  ebcfe: 8b 0d 2c 49 72 00    mov    0x72492c(%rip),%ecx        # 810630 <__isinff@plt+0x790930>
  ebd04: 85 c9                test  %ecx,%ecx
  ebd06: 0f 8e 08 01 00 00    jle    ebe14 <__isinff@plt+0x6c114>
  ebd0c: 48 8d 1d 0d 49 72 00 lea    0x72490d(%rip),%rbx        # 810620 <__isinff@plt+0x790920>
  ebd13: 31 ed                xor    %ebp,%ebp
  ebd15: 48 8b 7b 28          mov    0x28(%rbx),%rdi
  ebd19: 4c 89 e2            mov    %r12,%rdx
  ebd1c: 4c 89 ee            mov    %r13,%rsi
  ebd1f: ff c5                inc    %ebp
  ebd21: ff 53 20            callq  *0x20(%rbx)
  ebd24: 48 83 c3 18          add    $0x18,%rbx
  ebd28: 39 2d 02 49 72 00    cmp    %ebp,0x724902(%rip)        # 810630 <__isinff@plt+0x790930>
  ebd2e: 0f 8e e0 00 00 00    jle    ebe14 <__isinff@plt+0x6c114>
  ebd34: 48 8b 7b 28          mov    0x28(%rbx),%rdi
  ebd38: 4c 89 e2            mov    %r12,%rdx
  ebd3b: 4c 89 ee            mov    %r13,%rsi
  ebd3e: ff 53 20            callq  *0x20(%rbx)
  ebd41: 8d 45 01            lea    0x1(%rbp),%eax
  ebd44: 39 05 e6 48 72 00    cmp    %eax,0x7248e6(%rip)        # 810630 <__isinff@plt+0x790930>
  ebd4a: 48 8d 4b 18          lea    0x18(%rbx),%rcx
  ebd4e: 0f 8e c0 00 00 00    jle    ebe14 <__isinff@plt+0x6c114>
  ebd54: 48 8b 79 28          mov    0x28(%rcx),%rdi
  ebd58: 4c 89 e2            mov    %r12,%rdx
  ebd5b: 4c 89 ee            mov    %r13,%rsi
  ebd5e: ff 51 20            callq  *0x20(%rcx)
  ebd61: 8d 55 02            lea    0x2(%rbp),%edx
  ebd64: 39 15 c6 48 72 00    cmp    %edx,0x7248c6(%rip)        # 810630 <__isinff@plt+0x790930>
  ebd6a: 48 8d 4b 30          lea    0x30(%rbx),%rcx
  ebd6e: 0f 8e a0 00 00 00    jle    ebe14 <__isinff@plt+0x6c114>
  ebd74: 48 8b 79 28          mov    0x28(%rcx),%rdi
  ebd78: 4c 89 e2            mov    %r12,%rdx
  ebd7b: 4c 89 ee            mov    %r13,%rsi
  ebd7e: ff 51 20            callq  *0x20(%rcx)
  ebd81: 8d 7d 03            lea    0x3(%rbp),%edi
  ebd84: 39 3d a6 48 72 00    cmp    %edi,0x7248a6(%rip)        # 810630 <__isinff@plt+0x790930>
  ebd8a: 48 8d 4b 48          lea    0x48(%rbx),%rcx
  ebd8e: 0f 8e 80 00 00 00    jle    ebe14 <__isinff@plt+0x6c114>
  ebd94: 48 8b 79 28          mov    0x28(%rcx),%rdi
  ebd98: 4c 89 e2            mov    %r12,%rdx
  ebd9b: 4c 89 ee            mov    %r13,%rsi
  ebd9e: ff 51 20            callq  *0x20(%rcx)
  ebda1: 44 8d 45 04          lea    0x4(%rbp),%r8d
  ebda5: 44 39 05 84 48 72 00 cmp    %r8d,0x724884(%rip)        # 810630 <__isinff@plt+0x790930>
  ebdac: 48 8d 4b 60          lea    0x60(%rbx),%rcx
  ebdb0: 7e 62                jle    ebe14 <__isinff@plt+0x6c114>
  ebdb2: 48 8b 79 28          mov    0x28(%rcx),%rdi
  ebdb6: 4c 89 e2            mov    %r12,%rdx
  ebdb9: 4c 89 ee            mov    %r13,%rsi
  ebdbc: ff 51 20            callq  *0x20(%rcx)
  ebdbf: 44 8d 4d 05          lea    0x5(%rbp),%r9d
  ebdc3: 44 39 0d 66 48 72 00 cmp    %r9d,0x724866(%rip)        # 810630 <__isinff@plt+0x790930>
  ebdca: 48 8d 4b 78          lea    0x78(%rbx),%rcx
  ebdce: 7e 44                jle    ebe14 <__isinff@plt+0x6c114>
  ebdd0: 48 8b 79 28          mov    0x28(%rcx),%rdi
  ebdd4: 4c 89 e2            mov    %r12,%rdx
  ebdd7: 4c 89 ee            mov    %r13,%rsi
  ebdda: ff 51 20            callq  *0x20(%rcx)
  ebddd: 44 8d 55 06          lea    0x6(%rbp),%r10d
  ebde1: 44 39 15 48 48 72 00 cmp    %r10d,0x724848(%rip)        # 810630 <__isinff@plt+0x790930>
  ebde8: 48 8d 8b 90 00 00 00 lea    0x90(%rbx),%rcx
  ebdef: 7e 23                jle    ebe14 <__isinff@plt+0x6c114>
  ebdf1: 48 8b 79 28          mov    0x28(%rcx),%rdi
  ebdf5: 4c 89 e2            mov    %r12,%rdx
  ebdf8: 4c 89 ee            mov    %r13,%rsi
  ebdfb: 83 c5 07            add    $0x7,%ebp
  ebdfe: 48 81 c3 a8 00 00 00 add    $0xa8,%rbx
  ebe05: ff 51 20            callq  *0x20(%rcx)
  ebe08: 39 2d 22 48 72 00    cmp    %ebp,0x724822(%rip)        # 810630 <__isinff@plt+0x790930>
  ebe0e: 0f 8f 01 ff ff ff    jg    ebd15 <__isinff@plt+0x6c015>
  ebe14: 48 83 c4 08          add    $0x8,%rsp
  ebe18: 5b                  pop    %rbx
  ebe19: 5d                  pop    %rbp
  ebe1a: 41 5c                pop    %r12
  ebe1c: 41 5d                pop    %r13
  ebe1e: c3                  retq
</code>
|-
| 5c7850
|
| Pthread_setspecific()
|<code>
  5c7850: ff cf                dec    %edi
  5c7852: e9 e9 7c ab ff      jmpq  7f540 <pthread_setspecific@plt>
</code>
|-
 
| 5c7860
|
| Pthread_getspecific()
|<code>
  5c7860: ff cf                dec    %edi
  5c7862: e9 49 83 ab ff      jmpq  7fbb0 <pthread_getspecific@plt>
</code>
|-
| 905d0
|
| "lookupContext()"
|<code>
// Check for 0x321cbda00, the "driver deinitialized" magic constant. Return 4 if set.
 
  905d0:      48 8b 05 91 e0 77 00    mov    0x77e091(%rip),%rax        # 80e668 <__isinff@plt+0x78e968>              push  %rbx
  905d8:      b9 04 00 00 00          mov    $0x4,%ecx
  905dd:      48 89 fb                mov    %rdi,%rbx
  905e0:      8b 90 88 01 00 00      mov    0x188(%rax),%edx
  905e6:      81 fa 00 ba 1c 32      cmp    $0x321cba00,%edx
  905ec:      74 0a                  je    905f8 <__isinff@plt+0x108f8>
 
// Check for 0xabc123, the "driver initialized" magic constant. Return 3 if unset.
 
  905ee:      81 fa 23 c1 ab 00      cmp    $0xabc123,%edx
  905f4:      b1 03                  mov    $0x3,%cl
  905f6:      74 08                  je    90600 <__isinff@plt+0x10900>
  905f8:      5b                      pop    %rbx
  905f9:      89 c8                  mov    %ecx,%eax
  905fb:      c3                      retq 
  905fc:      66 66 66 90            xchg  %ax,%ax
 
// Also return 3 (DRIVER_UNINITIALIZED) if we were passed an uninitialized key.
 
  90600:      30 c9                  xor    %cl,%cl
  90602:      48 85 ff                test  %rdi,%rdi
  90605:      74 f1                  je    905f8 <__isinff@plt+0x108f8>
 
// Call pthread_getspecific()
 
  90607:      8b 38                  mov    (%rax),%edi
  90609:      e8 52 72 53 00          callq  5c7860 <__isinff@plt+0x547b60>
 
// Check for NULL from pthread_getspecific(). Return 201 (INVALID_CONTEXT) in that case.
 
  9060e:      48 85 c0                test  %rax,%rax
  90611:      48 89 03                mov    %rax,(%rbx)
  90614:      b9 c9 00 00 00          mov    $0xc9,%ecx
  90619:      74 dd                  je    905f8 <__isinff@plt+0x108f8>
 
// We had a valid context object. Return 0x338 bytes into it.
 
  9061b:      8b 88 38 03 00 00      mov    0x338(%rax),%ecx
  90621:      5b                      pop    %rbx
  90622:      89 c8                  mov    %ecx,%eax
  90624:      c3                      retq
</code>
|-
| ebcd0
|
|
|<code>
  ebcd0:      31 c0                  xor    %eax,%eax
  ebcd2:      83 3d 4b 49 72 00 00    cmpl  $0x0,0x72494b(%rip)        # 810624 <__isinff@plt+0x790924>
  ebcd9:      0f 95 c0                setne  %al
  ebcdc:      c3                      retq
</code>
|-
|81460
|
|
|<code>
  81460: 53                  push  %rbx
  81461: 89 fb                mov    %edi,%ebx
  81463: e8 b8 f2 00 00      callq  90720 <__isinff@plt+0x10a20>
  81468: 85 db                test  %ebx,%ebx
  8146a: 74 07                je    81473 <__isinff@plt+0x1773>
  8146c: 5b                  pop    %rbx
  8146d: b8 01 00 00 00      mov    $0x1,%eax
  81472: c3                  retq 
  81473: 5b                  pop    %rbx
  81474: e9 07 f4 00 00      jmpq  90880 <__isinff@plt+0x10b80>
</code>
|-
| 90720
|
|
|<code>
  90720: 53                  push  %rbx
  90721: 48 8b 1d 40 df 77 00 mov    0x77df40(%rip),%rbx        # 80e668 <__isinff@plt+0x78e968>
  90728: 8b 83 80 01 00 00    mov    0x180(%rbx),%eax
  9072e: 85 c0                test  %eax,%eax
  90730: 74 02                je    90734 <__isinff@plt+0x10a34>
  90732: 5b                  pop    %rbx
  90733: c3                  retq 
  90734: 48 8d bb 78 01 00 00 lea    0x178(%rbx),%rdi
  9073b: 31 d2                xor    %edx,%edx
  9073d: be 01 00 00 00      mov    $0x1,%esi
  90742: e8 b9 69 53 00      callq  5c7100 <__isinff@plt+0x547400>
  90747: 85 c0                test  %eax,%eax
  90749: 0f 84 9a 00 00 00    je    907e9 <__isinff@plt+0x10ae9>
  9074f: 44 8b 9b 80 01 00 00 mov    0x180(%rbx),%r11d
  90756: 45 85 db            test  %r11d,%r11d
  90759: 75 d7                jne    90732 <__isinff@plt+0x10a32>
  9075b: e8 20 70 53 00      callq  5c7780 <__isinff@plt+0x547a80>
  90760: 8b 93 80 01 00 00    mov    0x180(%rbx),%edx
  90766: 85 d2                test  %edx,%edx
  90768: 75 c8                jne    90732 <__isinff@plt+0x10a32>
  9076a: e8 11 70 53 00      callq  5c7780 <__isinff@plt+0x547a80>
  9076f: 8b 8b 80 01 00 00    mov    0x180(%rbx),%ecx
  90775: 85 c9                test  %ecx,%ecx
  90777: 75 b9                jne    90732 <__isinff@plt+0x10a32>
  90779: e8 02 70 53 00      callq  5c7780 <__isinff@plt+0x547a80>
  9077e: 8b b3 80 01 00 00    mov    0x180(%rbx),%esi
  90784: 85 f6                test  %esi,%esi
  90786: 75 aa                jne    90732 <__isinff@plt+0x10a32>
  90788: e8 f3 6f 53 00      callq  5c7780 <__isinff@plt+0x547a80>
  9078d: 8b bb 80 01 00 00    mov    0x180(%rbx),%edi
  90793: 85 ff                test  %edi,%edi
  90795: 75 9b                jne    90732 <__isinff@plt+0x10a32>
  90797: e8 e4 6f 53 00      callq  5c7780 <__isinff@plt+0x547a80>
  9079c: 44 8b 83 80 01 00 00 mov    0x180(%rbx),%r8d
  907a3: 45 85 c0            test  %r8d,%r8d
  907a6: 75 8a                jne    90732 <__isinff@plt+0x10a32>
  907a8: e8 d3 6f 53 00      callq  5c7780 <__isinff@plt+0x547a80>
  907ad: 44 8b 8b 80 01 00 00 mov    0x180(%rbx),%r9d
  907b4: 45 85 c9            test  %r9d,%r9d
  907b7: 0f 85 75 ff ff ff    jne    90732 <__isinff@plt+0x10a32>
  907bd: e8 be 6f 53 00      callq  5c7780 <__isinff@plt+0x547a80>
  907c2: 44 8b 93 80 01 00 00 mov    0x180(%rbx),%r10d
  907c9: 45 85 d2            test  %r10d,%r10d
  907cc: 0f 85 60 ff ff ff    jne    90732 <__isinff@plt+0x10a32>
  907d2: e8 a9 6f 53 00      callq  5c7780 <__isinff@plt+0x547a80>
  907d7: 44 8b 9b 80 01 00 00 mov    0x180(%rbx),%r11d
  907de: 45 85 db            test  %r11d,%r11d
  907e1: 0f 84 74 ff ff ff    je    9075b <__isinff@plt+0x10a5b>
  907e7: 5b                  pop    %rbx
  907e8: c3                  retq 
</code>
|-
|0x90880
|
|
|<code>
  90880:      41 54                  push  %r12
  90882:      55                      push  %rbp
  90883:      53                      push  %rbx
  90884:      31 db                  xor    %ebx,%ebx
  90886:      48 81 ec 00 08 00 00    sub    $0x800,%rsp
  9088d:      e8 8e fe ff ff          callq  90720 <__isinff@plt+0x10a20>
  90892:      48 8b 2d cf dd 77 00    mov    0x77ddcf(%rip),%rbp        # 80e668 <__isinff@plt+0x78e968>8            lea    0x8(%rbp),%rdi
  9089d:      e8 1e 6f 53 00          callq  5c77c0 <__isinff@plt+0x547ac0>
  908a2:      81 bd 88 01 00 00 23    cmpl  $0xabc123,0x188(%rbp)
  908a9:      c1 ab 00
  908ac:      0f 84 16 01 00 00      je    909c8 <__isinff@plt+0x10cc8>
  908b2:      4c 8d a4 24 00 04 00    lea    0x400(%rsp),%r12
  908b9:      00
  908ba:      48 8d 3d eb 77 53 00    lea    0x5377eb(%rip),%rdi        # 5c80ac <__isinff@plt+0x5483ac>0 00          mov    $0x400,%edx
  908c6:      c6 84 24 00 04 00 00    movb  $0x0,0x400(%rsp)
  908cd:      00
  908ce:      c6 04 24 00            movb  $0x0,(%rsp)
  908d2:      4c 89 e6                mov    %r12,%rsi
  908d5:      e8 76 70 53 00          callq  5c7950 <__isinff@plt+0x547c50>
  908da:      48 8d 3d cb 76 53 00    lea    0x5376cb(%rip),%rdi        # 5c7fac <__isinff@plt+0x5482ac>              mov    %rsp,%rsi
  908e4:      ba 00 04 00 00          mov    $0x400,%edx
  908e9:      e8 62 70 53 00          callq  5c7950 <__isinff@plt+0x547c50>
  908ee:      80 3c 24 00            cmpb  $0x0,(%rsp)
  908f2:      0f 85 e8 00 00 00      jne    909e0 <__isinff@plt+0x10ce0>
  908f8:      c7 85 c0 03 00 00 00    movl  $0x0,0x3c0(%rbp)
  908ff:      00 00 00
  90902:      e8 89 6e 53 00          callq  5c7790 <__isinff@plt+0x547a90>
  90907:      48 8d bd a0 01 00 00    lea    0x1a0(%rbp),%rdi
  9090e:      31 f6                  xor    %esi,%esi
  90910:      ba 00 01 00 00          mov    $0x100,%edx
  90915:      89 85 90 04 00 00      mov    %eax,0x490(%rbp)
  9091b:      c7 85 a0 04 00 00 00    movl  $0x0,0x4a0(%rbp)
  90922:      00 00 00
  90925:      48 c7 85 98 04 00 00    movq  $0x0,0x498(%rbp)
  9092c:      00 00 00 00
  90930:      c7 85 b0 03 00 00 00    movl  $0x0,0x3b0(%rbp)
  90937:      00 00 00
  9093a:      c7 85 a0 02 00 00 00    movl  $0x0,0x2a0(%rbp)
  90941:      00 00 00
  90944:      c7 85 94 01 00 00 00    movl  $0x0,0x194(%rbp)
  9094b:      00 00 00
  9094e:      e8 3d f0 fe ff          callq  7f990 <memset@plt>
  90953:      48 8d bd c0 04 00 00    lea    0x4c0(%rbp),%rdi
  9095a:      e8 b1 c4 00 00          callq  9ce10 <__isinff@plt+0x1d110>
  9095f:      e8 cc 1e 07 00          callq  102830 <__isinff@plt+0x82b30>
  90964:      85 c0                  test  %eax,%eax
  90966:      89 c3                  mov    %eax,%ebx
  90968:      0f 84 9a 00 00 00      je    90a08 <__isinff@plt+0x10d08>
  9096e:      48 8b bd b8 03 00 00    mov    0x3b8(%rbp),%rdi
  90975:      48 85 ff                test  %rdi,%rdi
  90978:      74 10                  je    9098a <__isinff@plt+0x10c8a>
  9097a:      e8 d1 a8 00 00          callq  9b250 <__isinff@plt+0x1b550>
  9097f:      48 c7 85 b8 03 00 00    movq  $0x0,0x3b8(%rbp)
  90986:      00 00 00 00
  9098a:      85 db                  test  %ebx,%ebx
  9098c:      75 72                  jne    90a00 <__isinff@plt+0x10d00>
  9098e:      c7 85 88 01 00 00 23    movl  $0xabc123,0x188(%rbp)
  90995:      c1 ab 00
  90998:      c7 85 94 04 00 00 00    movl  $0x0,0x494(%rbp)
  9099f:      00 00 00
  909a2:      e8 79 b4 05 00          callq  ebe20 <__isinff@plt+0x6c120>
  909a7:      e8 24 b3 05 00          callq  ebcd0 <__isinff@plt+0x6bfd0>
  909ac:      84 c0                  test  %al,%al
  909ae:      0f 85 ac 00 00 00      jne    90a60 <__isinff@plt+0x10d60>
  909b4:      e8 b7 20 07 00          callq  102a70 <__isinff@plt+0x82d70>
  909b9:      31 db                  xor    %ebx,%ebx
  909bb:      e8 10 b3 05 00          callq  ebcd0 <__isinff@plt+0x6bfd0>
  909c0:      84 c0                  test  %al,%al
  909c2:      0f 85 7f 00 00 00      jne    90a47 <__isinff@plt+0x10d47>
  909c8:      48 8d 7d 08            lea    0x8(%rbp),%rdi
  909cc:      e8 df 6d 53 00          callq  5c77b0 <__isinff@plt+0x547ab0>
  909d1:      48 81 c4 00 08 00 00    add    $0x800,%rsp
  909d8:      89 d8                  mov    %ebx,%eax
  909da:      5b                      pop    %rbx
  909db:      5d                      pop    %rbp
  909dc:      41 5c                  pop    %r12
  909de:      c3                      retq 
  909df:      90                      nop
  909e0:      80 bc 24 00 04 00 00    cmpb  $0x0,0x400(%rsp)
  909e7:      00
  909e8:      0f 84 0a ff ff ff      je    908f8 <__isinff@plt+0x10bf8>
  909ee:      c7 85 c0 03 00 00 01    movl  $0x1,0x3c0(%rbp)
  909f5:      00 00 00
  909f8:      e9 05 ff ff ff          jmpq  90902 <__isinff@plt+0x10c02>
  909fd:      66 66 90                xchg  %ax,%ax
  90a00:      89 9d 88 01 00 00      mov    %ebx,0x188(%rbp)
  90a06:      eb c0                  jmp    909c8 <__isinff@plt+0x10cc8>
  90a08:      48 8b 3d 19 e5 77 00    mov    0x77e519(%rip),%rdi        # 80ef28 <__isinff@plt+0x78f228>
  90a0f:      b3 02                  mov    $0x2,%bl
  90a11:      e8 6a 6e 53 00          callq  5c7880 <__isinff@plt+0x547b80>
  90a16:      85 c0                  test  %eax,%eax
  90a18:      89 45 00                mov    %eax,0x0(%rbp)
  90a1b:      0f 84 4d ff ff ff      je    9096e <__isinff@plt+0x10c6e>
  90a21:      be 01 00 00 00          mov    $0x1,%esi
  90a26:      4c 89 e7                mov    %r12,%rdi
  90a29:      e8 a2 66 53 00          callq  5c70d0 <__isinff@plt+0x5473d0>
  90a2e:      f6 84 24 0a 04 00 00    testb  $0x8,0x40a(%rsp)
  90a35:      08
  90a36:      75 3b                  jne    90a73 <__isinff@plt+0x10d73>
  90a38:      e8 23 bc 01 00          callq  ac660 <__isinff@plt+0x2c960>
  90a3d:      e8 ce b5 05 00          callq  ec010 <__isinff@plt+0x6c310>
  90a42:      e9 47 ff ff ff          jmpq  9098e <__isinff@plt+0x10c8e>
  90a47:      48 8b 3d 0a cd 77 00    mov    0x77cd0a(%rip),%rdi        # 80d758 <__isinff@plt+0x78da58>
  90a4e:      31 f6                  xor    %esi,%esi
  90a50:      e8 8b b2 05 00          callq  ebce0 <__isinff@plt+0x6bfe0>
  90a55:      e9 6e ff ff ff          jmpq  909c8 <__isinff@plt+0x10cc8>
  90a5a:      66 66 90                xchg  %ax,%ax
  90a5d:      66 66 90                xchg  %ax,%ax
  90a60:      48 8b 3d b1 dd 77 00    mov    0x77ddb1(%rip),%rdi        # 80e818 <__isinff@plt+0x78eb18>
  90a67:      31 f6                  xor    %esi,%esi
  90a69:      e8 72 b2 05 00          callq  ebce0 <__isinff@plt+0x6bfe0>
  90a6e:      e9 41 ff ff ff          jmpq  909b4 <__isinff@plt+0x10cb4>
  90a73:      83 8d a4 04 00 00 01    orl    $0x1,0x4a4(%rbp)
  90a7a:      eb bc                  jmp    90a38 <__isinff@plt+0x10d38>
  90a7c:      66 66 66 90            xchg  %ax,%ax
  90a80:      53                      push  %rbx
  90a81:      48 8b 1d e0 db 77 00    mov    0x77dbe0(%rip),%rbx        # 80e668 <__isinff@plt+0x78e968>
  90a88:      8b 3b                  mov    (%rbx),%edi
  90a8a:      85 ff                  test  %edi,%edi
  90a8c:      75 12                  jne    90aa0 <__isinff@plt+0x10da0>
  90a8e:      c7 83 88 01 00 00 00    movl  $0x321cba00,0x188(%rbx)
  90a95:      ba 1c 32
  90a98:      5b                      pop    %rbx
  90a99:      c3                      retq
</code>
|-
|0x10a6a0
|0x18c
|cuCtxSynchronize
|
|-
|0x10a830
|0x253
|cuInit
|<code>
  10a830:      48 89 5c 24 e0          mov    %rbx,-0x20(%rsp)
  10a835:      48 89 6c 24 e8          mov    %rbp,-0x18(%rsp)
  10a83a:      89 fd                  mov    %edi,%ebp
  10a83c:      4c 89 64 24 f0          mov    %r12,-0x10(%rsp)
  10a841:      4c 89 6c 24 f8          mov    %r13,-0x8(%rsp)
  10a846:      48 81 ec 88 00 00 00    sub    $0x88,%rsp
  10a84d:      48 c7 44 24 48 00 00    movq  $0x0,0x48(%rsp)
  10a854:      00 00
  10a856:      e8 75 14 fe ff          callq  ebcd0 <__isinff@plt+0x6bfd0>
  10a85b:      84 c0                  test  %al,%al
  10a85d:      89 c3                  mov    %eax,%ebx
  10a85f:      0f 85 52 01 00 00      jne    10a9b7 <__isinff@plt+0x8acb7>
  10a865:      45 31 ed                xor    %r13d,%r13d
  10a868:      44 8b 0d a5 5f 70 00    mov    0x705fa5(%rip),%r9d        # 810814 <__isinff@plt+0x790b14>
  10a86f:      45 85 c9                test  %r9d,%r9d
  10a872:      0f 84 08 01 00 00      je    10a980 <__isinff@plt+0x8ac80>
 
// first-time initialization sequence returns to here
 
  10a878:      89 ef                  mov    %ebp,%edi
  10a87a:      e8 e1 6b f7 ff          callq  81460 <__isinff@plt+0x1760>
  10a87f:      44 8b 15 8e 5f 70 00    mov    0x705f8e(%rip),%r10d        # 810814 <__isinff@plt+0x790b14>
  10a886:      41 89 c4                mov    %eax,%r12d
  10a889:      45 85 d2                test  %r10d,%r10d
  10a88c:      0f 84 b4 00 00 00      je    10a946 <__isinff@plt+0x8ac46>
  10a892:      84 db                  test  %bl,%bl
  10a894:      0f 95 c3                setne  %bl
  10a897:      44 84 eb                test  %r13b,%bl
  10a89a:      75 24                  jne    10a8c0 <__isinff@plt+0x8abc0>
  10a89c:      44 89 e0                mov    %r12d,%eax
  10a89f:      48 8b 5c 24 68          mov    0x68(%rsp),%rbx
  10a8a4:      48 8b 6c 24 70          mov    0x70(%rsp),%rbp
  10a8a9:      4c 8b 64 24 78          mov    0x78(%rsp),%r12
  10a8ae:      4c 8b ac 24 80 00 00    mov    0x80(%rsp),%r13
  10a8b5:      00
  10a8b6:      48 81 c4 88 00 00 00    add    $0x88,%rsp
  10a8bd:      c3                      retq 
  10a8be:      66 90                  xchg  %ax,%ax
  10a8c0:      fc                      cld   
  10a8c1:      31 c0                  xor    %eax,%eax
  10a8c3:      b9 08 00 00 00          mov    $0x8,%ecx
  10a8c8:      48 89 e7                mov    %rsp,%rdi
  10a8cb:      f3 48 ab                rep stos %rax,%es:(%rdi)
  10a8ce:      4c 8b 2d 93 3d 70 00    mov    0x703d93(%rip),%r13        # 80e668 <__isinff@plt+0x78e968>
  10a8d5:      89 6c 24 50            mov    %ebp,0x50(%rsp)
  10a8d9:      48 8d 6c 24 50          lea    0x50(%rsp),%rbp
  10a8de:      41 8b 7d 00            mov    0x0(%r13),%edi
  10a8e2:      e8 79 cf 4b 00          callq  5c7860 <__isinff@plt+0x547b60>
  10a8e7:      4c 8d 1d 75 0a 4d 00    lea    0x4d0a75(%rip),%r11        # 5db363 <__isinff@plt+0x55b663>
  10a8ee:      48 89 c2                mov    %rax,%rdx
  10a8f1:      48 89 04 24            mov    %rax,(%rsp)
  10a8f5:      31 c0                  xor    %eax,%eax
  10a8f7:      48 85 d2                test  %rdx,%rdx
  10a8fa:      48 c7 44 24 08 00 00    movq  $0x0,0x8(%rsp)
  10a901:      00 00
  10a903:      c7 44 24 10 01 00 00    movl  $0x1,0x10(%rsp)
  10a90a:      00
  10a90b:      4c 89 5c 24 18          mov    %r11,0x18(%rsp)
  10a910:      48 89 6c 24 20          mov    %rbp,0x20(%rsp)
  10a915:      74 07                  je    10a91e <__isinff@plt+0x8ac1e>
  10a917:      48 8b 82 f0 03 00 00    mov    0x3f0(%rdx),%rax
  10a91e:      48 8b 74 24 48          mov    0x48(%rsp),%rsi
  10a923:      48 8b 3d 16 43 70 00    mov    0x704316(%rip),%rdi        # 80ec40 <__isinff@plt+0x78ef40>
  10a92a:      48 89 44 24 28          mov    %rax,0x28(%rsp)
  10a92f:      44 89 64 24 38          mov    %r12d,0x38(%rsp)
  10a934:      48 89 74 24 30          mov    %rsi,0x30(%rsp)
  10a939:      48 89 e6                mov    %rsp,%rsi
  10a93c:      e8 9f 13 fe ff          callq  ebce0 <__isinff@plt+0x6bfe0>
  10a941:      e9 56 ff ff ff          jmpq  10a89c <__isinff@plt+0x8ab9c>
  10a946:      48 8d 3d 8d 00 4d 00    lea    0x4d008d(%rip),%rdi        # 5da9da <__isinff@plt+0x55acda>
  10a94d:      e8 0e 4b f7 ff          callq  7f460 <getenv@plt>
  10a952:      48 85 c0                test  %rax,%rax
  10a955:      74 17                  je    10a96e <__isinff@plt+0x8ac6e>
  10a957:      31 c9                  xor    %ecx,%ecx
  10a959:      ba 0a 00 00 00          mov    $0xa,%edx
  10a95e:      31 f6                  xor    %esi,%esi
  10a960:      48 89 c7                mov    %rax,%rdi
  10a963:      e8 c8 4f f7 ff          callq  7f930 <__strtol_internal@plt>
  10a968:      89 05 aa 5e 70 00      mov    %eax,0x705eaa(%rip)        # 810818 <__isinff@plt+0x790b18>
  10a96e:      c7 05 9c 5e 70 00 01    movl  $0x1,0x705e9c(%rip)        # 810814 <__isinff@plt+0x790b14>
  10a975:      00 00 00
  10a978:      e9 15 ff ff ff          jmpq  10a892 <__isinff@plt+0x8ab92>
  10a97d:      66 66 90                xchg  %ax,%ax
 
// first-time initialization sequence.
 
  10a980:      48 8d 3d 53 00 4d 00    lea    0x4d0053(%rip),%rdi        # 5da9da <__isinff@plt+0x55acda> "CUDA_API_TRACE_PTR"
  10a987:      e8 d4 4a f7 ff          callq  7f460 <getenv@plt>
  10a98c:      48 85 c0                test  %rax,%rax
  10a98f:      74 17                  je    10a9a8 <__isinff@plt+0x8aca8>
 
// we go to 10a9a8 if CUDA_API_TRACE_PTR is unset
 
  10a991:      31 c9                  xor    %ecx,%ecx
  10a993:      ba 0a 00 00 00          mov    $0xa,%edx
  10a998:      31 f6                  xor    %esi,%esi
  10a99a:      48 89 c7                mov    %rax,%rdi
  10a99d:      e8 8e 4f f7 ff          callq  7f930 <__strtol_internal@plt>
  10a9a2:      89 05 70 5e 70 00      mov    %eax,0x705e70(%rip)        # 810818 <__isinff@plt+0x790b18>
 
// set cudaInitialized to 1
 
  10a9a8:      c7 05 62 5e 70 00 01    movl  $0x1,0x705e62(%rip)        # 810814 <__isinff@plt+0x790b14>
  10a9af:      00 00 00
  10a9b2:      e9 c1 fe ff ff          jmpq  10a878 <__isinff@plt+0x8ab78>
 
 
  10a9b7:      31 ff                  xor    %edi,%edi
  10a9b9:      e8 12 5c f8 ff          callq  905d0 <__isinff@plt+0x108d0>
  10a9be:      85 c0                  test  %eax,%eax
  10a9c0:      0f 85 9f fe ff ff      jne    10a865 <__isinff@plt+0x8ab65>
  10a9c6:      fc                      cld   
  10a9c7:      31 c0                  xor    %eax,%eax
  10a9c9:      b9 07 00 00 00          mov    $0x7,%ecx
  10a9ce:      48 89 e7                mov    %rsp,%rdi
  10a9d1:      f3 48 ab                rep stos %rax,%es:(%rdi)
  10a9d4:      48 8b 05 8d 3c 70 00    mov    0x703c8d(%rip),%rax        # 80e668 <__isinff@plt+0x78e968>
  10a9db:      89 6c 24 50            mov    %ebp,0x50(%rsp)
  10a9df:      8b 38                  mov    (%rax),%edi
  10a9e1:      e8 7a ce 4b 00          callq  5c7860 <__isinff@plt+0x547b60>
  10a9e6:      48 85 c0                test  %rax,%rax
  10a9e9:      48 89 04 24            mov    %rax,(%rsp)
  10a9ed:      74 69                  je    10aa58 <__isinff@plt+0x8ad58>
  10a9ef:      48 ff 80 f0 03 00 00    incq  0x3f0(%rax)
  10a9f6:      48 8d 54 24 50          lea    0x50(%rsp),%rdx
  10a9fb:      48 8d 35 61 09 4d 00    lea    0x4d0961(%rip),%rsi        # 5db363 <__isinff@plt+0x55b663>
  10aa02:      48 8b 04 24            mov    (%rsp),%rax
  10aa06:      48 c7 44 24 08 00 00    movq  $0x0,0x8(%rsp)
  10aa0d:      00 00
  10aa0f:      48 89 54 24 20          mov    %rdx,0x20(%rsp)
  10aa14:      31 d2                  xor    %edx,%edx
  10aa16:      c7 44 24 10 01 00 00    movl  $0x1,0x10(%rsp)
  10aa1d:      00
  10aa1e:      48 89 74 24 18          mov    %rsi,0x18(%rsp)
  10aa23:      48 85 c0                test  %rax,%rax
  10aa26:      74 07                  je    10aa2f <__isinff@plt+0x8ad2f>
  10aa28:      48 8b 90 f0 03 00 00    mov    0x3f0(%rax),%rdx
  10aa2f:      48 8b 3d ea 35 70 00    mov    0x7035ea(%rip),%rdi        # 80e020 <__isinff@plt+0x78e320>
  10aa36:      4c 8d 44 24 48          lea    0x48(%rsp),%r8
  10aa3b:      48 89 e6                mov    %rsp,%rsi
  10aa3e:      41 bd 01 00 00 00      mov    $0x1,%r13d
  10aa44:      48 89 54 24 28          mov    %rdx,0x28(%rsp)
  10aa49:      4c 89 44 24 30          mov    %r8,0x30(%rsp)
  10aa4e:      e8 8d 12 fe ff          callq  ebce0 <__isinff@plt+0x6bfe0>
  10aa53:      e9 10 fe ff ff          jmpq  10a868 <__isinff@plt+0x8ab68>
  10aa58:      4c 8d 05 04 09 4d 00    lea    0x4d0904(%rip),%r8        # 5db363 <__isinff@plt+0x55b663>
  10aa5f:      4c 8d 64 24 50          lea    0x50(%rsp),%r12
  10aa64:      31 d2                  xor    %edx,%edx
  10aa66:      48 c7 44 24 08 00 00    movq  $0x0,0x8(%rsp)
  10aa6d:      00 00
  10aa6f:      c7 44 24 10 01 00 00    movl  $0x1,0x10(%rsp)
  10aa76:      00
  10aa77:      4c 89 44 24 18          mov    %r8,0x18(%rsp)
  10aa7c:      4c 89 64 24 20          mov    %r12,0x20(%rsp)
  10aa81:      eb ac                  jmp    10aa2f <__isinff@plt+0x8ad2f>
  10aa83:      66 66 66 90            xchg  %ax,%ax
  10aa87:      66 66 90                xchg  %ax,%ax
  10aa8a:      66 66 90                xchg  %ax,%ax
  10aa8d:      66 66 90                xchg  %ax,%ax</code>
|-
|0x10aa90
|0x272
|cuGetExportTable
|
|-
|0x10ad10
|0x286
|cuGraphicsUnmapResources
|
|-
|0x10afa0
|0x286
|cuGraphicsMapResources
|
|-
|0x10b230
|0x272
|cuGraphicsResourceSetMapFlags
|
|-
|0x10b4b0
|0x28e
|cuGraphicsResourceGetMappedPointer
|
|-
|0x10b740
|0x2b2
|cuGraphicsSubResourceGetMappedArray
|
|-
|0x10ba00
|0x24d
|cuGraphicsUnregisterResource
|
|-
|0x10bc50
|0x245
|cuStreamDestroy
|
|-
|0x10bea0
|0x245
|cuStreamSynchronize
|
|-
|0x10c0f0
|0x245
|cuStreamQuery
|
|-
|0x10c340
|0x272
|cuStreamCreate
|
|-
|0x10c5c0
|0x28e
|cuEventElapsedTime
|
|-
|0x10c850
|0x24d
|cuEventDestroy
|
|-
|0x10caa0
|0x24d
|cuEventSynchronize
|
|-
|0x10ccf0
|0x24d
|cuEventQuery
|
|-
|0x10cf40
|0x261
|cuEventRecord
|
|-
|0x10d1b0
|0x272
|cuEventCreate
|
|-
|0x10d430
|0x2aa
|cuLaunchGridAsync
|
|-
|0x10d6e0
|0x28e
|cuLaunchGrid
|
|-
|0x10d970
|0x24d
|cuLaunch
|
|-
|0x10dbc0
|0x28e
|cuParamSetTexRef
|
|-
|0x10de50
|0x2b9
|cuParamSetv
|
|-
|0x10e110
|0x2b5
|cuParamSetf
|
|-
|0x10e3d0
|0x28e
|cuParamSeti
|
|-
|0x10e660
|0x272
|cuParamSetSize
|
|-
|0x10e8e0
|0x272
|cuTexRefGetFlags
|
|-
|0x10eb60
|0x28e
|cuTexRefGetFormat
|
|-
|0x10edf0
|0x272
|cuTexRefGetFilterMode
|
|-
|0x10f070
|0x28e
|cuTexRefGetAddressMode
|
|-
|0x10f300
|0x272
|cuTexRefGetArray
|
|-
|0x10f580
|0x272
|cuTexRefGetAddress
|
|-
|0x10f800
|0x272
|cuTexRefSetFlags
|
|-
|0x10fa80
|0x272
|cuTexRefSetFilterMode
|
|-
|0x10fd00
|0x28e
|cuTexRefSetAddressMode
|
|-
|0x10ff90
|0x28e
|cuTexRefSetFormat
|
|-
|0x11a0d0
|0x28e
|cuCtxCreate
|
|-
|0x11a360
|0x28e
|cuDeviceGetAttribute
|
|-
|0x11a5f0
|0x272
|cuDeviceGetProperties
|
|-
|0x11a870
|0x272
|cuDeviceTotalMem
|
|-
|0x11aaf0
|0x28e
|cuDeviceComputeCapability
|
|-
|0x11ad80
|0x28e
|cuDeviceGetName
|
|-
|0x11b010
|0x24d
|cuDeviceGetCount
|<code>
  11b010:      48 89 5c 24 e0          mov    %rbx,-0x20(%rsp)
  11b015:      48 89 6c 24 e8          mov    %rbp,-0x18(%rsp)
  11b01a:      48 89 fd                mov    %rdi,%rbp
  11b01d:      4c 89 64 24 f0          mov    %r12,-0x10(%rsp)
  11b022:      4c 89 6c 24 f8          mov    %r13,-0x8(%rsp)
  11b027:      48 83 ec 78            sub    $0x78,%rsp
  11b02b:      48 c7 44 24 48 00 00    movq  $0x0,0x48(%rsp)
  11b032:      00 00
  11b034:      e8 97 0c fd ff          callq  ebcd0 <__isinff@plt+0x6bfd0>
  11b039:      84 c0                  test  %al,%al
  11b03b:      89 c3                  mov    %eax,%ebx
  11b03d:      0f 85 4d 01 00 00      jne    11b190 <__isinff@plt+0x9b490>
  11b043:      45 31 ed                xor    %r13d,%r13d
  11b046:      44 8b 0d c7 57 6f 00    mov    0x6f57c7(%rip),%r9d        # 810814 <__isinff@plt+0x790b14>
  11b04d:      45 85 c9                test  %r9d,%r9d
  11b050:      0f 84 01 01 00 00      je    11b157 <__isinff@plt+0x9b457>
  11b056:      48 89 ef                mov    %rbp,%rdi
 
// Perform the basic driver-initialization checks
 
  11b059:      e8 42 5b f6 ff          callq  80ba0 <__isinff@plt+0xea0>
  11b05e:      44 8b 15 af 57 6f 00    mov    0x6f57af(%rip),%r10d        # 810814 <__isinff@plt+0x790b14>
  11b065:      41 89 c4                mov    %eax,%r12d
  11b068:      45 85 d2                test  %r10d,%r10d
  11b06b:      0f 84 af 00 00 00      je    11b120 <__isinff@plt+0x9b420>
  11b071:      84 db                  test  %bl,%bl
  11b073:      0f 95 c3                setne  %bl
  11b076:      44 84 eb                test  %r13b,%bl
  11b079:      75 1c                  jne    11b097 <__isinff@plt+0x9b397>
  11b07b:      44 89 e0                mov    %r12d,%eax
  11b07e:      48 8b 5c 24 58          mov    0x58(%rsp),%rbx
  11b083:      48 8b 6c 24 60          mov    0x60(%rsp),%rbp
  11b088:      4c 8b 64 24 68          mov    0x68(%rsp),%r12
  11b08d:      4c 8b 6c 24 70          mov    0x70(%rsp),%r13
  11b092:      48 83 c4 78            add    $0x78,%rsp
  11b096:      c3                      retq
 
// handle weird case
 
  11b097:      fc                      cld   
  11b098:      31 c0                  xor    %eax,%eax
  11b09a:      b9 08 00 00 00          mov    $0x8,%ecx
  11b09f:      48 89 e7                mov    %rsp,%rdi
  11b0a2:      f3 48 ab                rep stos %rax,%es:(%rdi)
  11b0a5:      4c 8b 2d bc 35 6f 00    mov    0x6f35bc(%rip),%r13        # 80e668 <__isinff@plt+0x78e968>
  11b0ac:      48 89 6c 24 40          mov    %rbp,0x40(%rsp)
  11b0b1:      48 8d 6c 24 40          lea    0x40(%rsp),%rbp
  11b0b6:      41 8b 7d 00            mov    0x0(%r13),%edi
  11b0ba:      e8 a1 c7 4a 00          callq  5c7860 <__isinff@plt+0x547b60>
  11b0bf:      4c 8d 1d 6a 02 4c 00    lea    0x4c026a(%rip),%r11        # 5db330 <__isinff@plt+0x55b630>
  11b0c6:      48 89 c2                mov    %rax,%rdx
  11b0c9:      48 89 04 24            mov    %rax,(%rsp)
  11b0cd:      31 c0                  xor    %eax,%eax
  11b0cf:      48 85 d2                test  %rdx,%rdx
  11b0d2:      48 c7 44 24 08 00 00    movq  $0x0,0x8(%rsp)
  11b0d9:      00 00
  11b0db:      c7 44 24 10 04 00 00    movl  $0x4,0x10(%rsp)
  11b0e2:      00
  11b0e3:      4c 89 5c 24 18          mov    %r11,0x18(%rsp)
  11b0e8:      48 89 6c 24 20          mov    %rbp,0x20(%rsp)
  11b0ed:      74 07                  je    11b0f6 <__isinff@plt+0x9b3f6>
  11b0ef:      48 8b 82 f0 03 00 00    mov    0x3f0(%rdx),%rax
  11b0f6:      48 8b 74 24 48          mov    0x48(%rsp),%rsi
  11b0fb:      48 8b 3d 3e 3b 6f 00    mov    0x6f3b3e(%rip),%rdi        # 80ec40 <__isinff@plt+0x78ef40>
  11b102:      48 89 44 24 28          mov    %rax,0x28(%rsp)
  11b107:      44 89 64 24 38          mov    %r12d,0x38(%rsp)
  11b10c:      48 89 74 24 30          mov    %rsi,0x30(%rsp)
  11b111:      48 89 e6                mov    %rsp,%rsi
  11b114:      e8 c7 0b fd ff          callq  ebce0 <__isinff@plt+0x6bfe0>
  11b119:      e9 5d ff ff ff          jmpq  11b07b <__isinff@plt+0x9b37b>
  11b11e:      66 90                  xchg  %ax,%ax
 
// Handler for no-context case
 
  11b120:      48 8d 3d b3 f8 4b 00    lea    0x4bf8b3(%rip),%rdi        # 5da9da <__isinff@plt+0x55acda>
  11b127:      e8 34 43 f6 ff          callq  7f460 <getenv@plt>
  11b12c:      48 85 c0                test  %rax,%rax
  11b12f:      74 17                  je    11b148 <__isinff@plt+0x9b448>
  11b131:      31 c9                  xor    %ecx,%ecx
  11b133:      ba 0a 00 00 00          mov    $0xa,%edx
  11b138:      31 f6                  xor    %esi,%esi
  11b13a:      48 89 c7                mov    %rax,%rdi
  11b13d:      e8 ee 47 f6 ff          callq  7f930 <__strtol_internal@plt>
  11b142:      89 05 d0 56 6f 00      mov    %eax,0x6f56d0(%rip)        # 810818 <__isinff@plt+0x790b18>
  11b148:      c7 05 c2 56 6f 00 01    movl  $0x1,0x6f56c2(%rip)        # 810814 <__isinff@plt+0x790b14>
  11b14f:      00 00 00
  11b152:      e9 1a ff ff ff          jmpq  11b071 <__isinff@plt+0x9b371>
  11b157:      48 8d 3d 7c f8 4b 00    lea    0x4bf87c(%rip),%rdi        # 5da9da <__isinff@plt+0x55acda>
  11b15e:      e8 fd 42 f6 ff          callq  7f460 <getenv@plt>
  11b163:      48 85 c0                test  %rax,%rax
  11b166:      74 17                  je    11b17f <__isinff@plt+0x9b47f>
  11b168:      31 c9                  xor    %ecx,%ecx
  11b16a:      ba 0a 00 00 00          mov    $0xa,%edx
  11b16f:      31 f6                  xor    %esi,%esi
  11b171:      48 89 c7                mov    %rax,%rdi
  11b174:      e8 b7 47 f6 ff          callq  7f930 <__strtol_internal@plt>
  11b179:      89 05 99 56 6f 00      mov    %eax,0x6f5699(%rip)        # 810818 <__isinff@plt+0x790b18>
  11b17f:      c7 05 8b 56 6f 00 01    movl  $0x1,0x6f568b(%rip)        # 810814 <__isinff@plt+0x790b14>
  11b186:      00 00 00
  11b189:      e9 c8 fe ff ff          jmpq  11b056 <__isinff@plt+0x9b356>
  11b18e:      66 90                  xchg  %ax,%ax
  11b190:      31 ff                  xor    %edi,%edi
  11b192:      e8 39 54 f7 ff          callq  905d0 <__isinff@plt+0x108d0>
  11b197:      85 c0                  test  %eax,%eax
  11b199:      0f 85 a4 fe ff ff      jne    11b043 <__isinff@plt+0x9b343>
  11b19f:      fc                      cld   
  11b1a0:      31 c0                  xor    %eax,%eax
  11b1a2:      b9 07 00 00 00          mov    $0x7,%ecx
  11b1a7:      48 89 e7                mov    %rsp,%rdi
  11b1aa:      f3 48 ab                rep stos %rax,%es:(%rdi)
  11b1ad:      48 8b 05 b4 34 6f 00    mov    0x6f34b4(%rip),%rax        # 80e668 <__isinff@plt+0x78e968>
  11b1b4:      48 89 6c 24 40          mov    %rbp,0x40(%rsp)
  11b1b9:      8b 38                  mov    (%rax),%edi
  11b1bb:      e8 a0 c6 4a 00          callq  5c7860 <__isinff@plt+0x547b60>
  11b1c0:      48 85 c0                test  %rax,%rax
  11b1c3:      48 89 04 24            mov    %rax,(%rsp)
  11b1c7:      74 69                  je    11b232 <__isinff@plt+0x9b532>
  11b1c9:      48 ff 80 f0 03 00 00    incq  0x3f0(%rax)
  11b1d0:      48 8d 54 24 40          lea    0x40(%rsp),%rdx
  11b1d5:      48 8d 35 54 01 4c 00    lea    0x4c0154(%rip),%rsi        # 5db330 <__isinff@plt+0x55b630>
  11b1dc:      48 8b 04 24            mov    (%rsp),%rax
  11b1e0:      48 c7 44 24 08 00 00    movq  $0x0,0x8(%rsp)
  11b1e7:      00 00
  11b1e9:      48 89 54 24 20          mov    %rdx,0x20(%rsp)
  11b1ee:      31 d2                  xor    %edx,%edx
  11b1f0:      c7 44 24 10 04 00 00    movl  $0x4,0x10(%rsp)
  11b1f7:      00
  11b1f8:      48 89 74 24 18          mov    %rsi,0x18(%rsp)
  11b1fd:      48 85 c0                test  %rax,%rax
  11b200:      74 07                  je    11b209 <__isinff@plt+0x9b509>
  11b202:      48 8b 90 f0 03 00 00    mov    0x3f0(%rax),%rdx
  11b209:      48 8b 3d 10 2e 6f 00    mov    0x6f2e10(%rip),%rdi        # 80e020 <__isinff@plt+0x78e320>
  11b210:      4c 8d 44 24 48          lea    0x48(%rsp),%r8
  11b215:      48 89 e6                mov    %rsp,%rsi
  11b218:      41 bd 01 00 00 00      mov    $0x1,%r13d
  11b21e:      48 89 54 24 28          mov    %rdx,0x28(%rsp)
  11b223:      4c 89 44 24 30          mov    %r8,0x30(%rsp)
  11b228:      e8 b3 0a fd ff          callq  ebce0 <__isinff@plt+0x6bfe0>
  11b22d:      e9 14 fe ff ff          jmpq  11b046 <__isinff@plt+0x9b346>
  11b232:      4c 8d 05 f7 00 4c 00    lea    0x4c00f7(%rip),%r8        # 5db330 <__isinff@plt+0x55b630>
  11b239:      4c 8d 64 24 40          lea    0x40(%rsp),%r12
  11b23e:      31 d2                  xor    %edx,%edx
  11b240:      48 c7 44 24 08 00 00    movq  $0x0,0x8(%rsp)
  11b247:      00 00
  11b249:      c7 44 24 10 04 00 00    movl  $0x4,0x10(%rsp)
  11b250:      00
  11b251:      4c 89 44 24 18          mov    %r8,0x18(%rsp)
  11b256:      4c 89 64 24 20          mov    %r12,0x20(%rsp)
  11b25b:      eb ac                  jmp    11b209 <__isinff@plt+0x9b509>
  11b25d:      66 66 90                xchg  %ax,%ax
  11b260:      48 89 5c 24 d8          mov    %rbx,-0x28(%rsp)
  11b265:      48 89 6c 24 e0          mov    %rbp,-0x20(%rsp)
  11b26a:      48 89 fd                mov    %rdi,%rbp
  11b26d:      4c 89 64 24 e8          mov    %r12,-0x18(%rsp)
  11b272:      4c 89 6c 24 f0          mov    %r13,-0x10(%rsp)
  11b277:      41 89 f4                mov    %esi,%r12d
  11b27a:      4c 89 74 24 f8          mov    %r14,-0x8(%rsp)
  11b27f:      48 81 ec 88 00 00 00    sub    $0x88,%rsp
  11b286:      48 c7 44 24 58 00 00    movq  $0x0,0x58(%rsp)
  11b28d:      00 00
  11b28f:      e8 3c 0a fd ff          callq  ebcd0 <__isinff@plt+0x6bfd0>
  11b294:      84 c0                  test  %al,%al
  11b296:      89 c3                  mov    %eax,%ebx
  11b298:      0f 85 62 01 00 00      jne    11b400 <__isinff@plt+0x9b700>
  11b29e:      45 31 f6                xor    %r14d,%r14d
  11b2a1:      44 8b 0d 6c 55 6f 00    mov    0x6f556c(%rip),%r9d        # 810814 <__isinff@plt+0x790b14>
  11b2a8:      45 85 c9                test  %r9d,%r9d
  11b2ab:      0f 84 16 01 00 00      je    11b3c7 <__isinff@plt+0x9b6c7>
  11b2b1:      44 89 e6                mov    %r12d,%esi
  11b2b4:      48 89 ef                mov    %rbp,%rdi
  11b2b7:      e8 34 5b f6 ff          callq  80df0 <__isinff@plt+0x10f0>
  11b2bc:      44 8b 15 51 55 6f 00    mov    0x6f5551(%rip),%r10d        # 810814 <__isinff@plt+0x790b14>
  11b2c3:      41 89 c5                mov    %eax,%r13d
  11b2c6:      45 85 d2                test  %r10d,%r10d
  11b2c9:      0f 84 c1 00 00 00      je    11b390 <__isinff@plt+0x9b690>
  11b2cf:      84 db                  test  %bl,%bl
  11b2d1:      0f 95 c3                setne  %bl
  11b2d4:      41 84 de                test  %bl,%r14b
  11b2d7:      75 27                  jne    11b300 <__isinff@plt+0x9b600>
  11b2d9:      44 89 e8                mov    %r13d,%eax
  11b2dc:      48 8b 5c 24 60          mov    0x60(%rsp),%rbx
  11b2e1:      48 8b 6c 24 68          mov    0x68(%rsp),%rbp
  11b2e6:      4c 8b 64 24 70          mov    0x70(%rsp),%r12
  11b2eb:      4c 8b 6c 24 78          mov    0x78(%rsp),%r13
  11b2f0:      4c 8b b4 24 80 00 00    mov    0x80(%rsp),%r14
  11b2f7:      00
  11b2f8:      48 81 c4 88 00 00 00    add    $0x88,%rsp
  11b2ff:      c3                      retq 
  11b300:      fc                      cld   
  11b301:      31 c0                  xor    %eax,%eax
  11b303:      b9 08 00 00 00          mov    $0x8,%ecx
  11b308:      48 89 e7                mov    %rsp,%rdi
  11b228:      e8 b3 0a fd ff          callq  ebce0 <__isinff@plt+0x6bfe0>
  11b22d:      e9 14 fe ff ff          jmpq  11b046 <__isinff@plt+0x9b346>
  11b232:      4c 8d 05 f7 00 4c 00    lea    0x4c00f7(%rip),%r8        # 5db330 <__isinff@plt+0x55b630>24 40          lea    0x40(%rsp),%r12
  11b23e:      31 d2                  xor    %edx,%edx
  11b240:      48 c7 44 24 08 00 00    movq  $0x0,0x8(%rsp)
  11b247:      00 00
  11b249:      c7 44 24 10 04 00 00    movl  $0x4,0x10(%rsp)
  11b250:      00
  11b251:      4c 89 44 24 18          mov    %r8,0x18(%rsp)
  11b256:      4c 89 64 24 20          mov    %r12,0x20(%rsp)
  11b25b:      eb ac                  jmp    11b209 <__isinff@plt+0x9b509></code>
|-
|0x11b260
|0x272
|cuDeviceGet
|
|-
|0x11b4e0
|0x24d
|cuDriverGetVersion
|
|-
|0x11b730
|0x18c
|cuGLInit
|
|-
|0x11b8c0
|0x28e
|cuGLCtxCreate
|
|-
|0x11bb50
|0x261
|cuGLUnmapBufferObjectAsync
|
|-
|0x11bdc0
|0x2aa
|cuGLMapBufferObjectAsync
|
|-
|0x11c070
|0x261
|cuGLSetBufferObjectMapFlags
|
|-
|0x11c2e0
|0x253
|cuGLUnregisterBufferObject
|
|-
|0x11c540
|0x253
|cuGLUnmapBufferObject
|
|-
|0x11c7a0
|0x28e
|cuGLMapBufferObject
|
|-
|0x11ca30
|0x253
|cuGLRegisterBufferObject
|
|-
|0x11cc90
|0x2b2
|cuGraphicsGLRegisterImage
|
|-
|0x11cf50
|0x28e
|cuGraphicsGLRegisterBuffer
|
|-
|0x81ef0
|0x5f
|cuMemGetAttribute
|
|-
|0x110a30
|0x24d
|cuTexRefDestroy
|
|-
|0x110c80
|0x24d
|cuTexRefCreate
|
|-
|0x110ed0
|0x272
|cuArray3DGetDescriptor
|
|-
|0x111b20
|0x272
|cuFuncSetCacheConfig
|
|-
|0x111da0
|0x28e
|cuFuncGetAttribute
|
|-
|0x112b30
|0x2d5
|cuMemsetD2D8
|
|-
|0x112e10
|0x28d
|cuMemsetD32
|
|-
|0x113ac0
|0x2cc
|cuMemcpyAtoHAsync
|
|-
|0x113d90
|0x2cc
|cuMemcpyHtoAAsync
|
|-
|0x114ac0
|0x24d
|cuMemcpy2DUnaligned
|
|-
|-
|0x114d10
! COLSPAN="3" style="background:#efefef;" | 0x5c000002 (per-device)
|0x24d
|cuMemcpy2D
|
|-
|-
|0x114f60
| 0x20800110
|0x2d4
| 0x84
|cuMemcpyAtoA
|
|-
|0x115a80
|0x2b2
|cuMemcpyDtoA
|
|-
|0x115d40
|0x28d
|cuMemcpyDtoD
|
|-
|0x115fd0
|0x28e
|cuMemcpyDtoH
|
|-
|0x116a00
|0x28e
|cuMemHostAlloc
|
|-
|0x116c90
|0x24d
|cuMemFreeHost
|
|-
|0x116ee0
|0x272
|cuMemAllocHost
|
|-
|0x117bb0
|0x272
|cuMemGetInfo
|
|-
|0x117e30
|0x28e
|cuModuleGetTexRef
|
|-
|0x118ae0
|0x2d4
|cuModuleLoadDataEx
|
|-
|0x118dc0
|0x272
|cuModuleLoadData
|
|-
|0x119c00
|0x272
|cuCtxAttach
|
|-
|0x119e80
|0x24d
|cuCtxDestroy
|
|-
|0x1104e0
|0x2b2
|cuTexRefSetAddress
|
|-
|0x1107a0
|0x28e
|cuTexRefSetArray
|
|-
|0x1113d0
|0x24d
|cuArrayDestroy
|
|-
|0x1118a0
|0x272
|cuArrayCreate
|
|-
|0x1122b0
|0x2b2
|cuFuncSetBlockShape
|
|-
|0x1130a0
|0x29d
|cuMemsetD16
|
|-
|0x1135e0
|0x261
|cuMemcpy3DAsync
|
|-
|0x1145c0
|0x2aa
|cuMemcpyHtoDAsync
|
|-
|0x1157c0
|0x2b1
|cuMemcpyAtoD
|
|-
|0x1164f0
|0x272
|cuMemHostGetFlags
|
|-
|0x1173f0
|0x253
|cuMemFree
|
|-
|0x1180c0
|0x2b9
|cuModuleGetGlobal
|
|-
|0x1192c0
|0x24d
|cuCtxGetDevice
|
|-
|0x1199b0
|0x24d
|cuCtxDetach
|
|-
|0x102120
|0x119
|clGetExtensionFunctionAddress
|
|-
|0x110220
|0x2b2
|cuTexRefSetAddress2D
|
|-
|0x111150
|0x272
|cuArray3DCreate
|
|-
|0x111620
|0x272
|cuArrayGetDescriptor
|
|-
|0x112030
|0x272
|cuFuncSetSharedSize
|
|-
|0x112570
|0x2d3
|cuMemsetD2D32
|
|-
|0x112850
|0x2d5
|cuMemsetD2D16
|
|-
|0x113340
|0x29c
|cuMemsetD8
|
|-
|0x113850
|0x261
|cuMemcpy2DAsync
|
|-
|0x114060
|0x2aa
|cuMemcpyDtoDAsync
|
|-
|0x114310
|0x2aa
|cuMemcpyDtoHAsync
|
|-
|0x114870
|0x24d
|cuMemcpy3D
|
|-
|0x115240
|0x2b2
|cuMemcpyAtoH
|
|-
|0x115500
|0x2b9
|cuMemcpyHtoA
|
|-
|0x116260
|0x28d
|cuMemcpyHtoD
|
|-
|0x116770
|0x28e
|cuMemHostGetDevicePointer
|
|-
|0x117160
|0x28e
|cuMemGetAddressRange
|
|-
|0x117650
|0x2d4
|cuMemAllocPitch
|
|-
|0x117930
|0x272
|cuMemAlloc
|
|-
|0x118380
|0x28e
|cuModuleGetFunction
|
|-
|0x118610
|0x24d
|cuModuleUnload
|
|-
|0x118860
|0x272
|cuModuleLoadFatBinary
|
|-
|0x119040
|0x272
|cuModuleLoad
|
|-
|0x119510
|0x24d
|cuCtxPopCurrent
|
|-
|0x119760
|0x24d
|cuCtxPushCurrent
|
|
* Retrieves device name:
<pre>RESULT: 0 0xc1d04277 0x5c000002 0x20800110 0x00000000
0x0010 0x73be4970 0x00007fff 0x00000084 0x00000000
GPU method 0x5c000002:20800110 0x00000000 0x6f466547 0x20656372 0x20535447
0x0010 0x4d303633 0x00000000 0x00000000 0x00000000 </pre>
* 6f46654720656372205354474d303633 == "oFeG ecr STGM063"
|-
|-
|}
|}


 
==disassembly==
These disassemblies makes use of <tt>libcuda.so.195.36.15</tt> (0867d66be617faab3782fa0ba19ec9ba, 7404990 bytes). Symbols were extracted via <tt>objdump -T</tt>.
* AMD64 ABI:
** Integer arguments via RDI, RSI, RDX, RCX, R8 and R9, then stack
** FP arguments in XMM0..XMM7, then stack
** Return value in RAX
** [[libcuda traces]]


==See Also==
==See Also==

Latest revision as of 22:18, 22 August 2011

Reverse engineering of the CUDA system. CUDA primarily communicates with the NVIDIA closed-source driver via several dozen undocumented ioctl()s. My open source implementation, libcudest, is located at GitHub. Sundry utilities for reverse engineering are also within this repository, though recent modifications to valgrind-mmt have rather superseded my tools.

libcudest began as a project for Hyesoon Kim's CS4803DGC at the Georgia Institute of Technology.

Driver versions

Newer drivers can be used with older CUDA versions, but the converse is not true. The "CUDA macroversion" listed below is the first CUDA release designed explicitly for use with the listed drivers.

Version CUDA macroversion Notes
195.36.15 3.0
195.36.24 3.0
195.36.31 3.0
256.22 3.1-beta
256.29 3.1-beta
256.35 3.1-beta

CUDA Environment variables

Discovered via binary analysis and a shimmed getenv(3). Effects determined via blackbox and binary analyses:

Variable Notes Documented? Effects
__RM_NO_VERSION_CHECK N Also checked by nvidia-smi
COMPUTE_PROFILE Y If set to 1, profiling will be performed. Implies CUDA_LAUNCH_BLOCKING.
COMPUTE_PROFILE_CONFIG Y Specifies a profiler configuration file. Only checked if COMPUTE_PROFILE is set.
COMPUTE_PROFILE_CSV Y If set to 1, a profiling data will be written in CSV format. Only checked if COMPUTE_PROFILE is set.
COMPUTE_PROFILE_LOG Y Specifies profiler output file (default: "./cuda_profile.log"). Only checked if COMPUTE_PROFILE is set.
CUDA_AMODEL_DLL N
CUDA_AMODEL_GPU N
CUDA_API_TRACE_PTR N
CUDA_CACHE_DISABLE Y If this is unset, the code cache will be used.
CUDA_CACHE_MAXSIZE Y
CUDA_CACHE_PATH Y If this is set, it overrides the code cache's default path of $HOME/.nv/ComputeCache
CUDA_DEVCODE_CACHE Y PTX compilation cache.
CUDA_DEVCODE_PATH Y Search path for fat binaries.
CUDA_EMULATION_MODE
CUDA_FORCE_PTX_JIT
CUDA_HEAP_RANGE Checked each time a context is created
CUDA_INJECTION64_PATH
CUDA_LAUNCH_BLOCKING Y (CUDA 3.0 Programmer's Guide, 3.2.6.1) Forces synchronization of host threads on GPU kernels.
CUDA_MEMCHECK Checked each time a context is created
CUDA_MEMORY_LOG Checked each time a context is created
CUDA_VISIBLE_DEVICES

Maps

Ordered from highest to lowest locations in x86 memory. These are architecture-, and to a lesser degree driver- and kernel version-specific. Applications and libraries can of course create many more maps than these.

  • vsyscalls. read-execute-private, very few pages, topmost area of memory, usually highest mapping
  • VDSO. read-execute-private, one page, high in memory (SYSENTER/SYSEXIT)
  • Userspace stack. read-write-private, many pages, high in memory
  • Anonymous map, 3 read-write-private pages, high in memory.
    • Possibly associated with nvidia driver's NV_STACK_SIZE stack. read-write-private, (3 * 4096 on amd64, 2 * 4096 on i686)
  • Two sets of /dev/nvidiaX maps for each bound device. Sets are usually continguous, and contain:
    • an anonymous page, read-write-private
    • several mappings of the device, having variable number of pages, all read-write-shared
  • Libraries. variable, middle of memory.
  • Userspace heap. read-write-private, many pages, low in memory
  • Application (data region). read-write-private, variable, low in memory
  • Application (text region). read-execute-private, variable, usually lowest mapping

mmap()s

offset size notes Nouveau name block range
reg_addr + 0x0000 0x2000 not mapped by libcuda PMC functional block 0x000000--0x001fff
reg_addr + 0x9000 0x1000 [Rwxs] mapped in cuInit(). first mapping. per-device. PTIMER functional block 0x009000--0x009fff
reg_addr + 0xc0a000 / 0xc0c000 0x1000 [RWxs] location is acquired from ioctl 4e PFIFO command submission interface 0xc00000--0xcfffff

ioctls

An ioctl (on x86) is 32 bits. The following definition comes from linux/asm-generic/ioctl.h in a 2.6.34 kernel:

  • Bit 31: Read?
  • Bit 30: Write?
  • Bits 29-16: Parameter size
  • Bits 15-8: Type (module)
  • Bits 7-0: Number (command)

Looking at the source of the 195.36.15 kernel driver's OS interface, we see that NVIDIA uses the standard ioctl-creation macros from ioctl.h, and can be expected to adhere to this format. The type code used (NV_IOCTL_MAGIC) is 'F' (0x46), which overlaps with the framebuffer ioctl range as registered in 2.6.34. We further see that only _IOWR() is used to declare ioctls, implying that the first two bits will always be '11'. Both of these deductions are borne out observing strace output of a CUDA process.

Code Param size Param location(s) Driver API call sites Notes
/dev/nvidiactl
0xc8

NV_ESC_CARD_INFO

0x600 (1536) anonymous page cuInit
  • Largest parameter by far.
    • Possibly scaled? Shifted 3 bits left, this is 0x3000, the size of the amd64 anonymous mapping.
    • More likely we support returning up to 32x 48-byte descriptors, and...
  • Wants the first 32 bits to be 1, all others 0.
    • ...this is most likely a mask indicating which card IDs we want information for!
typedef struct nv_ioctl_card_info
{
    NvU16    flags;               /* see below                   */
    NvU8     bus;                 /* bus number (PCI, AGP, etc)  */
    NvU8     slot;                /* card slot                   */
    NvU16    vendor_id;           /* PCI vendor id               */
    NvU16    device_id;
    NvU16    interrupt_line;
    NvU64    reg_address    NV_ALIGN_BYTES(8);
    NvU64    reg_size       NV_ALIGN_BYTES(8);
    NvU64    fb_address     NV_ALIGN_BYTES(8);
    NvU64    fb_size        NV_ALIGN_BYTES(8);
} nv_ioctl_card_info_t;
  • Returns (all subsequent bytes are 0):
0x00010001	0x0cb110de	0x00000026	0x00000000
0xf2000000	0x00000000	0x01000000	0x00000000
0xe0000000	0x00000000	0x10000000	0x00000000
  • 0x0001: flag (NV_IOCTL_CARD_INFO_FLAG_PRESENT)
  • 0x0001: bus/slot
  • 0x0cb110de: vendor + device IDs
    • lspci -n: 01:00.0 0300: 10de:0cb1 (rev a2)
    • lspci -t -v: \-[0000:00]-+-03.0-[01]--+-00.0 nVidia Corporation GT215 [GeForce GTS 360M]
  • 0x26: IRQ line (here, #38)
  • 0xf2000000 00000000: reg_address
  • 0x01000000 00000000: reg_size
  • 0xe0000000 00000000: fb_address
  • 0x10000000 00000000: fb_size
    • these are all system memory references, see /proc/iomem:
  e0000000-f30fffff : PCI Bus 0000:01
    e0000000-efffffff : 0000:01:00.0
    f0000000-f1ffffff : 0000:01:00.0
    f2000000-f2ffffff : 0000:01:00.0
      f2000000-f2ffffff : nvidia
    f3000000-f307ffff : 0000:01:00.0
    f3080000-f3083fff : 0000:01:00.1
      f3080000-f3083fff : ICH HD audio
0xca

NV_ESC_ENV_INFO

0x004 anonymous page cuInit
  • Seems to ignore input value.
  • Writes result value (0x00000001).
typedef struct nv_ioctl_env_info
{
    NvU32 pat_supported;
} nv_ioctl_env_info_t;
0xce

NV_ESC_ALLOC_OS_EVENT

0x14
0xcf

NV_ESC_FREE_OS_EVENT

0xd1

NV_ESC_STATUS_CODE

0xd2

NV_ESC_CHECK_VERSION_STR

0x048 stack cuInit
  • Performed immediately following opening of the nvidiactl device
typedef struct nv_ioctl_rm_api_version
{
    NvU32 cmd;
    NvU32 reply;
    char versionString[NV_RM_API_VERSION_STRING_LENGTH];
} nv_ioctl_rm_api_version_t;

#define NV_RM_API_VERSION_CMD_STRICT         0
#define NV_RM_API_VERSION_CMD_RELAXED       '1'
#define NV_RM_API_VERSION_CMD_OVERRIDE      '2'

#define NV_RM_API_VERSION_REPLY_UNRECOGNIZED 0
#define NV_RM_API_VERSION_REPLY_RECOGNIZED   1
  • 0x312e 3633 2e35 3931 35ull == 195.36.15
    • '1' '.' '6' '3' '.' '5' '9' '1', '5'
    • looks like: all version chars in ascii. first 8 reversed, then any left follow?
  • All other bytes are 0.
  • Writes result to first 8 bytes (0x00000001), leaves others untouched
0x22 0x00c stack cuInit
  • Inputs set to 0.
  • Outputs (example):
3251635025	65	0
  • First value is used as first input word to the majority of subsequent ioctls
  • Second value ranges over (at least) 41--65...
  • Not sent in 256.22/3.10...
0x2a 0x020 stack cuInit
  • GPU method invocation. Second and third words specify the method being called. Fifth and sixth specify the address being passed; seventh and eighth the size thereof.

Sample inputs:

0x7fffffffd310:	3251635025	3251635025	533	0
0x7fffffffd320:	4294955888	32767	132	0
  • First and second words are *not* always equivalent.
  • Outputs are usually unchanged, but not always:
ioctl 2a, 32-byte param, fd 3	0xc1d04214 0x5c000002 0x2080012f 0x00000000 
0x0010				0x950713f0 0x00007fff 0x000000a8 0x00000000 
GPU method 0x5c000002:2080012f	0x00000000 0x00000000 0x00000000 0x00000000 
0x0010				0x00000000 0x00000000 0x00000000 0x00000000 
0x0020				0x00000000 0x00000000 0x00000000 0x00000000 
0x0030				0x00000000 0x00000000 0x00000000 0x00000000 
0x0040				0x00000000 0x00000000 0x00000000 0x00000000 
0x0050				0x00000000 0x00000000 0x00000000 0x00000000 
0x0060				0x00000000 0x00000000 0x00000000 0x00000000 
0x0070				0x00000000 0x00000000 0x00000000 0x00000000 
0x0080				0x00000000 0x00000000 0x00000000 0x00000000 
0x0090				0x00000000 0x00000000 0x00000000 0x00000000 
0x00a0				0x00000000 0x00000000 
RESULT: 0			0xc1d04214 0x5c000002 0x2080012f 0x00000000 
0x0010				0x950713f0 0x00007fff 0x000000a8 0x00000029 
GPU method 0x5c000002:2080012f	**************MODIFICATION FROM CALL
0x00000000 0x00000000 0x00000000 0x00000000 
0x0010				0x00000000 0x00000000 0x00000000 0x00000000 
0x0020				0x00000000 0x00000000 0x00000000 0x00000000 
0x0030				0x00000000 0x00000000 0x00000000 0x00000000 
0x0040				0x00000000 0x00000000 0x00000000 0x00000000 
0x0050				0x00000000 0x00000000 0x00000000 0x00000000 
0x0060				0x00000000 0x00000000 0x00000000 0x00000000 
0x0070				0x00000000 0x00000000 0x00000000 0x00000000 
0x0080				0x00000000 0x00000000 0x00000000 0x00000000 
0x0090				0x00000000 0x00000000 0x00000000 0x00000000 
0x00a0				0x00000000 0x00000000 
0x2b 0x020 stack cuInit
  • GPU object creation(?)
0x4d 0x048 stack cuInit
  • Performed following opening of nvidiaX device
0x2d 0x014 stack cuInit
  • Performed following read of /proc/interrupts
0x4e 0x030 cuInit
  • Immediately prior to first mmap()
0x4f 0x020 cuInit
  • Invoked if mmap() returns MAP_FAILED, prior to failing out
0x54 0x30
0x57 0x038
0x58 0x28
0x59 0x10
/dev/nvidiaX
0x32 0x014 stack cuInit
  • Performed several times in succession
0x37 0x020 stack cuInit
  • Follows burst of 3x 0x32's, then interwoven with bursts of 2a's

GPU methods

Code Param size Notes
0x5c000002 (per-device)
0x20800110 0x84
  • Retrieves device name:
RESULT: 0			0xc1d04277 0x5c000002 0x20800110 0x00000000 
0x0010				0x73be4970 0x00007fff 0x00000084 0x00000000 
GPU method 0x5c000002:20800110	0x00000000 0x6f466547 0x20656372 0x20535447 
0x0010				0x4d303633 0x00000000 0x00000000 0x00000000 
  • 6f46654720656372205354474d303633 == "oFeG ecr STGM063"

disassembly

These disassemblies makes use of libcuda.so.195.36.15 (0867d66be617faab3782fa0ba19ec9ba, 7404990 bytes). Symbols were extracted via objdump -T.

  • AMD64 ABI:
    • Integer arguments via RDI, RSI, RDX, RCX, R8 and R9, then stack
    • FP arguments in XMM0..XMM7, then stack
    • Return value in RAX
    • libcuda traces

See Also