summaryrefslogtreecommitdiff
path: root/emulators/hercules/patches/patch-aj
blob: c9545cb36ebf7d9383982688b0373d2556aabeb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
$NetBSD: patch-aj,v 1.2 2010/01/17 08:00:47 dholland Exp $

Patch from Wofgang Solfrank:

"Change the timeout value from 1 usec to 10 msec in the timer thread.
At least with unproven-pthreads, the comment above that is wrong
when stating that a 1 usec timeout would be stretched to the next
system clock tick."

Also, patch out no-longer-supported gcc language extensions.

--- timer.c.orig	2001-02-08 20:02:41.000000000 +0000
+++ timer.c
@@ -190,7 +190,7 @@ struct  timeval tv;                     
 
             /* Decrement the CPU timer if the CPU is running */
             if(regs->cpustate == CPUSTATE_STARTED && (S64)diff > 0)
-                (S64)regs->ptimer -= (S64)diff;
+                regs->ptimer = (S64)regs->ptimer - (S64)diff;
 
             /* Set interrupt flag if the CPU timer is negative */
             if ((S64)regs->ptimer < 0)
@@ -207,7 +207,7 @@ struct  timeval tv;                     
             {
                 /* Decrement the CPU timer if the CPU is running */
                 if( (S64)diff > 0)
-                    (S64)regs->guestregs->ptimer -= (S64)diff;
+                    regs->guestregs->ptimer = (S64)regs->guestregs->ptimer - (S64)diff;
 
                 /* Set interrupt flag if the CPU timer is negative */
                 if ((S64)regs->guestregs->ptimer < 0)
@@ -319,7 +319,7 @@ struct  timeval tv;                     
                 /* Calculate instructions/millisecond for this CPU */
                 regs->mipsrate =
                     (regs->instcount - regs->prevcount) / msecctr;
-                regs->siosrate = regs->siocount;
+                regs->siosrate = regs->siocount * 1000 / msecctr;
 
                 /* Save the instruction counter */
                 regs->prevcount = regs->instcount;
@@ -336,7 +336,7 @@ struct  timeval tv;                     
         /* Sleep for one system clock tick by specifying a one-microsecond
            delay, which will get stretched out to the next clock tick */
         tv.tv_sec = 0;
-        tv.tv_usec = 1;
+        tv.tv_usec = 10000;
         select (0, NULL, NULL, NULL, &tv);
 
     } /* end while */