Commit Graph

15 Commits (main)

Author SHA1 Message Date
Justine Tunney 0e85b136ae Fix Windows 7 support (#19)
This change pays off technical debt with the function -> DLL mappings in
libc/nt/master.sh, which was originally defined based on binary analysis
on Windows 10. It's now been updated so the kernel32/kernelbase/advapi32
imports should be exactly as they are written, on the MSDN documentation
and that wouldn't have been easy without Geoff Chappell's work thank him

https://www.geoffchappell.com/studies/windows/win32/index.htm
2020-12-28 13:52:02 -08:00
Justine Tunney 95b142e4e5 Make minor improvements 2020-12-23 23:42:56 -08:00
Justine Tunney b562d6fdb3 Make minor improvements 2020-12-19 11:21:04 -08:00
Justine Tunney 1fc91f3580 Fold conv package into fmt
Both packages had nearly identical dependency requirements, so merging
them should help reduce the complexity of the build graph.
2020-12-09 16:52:00 -08:00
Justine Tunney 9df2cef4c4 Enhance chibicc 2020-12-09 04:00:48 -08:00
Justine Tunney 8da931a7f6 Add chibicc
This program popped up on Hacker News recently. It's the only modern
compiler I've ever seen that doesn't have dependencies and is easily
modified. So I added all of the missing GNU extensions I like to use
which means it might be possible soon to build on non-Linux and have
third party not vendor gcc binaries.
2020-12-06 16:20:21 -08:00
Justine Tunney db33973e0a Get fork() working on Windows
This is done without using Microsoft's internal APIs. MAP_PRIVATE
mappings are copied to the subprocess via a pipe, since Microsoft
doesn't want us to have proper COW pages. MAP_SHARED mappings are
remapped without needing to do any copying. Global variables need
copying along with the stack and the whole heap of anonymous mem.
This actually improves the reliability of the redbean http server
although one shouldn't expect 10k+ connections on a home computer
that isn't running software built to serve like Linux or FreeBSD.
2020-11-13 03:14:39 -08:00
Justine Tunney 2d80bbc802 Get binaries closer to running without an o/s
blinkenlights now does a pretty good job emulating what happens when
binaries boot from BIOS into long mode. So it's been much easier to
debug the bare metal process and wrinkle out many issues.
2020-11-02 19:12:47 -08:00
Justine Tunney c45e46f871 Add fixes performance and static web server 2020-10-05 23:11:49 -07:00
Justine Tunney 23d333c090 Make more improvements
This change includes many bug fixes, for the NT polyfills, strings,
memory, boot, and math libraries which were discovered by adding more
tools for recreational programming, such as PC emulation. Lemon has also
been vendored because it works so well at parsing languages.
2020-09-28 01:20:34 -07:00
Justine Tunney 416fd86676 Make improvements
- Emulator can now test the αcτµαlly pδrταblε εxεcµταblε bootloader

- Whipped up a webserver named redbean. It services 150k requests per
  second on a single core. Bundling assets inside zip enables extremely
  fast serving for two reasons. The first is that zip central directory
  lookups go faster than stat() system calls. The second is that both
  zip and gzip content-encoding use DEFLATE, therefore, compressed
  responses can be served via the sendfile() system call which does an
  in-kernel copy directly from the zip executable structure. Also note
  that red bean zip executables can be deployed easily to all platforms,
  since these native executables work on Linux, Mac, BSD, and Windows.

- Address sanitizer now works very well
2020-09-14 00:02:34 -07:00
Justine Tunney 7327c345f9 Get address sanitizer mostly working 2020-09-03 05:44:37 -07:00
Justine Tunney f4f4caab0e Add x86_64-linux-gnu emulator
I wanted a tiny scriptable meltdown proof way to run userspace programs
and visualize how program execution impacts memory. It helps to explain
how things like Actually Portable Executable works. It can show you how
the GCC generated code is going about manipulating matrices and more. I
didn't feel fully comfortable with Qemu and Bochs because I'm not smart
enough to understand them. I wanted something like gVisor but with much
stronger levels of assurances. I wanted a single binary that'll run, on
all major operating systems with an embedded GPL barrier ZIP filesystem
that is tiny enough to transpile to JavaScript and run in browsers too.

https://justine.storage.googleapis.com/emulator625.mp4
2020-08-25 04:43:42 -07:00
Justine Tunney 4918121810 Add new calculator app
Cosmopolitan makes it easy to build and maintain programming languages,
since it abstracts system call #ifdef toil, so you can focus on vision.
Here's an example of a language that isn't turing complete, weighing in
at <1,000 lines of modern C, intended to help with testing libc / libm:

    .1 .2 + .3 - abs epsilon < assert
    pi sqrt pi sqrt * pi - abs epsilon < assert
    -.5 rint dup 0 = assert signbit assert
    -.5 nearbyint dup 0 = assert signbit assert
    -.5 ceil dup 0 = assert signbit assert
    -.5 trunc dup 0 = assert signbit assert
    -.5 round -1 = assert
    -.5 floor -1 = assert
    0 signbit ! assert

CALCULATOR.COM pays homage to CALC.EXE recently removed from Windows 10.
Microsoft should bundle this app instead. It too is roughly 100kb, works
just fine w/ command prompt, and portable since it runs on Mac/Linux/BSD
too while bundling even more features than the calculator on Google.com.

It should be possible to run CALCULATOR.COM on Android and iOS too, just
in case anyone needs a backend pipe driven framework, for graphical user
interfaces of calculators. Sadly we haven't tried it since we don't know
how to run software on telephones so the system call support is a priori
2020-06-30 19:58:08 -07:00
Justine Tunney c91b3c5006 Initial import 2020-06-15 07:18:57 -07:00