Commit graph

174 commits

Author SHA1 Message Date
Justine Tunney
cc56038b05 Fix memzoom on Windows
Right now we can't call poll() on file and fifos on Windows. So we work
around that by simply blocking on keyboard input. This is OK because on
Windows we can't use /proc/*/mem for realtime monitoring, so there's no
reason not to block.

See #65
2021-02-27 15:01:00 -08:00
Justine Tunney
f3baa05195 Define console.log() in hellojs.com example
Fixes #69
2021-02-27 14:15:13 -08:00
Thomas Bernard
1c9065510f redbean.c: remove duplicate png content-types 2021-02-27 13:37:36 -08:00
Justine Tunney
da199b7a45 Further refine printf long double change (#66) 2021-02-27 13:30:17 -08:00
Waldir Pimenta
98fba078a3 Add title to the LICENSE file 2021-02-27 13:25:59 -08:00
Alison Winters
5d334b9ce0 Support %lf and %lF in format string
Per C99 this should resolve to double.
2021-02-27 13:14:09 -08:00
Justine Tunney
35c7edac49 Restore Windows command prompt mode on exit
Fixes #60
2021-02-27 12:53:51 -08:00
Justine Tunney
218ef49147 Fix redbean zip central directory lookup
This regression snuck in at some point. It resulted in the program
sometimes failing to load when the zip content was changed.
2021-02-27 12:08:28 -08:00
Justine Tunney
19d0c15e03 Perform some code cleanup 2021-02-27 10:33:32 -08:00
Justine Tunney
3e17c7b20f Make Reddit users happy 2021-02-26 20:18:10 -08:00
Justine Tunney
fcfe7c1080 Rename LICENSE file 2021-02-26 16:09:33 -08:00
Justine Tunney
91f4167a45 Add root redirect for redbean webserver
We have a webserver demo:

    make -j8 o//tool/net/redbean.com
    o/tool/net/redbean.com -v

It's been a little bit confusing that until now you had to visit the
following URL in order to see the default web page:

    http://127.0.0.1:8080/tool/net/redbean.html

The following URLs will now redirect to the above page, but only if
nothing's been defined for those paths and they would otherwise result
in a 404 response:

    http://127.0.0.1:8080/
    http://127.0.0.1:8080/index.html
2021-02-25 19:14:22 -08:00
Justine Tunney
40291c9db3 Improve signal handling and math
- Polyfill ucontext_t on FreeBSD/OpenBSD/NetBSD
- Add tests confirming signals can edit CPU state
- Work towards supporting ZIP filesystem on bare metal
- Add more tinymath unit tests for POSIX conformance
- Add X87 and SSE status flags to crash report
- Fix some bugs in blinkenlights
- Fix llvm build breakage
2021-02-25 18:33:33 -08:00
Justine Tunney
cdc54ea1fd Use unsigned leb128 for magnums 2021-02-24 04:00:38 -08:00
Justine Tunney
edd9297eba Support malloc() on bare metal
Your Actually Portable Executables now contains a simple virtual memory
that works similarly to the Linux Kernel in the sense that it maps your
physical memory to negative addresses. This is needed to support mmap()
and malloc(). This functionality has zero code size impact. For example
the MODE=tiny LIFE.COM executable is still only 12KB in size.

The APE bootloader code has also been simplified to improve readibility
and further elevate the elegance by which we're able to support so many
platforms thereby enhancing verifiability so that we may engender trust
in this bootloading process.
2021-02-24 00:53:24 -08:00
Justine Tunney
ac3b1dfb21 Parse EFI command line arguments (#12) 2021-02-21 23:33:44 -08:00
Justine Tunney
537c21338b Add UEFI support
This is mutually exclusive with Windows support. Documentation for how
to use it has been written in libc/runtime/efimain.c
2021-02-21 21:33:04 -08:00
Justine Tunney
c6c9b5dfde Further refine hypot implementation
Thanks go to Fabian Giesen on Twitter for code review and advice.
2021-02-21 12:53:01 -08:00
Justine Tunney
4a5698b5c9 Implement better hypot function 2021-02-21 11:06:18 -08:00
Justine Tunney
6c7b8facaa Delete accidental file 2021-02-21 00:58:50 -08:00
Justine Tunney
7a393c06fe Add IP address conversion helpers
Fixes #47
2021-02-20 22:53:22 -08:00
Justine Tunney
e345b42d78 Don't scrub PATH variable since Clang needs it 2021-02-20 12:54:13 -08:00
Justine Tunney
e85aeda4ba Fix some more build issues (#43)
We're now scrubbing environment variables in compile.com since gnu make
was not behaving as expected. It also appears there was a regression in
recent revisions that caused ASAN to be turned off for most binaries in
dbg mode, which has now been fixed. Cosmopolitan is fully ASAN hardened
down to the lowest level libraries and it doesn't need any interceptors
2021-02-20 12:39:39 -08:00
Justine Tunney
3e1fd1d962 Add tool for parsing strace output 2021-02-20 10:45:55 -08:00
Justine Tunney
b740cca642 Improve build system
- Reduce full build latency from ~20s to ~18s
- Bring back silent mode if `make V=0` is passed
- Demodernize utimes() polyfill so it works RHEL5
- Delete some old shell scripts that are no longer needed
- Truncate long lines when outputting builds to Emacs buffers
2021-02-19 23:03:34 -08:00
Justine Tunney
c797f139bb Set LC_ALL=C in build config (#43)
It's most likely the case (and SHOULD be the case) that C is the same
locale as C.UTF-8. The only exception might be Python's gonzo unicode
handling which whines when unicode is used without authorization, but
that shouldn't be an issue since we don't need Python to build.
2021-02-19 17:16:45 -08:00
Justine Tunney
adebc5e4c3 Remove support vector config shortcuts
These were used to build the "How Fat Does a Fat Binary Need to Be?"
blog post, but they're not needed anymore.
2021-02-19 17:16:17 -08:00
Justine Tunney
5f1415af3a Add help dialog to Blinkenlights emulator 2021-02-19 17:16:17 -08:00
Jay Petacat
02b4a5c824 Fix zip file name in "Getting Started" example 2021-02-19 13:39:06 -08:00
Justine Tunney
45b994ea23 Make minor corrections to curl example
This makes the code size smaller and correctly uses the firstnonnull()
API which aborts if both arguments are NULL.
2021-02-18 20:17:07 -08:00
Justine Tunney
2c15efc249 Add curl example (#42)
make -j8 o//examples/curl.com
    o//examples/curl.com http://justine.lol/ape.html
2021-02-18 19:20:41 -08:00
Justine Tunney
667ab245fe Implement setlocale() stub (#43) 2021-02-18 17:06:06 -08:00
Justine Tunney
08d3700c15 Fix getting started example for Z-shell (#44)
Apropos zsh, our patch has now been upstreamed! See:
https://github.com/zsh-users/zsh/commit/326d9c203b39
2021-02-18 16:32:31 -08:00
Justine Tunney
6f35bd47ab Fix JavaScript interpreter example 2021-02-11 23:18:39 -08:00
Justine Tunney
bfa8581537 Trim down executable sizes 2021-02-11 08:37:18 -08:00
Justine Tunney
ec69413f83 Cosmopolitan 0.2 2021-02-09 20:36:07 -08:00
Justine Tunney
e75ffde09e Get codebase completely working with LLVM
You can now build Cosmopolitan with Clang:

    make -j8 MODE=llvm
    o/llvm/examples/hello.com

The assembler and linker code is now friendly to LLVM too.
So it's not needed to configure Clang to use binutils under
the hood. If you love LLVM then you can now use pure LLVM.
2021-02-09 02:57:32 -08:00
Justine Tunney
0e36cb3ac4 Improve dead code elimination 2021-02-08 04:04:42 -08:00
Justine Tunney
760db8c5ad Remove clang dependency from build
We need a better way to conditionally test Clang if it exists.
2021-02-07 07:20:56 -08:00
Justine Tunney
2f3bd90216 Apply some touchups 2021-02-07 07:02:46 -08:00
Justine Tunney
9f149e1de3 Elevate .text.syscall to .privileged
It turns out adding OpenBSD msyscall() origin verification broke the
--ftrace flag. The executable needs to issue raw syscalls while it's
rewriting itself. So they need to be in the same section, and that's
just plain simpler too.
2021-02-06 04:49:22 -08:00
Justine Tunney
d7733579d3 Fix Clang support
The amalgamated release is now confirmed to be working with Clang,
including its integrated assembler.

Fixes #41
2021-02-06 00:29:09 -08:00
Justine Tunney
e06c90fafc Cleanup socket code 2021-02-05 23:58:50 -08:00
Justine Tunney
a91ba89d85 Fix sigsuspend() and sigprocmask() on OpenBSD
Test reliability is now iron clad.
2021-02-05 12:19:43 -08:00
Justine Tunney
b2cd58a322 Get all tests passing on NetBSD 2021-02-05 09:49:28 -08:00
Justine Tunney
23ae9dfceb Add NetBSD support 2021-02-05 06:19:45 -08:00
Justine Tunney
2fdc19e7a7 Write more memory mapping tests
Microsoft claims to support COW but it's probably not true.
2021-02-04 18:24:33 -08:00
Justine Tunney
74d48f7cb6 Definen LLP64 data model for code completion
This change should not be interpreted as an intent to support MSVC which
appears to live on in VSCode IntelliSense for what's dead will never die
2021-02-04 16:56:43 -08:00
Justine Tunney
3384a5a48c Apply touchups to last PR
Compilers like GCC require comments on lines like `#endif rdmsr`. Since
the rdmsr macro was only being used in arch_prctl(), I've localized the
macro, and I'm considering deleting arch_prctl() too, since there isn't
any way to have mem segments unfortunately across operating systems ;_;
The remaining changed lines are due to clang-format which runs on auto.
2021-02-04 16:41:34 -08:00
Justine Tunney
888cfa74d7
Merge pull request #40 from nicholatian/jart
Add VS Code IntelliSense support scaffolding
2021-02-04 15:45:07 -08:00