fix #681
diff --git a/arch/AArch64/AArch64InstPrinter.c b/arch/AArch64/AArch64InstPrinter.c
index 53dba19..3b61627 100644
--- a/arch/AArch64/AArch64InstPrinter.c
+++ b/arch/AArch64/AArch64InstPrinter.c
@@ -1037,7 +1037,12 @@
double FPImm = MCOperand_isFPImm(MO) ? MCOperand_getFPImm(MO) : AArch64_AM_getFPImmFloat((int)MCOperand_getImm(MO));
// 8 decimal places are enough to perfectly represent permitted floats.
+#if defined(_KERNEL_MODE)
+ // Issue #681: Windows kernel does not support formatting float point
+ SStream_concat(O, "#<float_point_unsupported>");
+#else
SStream_concat(O, "#%.8f", FPImm);
+#endif
if (MI->csh->detail) {
MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_FP;
MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].fp = FPImm;
diff --git a/arch/ARM/ARMInstPrinter.c b/arch/ARM/ARMInstPrinter.c
index bdca3e7..17b4e8f 100644
--- a/arch/ARM/ARMInstPrinter.c
+++ b/arch/ARM/ARMInstPrinter.c
@@ -2103,7 +2103,13 @@
static void printFPImmOperand(MCInst *MI, unsigned OpNum, SStream *O)
{
MCOperand *MO = MCInst_getOperand(MI, OpNum);
+
+#if defined(_KERNEL_MODE)
+ // Issue #681: Windows kernel does not support formatting float point
+ SStream_concat(O, "#<float_point_unsupported>");
+#else
SStream_concat(O, "#%e", getFPImmFloat((unsigned int)MCOperand_getImm(MO)));
+#endif
if (MI->csh->detail) {
MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].type = ARM_OP_FP;
MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].fp = getFPImmFloat((unsigned int)MCOperand_getImm(MO));
diff --git a/cs.c b/cs.c
index 3be8ceb..4549e28 100644
--- a/cs.c
+++ b/cs.c
@@ -21,6 +21,21 @@
#include "windows\winkernel_mm.h"
#endif
+// Issue #681: Windows kernel does not support formatting float point
+#if defined(_KERNEL_MODE) && !defined(CAPSTONE_DIET)
+#if defined(CAPSTONE_HAS_ARM) || defined(CAPSTONE_HAS_ARM64)
+#define CAPSTONE_STR_INTERNAL(x) #x
+#define CAPSTONE_STR(x) CAPSTONE_STR_INTERNAL(x)
+#define CAPSTONE_MSVC_WRANING_PREFIX __FILE__ "("CAPSTONE_STR(__LINE__)") : warning message : "
+
+#pragma message(CAPSTONE_MSVC_WRANING_PREFIX "Windows driver does not support full features for selected architecture(s). Define CAPSTONE_DIET to compile Capstone with only supported features. See issue #681 for details.")
+
+#undef CAPSTONE_MSVC_WRANING_PREFIX
+#undef CAPSTONE_STR
+#undef CAPSTONE_STR_INTERNAL
+#endif
+#endif // defined(_KERNEL_MODE) && !defined(CAPSTONE_DIET)
+
#if !defined(CAPSTONE_HAS_OSXKERNEL) && !defined(CAPSTONE_DIET) && !defined(_KERNEL_MODE)
#define INSN_CACHE_SIZE 32
#else
diff --git a/tests/test_arm.c b/tests/test_arm.c
index 1af84be..ec042a7 100644
--- a/tests/test_arm.c
+++ b/tests/test_arm.c
@@ -56,7 +56,12 @@
printf("\t\toperands[%u].type: IMM = 0x%x\n", i, op->imm);
break;
case ARM_OP_FP:
+#if defined(_KERNEL_MODE)
+ // Issue #681: Windows kernel does not support formatting float point
+ printf("\t\toperands[%u].type: FP = <float_point_unsupported>\n", i);
+#else
printf("\t\toperands[%u].type: FP = %f\n", i, op->fp);
+#endif
break;
case ARM_OP_MEM:
printf("\t\toperands[%u].type: MEM\n", i);
diff --git a/tests/test_arm64.c b/tests/test_arm64.c
index 6a9f8da..bc205c3 100644
--- a/tests/test_arm64.c
+++ b/tests/test_arm64.c
@@ -54,7 +54,12 @@
printf("\t\toperands[%u].type: IMM = 0x%" PRIx64 "\n", i, op->imm);
break;
case ARM64_OP_FP:
+#if defined(_KERNEL_MODE)
+ // Issue #681: Windows kernel does not support formatting float point
+ printf("\t\toperands[%u].type: FP = <float_point_unsupported>\n", i);
+#else
printf("\t\toperands[%u].type: FP = %f\n", i, op->fp);
+#endif
break;
case ARM64_OP_MEM:
printf("\t\toperands[%u].type: MEM\n", i);