1/**
2 * \file
3 * \brief Address-space support for Mackerel IA32-MSR device definitions
4 */
5
6/*
7 * Copyright (c) 2007-2010, ETH Zurich.
8 * All rights reserved.
9 *
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
13 */
14
15#ifndef IA32_SPACES_H
16#define IA32_SPACES_H
17
18static inline uint64_t ia32_msr_read_64(ia32_t *dev, size_t offset);
19static inline void ia32_msr_write_64(ia32_t *dev, size_t offset,
20                                     uint64_t value);
21
22static inline uint32_t ia32_msr_read_32(ia32_t *dev, size_t offset);
23static inline void ia32_msr_write_32(ia32_t *dev, size_t offset,
24                                     uint32_t value);
25
26static inline uint64_t ia32_msr_read_64(ia32_t *dev, size_t offset)
27{
28    return rdmsr(offset);
29}
30
31static inline void ia32_msr_write_64(ia32_t *dev, size_t offset,
32                                     uint64_t value)
33{
34    wrmsr(offset, value);
35}
36
37static inline uint32_t ia32_msr_read_32(ia32_t *dev, size_t offset)
38{
39    return rdmsr(offset) & 0xffffffff;
40}
41
42static inline void ia32_msr_write_32(ia32_t *dev, size_t offset,
43                                     uint32_t value)
44{
45    wrmsr(offset, value);
46}
47
48#endif // IA32_SPACES_H
49