xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Subject: [PATCH 2/4] docs/html/hcall: Annotations for two hypercalls
Date: Sun, 13 Nov 2011 19:21:04 +0000	[thread overview]
Message-ID: <1321212066-10648-3-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1321212066-10648-1-git-send-email-ian.jackson@eu.citrix.com>

Add annotations for a couple of the hypercalls:
 HYPERVISOR_set_trap_table
 HYPERVISOR_mmu_update

We do this by
 * annotating the list of #defines for hypercall numbers
 * annotating the list of error values
 * providing a function prototype for the systematically-named functions
The header generator does the rest.

This exercise revealed a couple of infelicities:
 * In the actual source code, do_mmu_update is defined to return an int
   and do_set_trap_table a long.  However both functions return either
   -Efoo (on error) or 0 for success.
 * The error numbers are defined only in the private header file
   xen/include/xen/errno.h and then only with names which will
   typically clash with other projects.  It would be nice to include a
   public version of this header which defines XEN_E*.  But for now
   we run xen-headers on errno.h too.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 docs/Makefile                     |    2 +-
 xen/include/public/arch-x86/xen.h |    6 ++++++
 xen/include/public/xen.h          |   11 +++++++++--
 xen/include/xen/errno.h           |    5 +++++
 4 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/docs/Makefile b/docs/Makefile
index fc42859..01e59cb 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -134,7 +134,7 @@ html/hcall/stamp:
 	./xen-headers -O $(@D) \
 		-T 'arch-x86_64 - Xen public headers' \
 		-X arch-ia64 -X arch-x86_32 -X xen-x86_32 \
-		../xen include/public
+		../xen include/public include/xen/errno.h
 	touch $@
 
 txt/%.txt: %.txt
diff --git a/xen/include/public/arch-x86/xen.h b/xen/include/public/arch-x86/xen.h
index 79ec633..d663cef 100644
--- a/xen/include/public/arch-x86/xen.h
+++ b/xen/include/public/arch-x86/xen.h
@@ -82,7 +82,13 @@ typedef unsigned long xen_pfn_t;
 typedef unsigned long xen_ulong_t;
 
 /*
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_set_trap_table(const struct trap_info traps[]);
+ * `
+ */
+/*
  * Send an array of these to HYPERVISOR_set_trap_table().
+ * Terminate the array with a sentinel entry, with traps[].address==0.
  * The privilege level specifies which modes may enter a trap via a software
  * interrupt. On x86/64, since rings 1 and 2 are unavailable, we allocate
  * privilege levels as follows:
diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h
index fde9fa5..f2c9e6f 100644
--- a/xen/include/public/xen.h
+++ b/xen/include/public/xen.h
@@ -55,6 +55,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
  * HYPERCALLS
  */
 
+/* ` enum hypercall_num { // __HYPERVISOR_* => HYPERVISOR_*() */
+
 #define __HYPERVISOR_set_trap_table        0
 #define __HYPERVISOR_mmu_update            1
 #define __HYPERVISOR_set_gdt               2
@@ -105,6 +107,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 #define __HYPERVISOR_arch_6               54
 #define __HYPERVISOR_arch_7               55
 
+/* ` } */
+
 /*
  * HYPERCALL COMPATIBILITY.
  */
@@ -163,8 +167,11 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 #define NR_VIRQS       24
 
 /*
- * HYPERVISOR_mmu_update(reqs, count, pdone, foreigndom)
- * 
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_mmu_update(const struct mmu_update reqs[],
+ * `                       unsigned count, unsigned *done_out,
+ * `                       unsigned foreigndom)
+ * `
  * @reqs is an array of mmu_update_t structures ((ptr, val) pairs).
  * @count is the length of the above array.
  * @pdone is an output parameter indicating number of completed operations
diff --git a/xen/include/xen/errno.h b/xen/include/xen/errno.h
index 7cf599f..c2eb5d3 100644
--- a/xen/include/xen/errno.h
+++ b/xen/include/xen/errno.h
@@ -1,6 +1,9 @@
 #ifndef _I386_ERRNO_H
 #define _I386_ERRNO_H
 
+/* ` enum neg_errnoval { /* -Efoo for each Efoo in the list below } */
+/* ` enum errnoval { */
+
 #define	EPERM		 1	/* Operation not permitted */
 #define	ENOENT		 2	/* No such file or directory */
 #define	ESRCH		 3	/* No such process */
@@ -129,4 +132,6 @@
 #define	ENOMEDIUM	123	/* No medium found */
 #define	EMEDIUMTYPE	124	/* Wrong medium type */
 
+/* } */
+
 #endif
-- 
1.7.2.5

  parent reply	other threads:[~2011-11-13 19:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-13 19:21 [PATCH 0/4] docs/html/hcall: Hypercall docs headers Ian Jackson
2011-11-13 19:21 ` [PATCH 1/4] docs/html/hcall: Initial cut of header documentation massager Ian Jackson
2011-11-14  9:59   ` Ian Campbell
2011-11-14 17:20     ` Ian Jackson
2011-11-13 19:21 ` Ian Jackson [this message]
2011-11-14 10:12   ` [PATCH 2/4] docs/html/hcall: Annotations for two hypercalls Ian Campbell
2011-11-14 17:22     ` Ian Jackson
2011-11-14 18:40   ` Konrad Rzeszutek Wilk
2011-11-15 14:47     ` Ian Jackson
2011-11-15 15:00       ` Konrad Rzeszutek Wilk
2011-11-29 14:21         ` Ian Jackson
2011-11-13 19:21 ` [PATCH 3/4] docs/html/hcall: Generate an "index.html" Ian Jackson
2011-11-14 10:13   ` Ian Campbell
2011-11-14 17:23     ` Ian Jackson
2011-11-13 19:21 ` [PATCH 4/4] docs/html/hcall: Arrange for automatic build Ian Jackson
2011-11-14 10:13 ` [PATCH 0/4] docs/html/hcall: Hypercall docs headers Ian Campbell
2011-11-14 17:24   ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1321212066-10648-3-git-send-email-ian.jackson@eu.citrix.com \
    --to=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).