Testing physics

This commit is contained in:
2026-07-18 20:53:22 -05:00
parent 1174e471f6
commit 6c5738c863
24 changed files with 347 additions and 126 deletions
+20
View File
@@ -7,10 +7,30 @@
#include "systemlinux.h"
#if defined(__x86_64__) || defined(__i386__)
#include <x86intrin.h>
#else
#include <time.h>
#endif
errorret_t systemInitLinux() {
errorOk();
}
systemdialogtype_t systemGetActiveDialogTypeLinux() {
return SYSTEM_DIALOG_TYPE_NONE;
}
uint64_t systemGetCyclesLinux(void) {
#if defined(__x86_64__) || defined(__i386__)
return __rdtsc();
#elif defined(__aarch64__)
uint64_t cycles;
__asm__ volatile("mrs %0, cntvct_el0" : "=r" (cycles));
return cycles;
#else
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return (uint64_t)ts.tv_sec * 1000000000ULL + (uint64_t)ts.tv_nsec;
#endif
}
+11 -2
View File
@@ -15,7 +15,16 @@ errorret_t systemInitLinux(void);
/**
* Currently just returns SYSTEM_DIALOG_TYPE_NONE.
*
*
* @return Currently open system dialog type.
*/
systemdialogtype_t systemGetActiveDialogTypeLinux();
systemdialogtype_t systemGetActiveDialogTypeLinux();
/**
* Returns the current CPU cycle counter value. Uses the hardware
* timestamp counter on x86/x86_64 and the virtual counter register on
* ARM64, falling back to a monotonic nanosecond clock elsewhere.
*
* @return The current CPU cycle count.
*/
uint64_t systemGetCyclesLinux(void);
+2 -1
View File
@@ -9,4 +9,5 @@
#include "system/systemlinux.h"
#define systemInitPlatform systemInitLinux
#define systemGetActiveDialogTypePlatform systemGetActiveDialogTypeLinux
#define systemGetActiveDialogTypePlatform systemGetActiveDialogTypeLinux
#define systemGetCyclesPlatform systemGetCyclesLinux