mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 03:38: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
|
@ -3,8 +3,6 @@
|
|||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
extern const uint32_t kCrc32Tab[256];
|
||||
|
||||
void crc32init(uint32_t[hasatleast 256], uint32_t);
|
||||
uint32_t crc32_z(uint32_t, const void *, size_t);
|
||||
extern uint32_t (*const crc32c)(uint32_t, const void *, size_t) paramsnonnull();
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.h"
|
||||
.text.startup
|
||||
|
||||
/ Generates lookup table for computing CRC-32 byte-by-byte.
|
||||
/
|
||||
|
|
|
@ -21,12 +21,25 @@
|
|||
#include "libc/nexgen32e/crc32.h"
|
||||
#include "libc/nexgen32e/x86feature.h"
|
||||
|
||||
static uint32_t kCrc32Tab[256];
|
||||
|
||||
/**
|
||||
* Computes Phil Katz CRC-32 used by zip/zlib/gzip/etc.
|
||||
*
|
||||
* x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1
|
||||
* 0b100000100110000010001110110110111
|
||||
* bitreverse32(0x104c11db7)
|
||||
*
|
||||
* @param h is initial value
|
||||
*/
|
||||
uint32_t crc32_z(uint32_t h, const void *data, size_t size) {
|
||||
const unsigned char *p, *pe;
|
||||
static bool once;
|
||||
size_t skip;
|
||||
if (!once) {
|
||||
crc32init(kCrc32Tab, 0xedb88320);
|
||||
once = true;
|
||||
}
|
||||
if (data) {
|
||||
h ^= 0xffffffff;
|
||||
if (size >= 64 && X86_HAVE(PCLMUL)) {
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
/*-*- 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"
|
||||
|
||||
/ Phil Katz CRC-32 Polynomial
|
||||
/ x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1
|
||||
/ 0b100000100110000010001110110110111
|
||||
/ bitreverse32(0x104c11db7)
|
||||
#define kZipCrc32Polynomial 0xedb88320
|
||||
|
||||
.initbss 300,_init_kCrc32Tab
|
||||
kCrc32Tab:
|
||||
.rept 256
|
||||
.long 0
|
||||
.endr
|
||||
.endobj kCrc32Tab,globl,hidden
|
||||
.previous
|
||||
|
||||
.init.start 300,_init_kCrc32Tab
|
||||
push %rsi
|
||||
mov $kZipCrc32Polynomial,%esi
|
||||
call crc32init
|
||||
pop %rsi
|
||||
.init.end 300,_init_kCrc32Tab
|
||||
.source __FILE__
|
Loading…
Add table
Add a link
Reference in a new issue