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 used by Intel PT support, and is a
8 // stopgap until "resources" can be used to read/write x86 MSRs.
9 // "mtrace" == "zircon trace": the idea being to be a generalization of
10 // ktrace. It's all temporary, but there may be other uses before the stopgap
11 // is no longer necessary.
12
13 #include "lib/mtrace.h"
14
15 #include <lib/zircon-internal/mtrace.h>
16
mtrace_control(uint32_t kind,uint32_t action,uint32_t options,user_inout_ptr<void> arg,size_t size)17 zx_status_t mtrace_control(uint32_t kind, uint32_t action, uint32_t options,
18 user_inout_ptr<void> arg, size_t size) {
19 switch (kind) {
20 #ifdef __x86_64__
21 case MTRACE_KIND_CPUPERF:
22 return mtrace_cpuperf_control(action, options, arg, size);
23 case MTRACE_KIND_INSNTRACE:
24 return mtrace_insntrace_control(action, options, arg, size);
25 #endif
26 default:
27 return ZX_ERR_INVALID_ARGS;
28 }
29 }
30