Skip to content

Commit

Permalink
refactor: move DTB before RAM and increase its size to 1MB
Browse files Browse the repository at this point in the history
  • Loading branch information
edubart committed Jul 31, 2023
1 parent d8b0287 commit 4fb4b7f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/machine-emulator-defines
2 changes: 1 addition & 1 deletion src/cartesi/machine_ext.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ function machine_methods:get_pmas(dump_memory)
local config = self:get_initial_config()
local pmas = {
{ start = cartesi.PMA_SHADOW_STATE_START, length = cartesi.PMA_SHADOW_STATE_LENGTH }, -- shadow state
{ start = cartesi.PMA_DTB_START, length = cartesi.PMA_DTB_LENGTH }, -- dtb
{ start = cartesi.PMA_SHADOW_PMAS_START, length = cartesi.PMA_SHADOW_PMAS_LENGTH }, -- shadow pmas
{ start = cartesi.PMA_SHADOW_TLB_START, length = cartesi.PMA_SHADOW_TLB_LENGTH }, -- shadow tlb
{ start = cartesi.PMA_CLINT_START, length = cartesi.PMA_CLINT_LENGTH }, -- clint
{ start = cartesi.PMA_HTIF_START, length = cartesi.PMA_HTIF_LENGTH }, -- htif
{ start = cartesi.PMA_DTB_START, length = cartesi.PMA_DTB_LENGTH }, -- dtb
}
-- uarch ram
if config.uarch.ram.length > 0 then
Expand Down
4 changes: 2 additions & 2 deletions src/clua-cartesi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ CM_API int luaopen_cartesi(lua_State *L) {

clua_setintegerfield(L, PMA_SHADOW_STATE_START, "PMA_SHADOW_STATE_START", -1);
clua_setintegerfield(L, PMA_SHADOW_STATE_LENGTH, "PMA_SHADOW_STATE_LENGTH", -1);
clua_setintegerfield(L, PMA_DTB_START, "PMA_DTB_START", -1);
clua_setintegerfield(L, PMA_DTB_LENGTH, "PMA_DTB_LENGTH", -1);
clua_setintegerfield(L, PMA_SHADOW_PMAS_START, "PMA_SHADOW_PMAS_START", -1);
clua_setintegerfield(L, PMA_SHADOW_PMAS_LENGTH, "PMA_SHADOW_PMAS_LENGTH", -1);
clua_setintegerfield(L, PMA_SHADOW_TLB_START, "PMA_SHADOW_TLB_START", -1);
Expand All @@ -138,6 +136,8 @@ CM_API int luaopen_cartesi(lua_State *L) {
clua_setintegerfield(L, PMA_HTIF_START, "PMA_HTIF_START", -1);
clua_setintegerfield(L, PMA_HTIF_LENGTH, "PMA_HTIF_LENGTH", -1);
clua_setintegerfield(L, PMA_UARCH_RAM_START, "PMA_UARCH_RAM_START", -1);
clua_setintegerfield(L, PMA_DTB_START, "PMA_DTB_START", -1);
clua_setintegerfield(L, PMA_DTB_LENGTH, "PMA_DTB_LENGTH", -1);
clua_setintegerfield(L, PMA_RAM_START, "PMA_RAM_START", -1);

clua_setintegerfield(L, MVENDORID_INIT, "MVENDORID", -1);
Expand Down
4 changes: 2 additions & 2 deletions src/pma-constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ enum PMA_ranges : uint64_t {
PMA_SHADOW_STATE_LENGTH = EXPAND_UINT64_C(PMA_SHADOW_STATE_LENGTH_DEF), ///< Length of processor shadow range
PMA_SHADOW_PMAS_START = EXPAND_UINT64_C(PMA_SHADOW_PMAS_START_DEF), ///< Start of pma board shadow range
PMA_SHADOW_PMAS_LENGTH = EXPAND_UINT64_C(PMA_SHADOW_PMAS_LENGTH_DEF), ///< Length of pma board shadow range
PMA_DTB_START = EXPAND_UINT64_C(PMA_DTB_START_DEF), ///< Start of DTB range
PMA_DTB_LENGTH = EXPAND_UINT64_C(PMA_DTB_LENGTH_DEF), ///< Length of DTB range
PMA_SHADOW_TLB_START = EXPAND_UINT64_C(PMA_SHADOW_TLB_START_DEF), ///< Start of TLB shadow range
PMA_SHADOW_TLB_LENGTH = EXPAND_UINT64_C(PMA_SHADOW_TLB_LENGTH_DEF), ///< Length of TLB shadow range
PMA_CLINT_START = EXPAND_UINT64_C(PMA_CLINT_START_DEF), ///< Start of CLINT range
PMA_CLINT_LENGTH = EXPAND_UINT64_C(PMA_CLINT_LENGTH_DEF), ///< Length of CLINT range
PMA_HTIF_START = EXPAND_UINT64_C(PMA_HTIF_START_DEF), ///< Start of HTIF range
PMA_HTIF_LENGTH = EXPAND_UINT64_C(PMA_HTIF_LENGTH_DEF), ///< Length of HTIF range
PMA_UARCH_RAM_START = EXPAND_UINT64_C(PMA_UARCH_RAM_START_DEF), ///< Length of microarchitecture RAM range
PMA_DTB_START = EXPAND_UINT64_C(PMA_DTB_START_DEF), ///< Start of DTB range
PMA_DTB_LENGTH = EXPAND_UINT64_C(PMA_DTB_LENGTH_DEF), ///< Length of DTB range
// PMA_FIRST_VIRTIO_START = EXPAND_UINT64_C(PMA_FIRST_VIRTIO_START_DEF), ///< Start of first VIRTIO range
// PMA_VIRTIO_LENGTH = EXPAND_UINT64_C(PMA_VIRTIO_LENGTH_DEF), ///< Length of each VIRTIO range
// PMA_LAST_VIRTIO_END = EXPAND_UINT64_C(PMA_LAST_VIRTIO_END_DEF), ///< End of last VIRTIO range
Expand Down

0 comments on commit 4fb4b7f

Please sign in to comment.