Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dav1d
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
François Cartegnie
dav1d
Commits
d9b1ca87
Commit
d9b1ca87
authored
Oct 12, 2018
by
Martin Storsjö
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
checkasm: Add code for reading ARM cycle counter registers
parent
b567f04e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
tests/checkasm/checkasm.h
tests/checkasm/checkasm.h
+29
-0
No files found.
tests/checkasm/checkasm.h
View file @
d9b1ca87
...
...
@@ -101,6 +101,35 @@ static inline uint64_t readtime(void) {
}
#define readtime readtime
#endif
#elif ARCH_AARCH64
#ifdef _MSC_VER
#define readtime() (_InstructionSynchronizationBarrier(), ReadTimeStampCounter())
#else
static
inline
uint64_t
readtime
(
void
)
{
uint64_t
cycle_counter
;
/* This requires enabling user mode access to the cycle counter (which
* can only be done from kernel space).
* This could also read cntvct_el0 instead of pmccntr_el0; that register
* might also be readable (depending on kernel version), but it has much
* worse precision (it's a fixed 50 MHz timer). */
__asm__
__volatile__
(
"isb
\n
mrs %0, pmccntr_el0"
:
"=r"
(
cycle_counter
)
::
"memory"
);
return
cycle_counter
;
}
#define readtime readtime
#endif
#elif ARCH_ARM && !defined(_MSC_VER)
static
inline
uint64_t
readtime
(
void
)
{
uint32_t
cycle_counter
;
/* This requires enabling user mode access to the cycle counter (which
* can only be done from kernel space). */
__asm__
__volatile__
(
"isb
\n
mrc p15, 0, %0, c9, c13, 0"
:
"=r"
(
cycle_counter
)
::
"memory"
);
return
cycle_counter
;
}
#define readtime readtime
#endif
/* Verifies that clobbered callee-saved registers
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment