Merge branch 'master' of git://github.com/illumos/illumos-gate
[unleashed.git] / usr / src / grub / grub-0.97 / stage2 / cpu.h
blob0b45295e9b1d20c959eeb7f5b2b1577b1f2130ef
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2006 Free Software Foundation, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
21 * Use is subject to license terms.
24 #ifndef _AMD64_CPU
25 #define _AMD64_CPU
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
31 #include <shared.h>
33 typedef unsigned int uint_t;
34 typedef unsigned long ulong_t;
36 #define BITX(u, h, l) (((u) >> (l)) & ((1lu << ((h) - (l) + 1lu)) - 1lu))
38 #include <controlregs.h>
40 extern ulong_t amd64_get_cr2(void);
41 extern ulong_t amd64_get_cr0(void);
42 extern ulong_t amd64_get_cr3(void);
43 extern ulong_t amd64_get_cr4(void);
45 extern ulong_t amd64_get_eflags(void);
47 struct amd64_cpuid_regs {
48 uint32_t r_eax;
49 uint32_t r_ebx;
50 uint32_t r_ecx;
51 uint32_t r_edx;
54 #define AMD64_Auth 0x68747541
55 #define AMD64_enti 0x69746e65
56 #define AMD64_cAMD 0x444d4163
58 extern uint32_t amd64_cpuid_supported(void);
59 extern void amd64_cpuid_insn(uint32_t, struct amd64_cpuid_regs *);
60 extern void amd64_rdmsr(uint32_t, uint64_t *);
61 extern void amd64_wrmsr(uint32_t, const uint64_t *);
62 extern int get_target_operating_mode(void);
64 #ifdef __cplusplus
66 #endif
68 #endif /* _AMD64_CPU */