-serial_interrupt (struct intr_frame *f UNUSED)
-{
- /* As long as we have space in our buffer for a byte,
- and the hardware has a byte to give us,
- receive a byte. */
- while (!queue_full (&recv_queue) && (inb (LSR_REG) & LSR_DR) != 0)
- {
- uint8_t byte = inb (RBR_REG);
- //outb (0x0402, byte);
- queue_putc (&recv_queue, byte);
- }
-
- /* As long as we have a byte to transmit,
- and the hardware is ready to accept a byte for transmission,
- transmit a byte. */
- while (!queue_empty (&xmit_queue) && (inb (LSR_REG) & LSR_THRE) != 0)
- outb (THR_REG, queue_getc (&xmit_queue));
-
- /* Update interrupt enable register based on queue status. */
- update_ier ();
-}
-\f
-static int next (int pos);
-static bool owned_by_current_thread (const struct queue *);
-static void wait (struct queue *q, struct thread **waiter);
-static void signal (struct queue *q, struct thread **waiter);
-
-static void
-queue_init (struct queue *q, const char *name)
-{
- lock_init (&q->lock, name);
- q->not_full = q->not_empty = NULL;
- q->head = q->tail = 0;
-}
-
-static void
-queue_lock (struct queue *q)
-{
- lock_acquire (&q->lock);
- q->old_level = intr_disable ();
-}
-
-static void
-queue_unlock (struct queue *q)
-{
- ASSERT (!intr_context ());
- ASSERT (owned_by_current_thread (q));
-
- lock_release (&q->lock);
- intr_set_level (q->old_level);
-}
-
-static bool
-queue_empty (const struct queue *q)