mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-23 21:39:10 -04:00
Change the declaration of set_processor_satp function
This commit is contained in:
parent
cfcece940e
commit
01c7b5e384
2 changed files with 13 additions and 9 deletions
|
@ -75,8 +75,8 @@ public:
|
|||
// attach memory module
|
||||
processor_.attach_ram(&ram_);
|
||||
#ifdef VM_ENABLE
|
||||
//Set
|
||||
processor_.set_processor_satp(VM_ADDR_MODE);
|
||||
//Set
|
||||
set_processor_satp(VM_ADDR_MODE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -133,13 +133,13 @@ public:
|
|||
bool is_pc = false;
|
||||
std::cout << "startup addr: " << std::hex << STARTUP_ADDR << std::endl;
|
||||
std::cout << "bit mode: " << std::dec << XLEN << std::endl;
|
||||
if (get_mode() == VA_MODE::BARE)
|
||||
return 0;
|
||||
|
||||
if (*dev_maddr == STARTUP_ADDR || *dev_maddr == 0x7FFFF000) {
|
||||
is_pc = true;
|
||||
}
|
||||
|
||||
if (get_mode() == VA_MODE::BARE)
|
||||
return 0;
|
||||
|
||||
uint64_t ppn = *dev_maddr >> 12;
|
||||
uint64_t init_pAddr = *dev_maddr;
|
||||
uint64_t init_vAddr = *dev_maddr + 0xf0000000; // vpn will change, but we want to return the vpn of the beginning of the virtual allocation
|
||||
|
@ -188,9 +188,10 @@ public:
|
|||
return err;
|
||||
});
|
||||
#ifdef VM_ENABLE
|
||||
// VM address translation
|
||||
std::cout << "physical addr: " << std::hex << *dev_addr << std::endl;
|
||||
// VM address translation
|
||||
map_local_mem(size, dev_addr);
|
||||
std::cout << "virtual addr: " << std::hex << *dev_addr << std::endl;
|
||||
#endif
|
||||
*dev_addr = addr;
|
||||
return 0;
|
||||
|
@ -342,7 +343,7 @@ public:
|
|||
|
||||
#ifdef VM_ENABLE
|
||||
/* VM Management */
|
||||
void set_processor_satp(VA_MODE mode)
|
||||
void set_processor_satp(VA_MODE mode)
|
||||
{
|
||||
uint32_t satp;
|
||||
if (mode == VA_MODE::BARE)
|
||||
|
@ -546,9 +547,11 @@ public:
|
|||
uint64_t asize = aligned_size(RAM_PAGE_SIZE, CACHE_BLOCK_SIZE);
|
||||
uint8_t *src = new uint8_t[RAM_PAGE_SIZE];
|
||||
for (uint64_t i = 0; i < RAM_PAGE_SIZE; ++i) {
|
||||
src[i] = (0x00000000 >> ((i & 0x3) * 8)) & 0xff;
|
||||
src[i] = (0x00000000 >> ((i & 0x3) << 3)) & 0xff;
|
||||
}
|
||||
ram_.enable_acl(false);
|
||||
ram_.write((const uint8_t*)src, addr, asize);
|
||||
ram_.enable_acl(true);
|
||||
}
|
||||
|
||||
void read_page_table(uint64_t addr) {
|
||||
|
@ -567,7 +570,9 @@ public:
|
|||
src[i] = (value >> ((i & 0x3) * 8)) & 0xff;
|
||||
}
|
||||
//std::cout << "writing PTE to RAM addr 0x" << std::hex << addr << std::endl;
|
||||
ram_.enable_acl(false);
|
||||
ram_.write((const uint8_t*)src, addr, PTE_SIZE);
|
||||
ram_.enable_acl(true);
|
||||
}
|
||||
|
||||
uint64_t read_pte(uint64_t addr) {
|
||||
|
|
|
@ -34,7 +34,6 @@ public:
|
|||
|
||||
void dcr_write(uint32_t addr, uint32_t value);
|
||||
#ifdef VM_ENABLE
|
||||
void set_processor_satp(VA_MODE mode);
|
||||
uint32_t get_satp();
|
||||
void set_satp(uint32_t satp);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue