ia64/xen-unstable

changeset 6602:fc12b08bf4fe

Mini-os fixes from Simon Kagstrom.
author kaf24@firebug.cl.cam.ac.uk
date Fri Sep 02 10:04:42 2005 +0000 (2005-09-02)
parents 4544d105f194
children 291e816acbf4
files extras/mini-os/README extras/mini-os/domain_config extras/mini-os/include/hypervisor.h extras/mini-os/include/list.h
line diff
     1.1 --- a/extras/mini-os/README	Fri Sep 02 10:04:11 2005 +0000
     1.2 +++ b/extras/mini-os/README	Fri Sep 02 10:04:42 2005 +0000
     1.3 @@ -23,13 +23,8 @@ Stuff it doesn't show:
     1.4  
     1.5  - to build it just type make.
     1.6  
     1.7 -- copy image.final somewhere where dom0 can access it
     1.8 +- to start it do the following in domain0 (assuming xend is running)
     1.9 +  # xm create domain_config
    1.10  
    1.11 -- in dom0
    1.12 -  # xi_create 16000 test
    1.13 -    <domid>
    1.14 -  # xi_build <domid> image.final 0
    1.15 -  # xi_start <domid>
    1.16 -
    1.17 -this prints out a bunch of stuff and then every 1000 timer interrupts the
    1.18 -system time.
    1.19 +this starts the kernel and prints out a bunch of stuff and then every
    1.20 +1000 timer interrupts the system time.
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/extras/mini-os/domain_config	Fri Sep 02 10:04:42 2005 +0000
     2.3 @@ -0,0 +1,17 @@
     2.4 +#  -*- mode: python; -*-
     2.5 +#============================================================================
     2.6 +# Python configuration setup for 'xm create'.
     2.7 +# This script sets the parameters used when a domain is created using 'xm create'.
     2.8 +# You use a separate script for each domain you want to create, or 
     2.9 +# you can set the parameters for the domain on the xm command line.
    2.10 +#============================================================================
    2.11 +
    2.12 +#----------------------------------------------------------------------------
    2.13 +# Kernel image file.
    2.14 +kernel = "mini-os.elf"
    2.15 +
    2.16 +# Initial memory allocation (in megabytes) for the new domain.
    2.17 +memory = 32
    2.18 +
    2.19 +# A name for your domain. All domains must have different names.
    2.20 +name = "Mini-OS"
     3.1 --- a/extras/mini-os/include/hypervisor.h	Fri Sep 02 10:04:11 2005 +0000
     3.2 +++ b/extras/mini-os/include/hypervisor.h	Fri Sep 02 10:04:42 2005 +0000
     3.3 @@ -329,7 +329,7 @@ static __inline__ int HYPERVISOR_dom_mem
     3.4      int ret;
     3.5      __asm__ __volatile__ (
     3.6          TRAP_INSTR
     3.7 -        : "=a" (ret) : "0" (__HYPERVISOR_dom_mem_op),
     3.8 +        : "=a" (ret) : "0" (__HYPERVISOR_memory_op),
     3.9          _a1 (dom_mem_op) : "memory" );
    3.10  
    3.11      return ret;
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/extras/mini-os/include/list.h	Fri Sep 02 10:04:42 2005 +0000
     4.3 @@ -0,0 +1,184 @@
     4.4 +#ifndef _LINUX_LIST_H
     4.5 +#define _LINUX_LIST_H
     4.6 +
     4.7 +/*
     4.8 + * Simple doubly linked list implementation.
     4.9 + *
    4.10 + * Some of the internal functions ("__xxx") are useful when
    4.11 + * manipulating whole lists rather than single entries, as
    4.12 + * sometimes we already know the next/prev entries and we can
    4.13 + * generate better code by using them directly rather than
    4.14 + * using the generic single-entry routines.
    4.15 + */
    4.16 +
    4.17 +struct list_head {
    4.18 +	struct list_head *next, *prev;
    4.19 +};
    4.20 +
    4.21 +#define LIST_HEAD_INIT(name) { &(name), &(name) }
    4.22 +
    4.23 +#define LIST_HEAD(name) \
    4.24 +	struct list_head name = LIST_HEAD_INIT(name)
    4.25 +
    4.26 +#define INIT_LIST_HEAD(ptr) do { \
    4.27 +	(ptr)->next = (ptr); (ptr)->prev = (ptr); \
    4.28 +} while (0)
    4.29 +
    4.30 +/*
    4.31 + * Insert a new entry between two known consecutive entries. 
    4.32 + *
    4.33 + * This is only for internal list manipulation where we know
    4.34 + * the prev/next entries already!
    4.35 + */
    4.36 +static __inline__ void __list_add(struct list_head * new,
    4.37 +	struct list_head * prev,
    4.38 +	struct list_head * next)
    4.39 +{
    4.40 +	next->prev = new;
    4.41 +	new->next = next;
    4.42 +	new->prev = prev;
    4.43 +	prev->next = new;
    4.44 +}
    4.45 +
    4.46 +/**
    4.47 + * list_add - add a new entry
    4.48 + * @new: new entry to be added
    4.49 + * @head: list head to add it after
    4.50 + *
    4.51 + * Insert a new entry after the specified head.
    4.52 + * This is good for implementing stacks.
    4.53 + */
    4.54 +static __inline__ void list_add(struct list_head *new, struct list_head *head)
    4.55 +{
    4.56 +	__list_add(new, head, head->next);
    4.57 +}
    4.58 +
    4.59 +/**
    4.60 + * list_add_tail - add a new entry
    4.61 + * @new: new entry to be added
    4.62 + * @head: list head to add it before
    4.63 + *
    4.64 + * Insert a new entry before the specified head.
    4.65 + * This is useful for implementing queues.
    4.66 + */
    4.67 +static __inline__ void list_add_tail(struct list_head *new, struct list_head *head)
    4.68 +{
    4.69 +	__list_add(new, head->prev, head);
    4.70 +}
    4.71 +
    4.72 +/*
    4.73 + * Delete a list entry by making the prev/next entries
    4.74 + * point to each other.
    4.75 + *
    4.76 + * This is only for internal list manipulation where we know
    4.77 + * the prev/next entries already!
    4.78 + */
    4.79 +static __inline__ void __list_del(struct list_head * prev,
    4.80 +				  struct list_head * next)
    4.81 +{
    4.82 +	next->prev = prev;
    4.83 +	prev->next = next;
    4.84 +}
    4.85 +
    4.86 +/**
    4.87 + * list_del - deletes entry from list.
    4.88 + * @entry: the element to delete from the list.
    4.89 + * Note: list_empty on entry does not return true after this, the entry is in an undefined state.
    4.90 + */
    4.91 +static __inline__ void list_del(struct list_head *entry)
    4.92 +{
    4.93 +	__list_del(entry->prev, entry->next);
    4.94 +}
    4.95 +
    4.96 +/**
    4.97 + * list_del_init - deletes entry from list and reinitialize it.
    4.98 + * @entry: the element to delete from the list.
    4.99 + */
   4.100 +static __inline__ void list_del_init(struct list_head *entry)
   4.101 +{
   4.102 +	__list_del(entry->prev, entry->next);
   4.103 +	INIT_LIST_HEAD(entry); 
   4.104 +}
   4.105 +
   4.106 +/**
   4.107 + * list_empty - tests whether a list is empty
   4.108 + * @head: the list to test.
   4.109 + */
   4.110 +static __inline__ int list_empty(struct list_head *head)
   4.111 +{
   4.112 +	return head->next == head;
   4.113 +}
   4.114 +
   4.115 +/**
   4.116 + * list_splice - join two lists
   4.117 + * @list: the new list to add.
   4.118 + * @head: the place to add it in the first list.
   4.119 + */
   4.120 +static __inline__ void list_splice(struct list_head *list, struct list_head *head)
   4.121 +{
   4.122 +	struct list_head *first = list->next;
   4.123 +
   4.124 +	if (first != list) {
   4.125 +		struct list_head *last = list->prev;
   4.126 +		struct list_head *at = head->next;
   4.127 +
   4.128 +		first->prev = head;
   4.129 +		head->next = first;
   4.130 +
   4.131 +		last->next = at;
   4.132 +		at->prev = last;
   4.133 +	}
   4.134 +}
   4.135 +
   4.136 +/**
   4.137 + * list_entry - get the struct for this entry
   4.138 + * @ptr:	the &struct list_head pointer.
   4.139 + * @type:	the type of the struct this is embedded in.
   4.140 + * @member:	the name of the list_struct within the struct.
   4.141 + */
   4.142 +#define list_entry(ptr, type, member) \
   4.143 +	((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
   4.144 +
   4.145 +/**
   4.146 + * list_for_each	-	iterate over a list
   4.147 + * @pos:	the &struct list_head to use as a loop counter.
   4.148 + * @head:	the head for your list.
   4.149 + */
   4.150 +#define list_for_each(pos, head) \
   4.151 +	for (pos = (head)->next; pos != (head); pos = pos->next)
   4.152 +        	
   4.153 +/**
   4.154 + * list_for_each_safe	-	iterate over a list safe against removal of list entry
   4.155 + * @pos:	the &struct list_head to use as a loop counter.
   4.156 + * @n:		another &struct list_head to use as temporary storage
   4.157 + * @head:	the head for your list.
   4.158 + */
   4.159 +#define list_for_each_safe(pos, n, head) \
   4.160 +	for (pos = (head)->next, n = pos->next; pos != (head); \
   4.161 +		pos = n, n = pos->next)
   4.162 +
   4.163 +/**
   4.164 + * list_for_each_entry	-	iterate over list of given type
   4.165 + * @pos:	the type * to use as a loop counter.
   4.166 + * @head:	the head for your list.
   4.167 + * @member:	the name of the list_struct within the struct.
   4.168 + */
   4.169 +#define list_for_each_entry(pos, head, member)				\
   4.170 +	for (pos = list_entry((head)->next, typeof(*pos), member);	\
   4.171 +	     &pos->member != (head); 					\
   4.172 +	     pos = list_entry(pos->member.next, typeof(*pos), member))
   4.173 +
   4.174 +/**
   4.175 + * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
   4.176 + * @pos:	the type * to use as a loop counter.
   4.177 + * @n:		another type * to use as temporary storage
   4.178 + * @head:	the head for your list.
   4.179 + * @member:	the name of the list_struct within the struct.
   4.180 + */
   4.181 +#define list_for_each_entry_safe(pos, n, head, member)			\
   4.182 +	for (pos = list_entry((head)->next, typeof(*pos), member),	\
   4.183 +		n = list_entry(pos->member.next, typeof(*pos), member);	\
   4.184 +	     &pos->member != (head); 					\
   4.185 +	     pos = n, n = list_entry(n->member.next, typeof(*n), member))
   4.186 +#endif /* _LINUX_LIST_H */
   4.187 +