aboutsummaryrefslogtreecommitdiffstats
path: root/xenolinux-2.4.21-pre4-sparse/arch
diff options
context:
space:
mode:
Diffstat (limited to 'xenolinux-2.4.21-pre4-sparse/arch')
-rw-r--r--xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_ops.h17
-rw-r--r--xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/sched_ops.c81
2 files changed, 64 insertions, 34 deletions
diff --git a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_ops.h b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_ops.h
index a482d3c4d9..22ebd7aba0 100644
--- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_ops.h
+++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_ops.h
@@ -6,6 +6,7 @@
* Copyright (c) 2002, K A Fraser, B Dragovic
*
* MUST BE KEPT IN SYNC WITH xen/include/xeno/dom0_ops.h
+ * MUST BE KEPT IN SYNC WITH tools/domain_builder/dom0_ops.h
*/
#define DOM0_NEWDOMAIN 0
@@ -43,16 +44,16 @@ typedef struct dom0_getmemlist_st
typedef struct dom0_bvtctl_st
{
- unsigned long ctx_allow; /* context switch allowance */
+ unsigned long ctx_allow; /* context switch allowance */
} dom0_bvtctl_t;
typedef struct dom0_adjustdom_st
{
- unsigned int domain; /* domain id */
- unsigned long mcu_adv; /* mcu advance: inverse of weight */
- unsigned long warp; /* time warp */
- unsigned long warpl; /* warp limit */
- unsigned long warpu; /* unwarp time requirement */
+ unsigned int domain; /* domain id */
+ unsigned long mcu_adv; /* mcu advance: inverse of weight */
+ unsigned long warp; /* time warp */
+ unsigned long warpl; /* warp limit */
+ unsigned long warpu; /* unwarp time requirement */
} dom0_adjustdom_t;
/* This is entirely processed by XenoLinux */
@@ -92,8 +93,8 @@ typedef struct dom0_op_st
dom0_newdomain_t newdomain;
dom0_killdomain_t killdomain;
dom0_getmemlist_t getmemlist;
- dom0_bvtctl_t bvtctl;
- dom0_adjustdom_t adjustdom;
+ dom0_bvtctl_t bvtctl;
+ dom0_adjustdom_t adjustdom;
dom_mem_t dommem;
dom_pgupdate_t pgupdate;
dom_meminfo_t meminfo;
diff --git a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/sched_ops.c b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/sched_ops.c
index 2408f83880..9c5fce7857 100644
--- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/sched_ops.c
+++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/sched_ops.c
@@ -16,26 +16,33 @@
*
* Commands understood by the interface:
*
- * S <did> <mcu advance> [ <warp> <warp limit> <unwarp limit> ]
* C <context swith allowance>
+ * S <did> <mcu advance> <warp> <warp limit> <unwarp limit>
*
****************************************************************************
* $Id: c-insert.c,v 1.7 2002/11/08 16:04:34 rn Exp $
****************************************************************************
*/
-
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/ctype.h>
+#include <linux/string.h>
+#include <linux/errno.h>
#include <linux/proc_fs.h>
-#include <asm/hypervisor.h>
+
#include "dom0_ops.h"
#define SCHED_ENTRY "sched"
extern struct proc_dir_entry *xeno_base;
static struct proc_dir_entry *sched_pde;
+static unsigned char readbuf[1024];
static int sched_read_proc(char *page, char **start, off_t off,
- int count, int *eof, void *data)
+ int count, int *eof, void *data)
{
strcpy(page, readbuf);
*readbuf = '\0';
@@ -46,35 +53,57 @@ static int sched_read_proc(char *page, char **start, off_t off,
static int sched_write_proc(struct file *file, const char *buffer,
- u_long count, void *data)
+ u_long count, void *data)
{
- dom0_op_t op;
+ dom0_op_t op;
- int ret, len;
- int ts, te, tl; /* token start, end, and length */
+ int ret, len;
+ int ts, te, tl; /* token start, end, and length */
/* Only admin can adjust scheduling parameters */
if ( !capable(CAP_SYS_ADMIN) )
return -EPERM;
- /* parse the commands */
- len = count;
- ts = te = 0;
-
- while ( count && isspace(buffer[ts]) ) { ts++; count--; } // skip spaces.
- te = ts;
- if ( te <= ts ) goto bad;
- tl = te - ts;
-
- if ( strncmp(&buffer[ts], "S", tl) == 0 )
- {
- op.cmd = NETWORK_OP_ADDRULE;
- }
- else if ( strncmp(&buffer[ts], "C", tl) == 0 )
- {
- op.cmd = NETWORK_OP_DELETERULE;
- }
-
+ /* parse the commands */
+ len = count;
+ ts = te = 0;
+
+ while ( count && isspace(buffer[ts]) ) { ts++; count--; } /*skip spaces*/
+ te = ts;
+ while ( count && !isspace(buffer[te]) ) { te++; count--; } /*command end*/
+ if ( te <= ts ) goto bad;
+ tl = te - ts;
+
+ if ( strncmp(&buffer[ts], "C", tl) == 0 ) {
+ op.cmd = DOM0_BVTCTL;
+ } else if ( strncmp(&buffer[ts], "S", tl) == 0 ) {
+ op.cmd = DOM0_ADJUSTDOM;
+ } else
+ goto bad;
+
+ /* skip whitspaces and get first parameter */
+ ts = te; while ( count && isspace(buffer[ts]) ) { ts++; count--; }
+ te = ts; while ( count && !isspace(buffer[te]) ) { te++; count--; }
+ if ( te <= ts ) goto bad;
+ tl = te - ts;
+ if ( !isdigit(buffer[ts]) ) goto bad;
+
+ if (op.cmd == DOM0_BVTCTL) {
+ /* get context switch allowance */
+ sscanf(&buffer[ts], "%lu", &op.u.bvtctl.ctx_allow);
+ } else if (op.cmd == DOM0_ADJUSTDOM) {
+ sscanf(&buffer[ts], "%u %lu %lu %lu %lu",
+ &op.u.adjustdom.domain,
+ &op.u.adjustdom.mcu_adv,
+ &op.u.adjustdom.warp,
+ &op.u.adjustdom.warpl,
+ &op.u.adjustdom.warpu);
+ }
+ ret = HYPERVISOR_dom0_op(&op);
+ return sizeof(op);
+
+ bad:
+ return -EINVAL;
}