_nx_kernel_mount:
00000000000f43b2 55 pushq %rbp
00000000000f43b3 48 89 e5 movq %rsp, %rbp
00000000000f43b6 41 57 pushq %r15
// (snip)
00000000000f44cb e8 00 00 00 00 callq _cpuid_features
00000000000f44d0 48 0f ba e0 34 btq $0x34, %rax
00000000000f44d5 72 43 jb 0xf451a
00000000000f44d7 31 d2 xorl %edx, %edx
00000000000f44d9 48 8d 35 60 7e 07 00 leaq _crc32c_table(%rip), %rsi
00000000000f44e0 4c 8d 05 53 b1 f1 ff leaq _crc32c_soft(%rip), %r8
// (snip)
00000000000f4518 eb 07 jmp 0xf4521
00000000000f451a 4c 8d 05 b6 b0 f1 ff leaq _crc32c_x86_hw(%rip), %r8
00000000000f4521 4c 89 05 10 7e 07 00 movq %r8, _crc32c(%rip)
///
/// The code above checks the stored CPUID data for SSE4.2 (bit 52 of ECX:EDX).
/// If SSE4.2 is not available, store _crc32c_soft (software CRC32) in _crc32c variable.
/// If SSE4.2 is available, store _crc32_x86_hw (hardware CRC32) in _crc32c variable.
/// _crc32c will be called indirectly for CRC32 calculations.
/// (They do something similar to choose an AVX implementation of _fletcher64 if
/// AVX is available.)
///
// (snip)
///
/// Hardware CRC32 implementation (uses crc32q/crc32l/crc32w/crc32b)
///
_crc32c_x86_hw:
000000000000f5d7 55 pushq %rbp
000000000000f5d8 48 89 e5 movq %rsp, %rbp
000000000000f5db 89 f8 movl %edi, %eax
000000000000f5dd 48 89 d1 movq %rdx, %rcx
000000000000f5e0 48 c1 e9 03 shrq $0x3, %rcx
000000000000f5e4 74 11 je 0xf5f7
000000000000f5e6 31 ff xorl %edi, %edi
000000000000f5e8 f2 48 0f 38 f1 04 fe crc32q (%rsi,%rdi,8), %rax
000000000000f5ef 48 ff c7 incq %rdi
000000000000f5f2 48 39 f9 cmpq %rdi, %rcx
000000000000f5f5 75 f1 jne 0xf5e8
000000000000f5f7 48 89 d1 movq %rdx, %rcx
000000000000f5fa 48 83 e1 f8 andq $-0x8, %rcx
000000000000f5fe 48 01 ce addq %rcx, %rsi
000000000000f601 83 e2 07 andl $0x7, %edx
000000000000f604 48 83 fa 03 cmpq $0x3, %rdx
000000000000f608 76 10 jbe 0xf61a
000000000000f60a 31 c9 xorl %ecx, %ecx
000000000000f60c f2 0f 38 f1 04 8e crc32l (%rsi,%rcx,4), %eax
000000000000f612 48 83 c6 04 addq $0x4, %rsi
000000000000f616 48 83 c2 fc addq $-0x4, %rdx
000000000000f61a 48 83 fa 02 cmpq $0x2, %rdx
000000000000f61e 72 0e jb 0xf62e
000000000000f620 66 f2 0f 38 f1 06 crc32w (%rsi), %eax
000000000000f626 48 83 c6 02 addq $0x2, %rsi
000000000000f62a 48 83 c2 fe addq $-0x2, %rdx
000000000000f62e 48 85 d2 testq %rdx, %rdx
000000000000f631 74 05 je 0xf638
000000000000f633 f2 0f 38 f0 06 crc32b (%rsi), %eax
000000000000f638 5d popq %rbp
000000000000f639 c3 retq
///
/// Software CRC32 implementation (uses lookup table)
///
_crc32c_soft:
000000000000f63a 55 pushq %rbp
000000000000f63b 48 89 e5 movq %rsp, %rbp
000000000000f63e 89 f8 movl %edi, %eax
000000000000f640 48 85 d2 testq %rdx, %rdx
000000000000f643 74 23 je 0xf668
000000000000f645 31 c9 xorl %ecx, %ecx
000000000000f647 4c 8d 05 f2 cc 15 00 leaq _crc32c_table(%rip), %r8
000000000000f64e 44 0f b6 0c 0e movzbl (%rsi,%rcx), %r9d
000000000000f653 0f b6 f8 movzbl %al, %edi
000000000000f656 44 31 cf xorl %r9d, %edi
000000000000f659 c1 e8 08 shrl $0x8, %eax
000000000000f65c 41 33 04 b8 xorl (%r8,%rdi,4), %eax
000000000000f660 48 ff c1 incq %rcx
000000000000f663 48 39 ca cmpq %rcx, %rdx
000000000000f666 75 e6 jne 0xf64e
000000000000f668 5d popq %rbp
000000000000f669 c3 retq
// (snip)
///
/// drec_hash_func is a worker function that simply sets up and calls the selected CRC32
/// function (hardware or software).
/// It is used as a callback function for utf8_normalizeOptCaseFoldAndHash, which calls
/// drec_hash_func iteratively over a buffer.
///
_drec_hash_func:
00000000000a2288 55 pushq %rbp
00000000000a2289 48 89 e5 movq %rsp, %rbp
00000000000a228c 53 pushq %rbx
00000000000a228d 50 pushq %rax
00000000000a228e 48 89 d3 movq %rdx, %rbx
00000000000a2291 48 89 f2 movq %rsi, %rdx
00000000000a2294 48 89 fe movq %rdi, %rsi
00000000000a2297 8b 3b movl (%rbx), %edi
00000000000a2299 ff 15 99 a0 0c 00 callq *_crc32c(%rip)
00000000000a229f 89 03 movl %eax, (%rbx)
00000000000a22a1 48 83 c4 08 addq $0x8, %rsp
00000000000a22a5 5b popq %rbx
00000000000a22a6 5d popq %rbp
00000000000a22a7 c3 retq
// (snip)
///
/// fs_lookup_name_with_parent_id is called from 14 different locations in apfs.kext
///
_fs_lookup_name_with_parent_id:
00000000000a178e 55 pushq %rbp
00000000000a178f 48 89 e5 movq %rsp, %rbp
00000000000a1792 41 57 pushq %r15
// (snip)
// Loads drec_hash_func callback function address, then calls utf8_normalizeOptCaseFoldAndHash
00000000000a186d 48 8d 0d 14 0a 00 00 leaq _drec_hash_func(%rip), %rcx
00000000000a1874 4c 89 ef movq %r13, %rdi
00000000000a1877 4c 89 f6 movq %r14, %rsi
00000000000a187a e8 00 00 00 00 callq _utf8_normalizeOptCaseFoldAndHash
// (snip)
///
/// dir_rec_alloc_with_hash is called from 20 different locations in apfs.kext
///
_dir_rec_alloc_with_hash:
00000000000a1a51 55 pushq %rbp
00000000000a1a52 48 89 e5 movq %rsp, %rbp
00000000000a1a55 41 57 pushq %r15
// (snip)
// Loads drec_hash_func callback function address, then calls utf8_normalizeOptCaseFoldAndHash
00000000000a1b58 48 8d 0d 29 07 00 00 leaq _drec_hash_func(%rip), %rcx
00000000000a1b5f 4c 89 f7 movq %r14, %rdi
00000000000a1b62 e8 00 00 00 00 callq _utf8_normalizeOptCaseFoldAndHash