aboutsummaryrefslogtreecommitdiff
path: root/mach/setup-thread.c
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2017-06-08 15:39:03 -0400
committerZack Weinberg <zackw@panix.com>2017-06-08 15:39:03 -0400
commit5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 (patch)
tree4470480d904b65cf14ca524f96f79eca818c3eaf /mach/setup-thread.c
parent199fc19d3aaaf57944ef036e15904febe877fc93 (diff)
downloadglibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.tar
glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.tar.gz
glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.tar.bz2
glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.zip
Prepare for radical source tree reorganization.zack/build-layout-experiment
All top-level files and directories are moved into a temporary storage directory, REORG.TODO, except for files that will certainly still exist in their current form at top level when we're done (COPYING, COPYING.LIB, LICENSES, NEWS, README), all old ChangeLog files (which are moved to the new directory OldChangeLogs, instead), and the generated file INSTALL (which is just deleted; in the new order, there will be no generated files checked into version control).
Diffstat (limited to 'mach/setup-thread.c')
-rw-r--r--mach/setup-thread.c79
1 files changed, 0 insertions, 79 deletions
diff --git a/mach/setup-thread.c b/mach/setup-thread.c
deleted file mode 100644
index 090d9086ad..0000000000
--- a/mach/setup-thread.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright (C) 1991-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <mach.h>
-#include <thread_state.h>
-#include <string.h>
-#include <mach/machine/vm_param.h>
-#include "sysdep.h" /* Defines stack direction. */
-
-#define STACK_SIZE (16 * 1024 * 1024) /* 16MB, arbitrary. */
-
-/* Give THREAD a stack and set it to run at PC when resumed.
- If *STACK_SIZE is nonzero, that size of stack is allocated.
- If *STACK_BASE is nonzero, that stack location is used.
- If STACK_BASE is not null it is filled in with the chosen stack base.
- If STACK_SIZE is not null it is filled in with the chosen stack size.
- Regardless, an extra page of red zone is allocated off the end; this
- is not included in *STACK_SIZE. */
-
-kern_return_t
-__mach_setup_thread (task_t task, thread_t thread, void *pc,
- vm_address_t *stack_base, vm_size_t *stack_size)
-{
- kern_return_t error;
- struct machine_thread_state ts;
- mach_msg_type_number_t tssize = MACHINE_THREAD_STATE_COUNT;
- vm_address_t stack;
- vm_size_t size;
- int anywhere;
-
- size = stack_size ? *stack_size ? : STACK_SIZE : STACK_SIZE;
- stack = stack_base ? *stack_base ? : 0 : 0;
- anywhere = !stack_base || !*stack_base;
-
- error = __vm_allocate (task, &stack, size + __vm_page_size, anywhere);
- if (error)
- return error;
-
- if (stack_size)
- *stack_size = size;
-
- memset (&ts, 0, sizeof (ts));
- MACHINE_THREAD_STATE_SET_PC (&ts, pc);
-#ifdef STACK_GROWTH_DOWN
- if (stack_base)
- *stack_base = stack + __vm_page_size;
- ts.SP = stack + __vm_page_size + size;
-#elif defined (STACK_GROWTH_UP)
- if (stack_base)
- *stack_base = stack;
- ts.SP = stack;
- stack += size;
-#else
- #error stack direction unknown
-#endif
-
- /* Create the red zone. */
- if (error = __vm_protect (task, stack, __vm_page_size, 0, VM_PROT_NONE))
- return error;
-
- return __thread_set_state (thread, MACHINE_THREAD_STATE_FLAVOR,
- (natural_t *) &ts, tssize);
-}
-
-weak_alias (__mach_setup_thread, mach_setup_thread)