1 /* 2 * GRUB -- GRand Unified Bootloader 3 * Copyright (C) 2006 Free Software Foundation, Inc. 4 * 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. 9 * 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. 14 * 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. 18 */ 19 /* 20 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 21 * Use is subject to license terms. 22 */ 23 24 #ifndef _AMD64_CPU 25 #define _AMD64_CPU 26 27 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 typedef unsigned int uint_t; 34 typedef unsigned long ulong_t; 35 36 #define BITX(u, h, l) (((u) >> (l)) & ((1lu << ((h) - (l) + 1lu)) - 1lu)) 37 38 #include <controlregs.h> 39 40 #define CB 0x0001 41 42 extern void amd64_flush_tlb(void); 43 extern void amd64_flush_tlbentry(caddr_t); 44 45 extern ulong_t amd64_get_cr2(void); 46 extern ulong_t amd64_get_cr0(void); 47 extern ulong_t amd64_get_cr3(void); 48 extern ulong_t amd64_get_cr4(void); 49 50 extern ulong_t amd64_get_eflags(void); 51 52 struct amd64_cpuid_regs { 53 uint32_t r_eax; 54 uint32_t r_ebx; 55 uint32_t r_ecx; 56 uint32_t r_edx; 57 }; 58 59 #define AMD64_Auth 0x68747541 60 #define AMD64_enti 0x69746e65 61 #define AMD64_cAMD 0x444d4163 62 63 extern uint32_t amd64_cpuid_supported(void); 64 extern void amd64_cpuid_insn(uint32_t, struct amd64_cpuid_regs *); 65 extern void amd64_rdmsr(uint32_t, uint64_t *); 66 extern void amd64_wrmsr(uint32_t, const uint64_t *); 67 extern int get_target_operating_mode(void); 68 69 #ifdef __cplusplus 70 } 71 #endif 72 73 #endif /* _AMD64_CPU */ 74