rem: events[curr_cpu] = (timer *)event->entry.next;
add: sEvents[currentCPU] = (timer *)event->entry.next;
context: int timer_interrupt(){	bigtime_t sched_time;	timer *event;	spinlock *spinlock;	int curr_cpu = smp_get_current_cpu();	int rc = B_HANDLED_INTERRUPT;//	dprintf("timer_interrupt: time 0x%x 0x%x, cpu %d\n", system_time(), smp_get_current_cpu());	spinlock = &timer_spinlock[curr_cpu];	acquire_spinlock(spinlock);restart_scan:	event = events[curr_cpu];	if ((event) && ((bigtime_t)event->entry.key < system_time())) {		// this event needs to happen		int mode = event->flags;		events[curr_cpu] = (timer *)event->entry.next;		event->entry.key = 0;		release_spinlock(spinlock);		// call the callback		// note: if the event is not periodic, it is ok		// to delete the event structure inside the callback		if (event->hook) {			rc = event->hook(event);//			if (event->func(event->data) == INT_RESCHEDULE)//				rc = INT_RESCHEDULE;		}		acquire_spinlock(spinlock);		if (mode == B_PERIODIC_TIMER) {			// we need to adjust it and add it back to the list			sched_time = system_time() + event->period;			if (sched_time == 0)				sched_time = 1; // if we wrapped around and happen				                // to hit zero, set it to one, since				                // zero represents not scheduled			event->entry.key = (int64)sched_time;			add_event_to_list(event, &events[curr_cpu]);		}		goto restart_scan; // the list may have changed	}	// setup the next hardware timer	if (events[curr_cpu] != NULL)		arch_timer_set_hardware_timer((bigtime_t)events[curr_cpu]->entry.key - system_time());	release_spinlock(spinlock);	return rc;}