Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/arch/x86/paging.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <delegate>
#include <util/bitops.hpp>
#include <util/units.hpp>
#include <kernel/memory.hpp>
#include <mem/vmap.hpp>
#include <cstdlib>
#include <expects>

Expand Down
2 changes: 1 addition & 1 deletion api/hal/machine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <memory>

#include <arch.hpp>
#include <util/allocator.hpp>
#include <mem/allocator.hpp>

namespace os {
namespace detail { class Machine; }
Expand Down
2 changes: 1 addition & 1 deletion api/hal/machine_memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// limitations under the License.

#include <os.hpp>
#include <util/alloc_lstack.hpp>
#include <mem/alloc/lstack.hpp>

#ifndef OS_MACHINE_MEMORY_HPP
#define OS_MACHINE_MEMORY_HPP
Expand Down
28 changes: 28 additions & 0 deletions api/mem/alloc.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef MEM_ALLOC_HPP
#define MEM_ALLOC_HPP

#include <mem/alloc/buddy.hpp>
#include <mem/allocator.hpp>

namespace os::mem {

using Raw_allocator = buddy::Alloc<false>;

/** Get default allocator for untyped allocations */
Raw_allocator& raw_allocator();

template <typename T>
using Typed_allocator = Allocator<T, Raw_allocator>;

/** Get default std::allocator for typed allocations */
template <typename T>
inline Typed_allocator<T> system_allocator() {
return Typed_allocator<T>(raw_allocator());
}

/** True once the heap is initialized and usable */
bool heap_ready();

} // namespace os::mem

#endif // MEM_ALLOC_HPP
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions api/mem/flags.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#ifndef MEM_FLAGS_HPP
#define MEM_FLAGS_HPP

#include <cstdint>
#include <util/bitops.hpp>

namespace os::mem {
enum class Access : uint8_t {
none = 0,
read = 1,
write = 2,
execute = 4
};
} // os::mem

namespace util {
inline namespace bitops {
template<>
struct enable_bitmask_ops<os::mem::Access> {
using type = typename std::underlying_type<os::mem::Access>::type;
static constexpr bool enable = true;
};
}
}

#endif // MEM_FLAGS_HPP
6 changes: 3 additions & 3 deletions api/kernel/memmap.hpp → api/mem/memmap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
// limitations under the License.

#pragma once
#ifndef KERNEL_MEMMAP_HPP
#define KERNEL_MEMMAP_HPP
#ifndef MEM_MEMMAP_HPP
#define MEM_MEMMAP_HPP

#include <cassert>
#include <delegate>
Expand Down Expand Up @@ -466,4 +466,4 @@ class Memory_map {
}; //< class Memory_map

} // ns os::mem
#endif //< KERNEL_MEMMAP_HPP
#endif //< MEM_MEMMAP_HPP
Loading