mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-12 01:08:00 +00:00
Delete some dead code
This commit is contained in:
parent
9e6faa5256
commit
2f89c2482a
12 changed files with 0 additions and 505 deletions
|
@ -168,7 +168,6 @@ o/$(MODE)/ape/ape-no-modify-self.o: \
|
||||||
libc/macros.internal.h \
|
libc/macros.internal.h \
|
||||||
libc/nexgen32e/uart.internal.h \
|
libc/nexgen32e/uart.internal.h \
|
||||||
libc/calls/metalfile.internal.h \
|
libc/calls/metalfile.internal.h \
|
||||||
libc/nexgen32e/vidya.internal.h \
|
|
||||||
libc/nt/pedef.internal.h \
|
libc/nt/pedef.internal.h \
|
||||||
libc/runtime/e820.internal.h \
|
libc/runtime/e820.internal.h \
|
||||||
libc/runtime/mman.internal.h \
|
libc/runtime/mman.internal.h \
|
||||||
|
@ -199,7 +198,6 @@ o/$(MODE)/ape/ape-copy-self.o: \
|
||||||
libc/macros.internal.h \
|
libc/macros.internal.h \
|
||||||
libc/nexgen32e/uart.internal.h \
|
libc/nexgen32e/uart.internal.h \
|
||||||
libc/calls/metalfile.internal.h \
|
libc/calls/metalfile.internal.h \
|
||||||
libc/nexgen32e/vidya.internal.h \
|
|
||||||
libc/nt/pedef.internal.h \
|
libc/nt/pedef.internal.h \
|
||||||
libc/runtime/e820.internal.h \
|
libc/runtime/e820.internal.h \
|
||||||
libc/runtime/mman.internal.h \
|
libc/runtime/mman.internal.h \
|
||||||
|
|
|
@ -22,119 +22,6 @@
|
||||||
#ifdef __ASSEMBLER__
|
#ifdef __ASSEMBLER__
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
|
|
||||||
/**
|
|
||||||
* @fileoverview Macros relevant to αcτµαlly pδrταblε εxεcµταblε.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Calls near (i.e. pc+pcrel<64kB) FUNCTION.
|
|
||||||
// @mode long,legacy,real
|
|
||||||
// @cost 9 bytes overhead
|
|
||||||
.macro rlcall function:req
|
|
||||||
.byte 0x50 # push %[er]ax
|
|
||||||
.byte 0xb8,0,0 # mov $?,%[e]ax
|
|
||||||
jmp 911f
|
|
||||||
.byte 0x58 # pop %[er]ax
|
|
||||||
.byte 0xe8 # call Jvds
|
|
||||||
.long \function\()-.-4
|
|
||||||
jmp 912f
|
|
||||||
911: .byte 0x58 # pop %[er]ax
|
|
||||||
.byte 0xe8 # call Jvds
|
|
||||||
.short \function\()-.-2
|
|
||||||
912:
|
|
||||||
.endm
|
|
||||||
|
|
||||||
// Loads far (i.e. <1mb) abs constexpr ADDRESS into ES:DI+EDX+RDX.
|
|
||||||
// @mode long,legacy,real
|
|
||||||
.macro movesdi address:req
|
|
||||||
.byte 0xbf # mov $0x????xxxx,%[e]di
|
|
||||||
.short \address>>4
|
|
||||||
.byte 0x8e,0xc7 # mov %di,%es
|
|
||||||
.byte 0xbf # mov $0x????xxxx,%[e]di
|
|
||||||
.short \address&0xf
|
|
||||||
jmp 297f
|
|
||||||
.byte 0xbf # mov $0x????xxxx,%edi
|
|
||||||
.long \address
|
|
||||||
297:
|
|
||||||
.endm
|
|
||||||
|
|
||||||
// Loads 16-bit CONSTEXPR into Qw-register w/ optional zero-extend.
|
|
||||||
// @mode long,legacy,real
|
|
||||||
.macro bbmov constexpr:req abcd abcd.hi:req abcd.lo:req
|
|
||||||
.ifnb \abcd
|
|
||||||
.if (\constexpr)<128 && (\constexpr)>=0
|
|
||||||
pushpop \constexpr,\abcd
|
|
||||||
.exitm
|
|
||||||
.endif
|
|
||||||
.endif
|
|
||||||
movb $(\constexpr)>>8&0xff,\abcd.hi
|
|
||||||
movb $(\constexpr)&0xff,\abcd.lo
|
|
||||||
.endm
|
|
||||||
|
|
||||||
// Compares 16-bit CONSTEXPR with Qw-register.
|
|
||||||
// @mode long,legacy,real
|
|
||||||
.macro bbcmp constexpr:req abcd.hi:req abcd.lo:req
|
|
||||||
cmpb $(\constexpr)>>8&0xff,\abcd.hi
|
|
||||||
jnz 387f
|
|
||||||
cmpb $(\constexpr)&0xff,\abcd.lo
|
|
||||||
387:
|
|
||||||
.endm
|
|
||||||
|
|
||||||
// Adds 16-bit CONSTEXPR to Qw-register.
|
|
||||||
// @mode long,legacy,real
|
|
||||||
.macro bbadd constexpr:req abcd.hi:req abcd.lo:req
|
|
||||||
addb $(\constexpr)&0xff,\abcd.lo
|
|
||||||
.if (\constexpr) != 0
|
|
||||||
adcb $(\constexpr)>>8&0xff,\abcd.hi
|
|
||||||
.endif
|
|
||||||
.endm
|
|
||||||
|
|
||||||
// Subtracts 16-bit CONSTEXPR from Qw-register.
|
|
||||||
// @mode long,legacy,real
|
|
||||||
.macro bbsub constexpr:req abcd.hi:req abcd.lo:req
|
|
||||||
subb $(\constexpr)&0xff,\abcd.lo
|
|
||||||
.if (\constexpr) != 0
|
|
||||||
sbbb $(\constexpr)>>8&0xff,\abcd.hi
|
|
||||||
.endif
|
|
||||||
.endm
|
|
||||||
|
|
||||||
// Ands Qw-register with 16-bit CONSTEXPR.
|
|
||||||
// @mode long,legacy,real
|
|
||||||
.macro bband constexpr:req abcd.hi:req abcd.lo:req
|
|
||||||
.if ((\constexpr)&0xff) != 0xff || ((\constexpr)>>8&0xff) == 0xff
|
|
||||||
andb $(\constexpr)&0xff,\abcd.lo
|
|
||||||
.endif
|
|
||||||
.if ((\constexpr)>>8&0xff) != 0xff
|
|
||||||
andb $(\constexpr)>>8&0xff,\abcd.hi
|
|
||||||
.endif
|
|
||||||
.endm
|
|
||||||
|
|
||||||
// Ors Qw-register with 16-bit CONSTEXPR.
|
|
||||||
// @mode long,legacy,real
|
|
||||||
.macro bbor constexpr:req abcd.hi:req abcd.lo:req
|
|
||||||
.if ((\constexpr)&0xff) != 0 || ((\constexpr)>>8&0xff) != 0
|
|
||||||
orb $(\constexpr)&0xff,\abcd.lo
|
|
||||||
.endif
|
|
||||||
.if ((\constexpr)>>8&0xff) != 0
|
|
||||||
orb $(\constexpr)>>8&0xff,\abcd.hi
|
|
||||||
.endif
|
|
||||||
.endm
|
|
||||||
|
|
||||||
// Performs ACTION only if in real mode.
|
|
||||||
// @mode long,legacy,real
|
|
||||||
.macro rlo clobber:req action:vararg
|
|
||||||
990: mov $0,\clobber
|
|
||||||
.if .-990b!=3
|
|
||||||
.error "bad clobber or assembler mode"
|
|
||||||
.endif
|
|
||||||
991: \action
|
|
||||||
.rept 2-(.-991b)
|
|
||||||
nop
|
|
||||||
.endr
|
|
||||||
.if .-991b!=2
|
|
||||||
.error "ACTION must be 1-2 bytes"
|
|
||||||
.endif
|
|
||||||
.endm
|
|
||||||
|
|
||||||
// Initializes real mode stack.
|
// Initializes real mode stack.
|
||||||
// The most holiest of holy code.
|
// The most holiest of holy code.
|
||||||
// @mode real
|
// @mode real
|
||||||
|
|
|
@ -10,11 +10,6 @@
|
||||||
#define lz4decode __lz4decode
|
#define lz4decode __lz4decode
|
||||||
|
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
#if 0
|
|
||||||
/*───────────────────────────────────────────────────────────────────────────│─╗
|
|
||||||
│ cosmopolitan § standard library » compression ─╬─│┼
|
|
||||||
╚────────────────────────────────────────────────────────────────────────────│*/
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct RlDecode {
|
struct RlDecode {
|
||||||
uint8_t repititions;
|
uint8_t repititions;
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_NEXGEN32E_MACROS_H_
|
|
||||||
#define COSMOPOLITAN_LIBC_NEXGEN32E_MACROS_H_
|
|
||||||
#ifdef __ASSEMBLER__
|
|
||||||
#include "libc/nexgen32e/macros.internal.inc"
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* let's give auto-import tooling a helping hand */
|
|
||||||
#define pbroadcastb pbroadcastb
|
|
||||||
|
|
||||||
#endif /* __ASSEMBLER__ */
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_NEXGEN32E_MACROS_H_ */
|
|
|
@ -1,89 +0,0 @@
|
||||||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
|
||||||
│ vi: set noet ft=asm ts=8 sw=8 fenc=utf-8 :vi │
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
|
||||||
│ │
|
|
||||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
|
||||||
│ any purpose with or without fee is hereby granted, provided that the │
|
|
||||||
│ above copyright notice and this permission notice appear in all copies. │
|
|
||||||
│ │
|
|
||||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
|
||||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
|
||||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
|
||||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
|
||||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
|
||||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
#include "libc/macros.internal.h"
|
|
||||||
#include "libc/nexgen32e/x86feature.h"
|
|
||||||
|
|
||||||
// Broadcast byte literal to vector, e.g.
|
|
||||||
//
|
|
||||||
// # xmm0=0x12121212121212121212121212121212
|
|
||||||
// .bcblit $0x12,%al,%eax,%xmm0
|
|
||||||
//
|
|
||||||
// @param reg and regSI need to be the same register
|
|
||||||
.macro .bcblit lit:req reg:req regSI:req xmm:req
|
|
||||||
mov \lit,\reg
|
|
||||||
movd \regSI,\xmm
|
|
||||||
pbroadcastb \xmm
|
|
||||||
.endm
|
|
||||||
|
|
||||||
// Broadcast word literal to vector, e.g.
|
|
||||||
//
|
|
||||||
// # xmm0=0x01230123012301230123012301230123
|
|
||||||
// .bcwlit $0x123,%ax,%eax,%xmm0
|
|
||||||
//
|
|
||||||
// @param reg and regSI need to be the same register
|
|
||||||
.macro .bcwlit lit:req reg:req regSI:req xmm:req
|
|
||||||
mov \lit,\reg
|
|
||||||
movd \regSI,\xmm
|
|
||||||
pbroadcastw \xmm
|
|
||||||
.endm
|
|
||||||
|
|
||||||
// Broadcast int16 from register to vector.
|
|
||||||
.macro .bcwreg regSI:req xmm:req
|
|
||||||
movd \regSI,\xmm
|
|
||||||
pbroadcastw \xmm
|
|
||||||
.endm
|
|
||||||
|
|
||||||
// Sets all bytes in XMM register to first byte, e.g.
|
|
||||||
//
|
|
||||||
// mov $0x11,%eax
|
|
||||||
// movd %eax,%xmm0
|
|
||||||
// pbroadcastb %xmm0
|
|
||||||
//
|
|
||||||
// 11000000000000000000000000000000
|
|
||||||
// → 11111111111111111111111111111111
|
|
||||||
//
|
|
||||||
// @param xmm can be %xmm0,%xmm1,etc.
|
|
||||||
.macro pbroadcastb xmm:req
|
|
||||||
#if X86_NEED(AVX2)
|
|
||||||
vpbroadcastb \xmm,\xmm
|
|
||||||
#else
|
|
||||||
punpcklbw \xmm,\xmm
|
|
||||||
punpcklwd \xmm,\xmm
|
|
||||||
pshufd $0,\xmm,\xmm
|
|
||||||
#endif
|
|
||||||
.endm
|
|
||||||
|
|
||||||
// Sets all words in XMM register to first word, e.g.
|
|
||||||
//
|
|
||||||
// mov $0x1234,%eax
|
|
||||||
// movd %eax,%xmm0
|
|
||||||
// pbroadcastw %xmm0
|
|
||||||
//
|
|
||||||
// 12340000000000000000000000000000
|
|
||||||
// → 12341234123412341234123412341234
|
|
||||||
//
|
|
||||||
// @param xmm can be %xmm0,%xmm1,etc.
|
|
||||||
.macro pbroadcastw xmm:req
|
|
||||||
#if X86_NEED(AVX2)
|
|
||||||
vpbroadcastw \xmm,\xmm
|
|
||||||
#else
|
|
||||||
punpcklwd \xmm,\xmm
|
|
||||||
pshufd $0,\xmm,\xmm
|
|
||||||
#endif
|
|
||||||
.endm
|
|
|
@ -1,54 +0,0 @@
|
||||||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
|
||||||
│ vi: set noet ft=asm ts=8 sw=8 fenc=utf-8 :vi │
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
|
||||||
│ │
|
|
||||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
|
||||||
│ any purpose with or without fee is hereby granted, provided that the │
|
|
||||||
│ above copyright notice and this permission notice appear in all copies. │
|
|
||||||
│ │
|
|
||||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
|
||||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
|
||||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
|
||||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
|
||||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
|
||||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
|
|
||||||
// Documentation for Intel(R)'s “Most Complicated Instruction”(TM)
|
|
||||||
//
|
|
||||||
// mnemonic op1 op2 op3 op4 modif f description, notes
|
|
||||||
// ═══════════ ════ ════ ════ ═══ ════════ ═════════════════════════════
|
|
||||||
// PCMPESTRM XMM0 Vdq Wdq ... o..szapc Explicit Length, Return Mask
|
|
||||||
// PCMPESTRI rCX Vdq Wdq ... o..szapc Explicit Length, Return Index
|
|
||||||
// PCMPISTRM XMM0 Vdq Wdq Ib o..szapc Implicit Length, Return Mask
|
|
||||||
// PCMPISTRI rCX Vdq Wdq Ib o..szapc Implicit Length, Return Index
|
|
||||||
//
|
|
||||||
// CF ← Reset if IntRes2 is equal to zero, set otherwise
|
|
||||||
// ZF ← Set if any byte/word of xmm2/mem128 is null, reset otherwise
|
|
||||||
// SF ← Set if any byte/word of xmm1 is null, reset otherwise
|
|
||||||
// OF ← IntRes2[0]
|
|
||||||
// AF ← Reset
|
|
||||||
// PF ← Reset
|
|
||||||
//
|
|
||||||
// PCMP{E,I}STR{I,M} Control Byte
|
|
||||||
// @see Intel Manual V.2B §4.1.7
|
|
||||||
//
|
|
||||||
// ┌─0:index of the LEAST significant, set, bit is used
|
|
||||||
// │ regardless of corresponding input element validity
|
|
||||||
// │ intres2 is returned in least significant bits of xmm0
|
|
||||||
// ├─1:index of the MOST significant, set, bit is used
|
|
||||||
// │ regardless of corresponding input element validity
|
|
||||||
// │ each bit of intres2 is expanded to byte/word
|
|
||||||
// │┌─0:negation of intres1 is for all 16 (8) bits
|
|
||||||
// │├─1:negation of intres1 is masked by reg/mem validity
|
|
||||||
// ││┌─intres1 is negated (1’s complement)
|
|
||||||
// │││┌─mode{equalany,ranges,equaleach,equalordered}
|
|
||||||
// ││││ ┌─issigned
|
|
||||||
// ││││ │┌─is16bit
|
|
||||||
// u│││├┐││
|
|
||||||
.Lequalordered = 0b00001100
|
|
||||||
.Lequalorder16 = 0b00001101
|
|
||||||
.Lequalranges8 = 0b00000100
|
|
|
@ -1,41 +0,0 @@
|
||||||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
|
||||||
│ vi: set noet ft=asm ts=8 sw=8 fenc=utf-8 :vi │
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
|
||||||
│ │
|
|
||||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
|
||||||
│ any purpose with or without fee is hereby granted, provided that the │
|
|
||||||
│ above copyright notice and this permission notice appear in all copies. │
|
|
||||||
│ │
|
|
||||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
|
||||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
|
||||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
|
||||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
|
||||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
|
||||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
#include "libc/macros.internal.h"
|
|
||||||
|
|
||||||
// Support code for fast integer division by Si units.
|
|
||||||
//
|
|
||||||
// Division by magnums is described in Hacker's Delight and is
|
|
||||||
// usually generated automatically by compilers, but sadly not
|
|
||||||
// when we optimize for size and idiv goes at least 10x slower
|
|
||||||
// so we do this which saves space while avoiding build tuning
|
|
||||||
//
|
|
||||||
// @param rdi is number to divide
|
|
||||||
// @param cl is magnum #1
|
|
||||||
// @param rdx is magnum #2
|
|
||||||
// @return quotient
|
|
||||||
tinydivsi:
|
|
||||||
.leafprologue
|
|
||||||
mov %rdi,%rax
|
|
||||||
imul %rdx
|
|
||||||
mov %rdx,%rax
|
|
||||||
sar %cl,%rax
|
|
||||||
sar $63,%rdi
|
|
||||||
sub %rdi,%rax
|
|
||||||
.leafepilogue
|
|
||||||
.endfn tinydivsi,globl
|
|
|
@ -1,36 +0,0 @@
|
||||||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
|
||||||
│ vi: set noet ft=asm ts=8 sw=8 fenc=utf-8 :vi │
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
|
||||||
│ │
|
|
||||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
|
||||||
│ any purpose with or without fee is hereby granted, provided that the │
|
|
||||||
│ above copyright notice and this permission notice appear in all copies. │
|
|
||||||
│ │
|
|
||||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
|
||||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
|
||||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
|
||||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
|
||||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
|
||||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
#include "libc/macros.internal.h"
|
|
||||||
|
|
||||||
// 32-bit strlen that's tiny and near optimal if data's tiny.
|
|
||||||
//
|
|
||||||
// @param RDI is wchar_t *s
|
|
||||||
// @param EAX is unsigned length
|
|
||||||
// @see libc/nexgen32e/strsak32.S
|
|
||||||
.ftrace1
|
|
||||||
tinywcslen:
|
|
||||||
.ftrace2
|
|
||||||
.leafprologue
|
|
||||||
xor %eax,%eax
|
|
||||||
1: cmpl $0,(%rdi,%rax,4)
|
|
||||||
jz 2f
|
|
||||||
inc %eax
|
|
||||||
jmp 1b
|
|
||||||
2: .leafepilogue
|
|
||||||
.endfn tinywcslen,globl
|
|
|
@ -1,39 +0,0 @@
|
||||||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
|
||||||
│ vi: set noet ft=asm ts=8 sw=8 fenc=utf-8 :vi │
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
|
||||||
│ │
|
|
||||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
|
||||||
│ any purpose with or without fee is hereby granted, provided that the │
|
|
||||||
│ above copyright notice and this permission notice appear in all copies. │
|
|
||||||
│ │
|
|
||||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
|
||||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
|
||||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
|
||||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
|
||||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
|
||||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
#include "libc/macros.internal.h"
|
|
||||||
|
|
||||||
// 32-bit strnlen that's tiny and near optimal if data's tiny.
|
|
||||||
//
|
|
||||||
// @param RDI is wchar_t *s
|
|
||||||
// @param RSI is size_t n
|
|
||||||
// @param EAX is unsigned length
|
|
||||||
// @see libc/nexgen32e/strsak32.S
|
|
||||||
.ftrace1
|
|
||||||
tinywcsnlen:
|
|
||||||
.ftrace2
|
|
||||||
.leafprologue
|
|
||||||
xor %eax,%eax
|
|
||||||
1: cmp %esi,%eax
|
|
||||||
jae 2f
|
|
||||||
cmpl $0,(%rdi,%rax,4)
|
|
||||||
jz 2f
|
|
||||||
inc %eax
|
|
||||||
jmp 1b
|
|
||||||
2: .leafepilogue
|
|
||||||
.endfn tinywcsnlen,globl
|
|
|
@ -1,81 +0,0 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_NEXGEN32E_VIDYA_H_
|
|
||||||
#define COSMOPOLITAN_LIBC_NEXGEN32E_VIDYA_H_
|
|
||||||
|
|
||||||
#define VIDYA_ROWS 25
|
|
||||||
#define VIDYA_COLUMNS 80
|
|
||||||
#define VIDYA_SIZE (VIDYA_ROWS * VIDYA_COLUMNS * 2)
|
|
||||||
#define VIDYA_MODE_MDA 7
|
|
||||||
#define VIDYA_MODE_CGA 3
|
|
||||||
#define VIDYA_ADDR_MDA 0xb0000
|
|
||||||
#define VIDYA_ADDR_CGA 0xb8000
|
|
||||||
#define VIDYA_ATTR_NORMAL 0x07 /* cozy default for both mda and cga */
|
|
||||||
#define VIDYA_REWIND ~0x7fff /* derived from mode addr min. lzcnt */
|
|
||||||
#define VIDYA_SERVICE 0x10
|
|
||||||
#define VIDYA_SET_MODE 0x0003
|
|
||||||
#define VIDYA_SET_CURSOR 0x0100
|
|
||||||
#define VIDYA_SET_CURSOR_NONE 0x2000
|
|
||||||
#define VIDYA_SET_BLINKING 0x1003
|
|
||||||
#define VIDYA_SET_BLINKING_NONE 0x0000
|
|
||||||
|
|
||||||
|
|
||||||
enum VidyaMode {
|
|
||||||
kVidyaModeMda = VIDYA_MODE_MDA,
|
|
||||||
kVidyaModeCga = VIDYA_MODE_CGA
|
|
||||||
};
|
|
||||||
|
|
||||||
enum VidyaColor {
|
|
||||||
kVidyaColorBlack = 0x0,
|
|
||||||
kVidyaColorBlue = 0x1,
|
|
||||||
kVidyaColorGreen = 0x2,
|
|
||||||
kVidyaColorCyan = 0x3,
|
|
||||||
kVidyaColorRed = 0x4,
|
|
||||||
kVidyaColorMagenta = 0x5,
|
|
||||||
kVidyaColorBrown = 0x6,
|
|
||||||
kVidyaColorLightGray = 0x7,
|
|
||||||
kVidyaColorDarkGray = 0x8,
|
|
||||||
kVidyaColorLightBlue = 0x9,
|
|
||||||
kVidyaColorLightGreen = 0xa,
|
|
||||||
kVidyaColorLightCyan = 0xb,
|
|
||||||
kVidyaColorLightRed = 0xc,
|
|
||||||
kVidyaColorLightMagenta = 0xd,
|
|
||||||
kVidyaColorYellow = 0xe,
|
|
||||||
kVidyaColorWhite = 0xf
|
|
||||||
};
|
|
||||||
|
|
||||||
struct thatispacked VidyaCell {
|
|
||||||
unsigned glyph : 8; /* IBM Code Page 437 */
|
|
||||||
union VidyaAttr {
|
|
||||||
enum {
|
|
||||||
kVidyaAttrBlank = 0x00,
|
|
||||||
kVidyaAttrNormal = VIDYA_ATTR_NORMAL,
|
|
||||||
kVidyaAttrMdaFlipped = 0x70,
|
|
||||||
kVidyaAttrMdaFlippedFaded = 0x78,
|
|
||||||
kVidyaAttrMdaFlippedIntense = 0xf0,
|
|
||||||
kVidyaAttrMdaFlippedFadedIntense = 0xf8
|
|
||||||
} preset : 8;
|
|
||||||
struct VidyaTextDecoration { /* MDA Only */
|
|
||||||
unsigned underline : 1;
|
|
||||||
unsigned __ignore1 : 1;
|
|
||||||
unsigned bold : 1;
|
|
||||||
unsigned __ignore2 : 3;
|
|
||||||
unsigned intense : 1;
|
|
||||||
} decoration;
|
|
||||||
struct { /* CGA Only */
|
|
||||||
enum VidyaColor fg : 4;
|
|
||||||
enum VidyaColor bg : 4;
|
|
||||||
} color;
|
|
||||||
} attr;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef union VidyaAttr VidyaAttr;
|
|
||||||
typedef struct VidyaCell VidyaCell;
|
|
||||||
typedef struct VidyaCell VidyaPage[VIDYA_ROWS][VIDYA_COLUMNS];
|
|
||||||
|
|
||||||
__far VidyaPage *vinit(enum VidyaMode mode);
|
|
||||||
__far VidyaPage *vcls(__far VidyaCell *pos);
|
|
||||||
__far VidyaCell *vputc(__far VidyaCell *pos, int c);
|
|
||||||
__far VidyaCell *vputs(__far VidyaCell *pos, const char *str);
|
|
||||||
__far VidyaCell *vtput(__far VidyaCell *pos, const void *data, size_t size);
|
|
||||||
__far VidyaCell *vscroll(__far VidyaCell *pos, size_t bytes);
|
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_NEXGEN32E_VIDYA_H_ */
|
|
|
@ -1,33 +0,0 @@
|
||||||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
|
||||||
│ vi: set noet ft=asm ts=8 sw=8 fenc=utf-8 :vi │
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
|
||||||
│ │
|
|
||||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
|
||||||
│ any purpose with or without fee is hereby granted, provided that the │
|
|
||||||
│ above copyright notice and this permission notice appear in all copies. │
|
|
||||||
│ │
|
|
||||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
|
||||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
|
||||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
|
||||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
|
||||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
|
||||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
|
|
||||||
// Reconfigures transcendental math coprocessor.
|
|
||||||
//
|
|
||||||
// @param \conf can be absent to restore default
|
|
||||||
// @clob x87 status and control words only
|
|
||||||
// @see Intel Manual V.1 §8.1.5
|
|
||||||
// @mode long,legacy
|
|
||||||
.macro x87conf conf=$0x33f
|
|
||||||
push %ax
|
|
||||||
pushw \conf
|
|
||||||
fclex
|
|
||||||
fldcw (%rsp)
|
|
||||||
pop %ax
|
|
||||||
pop %ax
|
|
||||||
.endm
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
#include "libc/thread/pt.internal.h"
|
#include "libc/thread/pt.internal.h"
|
||||||
#include "libc/nexgen32e/macros.h"
|
|
||||||
|
|
||||||
#define SIG_IGN 1
|
#define SIG_IGN 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue