tunsafe-clang15/tunsafe_cpu.h
Ludvig Strigeus cf92ac7a0c Updates for TunSafe 1.4-rc1
1.Subfolders in the Config/ directory now show up as submenus.
2.Added a way to run TunSafe as a Windows Service.
  Foreground Mode: The service will disconnect when TunSafe closes.
  Background Mode: The service will stay connected in the background.
  No longer required to run the TunSafe client as Admin as long as
  the service is running.
3.New config setting [Interface].ExcludedIPs to configure IPs that
  should not be routed through TunSafe.
4.Can now automatically start TunSafe when Windows starts
5.New UI with tabs and graphs
6.Cache DNS queries to ensure DNS will succeed if connection fails
7.Recreate tray icon when explorer.exe restarts
8.Renamed window title to TunSafe instead of TunSafe VPN Client
9.Main window is now resizable
10.Disallow roaming endpoint when using AllowedIPs=0.0.0.0/0
   Only the original endpoint is added in the routing table so
   this would result in an endless loop of packets.
11.Display approximate Wireguard framing overhead in stats
12.Preparations for protocol handling with multiple threads
13.Delete the routes we made when disconnecting
14.Fix error message about unable to delete a route when connecting
2018-08-12 03:30:06 +02:00

44 lines
1.1 KiB
C

// SPDX-License-Identifier: AGPL-1.0-only
// Copyright (C) 2018 Ludvig Strigeus <info@tunsafe.com>. All Rights Reserved.
#ifndef TUNSAFE_CPU_H_
#define TUNSAFE_CPU_H_
#include "tunsafe_types.h"
#if defined(ARCH_CPU_X86_FAMILY)
extern uint32 x86_pcap[3];
// cpuid 1, edx
#define X86_PCAP_SSE (x86_pcap[0] & (1 << 25))
#define X86_PCAP_SSE2 (x86_pcap[0] & (1 << 26))
// cpuid 1, ecx
#define X86_PCAP_SSE3 (x86_pcap[1] & (1 << 0))
#define X86_PCAP_PCLMULQDQ (x86_pcap[1] & (1 << 0))
#define X86_PCAP_SSSE3 (x86_pcap[1] & (1 << 9))
#define X86_PCAP_MOVBE (x86_pcap[1] & (1 << 22))
#define X86_PCAP_AES (x86_pcap[1] & (1 << 25))
#define X86_PCAP_AVX (x86_pcap[1] & (1 << 28))
// cpuid 7, ebx
#define X86_PCAP_AVX2 (x86_pcap[2] & (1 << 5))
#define X86_PCAP_AVX512F (x86_pcap[2] & (1 << 16))
#define X86_PCAP_AVX512VL (x86_pcap[2] & (1 << 31))
#endif // defined(ARCH_CPU_X86_FAMILY)
#if defined(ARCH_CPU_ARM_FAMILY)
extern uint32 arm_pcap[1];
#define ARM_PCAP_NEON (arm_pcap[0] & (1 << 0))
#endif // defined(ARCH_CPU_ARM_FAMILY)
void InitCpuFeatures();
void PrintCpuFeatures();
#endif // TUNSAFE_CPU_H_