1 /* (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> */
2 /* (c) 2008, The V3VEE Project <http://www.v3vee.org> */
5 #include <palacios/vmm_queue.h>
9 void v3_init_queue(struct gen_queue * queue) {
10 queue->num_entries = 0;
11 INIT_LIST_HEAD(&(queue->entries));
15 struct gen_queue * v3_create_queue() {
16 struct gen_queue * tmp_queue = V3_Malloc(sizeof(struct gen_queue));
17 v3_init_queue(tmp_queue);
21 void v3_enqueue(struct gen_queue * queue, addr_t entry) {
22 struct queue_entry * q_entry = V3_Malloc(sizeof(struct queue_entry));
24 q_entry->entry = entry;
25 list_add_tail(&(q_entry->entry_list), &(queue->entries));
30 addr_t v3_dequeue(struct gen_queue * queue) {
33 if (!list_empty(&(queue->entries))) {
34 struct list_head * q_entry = queue->entries.next;
35 struct queue_entry * tmp_entry = list_entry(q_entry, struct queue_entry, entry_list);
37 entry_val = tmp_entry->entry;