Skip to content

Commit

Permalink
Revert change in renaming heap to bss
Browse files Browse the repository at this point in the history
It was a stretch to call it .bss and I was thinking about removing
it entirely. So I think sticking with what is was previously called
is better.
  • Loading branch information
TheThirdOne committed Mar 12, 2020
1 parent 377c231 commit 3c6d2fe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
5 changes: 2 additions & 3 deletions src/rars/riscv/hardware/Memory.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import rars.Settings;
import rars.SimulationException;
import rars.riscv.Instruction;
import rars.util.Binary;

import java.util.*;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/rars/riscv/hardware/MemoryConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Range> sections;
public final int gp_offset, extern_size;
public final boolean builtin;
Expand All @@ -63,7 +63,7 @@ public MemoryConfiguration(String ident, String name, Map<String, Range> 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);
Expand Down Expand Up @@ -102,7 +102,7 @@ public int getDataBaseAddress() {
}

public int getHeapBaseAddress() {
return bss.low;
return heap.low;
}

public int getStackBaseAddress() {
Expand All @@ -114,7 +114,7 @@ public int getMemoryMapBaseAddress() {
}

public int getDataSegmentLimitAddress() {
return bss.high;
return heap.high;
}

public int getTextLimitAddress() {
Expand Down
6 changes: 3 additions & 3 deletions src/rars/riscv/hardware/MemoryConfigurations.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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));
Expand All @@ -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));
Expand Down

0 comments on commit 3c6d2fe

Please sign in to comment.