blob: 6c9930348830cea3e5781453bfa9b53dfb034e70 [file] [log] [blame]
// Copyright 2019 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.
#pragma once
#include <fbl/vector.h>
#include <lib/zx/bti.h>
#include <region-alloc/region-alloc.h>
#include "protected_memory_allocator.h"
class AmlogicMemoryAllocator : public ProtectedMemoryAllocator {
public:
AmlogicMemoryAllocator(zx::bti bti);
zx_status_t Init(uint64_t size);
zx_status_t Allocate(uint64_t size, zx::vmo* vmo) override;
private:
zx::bti bti_;
struct Region {
RegionAllocator::Region::UPtr region;
zx::vmo vmo;
};
RegionAllocator protected_allocator_;
fbl::Vector<fbl::unique_ptr<Region>> regions_;
uint64_t start_;
uint64_t size_;
zx::vmo contiguous_vmo_;
};