Comments (4)
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.
(I don't plan to distribute these binaries; they will only run on Linux / bare-metal machines that have known / controlled specs)
from cosmopolitan.
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.
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)
- Allow replacing `jartsr=` magic with `#!/bin/sh` header
- cosmocc segfaults on static struct sigaction HOT 2
- confstr() is declared in <stdio.h> rather than <unistd.h>
- Python binary is packaged without certificates HOT 4
- [Windows] execve regression
- test/posix/fread3gb_test fails on XnuSilicon
- cosmo.zip offiline? HOT 3
- llamafile --assimilate: corrupted program header size HOT 1
- test/libc/calls/open_test: open_readOnlyCreatMode gives wrong errno, but not with --strace, on linux aarch64 HOT 1
- Bug: Mac llamafile make issue HOT 1
- testing github autolabeler label is too noisy
- Bug: On Windows, cosmos GNU coreutils ls not printing correct result for `ls ../../` HOT 6
- compile_commands.json generator for clangd integration HOT 1
- Bug: Lua fails a `seek`-related test
- Bug: Lua's `ltests.c` doesn't compile
- Bug: secondary redbean SQLite WAL connections lock after first write HOT 4
- With set_toolchains("@cosmocc") : fatal error: string: No such file or directory HOT 4
- Feature Request: use versioned files at https://cosmo.zip/pub/cosmos/zip/
- Bug: cosmo rsync appears to hang on Windows arm64 HOT 5
- Typo in new specification HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cosmopolitan.