mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
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
This commit is contained in:
parent
7327c345f9
commit
416fd86676
230 changed files with 9835 additions and 5682 deletions
45
libc/runtime/destruct.S
Normal file
45
libc/runtime/destruct.S
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program is distributed in the hope that it will be useful, but │
|
||||
│ WITHOUT ANY WARRANTY; without even the implied warranty of │
|
||||
│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.h"
|
||||
.text.exit
|
||||
.source __FILE__
|
||||
|
||||
/ Calls linker registered finalization functions.
|
||||
/ @note functions are called in reverse order
|
||||
_destruct:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
ezlea __fini_array_start,cx
|
||||
.weak __fini_array_start
|
||||
ezlea __fini_array_end,ax
|
||||
.weak __fini_array_end
|
||||
cmp %rax,%rcx
|
||||
je 2f
|
||||
1: sub $8,%rax
|
||||
push %rax
|
||||
push %rcx
|
||||
call *(%rax)
|
||||
pop %rcx
|
||||
pop %rax
|
||||
cmp %rax,%rcx
|
||||
jne 1b
|
||||
2: pop %rbp
|
||||
ret
|
||||
.endfn _destruct,globl
|
|
@ -31,6 +31,7 @@ exit: push %rbp
|
|||
push %rdi
|
||||
xor %edi,%edi
|
||||
call __cxa_finalize
|
||||
call _destruct
|
||||
pop %rdi
|
||||
pop %rdi
|
||||
call _Exit
|
||||
|
|
|
@ -136,7 +136,8 @@
|
|||
} \
|
||||
while (0)
|
||||
|
||||
interruptfn void __print(const void *, size_t);
|
||||
void __print(const void *, size_t);
|
||||
void __print_string(const char *);
|
||||
|
||||
#define LOAD_DEFAULT_RBX() /* disabled for now b/c clang */
|
||||
#define RESTORE_RBX() /* disabled for now b/c clang */
|
||||
|
|
|
@ -49,9 +49,8 @@ static privileged void __print$nt(const void *data, size_t len) {
|
|||
* @clob nothing except flags
|
||||
* @see PRINT()
|
||||
*/
|
||||
privileged interruptfn void __print(const void *data, size_t len) {
|
||||
privileged void __print(const void *data, size_t len) {
|
||||
int64_t ax, ordinal;
|
||||
LOAD_DEFAULT_RBX();
|
||||
if (NT_HAVE_IMPORT(__imp_WriteFile)) {
|
||||
__print$nt(data, len);
|
||||
} else {
|
||||
|
@ -69,3 +68,9 @@ privileged interruptfn void __print(const void *data, size_t len) {
|
|||
}
|
||||
RESTORE_RBX();
|
||||
}
|
||||
|
||||
privileged void __print_string(const char *s) {
|
||||
size_t n = 0;
|
||||
while (s[n]) ++n;
|
||||
__print(s, n);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue