1N/A/*
1N/A * GRUB -- GRand Unified Bootloader
1N/A * Copyright (C) 2006 Free Software Foundation, Inc.
1N/A *
1N/A * This program is free software; you can redistribute it and/or modify
1N/A * it under the terms of the GNU General Public License as published by
1N/A * the Free Software Foundation; either version 2 of the License, or
1N/A * (at your option) any later version.
1N/A *
1N/A * This program is distributed in the hope that it will be useful,
1N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of
1N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1N/A * GNU General Public License for more details.
1N/A *
1N/A * You should have received a copy of the GNU General Public License
1N/A * along with this program; if not, write to the Free Software
1N/A * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1N/A */
1N/A/*
1N/A * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
1N/A * Use is subject to license terms.
1N/A */
1N/A
1N/A#ifndef _AMD64_CPU
1N/A#define _AMD64_CPU
1N/A
1N/A#pragma ident "%Z%%M% %I% %E% SMI"
1N/A
1N/A#ifdef __cplusplus
1N/Aextern "C" {
1N/A#endif
1N/A
1N/Atypedef unsigned int uint_t;
1N/Atypedef unsigned long ulong_t;
1N/A
1N/A#define BITX(u, h, l) (((u) >> (l)) & ((1lu << ((h) - (l) + 1lu)) - 1lu))
1N/A
1N/A#include <controlregs.h>
1N/A
1N/A#define CB 0x0001
1N/A
1N/Aextern void amd64_flush_tlb(void);
1N/Aextern void amd64_flush_tlbentry(caddr_t);
1N/A
1N/Aextern ulong_t amd64_get_cr2(void);
1N/Aextern ulong_t amd64_get_cr0(void);
1N/Aextern ulong_t amd64_get_cr3(void);
1N/Aextern ulong_t amd64_get_cr4(void);
1N/A
1N/Aextern ulong_t amd64_get_eflags(void);
1N/A
1N/Astruct amd64_cpuid_regs {
1N/A uint32_t r_eax;
1N/A uint32_t r_ebx;
1N/A uint32_t r_ecx;
1N/A uint32_t r_edx;
1N/A};
1N/A
1N/A#define AMD64_Auth 0x68747541
1N/A#define AMD64_enti 0x69746e65
1N/A#define AMD64_cAMD 0x444d4163
1N/A
1N/Aextern uint32_t amd64_cpuid_supported(void);
1N/Aextern void amd64_cpuid_insn(uint32_t, struct amd64_cpuid_regs *);
1N/Aextern void amd64_rdmsr(uint32_t, uint64_t *);
1N/Aextern void amd64_wrmsr(uint32_t, const uint64_t *);
1N/Aextern int get_target_operating_mode(void);
1N/A
1N/A#ifdef __cplusplus
1N/A}
1N/A#endif
1N/A
1N/A#endif /* _AMD64_CPU */