diff options
5 files changed, 0 insertions, 857 deletions
diff --git a/debian/patches/0001-kern-import-macros.h-from-x15.patch b/debian/patches/0001-kern-import-macros.h-from-x15.patch deleted file mode 100644 index 2373e20..0000000 --- a/debian/patches/0001-kern-import-macros.h-from-x15.patch +++ /dev/null @@ -1,622 +0,0 @@ -From b3c5e41bc05bc622c637d1da75a3c63091e4e789 Mon Sep 17 00:00:00 2001 -From: Justus Winter <4winter@informatik.uni-hamburg.de> -Date: Tue, 31 Mar 2015 12:57:05 +0200 -Subject: [PATCH gnumach 1/6] kern: import `macros.h' from x15 - -Import the macro definitions from the x15 kernel project, and replace -all similar definitions littered all over the place with it. - -Importing this file will make importing code from the x15 kernel -easier. We are already using the red-black tree implementation and -the slab allocator from it, and we will import even more code in the -near future. - -* kern/list.h: Do not define `structof', include `macros.h' instead. -* kern/rbtree.h: Likewise. -* kern/slab.c: Do not define `ARRAY_SIZE', include `macros.h' instead. -* i386/grub/misc.h: Likewise. -* i386/i386/xen.h: Do not define `barrier', include `macros.h' instead. -* kern/macro_help.h: Delete file. Replaced by `macros.h'. -* kern/macros.h: New file. -* Makefrag.am (libkernel_a_SOURCES): Add new file, remove old file. -* device/dev_master.h: Adopt accordingly. -* device/io_req.h: Likewise. -* device/net_io.h: Likewise. -* i386/intel/read_fault.c: Likewise. -* ipc/ipc_kmsg.h: Likewise. -* ipc/ipc_mqueue.h: Likewise. -* ipc/ipc_object.h: Likewise. -* ipc/ipc_port.h: Likewise. -* ipc/ipc_space.h: Likewise. -* ipc/ipc_splay.c: Likewise. -* ipc/ipc_splay.h: Likewise. -* kern/assert.h: Likewise. -* kern/ast.h: Likewise. -* kern/pc_sample.h: Likewise. -* kern/refcount.h: Likewise. -* kern/sched.h: Likewise. -* kern/sched_prim.c: Likewise. -* kern/timer.c: Likewise. -* kern/timer.h: Likewise. -* vm/vm_fault.c: Likewise. -* vm/vm_map.h: Likewise. -* vm/vm_object.h: Likewise. -* vm/vm_page.h: Likewise. ---- - Makefrag.am | 2 +- - device/dev_master.h | 2 +- - device/io_req.h | 2 +- - device/net_io.h | 2 +- - i386/grub/misc.h | 2 +- - i386/i386/xen.h | 2 +- - i386/intel/read_fault.c | 2 +- - ipc/ipc_kmsg.h | 2 +- - ipc/ipc_mqueue.h | 2 +- - ipc/ipc_object.h | 2 +- - ipc/ipc_port.h | 2 +- - ipc/ipc_space.h | 2 +- - ipc/ipc_splay.c | 2 +- - ipc/ipc_splay.h | 2 +- - kern/assert.h | 2 +- - kern/ast.h | 2 +- - kern/list.h | 4 +-- - kern/macro_help.h | 50 ---------------------------------- - kern/macros.h | 72 +++++++++++++++++++++++++++++++++++++++++++++++++ - kern/pc_sample.h | 2 +- - kern/rbtree.h | 5 +--- - kern/refcount.h | 2 +- - kern/sched.h | 2 +- - kern/sched_prim.c | 2 +- - kern/slab.c | 2 +- - kern/timer.c | 2 +- - kern/timer.h | 2 +- - vm/vm_fault.c | 2 +- - vm/vm_map.h | 2 +- - vm/vm_object.h | 2 +- - vm/vm_page.h | 2 +- - 31 files changed, 101 insertions(+), 84 deletions(-) - delete mode 100644 kern/macro_help.h - create mode 100644 kern/macros.h - -diff --git a/Makefrag.am b/Makefrag.am -index 9166143..9222ad2 100644 ---- a/Makefrag.am -+++ b/Makefrag.am -@@ -171,7 +171,7 @@ libkernel_a_SOURCES += \ - kern/mach_factor.h \ - kern/machine.c \ - kern/machine.h \ -- kern/macro_help.h \ -+ kern/macros.h \ - kern/pc_sample.c \ - kern/pc_sample.h \ - kern/printf.c \ -diff --git a/device/dev_master.h b/device/dev_master.h -index 6ad1152..70d4c63 100644 ---- a/device/dev_master.h -+++ b/device/dev_master.h -@@ -37,7 +37,7 @@ - - #if NCPUS > 1 - --#include <kern/macro_help.h> -+#include <kern/macros.h> - #include <kern/cpu_number.h> - #include <kern/sched_prim.h> - #include <kern/thread.h> -diff --git a/device/io_req.h b/device/io_req.h -index 65e23e6..1ad4680 100644 ---- a/device/io_req.h -+++ b/device/io_req.h -@@ -42,7 +42,7 @@ - #include <device/device_types.h> - #include <device/dev_hdr.h> - --#include <kern/macro_help.h> -+#include <kern/macros.h> - - /* - * IO request element, queued on device for delayed replies. -diff --git a/device/net_io.h b/device/net_io.h -index f6de854..d4e24d4 100644 ---- a/device/net_io.h -+++ b/device/net_io.h -@@ -38,7 +38,7 @@ - #include <mach/machine/vm_types.h> - #include <ipc/ipc_kmsg.h> - --#include <kern/macro_help.h> -+#include <kern/macros.h> - #include <kern/lock.h> - #include <kern/kalloc.h> - -diff --git a/i386/grub/misc.h b/i386/grub/misc.h -index c6cd456..b71140a 100644 ---- a/i386/grub/misc.h -+++ b/i386/grub/misc.h -@@ -21,6 +21,7 @@ - #define GRUB_MISC_HEADER 1 - - #include <stdarg.h> -+#include <kern/macros.h> - #include <grub/types.h> - #include <grub/symbol.h> - #include <grub/err.h> -@@ -32,7 +33,6 @@ - #define ALIGN_UP_OVERHEAD(addr, align) ((-(addr)) & ((typeof (addr)) (align) - 1)) - #define ALIGN_DOWN(addr, align) \ - ((addr) & ~((typeof (addr)) align - 1)) --#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0])) - #define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; } - - #define grub_dprintf(condition, ...) grub_real_dprintf(GRUB_FILE, __LINE__, condition, __VA_ARGS__) -diff --git a/i386/i386/xen.h b/i386/i386/xen.h -index 638d671..c681187 100644 ---- a/i386/i386/xen.h -+++ b/i386/i386/xen.h -@@ -21,6 +21,7 @@ - - #ifdef MACH_XEN - #ifndef __ASSEMBLER__ -+#include <kern/macros.h> - #include <kern/printf.h> - #include <mach/machine/vm_types.h> - #include <mach/vm_param.h> -@@ -32,7 +33,6 @@ - #include <xen/public/xen.h> - - /* TODO: this should be moved in appropriate non-Xen place. */ --#define barrier() __asm__ __volatile__ ("": : :"memory") - #define mb() __asm__ __volatile__("lock; addl $0,0(%%esp)":::"memory") - #define rmb() mb() - #define wmb() mb() -diff --git a/i386/intel/read_fault.c b/i386/intel/read_fault.c -index 29f4439..4b1edce 100644 ---- a/i386/intel/read_fault.c -+++ b/i386/intel/read_fault.c -@@ -31,7 +31,7 @@ - #include <vm/vm_page.h> - #include <vm/pmap.h> - --#include <kern/macro_help.h> -+#include <kern/macros.h> - - /* - * Expansion of vm_fault for read fault in kernel mode. -diff --git a/ipc/ipc_kmsg.h b/ipc/ipc_kmsg.h -index 620785b..393c039 100644 ---- a/ipc/ipc_kmsg.h -+++ b/ipc/ipc_kmsg.h -@@ -38,7 +38,7 @@ - #include <mach/message.h> - #include <kern/assert.h> - #include <kern/cpu_number.h> --#include <kern/macro_help.h> -+#include <kern/macros.h> - #include <kern/kalloc.h> - #include <ipc/ipc_marequest.h> - #include <ipc/ipc_object.h> -diff --git a/ipc/ipc_mqueue.h b/ipc/ipc_mqueue.h -index f8a2f1e..2af5e02 100644 ---- a/ipc/ipc_mqueue.h -+++ b/ipc/ipc_mqueue.h -@@ -37,7 +37,7 @@ - #include <mach/message.h> - #include <kern/assert.h> - #include <kern/lock.h> --#include <kern/macro_help.h> -+#include <kern/macros.h> - #include <ipc/ipc_kmsg_queue.h> - #include <ipc/ipc_kmsg.h> - #include <ipc/ipc_thread.h> -diff --git a/ipc/ipc_object.h b/ipc/ipc_object.h -index b83bb5a..be5bea7 100644 ---- a/ipc/ipc_object.h -+++ b/ipc/ipc_object.h -@@ -38,7 +38,7 @@ - #include <mach/message.h> - #include <ipc/ipc_types.h> - #include <kern/lock.h> --#include <kern/macro_help.h> -+#include <kern/macros.h> - #include <kern/slab.h> - - typedef unsigned int ipc_object_refs_t; -diff --git a/ipc/ipc_port.h b/ipc/ipc_port.h -index 6914c71..ade6967 100644 ---- a/ipc/ipc_port.h -+++ b/ipc/ipc_port.h -@@ -43,7 +43,7 @@ - #include <mach/kern_return.h> - #include <mach/port.h> - #include <kern/lock.h> --#include <kern/macro_help.h> -+#include <kern/macros.h> - #include <kern/ipc_kobject.h> - #include <ipc/ipc_mqueue.h> - #include <ipc/ipc_table.h> -diff --git a/ipc/ipc_space.h b/ipc/ipc_space.h -index c4683d2..3bd2f4d 100644 ---- a/ipc/ipc_space.h -+++ b/ipc/ipc_space.h -@@ -42,7 +42,7 @@ - #include <mach/boolean.h> - #include <mach/kern_return.h> - #include <mach/mach_types.h> --#include <kern/macro_help.h> -+#include <kern/macros.h> - #include <kern/lock.h> - #include <kern/slab.h> - #include <ipc/ipc_splay.h> -diff --git a/ipc/ipc_splay.c b/ipc/ipc_splay.c -index 6fb5bcb..062a69f 100644 ---- a/ipc/ipc_splay.c -+++ b/ipc/ipc_splay.c -@@ -35,7 +35,7 @@ - - #include <mach/port.h> - #include <kern/assert.h> --#include <kern/macro_help.h> -+#include <kern/macros.h> - #include <ipc/ipc_entry.h> - #include <ipc/ipc_splay.h> - -diff --git a/ipc/ipc_splay.h b/ipc/ipc_splay.h -index d3316ef..42e5a80 100644 ---- a/ipc/ipc_splay.h -+++ b/ipc/ipc_splay.h -@@ -38,7 +38,7 @@ - - #include <mach/port.h> - #include <kern/assert.h> --#include <kern/macro_help.h> -+#include <kern/macros.h> - #include <ipc/ipc_entry.h> - - typedef struct ipc_splay_tree { -diff --git a/kern/assert.h b/kern/assert.h -index bd2a8be..7b66d1b 100644 ---- a/kern/assert.h -+++ b/kern/assert.h -@@ -29,7 +29,7 @@ - - /* assert.h 4.2 85/01/21 */ - --#include <kern/macro_help.h> -+#include <kern/macros.h> - - #ifndef NDEBUG - #define MACH_ASSERT 1 -diff --git a/kern/ast.h b/kern/ast.h -index 4c28b1e..7d472be 100644 ---- a/kern/ast.h -+++ b/kern/ast.h -@@ -41,7 +41,7 @@ - */ - - #include "cpu_number.h" --#include <kern/macro_help.h> -+#include <kern/macros.h> - #include <machine/ast.h> - - /* -diff --git a/kern/list.h b/kern/list.h -index ad782a8..be92762 100644 ---- a/kern/list.h -+++ b/kern/list.h -@@ -31,9 +31,7 @@ - - #include <stddef.h> - #include <sys/types.h> -- --#define structof(ptr, type, member) \ -- ((type *)((char *)ptr - offsetof(type, member))) -+#include <kern/macros.h> - - /* - * Structure used as both head and node. -diff --git a/kern/macro_help.h b/kern/macro_help.h -deleted file mode 100644 -index 7ce171f..0000000 ---- a/kern/macro_help.h -+++ /dev/null -@@ -1,50 +0,0 @@ --/* -- * Mach Operating System -- * Copyright (c) 1991,1990,1989,1988 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. -- */ --/* -- * File: kern/macro_help.h -- * -- * Provide help in making lint-free macro routines -- * -- */ -- --#ifndef _KERN_MACRO_HELP_H_ --#define _KERN_MACRO_HELP_H_ -- --#if !defined(MACRO_BEGIN) -- --#include <mach/boolean.h> -- --#define NEVER FALSE --#define ALWAYS TRUE -- --#define MACRO_BEGIN ({ --#define MACRO_END }) -- --#define MACRO_RETURN if (ALWAYS) return -- --#endif /* !MACRO_BEGIN */ -- --#endif /* _KERN_MACRO_HELP_H_ */ -diff --git a/kern/macros.h b/kern/macros.h -new file mode 100644 -index 0000000..fb8dc5e ---- /dev/null -+++ b/kern/macros.h -@@ -0,0 +1,72 @@ -+/* -+ * Copyright (c) 2009, 2010, 2013 Richard Braun. -+ * -+ * This program 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 3 of the License, or -+ * (at your option) any later version. -+ * -+ * This program 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, see <http://www.gnu.org/licenses/>. -+ * -+ * -+ * Helper macros. -+ */ -+ -+#ifndef _KERN_MACROS_H -+#define _KERN_MACROS_H -+ -+#define MACRO_BEGIN ({ -+#define MACRO_END }) -+#define MACRO_RETURN if (1) return -+ -+#define __QUOTE(x) #x -+#define QUOTE(x) __QUOTE(x) -+ -+#ifdef __ASSEMBLER__ -+#define DECL_CONST(x, s) x -+#else /* __ASSEMBLER__ */ -+#define __DECL_CONST(x, s) x##s -+#define DECL_CONST(x, s) __DECL_CONST(x, s) -+#endif /* __ASSEMBLER__ */ -+ -+#define STRLEN(x) (sizeof(x) - 1) -+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -+ -+#define MIN(a, b) ((a) < (b) ? (a) : (b)) -+#define MAX(a, b) ((a) > (b) ? (a) : (b)) -+ -+#define DIV_CEIL(n, d) (((n) + (d) - 1) / (d)) -+ -+#define P2ALIGNED(x, a) (((x) & ((a) - 1)) == 0) -+#define ISP2(x) P2ALIGNED(x, x) -+#define P2ALIGN(x, a) ((x) & -(a)) -+#define P2ROUND(x, a) (-(-(x) & -(a))) -+#define P2END(x, a) (-(~(x) & -(a))) -+ -+#define structof(ptr, type, member) \ -+ ((type *)((char *)(ptr) - offsetof(type, member))) -+ -+#define alignof(x) __alignof__(x) -+ -+#define likely(expr) __builtin_expect(!!(expr), 1) -+#define unlikely(expr) __builtin_expect(!!(expr), 0) -+ -+#define barrier() asm volatile("" : : : "memory") -+ -+#define __noreturn __attribute__((noreturn)) -+#define __aligned(x) __attribute__((aligned(x))) -+#define __always_inline inline __attribute__((always_inline)) -+#define __section(x) __attribute__((section(x))) -+#define __packed __attribute__((packed)) -+#define __alias(x) __attribute__((alias(x))) -+ -+#define __format_printf(fmt, args) \ -+ __attribute__((format(printf, fmt, args))) -+ -+#endif /* _KERN_MACROS_H */ -diff --git a/kern/pc_sample.h b/kern/pc_sample.h -index 3c64068..4832cb9 100644 ---- a/kern/pc_sample.h -+++ b/kern/pc_sample.h -@@ -49,7 +49,7 @@ - #include <mach/pc_sample.h> - #include <mach/machine/vm_types.h> - #include <kern/kern_types.h> --#include <kern/macro_help.h> -+#include <kern/macros.h> - - /* - * Control structure for sampling, included in -diff --git a/kern/rbtree.h b/kern/rbtree.h -index 189a7fd..16ef273 100644 ---- a/kern/rbtree.h -+++ b/kern/rbtree.h -@@ -31,12 +31,9 @@ - - #include <stddef.h> - #include <kern/assert.h> --#include <kern/macro_help.h> -+#include <kern/macros.h> - #include <sys/types.h> - --#define structof(ptr, type, member) \ -- ((type *)((char *)ptr - offsetof(type, member))) -- - /* - * Indexes of the left and right nodes in the children array of a node. - */ -diff --git a/kern/refcount.h b/kern/refcount.h -index 74204d6..f32feb8 100644 ---- a/kern/refcount.h -+++ b/kern/refcount.h -@@ -27,7 +27,7 @@ - #ifndef _KERN_REFCOUNT_H_ - #define _KERN_REFCOUNT_H_ - --#include <kern/macro_help.h> -+#include <kern/macros.h> - - /* Unless the above include file specified otherwise, - use the system-independent (unoptimized) atomic reference counter. */ -diff --git a/kern/sched.h b/kern/sched.h -index ea601c5..f82f9f5 100644 ---- a/kern/sched.h -+++ b/kern/sched.h -@@ -38,7 +38,7 @@ - #include <kern/queue.h> - #include <kern/lock.h> - #include <kern/kern_types.h> --#include <kern/macro_help.h> -+#include <kern/macros.h> - - #if MACH_FIXPRI - #include <mach/policy.h> -diff --git a/kern/sched_prim.c b/kern/sched_prim.c -index d7792ae..e8f260e 100644 ---- a/kern/sched_prim.c -+++ b/kern/sched_prim.c -@@ -44,7 +44,7 @@ - #include <kern/lock.h> - #include <kern/mach_clock.h> - #include <kern/mach_factor.h> --#include <kern/macro_help.h> -+#include <kern/macros.h> - #include <kern/processor.h> - #include <kern/queue.h> - #include <kern/sched.h> -diff --git a/kern/slab.c b/kern/slab.c -index 19ebfed..60378b5 100644 ---- a/kern/slab.c -+++ b/kern/slab.c -@@ -79,6 +79,7 @@ - #include <string.h> - #include <kern/assert.h> - #include <kern/mach_clock.h> -+#include <kern/macros.h> - #include <kern/printf.h> - #include <kern/slab.h> - #include <kern/kalloc.h> -@@ -96,7 +97,6 @@ - /* - * Utility macros. - */ --#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) - #define P2ALIGNED(x, a) (((x) & ((a) - 1)) == 0) - #define ISP2(x) P2ALIGNED(x, x) - #define P2ALIGN(x, a) ((x) & -(a)) -diff --git a/kern/timer.c b/kern/timer.c -index 6d6517e..79ada27 100644 ---- a/kern/timer.c -+++ b/kern/timer.c -@@ -33,7 +33,7 @@ - #include <kern/cpu_number.h> - - #include <kern/assert.h> --#include <kern/macro_help.h> -+#include <kern/macros.h> - - - -diff --git a/kern/timer.h b/kern/timer.h -index 57f017a..2f473cf 100644 ---- a/kern/timer.h -+++ b/kern/timer.h -@@ -27,7 +27,7 @@ - #ifndef _KERN_TIMER_H_ - #define _KERN_TIMER_H_ - --#include <kern/macro_help.h> -+#include <kern/macros.h> - - #if STAT_TIME - /* -diff --git a/vm/vm_fault.c b/vm/vm_fault.c -index 686156c..0fa4d6a 100644 ---- a/vm/vm_fault.c -+++ b/vm/vm_fault.c -@@ -51,7 +51,7 @@ - #include <mach/memory_object.h> - #include <vm/memory_object_user.user.h> - /* For memory_object_data_{request,unlock} */ --#include <kern/macro_help.h> -+#include <kern/macros.h> - #include <kern/slab.h> - - #if MACH_PCSAMPLE -diff --git a/vm/vm_map.h b/vm/vm_map.h -index b8103eb..fc7730a 100644 ---- a/vm/vm_map.h -+++ b/vm/vm_map.h -@@ -52,7 +52,7 @@ - #include <vm/vm_types.h> - #include <kern/lock.h> - #include <kern/rbtree.h> --#include <kern/macro_help.h> -+#include <kern/macros.h> - - /* TODO: make it dynamic */ - #define KENTRY_DATA_SIZE (256*PAGE_SIZE) -diff --git a/vm/vm_object.h b/vm/vm_object.h -index 5c42f56..3bfc67a 100644 ---- a/vm/vm_object.h -+++ b/vm/vm_object.h -@@ -45,7 +45,7 @@ - #include <kern/lock.h> - #include <kern/assert.h> - #include <kern/debug.h> --#include <kern/macro_help.h> -+#include <kern/macros.h> - #include <vm/pmap.h> - #include <ipc/ipc_types.h> - -diff --git a/vm/vm_page.h b/vm/vm_page.h -index 4fe1b41..e6a8c49 100644 ---- a/vm/vm_page.h -+++ b/vm/vm_page.h -@@ -42,7 +42,7 @@ - #include <kern/queue.h> - #include <kern/lock.h> - --#include <kern/macro_help.h> -+#include <kern/macros.h> - #include <kern/sched_prim.h> /* definitions of wait/wakeup */ - - #if MACH_VM_DEBUG --- -2.1.4 - diff --git a/debian/patches/error-handling0001-kern-gracefully-handle-resource-shortage.patch b/debian/patches/error-handling0001-kern-gracefully-handle-resource-shortage.patch deleted file mode 100644 index 45aa690..0000000 --- a/debian/patches/error-handling0001-kern-gracefully-handle-resource-shortage.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 9cc6ec312879838cd381e77cffbe4869bc98892a Mon Sep 17 00:00:00 2001 -From: Justus Winter <4winter@informatik.uni-hamburg.de> -Date: Sun, 26 Apr 2015 15:35:43 +0200 -Subject: [PATCH gnumach 1/3] kern: gracefully handle resource shortage - -* kern/task.c (task_create): Gracefully handle resource shortage. ---- - kern/task.c | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/kern/task.c b/kern/task.c -index 57e7f41..dcd5371 100644 ---- a/kern/task.c -+++ b/kern/task.c -@@ -89,9 +89,8 @@ kern_return_t task_create( - #endif - - new_task = (task_t) kmem_cache_alloc(&task_cache); -- if (new_task == TASK_NULL) { -- panic("task_create: no memory for task structure"); -- } -+ if (new_task == TASK_NULL) -+ return KERN_RESOURCE_SHORTAGE; - - /* one ref for just being alive; one for our caller */ - new_task->ref_count = 2; --- -2.1.4 - diff --git a/debian/patches/error-handling0002-vm-gracefully-handle-resource-shortage.patch b/debian/patches/error-handling0002-vm-gracefully-handle-resource-shortage.patch deleted file mode 100644 index 1b70c48..0000000 --- a/debian/patches/error-handling0002-vm-gracefully-handle-resource-shortage.patch +++ /dev/null @@ -1,59 +0,0 @@ -From c896bbc9b73edadc3ed96019055540686717d21f Mon Sep 17 00:00:00 2001 -From: Justus Winter <4winter@informatik.uni-hamburg.de> -Date: Sun, 26 Apr 2015 15:39:00 +0200 -Subject: [PATCH gnumach 2/3] vm: gracefully handle resource shortage - -* vm/vm_object.c (vm_object_copy_call): Gracefully handle resource -shortage by doing the allocation earlier and aborting the function if -unsuccessful. ---- - vm/vm_object.c | 26 ++++++++++++-------------- - 1 file changed, 12 insertions(+), 14 deletions(-) - -diff --git a/vm/vm_object.c b/vm/vm_object.c -index 71c0edb..8c6bbab 100644 ---- a/vm/vm_object.c -+++ b/vm/vm_object.c -@@ -1336,16 +1336,6 @@ kern_return_t vm_object_copy_call( - vm_page_t p; - - /* -- * Set the backing object for the new -- * temporary object. -- */ -- -- assert(src_object->ref_count > 0); -- src_object->ref_count++; -- vm_object_paging_begin(src_object); -- vm_object_unlock(src_object); -- -- /* - * Create a memory object port to be associated - * with this new vm_object. - * -@@ -1358,10 +1348,18 @@ kern_return_t vm_object_copy_call( - */ - - new_memory_object = ipc_port_alloc_kernel(); -- if (new_memory_object == IP_NULL) { -- panic("vm_object_copy_call: allocate memory object port"); -- /* XXX Shouldn't panic here. */ -- } -+ if (new_memory_object == IP_NULL) -+ return KERN_RESOURCE_SHORTAGE; -+ -+ /* -+ * Set the backing object for the new -+ * temporary object. -+ */ -+ -+ assert(src_object->ref_count > 0); -+ src_object->ref_count++; -+ vm_object_paging_begin(src_object); -+ vm_object_unlock(src_object); - - /* we hold a naked receive right for new_memory_object */ - (void) ipc_port_make_send(new_memory_object); --- -2.1.4 - diff --git a/debian/patches/error-handling0003-kern-gracefully-handle-resource-shortage.patch b/debian/patches/error-handling0003-kern-gracefully-handle-resource-shortage.patch deleted file mode 100644 index b2d4e5a..0000000 --- a/debian/patches/error-handling0003-kern-gracefully-handle-resource-shortage.patch +++ /dev/null @@ -1,143 +0,0 @@ -From a453f45b30aa90da0b1aa84787a95243b116545b Mon Sep 17 00:00:00 2001 -From: Justus Winter <4winter@informatik.uni-hamburg.de> -Date: Sun, 26 Apr 2015 15:47:47 +0200 -Subject: [PATCH gnumach 3/3] kern: gracefully handle resource shortage - -* kern/thread.c (stack_alloc): Report resource shortage. -* kern/sched_prim.h (stack_alloc): Adjust declaration accordingly. -* kern/thread_swap.c (thread_doswapin): Report resource shortage. -(swapin_thread_continue): If the swap-in fails, put the thread back on -the queue and go back to sleep. -* kern/thread_swap.h (thread_doswapin): Adjust declaration accordingly. ---- - kern/sched_prim.h | 2 +- - kern/thread.c | 11 ++++++----- - kern/thread_swap.c | 17 ++++++++++++++--- - kern/thread_swap.h | 2 +- - 4 files changed, 22 insertions(+), 10 deletions(-) - -diff --git a/kern/sched_prim.h b/kern/sched_prim.h -index fd989b6..62698dc 100644 ---- a/kern/sched_prim.h -+++ b/kern/sched_prim.h -@@ -150,7 +150,7 @@ extern void stack_handoff( - * or are defined directly by machine-dependent code. - */ - --extern void stack_alloc( -+extern kern_return_t stack_alloc( - thread_t thread, - void (*resume)(thread_t)); - extern boolean_t stack_alloc_try( -diff --git a/kern/thread.c b/kern/thread.c -index 009884c..f52c95b 100644 ---- a/kern/thread.c -+++ b/kern/thread.c -@@ -171,7 +171,7 @@ boolean_t stack_alloc_try( - * May block. - */ - --void stack_alloc( -+kern_return_t stack_alloc( - thread_t thread, - void (*resume)(thread_t)) - { -@@ -195,15 +195,15 @@ void stack_alloc( - (void) splx(s); - - if (stack == 0) { -+ kern_return_t kr; - /* - * Kernel stacks should be naturally aligned, - * so that it is easy to find the starting/ending - * addresses of a stack given an address in the middle. - */ -- -- if (kmem_alloc_aligned(kmem_map, &stack, KERNEL_STACK_SIZE) -- != KERN_SUCCESS) -- panic("stack_alloc"); -+ kr = kmem_alloc_aligned(kmem_map, &stack, KERNEL_STACK_SIZE); -+ if (kr != KERN_SUCCESS) -+ return kr; - - #if MACH_DEBUG - stack_init(stack); -@@ -211,6 +211,7 @@ void stack_alloc( - } - - stack_attach(thread, stack, resume); -+ return KERN_SUCCESS; - } - - /* -diff --git a/kern/thread_swap.c b/kern/thread_swap.c -index dc2924a..20ad040 100644 ---- a/kern/thread_swap.c -+++ b/kern/thread_swap.c -@@ -123,15 +123,18 @@ void thread_swapin(thread_t thread) - * it on a run queue. No locks should be held on entry, as it is - * likely that this routine will sleep (waiting for stack allocation). - */ --void thread_doswapin(thread_t thread) -+kern_return_t thread_doswapin(thread_t thread) - { -+ kern_return_t kr; - spl_t s; - - /* - * Allocate the kernel stack. - */ - -- stack_alloc(thread, thread_continue); -+ kr = stack_alloc(thread, thread_continue); -+ if (kr != KERN_SUCCESS) -+ return kr; - - /* - * Place on run queue. -@@ -144,6 +147,7 @@ void thread_doswapin(thread_t thread) - thread_setrun(thread, TRUE); - thread_unlock(thread); - (void) splx(s); -+ return KERN_SUCCESS; - } - - /* -@@ -163,13 +167,20 @@ void __attribute__((noreturn)) swapin_thread_continue(void) - - while ((thread = (thread_t) dequeue_head(&swapin_queue)) - != THREAD_NULL) { -+ kern_return_t kr; - swapper_unlock(); - (void) splx(s); - -- thread_doswapin(thread); /* may block */ -+ kr = thread_doswapin(thread); /* may block */ - - s = splsched(); - swapper_lock(); -+ -+ if (kr != KERN_SUCCESS) { -+ enqueue_head(&swapin_queue, -+ (queue_entry_t) thread); -+ break; -+ } - } - - assert_wait((event_t) &swapin_queue, FALSE); -diff --git a/kern/thread_swap.h b/kern/thread_swap.h -index 9d64537..d032acc 100644 ---- a/kern/thread_swap.h -+++ b/kern/thread_swap.h -@@ -37,7 +37,7 @@ - */ - extern void swapper_init(void); - extern void thread_swapin(thread_t thread); --extern void thread_doswapin(thread_t thread); -+extern kern_return_t thread_doswapin(thread_t thread); - extern void swapin_thread(void) __attribute__((noreturn)); - - #endif /* _KERN_THREAD_SWAP_H_ */ --- -2.1.4 - diff --git a/debian/patches/series b/debian/patches/series index 315c2bc..b583bee 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -8,11 +8,7 @@ #vm_page_cleanq.patch task-load.patch reorder-ipc_port.patch -error-handling0001-kern-gracefully-handle-resource-shortage.patch -error-handling0002-vm-gracefully-handle-resource-shortage.patch -error-handling0003-kern-gracefully-handle-resource-shortage.patch sysenter0001-yyy-sysenter-prototype.patch -0001-kern-import-macros.h-from-x15.patch 0002-kern-add-radix-tree-library.patch 0003-ipc-undo-manual-inlining-of-ipc_entry_X-functions.patch 0004-ipc-replace-reverse-hash-table-with-a-radix-tree.patch |