blob: a8b599cb02004043e5e41e18da52a06ed3fd29d0 [file] [log] [blame]
// Copyright 2017 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stddef.h>
#include <lib/zx/vmar.h>
#include <lib/zx/vmo.h>
namespace context {
struct InternalContext;
using Context = InternalContext;
// A stack to be used with |MakeContext|.
class Stack {
// Creates a new stack. |stack_size| is the minimal size of the new stack.
explicit Stack(size_t stack_size = 64 * 1024);
// Releases the memory associated with this stack. After this call, the stack
// is ready to be used again, but its content is not specified.
void Release();
size_t stack_size() const { return stack_size_; }
uintptr_t safe_stack() const { return safe_stack_; }
#if __has_feature(safe_stack)
uintptr_t unsafe_stack() const { return unsafe_stack_; };
const size_t stack_size_;
zx::vmo vmo_;
zx::vmar safe_stack_mapping_;
uintptr_t safe_stack_;
#if __has_feature(safe_stack)
zx::vmar unsafe_stack_mapping_;
uintptr_t unsafe_stack_;
} // namespace context