Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


*** empty log message ***
Jack Lange [Mon, 8 Sep 2008 19:19:59 +0000 (19:19 +0000)]
palacios/build/Makefile
palacios/include/geekos/ring_buffer.h
palacios/src/geekos/ring_buffer.c

index 697df40..7c689c1 100644 (file)
@@ -1,6 +1,6 @@
 # Makefile for GeekOS kernel, userspace, and tools
 # Copyright (c) 2004,2005 David H. Hovemeyer <daveho@cs.umd.edu>
-# $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
index 2e14891..51a01f1 100644 (file)
@@ -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__
index 7e0505f..aa87458 100644 (file)
@@ -1,7 +1,7 @@
 #include <geekos/ring_buffer.h>
 #include <geekos/malloc.h>
 #include <geekos/ktypes.h>
-
+#include <geekos/debug.h>
 
 
 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]);
+  }
+}