diff --git a/src/rars/riscv/hardware/Memory.java b/src/rars/riscv/hardware/Memory.java index e1a53645..b51302de 100644 --- a/src/rars/riscv/hardware/Memory.java +++ b/src/rars/riscv/hardware/Memory.java @@ -5,7 +5,6 @@ import rars.Settings; import rars.SimulationException; import rars.riscv.Instruction; -import rars.util.Binary; import java.util.*; @@ -232,7 +231,7 @@ public static void setConfiguration() { // Default configuration comes from SPIM sections.put(".text", t.text.limit(TEXT_BLOCK_LENGTH_WORDS * TEXT_BLOCK_TABLE_LENGTH * WORD_LENGTH_BYTES)); sections.put(".data", t.data.limit(BLOCK_LENGTH_WORDS * BLOCK_TABLE_LENGTH * WORD_LENGTH_BYTES)); - sections.put(".bss", t.bss); + sections.put("heap", t.heap); sections.put("stack", t.stack.limitReverse(BLOCK_LENGTH_WORDS * BLOCK_TABLE_LENGTH * WORD_LENGTH_BYTES-1)); sections.put("mmio", t.mmio.limit(BLOCK_LENGTH_WORDS * MMIO_TABLE_LENGTH * WORD_LENGTH_BYTES)); configuration = new MemoryConfiguration(t.getConfigurationIdentifier(),t.getConfigurationName(), sections,t.gp_offset,t.extern_size); @@ -271,7 +270,7 @@ public int allocateBytesFromHeap(int numBytes) throws IllegalArgumentException { if (newHeapAddress % 4 != 0) { newHeapAddress = newHeapAddress + (4 - newHeapAddress % 4); // next higher multiple of 4 } - if (newHeapAddress >= configuration.bss.high) { + if (newHeapAddress >= configuration.heap.high) { throw new IllegalArgumentException("request (" + numBytes + ") exceeds available heap storage"); } heapAddress = newHeapAddress; diff --git a/src/rars/riscv/hardware/MemoryConfiguration.java b/src/rars/riscv/hardware/MemoryConfiguration.java index 7b91fed1..3b0173fd 100644 --- a/src/rars/riscv/hardware/MemoryConfiguration.java +++ b/src/rars/riscv/hardware/MemoryConfiguration.java @@ -49,7 +49,7 @@ public class MemoryConfiguration { // Identifier is used for saving setting; name is used for display private String configurationIdentifier, configurationName; - public final Range text, data, bss, stack, mmio, total; + public final Range text, data, heap, stack, mmio, total; public final Map sections; public final int gp_offset, extern_size; public final boolean builtin; @@ -63,7 +63,7 @@ public MemoryConfiguration(String ident, String name, Map section this.builtin = builtin; text = sections.get(".text"); data = sections.get(".data"); - bss = sections.get(".bss"); + heap = sections.get("heap"); stack = sections.get("stack"); mmio = sections.get("mmio"); total = sections.values().stream().reduce(text, Range::combine); @@ -102,7 +102,7 @@ public int getDataBaseAddress() { } public int getHeapBaseAddress() { - return bss.low; + return heap.low; } public int getStackBaseAddress() { @@ -114,7 +114,7 @@ public int getMemoryMapBaseAddress() { } public int getDataSegmentLimitAddress() { - return bss.high; + return heap.high; } public int getTextLimitAddress() { diff --git a/src/rars/riscv/hardware/MemoryConfigurations.java b/src/rars/riscv/hardware/MemoryConfigurations.java index a898cea7..7bedb4d6 100644 --- a/src/rars/riscv/hardware/MemoryConfigurations.java +++ b/src/rars/riscv/hardware/MemoryConfigurations.java @@ -60,7 +60,7 @@ public static void buildConfigurationCollection() { // Default configuration comes from SPIM sections.put(".text", new Range( 0x400000,0x10000000)); sections.put(".data", new Range(0x10000000,0x10040000)); - sections.put(".bss", new Range(0x10040000,0x30000000)); + sections.put("heap", new Range(0x10040000,0x30000000)); sections.put("stack", new Range(0x60000000,0x80000000)); sections.put("mmio", new Range(0xffff0000,0xffffffff)); configurations.add(new MemoryConfiguration("Default","Default", sections,0x8000,0x10000)); @@ -69,7 +69,7 @@ public static void buildConfigurationCollection() { // Compact allows 16 bit addressing, data segment starts at 0 sections.put(".text", new Range(0x3000,0x4000)); sections.put(".data", new Range(0x0000,0x2000)); - sections.put(".bss", new Range(0x2000,0x2800)); //Heap and stack split in half (ideally they should overlap) + sections.put("heap", new Range(0x2000,0x2800)); //Heap and stack split in half (ideally they should overlap) sections.put("stack", new Range(0x2800,0x3000)); sections.put("mmio", new Range(0x7f00,0x8000)); configurations.add(new MemoryConfiguration("CompactDataAtZero", "Compact, Data at Address 0", sections,0x1800,0x1000)); @@ -78,7 +78,7 @@ public static void buildConfigurationCollection() { // Compact allows 16 bit addressing, text segment starts at 0 sections.put(".text", new Range(0x0000,0x1000)); sections.put(".data", new Range(0x1000,0x3000)); - sections.put(".bss", new Range(0x3000,0x3800)); //Heap and stack split in half (ideally they should overlap) + sections.put("heap", new Range(0x3000,0x3800)); //Heap and stack split in half (ideally they should overlap) sections.put("stack", new Range(0x3800,0x4000)); sections.put("mmio", new Range(0x7f00,0x8000)); configurations.add(new MemoryConfiguration("CompactTextAtZero", "Compact, Text at Address 0", sections,0x800,0x1000));