diff options
author | neal <neal> | 2007-12-22 17:27:45 +0000 |
---|---|---|
committer | neal <neal> | 2007-12-22 17:27:45 +0000 |
commit | 130ffe56c693fd20c162135ae4fe9dc6421207ad (patch) | |
tree | 24af511702ae5f0cc6b34bc76060cc7a1d9657b5 /viengoos | |
parent | 40e1bb55b60267bbb56448adf061926cbede6a40 (diff) |
hurd/
2007-12-22 Neal H. Walfield <neal@gnu.org>
* folio.h (FOLIO_PRIORITY_BITS): Define.
(FOLIO_PRIORITY_MIN): Likewise.
(FOLIO_PRIORITY_LRU): Likewise.
(FOLIO_PRIORITY_MAX): Likewise.
(FOLIO_GROUP_BITS): Likewise.
(FOLIO_GROUP_NONE): Likewise.
(FOLIO_GROUP_MIN): Likewise.
(FOLIO_GROUP_MAX): Likewise.
(struct folio_policy): New structure.
(FOLIO_POLICY_INIT): Define.
(FOLIO_POLICY_VOID): Likewise.
(FOLIO_POLICY_DEFAULT): Likewise.
(struct folio): Add field policy.
(RM_folio_policy): Define.
(folio_alloc): Take additional parameter policy.
(FOLIO_POLICY_DELIVER): Define.
(FOLIO_POLICY_DISCARDABLE_SET): Likewise.
(FOLIO_POLICY_GROUP_SET): Likewise.
(FOLIO_POLICY_PRIORITY_SET): Likewise.
(FOLIO_POLICY_SET): Likewise.
(folio_policy): New method.
viengoos/
2007-12-22 Neal H. Walfield <neal@gnu.org>
* object.h (folio_alloc): Take additional parameter policy.
Update users.
(folio_policy): New declaration.
* object.c: Include <hurd/folio.h>.
(folio_alloc): Take additional parameter policy. Use it.
(folio_policy): New function.
* server.c (server_loop): Update folio_alloc implementation to
handle additional parameter policy. Implement the folio_policy
method.
libhurd-mm/
2007-12-22 Neal H. Walfield <neal@gnu.org>
* storage.c (storage_alloc_): Update rm_folio_alloc use to reflect
API changes.
ruth/
2007-12-22 Neal H. Walfield <neal@gnu.org>
* ruth.c (main): Update rm_folio_alloc use to reflect API changes.
Diffstat (limited to 'viengoos')
-rw-r--r-- | viengoos/ChangeLog | 12 | ||||
-rw-r--r-- | viengoos/object.c | 34 | ||||
-rw-r--r-- | viengoos/object.h | 15 | ||||
-rw-r--r-- | viengoos/server.c | 49 | ||||
-rw-r--r-- | viengoos/t-activity.c | 8 | ||||
-rw-r--r-- | viengoos/t-as.c | 7 | ||||
-rw-r--r-- | viengoos/viengoos.c | 2 |
7 files changed, 102 insertions, 25 deletions
diff --git a/viengoos/ChangeLog b/viengoos/ChangeLog index b5f5814..77ac6c1 100644 --- a/viengoos/ChangeLog +++ b/viengoos/ChangeLog @@ -1,3 +1,15 @@ +2007-12-22 Neal H. Walfield <neal@gnu.org> + + * object.h (folio_alloc): Take additional parameter policy. + Update users. + (folio_policy): New declaration. + * object.c: Include <hurd/folio.h>. + (folio_alloc): Take additional parameter policy. Use it. + (folio_policy): New function. + * server.c (server_loop): Update folio_alloc implementation to + handle additional parameter policy. Implement the folio_policy + method. + 2007-12-21 Neal H. Walfield <neal@gnu.org> * output.h: Include <stdint.h> and <stdbool.h>. diff --git a/viengoos/object.c b/viengoos/object.c index b9f8ab0..95f78b5 100644 --- a/viengoos/object.c +++ b/viengoos/object.c @@ -22,6 +22,7 @@ #include <string.h> #include <hurd/stddef.h> #include <hurd/ihash.h> +#include <hurd/folio.h> #include <bit-array.h> #include "object.h" @@ -323,7 +324,7 @@ folio_parent (struct activity *activity, struct folio *folio) } struct folio * -folio_alloc (struct activity *activity) +folio_alloc (struct activity *activity, struct folio_policy policy) { if (! activity) assert (! root_activity); @@ -369,6 +370,8 @@ folio_alloc (struct activity *activity) if (activity) folio_parent (activity, folio); + folio->policy = policy; + return folio; } @@ -574,3 +577,32 @@ folio_object_alloc (struct activity *activity, *objectp = object; } } + +void +folio_policy (struct activity *activity, + struct folio *folio, + uintptr_t flags, struct folio_policy in, + struct folio_policy *out) +{ + if ((flags & FOLIO_POLICY_DELIVER) && out) + { + out->discardable = folio->policy.discardable; + out->group = folio->policy.group; + out->priority = folio->policy.priority; + } + + if (! (flags & FOLIO_POLICY_SET)) + return; + + if ((flags & FOLIO_POLICY_GROUP_SET)) + folio->policy.group = in.group; + + if ((flags & FOLIO_POLICY_DISCARDABLE_SET) + && in.discardable != folio->policy.discardable) + /* XXX: We need to move the folio from the discardable list to the + precious list (or vice versa). */ + folio->policy.discardable = in.discardable; + + if ((flags & FOLIO_POLICY_PRIORITY_SET)) + folio->policy.priority = in.priority; +} diff --git a/viengoos/object.h b/viengoos/object.h index fb8c93c..ed3a7ea 100644 --- a/viengoos/object.h +++ b/viengoos/object.h @@ -388,9 +388,11 @@ object_claim_ (struct activity *activity, struct object *object) object_claim_ (a, o); \ }) -/* Allocate a folio to activity ACTIVITY. Returns NULL if not - possible. Otherwise a pointer to the in-memory folio. */ -extern struct folio *folio_alloc (struct activity *activity); +/* Allocate a folio to activity ACTIVITY. POLICY is the new folio's + initial storage policy. Returns NULL if not possible. Otherwise a + pointer to the in-memory folio. */ +extern struct folio *folio_alloc (struct activity *activity, + struct folio_policy policy); /* Assign the storage designated by FOLIO to the activity ACTIVITY. */ extern void folio_parent (struct activity *activity, struct folio *folio); @@ -431,4 +433,11 @@ object_free (struct activity *activity, struct object *object) folio_object_free (activity, folio, page); } +/* Get and set folio FOLIO's storage policy according to flags FLAGS, + IN and OUT. */ +extern void folio_policy (struct activity *activity, + struct folio *folio, + uintptr_t flags, struct folio_policy in, + struct folio_policy *out); + #endif diff --git a/viengoos/server.c b/viengoos/server.c index 93dc156..b0f341c 100644 --- a/viengoos/server.c +++ b/viengoos/server.c @@ -365,23 +365,27 @@ server_loop (void) switch (label) { case RM_folio_alloc: - err = rm_folio_alloc_send_unmarshal (&msg, &principal_addr, - &folio_addr); - if (err) - REPLY (err); + { + struct folio_policy policy; + + err = rm_folio_alloc_send_unmarshal (&msg, &principal_addr, + &folio_addr, &policy); + if (err) + REPLY (err); - struct cap *folio_slot = SLOT (folio_addr); + struct cap *folio_slot = SLOT (folio_addr); - folio = folio_alloc (principal); - if (! folio) - REPLY (ENOMEM); + folio = folio_alloc (principal, policy); + if (! folio) + REPLY (ENOMEM); - r = cap_set (principal, - folio_slot, object_to_cap ((struct object *) folio)); - assert (r); + r = cap_set (principal, + folio_slot, object_to_cap ((struct object *) folio)); + assert (r); - rm_folio_alloc_reply_marshal (&msg); - break; + rm_folio_alloc_reply_marshal (&msg); + break; + } case RM_folio_free: err = rm_folio_free_send_unmarshal (&msg, &principal_addr, @@ -447,6 +451,25 @@ server_loop (void) rm_folio_object_alloc_reply_marshal (&msg); break; + case RM_folio_policy: + { + l4_word_t flags; + struct folio_policy in, out; + + err = rm_folio_policy_send_unmarshal (&msg, &principal_addr, + &folio_addr, + &flags, &in); + if (err) + REPLY (err); + + folio = (struct folio *) OBJECT (folio_addr, cap_folio, true); + + folio_policy (principal, folio, flags, in, &out); + + rm_folio_policy_reply_marshal (&msg, out); + break; + } + case RM_object_slot_copy_out: err = rm_object_slot_copy_out_send_unmarshal (&msg, &principal_addr, diff --git a/viengoos/t-activity.c b/viengoos/t-activity.c index 92d0a1a..ac30023 100644 --- a/viengoos/t-activity.c +++ b/viengoos/t-activity.c @@ -21,7 +21,7 @@ allocate_object (enum cap_type type, addr_t addr) { if (! folio || object == FOLIO_OBJECTS) { - folio = folio_alloc (root_activity); + folio = folio_alloc (root_activity, FOLIO_POLICY_DEFAULT); object = 0; } @@ -52,7 +52,7 @@ test (void) object_init (); /* Create the root activity. */ - folio = folio_alloc (NULL); + folio = folio_alloc (NULL, FOLIO_POLICY_DEFAULT); if (! folio) panic ("Failed to allocate storage for the initial task!"); @@ -84,7 +84,7 @@ test (void) a[i].child = (struct activity *) object; /* Allocate a folio against the activity and use it. */ - a[i].folio = folio_alloc (a[i].child); + a[i].folio = folio_alloc (a[i].child, FOLIO_POLICY_DEFAULT); assert (a[i].folio); folio_object_alloc (a[i].child, a[i].folio, 0, cap_page, &a[i].page); @@ -115,7 +115,7 @@ test (void) int i; for (i = 0; i < 10; i ++) { - struct folio *f = folio_alloc (root_activity); + struct folio *f = folio_alloc (root_activity, FOLIO_POLICY_DEFAULT); assert (f); try (root_activity, f, 4); diff --git a/viengoos/t-as.c b/viengoos/t-as.c index 2e23763..4797b20 100644 --- a/viengoos/t-as.c +++ b/viengoos/t-as.c @@ -21,7 +21,7 @@ allocate_object (enum cap_type type, addr_t addr) { if (! folio || object == FOLIO_OBJECTS) { - folio = folio_alloc (root_activity); + folio = folio_alloc (root_activity, FOLIO_POLICY_DEFAULT); object = 0; } @@ -88,7 +88,8 @@ try (struct alloc *allocs, int count, bool dump) { case cap_folio: caps[i] = object_to_cap ((struct object *) - folio_alloc (root_activity)); + folio_alloc (root_activity, + FOLIO_POLICY_DEFAULT)); break; case cap_void: caps[i].type = cap_void; @@ -217,7 +218,7 @@ test (void) object_init (); /* Create the root activity. */ - folio = folio_alloc (NULL); + folio = folio_alloc (NULL, FOLIO_POLICY_DEFAULT); if (! folio) panic ("Failed to allocate storage for the initial task!"); diff --git a/viengoos/viengoos.c b/viengoos/viengoos.c index c005ade..b4ddf57 100644 --- a/viengoos/viengoos.c +++ b/viengoos/viengoos.c @@ -226,7 +226,7 @@ system_task_load (void) { static int f = 1; - folio = folio_alloc (root_activity); + folio = folio_alloc (root_activity, FOLIO_POLICY_DEFAULT); folio_index = 0; /* XXX: Allocate more space. */ |