2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
7 #include <aros/debug.h>
9 #include <aros/asmcall.h>
10 #include <exec/execbase.h>
11 #include <exec/lists.h>
13 #define __AROS_KERNEL__
15 #include "exec_intern.h"
17 #include "kernel_intern.h"
19 #include "intservers.h"
21 /* VBlankServer. The same as general purpose IntServer but also counts task's quantum */
22 AROS_INTH3(VBlankServer
, struct List
*, intList
, intMask
, custom
)
26 struct KernelBase
*KernelBase
= __kernelBase
;
27 struct PlatformData
*pdata
= KernelBase
->kb_PlatformData
;
28 struct APICData
*apicData
= pdata
->kb_APIC
;
29 #if defined(__AROSEXEC_SMP__)
30 struct X86SchedulerPrivate
*apicScheduleData
;
33 D(bug("[Exec:X86] %s()\n", __func__
));
36 * If the APIC's dont have their own heartbeat timer,
37 * First decrease Elapsed time for current task
39 if ((!apicData
) || (!(apicData
->flags
& APF_TIMER
)))
41 #if defined(__AROSEXEC_SMP__)
45 UWORD current
= SCHEDELAPSED_GET
;
47 SCHEDELAPSED_SET(--current
);
51 FLAG_SCHEDQUANTUM_SET
;
54 #if defined(__AROSEXEC_SMP__)
58 /* we can only update cpu #0 */
59 apicTLS
= apicData
->cores
[0].cpu_TLS
;
60 if ((apicTLS
) && ((apicScheduleData
= apicTLS
->ScheduleData
) != NULL
))
62 if ((apicScheduleData
->Elapsed
) && (--apicScheduleData
->Elapsed
== 0))
64 __AROS_ATOMIC_OR_L(apicScheduleData
->ScheduleFlags
, TLSSF_Quantum
);
65 __AROS_ATOMIC_OR_L(apicScheduleData
->ScheduleFlags
, TLSSF_Switch
);
72 /* Chain to the generic routine */
73 return AROS_INTC3(IntServer
, intList
, intMask
, custom
);