Git Product home page Git Product logo

Comments (4)

jart avatar jart commented on August 27, 2024 2

What you propose was a sensible thing to do, until about seven minutes ago.

I'm proud to announce that Cosmopolitan now has malloc() support on metal. See edd9297 where I've updated the APE bootolader so that it reads the ELF program headers and maps whatever they define into memory. We use the PT_GNU_STACK program header to define the fixed address and size of the stack consistently for all operating systems. (Although officially speaking the only thing PT_GNU_STACK has historically done is it tells the Linux kernel to make mprotect actually protect memory rather than its default behavior of doing nothing and returning zero lool).

Is this recent change sufficient to meet your needs? I've got metal into a pretty good state right now. The next change is likely going to be interrupt handling, since right now all faults are triple faults without backtraces and life is going to be so much easier when that's no longer the case.

from cosmopolitan.

paulreimer avatar paulreimer commented on August 27, 2024

(I don't plan to distribute these binaries; they will only run on Linux / bare-metal machines that have known / controlled specs)

from cosmopolitan.

paulreimer avatar paulreimer commented on August 27, 2024

Thank you! This is awesome. It sounds like malloc Just Works, and I can get my ridiculous 32GB stacks from (slightly abusing?) the PT_GNU_STACK program header (I haven't tried this yet).

from cosmopolitan.

jart avatar jart commented on August 27, 2024

You can do both! Stacks can be huge and dynamic memory should just work too. The x86_64 architecture basically requires us to have a dynamic virtual memory manager in order to be able to run 64-bit instructions. I've managed to make the cost of having that no more than 12kb. But obviously the footprint will grow as you start linking functions like malloc().

I'm going to close this out since we've got a centralized tuning knob for stack size across all platforms now. Let me know if you'd like a way to make configuration easier. Possibly by having an optional macro that can be defined.

from cosmopolitan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.