Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Tweak memory allocation size for portability #221

Merged
merged 1 commit into from
Sep 18, 2023
Merged
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
13 changes: 11 additions & 2 deletions src/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,17 @@
#include "io.h"

static uint8_t *data_memory_base;
/* set memory size to 2^32 bytes */
#define MEM_SIZE 0x100000000ULL

/*
* set memory size to 2^32 - 1 bytes
*
* The memory size is set to 2^32 - 1 bytes in order
* to make rv32emu portable for both 32-bit and 64-bit platforms.
* As a result, rv32emu can access any segment of the memory in
* either platform. Furthermore, it is safe because most of the 
* test cases' data memory usage will not exceed this memory size.
*/
#define MEM_SIZE 0xFFFFFFFFULL

memory_t *memory_new()
{
Expand Down