1// Copyright 2016 The Fuchsia Authors
2//
3// Use of this source code is governed by a MIT-style
4// license that can be found in the LICENSE file or at
5// https://opensource.org/licenses/MIT
6
7// N.B. This is ideally temporary. It is currently used by Intel PT and PM
8// support, and is a stopgap until "resources" can be used to read/write
9// x86 MSRs. The intent is to use this interface for similar facilities in
10// ARM (assuming we need it - on x86 we need ring 0 to access most of the
11// MSRs we need).
12// Note on naming: The "m" in "mtrace" means "miscellaneous". "trace" is being
13// used very generically, e.g., all the different kinds of h/w based trace
14// and performance data capturing one can do.
15
16#pragma once
17
18#include <lib/user_copy/user_ptr.h>
19#include <stdint.h>
20#include <zircon/compiler.h>
21#include <zircon/types.h>
22
23zx_status_t mtrace_control(uint32_t kind, uint32_t action, uint32_t options,
24                           user_inout_ptr<void> arg, size_t size);
25
26#ifdef __x86_64__
27zx_status_t mtrace_cpuperf_control(uint32_t action, uint32_t options,
28                                   user_inout_ptr<void> arg, size_t size);
29zx_status_t mtrace_insntrace_control(uint32_t action, uint32_t options,
30                                     user_inout_ptr<void> arg, size_t size);
31#endif
32