Add arm/counter.h with armGetSystemTick (supersedes svcGetSystemTick)

This commit is contained in:
fincs 2018-08-05 14:29:47 +02:00
parent d255fe730b
commit 0589b39f7a
2 changed files with 20 additions and 0 deletions

View File

@ -17,6 +17,8 @@ extern "C" {
#include "switch/arm/tls.h"
#include "switch/arm/cache.h"
#include "switch/arm/atomics.h"
#include "switch/arm/counter.h"
#include "switch/kernel/svc.h"
#include "switch/kernel/tmem.h"

View File

@ -0,0 +1,18 @@
/**
* @file counter.h
* @brief AArch64 system counter-timer.
* @author fincs
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
/**
* @brief Gets the current system tick.
* @return The current system tick.
*/
static inline u64 armGetSystemTick(void) {
u64 ret;
__asm__ __volatile__ ("mrs %x[data], cntpct_el0" : [data] "=r" (ret));
return ret;
}