Added generic backtrace functions to allow backtrace output on buffers
[akaros.git] / kern / arch / x86 / perfmon.h
index 051f336..e084584 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef ROS_INC_PERFMON_H
-#define ROS_INC_PERFMON_H
+#pragma once
 #include <ros/common.h>
 #include <arch/x86.h>
 
 #define ENABLE_PERFCTR 0x00400000
 #define DISABLE_PERFCTR 0xFFAFFFFF
 
-
-static __inline uint64_t
-read_pmc(uint32_t index)
-{                                                                                                    
-    uint64_t pmc;
-
-    __asm __volatile("rdpmc" : "=A" (pmc) : "c" (index)); 
-    return pmc;                                                                                      
+static inline uint64_t read_pmc(uint32_t index)
+{
+       uint32_t edx, eax;
+       asm volatile("rdpmc" : "=d"(edx), "=a"(eax) : "c"(index));
+       return (uint64_t)edx << 32 | eax;
 }
 
 void perfmon_init();
-
-#endif /* ROS_INC_PERFMON_H */