Skip to content

Commit

Permalink
proxyutils: workaround for mem_size_actual == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
mildsunrise committed Nov 9, 2024
1 parent b952d6b commit ed97010
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion proxyclient/m1n1/proxyutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from .asm import ARMAsm
from .proxy import *
from .utils import Reloadable, chexdiff32
from .utils import Reloadable, chexdiff32, align_up
from .tgtypes import *
from .sysreg import *
from .malloc import Heap
Expand Down Expand Up @@ -54,6 +54,10 @@ def __init__(self, p: M1N1Proxy, heap_size=1024 * 1024 * 1024):

self.ba = self.iface.readstruct(self.ba_addr, BootArgs)

# generate a usable value for mem_size_actual if missing, in the same way as startup.c
if self.ba.mem_size_actual == 0:
self.ba.mem_size_actual = align_up(self.ba.phys_base + self.ba.mem_size - 0x800000000, 1 << 30)

# We allocate a 128MB heap, 128MB after the m1n1 heap, without telling it about it.
# This frees up from having to coordinate memory management or free stuff after a Python
# script runs, at the expense that if m1n1 ever uses more than 128MB of heap it will
Expand Down

0 comments on commit ed97010

Please sign in to comment.