Add scouts honor escape hatch for source embedding
parent
c91b3c5006
commit
b4269930f7
9
Makefile
9
Makefile
|
@ -40,10 +40,12 @@
|
||||||
# o/dbg/examples/crashreport.com
|
# o/dbg/examples/crashreport.com
|
||||||
# less examples/crashreport.c
|
# less examples/crashreport.c
|
||||||
#
|
#
|
||||||
# # extremely tiny binaries
|
# # extremely tiny binaries (scout's honor escape hatch)
|
||||||
|
# # please pay the $1k for commercial license if you can
|
||||||
# make -j8 -O MODE=tiny \
|
# make -j8 -O MODE=tiny \
|
||||||
# LDFLAGS=-s \
|
# LDFLAGS+=-s \
|
||||||
# CPPFLAGS=-DSUPPORT_VECTOR=0b00000001 \
|
# CPPFLAGS+=-DIM_FEELING_NAUGHTY \
|
||||||
|
# CPPFLAGS+=-DSUPPORT_VECTOR=0b00000001 \
|
||||||
# o/tiny/examples/hello4.elf
|
# o/tiny/examples/hello4.elf
|
||||||
# ls -hal o/tiny/examples/hello4.elf
|
# ls -hal o/tiny/examples/hello4.elf
|
||||||
# o/tiny/examples/hello4.elf
|
# o/tiny/examples/hello4.elf
|
||||||
|
@ -192,6 +194,7 @@ include test/dsp/core/test.mk
|
||||||
include test/dsp/scale/test.mk
|
include test/dsp/scale/test.mk
|
||||||
include test/dsp/tty/test.mk
|
include test/dsp/tty/test.mk
|
||||||
include test/dsp/test.mk
|
include test/dsp/test.mk
|
||||||
|
#-φ-examples/package/new.sh
|
||||||
|
|
||||||
OBJS = $(foreach x,$(PKGS),$($(x)_OBJS))
|
OBJS = $(foreach x,$(PKGS),$($(x)_OBJS))
|
||||||
SRCS = $(foreach x,$(PKGS),$($(x)_SRCS))
|
SRCS = $(foreach x,$(PKGS),$($(x)_SRCS))
|
||||||
|
|
197
README.md
197
README.md
|
@ -24,6 +24,26 @@ without the costs and restrictions cross-platform distribution entails.
|
||||||
That makes Cosmopolitan an excellent fit for writing small CLI programs
|
That makes Cosmopolitan an excellent fit for writing small CLI programs
|
||||||
that do things like heavyweight numerical computations as a subprocess.
|
that do things like heavyweight numerical computations as a subprocess.
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
Just clone the repository and put your own folder in it. Please choose a
|
||||||
|
name that's based on a .com or .org domain name registration you control
|
||||||
|
which is scout's honor but might change to require TXT records in future
|
||||||
|
|
||||||
|
We provide a script that makes it easy to start a new package:
|
||||||
|
|
||||||
|
examples/package/new.sh com/github/user/project
|
||||||
|
emacs com/github/user/project/program.c
|
||||||
|
make o//com/github/user/project/program.c
|
||||||
|
o//com/github/user/project/program.c
|
||||||
|
|
||||||
|
Please note GNU make is awesome. Little known fact: make is a functional
|
||||||
|
programming language. We've improve upon it too see tool/build/package.c
|
||||||
|
which performs strict dependency checking, to correct Google's published
|
||||||
|
mistakes c. 2006 which was when they switched from using a GNU Make repo
|
||||||
|
in favor of an inhouse derivative called Blaze which does strictness too
|
||||||
|
thereby allowing the repository to grow gracefully with any requirements
|
||||||
|
|
||||||
## Licensing
|
## Licensing
|
||||||
|
|
||||||
Cosmopolitan is Free Software licensed under the GPLv2. The build config
|
Cosmopolitan is Free Software licensed under the GPLv2. The build config
|
||||||
|
@ -41,6 +61,24 @@ you want your license to last 5 years, send $10,000 to the author above
|
||||||
who is Justine Tunney <jtunney@gmail.com>. This README will be updated,
|
who is Justine Tunney <jtunney@gmail.com>. This README will be updated,
|
||||||
if pricing and other details should change. Reach out for more details.
|
if pricing and other details should change. Reach out for more details.
|
||||||
|
|
||||||
|
## Integrated Development Environment
|
||||||
|
|
||||||
|
Your Cosmopolitan IDE is based on Emacs. When used alongside `make tags`
|
||||||
|
it can automate certain toilsome problems such as adding an include line
|
||||||
|
by typing `C-c C-h` with the cursor over a symbol. Please install these:
|
||||||
|
|
||||||
|
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
|
||||||
|
sudo apt install gdb ragel ctags clang-format-10 # <-recommended
|
||||||
|
git clone git@github.com:jart/cosmopolitan.git && cd cosmopolitan
|
||||||
|
tool/scripts/install-emacs.sh # recommended over apt
|
||||||
|
tool/scripts/configure-emacs.sh # adds load statements
|
||||||
|
make tags # index all the symbol
|
||||||
|
emacs # for power and glory!
|
||||||
|
|
||||||
|
See [tool/emacs/cosmo-stuff.el] for further details. Noting what enables
|
||||||
|
the to work so well and fast is our break with tradition by using rooted
|
||||||
|
quoted include statements while vendoring the transitive closure of deps
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
We'd love to accept your patches! Before we can take them, we have to
|
We'd love to accept your patches! Before we can take them, we have to
|
||||||
|
@ -49,3 +87,162 @@ jump through one legal hurdle. Please write an email to Justine Tunney
|
||||||
any changes you contribute to Cosmopolitan. We need to do that in order
|
any changes you contribute to Cosmopolitan. We need to do that in order
|
||||||
to dual license Cosmopolitan. Otherwise we can't tax corporations that
|
to dual license Cosmopolitan. Otherwise we can't tax corporations that
|
||||||
don't want to share their code with the community.
|
don't want to share their code with the community.
|
||||||
|
|
||||||
|
## Volunteering
|
||||||
|
|
||||||
|
We also need volunteers who can help us further stabilize System Five's
|
||||||
|
application binary interface. See our ABI scripts [libc/sysv/consts.sh]
|
||||||
|
and [libc/sysv/syscalls.sh]. Magic numbers are usually stabler than API
|
||||||
|
interfaces cf. NPM but we should ideally have fewer of them, similar to
|
||||||
|
how SI has sought to have fewer defining physics constants.
|
||||||
|
|
||||||
|
## Specimen
|
||||||
|
|
||||||
|
Cosmopolitan encodes binaries respecting the intersection of reasonable
|
||||||
|
platform requirements. That's easy to accomplish w/ binary isomorphisms
|
||||||
|
evidenced below by the RADIX256 disassembly below for [examples/life.c]
|
||||||
|
which ld is configured to overlay pe/elf/macho/bourne/bootloader in 12k
|
||||||
|
|
||||||
|
Please send feedback and concerns to <jtunney@gmail.com> since we would
|
||||||
|
love to do an even better job. Please also report GPL abuse the address
|
||||||
|
above as well. We believe this binary structure is novel, and therefore
|
||||||
|
easily recognizable. So if some goofball isn't bundling the source code
|
||||||
|
please let us know so we can reach out and ask they consider a license.
|
||||||
|
|
||||||
|
make -j10 -O MODE=tiny CPPFLAGS=-DIM_FEELING_NAUGHTY
|
||||||
|
o/tiny/tool/viz/bing.com <o/tiny/examples/life.com |
|
||||||
|
o/tiny/tool/viz/fold.com
|
||||||
|
|
||||||
|
MZqFpD=‘◙ ► ° ☺ ◘@ JT p♂
|
||||||
|
▓@δ δ◄ÉÉδ♥R1╥╜ δ♣Θ⌐☼ ⁿ┐ p1╔·Ä╫ë╠√♫XΦ ^üεh ▒♦╤εâΘ☺u∙╣ ☻┐ ♦Ä▐Ä╟
|
||||||
|
1÷1λ≤ñΩï@ ╣ ■≤ñ1φÄ▌Φ Uëσ╣ 0╕ ☺Ä└1└1λ≤¬Ç·@t#Φ. ╕ ♦Ä└┐↑ 0÷1╔ë°Φ]
|
||||||
|
î╞â╞ Ot•Hu≈Ä╞δ∞ë♫@2ë▬B2Ω3E ◙SR┤◘═‼r,ê╧Çτ⁇Çß└╨┴╨┴å═▲♠▼1÷Ä╞╛ 2ç≈
|
||||||
|
ÑÑÑÑÑñ▼ô½æ½Æ½X¬Æ[├ZÇ≥Ç1└═‼r≈δ┴S1█è▲♀29├w☻ë╪QP╗ ►î└)├üπλ☼╣♣ ╤δâΘ☺
|
||||||
|
u∙XYà█t♠9├w☻ë╪PQå═╨╔╨╔Ç╔☺1█┤☻═‼Y[r‼┤ 9├|♪A;♫♪2~♦1╔■╞[├P1└═‼Xδ╨
|
||||||
|
|
||||||
|
U¬
|
||||||
|
‘◙#‘“◙o=“$(command -v “$0“)“◙set -- “$o“ “$@“◙if [ -d /Applicati
|
||||||
|
ons ]; then◙dd if=“$o“ of=“$o“ bs=8 skip=“ 410“ count=“
|
||||||
|
87“ conv=notrunc 2>/dev/null◙elif exec 7<> “$o“; then◙printf ‘╲
|
||||||
|
177ELF╲2╲1╲1╲011╲0╲0╲0╲0╲0╲0╲0╲0╲2╲0╲076╲0╲1╲0╲0╲0╲134╲022╲100╲0
|
||||||
|
00╲000╲000╲000╲000╲150╲012╲000╲000╲000╲000╲000╲000╲000╲000╲000╲0
|
||||||
|
00╲000╲000╲000╲000╲0╲0╲0╲0╲100╲0╲070╲0╲004╲000╲0╲0╲000╲000╲000╲0
|
||||||
|
00‘ >&7◙exec 7<&-◙fi◙exec “$@“◙R=$⁇◙if [ $R -eq 126 ] && [ “$(un
|
||||||
|
ame -m)“ != x86_64 ]; then◙if Q=“$(command -v qemu-x86_64)“; the
|
||||||
|
n◙exec “$Q“ “$@“◙else◙echo error: need qemu-x86_64 >&2◙fi◙fi◙exi
|
||||||
|
t $R◙αcτμαlly pδrταblε εxεcμταblε♪◙ error: ♪◙ cpuid oldskool ds
|
||||||
|
knfo e820 nomem nolong hello◙ ♀ Cf☼▼D 8 ╕D f☼▼D
|
||||||
|
λλ Ü☼ λλ Æ☼ λλ Ü╧ λλ Æ╧ λλ ¢» λλ ô» ☻░¡← ☺ ■OQΣ≡♦
|
||||||
|
► 0► @► ►♣ =☻░¡+☼à↑♪ j ¥▓@☼ └âα■☼“└fΩW@ ÉÉÉÉUëσΦ§♪Φ↓ ┐• î
|
||||||
|
♠▬2ú↑2Φ(☺┐EDΦÑ Φ╨♀Φ→☻Uëσ╣♦ ╛ 0¼ê┬¼ê╞à╥t♀QVë╫╛€DΦ○ ^YâΘ☺uσ]├Uëσë·
|
||||||
|
à╥t↑RV1╔▒♥☺╩¼^♀ÇεZ¼εâ┬☺âΘ☺y÷]├UëσΦ↕ Φ Uëσ┐ 0╛♦ ΦÇ ΦÉ☺Uëσï╖☻0à÷u
|
||||||
|
♦ï6 01└PV╕lDPVWV╕dDP_àλt♠^Φ♦ δ⌡]├UëσWVΦ♂ ^_à÷t♥Φ↨ ]├Uëσë■─>▬2Φ╕
|
||||||
|
î♠▬2ú↑2]├UëσSë√ç▐¼ç▐ä└t↑ë╟VP╕ δ◘XΦ. δ♦XΦ( ^δ▀[]├ë±ë■1╥¼ê┬¼ê╞à
|
||||||
|
└t◄â┬♣┤@∞ α≤Ét∙âΘ☺uσ├PQRë≥â┬♣┤ ∞ αu♦≤Éδ≈ë°ë≥εZYX├UëσS┤╕░ Ä└ë°<♥t
|
||||||
|
☻0φ1λj X═►┤☺░ ╡ ▒ ═►┤►░♥╖ │ ═►1└[]├Uëσâ∞►ûë∙ëμëτ¬ë╧j☺Zδ♫V¼ä└u√ë≥
|
||||||
|
^)≥UëσSë╤ë·ÇΓ ÇμÇÇ┬áÇ╓☼╖ │á9·t)w↕¼<◙t↕<♪t↕¬░•¬âΘ☺uΦë°[]├☺▀δ≥ë°R1
|
||||||
|
╥≈√)╫ZδμPQRVë▐P╕ δ◘XΦ♫ δ♦XΦ◘ ë╟^ZYXδ╞≈╥ë∙Çß ÇσÇç╧)±Q)∙ë■☺╬╕
|
||||||
|
▲•≤ñX├Uëσ╕ S1█═§r→ü√MPu¶╕☺S1█═§1█1╔╕•S│☺▒♥═§Φ╢◙UëσΦ↔ Φy☺┐ ►╛ Φz
|
||||||
|
r○Φ╟ Φ∞ Φ‘☻╕àDΦ♀■Uëσ£X% puMf£fXfë┴f╗ f1╪fPf¥f£fXf9┴t:f!╪fPf¥
|
||||||
|
f┐ Çfë°fG☼óf9°|∟fë°☼óf┐ f!·f9·u○1└]├╕uDδ◙╕ÉDδ♣╕oDδ Φú²Uëσfh
|
||||||
|
PAMSS┴∩♦Ä╟f1λf1█f╕ Φ f╣↑ fïVⁿ═§r&f;Fⁿu à╔t♫â∙§r♠÷E¶☺u♥â╟↑fà█t
|
||||||
|
♦9≈r╦ë°[╔├∙δ·Uëσ·☼☺▬¿D☼ └♀☺☼“└δ ╣ Äß$■☼“└fΩrH √]├UëσSf╛ @ f
|
||||||
|
╗ ► f╣↑ f┴ß○fâ╩ⁿfâ┬♦f9╤t♫dgfï♦▬dgfë♦‼δΘgfì∟‼┐ ╕ @Ä└ï♫@2ï▬B2à
|
||||||
|
λt+ë°S1█ΦS°[)╟Që┴┴ß○1÷&fï♦dgfë♥fâ├♦â╞♦âΘ♦uδYδ╤[]├·▲1└Ä└HÄ╪┐ ♣╛►♣
|
||||||
|
&è♣Pè♦P&╞♣ ╞♦λ&Ç=λXê♦X&ê♣▼u@╕☺ Φ, ░¡μdΦ% ░╨μdΦ% Σ`PΦ↑ ░╤μdΦ◄ X♀☻
|
||||||
|
μ`Φ○ ░«μdΦ☻ δúΣd¿☻u·├Σd¿☺t·├√├Uëσ▲╕ lÄ╪f╟♠ 0♥α♠ f╟♠ ♥╨♠ f╟♠ ►♥└
|
||||||
|
♠ ╣ ☺f╕♥ 1÷fë♦f♣ ► â╞◘âΘ☺u∩▼f╟♠ 2 └♠ f╕ ≡♠ ☼“╪]├·☼☺▲02Φóλ☼ αf
|
||||||
|
♪á☻ ☼“αf╣Ç └☼2f♪☺☺ ☼0☼☺▬¿D☼ └f♪♥ Çfâα√☼“└Ω≥I( ╕0 Ä╪ÄαÄΦ1╥δ
|
||||||
|
HâΣ≡1φ1λΦ]• ┐ ► Φ{• ┐ ► ╛ ≡♠ ║ 2 Φ≡♣ ┐ùD ï4% 0 Φ╠√λλ┐ 0
|
||||||
|
╛♦ Φτ√λλΘΓ• Hì§█• Φλ• Θ╤• É☼▼D ☺ ♣ @
|
||||||
|
► ► ☺ ♠ @ ►
|
||||||
|
► ► Qσtd♠
|
||||||
|
► ♦ ♦ P♂ P♂@ P♂► ↑ ↑
|
||||||
|
◘ É☼▼Ç ◘ ♦ ☺ OpenBSD É☼▼Ç PE då☻ k↕d╲
|
||||||
|
≡ #☻♂☻♫☼ ╞¶ @ ► ► ♠ ♠
|
||||||
|
@ ► ♥ ☺ ► ♥ ◘ ► ►
|
||||||
|
ä← (
|
||||||
|
► @ .text
|
||||||
|
► ► ► ► ` p.data ►
|
||||||
|
└ └É☼▼Ç ╧·φ■• ☺♥ ☻ ♣ ÿ☻ ☺ ↓ H __PAGEZE
|
||||||
|
RO ↓ ÿ
|
||||||
|
__TEXT @ • ♣ ☺
|
||||||
|
__text __TEXT ►@ ► ► ♀
|
||||||
|
♦ ↓ Φ __DATA @
|
||||||
|
► • ♥ ☻ __data __DATA @
|
||||||
|
► ♀ __bss __DATA
|
||||||
|
0@ ► ♀ ☺ ← ↑
|
||||||
|
B)→☺&¿◘ºB)→☺&¿◘º♣ ╕ ♦ * @
|
||||||
|
|
||||||
|
S↕@
|
||||||
|
Éf.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä
|
||||||
|
f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f☼▼ä
|
||||||
|
ZAR╕ Hà└t◙Hà└t♣Θ»♦ Θ@☻ UHë╤HëσAWIë≈AVA╛ @ AUIë²ATA╝ ► SHë
|
||||||
|
√Hâ∞↑Hâ{◘ ☼ä╕ ïS►Hë╪Hâ├↑λ╩t○Hâ{◘ uδδ♥Hë├L9#L☼C#Iü─λ☼ IüΣ ≡λλH
|
||||||
|
ïC◘H♥♥H% ≡λλI9─snIïU◘Hà╥t↓Aâ}►☺u♠Iâ┼↑δΩIïE H☺╨L9αrεIïE L9αw◄H☺╨L
|
||||||
|
9αv○Lìáλ☼ δ½Lë·Lë≈╛♥ HëM╚Φ6 LëΓHïM╚Iü╞ ► Hâ╩♥Iü─ ► Hë►δÇH
|
||||||
|
â├↑Θ=λλλHâ─↑[A╲A]A^A_]├I╣ ≡λλλλ♥ Ië╚╣‘ Hë°λ╬H╙Φ%λ☺ â■λu♣Hì♦┬├
|
||||||
|
Hì¶┬Hâ: u‼Iï H- ► Ië Hâ╚♥Hë☻Hï☻âΘ○L!╚Hë┬δ╛U╣ 2 ║ ≡♠ ╛♥ HëσSH
|
||||||
|
ë√PΦÅλλλHâ ■☼☺;Z[]├1÷ë≡Hk└↑Hâ|•◘ t♦λ╞δεA╕☺ HìW↑A9≡r☺├UHëσATSLï
|
||||||
|
◙HïZ◘Hë╤Dë└DïZ►DïR¶Aë─λ╚L;IΦt→☼►AΦLïa°HâΘ↑☼◄A↑Lëa(à└u▌δ♥DëαHk└↑A
|
||||||
|
λ└Hâ┬↑H☺°Lë◘HëX◘DëX►DëP¶A9≡rí[A╲]├1└├UëσSç█[fÉ╠·⌠δ²Uëσâ∞◘U^ì~°j◘
|
||||||
|
Y1└≤¬·☼☺^°☼♂δ≈Uëσ]├╞♣ª↔ ◘δ►HàλH☼Eτt•╞♣ö↔ Lc$$Lìl$◘NìtΣ↑╕“↕@ ┐
|
||||||
|
► @ ╣P @ H)∙┴Θ♥≤H½1└â╔λLë≈≥H»IëλΘ╧ UHëσ┐ 0@ ╛°←@ ╣00@ HìA►Hë☺╟
|
||||||
|
A◘ ♥ SV÷•◘u<÷• u!÷•♦u◄Iâ⁇ t!j j☺╛ⁿ←@ δ*j“j♦╛☻∟@ δ▼j0j ╛∙←@ δ¶j*
|
||||||
|
j►╛λ←@ δ○jEj◘╛♦∟@ ╣q↓@ XH½XH☺╚H½W┐↑0@ Iâ╔λ╗(0@ H9▀s51╔1╥¼Ië└Aâα⌂
|
||||||
|
I╙αâ┴•L○┬ä└xδ¿@t○Lë╚H╙αH○┬Hë╨Hâ⁇ H☼E•H½δ╞_^[╔├╕* ├HâΣ≡1φ╗ @ Φ
|
||||||
|
!λλλâ♪┴▼ ☺╕◘ @ ╣◘ @ H9┴t♀PQλ►YXHâ└◘δ∩ÉLëτLëεLë≥Φ╣λλλë╟Φ UHëσ
|
||||||
|
ATAëⁿ1λPΦr DëτΦö♠ 1÷1╥UHëσAW╣00@ Ië╧Iï•IïO◘Hà╔t∟HâΘ↑Hë¶◘Hët◘◘
|
||||||
|
Hë|◘►IëO◘1└A_]├╣ Hà╔t≥PWVj!_j►^λ╤^_YHà└t▀I╟└ ♥ Ië•Jë♀ Lë┴δ┤U
|
||||||
|
HëσAVAUATHï5α← Ië■Ië⌠j YH¡HÆH¡HùH¡Hà└t↑Mà÷δ♣L9≥u♫VQQλ╨YY^1└HëF°
|
||||||
|
âΘ☺u╘H¡Hà└t◄Mà÷t○PLëτΦfδ┐λ^δ╢A╲Mà÷u←╕► @ ╣► @ HâΦ◘H9╚|◘PQλ►YXδ∩A
|
||||||
|
]A^]├╠U╣ ◘ 1└HëσAWAVAUATSHü∞Hα Hëà└▼λλHëà╚▼λλλ§C♂ Hâ─ à└uGHâ∞
|
||||||
|
H╟┴⌠λλλ맓♂ Hâ─↑A╕♠ Lìì╨⌂λλj Hë┴║⌐→@ Hâ∞ λ§♪♂ XZ╣☺ λ§╨◙
|
||||||
|
Hâ─ Hâ∞ j♦Xë♣»→ λ§╔◙ Ië─λ§╚◙ LëτHâ─ A╕ ☻ Hìì╨/λλ║λ⁇ Hì╡╤⁇λλ
|
||||||
|
Ië┼Φ╙☺ Aë─1└Hïì╨/λλH☺┴è◄ä╥t♪Ç·╲u♥╞☺/Hλ└δπA☼╖E f=λ╫w♪ëà╝▼λλ╕☺
|
||||||
|
δ☼Hì╡╝▼λλLë∩Φ0♦ ë└Hìì╨⌂λλE1└1█H☺└Ië╦LìU╬A╛²⌂ IìT♣ Hì╡╝▼λλâ╜╝▼λ
|
||||||
|
λ ☼äÅ Iλ└Iü°λ☺ w↕L9╤Hë╪H☼B┴Jëä┼╚▼λλDïì╝▼λλIc┴Aâ∙⌂v◘Dë╧ΦÉ♥ L9
|
||||||
|
╤s♀Hλ┴êAλH┴Φ◘u∩☼╖☻f=λ╫w♪ëà╝▼λλ╕☺ δ◘Hë╫Φö♥ ë└H☺└H☺┬Eà╔u¼Hë╚L)╪
|
||||||
|
H=²⌂ I☼G╞╞ä♣╨⌂λλ ΘdλλλL9╤s♠╞☺ Hλ┴L)┘╕■⌂ Lì╡╨▼λλHü∙■⌂ Lì╜└▼λλH
|
||||||
|
☼G╚Iü°λ☺ ╕λ☺ L☼G└Hâ∞ ╞ä♪╨⌂λλ LëΘLì¡╨/λλJ╟ä┼╨▼λλ λ§↔○ Θtⁿλλ
|
||||||
|
Hë·Hï⁇☼╖•f=λ╫w◙ëB↑╕☺ δ○Hìr↑Φ▀☻ ë└H☺└H☺☻├Hë·Hc╞ë≈LïB►â■⌂v♣Φì☻
|
||||||
|
HïJ◘I9╚v►Hìq☺Hër◘ê☺H┴Φ◘uτ├UHì♦▬Ië╙Më┬HëσAWI┐ & ☺ AVAUIë⌡ATS1
|
||||||
|
█Hâ∞8Hë}░Hì}░HëM¿Hëu╕HëE└Φbλλλâ}╚ t↔ïE╚à└t▬â° w╲I☼ú╟sVHì}░ΦAλλλδ
|
||||||
|
π1÷Hì}░Φ_λλλMà█t↨HïE╕Iλ╦L)ΦL9╪I☼G├A╞D♣ Mà╥☼äf☺ Iλ╩HïE¿I9┌L☼G╙J
|
||||||
|
╟♦╨ ΘK☺ Hλ├L9╙s§HïE╕H;E└r☻1└HïU¿HëD┌°E1÷ïu╚à÷☼ä►☺ Eä÷u¶â■ w
|
||||||
|
☼I☼ú≈☼âσ Θ≈ â■“t○â■╲☼à╥ E1Σâ}╚╲u♫Hì}░Iλ─Φì■λλδ∞E1╔â}╚“u♫Hì
|
||||||
|
}░Φy■λλIλ┴δ∞LëαMà╔u↓Iλ╠IâⁿλtÅ╛╲ Hì}░ΦÇ■λλδτHâ°☺v∟╛╲ Hì}░HëEá
|
||||||
|
Φf■λλHïEáHâΦ☻δ▐AÇΣ☺t↨╛“ Hì}░ΦH■λλIλ╔☼ä@λλλAÇ■☺A╛♥ Iâ┘ Mìa☺M9
|
||||||
|
⌠r¶╛“ Hì}░Iâ╞♥Φ▬■λλδτ1╥╣♥ Lë╚H≈±Hà╥A☼ö╞Θⁿ■λλHì}░Φ≥²λλHì}░Φ╛²
|
||||||
|
λλΘσ■λλ1÷Hì}░Φ┘²λλΘG■λλHâ─8ë╪[A╲A]A^A_]├╠Hì♣╪↓ ├☼┐└à└x←Ië╩☼♣H=☺
|
||||||
|
≡λλs☺├≈╪ë♣║↓ jλX∙├ï♣⌂▬ δφH┴Φ0δ•H┴Φ ☼╖└f=λ☼sσIë╩☼♣r╙├Aë├┴Φ►%λ☼
|
||||||
|
A┴δ∟A┴π↑D○╪δ┌QRëλ1└âλ⌂v“☼╜╧║┐→@ ïLJ≥ë·┴∩♠ÇΓ⁇♀Ç◘╨H┴α◘■╔u∞◘ΦH○°ZY
|
||||||
|
├U1└HëσWVSQRë┬ë├λ└☼╖¶Wë╤füß ⁿfü∙ ▄tΦfü∙ ╪t♦ë▬δ,☼╖♦Gë┴füß ⁿfü∙ ▄t
|
||||||
|
♂╟♠²λ â╚λδ☼┴Γ◙ìä☻ $áⁿë♠ìC☻ZY[^_]├f☼▼D Éâ♪▄↑ ♦÷♣ë§ ♦t♪@☼╢╧λ§ì
|
||||||
|
♣ δ°╠ï♣ö§ ☼♣·☼☺∟%Ü→@ ⌠δ² f☼▼D Énodll◙ KernelBase.dll ☺
|
||||||
|
└☺└☺└☺└☻α☻α☻α☻α☻α♥≡♥≡♥≡♥≡♥≡♦°♦°♦°♦°♦°♣ⁿ♣ⁿ♣ⁿ♣ⁿ♣ⁿ♣ⁿÉÉ☼▼D ⁇♣ExitPr
|
||||||
|
ocess æ☺FreeEnvironmentStringsW ╜☺GetCommandLineW ‼☻GetEnvironme
|
||||||
|
ntStringsW ╘☻GetStdHandle ╫♣SetDefaultDllDirectories ▼•WriteF
|
||||||
|
ile ░← ░→ ► ☼▼@ °→ ♠←
|
||||||
|
← 2← L← ╲← x← É☼▼Ç É╬ ☺&τ☺╬
|
||||||
|
☺☺⌂╬ üÇÇ►f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼
|
||||||
|
ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä
|
||||||
|
f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.
|
||||||
|
☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä
|
||||||
|
f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä
|
||||||
|
f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼
|
||||||
|
ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä
|
||||||
|
f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.
|
||||||
|
☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä
|
||||||
|
f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä
|
||||||
|
f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼
|
||||||
|
ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä
|
||||||
|
f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.
|
||||||
|
☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä
|
||||||
|
f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä
|
||||||
|
f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä f.☼▼ä ☼▼@
|
||||||
|
@ °→ ♠← ← 2← L← ╲←
|
||||||
|
x←
|
||||||
|
|
||||||
|
See also `build/dump -xd o/tiny/examples/life.com.dbg | less` assembly
|
||||||
|
and our linker script [ape/ape.lds] which glues the binaries together.
|
||||||
|
|
10
ape/ape.S
10
ape/ape.S
|
@ -45,11 +45,10 @@
|
||||||
#include "libc/nexgen32e/vidya.h"
|
#include "libc/nexgen32e/vidya.h"
|
||||||
#include "libc/nt/pedef.h"
|
#include "libc/nt/pedef.h"
|
||||||
#include "libc/sysv/consts/prot.h"
|
#include "libc/sysv/consts/prot.h"
|
||||||
.yoink __FILE__
|
|
||||||
.yoink "NOTICE"
|
|
||||||
.section .head,"ax",@progbits
|
|
||||||
|
|
||||||
/ Common Sections.
|
.source "NOTICE"
|
||||||
|
.source "ape/ape.S"
|
||||||
|
.source "ape/ape.lds"
|
||||||
.section .text,"ax",@progbits
|
.section .text,"ax",@progbits
|
||||||
.align __SIZEOF_POINTER__
|
.align __SIZEOF_POINTER__
|
||||||
.previous
|
.previous
|
||||||
|
@ -69,6 +68,7 @@ cstr: .endobj cstr,globl,hidden # ←for gdb readibility
|
||||||
.section .sort.rodata.real.str1.1,"aMS",@progbits
|
.section .sort.rodata.real.str1.1,"aMS",@progbits
|
||||||
rlstr: .endobj rlstr,globl,hidden # ←for gdb readibility
|
rlstr: .endobj rlstr,globl,hidden # ←for gdb readibility
|
||||||
.previous
|
.previous
|
||||||
|
.section .head,"ax",@progbits
|
||||||
|
|
||||||
/* ████████ ████████ ███████████
|
/* ████████ ████████ ███████████
|
||||||
██░░░░▒▒██ ██░░░░▒▒██ ████░░░░░░░░░▒▒████
|
██░░░░▒▒██ ██░░░░▒▒██ ████░░░░░░░░░▒▒████
|
||||||
|
@ -1932,4 +1932,4 @@ __data_start:
|
||||||
.hidden __piro_start
|
.hidden __piro_start
|
||||||
|
|
||||||
.end
|
.end
|
||||||
|
|
||||||
|
|
130
ape/ape.lds
130
ape/ape.lds
|
@ -105,7 +105,7 @@
|
||||||
strip input.com.dbg # remove all symbols
|
strip input.com.dbg # remove all symbols
|
||||||
strip -S input.com.dbg # remove debug info only
|
strip -S input.com.dbg # remove debug info only
|
||||||
make CPPFLAGS=-DNDEBUG # remove asserts (prod)
|
make CPPFLAGS=-DNDEBUG # remove asserts (prod)
|
||||||
make CPPFLAGS=-DIM_FEELING_NAUGHTY # remove legal notices
|
make CPPFLAGS=-DIM_FEELING_NAUGHTY # remove legal embeddings
|
||||||
|
|
||||||
The Makefile build is also configured to always produce a .map file
|
The Makefile build is also configured to always produce a .map file
|
||||||
when building each program, which provides further details.
|
when building each program, which provides further details.
|
||||||
|
@ -333,9 +333,11 @@ SECTIONS {
|
||||||
/*BEGIN: Read only data that needn't be mapped after initialization */
|
/*BEGIN: Read only data that needn't be mapped after initialization */
|
||||||
|
|
||||||
/* Legal Notices */
|
/* Legal Notices */
|
||||||
|
#ifndef IM_FEELING_NAUGHTY
|
||||||
KEEP(*(.commentprologue))
|
KEEP(*(.commentprologue))
|
||||||
KEEP(*(.comment))
|
KEEP(*(.comment))
|
||||||
KEEP(*(.commentepilogue))
|
KEEP(*(.commentepilogue))
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Windows DLL Import Directory */
|
/* Windows DLL Import Directory */
|
||||||
KEEP(*(.idata.ro));
|
KEEP(*(.idata.ro));
|
||||||
|
@ -563,7 +565,7 @@ ZIPCONST(v_zip_commentsize, _edata - __zip_end - kZipCdirHdrMinSize);
|
||||||
X = (X + (Y >> 010) & 0xFF) * PHI; \
|
X = (X + (Y >> 010) & 0xFF) * PHI; \
|
||||||
X = (X + (Y >> 020) & 0xFF) * PHI; \
|
X = (X + (Y >> 020) & 0xFF) * PHI; \
|
||||||
X = (X + (Y >> 030) & 0xFF) * PHI
|
X = (X + (Y >> 030) & 0xFF) * PHI
|
||||||
#define BOOP(X) \
|
#define CHURN(X) \
|
||||||
XORSHIFT(uuid1_, X); \
|
XORSHIFT(uuid1_, X); \
|
||||||
KMH(uuid1_, X); \
|
KMH(uuid1_, X); \
|
||||||
XORSHIFT(uuid2_, X); \
|
XORSHIFT(uuid2_, X); \
|
||||||
|
@ -572,68 +574,68 @@ ZIPCONST(v_zip_commentsize, _edata - __zip_end - kZipCdirHdrMinSize);
|
||||||
HIDDEN(uuid1_ = 88172645463325252);
|
HIDDEN(uuid1_ = 88172645463325252);
|
||||||
HIDDEN(uuid2_ = 88172645463325252);
|
HIDDEN(uuid2_ = 88172645463325252);
|
||||||
|
|
||||||
BOOP(.Lape.bss.align);
|
CHURN(.Lape.bss.align);
|
||||||
BOOP(.Lape.bss.filesz);
|
CHURN(.Lape.bss.filesz);
|
||||||
BOOP(.Lape.bss.memsz);
|
CHURN(.Lape.bss.memsz);
|
||||||
BOOP(.Lape.bss.offset);
|
CHURN(.Lape.bss.offset);
|
||||||
BOOP(.Lape.bss.paddr);
|
CHURN(.Lape.bss.paddr);
|
||||||
BOOP(.Lape.data.align);
|
CHURN(.Lape.data.align);
|
||||||
BOOP(.Lape.data.filesz);
|
CHURN(.Lape.data.filesz);
|
||||||
BOOP(.Lape.data.memsz);
|
CHURN(.Lape.data.memsz);
|
||||||
BOOP(.Lape.data.offset);
|
CHURN(.Lape.data.offset);
|
||||||
BOOP(.Lape.data.paddr);
|
CHURN(.Lape.data.paddr);
|
||||||
BOOP(.Lape.data.rva);
|
CHURN(.Lape.data.rva);
|
||||||
BOOP(.Lape.data.vaddr);
|
CHURN(.Lape.data.vaddr);
|
||||||
BOOP(.Lape.elf.entry);
|
CHURN(.Lape.elf.entry);
|
||||||
BOOP(.Lape.elf.phnum);
|
CHURN(.Lape.elf.phnum);
|
||||||
BOOP(.Lape.elf.phoff);
|
CHURN(.Lape.elf.phoff);
|
||||||
BOOP(.Lape.elf.shnum);
|
CHURN(.Lape.elf.shnum);
|
||||||
BOOP(.Lape.elf.shoff);
|
CHURN(.Lape.elf.shoff);
|
||||||
BOOP(.Lape.elf.shstrndx);
|
CHURN(.Lape.elf.shstrndx);
|
||||||
BOOP(.Lape.macho.end);
|
CHURN(.Lape.macho.end);
|
||||||
BOOP(.Lape.note);
|
CHURN(.Lape.note);
|
||||||
BOOP(.Lape.note.align);
|
CHURN(.Lape.note.align);
|
||||||
BOOP(.Lape.note.end);
|
CHURN(.Lape.note.end);
|
||||||
BOOP(.Lape.note.filesz);
|
CHURN(.Lape.note.filesz);
|
||||||
BOOP(.Lape.note.memsz);
|
CHURN(.Lape.note.memsz);
|
||||||
BOOP(.Lape.note.offset);
|
CHURN(.Lape.note.offset);
|
||||||
BOOP(.Lape.note.paddr);
|
CHURN(.Lape.note.paddr);
|
||||||
BOOP(.Lape.note.vaddr);
|
CHURN(.Lape.note.vaddr);
|
||||||
BOOP(.Lape.pe.offset);
|
CHURN(.Lape.pe.offset);
|
||||||
BOOP(.Lape.pe.optsz);
|
CHURN(.Lape.pe.optsz);
|
||||||
BOOP(.Lape.pe.sections);
|
CHURN(.Lape.pe.sections);
|
||||||
BOOP(.Lape.pe.sections_end);
|
CHURN(.Lape.pe.sections_end);
|
||||||
BOOP(.Lape.pe.shnum);
|
CHURN(.Lape.pe.shnum);
|
||||||
BOOP(.Lape.phdrs.end);
|
CHURN(.Lape.phdrs.end);
|
||||||
BOOP(.Lape.ram.align);
|
CHURN(.Lape.ram.align);
|
||||||
BOOP(.Lape.ram.filesz);
|
CHURN(.Lape.ram.filesz);
|
||||||
BOOP(.Lape.ram.memsz);
|
CHURN(.Lape.ram.memsz);
|
||||||
BOOP(.Lape.ram.offset);
|
CHURN(.Lape.ram.offset);
|
||||||
BOOP(.Lape.ram.paddr);
|
CHURN(.Lape.ram.paddr);
|
||||||
BOOP(.Lape.ram.rva);
|
CHURN(.Lape.ram.rva);
|
||||||
BOOP(.Lape.ram.vaddr);
|
CHURN(.Lape.ram.vaddr);
|
||||||
BOOP(.Lape.rom.align);
|
CHURN(.Lape.rom.align);
|
||||||
BOOP(.Lape.rom.filesz);
|
CHURN(.Lape.rom.filesz);
|
||||||
BOOP(.Lape.rom.memsz);
|
CHURN(.Lape.rom.memsz);
|
||||||
BOOP(.Lape.rom.offset);
|
CHURN(.Lape.rom.offset);
|
||||||
BOOP(.Lape.rom.paddr);
|
CHURN(.Lape.rom.paddr);
|
||||||
BOOP(.Lape.rom.rva);
|
CHURN(.Lape.rom.rva);
|
||||||
BOOP(.Lape.rom.vaddr);
|
CHURN(.Lape.rom.vaddr);
|
||||||
BOOP(.Lape.text.align);
|
CHURN(.Lape.text.align);
|
||||||
BOOP(.Lape.text.filesz);
|
CHURN(.Lape.text.filesz);
|
||||||
BOOP(.Lape.text.memsz);
|
CHURN(.Lape.text.memsz);
|
||||||
BOOP(.Lape.text.offset);
|
CHURN(.Lape.text.offset);
|
||||||
BOOP(.Lape.text.paddr);
|
CHURN(.Lape.text.paddr);
|
||||||
BOOP(.Lape.text.rva);
|
CHURN(.Lape.text.rva);
|
||||||
BOOP(.Lape.text.vaddr);
|
CHURN(.Lape.text.vaddr);
|
||||||
BOOP(ADDR(.bss));
|
CHURN(ADDR(.bss));
|
||||||
BOOP(WinMain);
|
CHURN(WinMain);
|
||||||
BOOP(_start);
|
CHURN(_start);
|
||||||
BOOP(ape.macho);
|
CHURN(ape.macho);
|
||||||
BOOP(ape.mz);
|
CHURN(ape.mz);
|
||||||
BOOP(ape.pe);
|
CHURN(ape.pe);
|
||||||
BOOP(ape.phdrs);
|
CHURN(ape.phdrs);
|
||||||
BOOP(v_ape_realsectors);
|
CHURN(v_ape_realsectors);
|
||||||
|
|
||||||
ASSERT(ape.mz == IMAGE_BASE_VIRTUAL, "linker panic");
|
ASSERT(ape.mz == IMAGE_BASE_VIRTUAL, "linker panic");
|
||||||
ASSERT((DEFINED(__init_bss_end) ? __init_bss_end : 0) % __SIZEOF_POINTER__ == 0,
|
ASSERT((DEFINED(__init_bss_end) ? __init_bss_end : 0) % __SIZEOF_POINTER__ == 0,
|
||||||
|
|
43
ape/ape.mk
43
ape/ape.mk
|
@ -15,38 +15,37 @@
|
||||||
|
|
||||||
PKGS += APE
|
PKGS += APE
|
||||||
|
|
||||||
DEFAULT_COPTS += -mno-red-zone
|
|
||||||
DEFAULT_LDFLAGS += -z max-page-size=0x1000
|
|
||||||
|
|
||||||
APELINK = ACTION=LINK.ape $(LINK) $(LINKARGS) $(OUTPUT_OPTION) && $(STRIP) -X $@ && $(GZ) $(ZFLAGS) -f $@.map
|
|
||||||
|
|
||||||
APE = $(APE_DEPS) \
|
APE = $(APE_DEPS) \
|
||||||
$(APE_OBJS) \
|
$(APE_OBJS) \
|
||||||
o/$(MODE)/ape/ape.lds
|
o/$(MODE)/ape/ape.lds
|
||||||
|
|
||||||
APE_FILES := \
|
APELINK = \
|
||||||
$(wildcard ape/*.*)
|
ACTION=LINK.ape \
|
||||||
|
$(LINK) \
|
||||||
|
$(LINKARGS) \
|
||||||
|
$(OUTPUT_OPTION) && \
|
||||||
|
$(STRIP) \
|
||||||
|
-X $@ && \
|
||||||
|
$(GZ) \
|
||||||
|
$(ZFLAGS) \
|
||||||
|
-f $@.map
|
||||||
|
|
||||||
APE_HDRS = \
|
DEFAULT_COPTS += -mno-red-zone
|
||||||
$(filter %.h,$(APE_FILES))
|
DEFAULT_LDFLAGS += -z max-page-size=0x1000
|
||||||
|
|
||||||
APE_SRCS = \
|
APE_FILES := $(wildcard ape/*.*)
|
||||||
$(filter %.S,$(APE_FILES))
|
APE_HDRS = $(filter %.h,$(APE_FILES))
|
||||||
|
APE_SRCS = $(filter %.S,$(APE_FILES))
|
||||||
APE_OBJS = \
|
APE_OBJS = $(APE_SRCS:%.S=o/$(MODE)/%.o)
|
||||||
$(APE_SRCS:%=o/$(MODE)/%.zip.o) \
|
APE_DEPS = $(APE_LIB)
|
||||||
$(APE_SRCS:%.S=o/$(MODE)/%.o)
|
APE_CHECKS = $(APE_HDRS:%=o/%.ok)
|
||||||
|
|
||||||
APE_DEPS = \
|
|
||||||
$(APE_LIB)
|
|
||||||
|
|
||||||
APE_CHECKS = \
|
|
||||||
$(APE_HDRS:%=o/%.ok)
|
|
||||||
|
|
||||||
o/%.com: o/%.com.dbg
|
o/%.com: o/%.com.dbg
|
||||||
@ACTION=OBJCOPY.ape TARGET=$@ build/do $(OBJCOPY) -SO binary $< $@
|
@ACTION=OBJCOPY.ape TARGET=$@ build/do $(OBJCOPY) -SO binary $< $@
|
||||||
|
|
||||||
o/ape/idata.inc: ape/idata.h ape/relocations.h
|
o/ape/idata.inc: \
|
||||||
|
ape/idata.h \
|
||||||
|
ape/relocations.h
|
||||||
|
|
||||||
$(APE_OBJS): $(BUILD_FILES) \
|
$(APE_OBJS): $(BUILD_FILES) \
|
||||||
ape/ape.mk
|
ape/ape.mk
|
||||||
|
|
|
@ -19,6 +19,8 @@ APE_LIB_A_OBJS = \
|
||||||
$(APE_LIB_A_SRCS_S:%.S=o/$(MODE)/%.o) \
|
$(APE_LIB_A_SRCS_S:%.S=o/$(MODE)/%.o) \
|
||||||
$(APE_LIB_A_SRCS_C:%.c=o/$(MODE)/%.o) \
|
$(APE_LIB_A_SRCS_C:%.c=o/$(MODE)/%.o) \
|
||||||
$(APE_LIB_A_SRCS:%=o/$(MODE)/%.zip.o) \
|
$(APE_LIB_A_SRCS:%=o/$(MODE)/%.zip.o) \
|
||||||
|
o/$(MODE)/ape/ape.lds.zip.o \
|
||||||
|
o/$(MODE)/ape/ape.S.zip.o \
|
||||||
o/$(MODE)/NOTICE.zip.o
|
o/$(MODE)/NOTICE.zip.o
|
||||||
|
|
||||||
APE_LIB_A_CHECKS = $(APE_LIB_A_HDRS:%=o/$(MODE)/%.ok)
|
APE_LIB_A_CHECKS = $(APE_LIB_A_HDRS:%=o/$(MODE)/%.ok)
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "ape/macros.h"
|
#include "ape/macros.h"
|
||||||
#include "ape/notice.inc"
|
#include "ape/notice.inc"
|
||||||
.section .real,"ax",@progbits
|
.section .real,"ax",@progbits
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
.code16
|
.code16
|
||||||
|
|
||||||
/ Resets personal computer.
|
/ Resets personal computer.
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "ape/macros.h"
|
#include "ape/macros.h"
|
||||||
#include "ape/notice.inc"
|
#include "ape/notice.inc"
|
||||||
.section .real,"ax",@progbits
|
.section .real,"ax",@progbits
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
.code16
|
.code16
|
||||||
|
|
||||||
.globl e820map
|
.globl e820map
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "ape/macros.h"
|
#include "ape/macros.h"
|
||||||
#include "ape/notice.inc"
|
#include "ape/notice.inc"
|
||||||
.section .real,"ax",@progbits
|
.section .real,"ax",@progbits
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
.code16
|
.code16
|
||||||
|
|
||||||
.globl g_pml4t
|
.globl g_pml4t
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "ape/macros.h"
|
#include "ape/macros.h"
|
||||||
#include "ape/notice.inc"
|
#include "ape/notice.inc"
|
||||||
.section .real,"ax",@progbits
|
.section .real,"ax",@progbits
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
.code16
|
.code16
|
||||||
|
|
||||||
.globl g_ptsp
|
.globl g_ptsp
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "ape/macros.h"
|
#include "ape/macros.h"
|
||||||
#include "ape/notice.inc"
|
#include "ape/notice.inc"
|
||||||
.section .real,"ax",@progbits
|
.section .real,"ax",@progbits
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
.code16
|
.code16
|
||||||
|
|
||||||
.globl kBiosDataArea
|
.globl kBiosDataArea
|
||||||
|
|
|
@ -51,7 +51,7 @@ CP ?= /bin/cp -f
|
||||||
RM ?= /bin/rm -f
|
RM ?= /bin/rm -f
|
||||||
SED ?= /bin/sed
|
SED ?= /bin/sed
|
||||||
MKDIR ?= /bin/mkdir -p
|
MKDIR ?= /bin/mkdir -p
|
||||||
TAGS ?= ctags
|
TAGS ?= /usr/bin/ctags # emacs source builds or something breaks it
|
||||||
ARFLAGS = rcsD
|
ARFLAGS = rcsD
|
||||||
TAGSFLAGS ?= -e -a --if0=no --langmap=c:.c.h.i --line-directives=yes
|
TAGSFLAGS ?= -e -a --if0=no --langmap=c:.c.h.i --line-directives=yes
|
||||||
SILENT ?= 1
|
SILENT ?= 1
|
||||||
|
@ -74,6 +74,7 @@ NM = o/third_party/gcc/bin/x86_64-linux-musl-nm
|
||||||
GCC = o/third_party/gcc/bin/x86_64-linux-musl-gcc
|
GCC = o/third_party/gcc/bin/x86_64-linux-musl-gcc
|
||||||
STRIP = o/third_party/gcc/bin/x86_64-linux-musl-strip
|
STRIP = o/third_party/gcc/bin/x86_64-linux-musl-strip
|
||||||
OBJCOPY = o/third_party/gcc/bin/x86_64-linux-musl-objcopy
|
OBJCOPY = o/third_party/gcc/bin/x86_64-linux-musl-objcopy
|
||||||
|
OBJDUMP = o/third_party/gcc/bin/x86_64-linux-musl-objdump
|
||||||
ADDR2LINE = o/third_party/gcc/bin/x86_64-linux-musl-addr2line
|
ADDR2LINE = o/third_party/gcc/bin/x86_64-linux-musl-addr2line
|
||||||
|
|
||||||
COMMA := ,
|
COMMA := ,
|
||||||
|
@ -87,6 +88,7 @@ BLAH1 := $(shell build/zipobj 2>/dev/null)
|
||||||
BLAH2 := $(shell build/package 2>/dev/null)
|
BLAH2 := $(shell build/package 2>/dev/null)
|
||||||
|
|
||||||
export ADDR2LINE
|
export ADDR2LINE
|
||||||
|
export OBJDUMP
|
||||||
export CCNAME
|
export CCNAME
|
||||||
export CCVERSION
|
export CCVERSION
|
||||||
export CP
|
export CP
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
#-*-mode:sh;indent-tabs-mode:nil;tab-width:2;coding:utf-8-*-┐
|
||||||
|
#───vi: set net ft=sh ts=2 sts=2 fenc=utf-8 :vi─────────────┘
|
||||||
|
#
|
||||||
|
# OVERVIEW
|
||||||
|
#
|
||||||
|
# GNU Disassembly Veneer
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# This script wraps normal objdump commands that're transparently
|
||||||
|
# passed-through.
|
||||||
|
#
|
||||||
|
# EXAMPLE
|
||||||
|
#
|
||||||
|
# build/objdump -xd o/tiny/examples/life.com.dbg
|
||||||
|
|
||||||
|
if [ ! -d o/third_party/gcc ]; then
|
||||||
|
third_party/gcc/unbundle.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec o/third_party/gcc/bin/x86_64-linux-musl-objdump "$@"
|
|
@ -61,4 +61,4 @@ mulaw: .leafprologue
|
||||||
mov %edx,%eax
|
mov %edx,%eax
|
||||||
jmp 3b
|
jmp 3b
|
||||||
.endfn mulaw,globl
|
.endfn mulaw,globl
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
|
@ -38,4 +38,4 @@ sad16x8n:
|
||||||
jnz 0b
|
jnz 0b
|
||||||
1: .leafepilogue
|
1: .leafepilogue
|
||||||
.endfn sad16x8n,globl,hidden
|
.endfn sad16x8n,globl,hidden
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
clamp4int256$core:
|
clamp4int256$core:
|
||||||
.leafprologue
|
.leafprologue
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Returns index of minimum uint16 in array.
|
/ Returns index of minimum uint16 in array.
|
||||||
/
|
/
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Returns index of minimum positive int16 in array.
|
/ Returns index of minimum positive int16 in array.
|
||||||
/
|
/
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/nexgen32e/x86feature.h"
|
#include "libc/nexgen32e/x86feature.h"
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Dispatches to fastest windex() implementation.
|
/ Dispatches to fastest windex() implementation.
|
||||||
.initbss 300,_init_windex
|
.initbss 300,_init_windex
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
|
||||||
|
#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# Your package static library build config
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Your library doesn't have a main() function and can be compromised
|
||||||
|
# of sources written in multiple languages.
|
||||||
|
|
||||||
|
PKGS += EXAMPLES_PACKAGE_LIB
|
||||||
|
|
||||||
|
EXAMPLES_PACKAGE_LIB_ARTIFACTS += EXAMPLES_PACKAGE_LIB_A
|
||||||
|
EXAMPLES_PACKAGE_LIB = $(EXAMPLES_PACKAGE_LIB_A_DEPS) $(EXAMPLES_PACKAGE_LIB_A)
|
||||||
|
EXAMPLES_PACKAGE_LIB_A = o/$(MODE)/examples/package/lib/lib.a
|
||||||
|
EXAMPLES_PACKAGE_LIB_A_HDRS = $(filter %.h,$(EXAMPLES_PACKAGE_LIB_A_FILES))
|
||||||
|
EXAMPLES_PACKAGE_LIB_A_SRCS_S = $(filter %.S,$(EXAMPLES_PACKAGE_LIB_A_FILES))
|
||||||
|
EXAMPLES_PACKAGE_LIB_A_SRCS_C = $(filter %.c,$(EXAMPLES_PACKAGE_LIB_A_FILES))
|
||||||
|
EXAMPLES_PACKAGE_LIB_A_CHECKS = $(EXAMPLES_PACKAGE_LIB_A).pkg
|
||||||
|
|
||||||
|
EXAMPLES_PACKAGE_LIB_A_FILES := \
|
||||||
|
$(wildcard examples/package/lib/*) \
|
||||||
|
$(wildcard examples/package/lib/thunks/*)
|
||||||
|
|
||||||
|
EXAMPLES_PACKAGE_LIB_A_SRCS = \
|
||||||
|
$(EXAMPLES_PACKAGE_LIB_A_SRCS_S) \
|
||||||
|
$(EXAMPLES_PACKAGE_LIB_A_SRCS_C)
|
||||||
|
|
||||||
|
EXAMPLES_PACKAGE_LIB_A_OBJS = \
|
||||||
|
$(EXAMPLES_PACKAGE_LIB_A_SRCS_S:%.S=o/$(MODE)/%.o) \
|
||||||
|
$(EXAMPLES_PACKAGE_LIB_A_SRCS_C:%.c=o/$(MODE)/%.o) \
|
||||||
|
$(EXAMPLES_PACKAGE_LIB_A_SRCS:%=o/$(MODE)/%.zip.o)
|
||||||
|
|
||||||
|
EXAMPLES_PACKAGE_LIB_A_DIRECTDEPS = \
|
||||||
|
LIBC_STDIO \
|
||||||
|
LIBC_STUBS
|
||||||
|
|
||||||
|
EXAMPLES_PACKAGE_LIB_A_DEPS := \
|
||||||
|
$(call uniq,$(foreach x,$(EXAMPLES_PACKAGE_LIB_A_DIRECTDEPS),$($(x))))
|
||||||
|
|
||||||
|
$(EXAMPLES_PACKAGE_LIB_A): \
|
||||||
|
examples/package/lib/ \
|
||||||
|
$(EXAMPLES_PACKAGE_LIB_A).pkg \
|
||||||
|
$(EXAMPLES_PACKAGE_LIB_A_OBJS)
|
||||||
|
|
||||||
|
$(EXAMPLES_PACKAGE_LIB_A).pkg: \
|
||||||
|
$(EXAMPLES_PACKAGE_LIB_A_OBJS) \
|
||||||
|
$(foreach x,$(EXAMPLES_PACKAGE_LIB_A_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
|
$(EXAMPLES_PACKAGE_LIB_A_OBJS): examples/package/lib/lib.mk
|
||||||
|
|
||||||
|
EXAMPLES_PACKAGE_LIB_LIBS = $(foreach x,$(EXAMPLES_PACKAGE_LIB_ARTIFACTS),$($(x)))
|
||||||
|
EXAMPLES_PACKAGE_LIB_SRCS = $(foreach x,$(EXAMPLES_PACKAGE_LIB_ARTIFACTS),$($(x)_SRCS))
|
||||||
|
EXAMPLES_PACKAGE_LIB_HDRS = $(foreach x,$(EXAMPLES_PACKAGE_LIB_ARTIFACTS),$($(x)_HDRS))
|
||||||
|
EXAMPLES_PACKAGE_LIB_BINS = $(foreach x,$(EXAMPLES_PACKAGE_LIB_ARTIFACTS),$($(x)_BINS))
|
||||||
|
EXAMPLES_PACKAGE_LIB_CHECKS = $(foreach x,$(EXAMPLES_PACKAGE_LIB_ARTIFACTS),$($(x)_CHECKS))
|
||||||
|
EXAMPLES_PACKAGE_LIB_OBJS = $(foreach x,$(EXAMPLES_PACKAGE_LIB_ARTIFACTS),$($(x)_OBJS))
|
||||||
|
EXAMPLES_PACKAGE_LIB_TESTS = $(foreach x,$(EXAMPLES_PACKAGE_LIB_ARTIFACTS),$($(x)_TESTS))
|
||||||
|
|
||||||
|
.PHONY: o/$(MODE)/examples/package/lib
|
||||||
|
o/$(MODE)/examples/package/lib: $(EXAMPLES_PACKAGE_LIB_CHECKS)
|
|
@ -0,0 +1,6 @@
|
||||||
|
#include "libc/macros.h"
|
||||||
|
|
||||||
|
MyAsm: .leafprologue
|
||||||
|
call MyPrint2
|
||||||
|
.leafepilogue
|
||||||
|
.endfn MyAsm,globl
|
|
@ -0,0 +1,10 @@
|
||||||
|
#include "examples/package/lib/myprint.h"
|
||||||
|
#include "libc/stdio/stdio.h"
|
||||||
|
|
||||||
|
void MyPrint(const char *s) {
|
||||||
|
MyAsm(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyPrint2(const char *s) {
|
||||||
|
fputs(s, stdout);
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
#ifndef COSMOPOLITAN_EXAMPLES_PACKAGE_LIB_MYPRINT_H_
|
||||||
|
#define COSMOPOLITAN_EXAMPLES_PACKAGE_LIB_MYPRINT_H_
|
||||||
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||||
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
|
void MyPrint(const char *);
|
||||||
|
void MyAsm(const char *);
|
||||||
|
|
||||||
|
COSMOPOLITAN_C_END_
|
||||||
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||||
|
#endif /* COSMOPOLITAN_EXAMPLES_PACKAGE_LIB_MYPRINT_H_ */
|
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# Creates new package in repository.
|
||||||
|
#
|
||||||
|
# EXAMPLE
|
||||||
|
#
|
||||||
|
# examples/package/new.sh com/github/user/project
|
||||||
|
|
||||||
|
DIR=${1:?need directory arg}
|
||||||
|
VAR=$(echo "$DIR" | tr a-z A-Z | tr / _)
|
||||||
|
BASENAME=${DIR##*/}
|
||||||
|
FILENAME="$DIR/$BASENAME"
|
||||||
|
MAKEFILE="$DIR/$BASENAME.mk"
|
||||||
|
|
||||||
|
if [ -d "$DIR" ]; then
|
||||||
|
echo "already exists: $DIR" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$DIR" &&
|
||||||
|
cp -R examples/package/new/* "$DIR" &&
|
||||||
|
find "$DIR" -type f |
|
||||||
|
xargs sed -i -e "
|
||||||
|
s/EXAMPLES_PACKAGE/$VAR/g
|
||||||
|
s/examples\/package\/package/$FILENAME/g
|
||||||
|
s/examples\/package/$DIR/g
|
||||||
|
" &&
|
||||||
|
sed -i -e "
|
||||||
|
/#-φ-examples\/package\/new\.sh/i\
|
||||||
|
include $MAKEFILE
|
||||||
|
" Makefile
|
|
@ -0,0 +1,74 @@
|
||||||
|
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
|
||||||
|
#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# Your package build config for executable programs
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# We assume each .c file in this directory has a main() function, so
|
||||||
|
# that it becomes as easy as possible to write lots of tiny programs
|
||||||
|
#
|
||||||
|
# EXAMPLE
|
||||||
|
#
|
||||||
|
# make o//examples/package
|
||||||
|
# o/examples/package/program.com
|
||||||
|
|
||||||
|
PKGS += EXAMPLES_PACKAGE
|
||||||
|
|
||||||
|
# Reads into memory the list of files in this directory.
|
||||||
|
EXAMPLES_PACKAGE_FILES := $(wildcard examples/package/*)
|
||||||
|
|
||||||
|
# Defines sets of files without needing further iops.
|
||||||
|
EXAMPLES_PACKAGE_SRCS = $(filter %.c,$(EXAMPLES_PACKAGE_FILES))
|
||||||
|
EXAMPLES_PACKAGE_HDRS = $(filter %.h,$(EXAMPLES_PACKAGE_FILES))
|
||||||
|
EXAMPLES_PACKAGE_COMS = $(EXAMPLES_PACKAGE_OBJS:%.o=%.com)
|
||||||
|
|
||||||
|
# Remaps source file names to object names.
|
||||||
|
# Also asks a wildcard rule to automatically run tool/build/zipobj.c
|
||||||
|
EXAMPLES_PACKAGE_OBJS = \
|
||||||
|
$(EXAMPLES_PACKAGE_SRCS:%.c=o/$(MODE)/%.o) \
|
||||||
|
$(EXAMPLES_PACKAGE_SRCS:%=o/$(MODE)/%.zip.o)
|
||||||
|
EXAMPLES_PACKAGE_BINS = \
|
||||||
|
$(EXAMPLES_PACKAGE_COMS) \
|
||||||
|
$(EXAMPLES_PACKAGE_COMS:%=%.dbg)
|
||||||
|
|
||||||
|
# Lists packages whose symbols are or may be directly referenced here.
|
||||||
|
# Note that linking stubs is always a good idea due to synthetic code.
|
||||||
|
EXAMPLES_PACKAGE_DIRECTDEPS = \
|
||||||
|
EXAMPLES_PACKAGE_LIB \
|
||||||
|
LIBC_STDIO \
|
||||||
|
LIBC_STUBS \
|
||||||
|
LIBC_TINYMATH
|
||||||
|
|
||||||
|
# Evaluates the set of transitive package dependencies.
|
||||||
|
EXAMPLES_PACKAGE_DEPS := \
|
||||||
|
$(call uniq,$(foreach x,$(EXAMPLES_PACKAGE_DIRECTDEPS),$($(x))))
|
||||||
|
|
||||||
|
# Invalidates objects in this package when this makefile is edited
|
||||||
|
$(EXAMPLES_PACKAGE_OBJS): examples/package/vizlib.mk
|
||||||
|
|
||||||
|
# Asks packager to index symbols and validate their relationships.
|
||||||
|
# @see tool/build/package.c
|
||||||
|
# @see build/rules.mk
|
||||||
|
o/$(MODE)/examples/package/build.pkg: \
|
||||||
|
$(EXAMPLES_PACKAGE_OBJS) \
|
||||||
|
$(foreach x,$(EXAMPLES_PACKAGE_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
|
# Specifies how to build programs as ELF binaries with DWARF debug info.
|
||||||
|
# @see build/rules.mk for definition of rule that does .com.dbg -> .com
|
||||||
|
o/$(MODE)/examples/package/%.com.dbg: \
|
||||||
|
$(EXAMPLES_PACKAGE_DEPS) \
|
||||||
|
o/$(MODE)/examples/package/package.pkg \
|
||||||
|
o/$(MODE)/examples/package/%.o \
|
||||||
|
$(CRT) \
|
||||||
|
$(APE)
|
||||||
|
-@$(APELINK)
|
||||||
|
|
||||||
|
# Creates target that builds everything in this package and subpackages.
|
||||||
|
.PHONY: o/$(MODE)/examples/package
|
||||||
|
o/$(MODE)/examples/package: \
|
||||||
|
o/$(MODE)/examples/package/lib \
|
||||||
|
$(EXAMPLES_PACKAGE_BINS) \
|
||||||
|
$(EXAMPLES_PACKAGE_CHECKS)
|
|
@ -0,0 +1,6 @@
|
||||||
|
#include "examples/package/lib/myprint.h"
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
MyPrint("welcome to your package");
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -19,31 +19,42 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
|
|
||||||
/ Raw Linux Assembly Binary Tutorial
|
/ Tiny Raw Linux Binary Tutorial
|
||||||
/
|
/
|
||||||
/ i.e. how to not use cosmopolitan runtimes at all
|
/ i.e. how to not use cosmopolitan runtimes at all
|
||||||
/ cosmopolitan basically abstracts this
|
/ cosmopolitan basically abstracts this
|
||||||
/ except for all major platforms
|
/ except for all major platforms
|
||||||
/
|
/
|
||||||
/ make o//examples/raw-linux-hello.elf
|
/ make o//examples/raw-linux-hello.elf
|
||||||
/ o//examples/raw-linux-hello.elf # about 6kb
|
/ o/examples/raw-linux-hello.elf # about 6kb
|
||||||
/
|
/
|
||||||
/ Next consider doing it in C with fancy build tuning
|
/ Next try C but with fancy build tuning
|
||||||
/
|
/
|
||||||
/ make -j8 -O \
|
/ make -j8 -O \
|
||||||
/ MODE=tiny \
|
/ MODE=tiny \
|
||||||
/ LDFLAGS=-s \
|
/ LDFLAGS+=-s \
|
||||||
/ CPPFLAGS=-DSUPPORT_VECTOR=0b00000001 \
|
/ CPPFLAGS+=-DIM_FEELING_NAUGHTY \
|
||||||
/ o/tiny/examples/hello2.elf
|
/ CPPFLAGS+=-DSUPPORT_VECTOR=0b00000001 \
|
||||||
/ o/tiny/examples/hello2.elf # about 8kb
|
/ o/tiny/examples/hello2.elf
|
||||||
|
/ o/tiny/examples/hello2.elf # about 8kb
|
||||||
/
|
/
|
||||||
|
/ @param rsp is [n,argv₀..argvₙ₋₁,0,envp₀..,0,auxv₀..,0,..]
|
||||||
|
/ @see also glibc static binaries which start at 800kb!!!
|
||||||
|
/ @see also go where interfaces sadly disempower ld prune
|
||||||
|
/ @see also the stl where bad linkage is due to tech debt
|
||||||
|
/ @see libc/macros-cpp.inc forthe getstr macro definition
|
||||||
|
/ @note libc/elf/elf.lds can be tinier with page align off
|
||||||
|
/ @note gas is more powerful than nasm due to rms notation
|
||||||
/ @noreturn
|
/ @noreturn
|
||||||
_start: mov $12,%rdx # arg no. 3 is length
|
_start: mov $12,%rdx # arg no. 3 is length
|
||||||
getstr "hello world\n",%rsi,%esi # arg no. 2 is memory
|
getstr "hello world\n",%rsi,%esi # arg no. 2 is memory
|
||||||
mov $1,%edi # arg no. 1 is stdout
|
mov $1,%edi # arg no. 1 is stdout
|
||||||
mov $1,%eax # write()
|
mov $1,%eax # write()
|
||||||
syscall # see libc/sysv/syscalls.sh
|
syscall # libc/sysv/syscalls.sh
|
||||||
mov $0,%edi # arg no. 1 is success status
|
mov $0,%edi # arg no. 1 is success status
|
||||||
mov $0xE7,%eax # exit_group()
|
mov $0xE7,%eax # exit_group()
|
||||||
syscall
|
syscall # context switch
|
||||||
|
0: rep nop # basic blockading
|
||||||
|
jmp 0b
|
||||||
.endfn _start,globl
|
.endfn _start,globl
|
||||||
|
.source __FILE__
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
.p2align 4
|
.p2align 4
|
||||||
minmax_vector:
|
minmax_vector:
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
.init.start 400,_init_g_ntstartupinfo
|
.init.start 400,_init_g_ntstartupinfo
|
||||||
ezlea g_ntstartupinfo,cx
|
ezlea g_ntstartupinfo,cx
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
.init.start 400,_init_g_ntsysteminfo
|
.init.start 400,_init_g_ntsysteminfo
|
||||||
ezlea g_ntsysteminfo,cx
|
ezlea g_ntsysteminfo,cx
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Obtains WIN32 magic path, e.g. GetTempPathA.
|
/ Obtains WIN32 magic path, e.g. GetTempPathA.
|
||||||
/
|
/
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "libc/nexgen32e/hascharacter.h"
|
#include "libc/nexgen32e/hascharacter.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
#include "libc/str/tpdecode.h"
|
||||||
#include "libc/sysv/consts/fileno.h"
|
#include "libc/sysv/consts/fileno.h"
|
||||||
#include "libc/sysv/errfuns.h"
|
#include "libc/sysv/errfuns.h"
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
#include "libc/str/tpdecode.h"
|
||||||
#include "libc/sysv/errfuns.h"
|
#include "libc/sysv/errfuns.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,4 +40,4 @@ kTmpPath:
|
||||||
call __getntsyspath
|
call __getntsyspath
|
||||||
.init.end 300,_init_kTmpPath
|
.init.end 300,_init_kTmpPath
|
||||||
|
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/conv/conv.h"
|
#include "libc/conv/conv.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
#include "libc/str/tpdecode.h"
|
||||||
#include "libc/sysv/errfuns.h"
|
#include "libc/sysv/errfuns.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
.init.start 300,_init_onntconsoleevent
|
.init.start 300,_init_onntconsoleevent
|
||||||
ezlea onntconsoleevent$nt,cx
|
ezlea onntconsoleevent$nt,cx
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
.init.start 300,_init_onwincrash
|
.init.start 300,_init_onwincrash
|
||||||
pushpop 1,%rcx
|
pushpop 1,%rcx
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Creates file descriptors for IPC.
|
/ Creates file descriptors for IPC.
|
||||||
/
|
/
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Sets effective group ID.
|
/ Sets effective group ID.
|
||||||
/
|
/
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Sets effective user ID.
|
/ Sets effective user ID.
|
||||||
/
|
/
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ System Five signal handler.
|
/ System Five signal handler.
|
||||||
/
|
/
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Directly calls ftruncate() impl on host o/s if available.
|
/ Directly calls ftruncate() impl on host o/s if available.
|
||||||
ftruncate$sysv:
|
ftruncate$sysv:
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Calls GetTempPathA() w/ different API.
|
/ Calls GetTempPathA() w/ different API.
|
||||||
/
|
/
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Directly calls lseek() impl on host o/s if available.
|
/ Directly calls lseek() impl on host o/s if available.
|
||||||
lseek$sysv:
|
lseek$sysv:
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Directly calls mmap() on system five host o/s.
|
/ Directly calls mmap() on system five host o/s.
|
||||||
mmap$sysv:
|
mmap$sysv:
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.text.windows
|
.text.windows
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
onntconsoleevent$nt:
|
onntconsoleevent$nt:
|
||||||
ezlea onntconsoleevent,ax
|
ezlea onntconsoleevent,ax
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.text.windows
|
.text.windows
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
onwincrash$nt:
|
onwincrash$nt:
|
||||||
ezlea onwincrash,ax
|
ezlea onwincrash,ax
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Directly calls pread() impl on host o/s if available.
|
/ Directly calls pread() impl on host o/s if available.
|
||||||
pread$sysv:
|
pread$sysv:
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Directly calls preadv() impl on host o/s if available.
|
/ Directly calls preadv() impl on host o/s if available.
|
||||||
preadv$sysv:
|
preadv$sysv:
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Directly calls pwrite() impl on host o/s if available.
|
/ Directly calls pwrite() impl on host o/s if available.
|
||||||
pwrite$sysv:
|
pwrite$sysv:
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Directly calls pwritev() impl on host o/s if available.
|
/ Directly calls pwritev() impl on host o/s if available.
|
||||||
pwritev$sysv:
|
pwritev$sysv:
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Directly calls truncate() impl on host o/s if available.
|
/ Directly calls truncate() impl on host o/s if available.
|
||||||
truncate$sysv:
|
truncate$sysv:
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "libc/notice.inc"
|
#include "libc/notice.inc"
|
||||||
#include "libc/runtime/internal.h"
|
#include "libc/runtime/internal.h"
|
||||||
.section .start,"ax",@progbits
|
.section .start,"ax",@progbits
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ System Five userspace program entrypoint.
|
/ System Five userspace program entrypoint.
|
||||||
/
|
/
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/notice.inc"
|
#include "libc/notice.inc"
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Embeds ASCII names for errno constants into binary.
|
/ Embeds ASCII names for errno constants into binary.
|
||||||
/
|
/
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#include "libc/nexgen32e/tinystrlen.h"
|
#include "libc/nexgen32e/tinystrlen.h"
|
||||||
#include "libc/str/internal.h"
|
#include "libc/str/internal.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
#include "libc/str/tpdecode.h"
|
||||||
|
#include "libc/str/tpencode.h"
|
||||||
#include "libc/unicode/unicode.h"
|
#include "libc/unicode/unicode.h"
|
||||||
|
|
||||||
forceinline unsigned long tpiencode(wint_t wc) {
|
forceinline unsigned long tpiencode(wint_t wc) {
|
||||||
|
|
|
@ -983,7 +983,7 @@ typedef uint64_t uintmax_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pulls another module, by symbol, into linkage.
|
* Pulls another module, by symbol, into linkage.
|
||||||
* The nop itself is discarded by the linker.
|
* @note nop is discarded by ape/ape.lds
|
||||||
*/
|
*/
|
||||||
#define YOINK(SYMBOL) \
|
#define YOINK(SYMBOL) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -996,11 +996,30 @@ typedef uint64_t uintmax_t;
|
||||||
: "X"(SYMBOL)); \
|
: "X"(SYMBOL)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pulls another module into linkage from top-level scope.
|
||||||
|
* @note nop is discarded by ape/ape.lds
|
||||||
|
*/
|
||||||
#define STATIC_YOINK(SYMBOLSTR) \
|
#define STATIC_YOINK(SYMBOLSTR) \
|
||||||
asm(".pushsection .yoink\n\tnop\t\"" SYMBOLSTR "\"\n\t.popsection")
|
asm(".pushsection .yoink\n\tnop\t\"" SYMBOLSTR "\"\n\t.popsection")
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pulls source file into ZIP portion of binary.
|
||||||
|
* @see build/rules.mk which defines the wildcard build rule %.zip.o
|
||||||
|
*/
|
||||||
|
#ifndef IM_FEELING_NAUGHTY
|
||||||
|
#define STATIC_YOINK_SOURCE(PATH) STATIC_YOINK(PATH)
|
||||||
|
#else
|
||||||
|
#define STATIC_YOINK_SOURCE(PATH)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pulls source code of object being compiled.
|
||||||
|
* @note automates better compliance with spirit of gpl terms
|
||||||
|
* @note headers need to call STATIC_YOINK_SOURCE() manually
|
||||||
|
*/
|
||||||
#ifdef __SAUCE__
|
#ifdef __SAUCE__
|
||||||
STATIC_YOINK(__SAUCE__);
|
STATIC_YOINK_SOURCE(__SAUCE__); /* see build/definitions.mk */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
.align 4
|
.align 4
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ These function names make it a bit more obvious which signal
|
/ These function names make it a bit more obvious which signal
|
||||||
/ caused the crash, particularly in the GDB GUI. They're coded
|
/ caused the crash, particularly in the GDB GUI. They're coded
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.text.unlikely
|
.text.unlikely
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Code-size saving thunk for CHECK_EQ() in NDEBUG mode.
|
/ Code-size saving thunk for CHECK_EQ() in NDEBUG mode.
|
||||||
__check_fail_eq:
|
__check_fail_eq:
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.text.unlikely
|
.text.unlikely
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Code-size saving thunk for CHECK_GE() in NDEBUG mode.
|
/ Code-size saving thunk for CHECK_GE() in NDEBUG mode.
|
||||||
__check_fail_ge:
|
__check_fail_ge:
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.text.unlikely
|
.text.unlikely
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Code-size saving thunk for CHECK_GT() in NDEBUG mode.
|
/ Code-size saving thunk for CHECK_GT() in NDEBUG mode.
|
||||||
__check_fail_gt:
|
__check_fail_gt:
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.text.unlikely
|
.text.unlikely
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Code-size saving thunk for CHECK_LE() in NDEBUG mode.
|
/ Code-size saving thunk for CHECK_LE() in NDEBUG mode.
|
||||||
__check_fail_le:
|
__check_fail_le:
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.text.unlikely
|
.text.unlikely
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Code-size saving thunk for CHECK_LT() in NDEBUG mode.
|
/ Code-size saving thunk for CHECK_LT() in NDEBUG mode.
|
||||||
__check_fail_lt:
|
__check_fail_lt:
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
__check_fail_ndebug:
|
__check_fail_ndebug:
|
||||||
push %rbp
|
push %rbp
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.text.unlikely
|
.text.unlikely
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Code-size saving thunk for CHECK_NE() in NDEBUG mode.
|
/ Code-size saving thunk for CHECK_NE() in NDEBUG mode.
|
||||||
__check_fail_ne:
|
__check_fail_ne:
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.text.unlikely
|
.text.unlikely
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
__ubsan_default_options:
|
__ubsan_default_options:
|
||||||
ret
|
ret
|
||||||
|
|
|
@ -87,6 +87,17 @@
|
||||||
ret
|
ret
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
/ Pulls source code file into ZIP portion of binary.
|
||||||
|
/
|
||||||
|
/ @param symbol is quoted path relative to root e.g. __FILE__
|
||||||
|
/ @see see libc/zipos/zipcentraldir.S
|
||||||
|
/ @see see libc/integral/c.inc
|
||||||
|
.macro .source symbol:req
|
||||||
|
#ifndef IM_FEELING_NAUGHTY
|
||||||
|
.yoink "\symbol"
|
||||||
|
#endif
|
||||||
|
.endm
|
||||||
|
|
||||||
/ Inserts profiling hook in prologue if cc wants it.
|
/ Inserts profiling hook in prologue if cc wants it.
|
||||||
/
|
/
|
||||||
/ Cosmopolitan does this in a slightly different way from normal
|
/ Cosmopolitan does this in a slightly different way from normal
|
||||||
|
|
|
@ -35,4 +35,4 @@ fesetround:
|
||||||
pop %rcx
|
pop %rcx
|
||||||
ret
|
ret
|
||||||
.endfn fesetround,globl,hidden
|
.endfn fesetround,globl,hidden
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.inc"
|
#include "libc/macros.h"
|
||||||
|
|
||||||
feraiseexcept:
|
feraiseexcept:
|
||||||
and $0x3f,%edi
|
and $0x3f,%edi
|
||||||
|
@ -27,4 +27,4 @@ feraiseexcept:
|
||||||
xor %eax,%eax
|
xor %eax,%eax
|
||||||
ret
|
ret
|
||||||
.endfn feraiseexcept,globl
|
.endfn feraiseexcept,globl
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
|
@ -36,4 +36,4 @@ fesetenv:
|
||||||
add $40,%rsp
|
add $40,%rsp
|
||||||
ret
|
ret
|
||||||
.endfn fesetenv,globl
|
.endfn fesetenv,globl
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
|
@ -29,4 +29,4 @@ fetestexcept:
|
||||||
and %edi,%eax
|
and %edi,%eax
|
||||||
ret
|
ret
|
||||||
.endfn fetestexcept,globl
|
.endfn fetestexcept,globl
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
.initbss 800,_init_calloc
|
.initbss 800,_init_calloc
|
||||||
hook$calloc:
|
hook$calloc:
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
#include "libc/notice.inc"
|
#include "libc/notice.inc"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Allocates n * itemsize bytes, initialized to zero.
|
/ Allocates n * itemsize bytes, initialized to zero.
|
||||||
/
|
/
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Frees memory the C++ way.
|
/ Frees memory the C++ way.
|
||||||
/
|
/
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
.initbss 800,_init_free
|
.initbss 800,_init_free
|
||||||
hook$free:
|
hook$free:
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Free memory returned by malloc() & co.
|
/ Free memory returned by malloc() & co.
|
||||||
/
|
/
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Allocates memory the C++ way.
|
/ Allocates memory the C++ way.
|
||||||
/
|
/
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
.initbss 800,_init_malloc
|
.initbss 800,_init_malloc
|
||||||
hook$malloc:
|
hook$malloc:
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Allocates uninitialized memory.
|
/ Allocates uninitialized memory.
|
||||||
/
|
/
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
#include "libc/notice.inc"
|
#include "libc/notice.inc"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Returns the number of bytes you can actually use in
|
/ Returns the number of bytes you can actually use in
|
||||||
/ an allocated chunk, which may be more than you requested
|
/ an allocated chunk, which may be more than you requested
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Allocates aligned memory the C++ way.
|
/ Allocates aligned memory the C++ way.
|
||||||
/
|
/
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
.initbss 800,_init_memalign
|
.initbss 800,_init_memalign
|
||||||
hook$memalign:
|
hook$memalign:
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
#include "libc/notice.inc"
|
#include "libc/notice.inc"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Allocates aligned memory.
|
/ Allocates aligned memory.
|
||||||
/
|
/
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Allocates aligned memory the POSIX way.
|
/ Allocates aligned memory the POSIX way.
|
||||||
/
|
/
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
#include "libc/notice.inc"
|
#include "libc/notice.inc"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Equivalent to valloc(minimum-page-that-holds(n)), that is,
|
/ Equivalent to valloc(minimum-page-that-holds(n)), that is,
|
||||||
/ round up n to nearest PAGESIZE.
|
/ round up n to nearest PAGESIZE.
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
│ 02110-1301 USA │
|
│ 02110-1301 USA │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
.initbss 800,_init_realloc
|
.initbss 800,_init_realloc
|
||||||
hook$realloc:
|
hook$realloc:
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
#include "libc/notice.inc"
|
#include "libc/notice.inc"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Allocates / resizes / frees memory, e.g.
|
/ Allocates / resizes / frees memory, e.g.
|
||||||
/
|
/
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
#include "libc/notice.inc"
|
#include "libc/notice.inc"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Resizes the space allocated for p to size n, only if this can be
|
/ Resizes the space allocated for p to size n, only if this can be
|
||||||
/ done without moving p (i.e., only if there is adjacent space
|
/ done without moving p (i.e., only if there is adjacent space
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
#include "libc/notice.inc"
|
#include "libc/notice.inc"
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
/ Equivalent to memalign(PAGESIZE, n).
|
/ Equivalent to memalign(PAGESIZE, n).
|
||||||
/
|
/
|
||||||
|
|
|
@ -36,4 +36,4 @@ __atomic_is_lock_free:
|
||||||
cmovnz %ecx,%eax
|
cmovnz %ecx,%eax
|
||||||
.leafepilogue
|
.leafepilogue
|
||||||
.endfn __atomic_is_lock_free,globl,hidden
|
.endfn __atomic_is_lock_free,globl,hidden
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
|
@ -30,4 +30,4 @@
|
||||||
/ @return 0 if equal or nonzero
|
/ @return 0 if equal or nonzero
|
||||||
bcmp: jmp *hook$memcmp(%rip)
|
bcmp: jmp *hook$memcmp(%rip)
|
||||||
.endfn bcmp,globl
|
.endfn bcmp,globl
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
|
@ -28,5 +28,5 @@
|
||||||
/ @param rdx is number of bytes
|
/ @param rdx is number of bytes
|
||||||
bcopy: jmp memmove
|
bcopy: jmp memmove
|
||||||
.endfn bcopy,globl
|
.endfn bcopy,globl
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
|
@ -40,4 +40,4 @@ bsf: .leafprologue
|
||||||
bsf %edi,%eax
|
bsf %edi,%eax
|
||||||
.leafepilogue
|
.leafepilogue
|
||||||
.endfn bsf,globl
|
.endfn bsf,globl
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
|
@ -41,4 +41,4 @@ bsfl: .leafprologue
|
||||||
.leafepilogue
|
.leafepilogue
|
||||||
.endfn bsfl,globl
|
.endfn bsfl,globl
|
||||||
.alias bsfl,bsfll
|
.alias bsfl,bsfll
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
|
@ -40,4 +40,4 @@ bsr: .leafprologue
|
||||||
bsr %edi,%eax
|
bsr %edi,%eax
|
||||||
.leafepilogue
|
.leafepilogue
|
||||||
.endfn bsr,globl
|
.endfn bsr,globl
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
|
@ -41,4 +41,4 @@ bsrl: .leafprologue
|
||||||
.leafepilogue
|
.leafepilogue
|
||||||
.endfn bsrl,globl
|
.endfn bsrl,globl
|
||||||
.alias bsrl,bsrll
|
.alias bsrl,bsrll
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
|
@ -44,4 +44,4 @@ bsrmax: .leafprologue
|
||||||
2: add $64,%eax
|
2: add $64,%eax
|
||||||
jmp 1b
|
jmp 1b
|
||||||
.endfn bsrmax,globl
|
.endfn bsrmax,globl
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
|
@ -32,4 +32,4 @@ bzero: mov %rsi,%rdx
|
||||||
xor %esi,%esi
|
xor %esi,%esi
|
||||||
jmp _memset
|
jmp _memset
|
||||||
.endfn bzero,globl
|
.endfn bzero,globl
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
|
@ -130,4 +130,4 @@ cescapectab:
|
||||||
add $(8-.Lcescapectab.ro.size%8),%rsi
|
add $(8-.Lcescapectab.ro.size%8),%rsi
|
||||||
.endif
|
.endif
|
||||||
.init.end 300,_init_cescapec
|
.init.end 300,_init_cescapec
|
||||||
.yoink __FILE__
|
.source __FILE__
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue