From: Jack Lange Date: Mon, 8 Sep 2008 19:19:59 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: 1.0~48 X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=e642ea3a27bf1961a19ef3776c34333025c2a585;p=palacios.git *** empty log message *** --- diff --git a/palacios/build/Makefile b/palacios/build/Makefile index 697df40..7c689c1 100644 --- a/palacios/build/Makefile +++ b/palacios/build/Makefile @@ -1,6 +1,6 @@ # Makefile for GeekOS kernel, userspace, and tools # Copyright (c) 2004,2005 David H. Hovemeyer -# $Revision: 1.67 $ +# $Revision: 1.68 $ # This is free software. You are permitted to use, # redistribute, and modify it as specified in the file "COPYING". @@ -228,7 +228,7 @@ KERNEL_C_SRCS := idt.c int.c trap.c irq.c io.c \ serial.c reboot.c \ paging.c \ debug.c vmm_stubs.c vm.c pci.c\ - queue.c socket.c \ + queue.c socket.c ring_buffer.c \ main.c # Kernel object files built from C source files diff --git a/palacios/include/geekos/ring_buffer.h b/palacios/include/geekos/ring_buffer.h index 2e14891..51a01f1 100644 --- a/palacios/include/geekos/ring_buffer.h +++ b/palacios/include/geekos/ring_buffer.h @@ -28,4 +28,7 @@ int rb_data_len(struct ring_buffer * ring); int rb_capacity(struct ring_buffer * ring); +void print_ring_buffer(struct ring_buffer * ring); + + #endif // ! __RING_BUFFER_H__ diff --git a/palacios/src/geekos/ring_buffer.c b/palacios/src/geekos/ring_buffer.c index 7e0505f..aa87458 100644 --- a/palacios/src/geekos/ring_buffer.c +++ b/palacios/src/geekos/ring_buffer.c @@ -1,7 +1,7 @@ #include #include #include - +#include void init_ring_buffer(struct ring_buffer * ring, uint_t size) { @@ -32,11 +32,11 @@ void free_ring_buffer(struct ring_buffer * ring) { static inline uchar_t * get_read_ptr(struct ring_buffer * ring) { - return (uchar_t *)&(ring->buf + ring->start); + return (uchar_t *)(ring->buf + ring->start); } static inline uchar_t * get_write_ptr(struct ring_buffer * ring) { - return (uchar_t *)&(ring->buf + ring->end); + return (uchar_t *)(ring->buf + ring->end); } @@ -131,3 +131,14 @@ int rb_write(struct ring_buffer * ring, char * src, uint_t len) { return write_len; } + + +void print_ring_buffer(struct ring_buffer * ring) { + int ctr = 0; + + for (ctr = 0; ctr < ring->current_len; ctr++) { + int index = (ctr + ring->start) % ring->size; + + PrintBoth("Entry %d (index=%d): %c\n", ctr, index, ring->buf[index]); + } +}