1/**
2 * \file
3 * \brief Address-space support for Mackerel CPUID device definitions
4 */
5
6/*
7 * Copyright (c) 2007, 2008, 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, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
13 */
14
15#ifndef CPUID_SPACES_H
16#define CPUID_SPACES_H
17#define CPUID(offset, reg)      __asm volatile("cpuid" : reg : "a" (offset))
18
19#include <barrelfish/barrelfish.h>
20
21static inline uint32_t cpuid_eax_read_32(cpuid_t *dev, size_t offset)
22{
23    uint32_t eax;
24    CPUID(offset, "=a" (eax));
25    return eax;
26}
27
28static inline uint32_t cpuid_ebx_read_32(cpuid_t *dev, size_t offset)
29{
30    uint32_t ebx;
31    CPUID(offset, "=b" (ebx));
32    return ebx;
33}
34
35static inline uint32_t cpuid_ecx_read_32(cpuid_t *dev, size_t offset)
36{
37    uint32_t ecx;
38    CPUID(offset, "=c" (ecx));
39    return ecx;
40}
41
42static inline uint32_t cpuid_edx_read_32(cpuid_t *dev, size_t offset)
43{
44    uint32_t edx;
45    CPUID(offset, "=d" (edx));
46    return edx;
47}
48
49static inline uint32_t cpuid_dcpa_read_32(cpuid_t *dev, size_t offset)
50{
51    return 0;
52}
53
54static inline uint32_t cpuid_dcpb_read_32(cpuid_t *dev, size_t offset)
55{
56    return 0;
57}
58
59static inline uint32_t cpuid_dcpc_read_32(cpuid_t *dev, size_t offset)
60{
61    return 0;
62}
63//                                       uint32_t value);
64
65#endif // CPUID_SPACES_H
66
67