From 0e248ccce2048cd444e72ed25e8c999c68f097b8 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 23 Jun 2013 14:42:36 +0800 Subject: [PATCH] Kernel/x86 - Workaround for possibly buggy 64-bit divide/modulo --- KernelLand/Kernel/arch/x86/lib.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/KernelLand/Kernel/arch/x86/lib.c b/KernelLand/Kernel/arch/x86/lib.c index b732f75f..f862afd2 100644 --- a/KernelLand/Kernel/arch/x86/lib.c +++ b/KernelLand/Kernel/arch/x86/lib.c @@ -351,6 +351,10 @@ DEF_DIVMOD(64); Uint64 DivMod64U(Uint64 Num, Uint64 Div, Uint64 *Rem) { + if( Div == 16 ) { + if(Rem) *Rem = Num & 15; + return Num >> 4; + } if( Div < 0x100000000ULL && Num < 0xFFFFFFFF * Div ) { Uint32 rem, ret_32; __asm__ __volatile__( -- 2.20.1