static unsigned int p_poll(int index, struct file *filp, poll_table *wait) { unsigned int mask = 0; pipe_file *pp = &(pipes[index]); #ifdef KERNEL_PIPE if(pipeType[index]>=PIPE_TYPE_KERNEL_THREAD) return (POLLIN|POLLRDNORM); #endif poll_wait(filp, &(RQ(index)), wait); if(pp->r_poll || dev_search(&(pp->device), pp->r_pos, (pp->device).head)){ if(pp->r_poll) pp->r_poll = 0; mask |= POLLIN | POLLRDNORM; /* readable */ } return mask; }
void intHandler(void) { unsigned int timeStamp = GET_TODLOW; unsigned int prid = getPRID(); state_t *ints_oldarea; pcb_t* current = getCurrentProcess(prid); if(prid == 0) ints_oldarea = (state_t *) INT_OLDAREA; else ints_oldarea = getNewOldAreaPtr(prid, INT_OLDAREA_INDEX); // Aggiorno i tempi di esecuzione del processo updateProcessExecTime(timeStamp, current); // Aggiorno lo stato del processore nel pcb updatePcbCPUState(ints_oldarea, current); /* selezione del gestore per gli interrupt giusto */ if(CAUSE_IP_GET(ints_oldarea->cause, 1)) /* interrupt processor local timer */ { pltIntHandler(current); } else if (CAUSE_IP_GET(ints_oldarea->cause, 2)) { intervalIntHandler(ints_oldarea); /* interval timer interrupt */ } else if (CAUSE_IP_GET(ints_oldarea->cause, 7)) /* int terminali */ { unsigned int dBA = dev_search(devCalc(4)); /* calcolo se l'int è del sub-device trasmettitore, ricevitore o entrambi */ if (((*(memaddr *) dBA + 0x8) >= ILLEGAL_OPCODE) || ((*(memaddr *) dBA + 0x8) <= CHAR_TRASM)) IOIntHandler(dBA + 0x8, dBA + 0xc); if (((*(memaddr *) dBA) >= ILLEGAL_OPCODE) || ((*(memaddr *) dBA) <= CHAR_RECV)) IOIntHandler(dBA, dBA + 0x4); } }