summaryrefslogtreecommitdiff
path: root/defpager
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1996-11-18 23:43:28 +0000
committerThomas Bushnell <thomas@gnu.org>1996-11-18 23:43:28 +0000
commit75134b8f36fb816af5b9d783b156dd71224ce9dd (patch)
treef491aaefdeacf37c2a64900dd85b460758fca4a1 /defpager
parente5f12a034cf64425f478aa93cd9c5ea6cc6f4296 (diff)
*** empty log message ***
Diffstat (limited to 'defpager')
-rw-r--r--defpager/Makefile10
-rw-r--r--defpager/defpager.c2
-rw-r--r--defpager/wiring.c111
3 files changed, 120 insertions, 3 deletions
diff --git a/defpager/Makefile b/defpager/Makefile
index d774073e..8f92dd7c 100644
--- a/defpager/Makefile
+++ b/defpager/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (C) 1995 Free Software Foundation
+# Copyright (C) 1995, 1996 Free Software Foundation
# Written by Michael I. Bushnell.
#
# This file is part of the GNU Hurd.
@@ -23,4 +23,12 @@ makemode := misc
SRCS = defpager.c
+subst-functions=__syscall_vm_allocate syscall_vm_allocate \
+ __vm_allocate_rpc vm_allocate_rpc \
+ __syscall_vm_map syscall_vm_map \
+ __vm_map_rpc vm_map_rpc
+comma=,
+LDFLAGS=-Wl,$(subst :,$(comma),$(strip $(subst-functions)))
+
include ../Makeconf
+
diff --git a/defpager/defpager.c b/defpager/defpager.c
index 9b0bce3a..87ff6aba 100644
--- a/defpager/defpager.c
+++ b/defpager/defpager.c
@@ -31,7 +31,6 @@ struct user_pager_info
off_t *map;
};
-
/* Expand the P->map as necessary to handle an incoming request of the
page at ADDR. */
static inline void
@@ -53,7 +52,6 @@ expand_map (struct user_pager_info *p, vm_offset_t addr)
}
}
-
error_t
pager_read_page (struct user_pager_info *pager,
vm_offset_t page,
diff --git a/defpager/wiring.c b/defpager/wiring.c
new file mode 100644
index 00000000..dda5d9d5
--- /dev/null
+++ b/defpager/wiring.c
@@ -0,0 +1,111 @@
+/* Memory wiring functions for default pager
+ Copyright (C) 1996 Free Software Foundation, Inc.
+ Written by Thomas Bushnell, n/BSG.
+
+ This file is part of the GNU Hurd.
+
+ The GNU Hurd is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ The GNU Hurd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+
+/* This file uses the "wrap" feature of GNU ld. See the GNU ld
+ documentation for more information on how this works.
+ The list of functions we wrap is specified in Makefile as
+ $(subst-functions). */
+
+
+error_t
+__wrap___syscall_vm_allocate (task_t target_task,
+ vm_address_t *address,
+ vm_size_t size,
+ boolean_t anywhere)
+{
+ error_t err;
+
+ err = __real___syscall_vm_allocate (target_task, address, size, anywhere);
+ if (!err && target_task == mach_task_self ())
+ wire_segment (*address, size);
+ return err;
+}
+
+error_t
+__wrap___vm_allocate_rpc (task_t target_task,
+ vm_address_t *address,
+ vm_size_t size,
+ boolean_t anywhere)
+{
+ error_t err;
+
+ err = __real___vm_allocate_rpc (target_task, address, size, anywhere);
+ if (!err && target_task == mach_task_self ())
+ wire_segment (*address, size);
+ return err;
+}
+
+error_t
+__wrap___syscall_vm_map (mach_port_t target_task,
+ vm_address_t *address,
+ vm_size_t size,
+ vm_address_t mask,
+ boolean_t anywhere,
+ mach_port_t memory_object,
+ vm_offset_t offset,
+ boolean_t copy,
+ vm_prot_t cur_protection,
+ vm_prot_t max_protection,
+ vm_inherit_t inheritance)
+{
+ error_t err;
+
+ err = __real___syscall_vm_map (target_task, address, size, mask, anywhere,
+ memory_object, offset, copy, cur_protection,
+ max_protection, inheritance);
+ if (!err && target_task == mach_task_self ())
+ wire_segment (*address, size);
+ return err;
+}
+
+
+error_t
+__wrap___vm_map_rpc (mach_port_t target_task,
+ vm_address_t *address,
+ vm_size_t size,
+ vm_address_t mask,
+ boolean_t anywhere,
+ mach_port_t memory_object,
+ vm_offset_t offset,
+ boolean_t copy,
+ vm_prot_t cur_protection,
+ vm_prot_t max_protection,
+ vm_inherit_t inheritance)
+{
+ error_t err;
+
+ err = __real___vm_map_rpc (target_task, address, size, mask, anywhere,
+ memory_object, offset, copy, cur_protection,
+ mak_protection, inheritance);
+ if (!err && target_task == mach_task_self ())
+ wire_segment (*address, size);
+ return err;
+}
+
+/* And the non-__ versions too. */
+
+#define weak_alias(name,aliasname) \
+ extern typeof (name) aliasname __attribute__ ((weak, alias (#name)));
+
+weak_alias (__wrap___vm_map_rpc, __wrap_vm_map_rpc)
+weak_alias (__wrap___syscall_vm_map, __wrap_syscall_vm_map)
+weak_alias (__wrap___vm_allocate_rpc, __wrap_vm_allocate_rpc)
+weak_alias (__wrap___syscall_vm_allocate, __wrap_syscall_vm_allocate)