- * Uses %eax,%ecx,%edx,%esi.
- */
-#define TIME_INT_ENTRY \
- NANOTIME32 /* eax low bits nanosecs */ ;\
- movl %gs:CPU_PROCESSOR,%ecx /* get current processor */ ;\
- movl CURRENT_TIMER(%ecx),%ecx /* get current timer */ ;\
- movl %eax,%edx /* save timestamp in %edx */ ;\
- subl TIMER_TSTAMP(%ecx),%eax /* compute elapsed time */ ;\
- TIMER_UPDATE(%ecx,%eax) /* update timer struct */ ;\
- movl %gs:CPU_ACTIVE_THREAD,%ecx /* get current thread */ ;\
- addl $(SYSTEM_TIMER),%ecx /* point to sys timer */ ;\
- movl %edx,TIMER_TSTAMP(%ecx) /* set timestamp */
+ * Uses %eax,%ebx,%ecx,%edx,%esi,%edi.
+ * Saves processor state info on stack.
+ */
+#define TIME_INT_ENTRY \
+ NANOTIME /* edx:eax nanosecs */ ; \
+ movl %eax,%gs:CPU_INT_EVENT_TIME /* save in cpu data */ ; \
+ movl %edx,%gs:CPU_INT_EVENT_TIME+4 /* save in cpu data */ ; \
+ movl %eax,%esi /* save timestamp */ ; \
+ movl %edx,%edi /* save timestamp */ ; \
+ movl %gs:CPU_PROCESSOR,%ebx /* get current processor */ ; \
+ movl THREAD_TIMER(%ebx),%ecx /* get current timer */ ; \
+ subl TIMER_TSTAMP(%ecx),%eax /* compute elapsed time */ ; \
+ sbbl TIMER_TSTAMP+4(%ecx),%edx /* compute elapsed time */ ; \
+ TIMER_UPDATE(%ecx,%edx,%eax) /* update timer */ ; \
+ movl KERNEL_TIMER(%ebx),%ecx /* point to kernel timer */ ; \
+ movl %esi,TIMER_TSTAMP(%ecx) /* set timestamp */ ; \
+ movl %edi,TIMER_TSTAMP+4(%ecx) /* set timestamp */ ; \
+ movl %esi,%eax /* restore timestamp */ ; \
+ movl %edi,%edx /* restore timestamp */ ; \
+ movl CURRENT_STATE(%ebx),%ecx /* get current state */ ; \
+ pushl %ecx /* save state */ ; \
+ subl TIMER_TSTAMP(%ecx),%eax /* compute elapsed time */ ; \
+ sbbl TIMER_TSTAMP+4(%ecx),%edx /* compute elapsed time */ ; \
+ TIMER_UPDATE(%ecx,%edx,%eax) /* update timer */ ; \
+ leal IDLE_STATE(%ebx),%eax /* get idle state */ ; \
+ cmpl %eax,%ecx /* compare current state */ ; \
+ je 0f /* skip if equal */ ; \
+ leal SYSTEM_STATE(%ebx),%ecx /* get system state */ ; \
+ movl %ecx,CURRENT_STATE(%ebx) /* set current state */ ; \
+0: movl %esi,TIMER_TSTAMP(%ecx) /* set timestamp */ ; \
+ movl %edi,TIMER_TSTAMP+4(%ecx) /* set timestamp */