summaryrefslogtreecommitdiff
path: root/viengoos/as.c
diff options
context:
space:
mode:
authorneal <neal>2007-12-12 17:49:55 +0000
committerneal <neal>2007-12-12 17:49:55 +0000
commit8eb5ea7006b2d9f37ce753bb10e0a1efcd5e76d3 (patch)
tree1d7cbb522638f6b3cabe0b1732f4da6b2d95ad8b /viengoos/as.c
parent88e93a2eaca6b06556eb7438f91d8f4841c422f9 (diff)
2007-12-12 Neal H. Walfield <neal@gnu.org>
* as.c (as_build_internal): If the required capability slot is not cap_void but MAY_OVERWRITE is true, return that slot.
Diffstat (limited to 'viengoos/as.c')
-rw-r--r--viengoos/as.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/viengoos/as.c b/viengoos/as.c
index d6b68f8..717b344 100644
--- a/viengoos/as.c
+++ b/viengoos/as.c
@@ -80,6 +80,7 @@ as_build_internal (activity_t activity,
l4_uint64_t root_guard = CAP_GUARD (root);
int root_gbits = CAP_GUARD_BITS (root);
+
if (root->type != cap_void
&& remaining >= root_gbits
&& root_guard == extract_bits64_inv (addr,
@@ -87,14 +88,28 @@ as_build_internal (activity_t activity,
/* ROOT's (possibly zero-width) guard matches and thus
translates part of the address. */
{
+ if (remaining == root_gbits && may_overwrite)
+ {
+ debug (0, "Overwriting " ADDR_FMT " with " ADDR_FMT
+ " (at " ADDR_FMT ")",
+ ADDR_PRINTF (addr_extend (addr_chop (a, remaining),
+ root_guard, root_gbits)),
+ ADDR_PRINTF (a),
+ ADDR_PRINTF (addr_chop (a, remaining)));
+ /* XXX: Free any data associated with the capability
+ (e.g., shadow pages). */
+ break;
+ }
+
/* Subtract the number of bits the guard translates. */
remaining -= root_gbits;
assert (remaining >= 0);
if (remaining == 0)
/* ROOT is not a void capability yet the guard translates
- all of the bits. This means that ROOT references an
- object at ADDR. This is a problem: we want to insert a
+ all of the bits and we may not overwrite the
+ capability. This means that ROOT references an object
+ at ADDR. This is a problem: we want to insert a
capability at ADDR. */
{
AS_DUMP;