; Listing generated by Microsoft (R) Optimizing Compiler Version 19.44.35220.0 include listing.inc INCLUDELIB MSVCRTD INCLUDELIB OLDNAMES _DATA SEGMENT COMM infolog:BYTE:0200H _DATA ENDS msvcjmc SEGMENT __5C8CA4D3_mmintrin@h DB 01H __8C83BECC_concurrencysal@h DB 01H __608E3340_sal@h DB 01H __FB67E29A_vadefs@h DB 01H __1D1B619C_vcruntime@h DB 01H __735960E1_corecrt@h DB 01H __211DB995_corecrt_malloc@h DB 01H __7CD62D9E_malloc@h DB 01H __9DCE0DC8_xmmintrin@h DB 01H __4C2AD0C7_winpackagefamily@h DB 01H __9DED9ED1_winapifamily@h DB 01H __12FEDF4E_sdkddkver@h DB 01H __9BAEE128_excpt@h DB 01H __B7B53233_stdarg@h DB 01H __6B04FCB3_specstrings_undef@h DB 01H __F4027AF7_specstrings_strict@h DB 01H __B90340D4_sdv_driverspecs@h DB 01H __BFFF5AD3_driverspecs@h DB 01H __32847078_specstrings@h DB 01H __108B2620_corecrt_wctype@h DB 01H __6CD6613D_ctype@h DB 01H __30902A1F_kernelspecs@h DB 01H __376FD5CA_basetsd@h DB 01H __13DE2371_errno@h DB 01H __8C6AE390_vcruntime_string@h DB 01H __8ACB2152_corecrt_memcpy_s@h DB 01H __EA6C9D17_corecrt_memory@h DB 01H __0DF2AF52_corecrt_wstring@h DB 01H __6E889ECC_string@h DB 01H __9BEDF4DE_guiddef@h DB 01H __51BFD2FE_pshpack4@h DB 01H __31652CEA_poppack@h DB 01H __5532AE4C_pshpack2@h DB 01H __58A52B9A_pshpack8@h DB 01H __57741015_pshpack1@h DB 01H __CDE68C90_apiset@h DB 01H __0BF06E8D_ktmtypes@h DB 01H __40C200C0_winnt@h DB 01H __9336F789_minwindef@h DB 01H __55136115_windef@h DB 01H __32205BF0_apisetcconv@h DB 01H __B48FDEA0_minwinbase@h DB 01H __3551B028_apiquery2@h DB 01H __65BE04AA_processenv@h DB 01H __4767CA46_fileapi@h DB 01H __282E6C4B_fileapifromapp@h DB 01H __393AF12C_debugapi@h DB 01H __EBC502B8_utilapiset@h DB 01H __1EAD8C69_handleapi@h DB 01H __D8EF9B29_errhandlingapi@h DB 01H __97FC1204_fibersapi@h DB 01H __27448220_namedpipeapi@h DB 01H __6EA33B2A_profileapi@h DB 01H __EAC6F673_heapapi@h DB 01H __D64EEA5A_ioapiset@h DB 01H __144BD4B6_synchapi@h DB 01H __03B1C640_interlockedapi@h DB 01H __DC64CB38_processthreadsapi@h DB 01H __D719B518_sysinfoapi@h DB 01H __410385B1_memoryapi@h DB 01H __C1AD45EF_enclaveapi@h DB 01H __F4C3AA32_threadpoollegacyapiset@h DB 01H __AC5A7A9F_threadpoolapiset@h DB 01H __F5254B21_jobapi@h DB 01H __BCEA6EE8_jobapi2@h DB 01H __D18ACE72_wow64apiset@h DB 01H __669B0D4A_libloaderapi@h DB 01H __645F7034_securitybaseapi@h DB 01H __67E58557_namespaceapi@h DB 01H __599D9D3A_systemtopologyapi@h DB 01H __2337E373_processtopologyapi@h DB 01H __02BFF239_securityappcontainer@h DB 01H __9C196272_realtimeapiset@h DB 01H __5AB313A4_winerror@h DB 01H __B7E7187B_timezoneapi@h DB 01H __6DE9EB6F_winbase@h DB 01H __56B2AFF2_wingdi@h DB 01H __BA1161A9_tvout@h DB 01H __0501A018_winuser@h DB 01H __EF12FA99_datetimeapi@h DB 01H __8FA7C3CA_winnls@h DB 01H __390F0C47_stringapiset@h DB 01H __28605B0A_wincontypes@h DB 01H __BFBDE86D_consoleapi@h DB 01H __C3CAFBF0_consoleapi2@h DB 01H __C20891C7_consoleapi3@h DB 01H __717C98B6_wincon@h DB 01H __2884C177_verrsrc@h DB 01H __A3FD3A34_winver@h DB 01H __6F8AD9F1_reason@h DB 01H __4C90FD6F_winreg@h DB 01H __68AFEBAD_wnnc@h DB 01H __5A7AB086_winnetwk@h DB 01H __2FE8A10C_stralign@h DB 01H __34558472_winsvc@h DB 01H __058845F1_mcx@h DB 01H __7F16006B_ime_cmodes@h DB 01H __0A3AF599_imm@h DB 01H __9349FE86_windows@h DB 01H __639A050C_sn_internal@h DB 01H __836A8CFC_stdint@h DB 01H __714FE6D7_sn_target@h DB 01H __60B45B40_corecrt_stdio_config@h DB 01H __CFA3741E_corecrt_wstdio@h DB 01H __B3FE3303_stdio@h DB 01H __955456CD_stddef@h DB 01H __99AED4FB_corecrt_search@h DB 01H __8B813BF6_corecrt_wstdlib@h DB 01H __3D1CA2C3_limits@h DB 01H __E8FB0A68_stdlib@h DB 01H __F562FA57_stb_image@h DB 01H __C95DC661_khrplatform@h DB 01H __6C577136_gl@h DB 01H __EE638A2C_wgl@h DB 01H __8EF9E35C_glfw3@h DB 01H __F8AC8404_emmintrin@h DB 01H __270DEC8D_pmmintrin@h DB 01H __97D49F0F_tmmintrin@h DB 01H __BEEF8A8C_smmintrin@h DB 01H __DB8D0340_nmmintrin@h DB 01H __0E36F90E_wmmintrin@h DB 01H __C5A2B409_zmmintrin@h DB 01H __F2B616C3_immintrin@h DB 01H __9FB25DBE_assert@h DB 01H __4E664295_glfw_function@h DB 01H __64C0EF11_StgSharpNative@h DB 01H __C1B0F7FE_t@affinity@c DB 01H msvcjmc ENDS PUBLIC sn_set_thread_affinity PUBLIC __JustMyCode_Default EXTRN memset:PROC EXTRN __imp_GetCurrentThread:PROC EXTRN __imp_GetThreadGroupAffinity:PROC EXTRN __imp_SetThreadGroupAffinity:PROC EXTRN __imp_GetActiveProcessorCount:PROC EXTRN _RTC_CheckStackVars:PROC EXTRN _RTC_InitBase:PROC EXTRN _RTC_Shutdown:PROC EXTRN __CheckForDebuggerJustMyCode:PROC EXTRN __GSHandlerCheck:PROC EXTRN __security_check_cookie:PROC EXTRN __security_cookie:QWORD ; COMDAT pdata pdata SEGMENT $pdata$sn_set_thread_affinity DD imagerel $LN7 DD imagerel $LN7+460 DD imagerel $unwind$sn_set_thread_affinity pdata ENDS ; COMDAT rtc$TMZ rtc$TMZ SEGMENT _RTC_Shutdown.rtc$TMZ DQ FLAT:_RTC_Shutdown rtc$TMZ ENDS ; COMDAT rtc$IMZ rtc$IMZ SEGMENT _RTC_InitBase.rtc$IMZ DQ FLAT:_RTC_InitBase rtc$IMZ ENDS ; COMDAT voltbl voltbl SEGMENT _volmd DW 034H DW 01b3H voltbl ENDS ; COMDAT xdata xdata SEGMENT $unwind$sn_set_thread_affinity DD 025053b19H DD 010d2312H DD 070060041H DD 05005H DD imagerel __GSHandlerCheck DD 01f8H xdata ENDS ; COMDAT CONST CONST SEGMENT sn_set_thread_affinity$rtcName$0 DB 063H DB 075H DB 072H DB 072H DB 065H DB 06eH DB 074H DB 00H sn_set_thread_affinity$rtcName$1 DB 067H DB 061H DB 00H ORG $+1 sn_set_thread_affinity$rtcName$2 DB 067H DB 061H DB 00H ORG $+1 sn_set_thread_affinity$rtcVarDesc DD 0108H DD 010H DQ FLAT:sn_set_thread_affinity$rtcName$2 DD 078H DD 010H DQ FLAT:sn_set_thread_affinity$rtcName$1 DD 028H DD 010H DQ FLAT:sn_set_thread_affinity$rtcName$0 ORG $+144 sn_set_thread_affinity$rtcFrameData DD 03H DD 00H DQ FLAT:sn_set_thread_affinity$rtcVarDesc CONST ENDS ; Function compile flags: /Odt ; COMDAT __JustMyCode_Default _TEXT SEGMENT __JustMyCode_Default PROC ; COMDAT 00000 c2 00 00 ret 0 __JustMyCode_Default ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File D:\platform-dev\StgSharp.Native\sn-src\t.affinity.c ; COMDAT sn_set_thread_affinity _TEXT SEGMENT current$6 = 8 count$7 = 52 ga$8 = 88 group$ = 132 index$ = 164 count$ = 196 ga$ = 232 tv76 = 456 tv153 = 456 tv144 = 464 __$ArrayPad$ = 472 core_id$ = 512 sn_set_thread_affinity PROC ; COMDAT ; 15 : { $LN7: 00000 89 4c 24 08 mov DWORD PTR [rsp+8], ecx 00004 55 push rbp 00005 57 push rdi 00006 48 81 ec 08 02 00 00 sub rsp, 520 ; 00000208H 0000d 48 8d 6c 24 20 lea rbp, QWORD PTR [rsp+32] 00012 48 8d 7c 24 20 lea rdi, QWORD PTR [rsp+32] 00017 b9 4a 00 00 00 mov ecx, 74 ; 0000004aH 0001c b8 cc cc cc cc mov eax, -858993460 ; ccccccccH 00021 f3 ab rep stosd 00023 8b 8c 24 28 02 00 00 mov ecx, DWORD PTR [rsp+552] 0002a 48 8b 05 00 00 00 00 mov rax, QWORD PTR __security_cookie 00031 48 33 c5 xor rax, rbp 00034 48 89 85 d8 01 00 00 mov QWORD PTR __$ArrayPad$[rbp], rax 0003b 48 8d 0d 00 00 00 00 lea rcx, OFFSET FLAT:__C1B0F7FE_t@affinity@c 00042 e8 00 00 00 00 call __CheckForDebuggerJustMyCode 00047 90 npad 1 ; 16 : #if SN_IS_OS(SN_OS_WINDOWS) ; 17 : if (core_id < 0) { 00048 83 bd 00 02 00 00 00 cmp DWORD PTR core_id$[rbp], 0 0004f 0f 8d 9b 00 00 00 jge $LN2@sn_set_thr ; 18 : /* Query which group the thread currently belongs to */ ; 19 : GROUP_AFFINITY current; ; 20 : GetThreadGroupAffinity(GetCurrentThread(), ¤t); 00055 ff 15 00 00 00 00 call QWORD PTR __imp_GetCurrentThread 0005b 48 8d 55 08 lea rdx, QWORD PTR current$6[rbp] 0005f 48 8b c8 mov rcx, rax 00062 ff 15 00 00 00 00 call QWORD PTR __imp_GetThreadGroupAffinity 00068 90 npad 1 ; 21 : /* Build a full mask for that group's actual core count */ ; 22 : DWORD count = GetActiveProcessorCount(current.Group); 00069 0f b7 4d 10 movzx ecx, WORD PTR current$6[rbp+8] 0006d ff 15 00 00 00 00 call QWORD PTR __imp_GetActiveProcessorCount 00073 89 45 34 mov DWORD PTR count$7[rbp], eax ; 23 : GROUP_AFFINITY ga; ; 24 : memset(&ga, 0, sizeof(ga)); 00076 41 b8 10 00 00 00 mov r8d, 16 0007c 33 d2 xor edx, edx 0007e 48 8d 4d 58 lea rcx, QWORD PTR ga$8[rbp] 00082 e8 00 00 00 00 call memset 00087 90 npad 1 ; 25 : ga.Group = current.Group; 00088 0f b7 45 10 movzx eax, WORD PTR current$6[rbp+8] 0008c 66 89 45 60 mov WORD PTR ga$8[rbp+8], ax ; 26 : ga.Mask = (count >= 64) ? ~(KAFFINITY)0 00090 83 7d 34 40 cmp DWORD PTR count$7[rbp], 64 ; 00000040H 00094 72 0d jb SHORT $LN5@sn_set_thr 00096 48 c7 85 c8 01 00 00 ff ff ff ff mov QWORD PTR tv76[rbp], -1 000a1 eb 26 jmp SHORT $LN6@sn_set_thr $LN5@sn_set_thr: 000a3 8b 45 34 mov eax, DWORD PTR count$7[rbp] 000a6 b9 01 00 00 00 mov ecx, 1 000ab 48 89 8d d0 01 00 00 mov QWORD PTR tv144[rbp], rcx 000b2 0f b6 c8 movzx ecx, al 000b5 48 8b 85 d0 01 00 00 mov rax, QWORD PTR tv144[rbp] 000bc 48 d3 e0 shl rax, cl 000bf 48 ff c8 dec rax 000c2 48 89 85 c8 01 00 00 mov QWORD PTR tv76[rbp], rax $LN6@sn_set_thr: 000c9 48 8b 85 c8 01 00 00 mov rax, QWORD PTR tv76[rbp] 000d0 48 89 45 58 mov QWORD PTR ga$8[rbp], rax ; 27 : : ((KAFFINITY)1 << count) - 1; ; 28 : SetThreadGroupAffinity(GetCurrentThread(), &ga, NULL); 000d4 ff 15 00 00 00 00 call QWORD PTR __imp_GetCurrentThread 000da 45 33 c0 xor r8d, r8d 000dd 48 8d 55 58 lea rdx, QWORD PTR ga$8[rbp] 000e1 48 8b c8 mov rcx, rax 000e4 ff 15 00 00 00 00 call QWORD PTR __imp_SetThreadGroupAffinity 000ea 90 npad 1 ; 29 : return; 000eb e9 b3 00 00 00 jmp $LN1@sn_set_thr $LN2@sn_set_thr: ; 30 : } ; 31 : WORD group = (WORD)(core_id / 64); 000f0 8b 85 00 02 00 00 mov eax, DWORD PTR core_id$[rbp] 000f6 99 cdq 000f7 83 e2 3f and edx, 63 ; 0000003fH 000fa 03 c2 add eax, edx 000fc c1 f8 06 sar eax, 6 000ff 66 89 85 84 00 00 00 mov WORD PTR group$[rbp], ax ; 32 : int index = core_id % 64; 00106 8b 85 00 02 00 00 mov eax, DWORD PTR core_id$[rbp] 0010c 99 cdq 0010d 83 e2 3f and edx, 63 ; 0000003fH 00110 03 c2 add eax, edx 00112 83 e0 3f and eax, 63 ; 0000003fH 00115 2b c2 sub eax, edx 00117 89 85 a4 00 00 00 mov DWORD PTR index$[rbp], eax ; 33 : DWORD count = GetActiveProcessorCount(group); 0011d 0f b7 8d 84 00 00 00 movzx ecx, WORD PTR group$[rbp] 00124 ff 15 00 00 00 00 call QWORD PTR __imp_GetActiveProcessorCount 0012a 89 85 c4 00 00 00 mov DWORD PTR count$[rbp], eax ; 34 : if ((DWORD)index >= count) 00130 8b 85 c4 00 00 00 mov eax, DWORD PTR count$[rbp] 00136 39 85 a4 00 00 00 cmp DWORD PTR index$[rbp], eax 0013c 72 02 jb SHORT $LN3@sn_set_thr ; 35 : return; 0013e eb 63 jmp SHORT $LN1@sn_set_thr $LN3@sn_set_thr: ; 36 : GROUP_AFFINITY ga; ; 37 : memset(&ga, 0, sizeof(ga)); 00140 41 b8 10 00 00 00 mov r8d, 16 00146 33 d2 xor edx, edx 00148 48 8d 8d e8 00 00 00 lea rcx, QWORD PTR ga$[rbp] 0014f e8 00 00 00 00 call memset 00154 90 npad 1 ; 38 : ga.Group = group; 00155 0f b7 85 84 00 00 00 movzx eax, WORD PTR group$[rbp] 0015c 66 89 85 f0 00 00 00 mov WORD PTR ga$[rbp+8], ax ; 39 : ga.Mask = (KAFFINITY)1 << index; 00163 8b 85 a4 00 00 00 mov eax, DWORD PTR index$[rbp] 00169 b9 01 00 00 00 mov ecx, 1 0016e 48 89 8d c8 01 00 00 mov QWORD PTR tv153[rbp], rcx 00175 0f b6 c8 movzx ecx, al 00178 48 8b 85 c8 01 00 00 mov rax, QWORD PTR tv153[rbp] 0017f 48 d3 e0 shl rax, cl 00182 48 89 85 e8 00 00 00 mov QWORD PTR ga$[rbp], rax ; 40 : SetThreadGroupAffinity(GetCurrentThread(), &ga, NULL); 00189 ff 15 00 00 00 00 call QWORD PTR __imp_GetCurrentThread 0018f 45 33 c0 xor r8d, r8d 00192 48 8d 95 e8 00 00 00 lea rdx, QWORD PTR ga$[rbp] 00199 48 8b c8 mov rcx, rax 0019c ff 15 00 00 00 00 call QWORD PTR __imp_SetThreadGroupAffinity 001a2 90 npad 1 $LN1@sn_set_thr: ; 41 : ; 42 : #elif SN_IS_OS(SN_OS_LINUX) ; 43 : cpu_set_t set; ; 44 : if (core_id < 0) { ; 45 : CPU_ZERO(&set); ; 46 : long ncpus = sysconf(_SC_NPROCESSORS_ONLN); ; 47 : for (long i = 0; i < ncpus; i++) ; 48 : CPU_SET((int)i, &set); ; 49 : } else { ; 50 : CPU_ZERO(&set); ; 51 : CPU_SET(core_id, &set); ; 52 : } ; 53 : pthread_setaffinity_np(pthread_self(), sizeof(set), &set); ; 54 : #endif ; 55 : } 001a3 48 8d 4d e0 lea rcx, QWORD PTR [rbp-32] 001a7 48 8d 15 00 00 00 00 lea rdx, OFFSET FLAT:sn_set_thread_affinity$rtcFrameData 001ae e8 00 00 00 00 call _RTC_CheckStackVars 001b3 48 8b 8d d8 01 00 00 mov rcx, QWORD PTR __$ArrayPad$[rbp] 001ba 48 33 cd xor rcx, rbp 001bd e8 00 00 00 00 call __security_check_cookie 001c2 48 8d a5 e8 01 00 00 lea rsp, QWORD PTR [rbp+488] 001c9 5f pop rdi 001ca 5d pop rbp 001cb c3 ret 0 sn_set_thread_affinity ENDP _TEXT ENDS END