changeset 653:0d289341e756

cp: maintain a circular buffer of Channel Report Words Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Thu, 29 Mar 2012 17:42:13 -0400
parents c195a73e0204
children 57988d03241d
files cp/guest/attach.c cp/guest/init.c cp/include/vcpu.h
diffstat 3 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/cp/guest/attach.c	Tue Jul 30 21:58:41 2019 -0400
+++ b/cp/guest/attach.c	Thu Mar 29 17:42:13 2012 -0400
@@ -1,17 +1,18 @@
 /*
- * (C) Copyright 2007-2011  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * (C) Copyright 2007-2012  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  *
  * This file is released under the GPLv2.  See the COPYING file for more
  * details.
  */
 
+#include <circbuf.h>
 #include <vcpu.h>
 #include <guest.h>
 #include <sclp.h>
 
 static void guest_append_crw(struct virt_sys *sys, struct crw *crw)
 {
-	FIXME("guest CRW was not queued");
+	insert_circbuf(&sys->crws, crw);
 }
 
 int guest_attach(struct virt_sys *sys, u64 rdev, u64 vdev)
--- a/cp/guest/init.c	Tue Jul 30 21:58:41 2019 -0400
+++ b/cp/guest/init.c	Thu Mar 29 17:42:13 2012 -0400
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2007-2011  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * (C) Copyright 2007-2012  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  *
  * This file is released under the GPLv2.  See the COPYING file for more
  * details.
@@ -213,6 +213,8 @@
 	if (!sys)
 		return NULL;
 
+	init_circbuf(&sys->crws, struct crw, NUM_CRWS);
+
 	if (alloc_console(&sys->console))
 		goto free;
 
--- a/cp/include/vcpu.h	Tue Jul 30 21:58:41 2019 -0400
+++ b/cp/include/vcpu.h	Thu Mar 29 17:42:13 2012 -0400
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2007-2011  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * (C) Copyright 2007-2012  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  *
  * This file is released under the GPLv2.  See the COPYING file for more
  * details.
@@ -9,6 +9,7 @@
 #define __VCPU_H
 
 #include <list.h>
+#include <circbuf.h>
 #include <console.h>
 #include <mutex.h>
 
@@ -66,6 +67,7 @@
 	u8 *bigbuf;
 };
 
+#define NUM_CRWS	32
 struct virt_sys {
 	struct task *task;		/* the virtual CPU task */
 	struct virt_cpu *cpu;		/* the virtual CPU state */
@@ -83,6 +85,7 @@
 
 	mutex_t virt_devs_lock;
 	struct list_head virt_devs;	/* list of guest virtual devs */
+	CIRCBUF(crws, NUM_CRWS, struct crw);
 
 	struct address_space as;	/* the guest storage */
 };