[34] | 1 | /* |
---|
| 2 | * util.h: Useful utility functions. |
---|
| 3 | * |
---|
| 4 | * Leendert van Doorn, leendert@watson.ibm.com |
---|
| 5 | * Copyright (c) 2005, International Business Machines Corporation. |
---|
| 6 | * |
---|
| 7 | * This program is free software; you can redistribute it and/or modify it |
---|
| 8 | * under the terms and conditions of the GNU General Public License, |
---|
| 9 | * version 2, as published by the Free Software Foundation. |
---|
| 10 | * |
---|
| 11 | * This program is distributed in the hope it will be useful, but WITHOUT |
---|
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
| 14 | * more details. |
---|
| 15 | * |
---|
| 16 | * You should have received a copy of the GNU General Public License along with |
---|
| 17 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
---|
| 18 | * Place - Suite 330, Boston, MA 02111-1307 USA. |
---|
| 19 | */ |
---|
| 20 | #ifndef __UTIL_H__ |
---|
| 21 | #define __UTIL_H__ |
---|
| 22 | |
---|
| 23 | #include <stdarg.h> |
---|
| 24 | #include <vm86.h> |
---|
| 25 | |
---|
| 26 | #include <xen/hvm/e820.h> |
---|
| 27 | #define E820_MAP_NR ((unsigned char *)E820_MAP_PAGE + E820_MAP_NR_OFFSET) |
---|
| 28 | #define E820_MAP ((struct e820entry *)(E820_MAP_PAGE + E820_MAP_OFFSET)) |
---|
| 29 | |
---|
| 30 | #define offsetof(type, member) ((unsigned) &((type *)0)->member) |
---|
| 31 | |
---|
| 32 | struct vmx_assist_context; |
---|
| 33 | |
---|
| 34 | extern void cpuid_addr_value(uint64_t addr, uint64_t *value); |
---|
| 35 | extern void hexdump(unsigned char *, int); |
---|
| 36 | extern void dump_regs(struct regs *); |
---|
| 37 | extern void dump_vmx_context(struct vmx_assist_context *); |
---|
| 38 | extern void print_e820_map(struct e820entry *, int); |
---|
| 39 | extern void dump_dtr(unsigned long, unsigned long); |
---|
| 40 | extern void *memcpy(void *, const void *, unsigned); |
---|
| 41 | extern void *memset(void *, int, unsigned); |
---|
| 42 | extern int printf(const char *fmt, ...); |
---|
| 43 | extern int vprintf(const char *fmt, va_list ap); |
---|
| 44 | extern void panic(const char *format, ...); |
---|
| 45 | extern void halt(void); |
---|
| 46 | |
---|
| 47 | #endif /* __UTIL_H__ */ |
---|