diff options
-rw-r--r-- | libmom/ChangeLog | 31 | ||||
-rw-r--r-- | libmom/Makefile | 41 | ||||
-rw-r--r-- | libmom/allocate-address.c | 50 | ||||
-rw-r--r-- | libmom/allocate-memory.c | 51 | ||||
-rw-r--r-- | libmom/copy-ref.c | 34 | ||||
-rw-r--r-- | libmom/deallocate-memory.c | 35 | ||||
-rw-r--r-- | libmom/error-trans.c | 40 | ||||
-rw-r--r-- | libmom/fetch-mach-port.c | 27 | ||||
-rw-r--r-- | libmom/hash-ref.c | 28 | ||||
-rw-r--r-- | libmom/mach-port-set.c | 30 | ||||
-rw-r--r-- | libmom/make-memory-readonly.c | 36 | ||||
-rw-r--r-- | libmom/make-memory-readwrite.c | 36 | ||||
-rw-r--r-- | libmom/memory-init.c | 32 | ||||
-rw-r--r-- | libmom/mom-errors.h | 47 | ||||
-rw-r--r-- | libmom/mom-kerndep.h | 41 | ||||
-rw-r--r-- | libmom/mom.h | 132 | ||||
-rw-r--r-- | libmom/priv.h | 27 | ||||
-rw-r--r-- | libmom/ref-destroy.c | 29 | ||||
-rw-r--r-- | libmom/refs-identical.c | 28 | ||||
-rw-r--r-- | libmom/reserve-memory-anywhere.c | 40 | ||||
-rw-r--r-- | libmom/reserve-memory.c | 42 | ||||
-rw-r--r-- | libmom/unreserve-memory.c | 27 | ||||
-rw-r--r-- | libmom/unuse-memory.c | 43 | ||||
-rw-r--r-- | libmom/wire-memory.c | 28 |
24 files changed, 0 insertions, 955 deletions
diff --git a/libmom/ChangeLog b/libmom/ChangeLog deleted file mode 100644 index f04006c5..00000000 --- a/libmom/ChangeLog +++ /dev/null @@ -1,31 +0,0 @@ -Sat May 25 17:25:09 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu> - - * refs-identical.c (mom_ports_identical): Omit uses of deleted - members of struct mom_port_ref.c. - - * ref-destroy.c (mom_ref_destroy): Omit uses of deleted members of - struct mom_port_ref.c. - - * mach-port-set.c (mom_mach_port_set): Omit uses of deleted - members of struct mom_port_ref.c. - - * fetch-mach-port.c (mom_fetch_mach_port): Omit uses of deleted - members of struct mom_port_ref.c. - - * copy-ref.c (mom_copy_ref): Likewise. - - * mom-kerndep.h (struct mom_port_ref): Delete members `lock' and - `refcnt'. - * Makefile (SRCS): Delete add-ref.c and drop-ref.c. - * mom.h (mom_add_ref, mom_drop_ref): Delete functions. - * add-ref.c, drop-ref.c: Delete files. - -Fri May 24 16:14:54 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu> - - * mom.h: Include <mom-errors.h>. - * error-trans.c: New file. - * mom-kerndep.h (mom_error_translate_mach): New function. - * Makefile (LCLHDRS, installhdrs): Add mom-errors.h. - (SRCS): Add error-trans.c. - * mom-errors.h: New file. - diff --git a/libmom/Makefile b/libmom/Makefile deleted file mode 100644 index 04df2c9c..00000000 --- a/libmom/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -# -# Copyright (C) 1996 Free Software Foundation, Inc. -# Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. - -dir := libmom -makemode := library - -libname = libmom - -SRCS = allocate-address.c allocate-memory.c copy-ref.c \ - deallocate-memory.c fetch-mach-port.c hash-ref.c \ - mach-port-set.c make-memory-readonly.c make-memory-readwrite.c \ - memory-init.c ref-destroy.c refs-identical.c reserve-memory.c \ - reserve-memory-anywhere.c unreserve-memory.c unuse-memory.c \ - wire-memory.c error-trans.c - -LCLHDRS = mom.h mom-kerndep.h priv.h mom-errors.h -installhdrs = mom.h mom-kerndep.h mom-errors.h -installhdrsubdir = . - -OBJS = $(SRCS:.c=.o) - -include ../Makeconf - - diff --git a/libmom/allocate-address.c b/libmom/allocate-address.c deleted file mode 100644 index fa017bac..00000000 --- a/libmom/allocate-address.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include "priv.h" - -error_t -mom_allocate_address (void *start, size_t len, int readonly, - struct mom_port_ref *obj, size_t offset, - int copy) -{ - error_t err; - mach_port_t port; - - assert ((vm_address_t) start % vm_page_size == 0); - assert (len % vm_page_size == 0); - if (obj) - { - port = mom_fetch_mach_port (obj); - assert (offset % vm_page_size == 0); - } - else - port = MACH_PORT_NULL; - - mutex_lock (&_mom_memory_lock); - err = vm_map (mach_task_self (), (vm_address_t *)&start, len, 0, 0, - port, (obj ? offset : 0), (obj ? copy : 0), - (VM_PROT_READ | VM_PROT_EXECUTE - | (!readonly ? VM_PROT_WRITE : 0)), - VM_PROT_READ | VM_PROT_EXECUTE | VM_PROT_WRITE, - VM_INHERIT_COPY); - mutex_unlock (&_mom_memory_lock); - return err; -} diff --git a/libmom/allocate-memory.c b/libmom/allocate-memory.c deleted file mode 100644 index d98632bc..00000000 --- a/libmom/allocate-memory.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include "priv.h" - -error_t -mom_allocate_memory (void **start, size_t len, int readonly, - struct mom_port_ref *obj, size_t offset, - int copy) -{ - error_t err; - mach_port_t port; - - assert (len % vm_page_size == 0); - if (obj) - { - port = mom_fetch_mach_port (obj); - assert (offset % vm_page_size == 0); - } - else - port = MACH_PORT_NULL; - - *start = 0; - - mutex_lock (&_mom_memory_lock); - err = vm_map (mach_task_self (), (vm_address_t *)start, len, 0, 0, - port, (obj ? offset : 0), (obj ? copy : 0), - (VM_PROT_READ | VM_PROT_EXECUTE - | (!readonly ? VM_PROT_WRITE : 0)), - VM_PROT_READ | VM_PROT_EXECUTE | VM_PROT_WRITE, - VM_INHERIT_COPY); - mutex_unlock (&_mom_memory_lock); - return err; -} diff --git a/libmom/copy-ref.c b/libmom/copy-ref.c deleted file mode 100644 index 03d4ab45..00000000 --- a/libmom/copy-ref.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copy a mom port reference - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include "priv.h" - -error_t -mom_copy_ref (struct mom_port_ref *new, - struct mom_port_ref *obj) -{ - error_t err; - - err = mach_port_mod_refs (mach_task_self (), - obj->port, MACH_PORT_RIGHT_SEND, 1); - if (!err) - new->port = obj->port; - return err; -} diff --git a/libmom/deallocate-memory.c b/libmom/deallocate-memory.c deleted file mode 100644 index bf7acfdb..00000000 --- a/libmom/deallocate-memory.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include "priv.h" - -error_t -mom_deallocate_memory (void *start, size_t len) -{ - error_t err; - - assert ((vm_address_t) start % vm_page_size == 0); - assert (len % vm_page_size == 0); - - mutex_lock (&_mom_memory_lock); - err = vm_deallocate (mach_task_self (), (vm_address_t) start, len); - mutex_unlock (&_mom_memory_lock); - return err; -} diff --git a/libmom/error-trans.c b/libmom/error-trans.c deleted file mode 100644 index 57ef7e31..00000000 --- a/libmom/error-trans.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include "priv.h" - -mom_error_t -mom_error_translate_mach (error_t macherr) -{ - switch (macherr) - { - case EMACH_SEND_INVALID_DEST: - return EMOM_INVALID_DEST; - - case EMACH_SEND_INVALID_RIGHT: - return EMOM_INVALID_REF; - - case EMIG_SERVER_DIED: - return EMOM_SERVER_DIED; - - default: - return macherr; - } -} diff --git a/libmom/fetch-mach-port.c b/libmom/fetch-mach-port.c deleted file mode 100644 index 85262600..00000000 --- a/libmom/fetch-mach-port.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Return the Mach port corresponding to a mom port reference - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include "priv.h" - -mach_port_t -mom_fetch_mach_port (struct mom_port_ref *obj) -{ - return obj->port; -} diff --git a/libmom/hash-ref.c b/libmom/hash-ref.c deleted file mode 100644 index 6c160b1b..00000000 --- a/libmom/hash-ref.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Return a hash key for a mom port - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include "priv.h" - -int -mom_hash_port (struct mom_port_ref *obj) -{ - return mom_fetch_mach_port (obj); -} - diff --git a/libmom/mach-port-set.c b/libmom/mach-port-set.c deleted file mode 100644 index ed6842fd..00000000 --- a/libmom/mach-port-set.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Initialize a mom port reference from a Mach port - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include "priv.h" - -error_t -mom_mach_port_set (struct mom_port_ref *obj, - mach_port_t port) -{ - obj->port = port; - return 0; -} - diff --git a/libmom/make-memory-readonly.c b/libmom/make-memory-readonly.c deleted file mode 100644 index e7ca4c87..00000000 --- a/libmom/make-memory-readonly.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include "priv.h" - -error_t -mom_make_memory_readonly (void *start, size_t len) -{ - error_t err; - - assert ((vm_address_t) start % vm_page_size == 0); - assert (len % vm_page_size == 0); - - mutex_lock (&_mom_memory_lock); - err = vm_protect (mach_task_self (), (vm_address_t) start, len, 0, - VM_PROT_READ | VM_PROT_EXECUTE); - mutex_unlock (&_mom_memory_lock); - return err; -} diff --git a/libmom/make-memory-readwrite.c b/libmom/make-memory-readwrite.c deleted file mode 100644 index f35e6bfd..00000000 --- a/libmom/make-memory-readwrite.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include "priv.h" - -error_t -mom_make_memory_readwrite (void *start, size_t len) -{ - error_t err; - - assert ((vm_address_t) start % vm_page_size == 0); - assert (len % vm_page_size == 0); - - mutex_lock (&_mom_memory_lock); - err = vm_protect (mach_task_self (), (vm_address_t) start, len, 0, - VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE); - mutex_unlock (&_mom_memory_lock); - return err; -} diff --git a/libmom/memory-init.c b/libmom/memory-init.c deleted file mode 100644 index 38972018..00000000 --- a/libmom/memory-init.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Initialization and static data for mom memory management. - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include "priv.h" - -struct mutex _mom_memory_lock = MUTEX_INITIALIZER; -size_t mom_page_size; - -static void init_memory (void) __attribute__ ((constructor)); - -static void -init_memory (void) -{ - mom_page_size = vm_page_size; -} diff --git a/libmom/mom-errors.h b/libmom/mom-errors.h deleted file mode 100644 index 85a35d5e..00000000 --- a/libmom/mom-errors.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Error codes for MOM library - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - - -/* MOM uses Mach error system 0x11 and subsystem 0. */ -#define _MOM_ERRNO(n) ((0x11 << 26 | ((n) & 0x3fff))) - -enum __momerrors_error_codes -{ - /* These are standard errors to be returned by RPC user stubs - in Mom systems. */ - - /* All Mom systems must detect and return these errors */ - - /* The RPC attempted to send to an invalid mom_port_ref. This can - happen because, for example, the server it spoke to has died. */ - EMOM_INVALID_DEST = _MOM_ERRNO (1), - - /* The RPC attempted to send an invalid mom_port_ref in its content. - This shall not happen if the server the reference is to has - merely died. */ - EMOM_INVALID_REF = _MOM_ERRNO (2), - - /* The server began processing the RPC, but at some point it died. */ - EMOM_SERVER_DIED = _MOM_ERRNO (3) -}; - -typedef enum __momerrors_error_codes mom_error_t; - - diff --git a/libmom/mom-kerndep.h b/libmom/mom-kerndep.h deleted file mode 100644 index cc61db05..00000000 --- a/libmom/mom-kerndep.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Mach-specific type definitions for MOM - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include <mach/mach.h> -#include <spin-lock.h> - -struct mom_port_ref -{ - mach_port_t port; -}; - -/* Mach-specific functions */ - -/* Initialize OBJ with a reference to Mach port PORT. One Mach user - reference is consumed. */ -error_t mom_mach_port_set (struct mom_port_ref *obj, mach_port_t port); - -/* Return the Mach port corresponding to OBJ. No new Mach user - references are created, so this Mach port should not be used - after OBJ has been destroyed. */ -mach_port_t mom_fetch_mach_port (struct mom_port_ref *obj); - -/* Turn a Mach error number into a Mom error number. */ -mom_error_t mom_error_translate_mach (error_t macherr); diff --git a/libmom/mom.h b/libmom/mom.h deleted file mode 100644 index 6d04f1d5..00000000 --- a/libmom/mom.h +++ /dev/null @@ -1,132 +0,0 @@ -/* Microkernel object module - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - - - -#include <stdlib.h> -#include <errno.h> - -#include <mom-errors.h> - -/* This header file defines structure layouts for the use of functions - below; it is specific to the particular microkernel in use. */ -#include <mom-kerndep.h> - - - - - -/* User RPC endpoints */ - -/* A communications end-point suitable for sending RPC's to servers. */ -struct mom_port_ref; /* layout defined in mom-kerndep.h */ - -/* Create a new port reference that refers to the same underlying channel - as OBJ. Fill *NEW with the new reference. NEW should be otherwise - unused memory. */ -error_t mom_copy_ref (struct mom_port_ref *new, struct mom_port_ref *obj); - -/* Tell if two mom ports refer to the same underlying server RPC channel */ -int mom_refs_identical (struct mom_port_ref *obj1, struct mom_port_ref *obj2); - -/* Return a hash key for a port. Different ports may have the same - hash key, but no port's hash key will ever change as long as that - port is known to this task. Two identical ports (as by - mom_ports_identical) will always have the same hash key. */ -int mom_hash_ref (struct mom_port_ref *obj); - -/* Destroy mom port reference OBJ and deallocate the underlying kernel - object. After this call, the memory in *OBJ may be used by the - user for any purpose. It is an error to call this routine if any - other thread might be calling any other mom port reference function - on OBJ concurrently. */ -void mom_ref_destroy (struct mom_port_ref *obj); - - - -/* Memory management */ - -/* Size of a "physical" page; mom memory management calls must be in - aligned multiples of this value. */ -extern size_t mom_page_size; - -/* Reserve a region of memory from START and continuing for LEN bytes - so that it won't be used by anyone, but don't make it directly - usable. */ -error_t mom_reserve_memory (void *start, size_t len); - -/* Reserve a region of memory anywhere of size LEN bytes and return - its address in ADDR. */ -error_t mom_reserve_memory_anywhere (void **addr, size_t len); - -/* Make a reserved region of memory usable, as specified by START and - LEN. If READONLY is set then only make it available for read - access; otherwise permit both read and write. If OBJ is null, then - use zero-filled anonymous storage. If OBJ is non-null, then it - specifies a mom port reference referring to a memory server, and - OFFSET is the offset within that server. If COPY is set, then the - data is copied from the memory object, otherwise it shares with - other users of the same object. */ -error_t mom_use_memory (void *start, size_t len, int readonly, - struct mom_port_ref *obj, size_t offset, - int copy); - -/* Ask the kernel to wire the region of memory specified to physical - memory. The exact semantics of this are kernel dependent; it is - also usually privileged in some fashion and will fail for - non-privileged users. */ -error_t mom_wire_memory (void *start, size_t len); - -/* Convert a region of usable memory to read-only */ -error_t mom_make_memory_readonly (void *start, size_t len); - -/* Convert a region of usable memory to read/write */ -error_t mom_make_memory_readwrite (void *start, size_t len); - -/* Convert a region of usable memory to reserved but unusable status. */ -error_t mom_unuse_memory (void *start, size_t len); - -/* Convert a region of reserved unusable memory to unreserved status. */ -error_t mom_unreserve_memory (void *start, size_t len); - - - -/* Optimized combination versions of memory functions; these are very - likely to be faster than using the two call sequences they are - equivalent to. */ - -/* Combined version of mom_unuse_memory followed by mom_unreserve_memory. */ -error_t mom_deallocate_memory (void *start, size_t len); - -/* Combined version of mom_reserve_memory and mom_use_memory. */ -error_t mom_allocate_address (void *start, size_t len, int readonly, - struct mom_port_ref *obj, size_t offset, - int copy); - -/* Combined version of mom_reserve_memory_anywhere and mom_use_memory. */ -error_t mom_allocate_memory (void **start, size_t len, int readonly, - struct mom_port_ref *obj, size_t offset, - int copy); - -/* Shorthand for the most common sort of allocation--like mom_allocate_memory, - but READONLY, and OBJ are both null. */ -#define mom_allocate(start,len) \ - (mom_allocate_memory ((start), (len), 0, 0, 0, 0)) - diff --git a/libmom/priv.h b/libmom/priv.h deleted file mode 100644 index 88d2d9ed..00000000 --- a/libmom/priv.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include "mom.h" -#include <assert.h> -#include <cthreads.h> - -extern struct mutex _mom_memory_lock; - - diff --git a/libmom/ref-destroy.c b/libmom/ref-destroy.c deleted file mode 100644 index 6966bcdc..00000000 --- a/libmom/ref-destroy.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Completely destroy a MOM port - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include "priv.h" - -void -mom_ref_destroy (struct mom_port_ref *obj) -{ - mach_port_deallocate (mach_task_self (), obj->port); -} - - diff --git a/libmom/refs-identical.c b/libmom/refs-identical.c deleted file mode 100644 index 0c4ee885..00000000 --- a/libmom/refs-identical.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Tell if two mom port references refer to the same channel - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include "priv.h" - -int -mom_ports_identical (struct mom_port_ref *obj1, - struct mom_port_ref *obj2) -{ - return obj1->port == obj2->port; -} diff --git a/libmom/reserve-memory-anywhere.c b/libmom/reserve-memory-anywhere.c deleted file mode 100644 index 40f9ec00..00000000 --- a/libmom/reserve-memory-anywhere.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include "priv.h" - -error_t -mom_reserve_memory_anywhere (void **start, size_t len) -{ - error_t err; - - assert (len % vm_page_size == 0); - - *start = 0; - - mutex_lock (&_mom_memory_lock); - err = vm_map (mach_task_self (), (vm_address_t *)&start, len, 0, 1, - MACH_PORT_NULL, 0, 0, 0, - VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE, - VM_INHERIT_COPY); - mutex_unlock (&_mom_memory_lock); - - return err; -} diff --git a/libmom/reserve-memory.c b/libmom/reserve-memory.c deleted file mode 100644 index ada9ef02..00000000 --- a/libmom/reserve-memory.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Reserve memory - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - - -#include "priv.h" - -error_t -mom_reserve_memory (void *start, size_t len) -{ - error_t err; - - assert ((vm_address_t) start % vm_page_size == 0); - assert (len % vm_page_size == 0); - - mutex_lock (&_mom_memory_lock); - err = vm_map (mach_task_self (), (vm_address_t *)&start, len, 0, 0, - MACH_PORT_NULL, 0, 0, 0, - VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE, - VM_INHERIT_COPY); - mutex_unlock (&_mom_memory_lock); - - return err; -} - - diff --git a/libmom/unreserve-memory.c b/libmom/unreserve-memory.c deleted file mode 100644 index 88e8eb94..00000000 --- a/libmom/unreserve-memory.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include "priv.h" - -error_t -mom_unreserve_memory (void *start, size_t len) -{ - return mom_deallocate_memory (start, len); -} diff --git a/libmom/unuse-memory.c b/libmom/unuse-memory.c deleted file mode 100644 index 363f2a45..00000000 --- a/libmom/unuse-memory.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include "priv.h" - -error_t -mom_unuse_memory (void *start, size_t len) -{ - error_t err; - - assert ((vm_address_t) start % vm_page_size == 0); - assert (len % vm_page_size == 0); - - mutex_lock (&_mom_memory_lock); - /* Deallocate and reallocate so that we drop any mapping around. */ - err = vm_deallocate (mach_task_self (), (vm_address_t) start, len); - if (!err) - err = vm_map (mach_task_self (), (vm_address_t *)&start, len, 0, 0, - MACH_PORT_NULL, 0, 0, 0, - VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE, - VM_INHERIT_COPY); - mutex_unlock (&_mom_memory_lock); - return err; -} - - diff --git a/libmom/wire-memory.c b/libmom/wire-memory.c deleted file mode 100644 index b3832154..00000000 --- a/libmom/wire-memory.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include "priv.h" - - -error_t -mom_wire_memory (void *start, size_t len) -{ - return EOPNOTSUPP; -} |