-
Notifications
You must be signed in to change notification settings - Fork 482
/
Copy pathUserKernelShared.h
56 lines (53 loc) · 1.33 KB
/
UserKernelShared.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2012, Intel Corporation
// written by Austen Ott
//
#define PcmMsrDriverClassName com_intel_driver_PcmMsr
#define kPcmMsrDriverClassName "com_intel_driver_PcmMsr"
#ifndef USER_KERNEL_SHARED
#define USER_KERNEL_SHARED
#include <stdint.h>
typedef struct {
uint64_t value;
uint32_t cpu_num;
uint32_t msr_num;
} pcm_msr_data_t;
typedef struct {
uint64_t value;
uint32_t msr_num;
bool mask;
char padding[115];
} k_pcm_msr_data_t;
// The topologyEntry struct that is used by PCM in the kernel. It
// needs to be kept in sync with the one in cpucounters.h (at least,
// the first 3 fields). Ideally we would just include that, but
// cpucounters.h has dependencies on the platform SDK and cannot be
// compiled in the kernel on macOS today.
typedef struct
{
int32_t os_id;
int32_t thread_id;
int32_t core_id;
int32_t tile_id;
int32_t socket;
int32_t native_cpu_model;
int32_t core_type; // This is an enum in the userland structure.
} topologyEntry;
enum {
kOpenDriver,
kCloseDriver,
kReadMSR,
kWriteMSR,
kBuildTopology,
kGetNumInstances,
kIncrementNumInstances,
kDecrementNumInstances,
// PCI functions
kRead,
kWrite,
kMapMemory,
kUnmapMemory,
kReadMemory,
kNumberOfMethods
};
#endif