Function at 0x404240
Capabilities:
Allocate thread local storage
Get thread local storage value
Set thread local storage value

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0xb94
mov eax, dword [0x42d008]
xor eax, esp
mov dword [esp + 0xb90], eax
mov eax, dword [0x42d040]
mov dword [esp], 0
push ebx
mov ebx, ecx
mov dword [esp + 8], ebx
push esi
push edi
cmp eax, 0xffffffff
jne 0x407df5
mov ebx, dword [0x42d040]
cmp ebx, 0xffffffff
jne 0x4042bf
call dword [sym.imp.KERNEL32.dll_TlsAlloc]
cmp eax, ebx
je 0x407e09
mov ebx, eax
mov eax, dword [esp + 0xc]
test al, 1
jne 0x407e28
cmp ebx, 0xffffffff
je 0x407e3d
mov ecx, ebx
mov edx, 0x42d040
or eax, 0xffffffff
lock cmpxchg dword [edx], ecx
cmp eax, 0xffffffff
jne 0x407e93
push ebx
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
test eax, eax
jne 0x407ea5
mov eax, dword [esp + 0xc]
test al, 4
jne 0x407ec6
push 0x800
lea eax, [esp + 0x39c]
push 0
push eax
call sub.VCRUNTIME140.dll_memset
add esp, 0xc
lea eax, [esp + 0x398]
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
push 0x800
call dword [sym.imp.mozglue.dll_moz_xmalloc]
add esp, 4
lea esi, [esp + 0x398]
mov edi, eax
mov ecx, 0x200
rep movsd dword es:[edi], dword [esi]
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
mov ebx, dword [esp + 0x10]
mov eax, dword fs:[0x2c]
mov dword [ebx + 4], 0xffffffff
mov dword [ebx + 8], 0
mov ecx, dword [eax]
mov eax, dword [0x42e294]
cmp eax, dword [ecx + 4]
jle 0x404390
push 0x42e294
call fcn.00405566
add esp, 4
cmp dword [0x42e294], 0xffffffff
jne 0x404390
push 4
call dword [sym.imp.mozglue.dll_moz_xmalloc]
add esp, 4
test eax, eax
je 0x407ed7
xor ecx, ecx
mov dword [esp + 0x24], ecx
mov dword [eax], ecx
push 0x42e294
mov dword [0x42e290], eax
call fcn.0040551c
add esp, 4
mov esi, dword [0x42e290]
push esi
call dword [sym.imp.KERNEL32.dll_AcquireSRWLockExclusive]
mov edi, dword [0x42d660]
xor edx, edx
inc edi
lea eax, [edi + edx]
movzx ecx, al
lea eax, [ecx + ecx*2]
cmp dword [eax*4 + 0x42d670], 0
jne 0x407ede
lea eax, [ecx + ecx*2]
mov dword [0x42d660], ecx
mov dword [eax*4 + 0x42d670], 1
mov dword [eax*4 + 0x42d674], 0
mov dword [ebx + 4], ecx
mov eax, dword [eax*4 + 0x42d678]
mov dword [ebx + 8], eax
push esi
call dword [sym.imp.KERNEL32.dll_ReleaseSRWLockExclusive]
mov eax, dword [ebx + 4]
mov dword [esp + 0x14], 0xffffffff
mov dword [esp + 0x18], eax
cmp eax, 0xffffffff
je 0x407ef0
mov eax, dword [ebx + 4]
mov dword [esp + 0x1c], 0x100
mov dword [esp + 0x20], eax
cmp eax, 0x100
jge 0x407f35
pop edi
mov dword [ebx], 1
mov ecx, dword [esp + 0xb98]
pop esi
pop ebx
xor ecx, esp
call fcn.00405160
mov esp, ebp
pop ebp
ret 4
push eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
test eax, eax
jne 0x40432a
jmp 0x404278
push ecx
push 0x73
push str.z:_build_build_src_security_sandbox_chromium_base_threading_thread_local_storage.cc
lea ecx, [esp + 0x34]
call fcn.00408d24
mov eax, 1
mov dword [esp + 0xc], eax
jmp 0x404297
and eax, 0xfffffffe
lea ecx, [esp + 0x28]
mov dword [esp + 0xc], eax
call fcn.00408ec2
jmp 0x40429f
call dword [sym.imp.KERNEL32.dll_TlsAlloc]
cmp eax, 0xffffffff
je 0x407e4c
mov ebx, eax
jmp 0x407e6b
mov eax, dword [esp + 0xc]
push ecx
push 0x7d
or eax, 2
lea ecx, [esp + 0xe0]
push str.z:_build_build_src_security_sandbox_chromium_base_threading_thread_local_storage.cc
mov dword [esp + 0x18], eax
call fcn.00408d24
mov eax, dword [esp + 0xc]
test al, 2
je 0x407e86
and eax, 0xfffffffd
lea ecx, [esp + 0xd8]
mov dword [esp + 0xc], eax
call fcn.00408ec2
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_TlsFree]
jmp 0x4042a8
push ebx
call dword [sym.imp.KERNEL32.dll_TlsFree]
mov ebx, dword [0x42d040]
jmp 0x4042bf
or dword [esp + 0xc], 4
push ecx
push 0x8f
push str.z:_build_build_src_security_sandbox_chromium_base_threading_thread_local_storage.cc
lea ecx, [esp + 0x194]
call fcn.00408d24
jmp 0x4042ce
lea ecx, [esp + 0x188]
call fcn.00408ec2
jmp 0x4042da
xor eax, eax
jmp 0x40437e
inc edx
cmp edx, 0x100
jl 0x4043a6
jmp 0x4043e9
push str.slot____kInvalidSlotValue
lea edx, [esp + 0x18]
lea ecx, [esp + 0x1c]
call fcn.004088f5
add esp, 4
test eax, eax
je 0x404408
push eax
push 0x11d
push str.z:_build_build_src_security_sandbox_chromium_base_threading_thread_local_storage.cc
lea ecx, [esp + 0x244]
call fcn.00408d9a
lea ecx, [esp + 0x238]
call fcn.00408ec2
jmp 0x404408
push str.slot____kThreadLocalStorageSize
lea edx, [esp + 0x20]
lea ecx, [esp + 0x24]
call fcn.004088f5
add esp, 4
test eax, eax
je 0x404422
push eax
push 0x11e
push str.z:_build_build_src_security_sandbox_chromium_base_threading_thread_local_storage.cc
lea ecx, [esp + 0x2f4]
call fcn.00408d9a
lea ecx, [esp + 0x2e8]
call fcn.00408ec2
jmp 0x404422