All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christoph Egger" <Christoph.Egger@amd.com>
To: xen-devel@lists.xensource.com
Cc: Keir Fraser <keir@xensource.com>
Subject: RFC: vaddr_t and vsize_t
Date: Wed, 17 Jan 2007 16:17:33 +0100	[thread overview]
Message-ID: <200701171617.33273.Christoph.Egger@amd.com> (raw)


Hi!

*BSD uses two types for virtual addresses and the virtual address space:
vaddr_t and vsize_t.

vaddr_t is used when a virtual address is meant. It is an unsigned integer and 
its size always matches sizeof(void *).
vsize_t is used when the virtual address space is meant. It is an unsigned 
integer and its size always matches the whole size of the virtual address 
space.

The difference to the pointer is that the pointer is only used to point to
something specific, e.g. a structure in the kernel.

That way mixing up virtual addresses, virtual address spaces and pointers
is hardly possible. What do you think about adding those types to Xen?


The type definition for x86_32 and x86_64 would be this:

diff -r fd2667419c53 xen/include/asm-x86/types.h
--- a/xen/include/asm-x86/types.h       Tue Jan 16 14:04:12 2007 -0500
+++ b/xen/include/asm-x86/types.h       Thu Nov 09 10:23:14 2006 +0100
@@ -36,6 +36,9 @@ typedef unsigned int u32;
 #if defined(__i386__)
 typedef signed long long s64;
 typedef unsigned long long u64;
+/* datatype to store virtual addresses. */
+typedef unsigned long vaddr_t;
+typedef unsigned long vsize_t;
 #if defined(CONFIG_X86_PAE)
 typedef u64 paddr_t;
 #define PRIpaddr "016llx"
@@ -47,6 +50,8 @@ typedef signed long s64;
 typedef signed long s64;
 typedef unsigned long u64;
 typedef unsigned long paddr_t;
+typedef unsigned long vaddr_t;
+typedef unsigned long vsize_t;
 #define PRIpaddr "016lx"
 #endif

             reply	other threads:[~2007-01-17 15:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-17 15:17 Christoph Egger [this message]
2007-01-17 15:49 ` RFC: vaddr_t and vsize_t Keir Fraser
2007-01-17 16:21   ` Christoph Egger
2007-01-17 16:51     ` Keir Fraser
2007-01-18  7:13       ` Christoph Egger
2007-01-18  7:31         ` Keir Fraser

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=200701171617.33273.Christoph.Egger@amd.com \
    --to=christoph.egger@amd.com \
    --cc=keir@xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.