Skip to contentSkip to conversation

dosemu 1.1.x and 1.1.4.13 bug (?) on CPUs faster than 2.0GHz

DISCUSSION Stas Sergeev 2 participants 2 messages Mar 12, 2003

lore
Share & tools
lore
#0 lore raw

Hello.

Quoted 1 line · Bart Oldeman

it's a multiplication that overflows from an int -- try this patch:

The attached one might also be
necessary to get the correct
output.

base/init/config.c +1 -1
@@ -493,7 +493,7 @@
 		/* speed division factor to get 838ns from CPU clock */
 		config.cpu_tick_spd = (LLF_TICKS*1000000)/chz;
 
-		warn ("Linux kernel %d.%d.%d; CPU speed is %Ld Hz\n",
+		warn ("Linux kernel %d.%d.%d; CPU speed is %lld Hz\n",
 		   kernel_version_code >> 16, (kernel_version_code >> 8) & 255,
 		   kernel_version_code & 255,chz);
 /*		fprintf (stderr,"CPU speed factors %ld,%ld\n",
#1 lore raw
Quoted 5 lines · Stas Sergeev
Quoted 1 line · Bart Oldeman

it's a multiplication that overflows from an int -- try this patch:

The attached one might also be
necessary to get the correct
output.

- warn ("Linux kernel %d.%d.%d; CPU speed is %Ld Hz\n",
+ warn ("Linux kernel %d.%d.%d; CPU speed is %lld Hz\n",

This is good for C99 compliance (C99 only guarantees "ll" but doesn't do anything from the practical point of view) -- "info libc"

`L'
`ll'
`q'
Specifies that the argument is a long long int'. (This type is an extension supported by the GNU C compiler. On systems that don't support extra-long integers, this is the same as long int'.)

The q' modifier is another name for the same thing, which comes from 4.4 BSD; a long long int' is sometimes called a "quad" `int'.

Still it's good to use a standard approach whereever possible, so thanks, Bart