[Libre-soc-bugs] [Bug 1169] Add ELF and mmap support to ISACaller -- no dynamic linking

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Mon Nov 27 08:23:52 GMT 2023


https://bugs.libre-soc.org/show_bug.cgi?id=1169

--- Comment #36 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Jacob Lifshay from comment #34)
> (In reply to Luke Kenneth Casson Leighton from comment #33)
> > (In reply to Jacob Lifshay from comment #32)
> > 
> > > I think we should add mmap back in: i'm already like 90% done with a minimal
> > > version of it and it makes ELF loading easier.
> > 
> > ok great.  do not spend time on "security", do not spend time
> > on "safety". allocate memory. use it. done.
> 
> nah, I'm just leaving all the stuff I already implemented in there. no point
> in wasting more time to delete something that's useful.

good plan.

> > 
> > if necessary allocate the (one, large but still within 32bit system range)
> > memory block early with a python startup hook.
> 
> it has several blocks of memory, since stuff like the stack is always mapped
> at the other end of the user address space.

make sure it will fit on a system with only 2 GB of RAM.

> e.g. the memory mappings at startup of a simple static-linked binary:
>     Start Addr           End Addr       Size     Offset objfile
>     0x10000000         0x100b0000    0xb0000        0x0 /home/jacob/a.out
>     0x100b0000         0x100d0000    0x20000    0xa0000 /home/jacob/a.out

good. fits in 2GB RAM.

> 0x7ffff7fe0000     0x7ffff8000000    0x20000        0x0 [vdso]
> 0x7ffffffd0000     0x800000000000    0x30000        0x0 [stack]

cut those back to 0x3fff_xxxx to fit into 2GB RAM systems.


(In reply to Jacob Lifshay from comment #35)
> Implemented mmap, except for final wiring of sc insn to call
> MemMMap.mmap_syscall. This is enough for loading ELF files, so I'm leaving
> it at that.

GREAT.

> it supports mapping anonymous memory and files, but only with MAP_PRIVATE.

not sure if this is in scope, assuming no unless it interferes with ELF loading
and running.

> MAP_SHARED isn't supported for now.

don't care in the least little bit. 100% out of scope of the bare minimum
requirement.

> MAP_FIXED and not are both supported,
> though I only test MAP_FIXED since
> that's all I need for ELF loading.

goood.

this is great jacob, gets the job done, and done fast.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list