Added basic UI; misc memory fixes
This commit is contained in:
parent
558e710e17
commit
26e90a99cd
13 changed files with 90 additions and 36 deletions
|
@ -61,8 +61,7 @@ private:
|
|||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
auto o_config_mem = boost::serialization::binary_object(&config_mem, sizeof(config_mem));
|
||||
ar& o_config_mem;
|
||||
ar& boost::serialization::make_binary_object(&config_mem, sizeof(config_mem));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -193,19 +193,19 @@ ResultCode TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySy
|
|||
// TODO(Subv): Perform permission checks.
|
||||
|
||||
// Reserve a page of memory before the mapped buffer
|
||||
auto reserve_buffer = std::make_unique<u8[]>(Memory::PAGE_SIZE);
|
||||
auto reserve_buffer = std::vector<u8>(Memory::PAGE_SIZE);
|
||||
dst_process->vm_manager.MapBackingMemoryToBase(
|
||||
Memory::IPC_MAPPING_VADDR, Memory::IPC_MAPPING_SIZE, reserve_buffer.get(),
|
||||
Memory::IPC_MAPPING_VADDR, Memory::IPC_MAPPING_SIZE, reserve_buffer.data(),
|
||||
Memory::PAGE_SIZE, Kernel::MemoryState::Reserved);
|
||||
|
||||
auto buffer = std::make_unique<u8[]>(num_pages * Memory::PAGE_SIZE);
|
||||
memory.ReadBlock(*src_process, source_address, buffer.get() + page_offset, size);
|
||||
auto buffer = std::vector<u8>(num_pages * Memory::PAGE_SIZE);
|
||||
memory.ReadBlock(*src_process, source_address, buffer.data() + page_offset, size);
|
||||
|
||||
// Map the page(s) into the target process' address space.
|
||||
target_address =
|
||||
dst_process->vm_manager
|
||||
.MapBackingMemoryToBase(Memory::IPC_MAPPING_VADDR, Memory::IPC_MAPPING_SIZE,
|
||||
buffer.get(), num_pages * Memory::PAGE_SIZE,
|
||||
buffer.data(), num_pages * Memory::PAGE_SIZE,
|
||||
Kernel::MemoryState::Shared)
|
||||
.Unwrap();
|
||||
|
||||
|
@ -213,7 +213,7 @@ ResultCode TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySy
|
|||
|
||||
// Reserve a page of memory after the mapped buffer
|
||||
dst_process->vm_manager.MapBackingMemoryToBase(
|
||||
Memory::IPC_MAPPING_VADDR, Memory::IPC_MAPPING_SIZE, reserve_buffer.get(),
|
||||
Memory::IPC_MAPPING_VADDR, Memory::IPC_MAPPING_SIZE, reserve_buffer.data(),
|
||||
Memory::PAGE_SIZE, Kernel::MemoryState::Reserved);
|
||||
|
||||
mapped_buffer_context.push_back({permissions, size, source_address,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <boost/serialization/unique_ptr.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/ipc.h"
|
||||
#include "core/hle/kernel/thread.h"
|
||||
|
@ -25,8 +25,8 @@ struct MappedBufferContext {
|
|||
VAddr source_address;
|
||||
VAddr target_address;
|
||||
|
||||
std::unique_ptr<u8[]> buffer;
|
||||
std::unique_ptr<u8[]> reserve_buffer;
|
||||
std::vector<u8> buffer;
|
||||
std::vector<u8> reserve_buffer;
|
||||
|
||||
private:
|
||||
template <class Archive>
|
||||
|
@ -35,10 +35,8 @@ private:
|
|||
ar& size;
|
||||
ar& source_address;
|
||||
ar& target_address;
|
||||
// TODO: Check whether we need these. If we do, add a field for the size and/or change to a
|
||||
// 'vector'
|
||||
// ar & buffer;
|
||||
// ar & reserve_buffer;
|
||||
ar& buffer;
|
||||
ar& reserve_buffer;
|
||||
}
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
|
|
|
@ -29,7 +29,7 @@ template <class Archive>
|
|||
void Process::serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& boost::serialization::base_object<Object>(*this);
|
||||
ar& handle_table;
|
||||
ar& codeset;
|
||||
ar& codeset; // TODO: Replace with apploader reference
|
||||
ar& resource_limit;
|
||||
ar& svc_access_mask;
|
||||
ar& handle_table_size;
|
||||
|
|
|
@ -133,7 +133,7 @@ private:
|
|||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& boost::serialization::base_object<Object>(*this);
|
||||
// TODO: memory reference
|
||||
ar& memory;
|
||||
ar& segments;
|
||||
ar& entrypoint;
|
||||
ar& name;
|
||||
|
|
|
@ -301,8 +301,7 @@ private:
|
|||
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int) {
|
||||
auto obj = boost::serialization::binary_object(this, sizeof(Regs));
|
||||
ar& obj;
|
||||
ar& boost::serialization::make_binary_object(this, sizeof(Regs));
|
||||
}
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
|
|
|
@ -84,18 +84,15 @@ private:
|
|||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
// TODO: Skip n3ds ram when not used?
|
||||
auto s_fcram = boost::serialization::binary_object(fcram.get(), Memory::FCRAM_N3DS_SIZE);
|
||||
auto s_vram = boost::serialization::binary_object(vram.get(), Memory::VRAM_SIZE);
|
||||
auto s_extra =
|
||||
boost::serialization::binary_object(n3ds_extra_ram.get(), Memory::N3DS_EXTRA_RAM_SIZE);
|
||||
ar& s_fcram;
|
||||
ar& s_vram;
|
||||
ar& s_extra;
|
||||
ar& boost::serialization::make_binary_object(fcram.get(), Memory::FCRAM_N3DS_SIZE);
|
||||
ar& boost::serialization::make_binary_object(vram.get(), Memory::VRAM_SIZE);
|
||||
// TODO: When n3ds support is added, put this back in
|
||||
// ar& boost::serialization::make_binary_object(n3ds_extra_ram.get(),
|
||||
// Memory::N3DS_EXTRA_RAM_SIZE);
|
||||
ar& current_page_table;
|
||||
ar& cache_marker;
|
||||
// TODO: How the hell to do page tables..
|
||||
// ar & page_table_list;
|
||||
// ar & current_page_table;
|
||||
ar& page_table_list;
|
||||
// dsp is set from Core::System at startup
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "boost/serialization/access.hpp"
|
||||
#include <boost/serialization/access.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "core/mmio.h"
|
||||
|
||||
|
@ -54,12 +56,14 @@ struct SpecialRegion {
|
|||
u32 size;
|
||||
MMIORegionPointer handler;
|
||||
|
||||
private:
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& base;
|
||||
ar& size;
|
||||
ar& handler;
|
||||
}
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -86,6 +90,15 @@ struct PageTable {
|
|||
* the corresponding entry in `pointers` MUST be set to null.
|
||||
*/
|
||||
std::array<PageType, PAGE_TABLE_NUM_ENTRIES> attributes;
|
||||
|
||||
private:
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int) {
|
||||
// TODO: Pointers; same as VMA backing regions we need to serialize the u8*
|
||||
ar& special_regions;
|
||||
ar& attributes;
|
||||
}
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
|
||||
/// Physical memory regions as seen from the ARM11
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue