static int bin_pe_init_tls(RBinPEObj* pe) {
	PE_(image_tls_directory) * image_tls_directory;
	PE_(image_data_directory) * data_dir_tls = &pe->data_directory[PE_IMAGE_DIRECTORY_ENTRY_TLS];
	PE_DWord tls_paddr = PE_(va2pa) (pe, data_dir_tls->VirtualAddress);

	image_tls_directory = R_NEW0 (PE_(image_tls_directory));
	if (read_tls_directory (pe->b, tls_paddr, image_tls_directory) < 0) {
		pe_printf ("Warning: read (image_tls_directory)\n");
		free (image_tls_directory);
		return 0;
	}
	pe->tls_directory = image_tls_directory;
	if (!image_tls_directory->AddressOfCallBacks) {
		return 0;
	}
	if (image_tls_directory->EndAddressOfRawData < image_tls_directory->StartAddressOfRawData) {
		return 0;
	}
	PE_DWord callbacks_paddr = PE_(va2pa) (pe, bin_pe_va_to_rva (pe,
			(PE_DWord) image_tls_directory->AddressOfCallBacks));
	bin_pe_store_tls_callbacks (pe, callbacks_paddr);
	return 0;
}
static int bin_pe_init_tls(RBinPEObj* pe) {
	PE_(image_tls_directory) * image_tls_directory;
	PE_(image_data_directory) * data_dir_tls = &pe->data_directory[PE_IMAGE_DIRECTORY_ENTRY_TLS];
	PE_DWord tls_paddr = PE_(va2pa) (pe, data_dir_tls->VirtualAddress);

	image_tls_directory = R_NEW0 (PE_(image_tls_directory));
	if (read_tls_directory (pe->b, tls_paddr, image_tls_directory) < 0) {
		pe_printf ("Warning: read (image_tls_directory)\n");
		free (image_tls_directory);
		return 0;
	}
	pe->tls_directory = image_tls_directory;
	if (!image_tls_directory->AddressOfCallBacks) {
		return 0;
	}
	if (image_tls_directory->EndAddressOfRawData < image_tls_directory->StartAddressOfRawData) {
		return 0;
	}
	PE_DWord callbacks_paddr = PE_(va2pa) (pe, bin_pe_va_to_rva (pe,
			(PE_DWord) image_tls_directory->AddressOfCallBacks));
	bin_pe_store_tls_callbacks (pe, callbacks_paddr);
	return 0;
}