Mercurial > hg > Game > Atoc
view include/hvcalls/common.h @ 0:42f240cc4bc6
From: 太田 篤志 <atoc@namikilab.tuat.ac.jp>
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 08 Sep 2009 13:44:18 +0900 |
parents | |
children |
line wrap: on
line source
/** * hvcalls/common.h * ハイパーバイザコール詰め合わせの共通部分 */ #ifndef HVCALLS__COMMON_H #define HVCALLS__COMMON_H #include <linux/kernel.h> #include <asm/types.h> // 64 ビット値のフォーマット指定子を定義 #if defined __powerpc64__ # define HVCALLS_S64DFMT "%ld" // signed # define HVCALLS_U64UFMT "%lu" // unsigned (dec) # define HVCALLS_U64XFMT "%016lx" // unsigned (hex) #elif defined __GNUC__ # define HVCALLS_S64DFMT "%lld" // signed # define HVCALLS_U64UFMT "%llu" // unsigned (dec) # define HVCALLS_U64XFMT "%016llx" // unsigned (hex) #else # error Can't determine 64bit format string. #endif /*defined __GNUC__, defined __powerpc64__*/ // 整数型のエイリアスを定義 typedef __u64 HVC_u64; // IS_DEBUG_MODE が定義されている場合は // HVCALLS_DO_PRINT_INFO も定義されたものとする #ifdef IS_DEBUG_MODE # ifndef HVCALLS_DO_PRINT_INFO # define HVCALLS_DO_PRINT_INFO # endif #endif /*IS_DEBUG_MODE*/ #ifdef HVCALLS_DO_PRINT_INFO // プリフィックス/サフィックスを定義 # ifdef MODULE_NAME # define HVCALLS_PREFIX MODULE_NAME " [hvcall] " # else # define HVCALLS_PREFIX "[hvcall] " # endif # define HVCALLS_SUFFIX // お好みで... // 情報出力用マクロの定義 # define HVCALLS_PRINT_INFO(str) \ printk(KERN_INFO HVCALLS_PREFIX str HVCALLS_SUFFIX "\n") # define HVCALLS_PRINT_VALUE_S64(str, value) \ printk(KERN_INFO HVCALLS_PREFIX str " (" HVCALLS_S64DFMT ")" HVCALLS_SUFFIX "\n", value) # define HVCALLS_PRINT_VALUE_U64(str, value) \ printk(KERN_INFO HVCALLS_PREFIX str " (" HVCALLS_U64UFMT ")" HVCALLS_SUFFIX "\n", value) # define HVCALLS_PRINT_VALUE_HEX(str, value) \ printk(KERN_INFO HVCALLS_PREFIX str " (0x" HVCALLS_U64XFMT ")" HVCALLS_SUFFIX "\n", value) #else # define HVCALLS_PRINT_INFO(str) # define HVCALLS_PRINT_VALUE_S64(str, value) # define HVCALLS_PRINT_VALUE_U64(str, value) # define HVCALLS_PRINT_VALUE_HEX(str, value) #endif /*HVCALLS_DO_PRINT_INFO*/ // エラー出力用マクロの定義 #define HVCALLS_PRINT_ERR(str, value) \ printk(KERN_ERR "Error: %s\n\t[%s(%d) %s : value(" HVCALLS_S64DFMT ")]\n", \ str, __FILE__, __LINE__, __func__, (__s64)value) #endif /*HVCALLS__COMMON_H*/