2020-11-08 12:48:16 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-11-08 12:48:16 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Types.h>
|
|
|
|
|
|
|
|
namespace AK {
|
|
|
|
|
|
|
|
class StackInfo {
|
|
|
|
public:
|
|
|
|
StackInfo();
|
|
|
|
|
|
|
|
FlatPtr base() const { return m_base; }
|
|
|
|
FlatPtr top() const { return m_top; }
|
|
|
|
size_t size() const { return m_size; }
|
|
|
|
size_t size_free() const
|
|
|
|
{
|
2023-07-01 00:42:37 +00:00
|
|
|
auto p = reinterpret_cast<FlatPtr>(__builtin_frame_address(0));
|
|
|
|
return p - m_base;
|
2020-11-08 12:48:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
FlatPtr m_base;
|
|
|
|
FlatPtr m_top;
|
|
|
|
size_t m_size;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-11-26 11:18:30 +00:00
|
|
|
#if USING_AK_GLOBALLY
|
2020-11-08 12:48:16 +00:00
|
|
|
using AK::StackInfo;
|
2022-11-26 11:18:30 +00:00
|
|
|
#endif
|