diff options
Diffstat (limited to 'debian/patches')
-rw-r--r-- | debian/patches/fix-receiver-lookups.patch | 752 | ||||
-rw-r--r-- | debian/patches/series | 2 |
2 files changed, 725 insertions, 29 deletions
diff --git a/debian/patches/fix-receiver-lookups.patch b/debian/patches/fix-receiver-lookups.patch index 6a46fd4b..d7bcf0b7 100644 --- a/debian/patches/fix-receiver-lookups.patch +++ b/debian/patches/fix-receiver-lookups.patch @@ -1,3 +1,26 @@ +diff --git a/hurd/default_pager.defs b/hurd/default_pager.defs +index 8ad82dc..4885503 100644 +--- a/hurd/default_pager.defs ++++ b/hurd/default_pager.defs +@@ -36,6 +36,10 @@ subsystem default_pager 2275; + + import <hurd/default_pager_types.h>; /* XXX */ + ++#ifdef DEFAULT_PAGER_IMPORTS ++DEFAULT_PAGER_IMPORTS ++#endif ++ + routine default_pager_object_create( + default_pager : mach_port_t; + out memory_object : memory_object_t = +@@ -90,6 +94,6 @@ routine default_pager_paging_storage( + to fix the object's maximum size. Any references to pages beyond the limit + will fail. */ + routine default_pager_object_set_size( +- memory_object : mach_port_t; ++ memory_object : memory_object_t; + msgseqno seqno : mach_port_seqno_t; + object_size_limit : vm_size_t); diff --git a/libpager/Makefile b/libpager/Makefile index 7c4da38..b622295 100644 --- a/libpager/Makefile @@ -299,34 +322,43 @@ index 90ffc01..6683e24 100644 return 0; } diff --git a/libpager/priv.h b/libpager/priv.h -index 7aa0fb4..939b5b7 100644 +index 7aa0fb4..d49cbb9 100644 --- a/libpager/priv.h +++ b/libpager/priv.h -@@ -138,7 +138,7 @@ struct port_class *_pager_class; - +@@ -139,6 +139,7 @@ struct port_class *_pager_class; void _pager_wait_for_seqno (struct pager *, mach_port_seqno_t); void _pager_release_seqno (struct pager *, mach_port_seqno_t); --void _pager_update_seqno (mach_port_t, mach_port_seqno_t); -+void _pager_update_seqno (struct pager *, mach_port_seqno_t); + void _pager_update_seqno (mach_port_t, mach_port_seqno_t); ++void _pager_update_seqno_p (struct pager *, mach_port_seqno_t); void _pager_block_termination (struct pager *); void _pager_allow_termination (struct pager *); error_t _pager_pagemap_resize (struct pager *, vm_address_t); diff --git a/libpager/seqnos.c b/libpager/seqnos.c -index 77bfbf2..f11624f 100644 +index 77bfbf2..985c434 100644 --- a/libpager/seqnos.c +++ b/libpager/seqnos.c -@@ -51,19 +51,15 @@ _pager_release_seqno (struct pager *p, +@@ -48,7 +48,6 @@ _pager_release_seqno (struct pager *p, + } + } +- /* Just update the seqno. */ void --_pager_update_seqno (mach_port_t object, -+_pager_update_seqno (struct pager *p, - mach_port_seqno_t seqno) - { -- struct pager *p; -- -- p = ports_lookup_port (0, object, _pager_class); -- if (p) + _pager_update_seqno (mach_port_t object, +@@ -57,13 +56,22 @@ _pager_update_seqno (mach_port_t object, + struct pager *p; + + p = ports_lookup_port (0, object, _pager_class); ++ _pager_update_seqno_p (p, seqno); + if (p) ++ ports_port_deref (p); ++} ++ ++/* Just update the seqno, pointer version. */ ++void ++_pager_update_seqno_p (struct pager *p, ++ mach_port_seqno_t seqno) ++{ + if (p + && p->port.class == _pager_class) { @@ -339,7 +371,7 @@ index 77bfbf2..f11624f 100644 } } diff --git a/libpager/stubs.c b/libpager/stubs.c -index 8478212..f51bddc 100644 +index 8478212..5d0417e 100644 --- a/libpager/stubs.c +++ b/libpager/stubs.c @@ -21,7 +21,7 @@ @@ -356,7 +388,7 @@ index 8478212..f51bddc 100644 printf ("m_o_copy called\n"); - _pager_update_seqno (obj, seq); -+ _pager_update_seqno (p, seq); ++ _pager_update_seqno_p (p, seq); return EOPNOTSUPP; } @@ -372,21 +404,685 @@ index 8478212..f51bddc 100644 printf ("m_o_data_write called\n"); - _pager_update_seqno (obj, seq); -+ _pager_update_seqno (p, seq); ++ _pager_update_seqno_p (p, seq); return EOPNOTSUPP; } -@@ -59,9 +59,12 @@ _pager_seqnos_memory_object_supply_completed (mach_port_t obj, - kern_return_t result, - vm_offset_t err_off) +diff --git a/mach-defpager/Makefile b/mach-defpager/Makefile +index e38a0be..c8e33c5 100644 +--- a/mach-defpager/Makefile ++++ b/mach-defpager/Makefile +@@ -34,4 +34,4 @@ LDFLAGS += -static + + include ../Makeconf + +-MIGSFLAGS = -DSEQNOS ++MIGSFLAGS = -DSEQNOS -imacros $(srcdir)/mig-mutate.h +diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c +index 8f8e13e..b718262 100644 +--- a/mach-defpager/default_pager.c ++++ b/mach-defpager/default_pager.c +@@ -60,6 +60,8 @@ + #include "default_pager_S.h" + #include "exc_S.h" + ++#include "priv.h" ++ + #define debug 0 + + static char my_name[] = "(default pager):"; +@@ -106,47 +108,6 @@ synchronized_printf (const char *fmt, ...) + #define ptoa(p) ((p)*vm_page_size) + #define atop(a) ((a)/vm_page_size) + +-/* +- * Bitmap allocation. +- */ +-typedef unsigned int bm_entry_t; +-#define NB_BM 32 +-#define BM_MASK 0xffffffff +- +-#define howmany(a,b) (((a) + (b) - 1)/(b)) +- +-/* +- * Value to indicate no block assigned +- */ +-#define NO_BLOCK ((vm_offset_t)-1) +- +-/* +- * 'Partition' structure for each paging area. +- * Controls allocation of blocks within paging area. +- */ +-struct part { +- pthread_mutex_t p_lock; /* for bitmap/free */ +- vm_size_t total_size; /* total number of blocks */ +- vm_size_t free; /* number of blocks free */ +- unsigned int id; /* named lookup */ +- bm_entry_t *bitmap; /* allocation map */ +- boolean_t going_away; /* destroy attempt in progress */ +- struct file_direct *file; /* file paged to */ +-}; +-typedef struct part *partition_t; +- +-struct { +- pthread_mutex_t lock; +- int n_partitions; +- partition_t *partition_list;/* array, for quick mapping */ +-} all_partitions; /* list of all such */ +- +-typedef unsigned char p_index_t; +- +-#define P_INDEX_INVALID ((p_index_t)-1) +- +-#define no_partition(x) ((x) == P_INDEX_INVALID) +- + partition_t partition_of(x) + int x; { -+ struct pager *p; - printf ("m_o_supply_completed called\n"); +@@ -632,81 +593,6 @@ ddprintf ("pager_dealloc_page(%d,%x,%d)\n",pindex,page,lock_it); + } + + /* +- * Allocation info for each paging object. +- * +- * Most operations, even pager_write_offset and pager_put_checksum, +- * just need a read lock. Higher-level considerations prevent +- * conflicting operations on a single page. The lock really protects +- * the underlying size and block map memory, so pager_extend needs a +- * write lock. +- * +- * An object can now span multiple paging partitions. The allocation +- * info we keep is a pair (offset,p_index) where the index is in the +- * array of all partition ptrs, and the offset is partition-relative. +- * Size wise we are doing ok fitting the pair into a single integer: +- * the offset really is in pages so we have vm_page_size bits available +- * for the partition index. +- */ +-#define DEBUG_READER_CONFLICTS 0 +- +-#if DEBUG_READER_CONFLICTS +-int default_pager_read_conflicts = 0; +-#endif +- +-union dp_map { +- +- struct { +- unsigned int p_offset : 24, +- p_index : 8; +- } block; +- +- union dp_map *indirect; +-}; +-typedef union dp_map *dp_map_t; +- +-/* quick check for part==block==invalid */ +-#define no_block(e) ((e).indirect == (dp_map_t)NO_BLOCK) +-#define invalidate_block(e) ((e).indirect = (dp_map_t)NO_BLOCK) +- +-struct dpager { +- pthread_mutex_t lock; /* lock for extending block map */ +- /* XXX should be read-write lock */ +-#if DEBUG_READER_CONFLICTS +- int readers; +- boolean_t writer; +-#endif +- dp_map_t map; /* block map */ +- vm_size_t size; /* size of paging object, in pages */ +- vm_size_t limit; /* limit (bytes) allowed to grow to */ +- vm_size_t byte_limit; /* limit, which wasn't +- rounded to page boundary */ +- p_index_t cur_partition; +-#ifdef CHECKSUM +- vm_offset_t *checksum; /* checksum - parallel to block map */ +-#define NO_CHECKSUM ((vm_offset_t)-1) +-#endif /* CHECKSUM */ +-}; +-typedef struct dpager *dpager_t; +- +-/* +- * A paging object uses either a one- or a two-level map of offsets +- * into a paging partition. +- */ +-#define PAGEMAP_ENTRIES 64 +- /* number of pages in a second-level map */ +-#define PAGEMAP_SIZE(npgs) ((npgs)*sizeof(vm_offset_t)) +- +-#define INDIRECT_PAGEMAP_ENTRIES(npgs) \ +- ((((npgs)-1)/PAGEMAP_ENTRIES) + 1) +-#define INDIRECT_PAGEMAP_SIZE(npgs) \ +- (INDIRECT_PAGEMAP_ENTRIES(npgs) * sizeof(vm_offset_t *)) +-#define INDIRECT_PAGEMAP(size) \ +- (size > PAGEMAP_ENTRIES) +- +-#define ROUNDUP_TO_PAGEMAP(npgs) \ +- (((npgs) + PAGEMAP_ENTRIES - 1) & ~(PAGEMAP_ENTRIES - 1)) +- +-/* + * Object sizes are rounded up to the next power of 2, + * unless they are bigger than a given maximum size. + */ +@@ -1885,40 +1771,6 @@ default_has_page(ds, offset) + return ( ! no_block(pager_read_offset(ds, offset)) ); + } + +-/* +- * Mapping between pager port and paging object. +- */ +-struct dstruct { +- queue_chain_t links; /* Link in pager-port list */ +- +- pthread_mutex_t lock; /* Lock for the structure */ +- pthread_cond_t +- waiting_seqno, /* someone waiting on seqno */ +- waiting_read, /* someone waiting on readers */ +- waiting_write, /* someone waiting on writers */ +- waiting_refs; /* someone waiting on refs */ +- +- memory_object_t pager; /* Pager port */ +- mach_port_seqno_t seqno; /* Pager port sequence number */ +- mach_port_t pager_request; /* Request port */ +- mach_port_urefs_t request_refs; /* Request port user-refs */ +- mach_port_t pager_name; /* Name port */ +- mach_port_urefs_t name_refs; /* Name port user-refs */ +- boolean_t external; /* Is an external object? */ +- +- unsigned int readers; /* Reads in progress */ +- unsigned int writers; /* Writes in progress */ +- +- /* This is the reply port of an outstanding +- default_pager_object_set_size call. */ +- mach_port_t lock_request; +- +- unsigned int errors; /* Pageout error count */ +- struct dpager dpager; /* Actual pager */ +-}; +-typedef struct dstruct * default_pager_t; +-#define DEFAULT_PAGER_NULL ((default_pager_t)0) +- + #if PARALLEL + #define dstruct_lock_init(ds) pthread_mutex_init(&ds->lock, NULL) + #define dstruct_lock(ds) pthread_mutex_lock(&ds->lock) +@@ -1960,17 +1812,6 @@ void pager_port_list_insert(port, ds) + pthread_mutex_unlock(&all_pagers.lock); + } -- _pager_update_seqno (obj, seq); -+ p = begin_using_pager (obj); -+ _pager_update_seqno (p, seq); -+ end_using_pager (p); +-/* given a data structure return a good port-name to associate it to */ +-#define pnameof(_x_) (((vm_offset_t)(_x_))+1) +-/* reverse, assumes no-odd-pointers */ +-#define dnameof(_x_) (((vm_offset_t)(_x_))&~1) +- +-/* The magic typecast */ +-#define pager_port_lookup(_port_) \ +- ((! MACH_PORT_VALID(_port_) || \ +- ((default_pager_t)dnameof(_port_))->pager != (_port_)) ? \ +- DEFAULT_PAGER_NULL : (default_pager_t)dnameof(_port_)) +- + void pager_port_list_delete(ds) + default_pager_t ds; + { +@@ -2450,15 +2291,14 @@ memory_object_copy_strategy_t default_pager_copy_strategy = + MEMORY_OBJECT_COPY_DELAY; - return EOPNOTSUPP; + kern_return_t +-seqnos_memory_object_init(pager, seqno, pager_request, pager_name, ++seqnos_memory_object_init(ds, seqno, pager_request, pager_name, + pager_page_size) +- mach_port_t pager; ++ default_pager_t ds; + mach_port_seqno_t seqno; + mach_port_t pager_request; + mach_port_t pager_name; + vm_size_t pager_page_size; + { +- default_pager_t ds; + kern_return_t kr; + static char here[] = "%sinit"; + +@@ -2466,7 +2306,6 @@ seqnos_memory_object_init(pager, seqno, pager_request, pager_name, + assert(MACH_PORT_VALID(pager_name)); + assert(pager_page_size == vm_page_size); + +- ds = pager_port_lookup(pager); + if (ds == DEFAULT_PAGER_NULL) + panic(here, my_name); + pager_port_lock(ds, seqno); +@@ -2512,7 +2351,7 @@ seqnos_memory_object_terminate(pager, seqno, pager_request, pager_name) + * not send rights. + */ + +- ds = pager_port_lookup(pager); ++ ds = begin_using_default_pager(pager); + if (ds == DEFAULT_PAGER_NULL) + panic(here, my_name); + ddprintf ("seqnos_memory_object_terminate <%p>: pager_port_lock: <%p>[s:%d,r:%d,w:%d,l:%d], %d\n", +@@ -2578,7 +2417,7 @@ void default_pager_no_senders(pager, seqno, mscount) + */ + + +- ds = pager_port_lookup(pager); ++ ds = begin_using_default_pager(pager); + if (ds == DEFAULT_PAGER_NULL) + panic(here,my_name); + pager_port_lock(ds, seqno); +@@ -2639,16 +2478,15 @@ int default_pager_pageout_count = 0; + static __thread default_pager_thread_t *dpt; + + kern_return_t +-seqnos_memory_object_data_request(pager, seqno, reply_to, offset, ++seqnos_memory_object_data_request(ds, seqno, reply_to, offset, + length, protection_required) +- memory_object_t pager; ++ default_pager_t ds; + mach_port_seqno_t seqno; + mach_port_t reply_to; + vm_offset_t offset; + vm_size_t length; + vm_prot_t protection_required; + { +- default_pager_t ds; + vm_offset_t addr; + unsigned int errors; + kern_return_t rc; +@@ -2657,7 +2495,6 @@ seqnos_memory_object_data_request(pager, seqno, reply_to, offset, + if (length != vm_page_size) + panic(here,my_name); + +- ds = pager_port_lookup(pager); + if (ds == DEFAULT_PAGER_NULL) + panic(here,my_name); + ddprintf ("seqnos_memory_object_data_request <%p>: pager_port_lock: <%p>[s:%d,r:%d,w:%d,l:%d], %d\n", +@@ -2742,9 +2579,9 @@ ddprintf ("seqnos_memory_object_data_request <%p>: pager_port_unlock: <%p>[s:%d, + * also assumes that the default_pager is single-threaded. + */ + kern_return_t +-seqnos_memory_object_data_initialize(pager, seqno, pager_request, ++seqnos_memory_object_data_initialize(ds, seqno, pager_request, + offset, addr, data_cnt) +- memory_object_t pager; ++ default_pager_t ds; + mach_port_seqno_t seqno; + mach_port_t pager_request; + register +@@ -2754,14 +2591,12 @@ seqnos_memory_object_data_initialize(pager, seqno, pager_request, + vm_size_t data_cnt; + { + vm_offset_t amount_sent; +- default_pager_t ds; + static char here[] = "%sdata_initialize"; + + #ifdef lint + pager_request++; + #endif /* lint */ + +- ds = pager_port_lookup(pager); + if (ds == DEFAULT_PAGER_NULL) + panic(here,my_name); + ddprintf ("seqnos_memory_object_data_initialize <%p>: pager_port_lock: <%p>[s:%d,r:%d,w:%d,l:%d], %d\n", +@@ -2804,9 +2639,9 @@ ddprintf ("seqnos_memory_object_data_initialize <%p>: pager_port_unlock: <%p>[s: + * into individual pages and pass them off to default_write. + */ + kern_return_t +-seqnos_memory_object_data_write(pager, seqno, pager_request, ++seqnos_memory_object_data_write(ds, seqno, pager_request, + offset, addr, data_cnt) +- memory_object_t pager; ++ default_pager_t ds; + mach_port_seqno_t seqno; + mach_port_t pager_request; + register +@@ -2817,7 +2652,6 @@ seqnos_memory_object_data_write(pager, seqno, pager_request, + { + register + vm_size_t amount_sent; +- default_pager_t ds; + static char here[] = "%sdata_write"; + int err; + +@@ -2828,7 +2662,6 @@ seqnos_memory_object_data_write(pager, seqno, pager_request, + if ((data_cnt % vm_page_size) != 0) + panic(here,my_name); + +- ds = pager_port_lookup(pager); + if (ds == DEFAULT_PAGER_NULL) + panic(here,my_name); + +@@ -2888,7 +2721,7 @@ seqnos_memory_object_data_write(pager, seqno, pager_request, + kern_return_t + seqnos_memory_object_copy(old_memory_object, seqno, old_memory_control, + offset, length, new_memory_object) +- memory_object_t old_memory_object; ++ default_pager_t old_memory_object; + mach_port_seqno_t seqno; + memory_object_control_t + old_memory_control; +@@ -2916,7 +2749,7 @@ seqnos_memory_object_lock_completed (memory_object_t pager, + kern_return_t + seqnos_memory_object_data_unlock(pager, seqno, pager_request, + offset, length, protection_required) +- memory_object_t pager; ++ default_pager_t pager; + mach_port_seqno_t seqno; + mach_port_t pager_request; + vm_offset_t offset; +@@ -2931,7 +2764,7 @@ kern_return_t + seqnos_memory_object_supply_completed(pager, seqno, pager_request, + offset, length, + result, error_offset) +- memory_object_t pager; ++ mach_port_t pager; + mach_port_seqno_t seqno; + mach_port_t pager_request; + vm_offset_t offset; +@@ -2949,10 +2782,10 @@ seqnos_memory_object_supply_completed(pager, seqno, pager_request, + * into individual pages and pass them off to default_write. + */ + kern_return_t +-seqnos_memory_object_data_return(pager, seqno, pager_request, ++seqnos_memory_object_data_return(ds, seqno, pager_request, + offset, addr, data_cnt, + dirty, kernel_copy) +- memory_object_t pager; ++ default_pager_t ds; + mach_port_seqno_t seqno; + mach_port_t pager_request; + vm_offset_t offset; +@@ -2962,7 +2795,7 @@ seqnos_memory_object_data_return(pager, seqno, pager_request, + boolean_t kernel_copy; + { + +- return seqnos_memory_object_data_write (pager, seqno, pager_request, ++ return seqnos_memory_object_data_write (ds, seqno, pager_request, + offset, addr, data_cnt); } + +@@ -3756,14 +3589,12 @@ S_default_pager_object_pages (mach_port_t pager, + + + kern_return_t +-S_default_pager_object_set_size (mach_port_t pager, ++S_default_pager_object_set_size (default_pager_t ds, + mach_port_seqno_t seqno, + vm_size_t limit) + { + kern_return_t kr = KERN_SUCCESS; +- default_pager_t ds; + +- ds = pager_port_lookup(pager); + if (ds == DEFAULT_PAGER_NULL) + return KERN_INVALID_ARGUMENT; + +diff --git a/mach-defpager/mig-decls.h b/mach-defpager/mig-decls.h +new file mode 100644 +index 0000000..0a2768e +--- /dev/null ++++ b/mach-defpager/mig-decls.h +@@ -0,0 +1,40 @@ ++/* ++ Copyright (C) 2014 Free Software Foundation, Inc. ++ Written by Justus Winter. ++ ++ 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 the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ ++ ++#ifndef __MACH_DEFPAGER_MIG_DECLS_H__ ++#define __MACH_DEFPAGER_MIG_DECLS_H__ ++ ++#include "priv.h" ++ ++/* Called by server stub functions. */ ++ ++static inline struct dstruct * __attribute__ ((unused)) ++begin_using_default_pager (mach_port_t port) ++{ ++ if (! MACH_PORT_VALID(port) ++ || ((default_pager_t) dnameof(port))->pager != (port)) ++ return DEFAULT_PAGER_NULL; ++ ++ if (port == default_pager_default_port) ++ return DEFAULT_PAGER_DEFAULT_PORT; ++ ++ return (default_pager_t) dnameof(port); ++} ++ ++#endif /* __MACH_DEFPAGER_MIG_DECLS_H__ */ +diff --git a/mach-defpager/mig-mutate.h b/mach-defpager/mig-mutate.h +new file mode 100644 +index 0000000..54aeeba +--- /dev/null ++++ b/mach-defpager/mig-mutate.h +@@ -0,0 +1,22 @@ ++/* ++ Copyright (C) 2014 Free Software Foundation, Inc. ++ Written by Justus Winter. ++ ++ 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 the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ ++ ++#define MEMORY_OBJECT_INTRAN default_pager_t begin_using_default_pager (mach_port_t) ++#define MEMORY_OBJECT_IMPORTS import "mig-decls.h"; ++#define DEFAULT_PAGER_IMPORTS import "mig-decls.h"; +diff --git a/mach-defpager/priv.h b/mach-defpager/priv.h +new file mode 100644 +index 0000000..53b3efc +--- /dev/null ++++ b/mach-defpager/priv.h +@@ -0,0 +1,195 @@ ++/* ++ * Mach Operating System ++ * Copyright (c) 1993-1989 Carnegie Mellon University ++ * All Rights Reserved. ++ * ++ * Permission to use, copy, modify and distribute this software and its ++ * documentation is hereby granted, provided that both the copyright ++ * notice and this permission notice appear in all copies of the ++ * software, derivative works or modified versions, and any portions ++ * thereof, and that both notices appear in supporting documentation. ++ * ++ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" ++ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR ++ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ++ * ++ * Carnegie Mellon requests users of this software to return to ++ * ++ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU ++ * School of Computer Science ++ * Carnegie Mellon University ++ * Pittsburgh PA 15213-3890 ++ * ++ * any improvements or extensions that they make and grant Carnegie Mellon ++ * the rights to redistribute these changes. ++ */ ++ ++#ifndef __MACH_DEFPAGER_PRIV_H__ ++#define __MACH_DEFPAGER_PRIV_H__ ++ ++#include <mach.h> ++#include <queue.h> ++ ++/* ++ * Bitmap allocation. ++ */ ++typedef unsigned int bm_entry_t; ++#define NB_BM 32 ++#define BM_MASK 0xffffffff ++ ++#define howmany(a,b) (((a) + (b) - 1)/(b)) ++ ++/* ++ * Value to indicate no block assigned ++ */ ++#define NO_BLOCK ((vm_offset_t)-1) ++ ++/* ++ * 'Partition' structure for each paging area. ++ * Controls allocation of blocks within paging area. ++ */ ++struct part { ++ pthread_mutex_t p_lock; /* for bitmap/free */ ++ vm_size_t total_size; /* total number of blocks */ ++ vm_size_t free; /* number of blocks free */ ++ unsigned int id; /* named lookup */ ++ bm_entry_t *bitmap; /* allocation map */ ++ boolean_t going_away; /* destroy attempt in progress */ ++ struct file_direct *file; /* file paged to */ ++}; ++typedef struct part *partition_t; ++ ++struct { ++ pthread_mutex_t lock; ++ int n_partitions; ++ partition_t *partition_list;/* array, for quick mapping */ ++} all_partitions; /* list of all such */ ++ ++typedef unsigned char p_index_t; ++ ++#define P_INDEX_INVALID ((p_index_t)-1) ++ ++#define no_partition(x) ((x) == P_INDEX_INVALID) ++ ++/* ++ * Allocation info for each paging object. ++ * ++ * Most operations, even pager_write_offset and pager_put_checksum, ++ * just need a read lock. Higher-level considerations prevent ++ * conflicting operations on a single page. The lock really protects ++ * the underlying size and block map memory, so pager_extend needs a ++ * write lock. ++ * ++ * An object can now span multiple paging partitions. The allocation ++ * info we keep is a pair (offset,p_index) where the index is in the ++ * array of all partition ptrs, and the offset is partition-relative. ++ * Size wise we are doing ok fitting the pair into a single integer: ++ * the offset really is in pages so we have vm_page_size bits available ++ * for the partition index. ++ */ ++#define DEBUG_READER_CONFLICTS 0 ++ ++#if DEBUG_READER_CONFLICTS ++int default_pager_read_conflicts = 0; ++#endif ++ ++union dp_map { ++ ++ struct { ++ unsigned int p_offset : 24, ++ p_index : 8; ++ } block; ++ ++ union dp_map *indirect; ++}; ++typedef union dp_map *dp_map_t; ++ ++/* quick check for part==block==invalid */ ++#define no_block(e) ((e).indirect == (dp_map_t)NO_BLOCK) ++#define invalidate_block(e) ((e).indirect = (dp_map_t)NO_BLOCK) ++ ++struct dpager { ++ pthread_mutex_t lock; /* lock for extending block map */ ++ /* XXX should be read-write lock */ ++#if DEBUG_READER_CONFLICTS ++ int readers; ++ boolean_t writer; ++#endif ++ dp_map_t map; /* block map */ ++ vm_size_t size; /* size of paging object, in pages */ ++ vm_size_t limit; /* limit (bytes) allowed to grow to */ ++ vm_size_t byte_limit; /* limit, which wasn't ++ rounded to page boundary */ ++ p_index_t cur_partition; ++#ifdef CHECKSUM ++ vm_offset_t *checksum; /* checksum - parallel to block map */ ++#define NO_CHECKSUM ((vm_offset_t)-1) ++#endif /* CHECKSUM */ ++}; ++typedef struct dpager *dpager_t; ++ ++/* ++ * A paging object uses either a one- or a two-level map of offsets ++ * into a paging partition. ++ */ ++#define PAGEMAP_ENTRIES 64 ++ /* number of pages in a second-level map */ ++#define PAGEMAP_SIZE(npgs) ((npgs)*sizeof(vm_offset_t)) ++ ++#define INDIRECT_PAGEMAP_ENTRIES(npgs) \ ++ ((((npgs)-1)/PAGEMAP_ENTRIES) + 1) ++#define INDIRECT_PAGEMAP_SIZE(npgs) \ ++ (INDIRECT_PAGEMAP_ENTRIES(npgs) * sizeof(vm_offset_t *)) ++#define INDIRECT_PAGEMAP(size) \ ++ (size > PAGEMAP_ENTRIES) ++ ++#define ROUNDUP_TO_PAGEMAP(npgs) \ ++ (((npgs) + PAGEMAP_ENTRIES - 1) & ~(PAGEMAP_ENTRIES - 1)) ++ ++/* ++ * Mapping between pager port and paging object. ++ */ ++struct dstruct { ++ queue_chain_t links; /* Link in pager-port list */ ++ ++ pthread_mutex_t lock; /* Lock for the structure */ ++ pthread_cond_t ++ waiting_seqno, /* someone waiting on seqno */ ++ waiting_read, /* someone waiting on readers */ ++ waiting_write, /* someone waiting on writers */ ++ waiting_refs; /* someone waiting on refs */ ++ ++ memory_object_t pager; /* Pager port */ ++ mach_port_seqno_t seqno; /* Pager port sequence number */ ++ mach_port_t pager_request; /* Request port */ ++ mach_port_urefs_t request_refs; /* Request port user-refs */ ++ mach_port_t pager_name; /* Name port */ ++ mach_port_urefs_t name_refs; /* Name port user-refs */ ++ boolean_t external; /* Is an external object? */ ++ ++ unsigned int readers; /* Reads in progress */ ++ unsigned int writers; /* Writes in progress */ ++ ++ /* This is the reply port of an outstanding ++ default_pager_object_set_size call. */ ++ mach_port_t lock_request; ++ ++ unsigned int errors; /* Pageout error count */ ++ struct dpager dpager; /* Actual pager */ ++}; ++typedef struct dstruct * default_pager_t; ++#define DEFAULT_PAGER_NULL ((default_pager_t)0) ++ ++/* given a data structure return a good port-name to associate it to */ ++#define pnameof(_x_) (((vm_offset_t) (_x_)) + 1) ++/* reverse, assumes no-odd-pointers */ ++#define dnameof(_x_) (((vm_offset_t) (_x_)) & ~1) ++ ++/* Port for memory_object_create. */ ++extern mach_port_t default_pager_default_port; ++ ++/* A magic value that serves as a fake default_pager_t object for the ++ default_pager_default_port. */ ++#define DEFAULT_PAGER_DEFAULT_PORT ((default_pager_t) -2) ++ ++#endif /* __MACH_DEFPAGER_PRIV_H__ */ diff --git a/debian/patches/series b/debian/patches/series index 80c850ee..b15cf450 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -45,4 +45,4 @@ revert-remove-threadvars-hack.patch xkb-compat.patch xxx-fix-build.patch -#fix-receiver-lookups.patch +fix-receiver-lookups.patch |