1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-10-06 02:20:40 +03:00
SoftEtherVPN/src/Mayaqua/Tick64.h
Daiyuu Nobori 2dec52b875 Heap area protection of memory has been enhanced.
When memory is released and reallocated, a random security value called a canary is written to the before/after area of memory, and if the value has been modified, the process is terminated (restarted) for safety, assuming it is a buffer overflow of the memory area. This feature may effectively prevent confidentiality or integrity violations in the event that some heap area overflow vulnerability is discovered in this system in the future.
2023-10-07 04:42:34 +02:00

58 lines
1.1 KiB
C

// SoftEther VPN Source Code - Developer Edition Master Branch
// Mayaqua Kernel
// Tick64.h
// Header of Tick64.c
#ifndef TICK64_H
#define TICK64_H
#include "MayaType.h"
// Maximum number of correction list entries
#define MAX_ADJUST_TIME 1024
// Correction list entry
struct ADJUST_TIME
{
UINT64 Tick;
UINT64 Time;
};
// TICK64 structure
struct TICK64
{
THREAD *Thread;
UINT64 Tick;
UINT64 TickStart;
UINT64 Time64;
UINT64 Tick64WithTime64;
UINT LastTick;
UINT RoundCount;
LOCK *TickLock;
volatile bool Halt;
LIST *AdjustTime;
};
// Constant
#define TICK64_SPAN 10 // Measurement interval (Usually less than 10ms)
#define TICK64_SPAN_WIN32 1000 // Interval of measurement on Win32
#define TICK64_ADJUST_SPAN 5000 // Correct the clock if it shifts more than this value
// Function prototype
void InitTick64();
void FreeTick64();
void Tick64Thread(THREAD *thread, void *param);
UINT64 Tick64();
UINT64 Diff64(UINT64 a, UINT64 b);
UINT64 Tick64ToTime64(UINT64 tick);
UINT64 TickToTime(UINT64 tick);
UINT64 TickHighres64();
UINT64 TickHighresNano64(bool raw);
#endif // TICK64_H