diff --git a/CMakeLists.txt b/CMakeLists.txt index 8eb194390d..3bc32614f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -597,11 +597,7 @@ if(MSVC) elseif(MINGW) set(ZIG_HOST_TARGET_ABI "-gnu") elseif(ZIG_HOST_TARGET_IS_ANDROID) - if(ZIG_HOST_TARGET_ARCH STREQUAL "arm") - set(ZIG_HOST_TARGET_ABI "-androidsf") - else() - set(ZIG_HOST_TARGET_ABI "-android") - endif() + set(ZIG_HOST_TARGET_ABI "-android") else() check_symbol_exists(__GLIBC__ "features.h" ZIG_HOST_TARGET_IS_GLIBC) if(ZIG_HOST_TARGET_IS_GLIBC) diff --git a/lib/libc/freebsd/lib/csu/powerpc/crt.h b/lib/libc/freebsd/lib/csu/powerpc/crt.h deleted file mode 100644 index 90da2bb9ca..0000000000 --- a/lib/libc/freebsd/lib/csu/powerpc/crt.h +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-1-Clause - * - * Copyright 2018 Andrew Turner - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _CRT_H_ -#define _CRT_H_ - -/* zig patch: no HAVE_CTORS/CTORS_CONSTRUCTORS */ -#define INIT_CALL_SEQ(func) "bl " __STRING(func) "; nop" - -#endif diff --git a/lib/libc/freebsd/lib/csu/powerpc/crt1_c.c b/lib/libc/freebsd/lib/csu/powerpc/crt1_c.c deleted file mode 100644 index 656ca9cde9..0000000000 --- a/lib/libc/freebsd/lib/csu/powerpc/crt1_c.c +++ /dev/null @@ -1,89 +0,0 @@ -/* LINTLIBRARY */ -/*- - * SPDX-License-Identifier: BSD-4-Clause - * - * Copyright 2001 David E. O'Brien. - * All rights reserved. - * Copyright 1996-1998 John D. Polstra. - * All rights reserved. - * Copyright (c) 1997 Jason R. Thorpe. - * Copyright (c) 1995 Christopher G. Demetriou - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed for the - * FreeBSD Project. See https://www.freebsd.org/ for - * information about FreeBSD. - * This product includes software developed for the - * NetBSD Project. See http://www.netbsd.org/ for - * information about NetBSD. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include - -#include "libc_private.h" -#include "csu_common.h" - -struct Struct_Obj_Entry; -struct ps_strings; - -struct ps_strings *__ps_strings; - -void _start(int, char **, char **, const struct Struct_Obj_Entry *, - void (*)(void), struct ps_strings *) __dead2; - -/* The entry function. */ -/* - * First 5 arguments are specified by the PowerPC SVR4 ABI. - * The last argument, ps_strings, is a BSD extension. - */ -/* ARGSUSED */ -void -_start(int argc, char **argv, char **env, - const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void), - struct ps_strings *ps_strings) -{ - if (ps_strings != (struct ps_strings *)0) - __ps_strings = ps_strings; - -#ifdef GCRT - __libc_start1_gcrt(argc, argv, env, cleanup, main, &eprol, &etext); -#else - __libc_start1(argc, argv, env, cleanup, main); -#endif -} - -#ifdef GCRT -__asm__(".text"); -__asm__("eprol:"); -__asm__(".previous"); -#endif - -#ifndef PIC -__asm__(".text\n" - "\t.global _GLOBAL_OFFSET_TABLE_\n" - "\t.reloc 0, R_PPC_NONE, _GLOBAL_OFFSET_TABLE_"); -#endif diff --git a/lib/libc/freebsd/lib/csu/powerpc/crtsavres.S b/lib/libc/freebsd/lib/csu/powerpc/crtsavres.S deleted file mode 100644 index 95ac717121..0000000000 --- a/lib/libc/freebsd/lib/csu/powerpc/crtsavres.S +++ /dev/null @@ -1,189 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-1-Clause - * - * Copyright 2019 Justin Hibbits - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -.text - -/* - * The PowerPC ABI spec requires the following save/restore functions to be - * provided: - * - * _savefpr_N - * _restfpr_N - * _restfpr_N_x - * _savegpr_N - * _restgpr_N - * _restgpr_N_x - * - * With N ranging from 14 to 31, to save the nonvolatile registers. - */ - -#define _CRTENTRY(name) \ - .text; \ - .globl name; \ - .type name,@function; \ - name: - -#define SAVEFPR(r) _CRTENTRY(__CONCAT(_savefpr_,r)) \ - stfd r,(-256 + r * 8)(11) - -SAVEFPR(14) -SAVEFPR(15) -SAVEFPR(16) -SAVEFPR(17) -SAVEFPR(18) -SAVEFPR(19) -SAVEFPR(20) -SAVEFPR(21) -SAVEFPR(22) -SAVEFPR(23) -SAVEFPR(24) -SAVEFPR(25) -SAVEFPR(26) -SAVEFPR(27) -SAVEFPR(28) -SAVEFPR(29) -SAVEFPR(30) -SAVEFPR(31) - blr - -#define RESTFPR(r) _CRTENTRY(__CONCAT(_restfpr_,r)) \ - lfd r,(-256 + r * 8)(11) - -RESTFPR(14) -RESTFPR(15) -RESTFPR(16) -RESTFPR(17) -RESTFPR(18) -RESTFPR(19) -RESTFPR(20) -RESTFPR(21) -RESTFPR(22) -RESTFPR(23) -RESTFPR(24) -RESTFPR(25) -RESTFPR(26) -RESTFPR(27) -RESTFPR(28) -RESTFPR(29) -RESTFPR(30) -RESTFPR(31) - blr - -#define SAVEGPR(r) _CRTENTRY(__CONCAT(_savegpr_,r)) \ - stw r,(-128 + r * 4)(11) - -SAVEGPR(14) -SAVEGPR(15) -SAVEGPR(16) -SAVEGPR(17) -SAVEGPR(18) -SAVEGPR(19) -SAVEGPR(20) -SAVEGPR(21) -SAVEGPR(22) -SAVEGPR(23) -SAVEGPR(24) -SAVEGPR(25) -SAVEGPR(26) -SAVEGPR(27) -SAVEGPR(28) -SAVEGPR(29) -SAVEGPR(30) -SAVEGPR(31) - blr - -#define RESTGPR(r) _CRTENTRY(__CONCAT(_restgpr_,r)) \ - lwz r,(-128 + r*4)(11) - -RESTGPR(14) -RESTGPR(15) -RESTGPR(16) -RESTGPR(17) -RESTGPR(18) -RESTGPR(19) -RESTGPR(20) -RESTGPR(21) -RESTGPR(22) -RESTGPR(23) -RESTGPR(24) -RESTGPR(25) -RESTGPR(26) -RESTGPR(27) -RESTGPR(28) -RESTGPR(29) -RESTGPR(30) -RESTGPR(31) - blr - -#define RESTFPR_X(r) _CRTENTRY(__CONCAT(__CONCAT(_restfpr_,r),_x)) \ - lfd r,(-256 + r * 8)(11) - -RESTFPR_X(14) -RESTFPR_X(15) -RESTFPR_X(16) -RESTFPR_X(17) -RESTFPR_X(18) -RESTFPR_X(19) -RESTFPR_X(20) -RESTFPR_X(21) -RESTFPR_X(22) -RESTFPR_X(23) -RESTFPR_X(24) -RESTFPR_X(25) -RESTFPR_X(26) -RESTFPR_X(27) -RESTFPR_X(28) -RESTFPR_X(29) -RESTFPR_X(30) -RESTFPR_X(31) - lwz 0,4(11) - mtlr 0 - mr 1,11 - blr - -#define RESTGPR_X(r) _CRTENTRY(__CONCAT(__CONCAT(_restgpr_,r),_x)) \ - lwz r,(-128 + r * 4)(11) - -RESTGPR_X(14) -RESTGPR_X(15) -RESTGPR_X(16) -RESTGPR_X(17) -RESTGPR_X(18) -RESTGPR_X(19) -RESTGPR_X(20) -RESTGPR_X(21) -RESTGPR_X(22) -RESTGPR_X(23) -RESTGPR_X(24) -RESTGPR_X(25) -RESTGPR_X(26) -RESTGPR_X(27) -RESTGPR_X(28) -RESTGPR_X(29) -RESTGPR_X(30) -RESTGPR_X(31) - lwz 0,4(11) - mtlr 0 - mr 1,11 - blr diff --git a/lib/libc/include/x86-freebsd-none/machine/_bus.h b/lib/libc/include/x86-freebsd-none/machine/_bus.h deleted file mode 100644 index 5f916269fe..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/_bus.h +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * Copyright (c) 2005 The FreeBSD Foundation. - * - * SPDX-License-Identifier: BSD-2-Clause - * - * Derived in part from NetBSD's bus.h files by (alphabetically): - * Christopher G. Demetriou - * Charles M. Hannum - * Jason Thorpe - * The NetBSD Foundation. - */ - -#ifndef I386_INCLUDE__BUS_H -#define I386_INCLUDE__BUS_H - -/* - * Bus address and size types - */ -#ifdef PAE -typedef uint64_t bus_addr_t; -#else -typedef uint32_t bus_addr_t; -#endif -typedef uint32_t bus_size_t; - -/* - * Access methods for bus resources and address space. - */ -typedef int bus_space_tag_t; -typedef u_int bus_space_handle_t; - -#endif /* I386_INCLUDE__BUS_H */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/apm_segments.h b/lib/libc/include/x86-freebsd-none/machine/apm_segments.h deleted file mode 100644 index 3d3f36d64e..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/apm_segments.h +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * LP (Laptop Package) - * - * Copyright (C) 1994 by HOSOKAWA Tatsumi - * - * This software may be used, modified, copied, and distributed, in - * both source and binary form provided that the above copyright and - * these terms are retained. Under no circumstances is the author - * responsible for the proper functioning of this software, nor does - * the author assume any responsibility for damages incurred with its - * use. - * - * Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) - */ - -#ifndef _MACHINE_APM_SEGMENTS_H -#define _MACHINE_APM_SEGMENTS_H - -#define SIZEOF_GDT 8 -#define BOOTSTRAP_GDT_NUM 32 - -#define APM_INIT_CS_INDEX (BOOTSTRAP_GDT_NUM - 4) -#define APM_INIT_DS_INDEX (BOOTSTRAP_GDT_NUM - 3) -#define APM_INIT_CS16_INDEX (BOOTSTRAP_GDT_NUM - 2) -#define APM_INIT_DS16_INDEX (BOOTSTRAP_GDT_NUM - 1) -#define APM_INIT_CS_SEL (APM_INIT_CS_INDEX << 3) -#define APM_INIT_DS_SEL (APM_INIT_DS_INDEX << 3) -#define APM_INIT_CS16_SEL (APM_INIT_CS16_INDEX << 3) -#define APM_INIT_DS16_SEL (APM_INIT_DS16_INDEX << 3) - -#define CS32_ATTRIB 0x409e -#define DS32_ATTRIB 0x4092 -#define CS16_ATTRIB 0x009e -#define DS16_ATTRIB 0x0092 - -#endif \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/asm.h b/lib/libc/include/x86-freebsd-none/machine/asm.h deleted file mode 100644 index 7a0b90fc1d..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/asm.h +++ /dev/null @@ -1,130 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_ASM_H_ -#define _MACHINE_ASM_H_ - -#include - -#ifdef PIC -#define PIC_PROLOGUE \ - pushl %ebx; \ - call 1f; \ -1: \ - popl %ebx; \ - addl $_GLOBAL_OFFSET_TABLE_+[.-1b],%ebx -#define PIC_EPILOGUE \ - popl %ebx -#define PIC_PLT(x) x@PLT -#define PIC_GOT(x) x@GOT(%ebx) -#define PIC_GOTOFF(x) x@GOTOFF(%ebx) -#else -#define PIC_PROLOGUE -#define PIC_EPILOGUE -#define PIC_PLT(x) x -#define PIC_GOTOFF(x) x -#endif - -/* - * CNAME and HIDENAME manage the relationship between symbol names in C - * and the equivalent assembly language names. CNAME is given a name as - * it would be used in a C program. It expands to the equivalent assembly - * language name. HIDENAME is given an assembly-language name, and expands - * to a possibly-modified form that will be invisible to C programs. - */ -#define CNAME(csym) csym -#define HIDENAME(asmsym) .asmsym - -/* XXX should use .p2align 4,0x90 for -m486. */ -#define _START_ENTRY .text; .p2align 2,0x90 - -#define _ENTRY(x) _START_ENTRY; \ - .globl CNAME(x); .type CNAME(x),@function; CNAME(x): \ - .cfi_startproc -#define END(x) .cfi_endproc; .size x, . - x - -#ifdef PROF -#define ALTENTRY(x) _ENTRY(x); \ - pushl %ebp; \ - .cfi_def_cfa_offset 8; \ - .cfi_offset %ebp, -8; \ - movl %esp,%ebp; \ - call PIC_PLT(HIDENAME(mcount)); \ - popl %ebp; \ - .cfi_restore %ebp; \ - .cfi_def_cfa_offset 4; \ - jmp 9f -#define ENTRY(x) _ENTRY(x); \ - pushl %ebp; \ - .cfi_def_cfa_offset 8; \ - .cfi_offset %ebp, -8; \ - movl %esp,%ebp; \ - call PIC_PLT(HIDENAME(mcount)); \ - popl %ebp; \ - .cfi_restore %ebp; \ - .cfi_def_cfa_offset 4; \ - 9: -#else -#define ALTENTRY(x) _ENTRY(x) -#define ENTRY(x) _ENTRY(x) -#endif - -/* - * WEAK_REFERENCE(): create a weak reference alias from sym. - * The macro is not a general asm macro that takes arbitrary names, - * but one that takes only C names. It does the non-null name - * translation inside the macro. - */ - -#define WEAK_REFERENCE(sym, alias) \ - .weak CNAME(alias); \ - .equ CNAME(alias),CNAME(sym) - -/* - * STRONG_ALIAS: create a strong alias. - */ -#define STRONG_ALIAS(alias,sym) \ - .globl alias; \ - alias = sym - -#define RCSID(x) .text; .asciz x - -#undef __FBSDID -#if !defined(STRIP_FBSDID) -#define __FBSDID(s) .ident s -#else -#define __FBSDID(s) /* nothing */ -#endif /* not STRIP_FBSDID */ - -#endif /* !_MACHINE_ASM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/asmacros.h b/lib/libc/include/x86-freebsd-none/machine/asmacros.h deleted file mode 100644 index 1be70fcbcd..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/asmacros.h +++ /dev/null @@ -1,181 +0,0 @@ -/* -*- mode: asm -*- */ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1993 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_ASMACROS_H_ -#define _MACHINE_ASMACROS_H_ - -#include - -/* XXX too much duplication in various asm*.h's. */ - -/* - * CNAME is used to manage the relationship between symbol names in C - * and the equivalent assembly language names. CNAME is given a name as - * it would be used in a C program. It expands to the equivalent assembly - * language name. - */ -#define CNAME(csym) csym - -#define ALIGN_DATA .p2align 2 /* 4 byte alignment, zero filled */ -#define ALIGN_TEXT .p2align 2,0x90 /* 4-byte alignment, nop filled */ -#define SUPERALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */ - -#define GEN_ENTRY(name) ALIGN_TEXT; .globl CNAME(name); \ - .type CNAME(name),@function; CNAME(name): -#define ENTRY(name) GEN_ENTRY(name) -#define ALTENTRY(name) GEN_ENTRY(name) -#define END(name) .size name, . - name - -#ifdef LOCORE - -#define GSEL_KPL 0x0020 /* GSEL(GCODE_SEL, SEL_KPL) */ -#define SEL_RPL_MASK 0x0003 - -/* - * Convenience macro for declaring interrupt entry points. - */ -#define IDTVEC(name) ALIGN_TEXT; .globl __CONCAT(X,name); \ - .type __CONCAT(X,name),@function; __CONCAT(X,name): - -/* - * Macros to create and destroy a trap frame. - */ - .macro PUSH_FRAME2 - pushal - pushl $0 - movw %ds,(%esp) - pushl $0 - movw %es,(%esp) - pushl $0 - movw %fs,(%esp) - movl %esp,%ebp - .endm - - .macro PUSH_FRAME - pushl $0 /* dummy error code */ - pushl $0 /* dummy trap type */ - PUSH_FRAME2 - .endm - -/* - * Access per-CPU data. - */ -#define PCPU(member) %fs:PC_ ## member - -#define PCPU_ADDR(member, reg) \ - movl %fs:PC_PRVSPACE, reg ; \ - addl $PC_ ## member, reg - -/* - * Setup the kernel segment registers. - */ - .macro SET_KERNEL_SREGS - movl $KDSEL, %eax /* reload with kernel's data segment */ - movl %eax, %ds - movl %eax, %es - movl $KPSEL, %eax /* reload with per-CPU data segment */ - movl %eax, %fs - .endm - - .macro NMOVE_STACKS - movl PCPU(KESP0), %edx - movl $TF_SZ, %ecx - testl $PSL_VM, TF_EFLAGS(%esp) - jz .L\@.1 - addl $VM86_STACK_SPACE, %ecx -.L\@.1: subl %ecx, %edx - movl %edx, %edi - movl %esp, %esi - rep; movsb - movl %edx, %esp - .endm - - .macro LOAD_KCR3 - call .L\@.1 -.L\@.1: popl %eax - movl (tramp_idleptd - .L\@.1)(%eax), %eax - movl %eax, %cr3 - .endm - - .macro MOVE_STACKS - LOAD_KCR3 - NMOVE_STACKS - .endm - - .macro KENTER - testl $PSL_VM, TF_EFLAGS(%esp) - jz .L\@.1 - LOAD_KCR3 - movl PCPU(CURPCB), %eax - testl $PCB_VM86CALL, PCB_FLAGS(%eax) - jnz .L\@.3 - NMOVE_STACKS - movl $handle_ibrs_entry,%edx - call *%edx - jmp .L\@.3 -.L\@.1: testb $SEL_RPL_MASK, TF_CS(%esp) - jz .L\@.3 -.L\@.2: MOVE_STACKS - movl $handle_ibrs_entry,%edx - call *%edx -.L\@.3: - .endm - -#endif /* LOCORE */ - -#ifdef __STDC__ -#define ELFNOTE(name, type, desctype, descdata...) \ -.pushsection .note.name, "a", @note ; \ - .align 4 ; \ - .long 2f - 1f /* namesz */ ; \ - .long 4f - 3f /* descsz */ ; \ - .long type ; \ -1:.asciz #name ; \ -2:.align 4 ; \ -3:desctype descdata ; \ -4:.align 4 ; \ -.popsection -#else /* !__STDC__, i.e. -traditional */ -#define ELFNOTE(name, type, desctype, descdata) \ -.pushsection .note.name, "a", @note ; \ - .align 4 ; \ - .long 2f - 1f /* namesz */ ; \ - .long 4f - 3f /* descsz */ ; \ - .long type ; \ -1:.asciz "name" ; \ -2:.align 4 ; \ -3:desctype descdata ; \ -4:.align 4 ; \ -.popsection -#endif /* __STDC__ */ - -#endif /* !_MACHINE_ASMACROS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/atomic.h b/lib/libc/include/x86-freebsd-none/machine/atomic.h deleted file mode 100644 index 63143fe5a3..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/atomic.h +++ /dev/null @@ -1,874 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 1998 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -#ifndef _MACHINE_ATOMIC_H_ -#define _MACHINE_ATOMIC_H_ - -#include - -#ifdef _KERNEL -#include -#include -#endif - -#ifndef __OFFSETOF_MONITORBUF -/* - * __OFFSETOF_MONITORBUF == __pcpu_offset(pc_monitorbuf). - * - * The open-coded number is used instead of the symbolic expression to - * avoid a dependency on sys/pcpu.h in machine/atomic.h consumers. - * An assertion in i386/vm_machdep.c ensures that the value is correct. - */ -#define __OFFSETOF_MONITORBUF 0x80 - -static __inline void -__mbk(void) -{ - - __asm __volatile("lock; addl $0,%%fs:%c0" - : : "i" (__OFFSETOF_MONITORBUF) : "memory", "cc"); -} - -static __inline void -__mbu(void) -{ - - __asm __volatile("lock; addl $0,(%%esp)" : : : "memory", "cc"); -} -#endif - -/* - * Various simple operations on memory, each of which is atomic in the - * presence of interrupts and multiple processors. - * - * atomic_set_char(P, V) (*(u_char *)(P) |= (V)) - * atomic_clear_char(P, V) (*(u_char *)(P) &= ~(V)) - * atomic_add_char(P, V) (*(u_char *)(P) += (V)) - * atomic_subtract_char(P, V) (*(u_char *)(P) -= (V)) - * - * atomic_set_short(P, V) (*(u_short *)(P) |= (V)) - * atomic_clear_short(P, V) (*(u_short *)(P) &= ~(V)) - * atomic_add_short(P, V) (*(u_short *)(P) += (V)) - * atomic_subtract_short(P, V) (*(u_short *)(P) -= (V)) - * - * atomic_set_int(P, V) (*(u_int *)(P) |= (V)) - * atomic_clear_int(P, V) (*(u_int *)(P) &= ~(V)) - * atomic_add_int(P, V) (*(u_int *)(P) += (V)) - * atomic_subtract_int(P, V) (*(u_int *)(P) -= (V)) - * atomic_swap_int(P, V) (return (*(u_int *)(P)); *(u_int *)(P) = (V);) - * atomic_readandclear_int(P) (return (*(u_int *)(P)); *(u_int *)(P) = 0;) - * - * atomic_set_long(P, V) (*(u_long *)(P) |= (V)) - * atomic_clear_long(P, V) (*(u_long *)(P) &= ~(V)) - * atomic_add_long(P, V) (*(u_long *)(P) += (V)) - * atomic_subtract_long(P, V) (*(u_long *)(P) -= (V)) - * atomic_swap_long(P, V) (return (*(u_long *)(P)); *(u_long *)(P) = (V);) - * atomic_readandclear_long(P) (return (*(u_long *)(P)); *(u_long *)(P) = 0;) - */ - -/* - * Always use lock prefixes. The result is slightly less optimal for - * UP systems, but it matters less now, and sometimes UP is emulated - * over SMP. - * - * The assembly is volatilized to avoid code chunk removal by the compiler. - * GCC aggressively reorders operations and memory clobbering is necessary - * in order to avoid that for memory barriers. - */ -#define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ -static __inline void \ -atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ -{ \ - __asm __volatile("lock; " OP \ - : "+m" (*p) \ - : CONS (V) \ - : "cc"); \ -} \ - \ -static __inline void \ -atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ -{ \ - __asm __volatile("lock; " OP \ - : "+m" (*p) \ - : CONS (V) \ - : "memory", "cc"); \ -} \ -struct __hack - -/* - * Atomic compare and set, used by the mutex functions. - * - * cmpset: - * if (*dst == expect) - * *dst = src - * - * fcmpset: - * if (*dst == *expect) - * *dst = src - * else - * *expect = *dst - * - * Returns 0 on failure, non-zero on success. - */ -#define ATOMIC_CMPSET(TYPE, CONS) \ -static __inline int \ -atomic_cmpset_##TYPE(volatile u_##TYPE *dst, u_##TYPE expect, u_##TYPE src) \ -{ \ - u_char res; \ - \ - __asm __volatile( \ - " lock; cmpxchg %3,%1 ; " \ - " sete %0 ; " \ - "# atomic_cmpset_" #TYPE " " \ - : "=q" (res), /* 0 */ \ - "+m" (*dst), /* 1 */ \ - "+a" (expect) /* 2 */ \ - : CONS (src) /* 3 */ \ - : "memory", "cc"); \ - return (res); \ -} \ - \ -static __inline int \ -atomic_fcmpset_##TYPE(volatile u_##TYPE *dst, u_##TYPE *expect, u_##TYPE src) \ -{ \ - u_char res; \ - \ - __asm __volatile( \ - " lock; cmpxchg %3,%1 ; " \ - " sete %0 ; " \ - "# atomic_fcmpset_" #TYPE " " \ - : "=q" (res), /* 0 */ \ - "+m" (*dst), /* 1 */ \ - "+a" (*expect) /* 2 */ \ - : CONS (src) /* 3 */ \ - : "memory", "cc"); \ - return (res); \ -} - -ATOMIC_CMPSET(char, "q"); -ATOMIC_CMPSET(short, "r"); -ATOMIC_CMPSET(int, "r"); - -/* - * Atomically add the value of v to the integer pointed to by p and return - * the previous value of *p. - */ -static __inline u_int -atomic_fetchadd_int(volatile u_int *p, u_int v) -{ - - __asm __volatile( - " lock; xaddl %0,%1 ; " - "# atomic_fetchadd_int" - : "+r" (v), /* 0 */ - "+m" (*p) /* 1 */ - : : "cc"); - return (v); -} - -static __inline int -atomic_testandset_int(volatile u_int *p, u_int v) -{ - u_char res; - - __asm __volatile( - " lock; btsl %2,%1 ; " - " setc %0 ; " - "# atomic_testandset_int" - : "=q" (res), /* 0 */ - "+m" (*p) /* 1 */ - : "Ir" (v & 0x1f) /* 2 */ - : "cc"); - return (res); -} - -static __inline int -atomic_testandclear_int(volatile u_int *p, u_int v) -{ - u_char res; - - __asm __volatile( - " lock; btrl %2,%1 ; " - " setc %0 ; " - "# atomic_testandclear_int" - : "=q" (res), /* 0 */ - "+m" (*p) /* 1 */ - : "Ir" (v & 0x1f) /* 2 */ - : "cc"); - return (res); -} - -/* - * We assume that a = b will do atomic loads and stores. Due to the - * IA32 memory model, a simple store guarantees release semantics. - * - * However, a load may pass a store if they are performed on distinct - * addresses, so we need Store/Load barrier for sequentially - * consistent fences in SMP kernels. We use "lock addl $0,mem" for a - * Store/Load barrier, as recommended by the AMD Software Optimization - * Guide, and not mfence. In the kernel, we use a private per-cpu - * cache line for "mem", to avoid introducing false data - * dependencies. In user space, we use the word at the top of the - * stack. - * - * For UP kernels, however, the memory of the single processor is - * always consistent, so we only need to stop the compiler from - * reordering accesses in a way that violates the semantics of acquire - * and release. - */ - -#if defined(_KERNEL) -#define __storeload_barrier() __mbk() -#else /* !_KERNEL */ -#define __storeload_barrier() __mbu() -#endif /* _KERNEL*/ - -#define ATOMIC_LOAD(TYPE) \ -static __inline u_##TYPE \ -atomic_load_acq_##TYPE(const volatile u_##TYPE *p) \ -{ \ - u_##TYPE res; \ - \ - res = *p; \ - __compiler_membar(); \ - return (res); \ -} \ -struct __hack - -#define ATOMIC_STORE(TYPE) \ -static __inline void \ -atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v) \ -{ \ - \ - __compiler_membar(); \ - *p = v; \ -} \ -struct __hack - -static __inline void -atomic_thread_fence_acq(void) -{ - - __compiler_membar(); -} - -static __inline void -atomic_thread_fence_rel(void) -{ - - __compiler_membar(); -} - -static __inline void -atomic_thread_fence_acq_rel(void) -{ - - __compiler_membar(); -} - -static __inline void -atomic_thread_fence_seq_cst(void) -{ - - __storeload_barrier(); -} - -#ifdef _KERNEL - -/* I486 does not support SMP or CMPXCHG8B. */ -static __inline int -atomic_cmpset_64_i386(volatile uint64_t *dst, uint64_t expect, uint64_t src) -{ - volatile uint32_t *p; - u_char res; - - p = (volatile uint32_t *)dst; - __asm __volatile( - " pushfl ; " - " cli ; " - " xorl %1,%%eax ; " - " xorl %2,%%edx ; " - " orl %%edx,%%eax ; " - " jne 1f ; " - " movl %4,%1 ; " - " movl %5,%2 ; " - "1: " - " sete %3 ; " - " popfl" - : "+A" (expect), /* 0 */ - "+m" (*p), /* 1 */ - "+m" (*(p + 1)), /* 2 */ - "=q" (res) /* 3 */ - : "r" ((uint32_t)src), /* 4 */ - "r" ((uint32_t)(src >> 32)) /* 5 */ - : "memory", "cc"); - return (res); -} - -static __inline int -atomic_fcmpset_64_i386(volatile uint64_t *dst, uint64_t *expect, uint64_t src) -{ - - if (atomic_cmpset_64_i386(dst, *expect, src)) { - return (1); - } else { - *expect = *dst; - return (0); - } -} - -static __inline uint64_t -atomic_load_acq_64_i386(const volatile uint64_t *p) -{ - const volatile uint32_t *q; - uint64_t res; - - q = (const volatile uint32_t *)p; - __asm __volatile( - " pushfl ; " - " cli ; " - " movl %1,%%eax ; " - " movl %2,%%edx ; " - " popfl" - : "=&A" (res) /* 0 */ - : "m" (*q), /* 1 */ - "m" (*(q + 1)) /* 2 */ - : "memory"); - return (res); -} - -static __inline void -atomic_store_rel_64_i386(volatile uint64_t *p, uint64_t v) -{ - volatile uint32_t *q; - - q = (volatile uint32_t *)p; - __asm __volatile( - " pushfl ; " - " cli ; " - " movl %%eax,%0 ; " - " movl %%edx,%1 ; " - " popfl" - : "=m" (*q), /* 0 */ - "=m" (*(q + 1)) /* 1 */ - : "A" (v) /* 2 */ - : "memory"); -} - -static __inline uint64_t -atomic_swap_64_i386(volatile uint64_t *p, uint64_t v) -{ - volatile uint32_t *q; - uint64_t res; - - q = (volatile uint32_t *)p; - __asm __volatile( - " pushfl ; " - " cli ; " - " movl %1,%%eax ; " - " movl %2,%%edx ; " - " movl %4,%2 ; " - " movl %3,%1 ; " - " popfl" - : "=&A" (res), /* 0 */ - "+m" (*q), /* 1 */ - "+m" (*(q + 1)) /* 2 */ - : "r" ((uint32_t)v), /* 3 */ - "r" ((uint32_t)(v >> 32))); /* 4 */ - return (res); -} - -static __inline int -atomic_cmpset_64_i586(volatile uint64_t *dst, uint64_t expect, uint64_t src) -{ - u_char res; - - __asm __volatile( - " lock; cmpxchg8b %1 ; " - " sete %0" - : "=q" (res), /* 0 */ - "+m" (*dst), /* 1 */ - "+A" (expect) /* 2 */ - : "b" ((uint32_t)src), /* 3 */ - "c" ((uint32_t)(src >> 32)) /* 4 */ - : "memory", "cc"); - return (res); -} - -static __inline int -atomic_fcmpset_64_i586(volatile uint64_t *dst, uint64_t *expect, uint64_t src) -{ - u_char res; - - __asm __volatile( - " lock; cmpxchg8b %1 ; " - " sete %0" - : "=q" (res), /* 0 */ - "+m" (*dst), /* 1 */ - "+A" (*expect) /* 2 */ - : "b" ((uint32_t)src), /* 3 */ - "c" ((uint32_t)(src >> 32)) /* 4 */ - : "memory", "cc"); - return (res); -} - -/* - * Architecturally always writes back some value to '*p' so will trigger - * a #GP(0) on read-only mappings. - */ -static __inline uint64_t -atomic_load_acq_64_i586(const volatile uint64_t *p) -{ - uint64_t res; - - __asm __volatile( - " movl %%ebx,%%eax ; " - " movl %%ecx,%%edx ; " - " lock; cmpxchg8b %1" - : "=&A" (res) /* 0 */ - : "m" (*p) /* 1 */ - : "memory", "cc"); - return (res); -} - -static __inline void -atomic_store_rel_64_i586(volatile uint64_t *p, uint64_t v) -{ - - __asm __volatile( - " movl %%eax,%%ebx ; " - " movl %%edx,%%ecx ; " - "1: " - " lock; cmpxchg8b %0 ; " - " jne 1b" - : "+m" (*p), /* 0 */ - "+A" (v) /* 1 */ - : : "ebx", "ecx", "memory", "cc"); -} - -static __inline uint64_t -atomic_swap_64_i586(volatile uint64_t *p, uint64_t v) -{ - - __asm __volatile( - " movl %%eax,%%ebx ; " - " movl %%edx,%%ecx ; " - "1: " - " lock; cmpxchg8b %0 ; " - " jne 1b" - : "+m" (*p), /* 0 */ - "+A" (v) /* 1 */ - : : "ebx", "ecx", "memory", "cc"); - return (v); -} - -static __inline int -atomic_cmpset_64(volatile uint64_t *dst, uint64_t expect, uint64_t src) -{ - - if ((cpu_feature & CPUID_CX8) == 0) - return (atomic_cmpset_64_i386(dst, expect, src)); - else - return (atomic_cmpset_64_i586(dst, expect, src)); -} - -static __inline int -atomic_fcmpset_64(volatile uint64_t *dst, uint64_t *expect, uint64_t src) -{ - - if ((cpu_feature & CPUID_CX8) == 0) - return (atomic_fcmpset_64_i386(dst, expect, src)); - else - return (atomic_fcmpset_64_i586(dst, expect, src)); -} - -static __inline uint64_t -atomic_load_acq_64(const volatile uint64_t *p) -{ - - if ((cpu_feature & CPUID_CX8) == 0) - return (atomic_load_acq_64_i386(p)); - else - return (atomic_load_acq_64_i586(p)); -} - -static __inline void -atomic_store_rel_64(volatile uint64_t *p, uint64_t v) -{ - - if ((cpu_feature & CPUID_CX8) == 0) - atomic_store_rel_64_i386(p, v); - else - atomic_store_rel_64_i586(p, v); -} - -static __inline uint64_t -atomic_swap_64(volatile uint64_t *p, uint64_t v) -{ - - if ((cpu_feature & CPUID_CX8) == 0) - return (atomic_swap_64_i386(p, v)); - else - return (atomic_swap_64_i586(p, v)); -} - -static __inline uint64_t -atomic_fetchadd_64(volatile uint64_t *p, uint64_t v) -{ - - for (;;) { - uint64_t t = *p; - if (atomic_cmpset_64(p, t, t + v)) - return (t); - } -} - -static __inline void -atomic_add_64(volatile uint64_t *p, uint64_t v) -{ - uint64_t t; - - for (;;) { - t = *p; - if (atomic_cmpset_64(p, t, t + v)) - break; - } -} - -static __inline void -atomic_subtract_64(volatile uint64_t *p, uint64_t v) -{ - uint64_t t; - - for (;;) { - t = *p; - if (atomic_cmpset_64(p, t, t - v)) - break; - } -} - -#endif /* _KERNEL */ - -ATOMIC_ASM(set, char, "orb %b1,%0", "iq", v); -ATOMIC_ASM(clear, char, "andb %b1,%0", "iq", ~v); -ATOMIC_ASM(add, char, "addb %b1,%0", "iq", v); -ATOMIC_ASM(subtract, char, "subb %b1,%0", "iq", v); - -ATOMIC_ASM(set, short, "orw %w1,%0", "ir", v); -ATOMIC_ASM(clear, short, "andw %w1,%0", "ir", ~v); -ATOMIC_ASM(add, short, "addw %w1,%0", "ir", v); -ATOMIC_ASM(subtract, short, "subw %w1,%0", "ir", v); - -ATOMIC_ASM(set, int, "orl %1,%0", "ir", v); -ATOMIC_ASM(clear, int, "andl %1,%0", "ir", ~v); -ATOMIC_ASM(add, int, "addl %1,%0", "ir", v); -ATOMIC_ASM(subtract, int, "subl %1,%0", "ir", v); - -ATOMIC_ASM(set, long, "orl %1,%0", "ir", v); -ATOMIC_ASM(clear, long, "andl %1,%0", "ir", ~v); -ATOMIC_ASM(add, long, "addl %1,%0", "ir", v); -ATOMIC_ASM(subtract, long, "subl %1,%0", "ir", v); - -#define ATOMIC_LOADSTORE(TYPE) \ - ATOMIC_LOAD(TYPE); \ - ATOMIC_STORE(TYPE) - -ATOMIC_LOADSTORE(char); -ATOMIC_LOADSTORE(short); -ATOMIC_LOADSTORE(int); -ATOMIC_LOADSTORE(long); - -#undef ATOMIC_ASM -#undef ATOMIC_LOAD -#undef ATOMIC_STORE -#undef ATOMIC_LOADSTORE - -static __inline int -atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src) -{ - - return (atomic_cmpset_int((volatile u_int *)dst, (u_int)expect, - (u_int)src)); -} - -static __inline int -atomic_fcmpset_long(volatile u_long *dst, u_long *expect, u_long src) -{ - - return (atomic_fcmpset_int((volatile u_int *)dst, (u_int *)expect, - (u_int)src)); -} - -static __inline u_long -atomic_fetchadd_long(volatile u_long *p, u_long v) -{ - - return (atomic_fetchadd_int((volatile u_int *)p, (u_int)v)); -} - -static __inline int -atomic_testandset_long(volatile u_long *p, u_int v) -{ - - return (atomic_testandset_int((volatile u_int *)p, v)); -} - -static __inline int -atomic_testandclear_long(volatile u_long *p, u_int v) -{ - - return (atomic_testandclear_int((volatile u_int *)p, v)); -} - -/* Read the current value and store a new value in the destination. */ -static __inline u_int -atomic_swap_int(volatile u_int *p, u_int v) -{ - - __asm __volatile( - " xchgl %1,%0 ; " - "# atomic_swap_int" - : "+r" (v), /* 0 */ - "+m" (*p)); /* 1 */ - return (v); -} - -static __inline u_long -atomic_swap_long(volatile u_long *p, u_long v) -{ - - return (atomic_swap_int((volatile u_int *)p, (u_int)v)); -} - -#define atomic_set_acq_char atomic_set_barr_char -#define atomic_set_rel_char atomic_set_barr_char -#define atomic_clear_acq_char atomic_clear_barr_char -#define atomic_clear_rel_char atomic_clear_barr_char -#define atomic_add_acq_char atomic_add_barr_char -#define atomic_add_rel_char atomic_add_barr_char -#define atomic_subtract_acq_char atomic_subtract_barr_char -#define atomic_subtract_rel_char atomic_subtract_barr_char -#define atomic_cmpset_acq_char atomic_cmpset_char -#define atomic_cmpset_rel_char atomic_cmpset_char -#define atomic_fcmpset_acq_char atomic_fcmpset_char -#define atomic_fcmpset_rel_char atomic_fcmpset_char - -#define atomic_set_acq_short atomic_set_barr_short -#define atomic_set_rel_short atomic_set_barr_short -#define atomic_clear_acq_short atomic_clear_barr_short -#define atomic_clear_rel_short atomic_clear_barr_short -#define atomic_add_acq_short atomic_add_barr_short -#define atomic_add_rel_short atomic_add_barr_short -#define atomic_subtract_acq_short atomic_subtract_barr_short -#define atomic_subtract_rel_short atomic_subtract_barr_short -#define atomic_cmpset_acq_short atomic_cmpset_short -#define atomic_cmpset_rel_short atomic_cmpset_short -#define atomic_fcmpset_acq_short atomic_fcmpset_short -#define atomic_fcmpset_rel_short atomic_fcmpset_short - -#define atomic_set_acq_int atomic_set_barr_int -#define atomic_set_rel_int atomic_set_barr_int -#define atomic_clear_acq_int atomic_clear_barr_int -#define atomic_clear_rel_int atomic_clear_barr_int -#define atomic_add_acq_int atomic_add_barr_int -#define atomic_add_rel_int atomic_add_barr_int -#define atomic_subtract_acq_int atomic_subtract_barr_int -#define atomic_subtract_rel_int atomic_subtract_barr_int -#define atomic_cmpset_acq_int atomic_cmpset_int -#define atomic_cmpset_rel_int atomic_cmpset_int -#define atomic_fcmpset_acq_int atomic_fcmpset_int -#define atomic_fcmpset_rel_int atomic_fcmpset_int - -#define atomic_set_acq_long atomic_set_barr_long -#define atomic_set_rel_long atomic_set_barr_long -#define atomic_clear_acq_long atomic_clear_barr_long -#define atomic_clear_rel_long atomic_clear_barr_long -#define atomic_add_acq_long atomic_add_barr_long -#define atomic_add_rel_long atomic_add_barr_long -#define atomic_subtract_acq_long atomic_subtract_barr_long -#define atomic_subtract_rel_long atomic_subtract_barr_long -#define atomic_cmpset_acq_long atomic_cmpset_long -#define atomic_cmpset_rel_long atomic_cmpset_long -#define atomic_fcmpset_acq_long atomic_fcmpset_long -#define atomic_fcmpset_rel_long atomic_fcmpset_long - -#define atomic_readandclear_int(p) atomic_swap_int(p, 0) -#define atomic_readandclear_long(p) atomic_swap_long(p, 0) -#define atomic_testandset_acq_long atomic_testandset_long - -/* Operations on 8-bit bytes. */ -#define atomic_set_8 atomic_set_char -#define atomic_set_acq_8 atomic_set_acq_char -#define atomic_set_rel_8 atomic_set_rel_char -#define atomic_clear_8 atomic_clear_char -#define atomic_clear_acq_8 atomic_clear_acq_char -#define atomic_clear_rel_8 atomic_clear_rel_char -#define atomic_add_8 atomic_add_char -#define atomic_add_acq_8 atomic_add_acq_char -#define atomic_add_rel_8 atomic_add_rel_char -#define atomic_subtract_8 atomic_subtract_char -#define atomic_subtract_acq_8 atomic_subtract_acq_char -#define atomic_subtract_rel_8 atomic_subtract_rel_char -#define atomic_load_acq_8 atomic_load_acq_char -#define atomic_store_rel_8 atomic_store_rel_char -#define atomic_cmpset_8 atomic_cmpset_char -#define atomic_cmpset_acq_8 atomic_cmpset_acq_char -#define atomic_cmpset_rel_8 atomic_cmpset_rel_char -#define atomic_fcmpset_8 atomic_fcmpset_char -#define atomic_fcmpset_acq_8 atomic_fcmpset_acq_char -#define atomic_fcmpset_rel_8 atomic_fcmpset_rel_char - -/* Operations on 16-bit words. */ -#define atomic_set_16 atomic_set_short -#define atomic_set_acq_16 atomic_set_acq_short -#define atomic_set_rel_16 atomic_set_rel_short -#define atomic_clear_16 atomic_clear_short -#define atomic_clear_acq_16 atomic_clear_acq_short -#define atomic_clear_rel_16 atomic_clear_rel_short -#define atomic_add_16 atomic_add_short -#define atomic_add_acq_16 atomic_add_acq_short -#define atomic_add_rel_16 atomic_add_rel_short -#define atomic_subtract_16 atomic_subtract_short -#define atomic_subtract_acq_16 atomic_subtract_acq_short -#define atomic_subtract_rel_16 atomic_subtract_rel_short -#define atomic_load_acq_16 atomic_load_acq_short -#define atomic_store_rel_16 atomic_store_rel_short -#define atomic_cmpset_16 atomic_cmpset_short -#define atomic_cmpset_acq_16 atomic_cmpset_acq_short -#define atomic_cmpset_rel_16 atomic_cmpset_rel_short -#define atomic_fcmpset_16 atomic_fcmpset_short -#define atomic_fcmpset_acq_16 atomic_fcmpset_acq_short -#define atomic_fcmpset_rel_16 atomic_fcmpset_rel_short - -/* Operations on 32-bit double words. */ -#define atomic_set_32 atomic_set_int -#define atomic_set_acq_32 atomic_set_acq_int -#define atomic_set_rel_32 atomic_set_rel_int -#define atomic_clear_32 atomic_clear_int -#define atomic_clear_acq_32 atomic_clear_acq_int -#define atomic_clear_rel_32 atomic_clear_rel_int -#define atomic_add_32 atomic_add_int -#define atomic_add_acq_32 atomic_add_acq_int -#define atomic_add_rel_32 atomic_add_rel_int -#define atomic_subtract_32 atomic_subtract_int -#define atomic_subtract_acq_32 atomic_subtract_acq_int -#define atomic_subtract_rel_32 atomic_subtract_rel_int -#define atomic_load_acq_32 atomic_load_acq_int -#define atomic_store_rel_32 atomic_store_rel_int -#define atomic_cmpset_32 atomic_cmpset_int -#define atomic_cmpset_acq_32 atomic_cmpset_acq_int -#define atomic_cmpset_rel_32 atomic_cmpset_rel_int -#define atomic_fcmpset_32 atomic_fcmpset_int -#define atomic_fcmpset_acq_32 atomic_fcmpset_acq_int -#define atomic_fcmpset_rel_32 atomic_fcmpset_rel_int -#define atomic_swap_32 atomic_swap_int -#define atomic_readandclear_32 atomic_readandclear_int -#define atomic_fetchadd_32 atomic_fetchadd_int -#define atomic_testandset_32 atomic_testandset_int -#define atomic_testandclear_32 atomic_testandclear_int - -#ifdef _KERNEL -/* Operations on 64-bit quad words. */ -#define atomic_cmpset_acq_64 atomic_cmpset_64 -#define atomic_cmpset_rel_64 atomic_cmpset_64 -#define atomic_fcmpset_acq_64 atomic_fcmpset_64 -#define atomic_fcmpset_rel_64 atomic_fcmpset_64 -#define atomic_fetchadd_acq_64 atomic_fetchadd_64 -#define atomic_fetchadd_rel_64 atomic_fetchadd_64 -#define atomic_add_acq_64 atomic_add_64 -#define atomic_add_rel_64 atomic_add_64 -#define atomic_subtract_acq_64 atomic_subtract_64 -#define atomic_subtract_rel_64 atomic_subtract_64 -#define atomic_load_64 atomic_load_acq_64 -#define atomic_store_64 atomic_store_rel_64 -#endif - -/* Operations on pointers. */ -#define atomic_set_ptr(p, v) \ - atomic_set_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_set_acq_ptr(p, v) \ - atomic_set_acq_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_set_rel_ptr(p, v) \ - atomic_set_rel_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_clear_ptr(p, v) \ - atomic_clear_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_clear_acq_ptr(p, v) \ - atomic_clear_acq_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_clear_rel_ptr(p, v) \ - atomic_clear_rel_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_add_ptr(p, v) \ - atomic_add_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_add_acq_ptr(p, v) \ - atomic_add_acq_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_add_rel_ptr(p, v) \ - atomic_add_rel_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_subtract_ptr(p, v) \ - atomic_subtract_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_subtract_acq_ptr(p, v) \ - atomic_subtract_acq_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_subtract_rel_ptr(p, v) \ - atomic_subtract_rel_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_load_acq_ptr(p) \ - atomic_load_acq_int((const volatile u_int *)(p)) -#define atomic_store_rel_ptr(p, v) \ - atomic_store_rel_int((volatile u_int *)(p), (v)) -#define atomic_cmpset_ptr(dst, old, new) \ - atomic_cmpset_int((volatile u_int *)(dst), (u_int)(old), (u_int)(new)) -#define atomic_cmpset_acq_ptr(dst, old, new) \ - atomic_cmpset_acq_int((volatile u_int *)(dst), (u_int)(old), \ - (u_int)(new)) -#define atomic_cmpset_rel_ptr(dst, old, new) \ - atomic_cmpset_rel_int((volatile u_int *)(dst), (u_int)(old), \ - (u_int)(new)) -#define atomic_fcmpset_ptr(dst, old, new) \ - atomic_fcmpset_int((volatile u_int *)(dst), (u_int *)(old), (u_int)(new)) -#define atomic_fcmpset_acq_ptr(dst, old, new) \ - atomic_fcmpset_acq_int((volatile u_int *)(dst), (u_int *)(old), \ - (u_int)(new)) -#define atomic_fcmpset_rel_ptr(dst, old, new) \ - atomic_fcmpset_rel_int((volatile u_int *)(dst), (u_int *)(old), \ - (u_int)(new)) -#define atomic_swap_ptr(p, v) \ - atomic_swap_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_readandclear_ptr(p) \ - atomic_readandclear_int((volatile u_int *)(p)) -#define atomic_testandclear_ptr(p, val) \ - atomic_testandclear_int((volatile u_int *)(p), (val)) -#define atomic_testandset_ptr(p, val) \ - atomic_testandset_int((volatile u_int *)(p), (val)) - -#if defined(_KERNEL) -#define mb() __mbk() -#define wmb() __mbk() -#define rmb() __mbk() -#else -#define mb() __mbu() -#define wmb() __mbu() -#define rmb() __mbu() -#endif - -#endif /* !_MACHINE_ATOMIC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/bootinfo.h b/lib/libc/include/x86-freebsd-none/machine/bootinfo.h deleted file mode 100644 index 4cf674b162..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/bootinfo.h +++ /dev/null @@ -1,110 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-4-Clause - * - * Copyright (C) 1994 by Rodney W. Grimes, Milwaukie, Oregon 97222 - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer as - * the first lines of this file unmodified. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Rodney W. Grimes. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY RODNEY W. GRIMES ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL RODNEY W. GRIMES BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_BOOTINFO_H_ -#define _MACHINE_BOOTINFO_H_ - -/* Only change the version number if you break compatibility. */ -#define BOOTINFO_VERSION 1 - -#define _WAS_N_BIOS_GEOM 8 - -/* - * A zero bootinfo field often means that there is no info available. - * Assumes booting with a boot loader from FreeBSD 2.1 or newer and - * that bi_size is always valid when bi_version == 1. - */ -struct bootinfo { - u_int32_t bi_version; /* Must be 1 */ - u_int32_t bi_kernelname; /* represents a char * */ - u_int32_t bi_nfs_diskless; /* struct nfs_diskless * */ - u_int32_t _was_bi_n_bios_used; - u_int32_t _was_bi_bios_geom[_WAS_N_BIOS_GEOM]; - u_int32_t bi_size; - u_int8_t bi_memsizes_valid; - u_int8_t bi_bios_dev; /* bootdev BIOS unit number (bootX -> loader only) */ - u_int8_t bi_pad[2]; - u_int32_t bi_basemem; - u_int32_t bi_extmem; - u_int32_t bi_symtab; /* struct symtab * */ - u_int32_t bi_esymtab; /* struct symtab * */ - /* Items below only from advanced bootloader */ - u_int32_t bi_kernend; /* end of kernel space */ - u_int32_t bi_envp; /* environment */ - u_int32_t bi_modulep; /* preloaded modules */ -}; - -#ifdef _KERNEL -extern struct bootinfo bootinfo; -#endif - -/* - * Constants for converting boot-style device number to type, - * adaptor (uba, mba, etc), unit number and partition number. - * Type (== major device number) is in the low byte - * for backward compatibility. Except for that of the "magic - * number", each mask applies to the shifted value. - * Format: - * (4) (8) (4) (8) (8) - * -------------------------------- - * |MA | SLICE | UN| PART | TYPE | - * -------------------------------- - */ -#define B_SLICESHIFT 20 -#define B_SLICEMASK 0xff -#define B_SLICE(val) (((val)>>B_SLICESHIFT) & B_SLICEMASK) -#define B_UNITSHIFT 16 -#define B_UNITMASK 0xf -#define B_UNIT(val) (((val) >> B_UNITSHIFT) & B_UNITMASK) -#define B_PARTITIONSHIFT 8 -#define B_PARTITIONMASK 0xff -#define B_PARTITION(val) (((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK) -#define B_TYPESHIFT 0 -#define B_TYPEMASK 0xff -#define B_TYPE(val) (((val) >> B_TYPESHIFT) & B_TYPEMASK) - -#define B_MAGICMASK 0xf0000000 -#define B_DEVMAGIC 0xa0000000 - -#define MAKEBOOTDEV(type, slice, unit, partition) \ - (((type) << B_TYPESHIFT) | ((slice) << B_SLICESHIFT) | \ - ((unit) << B_UNITSHIFT) | ((partition) << B_PARTITIONSHIFT) | \ - B_DEVMAGIC) - -#define BASE_SLICE 2 -#define COMPATIBILITY_SLICE 0 -#define MAX_SLICES 32 -#define WHOLE_DISK_SLICE 1 - -#endif /* !_MACHINE_BOOTINFO_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/bus_dma.h b/lib/libc/include/x86-freebsd-none/machine/bus_dma.h deleted file mode 100644 index d05553a4e4..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/bus_dma.h +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2005 Scott Long - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - - -#ifndef _I386_BUS_DMA_H_ -#define _I386_BUS_DMA_H_ - -#include - -#endif /* _I386_BUS_DMA_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/counter.h b/lib/libc/include/x86-freebsd-none/machine/counter.h deleted file mode 100644 index be8d7308e0..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/counter.h +++ /dev/null @@ -1,198 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2012 Konstantin Belousov - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef __MACHINE_COUNTER_H__ -#define __MACHINE_COUNTER_H__ - -#include -#ifdef INVARIANTS -#include -#endif -#include -#include -#include - -#define EARLY_COUNTER &__pcpu[0].pc_early_dummy_counter - -#define counter_enter() do { \ - if ((cpu_feature & CPUID_CX8) == 0) \ - critical_enter(); \ -} while (0) - -#define counter_exit() do { \ - if ((cpu_feature & CPUID_CX8) == 0) \ - critical_exit(); \ -} while (0) - -static inline void -counter_64_inc_8b(uint64_t *p, int64_t inc) -{ - - __asm __volatile( - "movl %%fs:(%%esi),%%eax\n\t" - "movl %%fs:4(%%esi),%%edx\n" -"1:\n\t" - "movl %%eax,%%ebx\n\t" - "movl %%edx,%%ecx\n\t" - "addl (%%edi),%%ebx\n\t" - "adcl 4(%%edi),%%ecx\n\t" - "cmpxchg8b %%fs:(%%esi)\n\t" - "jnz 1b" - : - : "S" ((char *)p - (char *)&__pcpu[0]), "D" (&inc) - : "memory", "cc", "eax", "edx", "ebx", "ecx"); -} - -#ifdef IN_SUBR_COUNTER_C -struct counter_u64_fetch_cx8_arg { - uint64_t res; - uint64_t *p; -}; - -static uint64_t -counter_u64_read_one_8b(uint64_t *p) -{ - uint32_t res_lo, res_high; - - __asm __volatile( - "movl %%eax,%%ebx\n\t" - "movl %%edx,%%ecx\n\t" - "cmpxchg8b (%2)" - : "=a" (res_lo), "=d"(res_high) - : "SD" (p) - : "cc", "ebx", "ecx"); - return (res_lo + ((uint64_t)res_high << 32)); -} - -static void -counter_u64_fetch_cx8_one(void *arg1) -{ - struct counter_u64_fetch_cx8_arg *arg; - uint64_t val; - - arg = arg1; - val = counter_u64_read_one_8b((uint64_t *)((char *)arg->p + - UMA_PCPU_ALLOC_SIZE * PCPU_GET(cpuid))); - atomic_add_64(&arg->res, val); -} - -static inline uint64_t -counter_u64_fetch_inline(uint64_t *p) -{ - struct counter_u64_fetch_cx8_arg arg; - uint64_t res; - int i; - - res = 0; - if ((cpu_feature & CPUID_CX8) == 0) { - /* - * The machines without cmpxchg8b are not SMP. - * Disabling the preemption provides atomicity of the - * counter reading, since update is done in the - * critical section as well. - */ - critical_enter(); - CPU_FOREACH(i) { - res += *(uint64_t *)((char *)p + - UMA_PCPU_ALLOC_SIZE * i); - } - critical_exit(); - } else { - arg.p = p; - arg.res = 0; - smp_rendezvous(NULL, counter_u64_fetch_cx8_one, NULL, &arg); - res = arg.res; - } - return (res); -} - -static inline void -counter_u64_zero_one_8b(uint64_t *p) -{ - - __asm __volatile( - "movl (%0),%%eax\n\t" - "movl 4(%0),%%edx\n" - "xorl %%ebx,%%ebx\n\t" - "xorl %%ecx,%%ecx\n\t" -"1:\n\t" - "cmpxchg8b (%0)\n\t" - "jnz 1b" - : - : "SD" (p) - : "memory", "cc", "eax", "edx", "ebx", "ecx"); -} - -static void -counter_u64_zero_one_cpu(void *arg) -{ - uint64_t *p; - - p = (uint64_t *)((char *)arg + UMA_PCPU_ALLOC_SIZE * PCPU_GET(cpuid)); - counter_u64_zero_one_8b(p); -} - -static inline void -counter_u64_zero_inline(counter_u64_t c) -{ - int i; - - if ((cpu_feature & CPUID_CX8) == 0) { - critical_enter(); - CPU_FOREACH(i) - *(uint64_t *)((char *)c + UMA_PCPU_ALLOC_SIZE * i) = 0; - critical_exit(); - } else { - smp_rendezvous(smp_no_rendezvous_barrier, - counter_u64_zero_one_cpu, smp_no_rendezvous_barrier, c); - } -} -#endif - -#define counter_u64_add_protected(c, inc) do { \ - if ((cpu_feature & CPUID_CX8) == 0) { \ - CRITICAL_ASSERT(curthread); \ - *(uint64_t *)zpcpu_get(c) += (inc); \ - } else \ - counter_64_inc_8b((c), (inc)); \ -} while (0) - -static inline void -counter_u64_add(counter_u64_t c, int64_t inc) -{ - - if ((cpu_feature & CPUID_CX8) == 0) { - critical_enter(); - *(uint64_t *)zpcpu_get(c) += inc; - critical_exit(); - } else { - counter_64_inc_8b(c, inc); - } -} - -#endif /* ! __MACHINE_COUNTER_H__ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/cpu.h b/lib/libc/include/x86-freebsd-none/machine/cpu.h deleted file mode 100644 index 21d0051493..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/cpu.h +++ /dev/null @@ -1,92 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_CPU_H_ -#define _MACHINE_CPU_H_ - -/* - * Definitions unique to i386 cpu support. - */ -#ifdef _KERNEL -#include /* For cpu_ticks(). */ -#endif -#include -#include -#include - -#define cpu_exec(p) /* nothing */ -#define cpu_swapin(p) /* nothing */ -#define cpu_getstack(td) ((td)->td_frame->tf_esp) -#define cpu_setstack(td, ap) ((td)->td_frame->tf_esp = (ap)) -#define cpu_spinwait() ia32_pause() - -#define TRAPF_USERMODE(framep) \ - ((ISPL((framep)->tf_cs) == SEL_UPL) || ((framep)->tf_eflags & PSL_VM)) -#define TRAPF_PC(framep) ((framep)->tf_eip) - -#ifdef _KERNEL -/* - * Struct containing pointers to CPU management functions whose - * implementation is run time selectable. Selection can be made, - * for example, based on detection of a particular CPU variant or - * hypervisor environment. - */ -struct cpu_ops { - void (*cpu_init)(void); - void (*cpu_resume)(void); -}; - -extern struct cpu_ops cpu_ops; -extern char btext[]; -extern char etext[]; - -void cpu_halt(void); -void cpu_lock_delay(void); -void cpu_reset(void); -void fork_trampoline(void); - -/* - * Return contents of in-cpu fast counter as a sort of "bogo-time" - * for random-harvesting purposes. - */ -static __inline uint64_t -get_cyclecount(void) -{ - - return (cpu_ticks()); -} - -#endif - -#endif /* !_MACHINE_CPU_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/cpufunc.h b/lib/libc/include/x86-freebsd-none/machine/cpufunc.h deleted file mode 100644 index 22cd1b7cd1..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/cpufunc.h +++ /dev/null @@ -1,718 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1993 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Functions to provide access to special i386 instructions. - * This in included in sys/systm.h, and that file should be - * used in preference to this. - */ - -#ifndef _MACHINE_CPUFUNC_H_ -#define _MACHINE_CPUFUNC_H_ - -struct region_descriptor; - -#define readb(va) (*(volatile uint8_t *) (va)) -#define readw(va) (*(volatile uint16_t *) (va)) -#define readl(va) (*(volatile uint32_t *) (va)) - -#define writeb(va, d) (*(volatile uint8_t *) (va) = (d)) -#define writew(va, d) (*(volatile uint16_t *) (va) = (d)) -#define writel(va, d) (*(volatile uint32_t *) (va) = (d)) - -static __inline void -breakpoint(void) -{ - __asm __volatile("int $3"); -} - -static __inline __pure2 u_int -bsfl(u_int mask) -{ - u_int result; - - __asm("bsfl %1,%0" : "=r" (result) : "rm" (mask) : "cc"); - return (result); -} - -static __inline void -clflush(u_long addr) -{ - - __asm __volatile("clflush %0" : : "m" (*(char *)addr)); -} - -static __inline void -clflushopt(u_long addr) -{ - - __asm __volatile("clflushopt %0" : : "m" (*(char *)addr)); -} - -static __inline void -clts(void) -{ - - __asm __volatile("clts"); -} - -static __inline void -disable_intr(void) -{ - __asm __volatile("cli" : : : "memory"); -} - -#ifdef _KERNEL -static __inline void -do_cpuid(u_int ax, u_int *p) -{ - __asm __volatile("cpuid" - : "=a" (p[0]), "=b" (p[1]), "=c" (p[2]), "=d" (p[3]) - : "0" (ax)); -} - -static __inline void -cpuid_count(u_int ax, u_int cx, u_int *p) -{ - __asm __volatile("cpuid" - : "=a" (p[0]), "=b" (p[1]), "=c" (p[2]), "=d" (p[3]) - : "0" (ax), "c" (cx)); -} -#else -static __inline void -do_cpuid(u_int ax, u_int *p) -{ - __asm __volatile( - "pushl\t%%ebx\n\t" - "cpuid\n\t" - "movl\t%%ebx,%1\n\t" - "popl\t%%ebx" - : "=a" (p[0]), "=DS" (p[1]), "=c" (p[2]), "=d" (p[3]) - : "0" (ax)); -} - -static __inline void -cpuid_count(u_int ax, u_int cx, u_int *p) -{ - __asm __volatile( - "pushl\t%%ebx\n\t" - "cpuid\n\t" - "movl\t%%ebx,%1\n\t" - "popl\t%%ebx" - : "=a" (p[0]), "=DS" (p[1]), "=c" (p[2]), "=d" (p[3]) - : "0" (ax), "c" (cx)); -} -#endif - -static __inline void -enable_intr(void) -{ - __asm __volatile("sti"); -} - -static __inline void -cpu_monitor(const void *addr, u_long extensions, u_int hints) -{ - __asm __volatile("monitor" - : : "a" (addr), "c" (extensions), "d" (hints)); -} - -static __inline void -cpu_mwait(u_long extensions, u_int hints) -{ - __asm __volatile("mwait" : : "a" (hints), "c" (extensions)); -} - -static __inline void -lfence(void) -{ - __asm __volatile("lfence" : : : "memory"); -} - -static __inline void -mfence(void) -{ - __asm __volatile("mfence" : : : "memory"); -} - -static __inline void -sfence(void) -{ - __asm __volatile("sfence" : : : "memory"); -} - -static __inline void -halt(void) -{ - __asm __volatile("hlt"); -} - -static __inline u_char -inb(u_int port) -{ - u_char data; - - __asm __volatile("inb %w1, %0" : "=a" (data) : "Nd" (port)); - return (data); -} - -static __inline u_int -inl(u_int port) -{ - u_int data; - - __asm __volatile("inl %w1, %0" : "=a" (data) : "Nd" (port)); - return (data); -} - -static __inline void -insb(u_int port, void *addr, size_t count) -{ - __asm __volatile("cld; rep; insb" - : "+D" (addr), "+c" (count) - : "d" (port) - : "memory"); -} - -static __inline void -insw(u_int port, void *addr, size_t count) -{ - __asm __volatile("cld; rep; insw" - : "+D" (addr), "+c" (count) - : "d" (port) - : "memory"); -} - -static __inline void -insl(u_int port, void *addr, size_t count) -{ - __asm __volatile("cld; rep; insl" - : "+D" (addr), "+c" (count) - : "d" (port) - : "memory"); -} - -static __inline void -invd(void) -{ - __asm __volatile("invd"); -} - -static __inline u_short -inw(u_int port) -{ - u_short data; - - __asm __volatile("inw %w1, %0" : "=a" (data) : "Nd" (port)); - return (data); -} - -static __inline void -outb(u_int port, u_char data) -{ - __asm __volatile("outb %0, %w1" : : "a" (data), "Nd" (port)); -} - -static __inline void -outl(u_int port, u_int data) -{ - __asm __volatile("outl %0, %w1" : : "a" (data), "Nd" (port)); -} - -static __inline void -outsb(u_int port, const void *addr, size_t count) -{ - __asm __volatile("cld; rep; outsb" - : "+S" (addr), "+c" (count) - : "d" (port)); -} - -static __inline void -outsw(u_int port, const void *addr, size_t count) -{ - __asm __volatile("cld; rep; outsw" - : "+S" (addr), "+c" (count) - : "d" (port)); -} - -static __inline void -outsl(u_int port, const void *addr, size_t count) -{ - __asm __volatile("cld; rep; outsl" - : "+S" (addr), "+c" (count) - : "d" (port)); -} - -static __inline void -outw(u_int port, u_short data) -{ - __asm __volatile("outw %0, %w1" : : "a" (data), "Nd" (port)); -} - -static __inline void -ia32_pause(void) -{ - __asm __volatile("pause"); -} - -static __inline u_int -read_eflags(void) -{ - u_int ef; - - __asm __volatile("pushfl; popl %0" : "=r" (ef)); - return (ef); -} - -static __inline uint64_t -rdmsr(u_int msr) -{ - uint64_t rv; - - __asm __volatile("rdmsr" : "=A" (rv) : "c" (msr)); - return (rv); -} - -static __inline uint32_t -rdmsr32(u_int msr) -{ - uint32_t low; - - __asm __volatile("rdmsr" : "=a" (low) : "c" (msr) : "edx"); - return (low); -} - -static __inline uint64_t -rdpmc(u_int pmc) -{ - uint64_t rv; - - __asm __volatile("rdpmc" : "=A" (rv) : "c" (pmc)); - return (rv); -} - -static __inline uint64_t -rdtsc(void) -{ - uint64_t rv; - - __asm __volatile("rdtsc" : "=A" (rv)); - return (rv); -} - -static __inline uint64_t -rdtsc_ordered_lfence(void) -{ - lfence(); - return (rdtsc()); -} - -static __inline uint64_t -rdtsc_ordered_mfence(void) -{ - mfence(); - return (rdtsc()); -} - -static __inline uint64_t -rdtscp(void) -{ - uint64_t rv; - - __asm __volatile("rdtscp" : "=A" (rv) : : "ecx"); - return (rv); -} - -static __inline uint64_t -rdtscp_aux(uint32_t *aux) -{ - uint64_t rv; - - __asm __volatile("rdtscp" : "=A" (rv), "=c" (*aux)); - return (rv); -} - -static __inline uint32_t -rdtsc32(void) -{ - uint32_t rv; - - __asm __volatile("rdtsc" : "=a" (rv) : : "edx"); - return (rv); -} - -static __inline uint32_t -rdtscp32(void) -{ - uint32_t rv; - - __asm __volatile("rdtscp" : "=a" (rv) : : "ecx", "edx"); - return (rv); -} - -static __inline void -wbinvd(void) -{ - __asm __volatile("wbinvd"); -} - -static __inline void -write_eflags(u_int ef) -{ - __asm __volatile("pushl %0; popfl" : : "r" (ef)); -} - -static __inline void -wrmsr(u_int msr, uint64_t newval) -{ - __asm __volatile("wrmsr" : : "A" (newval), "c" (msr)); -} - -static __inline void -load_cr0(u_int data) -{ - - __asm __volatile("movl %0,%%cr0" : : "r" (data)); -} - -static __inline u_int -rcr0(void) -{ - u_int data; - - __asm __volatile("movl %%cr0,%0" : "=r" (data)); - return (data); -} - -static __inline u_int -rcr2(void) -{ - u_int data; - - __asm __volatile("movl %%cr2,%0" : "=r" (data)); - return (data); -} - -static __inline void -load_cr3(u_int data) -{ - - __asm __volatile("movl %0,%%cr3" : : "r" (data) : "memory"); -} - -static __inline u_int -rcr3(void) -{ - u_int data; - - __asm __volatile("movl %%cr3,%0" : "=r" (data)); - return (data); -} - -static __inline void -load_cr4(u_int data) -{ - __asm __volatile("movl %0,%%cr4" : : "r" (data)); -} - -static __inline u_int -rcr4(void) -{ - u_int data; - - __asm __volatile("movl %%cr4,%0" : "=r" (data)); - return (data); -} - -static __inline uint64_t -rxcr(u_int reg) -{ - u_int low, high; - - __asm __volatile("xgetbv" : "=a" (low), "=d" (high) : "c" (reg)); - return (low | ((uint64_t)high << 32)); -} - -static __inline void -load_xcr(u_int reg, uint64_t val) -{ - u_int low, high; - - low = val; - high = val >> 32; - __asm __volatile("xsetbv" : : "c" (reg), "a" (low), "d" (high)); -} - -/* - * Global TLB flush (except for thise for pages marked PG_G) - */ -static __inline void -invltlb(void) -{ - - load_cr3(rcr3()); -} - -/* - * TLB flush for an individual page (even if it has PG_G). - * Only works on 486+ CPUs (i386 does not have PG_G). - */ -static __inline void -invlpg(u_int addr) -{ - - __asm __volatile("invlpg %0" : : "m" (*(char *)addr) : "memory"); -} - -static __inline u_short -rfs(void) -{ - u_short sel; - __asm __volatile("movw %%fs,%0" : "=rm" (sel)); - return (sel); -} - -static __inline uint64_t -rgdt(void) -{ - uint64_t gdtr; - __asm __volatile("sgdt %0" : "=m" (gdtr)); - return (gdtr); -} - -static __inline u_short -rgs(void) -{ - u_short sel; - __asm __volatile("movw %%gs,%0" : "=rm" (sel)); - return (sel); -} - -static __inline uint64_t -ridt(void) -{ - uint64_t idtr; - __asm __volatile("sidt %0" : "=m" (idtr)); - return (idtr); -} - -static __inline u_short -rldt(void) -{ - u_short ldtr; - __asm __volatile("sldt %0" : "=g" (ldtr)); - return (ldtr); -} - -static __inline u_short -rss(void) -{ - u_short sel; - __asm __volatile("movw %%ss,%0" : "=rm" (sel)); - return (sel); -} - -static __inline u_short -rtr(void) -{ - u_short tr; - __asm __volatile("str %0" : "=g" (tr)); - return (tr); -} - -static __inline void -load_fs(u_short sel) -{ - __asm __volatile("movw %0,%%fs" : : "rm" (sel)); -} - -static __inline void -load_gs(u_short sel) -{ - __asm __volatile("movw %0,%%gs" : : "rm" (sel)); -} - -static __inline void -lidt(struct region_descriptor *addr) -{ - __asm __volatile("lidt (%0)" : : "r" (addr)); -} - -static __inline void -lldt(u_short sel) -{ - __asm __volatile("lldt %0" : : "r" (sel)); -} - -static __inline void -ltr(u_short sel) -{ - __asm __volatile("ltr %0" : : "r" (sel)); -} - -static __inline u_int -rdr0(void) -{ - u_int data; - __asm __volatile("movl %%dr0,%0" : "=r" (data)); - return (data); -} - -static __inline void -load_dr0(u_int dr0) -{ - __asm __volatile("movl %0,%%dr0" : : "r" (dr0)); -} - -static __inline u_int -rdr1(void) -{ - u_int data; - __asm __volatile("movl %%dr1,%0" : "=r" (data)); - return (data); -} - -static __inline void -load_dr1(u_int dr1) -{ - __asm __volatile("movl %0,%%dr1" : : "r" (dr1)); -} - -static __inline u_int -rdr2(void) -{ - u_int data; - __asm __volatile("movl %%dr2,%0" : "=r" (data)); - return (data); -} - -static __inline void -load_dr2(u_int dr2) -{ - __asm __volatile("movl %0,%%dr2" : : "r" (dr2)); -} - -static __inline u_int -rdr3(void) -{ - u_int data; - __asm __volatile("movl %%dr3,%0" : "=r" (data)); - return (data); -} - -static __inline void -load_dr3(u_int dr3) -{ - __asm __volatile("movl %0,%%dr3" : : "r" (dr3)); -} - -static __inline u_int -rdr6(void) -{ - u_int data; - __asm __volatile("movl %%dr6,%0" : "=r" (data)); - return (data); -} - -static __inline void -load_dr6(u_int dr6) -{ - __asm __volatile("movl %0,%%dr6" : : "r" (dr6)); -} - -static __inline u_int -rdr7(void) -{ - u_int data; - __asm __volatile("movl %%dr7,%0" : "=r" (data)); - return (data); -} - -static __inline void -load_dr7(u_int dr7) -{ - __asm __volatile("movl %0,%%dr7" : : "r" (dr7)); -} - -static __inline u_char -read_cyrix_reg(u_char reg) -{ - outb(0x22, reg); - return inb(0x23); -} - -static __inline void -write_cyrix_reg(u_char reg, u_char data) -{ - outb(0x22, reg); - outb(0x23, data); -} - -static __inline register_t -intr_disable(void) -{ - register_t eflags; - - eflags = read_eflags(); - disable_intr(); - return (eflags); -} - -static __inline void -intr_restore(register_t eflags) -{ - write_eflags(eflags); -} - -static __inline uint32_t -rdpkru(void) -{ - uint32_t res; - - __asm __volatile("rdpkru" : "=a" (res) : "c" (0) : "edx"); - return (res); -} - -static __inline void -wrpkru(uint32_t mask) -{ - - __asm __volatile("wrpkru" : : "a" (mask), "c" (0), "d" (0)); -} - -void reset_dbregs(void); - -#ifdef _KERNEL -int rdmsr_safe(u_int msr, uint64_t *val); -int wrmsr_safe(u_int msr, uint64_t newval); -#endif - -#endif /* !_MACHINE_CPUFUNC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/cputypes.h b/lib/libc/include/x86-freebsd-none/machine/cputypes.h deleted file mode 100644 index 81253af8eb..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/cputypes.h +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1993 Christopher G. Demetriou - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MACHINE_CPUTYPES_H_ -#define _MACHINE_CPUTYPES_H_ - -#include - -/* - * Classes of processor. - */ -#define CPUCLASS_286 0 -#define CPUCLASS_386 1 -#define CPUCLASS_486 2 -#define CPUCLASS_586 3 -#define CPUCLASS_686 4 - -/* - * Kinds of processor. - */ -#define CPU_286 0 /* Intel 80286 */ -#define CPU_386SX 1 /* Intel 80386SX */ -#define CPU_386 2 /* Intel 80386DX */ -#define CPU_486SX 3 /* Intel 80486SX */ -#define CPU_486 4 /* Intel 80486DX */ -#define CPU_586 5 /* Intel Pentium */ -#define CPU_486DLC 6 /* Cyrix 486DLC */ -#define CPU_686 7 /* Pentium Pro */ -#define CPU_M1SC 8 /* Cyrix M1sc (aka 5x86) */ -#define CPU_M1 9 /* Cyrix M1 (aka 6x86) */ -#define CPU_BLUE 10 /* IBM BlueLighting CPU */ -#define CPU_M2 11 /* Cyrix M2 (enhanced 6x86 with MMX) */ -#define CPU_NX586 12 /* NexGen (now AMD) 586 */ -#define CPU_CY486DX 13 /* Cyrix 486S/DX/DX2/DX4 */ -#define CPU_PII 14 /* Intel Pentium II */ -#define CPU_PIII 15 /* Intel Pentium III */ -#define CPU_P4 16 /* Intel Pentium 4 */ -#define CPU_GEODE1100 17 /* NS Geode SC1100 */ - -#ifndef LOCORE -extern int cpu; -extern int cpu_class; -#endif - -#endif /* !_MACHINE_CPUTYPES_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/db_machdep.h b/lib/libc/include/x86-freebsd-none/machine/db_machdep.h deleted file mode 100644 index ef853eac0d..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/db_machdep.h +++ /dev/null @@ -1,87 +0,0 @@ -/*- - * Mach Operating System - * Copyright (c) 1991,1990 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ - -#ifndef _MACHINE_DB_MACHDEP_H_ -#define _MACHINE_DB_MACHDEP_H_ - -#include -#include - -typedef vm_offset_t db_addr_t; /* address - unsigned */ -typedef int db_expr_t; /* expression - signed */ - -#define PC_REGS() ((db_addr_t)(kdb_frame->tf_eflags & PSL_VM ? \ - (kdb_frame->tf_eip & 0xffff) + \ - ((kdb_frame->tf_cs & 0xffff) << 4) : \ - kdb_frame->tf_eip)) - -#define BKPT_INST 0xcc /* breakpoint instruction */ -#define BKPT_SIZE (1) /* size of breakpoint inst */ -#define BKPT_SET(inst) (BKPT_INST) - -#define BKPT_SKIP \ -do { \ - kdb_frame->tf_eip += 1; \ - kdb_thrctx->pcb_eip += 1; \ -} while(0) - -#define FIXUP_PC_AFTER_BREAK \ -do { \ - kdb_frame->tf_eip -= 1; \ - kdb_thrctx->pcb_eip -= 1; \ -} while(0); - -#define db_clear_single_step kdb_cpu_clear_singlestep -#define db_set_single_step kdb_cpu_set_singlestep - -/* - * The debug exception type is copied from %dr6 to 'code' and used to - * disambiguate single step traps. Watchpoints have no special support. - * Our hardware breakpoints are not well integrated with ddb and are too - * different from watchpoints. ddb treats them as unknown traps with - * unknown addresses and doesn't turn them off while it is running. - */ -#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BPTFLT) -#define IS_SSTEP_TRAP(type, code) \ - ((type) == T_TRCTRAP && (code) & DBREG_DR6_BS) -#define IS_WATCHPOINT_TRAP(type, code) 0 - -#define I_CALL 0xe8 -#define I_CALLI 0xff -#define I_RET 0xc3 -#define I_IRET 0xcf - -#define inst_trap_return(ins) (((ins)&0xff) == I_IRET) -#define inst_return(ins) (((ins)&0xff) == I_RET) -#define inst_call(ins) (((ins)&0xff) == I_CALL || \ - (((ins)&0xff) == I_CALLI && \ - ((ins)&0x3800) == 0x1000)) -#define inst_load(ins) 0 -#define inst_store(ins) 0 - -int db_segsize(struct trapframe *tfp); - -#endif /* !_MACHINE_DB_MACHDEP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/efi.h b/lib/libc/include/x86-freebsd-none/machine/efi.h deleted file mode 100644 index 940ccfae57..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/efi.h +++ /dev/null @@ -1,12 +0,0 @@ -/*- - * This file is in the public domain since it's just boilerplate. - */ - -#ifndef __I386_INCLUDE_EFI_H_ -#define __I386_INCLUDE_EFI_H_ - -#define EFIABI_ATTR /* __attribute__((ms_abi)) */ /* clang fails with this */ - -/* Note: we don't actually support this on i386 yet */ - -#endif /* __I386_INCLUDE_EFI_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/elan_mmcr.h b/lib/libc/include/x86-freebsd-none/machine/elan_mmcr.h deleted file mode 100644 index 4ff301172a..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/elan_mmcr.h +++ /dev/null @@ -1,300 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2004 John Birrell - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* AMD Elan SC520 Memory Mapped Configuration Region (MMCR). - * - * The layout of this structure is documented by AMD in the Elan SC520 - * Microcontroller Register Set Manual. The field names match those - * described in that document. The overall structure size must be 4096 - * bytes. Ignore fields with the 'pad' prefix - they are only present for - * alignment purposes. - */ - -#ifndef _MACHINE_ELAN_MMCR_H_ -#define _MACHINE_ELAN_MMCR_H_ 1 - -struct elan_mmcr { - /* CPU */ - u_int16_t REVID; - u_int8_t CPUCTL; - u_int8_t pad_0x003[0xd]; - - /* SDRAM Controller */ - u_int16_t DRCCTL; - u_int16_t DRCTMCTL; - u_int16_t DRCCFG; - u_int16_t DRCBENDADR; - u_int8_t pad_0x01a[0x6]; - u_int8_t ECCCTL; - u_int8_t ECCSTA; - u_int8_t ECCCKBPOS; - u_int8_t ECCCKTEST; - u_int32_t ECCSBADD; - u_int32_t ECCMBADD; - u_int8_t pad_0x02c[0x14]; - - /* SDRAM Buffer */ - u_int8_t DBCTL; - u_int8_t pad_0x041[0xf]; - - /* ROM/Flash Controller */ - u_int16_t BOOTCSCTL; - u_int8_t pad_0x052[0x2]; - u_int16_t ROMCS1CTL; - u_int16_t ROMCS2CTL; - u_int8_t pad_0x058[0x8]; - - /* PCI Bus Host Bridge */ - u_int16_t HBCTL; - u_int16_t HBTGTIRQCTL; - u_int16_t HBTGTIRQSTA; - u_int16_t HBMSTIRQCTL; - u_int16_t HBMSTIRQSTA; - u_int8_t pad_0x06a[0x2]; - u_int32_t MSTINTADD; - - /* System Arbitration */ - u_int8_t SYSARBCTL; - u_int8_t PCIARBSTA; - u_int16_t SYSARBMENB; - u_int32_t ARBPRICTL; - u_int8_t pad_0x078[0x8]; - - /* System Address Mapping */ - u_int32_t ADDDECCTL; - u_int32_t WPVSTA; - u_int32_t PAR0; - u_int32_t PAR1; - u_int32_t PAR2; - u_int32_t PAR3; - u_int32_t PAR4; - u_int32_t PAR5; - u_int32_t PAR6; - u_int32_t PAR7; - u_int32_t PAR8; - u_int32_t PAR9; - u_int32_t PAR10; - u_int32_t PAR11; - u_int32_t PAR12; - u_int32_t PAR13; - u_int32_t PAR14; - u_int32_t PAR15; - u_int8_t pad_0x0c8[0xb38]; - - /* GP Bus Controller */ - u_int8_t GPECHO; - u_int8_t GPCSDW; - u_int16_t GPCSQUAL; - u_int8_t pad_0xc04[0x4]; - u_int8_t GPCSRT; - u_int8_t GPCSPW; - u_int8_t GPCSOFF; - u_int8_t GPRDW; - u_int8_t GPRDOFF; - u_int8_t GPWRW; - u_int8_t GPWROFF; - u_int8_t GPALEW; - u_int8_t GPALEOFF; - u_int8_t pad_0xc11[0xf]; - - /* Programmable Input/Output */ - u_int16_t PIOPFS15_0; - u_int16_t PIOPFS31_16; - u_int8_t CSPFS; - u_int8_t pad_0xc25; - u_int8_t CLKSEL; - u_int8_t pad_0xc27; - u_int16_t DSCTL; - u_int16_t PIODIR15_0; - u_int16_t PIODIR31_16; - u_int8_t pad_0xc2e[0x2]; - u_int16_t PIODATA15_0; - u_int16_t PIODATA31_16; - u_int16_t PIOSET15_0; - u_int16_t PIOSET31_16; - u_int16_t PIOCLR15_0; - u_int16_t PIOCLR31_16; - u_int8_t pad_0xc3c[0x24]; - - /* Software Timer */ - u_int16_t SWTMRMILLI; - u_int16_t SWTMRMICRO; - u_int8_t SWTMRCFG; - u_int8_t pad_0xc65[0xb]; - - /* General-Purpose Timers */ - u_int8_t GPTMRSTA; - u_int8_t pad_0xc71; - u_int16_t GPTMR0CTL; - u_int16_t GPTMR0CNT; - u_int16_t GPTMR0MAXCMPA; - u_int16_t GPTMR0MAXCMPB; - u_int16_t GPTMR1CTL; - u_int16_t GPTMR1CNT; - u_int16_t GPTMR1MAXCMPA; - u_int16_t GPTMR1MAXCMPB; - u_int16_t GPTMR2CTL; - u_int16_t GPTMR2CNT; - u_int8_t pad_0xc86[0x8]; - u_int16_t GPTMR2MAXCMPA; - u_int8_t pad_0xc90[0x20]; - - /* Watchdog Timer */ - u_int16_t WDTMRCTL; - u_int16_t WDTMRCNTL; - u_int16_t WDTMRCNTH; - u_int8_t pad_0xcb6[0xa]; - - /* UART Serial Ports */ - u_int8_t UART1CTL; - u_int8_t UART1STA; - u_int8_t UART1FCRSHAD; - u_int8_t pad_0xcc3; - u_int8_t UART2CTL; - u_int8_t UART2STA; - u_int8_t UART2FCRSHAD; - u_int8_t pad_0xcc7[0x9]; - - /* Synchronous Serial Interface */ - u_int8_t SSICTL; - u_int8_t SSIXMIT; - u_int8_t SSICMD; - u_int8_t SSISTA; - u_int8_t SSIRCV; - u_int8_t pad_0xcd5[0x2b]; - - /* Programmable Interrupt Controller */ - u_int8_t PICICR; - u_int8_t pad_0xd01; - u_int8_t MPICMODE; - u_int8_t SL1PICMODE; - u_int8_t SL2PICMODE; - u_int8_t pad_0xd05[0x3]; - u_int16_t SWINT16_1; - u_int8_t SWINT22_17; - u_int8_t pad_0xd0b[0x5]; - u_int16_t INTPINPOL; - u_int8_t pad_0xd12[0x2]; - u_int16_t PCIHOSTMAP; - u_int8_t pad_0xd16[0x2]; - u_int16_t ECCMAP; - u_int8_t GPTMR0MAP; - u_int8_t GPTMR1MAP; - u_int8_t GPTMR2MAP; - u_int8_t pad_0xd1d[0x3]; - u_int8_t PIT0MAP; - u_int8_t PIT1MAP; - u_int8_t PIT2MAP; - u_int8_t pad_0xd23[0x5]; - u_int8_t UART1MAP; - u_int8_t UART2MAP; - u_int8_t pad_0xd2a[0x6]; - u_int8_t PCIINTAMAP; - u_int8_t PCIINTBMAP; - u_int8_t PCIINTCMAP; - u_int8_t PCIINTDMAP; - u_int8_t pad_0xd34[0xc]; - u_int8_t DMABCINTMAP; - u_int8_t SSIMAP; - u_int8_t WDTMAP; - u_int8_t RTCMAP; - u_int8_t WPVMAP; - u_int8_t ICEMAP; - u_int8_t FERRMAP; - u_int8_t pad_0xd47[0x9]; - u_int8_t GP0IMAP; - u_int8_t GP1IMAP; - u_int8_t GP2IMAP; - u_int8_t GP3IMAP; - u_int8_t GP4IMAP; - u_int8_t GP5IMAP; - u_int8_t GP6IMAP; - u_int8_t GP7IMAP; - u_int8_t GP8IMAP; - u_int8_t GP9IMAP; - u_int8_t GP10IMAP; - u_int8_t pad_0xd5b[0x15]; - - /* Reset Generation */ - u_int8_t SYSINFO; - u_int8_t pad_0xd71; - u_int8_t RESCFG; - u_int8_t pad_0xd73; - u_int8_t RESSTA; - u_int8_t pad_0xd75[0xb]; - - /* GP DMA Controller */ - u_int8_t GPDMACTL; - u_int8_t GPDMAMMIO; - u_int16_t GPDMAEXTCHMAPA; - u_int16_t GPDMAEXTCHMAPB; - u_int8_t GPDMAEXTPG0; - u_int8_t GPDMAEXTPG1; - u_int8_t GPDMAEXTPG2; - u_int8_t GPDMAEXTPG3; - u_int8_t GPDMAEXTPG5; - u_int8_t GPDMAEXTPG6; - u_int8_t GPDMAEXTPG7; - u_int8_t pad_0xd8d[0x3]; - u_int8_t GPDMAEXTTC3; - u_int8_t GPDMAEXTTC5; - u_int8_t GPDMAEXTTC6; - u_int8_t GPDMAEXTTC7; - u_int8_t pad_0xd94[0x4]; - u_int8_t GPDMABCCTL; - u_int8_t GPDMABCSTA; - u_int8_t GPDMABSINTENB; - u_int8_t GPDMABCVAL; - u_int8_t pad_0xd9c[0x4]; - u_int16_t GPDMANXTADDL3; - u_int16_t GPDMANXTADDH3; - u_int16_t GPDMANXTADDL5; - u_int16_t GPDMANXTADDH5; - u_int16_t GPDMANXTADDL6; - u_int16_t GPDMANXTADDH6; - u_int16_t GPDMANXTADDL7; - u_int16_t GPDMANXTADDH7; - u_int16_t GPDMANXTTCL3; - u_int8_t GPDMANXTTCH3; - u_int8_t pad_0xdb3; - u_int16_t GPDMANXTTCL5; - u_int8_t GPDMANXTTCH5; - u_int8_t pad_0xdb7; - u_int16_t GPDMANXTTCL6; - u_int8_t GPDMANXTTCH6; - u_int8_t pad_0xdbb; - u_int16_t GPDMANXTTCL7; - u_int8_t GPDMANXTTCH7; - u_int8_t pad_0xdc0[0x240]; - }; - -CTASSERT(sizeof(struct elan_mmcr) == 4096); - -extern volatile struct elan_mmcr * elan_mmcr; - -#endif /* _MACHINE_ELAN_MMCR_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/fpu.h b/lib/libc/include/x86-freebsd-none/machine/fpu.h deleted file mode 100644 index 0777d7f371..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/fpu.h +++ /dev/null @@ -1,4 +0,0 @@ -/*- - * This file is in the public domain. - */ -#include \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/frame.h b/lib/libc/include/x86-freebsd-none/machine/frame.h deleted file mode 100644 index 19166e1757..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/frame.h +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * Copyright (c) 2003 Peter Wemm. - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _I386_FRAME_H_ -#define _I386_FRAME_H_ - -#include - -#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) -#define EFL_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) - -#define TRAMP_STACK_SZ 4096 -#define TRAMP_COPYOUT_SZ 128 -#define VM86_STACK_SPACE 16 - -#endif /* _I386_FRAME_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/gdb_machdep.h b/lib/libc/include/x86-freebsd-none/machine/gdb_machdep.h deleted file mode 100644 index e3cf162f91..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/gdb_machdep.h +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2004 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MACHINE_GDB_MACHDEP_H_ -#define _MACHINE_GDB_MACHDEP_H_ - -#define GDB_BUFSZ 400 -#define GDB_NREGS 16 -#define GDB_REG_PC 8 - -static __inline size_t -gdb_cpu_regsz(int regnum __unused) -{ - return (sizeof(int)); -} - -static __inline int -gdb_cpu_query(void) -{ - return (0); -} - -static __inline void * -gdb_begin_write(void) -{ - - return (NULL); -} - -static __inline void -gdb_end_write(void *arg __unused) -{ - -} - -void *gdb_cpu_getreg(int, size_t *); -void gdb_cpu_setreg(int, void *); -int gdb_cpu_signal(int, int); -void gdb_cpu_stop_reason(int, int); - -#endif /* !_MACHINE_GDB_MACHDEP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/ieeefp.h b/lib/libc/include/x86-freebsd-none/machine/ieeefp.h deleted file mode 100644 index 2fc5a4785f..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/ieeefp.h +++ /dev/null @@ -1,154 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-4-Clause - * - * Copyright (c) 2003 Peter Wemm. - * Copyright (c) 1990 Andrew Moore, Talke Studio - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_IEEEFP_H_ -#define _MACHINE_IEEEFP_H_ - -/* Deprecated historical FPU control interface */ - -#include - -static __inline fp_rnd_t -fpgetround(void) -{ - unsigned short _cw; - - __fnstcw(&_cw); - return ((fp_rnd_t)((_cw & FP_RND_FLD) >> FP_RND_OFF)); -} - -static __inline fp_rnd_t -fpsetround(fp_rnd_t _m) -{ - fp_rnd_t _p; - unsigned short _cw, _newcw; - - __fnstcw(&_cw); - _p = (fp_rnd_t)((_cw & FP_RND_FLD) >> FP_RND_OFF); - _newcw = _cw & ~FP_RND_FLD; - _newcw |= (_m << FP_RND_OFF) & FP_RND_FLD; - __fnldcw(_cw, _newcw); - return (_p); -} - -static __inline fp_prec_t -fpgetprec(void) -{ - unsigned short _cw; - - __fnstcw(&_cw); - return ((fp_prec_t)((_cw & FP_PRC_FLD) >> FP_PRC_OFF)); -} - -static __inline fp_prec_t -fpsetprec(fp_prec_t _m) -{ - fp_prec_t _p; - unsigned short _cw, _newcw; - - __fnstcw(&_cw); - _p = (fp_prec_t)((_cw & FP_PRC_FLD) >> FP_PRC_OFF); - _newcw = _cw & ~FP_PRC_FLD; - _newcw |= (_m << FP_PRC_OFF) & FP_PRC_FLD; - __fnldcw(_cw, _newcw); - return (_p); -} - -/* - * Get or set the exception mask. - * Note that the x87 mask bits are inverted by the API -- a mask bit of 1 - * means disable for x87 and SSE, but for fp*mask() it means enable. - */ - -static __inline fp_except_t -fpgetmask(void) -{ - unsigned short _cw; - - __fnstcw(&_cw); - return ((~_cw & FP_MSKS_FLD) >> FP_MSKS_OFF); -} - -static __inline fp_except_t -fpsetmask(fp_except_t _m) -{ - fp_except_t _p; - unsigned short _cw, _newcw; - - __fnstcw(&_cw); - _p = (~_cw & FP_MSKS_FLD) >> FP_MSKS_OFF; - _newcw = _cw & ~FP_MSKS_FLD; - _newcw |= (~_m << FP_MSKS_OFF) & FP_MSKS_FLD; - __fnldcw(_cw, _newcw); - return (_p); -} - -static __inline fp_except_t -fpgetsticky(void) -{ - unsigned _ex; - unsigned short _sw; - - __fnstsw(&_sw); - _ex = (_sw & FP_STKY_FLD) >> FP_STKY_OFF; - return ((fp_except_t)_ex); -} - -static __inline fp_except_t -fpresetsticky(fp_except_t _m) -{ - struct { - unsigned _cw; - unsigned _sw; - unsigned _other[5]; - } _env; - fp_except_t _p; - - _m &= FP_STKY_FLD >> FP_STKY_OFF; - _p = fpgetsticky(); - if ((_p & ~_m) == _p) - return (_p); - if ((_p & ~_m) == 0) { - __fnclex(); - return (_p); - } - __fnstenv(&_env); - _env._sw &= ~_m; - __fldenv(&_env); - return (_p); -} - -#endif /* !_MACHINE_IEEEFP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/in_cksum.h b/lib/libc/include/x86-freebsd-none/machine/in_cksum.h deleted file mode 100644 index 8d037a9bef..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/in_cksum.h +++ /dev/null @@ -1,115 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from tahoe: in_cksum.c 1.2 86/01/05 - * from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp - */ - -#ifndef _MACHINE_IN_CKSUM_H_ -#define _MACHINE_IN_CKSUM_H_ 1 - -#include - -#define in_cksum(m, len) in_cksum_skip(m, len, 0) - -/* - * It it useful to have an Internet checksum routine which is inlineable - * and optimized specifically for the task of computing IP header checksums - * in the normal case (where there are no options and the header length is - * therefore always exactly five 32-bit words. - */ -#if defined(IPVERSION) && (IPVERSION == 4) -static __inline u_int -in_cksum_hdr(const struct ip *ip) -{ - u_int sum = 0; - - __asm( - "addl %1, %0\n" - "adcl %2, %0\n" - "adcl %3, %0\n" - "adcl %4, %0\n" - "adcl %5, %0\n" - "adcl $0, %0" - : "+r" (sum) - : "g" (((const u_int32_t *)ip)[0]), - "g" (((const u_int32_t *)ip)[1]), - "g" (((const u_int32_t *)ip)[2]), - "g" (((const u_int32_t *)ip)[3]), - "g" (((const u_int32_t *)ip)[4]) - : "cc" - ); - sum = (sum & 0xffff) + (sum >> 16); - if (sum > 0xffff) - sum -= 0xffff; - - return ~sum & 0xffff; -} -#endif - -static __inline u_short -in_addword(u_short sum, u_short b) -{ - __asm( - "addw %1, %0\n" - "adcw $0, %0" - : "+r" (sum) - : "g" (b) - : "cc" - ); - return (sum); -} - -static __inline u_short -in_pseudo(u_int sum, u_int b, u_int c) -{ - __asm( - "addl %1, %0\n" - "adcl %2, %0\n" - "adcl $0, %0" - : "+r" (sum) - : "g" (b), - "g" (c) - : "cc" - ); - sum = (sum & 0xffff) + (sum >> 16); - if (sum > 0xffff) - sum -= 0xffff; - return (sum); -} - -#ifdef _KERNEL - -#define HAVE_MD_IN_CKSUM - -u_short in_cksum_skip(struct mbuf *m, int len, int skip); -#endif /* _KERNEL */ - -#endif /* _MACHINE_IN_CKSUM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/intr_machdep.h b/lib/libc/include/x86-freebsd-none/machine/intr_machdep.h deleted file mode 100644 index 8a03cad39d..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/intr_machdep.h +++ /dev/null @@ -1,5 +0,0 @@ -/*- - * This file is in the public domain. - */ - -#include \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/iommu.h b/lib/libc/include/x86-freebsd-none/machine/iommu.h deleted file mode 100644 index 48ccad6a5c..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/iommu.h +++ /dev/null @@ -1,7 +0,0 @@ -/*- - * This file is in the public domain. - */ - -#include - -#define IOMMU_DOMAIN_UNLOAD_SLEEP \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/kdb.h b/lib/libc/include/x86-freebsd-none/machine/kdb.h deleted file mode 100644 index a6da687ba2..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/kdb.h +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2004 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MACHINE_KDB_H_ -#define _MACHINE_KDB_H_ - -#include -#include - -int kdb_cpu_set_watchpoint(vm_offset_t addr, vm_size_t size, int access); -int kdb_cpu_clr_watchpoint(vm_offset_t addr, vm_size_t size); - -static __inline void -kdb_cpu_clear_singlestep(void) -{ - kdb_frame->tf_eflags &= ~PSL_T; -} - -static __inline void -kdb_cpu_set_singlestep(void) -{ - kdb_frame->tf_eflags |= PSL_T; -} - -static __inline void -kdb_cpu_sync_icache(unsigned char *addr, size_t size) -{ -} - -static __inline void -kdb_cpu_trap(int type, int code) -{ -} - -#endif /* _MACHINE_KDB_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/md_var.h b/lib/libc/include/x86-freebsd-none/machine/md_var.h deleted file mode 100644 index ad8e8658e2..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/md_var.h +++ /dev/null @@ -1,83 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1995 Bruce D. Evans. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_MD_VAR_H_ -#define _MACHINE_MD_VAR_H_ - -#include - -extern u_int cpu_fxsr; -extern u_int cyrix_did; -#if defined(I586_CPU) && !defined(NO_F00F_HACK) -extern int has_f00f_bug; -#endif -#ifdef COMPAT_FREEBSD4 -extern int szfreebsd4_sigcode; -#endif -#ifdef COMPAT_43 -extern int szosigcode; -extern int sz_lcall_tramp; -#endif -extern vm_offset_t proc0kstack; -extern size_t setidt_disp; - -struct segment_descriptor; -union savefpu; - -int cp_slow0(vm_offset_t uva, size_t len, bool write, - void (*f)(vm_offset_t, void *), void *arg); -void cpu_switch_load_gs(void) __asm(__STRING(cpu_switch_load_gs)); -void copyout_init_tramp(void); -void doreti_iret(void) __asm(__STRING(doreti_iret)); -void doreti_iret_fault(void) __asm(__STRING(doreti_iret_fault)); -void doreti_popl_ds(void) __asm(__STRING(doreti_popl_ds)); -void doreti_popl_ds_fault(void) __asm(__STRING(doreti_popl_ds_fault)); -void doreti_popl_es(void) __asm(__STRING(doreti_popl_es)); -void doreti_popl_es_fault(void) __asm(__STRING(doreti_popl_es_fault)); -void doreti_popl_fs(void) __asm(__STRING(doreti_popl_fs)); -void doreti_popl_fs_fault(void) __asm(__STRING(doreti_popl_fs_fault)); -void fill_based_sd(struct segment_descriptor *sdp, uint32_t base); -void i686_pagezero(void *addr); -void sse2_pagezero(void *addr); -int cpu_minidumpsys_nopae(struct dumperinfo *, const struct minidumpstate *); -int cpu_minidumpsys_pae(struct dumperinfo *, const struct minidumpstate *); -void init_AMD_Elan_sc520(void); -vm_paddr_t kvtop(void *addr); -void panicifcpuunsupported(void); -void ppro_reenable_apic(void); -void set_fsbase(struct thread *td, uint32_t base); -void set_gsbase(struct thread *td, uint32_t base); -void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int selec); -void setidt_nodisp(int idx, uintptr_t func, int typ, int dpl, int selec); -union savefpu *get_pcb_user_save_td(struct thread *td); -union savefpu *get_pcb_user_save_pcb(struct pcb *pcb); - -#endif /* !_MACHINE_MD_VAR_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/minidump.h b/lib/libc/include/x86-freebsd-none/machine/minidump.h deleted file mode 100644 index 53d55ba9f9..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/minidump.h +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2006 Peter Wemm - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MACHINE_MINIDUMP_H_ -#define _MACHINE_MINIDUMP_H_ 1 - -#define MINIDUMP_MAGIC "minidump FreeBSD/i386" -#define MINIDUMP_VERSION 2 - -struct minidumphdr { - char magic[24]; - uint32_t version; - uint32_t msgbufsize; - uint32_t bitmapsize; - uint32_t ptesize; - uint32_t kernbase; - uint32_t paemode; - uint32_t dumpavailsize; -}; - -#endif /* _MACHINE_MINIDUMP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/npx.h b/lib/libc/include/x86-freebsd-none/machine/npx.h deleted file mode 100644 index 3c66e65dff..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/npx.h +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * 287/387 NPX Coprocessor Data Structures and Constants - * W. Jolitz 1/90 - */ - -#ifndef _MACHINE_NPX_H_ -#define _MACHINE_NPX_H_ - -#include - -#ifdef _KERNEL - -struct fpu_kern_ctx; - -#define PCB_USER_FPU(pcb) (((pcb)->pcb_flags & PCB_KERNNPX) == 0) - -#define XSAVE_AREA_ALIGN 64 - -int npxdna(void); -void npxdrop(void); -void npxexit(struct thread *td); -int npxformat(void); -int npxgetregs(struct thread *td); -void npxinit(bool bsp); -void npxresume(union savefpu *addr); -void npxsave(union savefpu *addr); -int npxsetregs(struct thread *td, union savefpu *addr, - char *xfpustate, size_t xfpustate_size); -int npxsetxstate(struct thread *td, char *xfpustate, - size_t xfpustate_size); -void npxsuspend(union savefpu *addr); -int npxtrap_x87(void); -int npxtrap_sse(void); -void npxuserinited(struct thread *); -void npx_get_fsave(void *); -int npx_set_fsave(void *); -void npx_fill_fpregs_xmm(struct savexmm *, struct save87 *); -void npx_set_fpregs_xmm(struct save87 *, struct savexmm *); - -struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags); -void fpu_kern_free_ctx(struct fpu_kern_ctx *ctx); -void fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, - u_int flags); -int fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx); -int fpu_kern_thread(u_int flags); -int is_fpu_kern_thread(u_int flags); - -union savefpu *fpu_save_area_alloc(void); -void fpu_save_area_free(union savefpu *fsa); -void fpu_save_area_reset(union savefpu *fsa); - -/* - * Flags for fpu_kern_alloc_ctx(), fpu_kern_enter() and fpu_kern_thread(). - */ -#define FPU_KERN_NORMAL 0x0000 -#define FPU_KERN_NOWAIT 0x0001 -#define FPU_KERN_KTHR 0x0002 -#define FPU_KERN_NOCTX 0x0004 - -#endif - -#endif /* !_MACHINE_NPX_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/param.h b/lib/libc/include/x86-freebsd-none/machine/param.h deleted file mode 100644 index 5699c7f0fd..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/param.h +++ /dev/null @@ -1,153 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _I386_INCLUDE_PARAM_H_ -#define _I386_INCLUDE_PARAM_H_ - -#include - -/* - * Machine dependent constants for Intel 386. - */ - -#define __HAVE_PIR - -#ifndef MACHINE -#define MACHINE "i386" -#endif -#ifndef MACHINE_ARCH -#define MACHINE_ARCH "i386" -#endif -#define MID_MACHINE MID_I386 - -#ifdef SMP -#ifndef MAXCPU -#define MAXCPU 32 -#endif -#else -#define MAXCPU 1 -#endif - -#ifndef MAXMEMDOM -#define MAXMEMDOM 1 -#endif - -#define ALIGNBYTES _ALIGNBYTES -#define ALIGN(p) _ALIGN(p) -/* - * ALIGNED_POINTER is a boolean macro that checks whether an address - * is valid to fetch data elements of type t from on this architecture. - * This does not reflect the optimal alignment, just the possibility - * (within reasonable limits). - */ -#define ALIGNED_POINTER(p, t) 1 - -/* - * CACHE_LINE_SIZE is the compile-time maximum cache line size for an - * architecture. It should be used with appropriate caution. - */ -#define CACHE_LINE_SHIFT 6 -#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) - -#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ -#define PAGE_SIZE (1 << PAGE_SHIFT) /* bytes/page */ -#define PAGE_MASK (PAGE_SIZE - 1) -#define NPTEPG (PAGE_SIZE / sizeof(pt_entry_t)) - -/* Size in bytes of the page directory */ -#define NBPTD (NPGPTD << PAGE_SHIFT) -/* Number of PDEs in page directory, 2048 for PAE, 1024 for non-PAE */ -#define NPDEPTD (NBPTD / sizeof(pd_entry_t)) -/* Number of PDEs in one page of the page directory, 512 vs. 1024 */ -#define NPDEPG (PAGE_SIZE / sizeof(pd_entry_t)) -#define PDRMASK (NBPDR - 1) -#ifndef PDRSHIFT -#define PDRSHIFT i386_pmap_PDRSHIFT -#endif -#ifndef NBPDR -#define NBPDR (1 << PDRSHIFT) /* bytes/page dir */ -#endif - -#define MAXPAGESIZES 2 /* maximum number of supported page sizes */ - -#define IOPAGES 2 /* pages of i/o permission bitmap */ - -#ifndef KSTACK_PAGES -#define KSTACK_PAGES 4 /* Includes pcb! */ -#endif -#define KSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */ -#if KSTACK_PAGES < 4 -#define TD0_KSTACK_PAGES 4 -#else -#define TD0_KSTACK_PAGES KSTACK_PAGES -#endif - -/* - * Ceiling on amount of swblock kva space, can be changed via - * the kern.maxswzone /boot/loader.conf variable. - * - * 276 is sizeof(struct swblock), but we do not always have a definition - * in scope for struct swblock, so we have to hardcode it. Each struct - * swblock holds metadata for 32 pages, so in theory, this is enough for - * 16 GB of swap. In practice, however, the usable amount is considerably - * lower due to fragmentation. - */ -#ifndef VM_SWZONE_SIZE_MAX -#define VM_SWZONE_SIZE_MAX (276 * 128 * 1024) -#endif - -/* - * Ceiling on size of buffer cache (really only effects write queueing, - * the VM page cache is not effected), can be changed via - * the kern.maxbcache /boot/loader.conf variable. - * - * The value is equal to the size of the auto-tuned buffer map for - * the machine with 4GB of RAM, see vfs_bio.c:kern_vfs_bio_buffer_alloc(). - */ -#ifndef VM_BCACHE_SIZE_MAX -#define VM_BCACHE_SIZE_MAX (7224 * 16 * 1024) -#endif - -/* - * Mach derived conversion macros - */ -#define trunc_4mpage(x) ((x) & ~PDRMASK) -#define round_4mpage(x) ((((x)) + PDRMASK) & ~PDRMASK) - -#define i386_btop(x) ((x) >> PAGE_SHIFT) -#define i386_ptob(x) ((x) << PAGE_SHIFT) - -#define INKERNEL(va) (TRUE) - -#endif /* !_I386_INCLUDE_PARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/pc/bios.h b/lib/libc/include/x86-freebsd-none/machine/pc/bios.h deleted file mode 100644 index a267f1c872..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/pc/bios.h +++ /dev/null @@ -1,321 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 1997 Michael Smith - * Copyright (c) 1998 Jonathan Lemon - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_PC_BIOS_H_ -#define _MACHINE_PC_BIOS_H_ - -/* - * Signature structure for the BIOS32 Service Directory header - */ -struct bios32_SDheader -{ - u_int8_t sig[4]; - u_int32_t entry; - u_int8_t revision; - u_int8_t len; - u_int8_t cksum; - u_int8_t pad[5]; -}; - -/* - * PnP BIOS presence structure - */ -struct PnPBIOS_table -{ - u_int8_t sig[4]; /* "$PnP */ - u_int8_t version; /* should be 0x10 */ - u_int8_t len; /* total structure length */ - u_int16_t control; /* BIOS feature flags */ - u_int8_t cksum; /* checksum */ - u_int32_t evflagaddr; /* address of event notificaton flag */ - u_int16_t rmentryoffset; /* real-mode entry offset */ - u_int16_t rmentryseg; /* segment */ - u_int16_t pmentryoffset; /* protected-mode entry offset */ - u_int32_t pmentrybase; /* segment base */ - u_int32_t oemdevid; /* motherboard EISA ID */ - u_int16_t rmbiosseg; /* real-mode BIOS segment */ - u_int32_t pmdataseg; /* protected-mode data segment */ -} __packed; - -/* - * PnP BIOS return codes - */ -#define PNP_SUCCESS 0x00 -#define PNP_NOT_SET_STATICALLY 0x7f -#define PNP_UNKNOWN_FUNCTION 0x81 -#define PNP_FUNCTION_NOT_SUPPORTED 0x82 -#define PNP_INVALID_HANDLE 0x83 -#define PNP_BAD_PARAMETER 0x84 -#define PNP_SET_FAILED 0x85 -#define PNP_EVENTS_NOT_PENDING 0x86 -#define PNP_SYSTEM_NOT_DOCKED 0x87 -#define PNP_NO_ISA_PNP_CARDS 0x88 -#define PNP_UNABLE_TO_DETERMINE_DOCK_CAPABILITIES 0x89 -#define PNP_CONFIG_CHANGE_FAILED_NO_BATTERY 0x8a -#define PNP_CONFIG_CHANGE_FAILED_RESOURCE_CONFLICT 0x8b -#define PNP_BUFFER_TOO_SMALL 0x8c -#define PNP_USE_ESCD_SUPPORT 0x8d -#define PNP_MESSAGE_NOT_SUPPORTED 0x8e -#define PNP_HARDWARE_ERROR 0x8f - -/* - * DMI return codes - */ -#define DMI_SUCCESS 0x00 -#define DMI_UNKNOWN_FUNCTION 0x81 -#define DMI_FUNCTION_NOT_SUPPORTED 0x82 -#define DMI_INVALID_HANDLE 0x83 -#define DMI_BAD_PARAMETER 0x84 -#define DMI_INVALID_SUBFUNCTION 0x85 -#define DMI_NO_CHANGE 0x86 -#define DMI_ADD_STRUCTURE_FAILED 0x87 -#define DMI_READ_ONLY 0x8d -#define DMI_LOCK_NOT_SUPPORTED 0x90 -#define DMI_CURRENTLY_LOCKED 0x91 -#define DMI_INVALID_LOCK 0x92 - -/* - * format specifiers and defines for bios16() - * s = short (16 bits) - * i = int (32 bits) - * p = pointer (converted to seg:offset) - * C,D,U = selector (corresponding to code/data/utility segment) - */ -#define PNP_COUNT_DEVNODES "sppD", 0x00 -#define PNP_GET_DEVNODE "sppsD", 0x01 -#define PNP_SET_DEVNODE "sspsD", 0x02 -#define PNP_GET_EVENT "spD", 0x03 -#define PNP_SEND_MSG "ssD", 0x04 -#define PNP_GET_DOCK_INFO "spD", 0x05 - -#define PNP_SEL_PRIBOOT "ssiiisspD", 0x07 -#define PNP_GET_PRIBOOT "sspppppD", 0x08 -#define PNP_SET_RESINFO "spD", 0x09 -#define PNP_GET_RESINFO "spD", 0x0A -#define PNP_GET_APM_ID "sppD", 0x0B - -#define PNP_GET_ISA_INFO "spD", 0x40 -#define PNP_GET_ECSD_INFO "spppD", 0x41 -#define PNP_READ_ESCD "spUD", 0x42 -#define PNP_WRITE_ESCD "spUD", 0x43 - -#define PNP_GET_DMI_INFO "spppppD", 0x50 -#define PNP_GET_DMI_STRUCTURE "sppUD", 0x51 -#define PNP_SET_DMI_STRUCTURE "sppsUD" 0x52 -#define PNP_GET_DMI_CHANGE "spUD" 0x53 -#define PNP_DMI_CONTROL "sspsUD" 0x54 -#define PNP_GET_GPNV_INFO "sppppD" 0x55 -#define PNP_READ_GPNV_DATA "ssppUD" 0x56 -#define PNP_WRITE_GPNV_DATA "sspsUD" 0x57 - -#define PNP_BOOT_CHECK "sp", 0x60 -#define PNP_COUNT_IPL "sppp", 0x61 -#define PNP_GET_BOOTPRI "spp", 0x62 -#define PNP_SET_BOOTPRI "sp", 0x63 -#define PNP_GET_LASTBOOT "sp", 0x64 -#define PNP_GET_BOOTFIRST "sp", 0x65 -#define PNP_SET_BOOTFIRST "sp", 0x66 - -/* - * PCI BIOS functions - */ -#define PCIBIOS_BIOS_PRESENT 0xb101 -#define PCIBIOS_READ_CONFIG_BYTE 0xb108 -#define PCIBIOS_READ_CONFIG_WORD 0xb109 -#define PCIBIOS_READ_CONFIG_DWORD 0xb10a -#define PCIBIOS_WRITE_CONFIG_BYTE 0xb10b -#define PCIBIOS_WRITE_CONFIG_WORD 0xb10c -#define PCIBIOS_WRITE_CONFIG_DWORD 0xb10d -#define PCIBIOS_GET_IRQ_ROUTING 0xb10e -#define PCIBIOS_ROUTE_INTERRUPT 0xb10f - -/* - * PCI interrupt routing table. - * - * $PIR in the BIOS segment contains a PIR_table - * int 1a:b106 returns PIR_table in buffer at es:(e)di - * int 1a:b18e returns PIR_table in buffer at es:(e)di - * int 1a:b406 returns es:di pointing to the BIOS PIR_table - */ -struct PIR_header -{ - int8_t ph_signature[4]; - u_int16_t ph_version; - u_int16_t ph_length; - u_int8_t ph_router_bus; - u_int8_t ph_router_dev_fn; - u_int16_t ph_pci_irqs; - u_int16_t ph_router_vendor; - u_int16_t ph_router_device; - u_int32_t ph_miniport; - u_int8_t ph_res[11]; - u_int8_t ph_checksum; -} __packed; - -struct PIR_intpin -{ - u_int8_t link; - u_int16_t irqs; -} __packed; - -struct PIR_entry -{ - u_int8_t pe_bus; - u_int8_t pe_res1:3; - u_int8_t pe_device:5; - struct PIR_intpin pe_intpin[4]; - u_int8_t pe_slot; - u_int8_t pe_res3; -} __packed; - -struct PIR_table -{ - struct PIR_header pt_header; - struct PIR_entry pt_entry[0]; -} __packed; - -/* - * Int 15:E820 'SMAP' structure - */ -#define SMAP_SIG 0x534D4150 /* 'SMAP' */ - -#define SMAP_TYPE_MEMORY 1 -#define SMAP_TYPE_RESERVED 2 -#define SMAP_TYPE_ACPI_RECLAIM 3 -#define SMAP_TYPE_ACPI_NVS 4 -#define SMAP_TYPE_ACPI_ERROR 5 -#define SMAP_TYPE_DISABLED 6 -#define SMAP_TYPE_PMEM 7 -#define SMAP_TYPE_PRAM 12 - -#define SMAP_XATTR_ENABLED 0x00000001 -#define SMAP_XATTR_NON_VOLATILE 0x00000002 -#define SMAP_XATTR_MASK (SMAP_XATTR_ENABLED | SMAP_XATTR_NON_VOLATILE) - -struct bios_smap { - u_int64_t base; - u_int64_t length; - u_int32_t type; -} __packed; - -/* Structure extended to include extended attribute field in ACPI 3.0. */ -struct bios_smap_xattr { - u_int64_t base; - u_int64_t length; - u_int32_t type; - u_int32_t xattr; -} __packed; - -#ifdef _KERNEL -#define BIOS_PADDRTOVADDR(x) ((x) + PMAP_MAP_LOW) -#define BIOS_VADDRTOPADDR(x) ((x) - PMAP_MAP_LOW) - -struct bios_oem_signature { - char * anchor; /* search anchor string in BIOS memory */ - size_t offset; /* offset from anchor (may be negative) */ - size_t totlen; /* total length of BIOS string to copy */ -} __packed; - -struct bios_oem_range { - u_int from; /* shouldn't be below 0xe0000 */ - u_int to; /* shouldn't be above 0xfffff */ -} __packed; - -struct bios_oem { - struct bios_oem_range range; - struct bios_oem_signature signature[]; -} __packed; - -struct segment_info { - u_int base; - u_int limit; -}; - -#define BIOSCODE_FLAG 0x01 -#define BIOSDATA_FLAG 0x02 -#define BIOSUTIL_FLAG 0x04 -#define BIOSARGS_FLAG 0x08 - -struct bios_segments { - struct segment_info code32; /* 32-bit code (mandatory) */ - struct segment_info code16; /* 16-bit code */ - struct segment_info data; /* 16-bit data */ - struct segment_info util; /* 16-bit utility */ - struct segment_info args; /* 16-bit args */ -}; - -struct bios_regs { - u_int eax; - u_int ebx; - u_int ecx; - u_int edx; - u_int esi; - u_int edi; -}; - -struct bios_args { - u_int entry; /* entry point of routine */ - struct bios_regs r; - struct bios_segments seg; -}; - -/* - * BIOS32 Service Directory entry. Caller supplies name, bios32_SDlookup - * fills in the rest of the details. - */ -struct bios32_SDentry -{ - union - { - u_int8_t name[4]; /* service identifier */ - u_int32_t id; /* as a 32-bit value */ - } ident; - u_int32_t base; /* base of service */ - u_int32_t len; /* service length */ - u_int32_t entry; /* entrypoint offset from base */ - vm_offset_t ventry; /* entrypoint in kernel virtual segment */ -}; - -/* - * Exported lookup results - */ -extern struct bios32_SDentry PCIbios; - -int bios_oem_strings(struct bios_oem *oem, u_char *buffer, size_t maxlen); -uint32_t bios_sigsearch(uint32_t start, u_char *sig, int siglen, int paralen, - int sigofs); -int bios16(struct bios_args *, char *, ...); -int bios16_call(struct bios_regs *, char *); -int bios32(struct bios_regs *, u_int, u_short); -int bios32_SDlookup(struct bios32_SDentry *ent); -void set_bios_selectors(struct bios_segments *, int); - -#endif - -#endif /* _MACHINE_PC_BIOS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/pcb.h b/lib/libc/include/x86-freebsd-none/machine/pcb.h deleted file mode 100644 index 897227eb4d..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/pcb.h +++ /dev/null @@ -1,116 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _I386_PCB_H_ -#define _I386_PCB_H_ - -/* - * Intel 386 process control block - */ -#ifndef _KERNEL -#include -#endif -#include - -/* - * NB: The fields marked with (*) are used by kernel debuggers. Their - * ABI should be preserved. - */ -struct pcb { - int pcb_edi; /* (*) */ - int pcb_esi; /* (*) */ - int pcb_ebp; /* (*) */ - int pcb_esp; /* (*) */ - int pcb_ebx; /* (*) */ - int pcb_eip; /* (*) */ - struct segment_descriptor pcb_fsd; - struct segment_descriptor pcb_gsd; - int pcb_ds; - int pcb_es; - int pcb_fs; - int pcb_gs; - int pcb_ss; - int pcb_cr0; - int pcb_cr2; - int pcb_cr3; - int pcb_cr4; - int pcb_dr0; - int pcb_dr1; - int pcb_dr2; - int pcb_dr3; - int pcb_dr6; - int pcb_dr7; - - struct region_descriptor pcb_gdt; - struct region_descriptor pcb_idt; - uint16_t pcb_ldt; - uint16_t pcb_tr; - - u_int pcb_flags; -#define PCB_DBREGS 0x02 /* process using debug registers */ -#define PCB_KERNNPX_THR 0x04 /* fpu_kern_thread() */ -#define PCB_NPXINITDONE 0x08 /* fpu state is initialized */ -#define PCB_VM86CALL 0x10 /* in vm86 call */ -#define PCB_NPXUSERINITDONE 0x20 /* user fpu state is initialized */ -#define PCB_KERNNPX 0x40 /* kernel uses npx */ -#define PCB_NPXNOSAVE 0x80 /* no save area for current FPU ctx */ - - uint16_t pcb_initial_npxcw; - - caddr_t pcb_onfault; /* copyin/out fault recovery */ - struct pcb_ext *pcb_ext; /* optional pcb extension */ - int pcb_waspsl; /* unused padding for ABI and API compat */ - u_long pcb_vm86[2]; /* vm86bios scratch space */ - union savefpu *pcb_save; - - uint32_t pcb_pad[10]; -}; - -/* Per-CPU state saved during suspend and resume. */ -struct susppcb { - struct pcb sp_pcb; - - /* fpu context for suspend/resume */ - void *sp_fpususpend; -}; - -#ifdef _KERNEL -struct trapframe; - -void makectx(struct trapframe *, struct pcb *); -int savectx(struct pcb *) __returns_twice; -void resumectx(struct pcb *) __fastcall; -#endif - -#endif /* _I386_PCB_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/pcb_ext.h b/lib/libc/include/x86-freebsd-none/machine/pcb_ext.h deleted file mode 100644 index 647747568a..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/pcb_ext.h +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 1997 Jonathan Lemon - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _I386_PCB_EXT_H_ -#define _I386_PCB_EXT_H_ - -/* - * Extension to the 386 process control block - */ -#include -#include -#include - -struct pcb_ext { - struct segment_descriptor ext_tssd; /* tss descriptor */ - struct i386tss ext_tss; /* per-process i386tss */ - caddr_t ext_iomap; /* i/o permission bitmap */ - struct vm86_kernel ext_vm86; /* vm86 area */ -}; - -#ifdef _KERNEL -int i386_extend_pcb(struct thread *); -#endif - -#endif /* _I386_PCB_EXT_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/pcpu.h b/lib/libc/include/x86-freebsd-none/machine/pcpu.h deleted file mode 100644 index 87c6b69f2b..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/pcpu.h +++ /dev/null @@ -1,196 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) Peter Wemm - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_PCPU_H_ -#define _MACHINE_PCPU_H_ - -#include -#include - -#include -#include - -struct monitorbuf { - int idle_state; /* Used by cpu_idle_mwait. */ - int stop_state; /* Used by cpustop_handler. */ - char padding[128 - (2 * sizeof(int))]; -}; -_Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); - -/* - * The SMP parts are setup in pmap.c and machdep.c for the BSP, and - * pmap.c and mp_machdep.c sets up the data for the AP's to "see" when - * they awake. The reason for doing it via a struct is so that an - * array of pointers to each CPU's data can be set up for things like - * "check curproc on all other processors" - */ - -#define PCPU_MD_FIELDS \ - struct monitorbuf pc_monitorbuf __aligned(128); /* cache line */\ - struct pcpu *pc_prvspace; /* Self-reference */ \ - struct pmap *pc_curpmap; \ - struct segment_descriptor pc_common_tssd; \ - struct segment_descriptor *pc_tss_gdt; \ - struct segment_descriptor *pc_fsgs_gdt; \ - struct i386tss *pc_common_tssp; \ - u_int pc_kesp0; \ - u_int pc_trampstk; \ - int pc_currentldt; \ - u_int pc_acpi_id; /* ACPI CPU id */ \ - u_int pc_apic_id; \ - int pc_private_tss; /* Flag indicating private tss*/\ - u_int pc_cmci_mask; /* MCx banks for CMCI */ \ - u_int pc_vcpu_id; /* Xen vCPU ID */ \ - struct mtx pc_cmap_lock; \ - void *pc_cmap_pte1; \ - void *pc_cmap_pte2; \ - caddr_t pc_cmap_addr1; \ - caddr_t pc_cmap_addr2; \ - vm_offset_t pc_qmap_addr; /* KVA for temporary mappings */\ - vm_offset_t pc_copyout_maddr; \ - vm_offset_t pc_copyout_saddr; \ - struct mtx pc_copyout_mlock; \ - struct sx pc_copyout_slock; \ - char *pc_copyout_buf; \ - vm_offset_t pc_pmap_eh_va; \ - caddr_t pc_pmap_eh_ptep; \ - uint32_t pc_smp_tlb_done; /* TLB op acknowledgement */ \ - uint32_t pc_ibpb_set; \ - void *pc_mds_buf; \ - void *pc_mds_buf64; \ - uint32_t pc_pad[4]; \ - uint8_t pc_mds_tmp[64]; \ - u_int pc_ipi_bitmap; \ - char __pad[3518] - -#ifdef _KERNEL - -#define MONITOR_STOPSTATE_RUNNING 0 -#define MONITOR_STOPSTATE_STOPPED 1 - -/* - * Evaluates to the byte offset of the per-cpu variable name. - */ -#define __pcpu_offset(name) \ - __offsetof(struct pcpu, name) - -/* - * Evaluates to the type of the per-cpu variable name. - */ -#define __pcpu_type(name) \ - __typeof(((struct pcpu *)0)->name) - -/* - * Evaluates to the address of the per-cpu variable name. - */ -#define __PCPU_PTR(name) \ - (&get_pcpu()->name) - -/* - * Evaluates to the value of the per-cpu variable name. - */ -#define __PCPU_GET(name) __extension__ ({ \ - __pcpu_type(name) __res; \ - struct __s { \ - u_char __b[MIN(sizeof(__res), 4)]; \ - }; \ - \ - if (sizeof(__res) == 1 || sizeof(__res) == 2 || \ - sizeof(__res) == 4) { \ - __asm __volatile("mov %%fs:%c1,%0" \ - : "=r" (*(struct __s *)(void *)&__res) \ - : "i" (__pcpu_offset(name))); \ - } else { \ - __res = *__PCPU_PTR(name); \ - } \ - __res; \ -}) - -/* - * Adds a value of the per-cpu counter name. The implementation - * must be atomic with respect to interrupts. - */ -#define __PCPU_ADD(name, val) do { \ - __pcpu_type(name) __val; \ - struct __s { \ - u_char __b[MIN(sizeof(__val), 4)]; \ - }; \ - \ - __val = (val); \ - if (sizeof(__val) == 1 || sizeof(__val) == 2 || \ - sizeof(__val) == 4) { \ - __asm __volatile("add %1,%%fs:%c0" \ - : \ - : "i" (__pcpu_offset(name)), \ - "r" (*(struct __s *)(void *)&__val) \ - : "cc", "memory"); \ - } else \ - *__PCPU_PTR(name) += __val; \ -} while (0) - -/* - * Sets the value of the per-cpu variable name to value val. - */ -#define __PCPU_SET(name, val) do { \ - __pcpu_type(name) __val; \ - struct __s { \ - u_char __b[MIN(sizeof(__val), 4)]; \ - }; \ - \ - __val = (val); \ - if (sizeof(__val) == 1 || sizeof(__val) == 2 || \ - sizeof(__val) == 4) { \ - __asm __volatile("mov %1,%%fs:%c0" \ - : \ - : "i" (__pcpu_offset(name)), \ - "r" (*(struct __s *)(void *)&__val) \ - : "memory"); \ - } else { \ - *__PCPU_PTR(name) = __val; \ - } \ -} while (0) - -#define get_pcpu() __extension__ ({ \ - struct pcpu *__pc; \ - \ - __asm __volatile("movl %%fs:%c1,%0" \ - : "=r" (__pc) \ - : "i" (__pcpu_offset(pc_prvspace))); \ - __pc; \ -}) - -#define PCPU_GET(member) __PCPU_GET(pc_ ## member) -#define PCPU_ADD(member, val) __PCPU_ADD(pc_ ## member, val) -#define PCPU_PTR(member) __PCPU_PTR(pc_ ## member) -#define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val) - -#define IS_BSP() (PCPU_GET(cpuid) == 0) - -#endif /* _KERNEL */ - -#endif /* !_MACHINE_PCPU_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/pcpu_aux.h b/lib/libc/include/x86-freebsd-none/machine/pcpu_aux.h deleted file mode 100644 index 5807079df3..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/pcpu_aux.h +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2019 The FreeBSD Foundation - * - * This software was developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_PCPU_AUX_H_ -#define _MACHINE_PCPU_AUX_H_ - -#ifndef _KERNEL -#error "Not for userspace" -#endif - -#ifndef _SYS_PCPU_H_ -#error "Do not include machine/pcpu_aux.h directly" -#endif - -/* Required for counters(9) to work on x86. */ -_Static_assert(sizeof(struct pcpu) == UMA_PCPU_ALLOC_SIZE, "fix pcpu size"); - -extern struct pcpu __pcpu[]; - -static __inline __pure2 struct thread * -__curthread(void) -{ - struct thread *td; - - __asm("movl %%fs:%c1,%0" : "=r" (td) - : "i" (offsetof(struct pcpu, pc_curthread))); - return (td); -} -#define curthread (__curthread()) - -static __inline __pure2 struct pcb * -__curpcb(void) -{ - struct pcb *pcb; - - __asm("movl %%fs:%c1,%0" : "=r" (pcb) - : "i" (offsetof(struct pcpu, pc_curpcb))); - return (pcb); -} -#define curpcb (__curpcb()) - -#endif /* _MACHINE_PCPU_AUX_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/perfmon.h b/lib/libc/include/x86-freebsd-none/machine/perfmon.h deleted file mode 100644 index 115fc233eb..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/perfmon.h +++ /dev/null @@ -1,253 +0,0 @@ -/*- - * Copyright 1996 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby - * granted, provided that both the above copyright notice and this - * permission notice appear in all copies, that both the above - * copyright notice and this permission notice appear in all - * supporting documentation, and that the name of M.I.T. not be used - * in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. M.I.T. makes - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied - * warranty. - * - * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS - * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT - * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Interface to performance-monitoring counters for Intel Pentium and - * Pentium Pro CPUs. - */ - -#ifndef _MACHINE_PERFMON_H_ -#define _MACHINE_PERFMON_H_ - -#ifndef _KERNEL -#include -#endif -#include - -#define NPMC 2 - -#define PMIOSETUP _IOW('5', 1, struct pmc) -#define PMIOGET _IOWR('5', 7, struct pmc) -#define PMIOSTART _IOW('5', 2, int) -#define PMIOSTOP _IOW('5', 3, int) -#define PMIOREAD _IOWR('5', 4, struct pmc_data) -#define PMIORESET _IOW('5', 5, int) -#define PMIOTSTAMP _IOR('5', 6, struct pmc_tstamp) - -struct pmc { - int pmc_num; - union { - struct { - unsigned char pmcus_event; - unsigned char pmcus_unit; - unsigned char pmcus_flags; - unsigned char pmcus_mask; - } pmcu_s; - unsigned int pmcu_val; - } pmc_pmcu; -}; - -#define PMC_ALL (-1) - -#define pmc_event pmc_pmcu.pmcu_s.pmcus_event -#define pmc_unit pmc_pmcu.pmcu_s.pmcus_unit -#define pmc_flags pmc_pmcu.pmcu_s.pmcus_flags -#define pmc_mask pmc_pmcu.pmcu_s.pmcus_mask -#define pmc_val pmc_pmcu.pmcu_val - -#define PMCF_USR 0x01 /* count events in user mode */ -#define PMCF_OS 0x02 /* count events in kernel mode */ -#define PMCF_E 0x04 /* use edge-detection mode */ -#define PMCF_PC 0x08 /* PMx output pin control */ -#define PMCF_INT 0x10 /* APIC interrupt enable (do not use) */ -#define PMCF_EN 0x40 /* enable counters */ -#define PMCF_INV 0x80 /* invert counter mask comparison */ - -#define PMCF_SYS_FLAGS (PMCF_INT | PMCF_EN) /* user cannot set */ - -struct pmc_data { - int pmcd_num; - quad_t pmcd_value; -}; - -struct pmc_tstamp { - int pmct_rate; - quad_t pmct_value; -}; - -#ifndef _KERNEL - -#define _PATH_PERFMON "/dev/perfmon" - -#else - -/* - * Intra-kernel interface to performance monitoring counters - */ -void perfmon_init(void); -int perfmon_avail(void); -int perfmon_setup(int, unsigned int); -int perfmon_get(int, unsigned int *); -int perfmon_fini(int); -int perfmon_start(int); -int perfmon_stop(int); -int perfmon_read(int, quad_t *); -int perfmon_reset(int); - -#endif /* _KERNEL */ - -/* - * Pentium Pro performance counters, from Appendix B. - */ -/* Data Cache Unit */ -#define PMC6_DATA_MEM_REFS 0x43 -#define PMC6_DCU_LINES_IN 0x45 -#define PMC6_DCU_M_LINES_IN 0x46 -#define PMC6_DCU_M_LINES_OUT 0x47 -#define PMC6_DCU_MISS_OUTSTANDING 0x48 - -/* Instruction Fetch Unit */ -#define PMC6_IFU_IFETCH 0x80 -#define PMC6_IFU_IFETCH_MISS 0x81 -#define PMC6_ITLB_MISS 0x85 -#define PMC6_IFU_MEM_STALL 0x86 -#define PMC6_ILD_STALL 0x87 - -/* L2 Cache */ -#define PMC6_L2_IFETCH 0x28 /* MESI */ -#define PMC6_L2_LD 0x29 /* MESI */ -#define PMC6_L2_ST 0x2a /* MESI */ -#define PMC6_L2_LINES_IN 0x24 -#define PMC6_L2_LINES_OUT 0x26 -#define PMC6_L2_M_LINES_INM 0x25 -#define PMC6_L2_M_LINES_OUTM 0x27 -#define PMC6_L2_RQSTS 0x2e /* MESI */ -#define PMC6_L2_ADS 0x21 -#define PMC6_L2_DBUS_BUSY 0x22 -#define PMC6_L2_DBUS_BUSY_RD 0x23 - -/* External Bus Logic */ -#define PMC6_BUS_DRDY_CLOCKS 0x62 -#define PMC6_BUS_LOCK_CLOCKS 0x63 -#define PMC6_BUS_REQ_OUTSTANDING 0x60 -#define PMC6_BUS_TRAN_BRD 0x65 -#define PMC6_BUS_TRAN_RFO 0x66 -#define PMC6_BUS_TRAN_WB 0x67 -#define PMC6_BUS_TRAN_IFETCH 0x68 -#define PMC6_BUS_TRAN_INVAL 0x69 -#define PMC6_BUS_TRAN_PWR 0x6a -#define PMC6_BUS_TRAN_P 0x6b -#define PMC6_BUS_TRAN_IO 0x6c -#define PMC6_BUS_TRAN_DEF 0x6d -#define PMC6_BUS_TRAN_BURST 0x6e -#define PMC6_BUS_TRAN_ANY 0x70 -#define PMC6_BUS_TRAN_MEM 0x6f -#define PMC6_BUS_DATA_RCV 0x64 -#define PMC6_BUS_BNR_DRV 0x61 -#define PMC6_BUS_HIT_DRV 0x7a -#define PMC6_BUS_HITM_DRV 0x7b -#define PMC6_BUS_SNOOP_STALL 0x7e - -/* Floating Point Unit */ -#define PMC6_FLOPS 0xc1 /* counter 0 only */ -#define PMC6_FP_COMP_OPS_EXE 0x10 /* counter 0 only */ -#define PMC6_FP_ASSIST 0x11 /* counter 1 only */ -#define PMC6_MUL 0x12 /* counter 1 only */ -#define PMC6_DIV 0x13 /* counter 1 only */ -#define PMC6_CYCLES_DIV_BUSY 0x14 /* counter 0 only */ - -/* Memory Ordering */ -#define PMC6_LD_BLOCKS 0x03 -#define PMC6_SB_DRAINS 0x04 -#define PMC6_MISALIGN_MEM_REF 0x05 - -/* Instruction Decoding and Retirement */ -#define PMC6_INST_RETIRED 0xc0 -#define PMC6_UOPS_RETIRED 0xc2 -#define PMC6_INST_DECODER 0xd0 /* (sic) */ - -/* Interrupts */ -#define PMC6_HW_INT_RX 0xc8 -#define PMC6_CYCLES_INT_MASKED 0xc6 -#define PMC6_CYCLES_INT_PENDING_AND_MASKED 0xc7 - -/* Branches */ -#define PMC6_BR_INST_RETIRED 0xc4 -#define PMC6_BR_MISS_PRED_RETIRED 0xc5 -#define PMC6_BR_TAKEN_RETIRED 0xc9 -#define PMC6_BR_MISS_PRED_TAKEN_RET 0xca -#define PMC6_BR_INST_DECODED 0xe0 -#define PMC6_BTB_MISSES 0xe2 -#define PMC6_BR_BOGUS 0xe4 -#define PMC6_BACLEARS 0xe6 - -/* Stalls */ -#define PMC6_RESOURCE_STALLS 0xa2 -#define PMC6_PARTIAL_RAT_STALLS 0xd2 - -/* Segment Register Loads */ -#define PMC6_SEGMENT_REG_LOADS 0x06 - -/* Clocks */ -#define PMC6_CPU_CLK_UNHALTED 0x79 - -/* - * Pentium Performance Counters - * This list comes from the Harvard people, not Intel. - */ -#define PMC5_DATA_READ 0 -#define PMC5_DATA_WRITE 1 -#define PMC5_DATA_TLB_MISS 2 -#define PMC5_DATA_READ_MISS 3 -#define PMC5_DATA_WRITE_MISS 4 -#define PMC5_WRITE_M_E 5 -#define PMC5_DATA_LINES_WBACK 6 -#define PMC5_DATA_CACHE_SNOOP 7 -#define PMC5_DATA_CACHE_SNOOP_HIT 8 -#define PMC5_MEM_ACCESS_BOTH 9 -#define PMC5_BANK_CONFLICTS 10 -#define PMC5_MISALIGNED_DATA 11 -#define PMC5_INST_READ 12 -#define PMC5_INST_TLB_MISS 13 -#define PMC5_INST_CACHE_MISS 14 -#define PMC5_SEGMENT_REG_LOAD 15 -#define PMC5_BRANCHES 18 -#define PMC5_BTB_HITS 19 -#define PMC5_BRANCH_TAKEN 20 -#define PMC5_PIPELINE_FLUSH 21 -#define PMC5_INST_EXECUTED 22 -#define PMC5_INST_EXECUTED_V 23 -#define PMC5_BUS_UTILIZATION 24 -#define PMC5_WRITE_BACKUP_STALL 25 -#define PMC5_DATA_READ_STALL 26 -#define PMC5_WRITE_E_M_STALL 27 -#define PMC5_LOCKED_BUS 28 -#define PMC5_IO_CYCLE 29 -#define PMC5_NONCACHE_MEMORY 30 -#define PMC5_ADDR_GEN_INTERLOCK 31 -#define PMC5_FLOPS 34 -#define PMC5_BP0_MATCH 35 -#define PMC5_BP1_MATCH 36 -#define PMC5_BP2_MATCH 37 -#define PMC5_BP3_MATCH 38 -#define PMC5_HW_INTR 39 -#define PMC5_DATA_RW 40 -#define PMC5_DATA_RW_MISS 41 - -#endif /* !_MACHINE_PERFMON_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/pmap.h b/lib/libc/include/x86-freebsd-none/machine/pmap.h deleted file mode 100644 index 886993cbbd..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/pmap.h +++ /dev/null @@ -1,272 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991 Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and William Jolitz of UUNET Technologies Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Derived from hp300 version by Mike Hibler, this version by William - * Jolitz uses a recursive map [a pde points to the page directory] to - * map the page tables using the pagetables themselves. This is done to - * reduce the impact on kernel virtual memory for lots of sparse address - * space, and to reduce the cost of memory to each process. - */ - -#ifndef _MACHINE_PMAP_H_ -#define _MACHINE_PMAP_H_ - -/* - * Page-directory and page-table entries follow this format, with a few - * of the fields not present here and there, depending on a lot of things. - */ - /* ---- Intel Nomenclature ---- */ -#define PG_V 0x001 /* P Valid */ -#define PG_RW 0x002 /* R/W Read/Write */ -#define PG_U 0x004 /* U/S User/Supervisor */ -#define PG_NC_PWT 0x008 /* PWT Write through */ -#define PG_NC_PCD 0x010 /* PCD Cache disable */ -#define PG_A 0x020 /* A Accessed */ -#define PG_M 0x040 /* D Dirty */ -#define PG_PS 0x080 /* PS Page size (0=4k,1=4M) */ -#define PG_PTE_PAT 0x080 /* PAT PAT index */ -#define PG_G 0x100 /* G Global */ -#define PG_AVAIL1 0x200 /* / Available for system */ -#define PG_AVAIL2 0x400 /* < programmers use */ -#define PG_AVAIL3 0x800 /* \ */ -#define PG_PDE_PAT 0x1000 /* PAT PAT index */ -#define PG_NX (1ull<<63) /* No-execute */ - -/* Our various interpretations of the above */ -#define PG_W PG_AVAIL1 /* "Wired" pseudoflag */ -#define PG_MANAGED PG_AVAIL2 -#define PG_PROMOTED PG_AVAIL3 /* PDE only */ - -#define PG_PROT (PG_RW|PG_U) /* all protection bits . */ -#define PG_N (PG_NC_PWT|PG_NC_PCD) /* Non-cacheable */ - -/* Page level cache control fields used to determine the PAT type */ -#define PG_PDE_CACHE (PG_PDE_PAT | PG_NC_PWT | PG_NC_PCD) -#define PG_PTE_CACHE (PG_PTE_PAT | PG_NC_PWT | PG_NC_PCD) - -/* - * Promotion to a 2 or 4MB (PDE) page mapping requires that the corresponding - * 4KB (PTE) page mappings have identical settings for the following fields: - */ -#define PG_PTE_PROMOTE (PG_MANAGED | PG_W | PG_G | PG_PTE_PAT | \ - PG_M | PG_NC_PCD | PG_NC_PWT | PG_U | PG_RW | PG_V) - -/* - * Page Protection Exception bits - */ - -#define PGEX_P 0x01 /* Protection violation vs. not present */ -#define PGEX_W 0x02 /* during a Write cycle */ -#define PGEX_U 0x04 /* access from User mode (UPL) */ -#define PGEX_RSV 0x08 /* reserved PTE field is non-zero */ -#define PGEX_I 0x10 /* during an instruction fetch */ - -/* - * Pte related macros - */ -#define VADDR(pdi, pti) ((vm_offset_t)(((pdi)< -#include -#include -#include -#include - -#include - -/* - * Address of current address space page table maps and directories. - */ -#ifdef _KERNEL - -/* - * Translate a virtual address to its physical address. - * - * This macro may be used before pmap_bootstrap() is called. - */ -#define vtophys(va) pmap_kextract((vm_offset_t)(va)) - -#define pte_clear(ptep) pte_store(ptep, 0) - -#define pde_store(pdep, pde) pte_store(pdep, pde) - -#endif /* _KERNEL */ - -/* - * Pmap stuff - */ -struct md_page { - TAILQ_HEAD(,pv_entry) pv_list; - int pat_mode; -}; - -struct pmap { - cpuset_t pm_active; /* active on cpus */ - struct mtx pm_mtx; - struct pmap_statistics pm_stats; /* pmap statistics */ - uint32_t *pm_pdir_nopae; /* KVA of page directory */ - uint64_t *pm_pdir_pae; - TAILQ_HEAD(,pv_chunk) pm_pvchunk; /* list of mappings in pmap */ - LIST_ENTRY(pmap) pm_list; /* List of all pmaps */ - uint64_t *pm_pdpt_pae; - struct vm_radix pm_root; /* spare page table pages */ - vm_page_t pm_ptdpg[4]; /* PAE NPGPTD */ -}; - -typedef struct pmap *pmap_t; - -#ifdef _KERNEL -extern struct pmap kernel_pmap_store; -#define kernel_pmap (&kernel_pmap_store) - -#define PMAP_LOCK(pmap) mtx_lock(&(pmap)->pm_mtx) -#define PMAP_LOCK_ASSERT(pmap, type) \ - mtx_assert(&(pmap)->pm_mtx, (type)) -#define PMAP_LOCK_DESTROY(pmap) mtx_destroy(&(pmap)->pm_mtx) -#define PMAP_LOCK_INIT(pmap) mtx_init(&(pmap)->pm_mtx, "pmap", \ - NULL, MTX_DEF | MTX_DUPOK) -#define PMAP_LOCKED(pmap) mtx_owned(&(pmap)->pm_mtx) -#define PMAP_MTX(pmap) (&(pmap)->pm_mtx) -#define PMAP_TRYLOCK(pmap) mtx_trylock(&(pmap)->pm_mtx) -#define PMAP_UNLOCK(pmap) mtx_unlock(&(pmap)->pm_mtx) - -extern char *ptvmmap; /* poor name! */ -extern vm_offset_t virtual_avail; -extern vm_offset_t virtual_end; - -#define pmap_page_get_memattr(m) ((vm_memattr_t)(m)->md.pat_mode) -#define pmap_page_is_write_mapped(m) (((m)->a.flags & PGA_WRITEABLE) != 0) -#define pmap_unmapbios(va, sz) pmap_unmapdev((va), (sz)) - -static inline int -pmap_vmspace_copy(pmap_t dst_pmap __unused, pmap_t src_pmap __unused) -{ - - return (0); -} - -struct sf_buf; - -#define pmap_vm_page_alloc_check(m) - -/* - * Only the following functions or macros may be used before pmap_bootstrap() - * is called: pmap_kenter(), pmap_kextract(), pmap_kremove(), vtophys(), and - * vtopte(). - */ -void pmap_activate_boot(pmap_t pmap); -void pmap_basemem_setup(u_int basemem); -void *pmap_bios16_enter(void); -void pmap_bios16_leave(void *handle); -void pmap_bootstrap(vm_paddr_t); -int pmap_cache_bits(pmap_t, int mode, bool is_pde); -int pmap_change_attr(vm_offset_t, vm_size_t, int); -caddr_t pmap_cmap3(vm_paddr_t pa, u_int pte_bits); -void pmap_cp_slow0_map(vm_offset_t kaddr, int plen, vm_page_t *ma); -void pmap_flush_page(vm_page_t m); -u_int pmap_get_kcr3(void); -u_int pmap_get_cr3(pmap_t); -vm_offset_t pmap_get_map_low(void); -vm_offset_t pmap_get_vm_maxuser_address(void); -void pmap_init_pat(void); -void pmap_kenter(vm_offset_t va, vm_paddr_t pa); -void *pmap_kenter_temporary(vm_paddr_t pa, int i); -vm_paddr_t pmap_kextract(vm_offset_t va); -void pmap_kremove(vm_offset_t); -void pmap_ksetrw(vm_offset_t va); -void *pmap_mapbios(vm_paddr_t, vm_size_t); -void *pmap_mapdev(vm_paddr_t, vm_size_t); -void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, int); -bool pmap_page_is_mapped(vm_page_t m); -void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma); -vm_paddr_t pmap_pg_frame(vm_paddr_t pa); -bool pmap_ps_enabled(pmap_t pmap); -void pmap_remap_lower(bool); -void pmap_remap_lowptdi(bool); -void pmap_set_nx(void); -void pmap_sf_buf_map(struct sf_buf *sf); -void pmap_unmapdev(void *, vm_size_t); -void pmap_invalidate_page(pmap_t, vm_offset_t); -void pmap_invalidate_range(pmap_t, vm_offset_t, vm_offset_t); -void pmap_invalidate_all(pmap_t); -void pmap_invalidate_cache(void); -void pmap_invalidate_cache_pages(vm_page_t *pages, int count); -void pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva); -void pmap_force_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva); -void *pmap_trm_alloc(size_t size, int flags); -void pmap_trm_free(void *addr, size_t size); -#define pmap_map_delete(pmap, sva, eva) pmap_remove(pmap, sva, eva) - -void invltlb_glob(void); - -struct thread; - -extern int pae_mode; -extern int i386_pmap_VM_NFREEORDER; -extern int i386_pmap_VM_LEVEL_0_ORDER; -extern int i386_pmap_PDRSHIFT; - -#endif /* _KERNEL */ - -#endif /* !LOCORE */ - -#endif /* !_MACHINE_PMAP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/pmap_base.h b/lib/libc/include/x86-freebsd-none/machine/pmap_base.h deleted file mode 100644 index e590f96a05..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/pmap_base.h +++ /dev/null @@ -1,125 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2018 The FreeBSD Foundation - * - * This software was developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_PMAP_BASE_H_ -#define _MACHINE_PMAP_BASE_H_ - -/* Internal flags for pmap_mapdev_attr(). */ -#define MAPDEV_SETATTR 0x0000001 /* Modify existing attrs. */ - -struct pmap_methods { - void (*pm_ksetrw)(vm_offset_t); - void (*pm_remap_lower)(bool); - void (*pm_remap_lowptdi)(bool); - void (*pm_align_superpage)(vm_object_t object, vm_ooffset_t offset, - vm_offset_t *addr, vm_size_t size); - vm_offset_t (*pm_quick_enter_page)(vm_page_t m); - void (*pm_quick_remove_page)(vm_offset_t addr); - void *(*pm_trm_alloc)(size_t size, int flags); - void (*pm_trm_free)(void *addr, size_t size); - vm_offset_t (*pm_get_map_low)(void); - vm_offset_t (*pm_get_vm_maxuser_address)(void); - vm_paddr_t (*pm_kextract)(vm_offset_t va); - vm_paddr_t (*pm_pg_frame)(vm_paddr_t pa); - void (*pm_sf_buf_map)(struct sf_buf *sf); - void (*pm_cp_slow0_map)(vm_offset_t kaddr, int plen, vm_page_t *ma); - u_int (*pm_get_kcr3)(void); - u_int (*pm_get_cr3)(pmap_t); - caddr_t (*pm_cmap3)(vm_paddr_t pa, u_int pte_flags); - void (*pm_basemem_setup)(u_int basemem); - void (*pm_set_nx)(void); - void *(*pm_bios16_enter)(void); - void (*pm_bios16_leave)(void *handle); - void (*pm_bootstrap)(vm_paddr_t firstaddr); - bool (*pm_is_valid_memattr)(pmap_t, vm_memattr_t); - int (*pm_cache_bits)(pmap_t, int, bool); - bool (*pm_ps_enabled)(pmap_t); - void (*pm_pinit0)(pmap_t); - int (*pm_pinit)(pmap_t); - void (*pm_activate)(struct thread *); - void (*pm_activate_boot)(pmap_t); - void (*pm_advise)(pmap_t, vm_offset_t, vm_offset_t, int); - void (*pm_clear_modify)(vm_page_t); - int (*pm_change_attr)(vm_offset_t, vm_size_t, int); - int (*pm_mincore)(pmap_t, vm_offset_t, vm_paddr_t *); - void (*pm_copy)(pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t); - void (*pm_copy_page)(vm_page_t, vm_page_t); - void (*pm_copy_pages)(vm_page_t [], vm_offset_t, vm_page_t [], - vm_offset_t, int); - void (*pm_zero_page)(vm_page_t); - void (*pm_zero_page_area)(vm_page_t, int, int); - int (*pm_enter)(pmap_t, vm_offset_t, vm_page_t, vm_prot_t, u_int, - int8_t); - void (*pm_enter_object)(pmap_t, vm_offset_t, vm_offset_t, - vm_page_t, vm_prot_t); - void (*pm_enter_quick)(pmap_t, vm_offset_t, vm_page_t, vm_prot_t); - void *(*pm_kenter_temporary)(vm_paddr_t pa, int); - void (*pm_object_init_pt)(pmap_t, vm_offset_t, vm_object_t, - vm_pindex_t, vm_size_t); - void (*pm_unwire)(pmap_t, vm_offset_t, vm_offset_t); - bool (*pm_page_exists_quick)(pmap_t, vm_page_t); - int (*pm_page_wired_mappings)(vm_page_t); - bool (*pm_page_is_mapped)(vm_page_t); - void (*pm_remove_pages)(pmap_t); - bool (*pm_is_modified)(vm_page_t); - bool (*pm_is_prefaultable)(pmap_t, vm_offset_t); - bool (*pm_is_referenced)(vm_page_t); - void (*pm_remove_write)(vm_page_t); - int (*pm_ts_referenced)(vm_page_t); - void *(*pm_mapdev_attr)(vm_paddr_t, vm_size_t, int, int); - void (*pm_unmapdev)(void *, vm_size_t); - void (*pm_page_set_memattr)(vm_page_t, vm_memattr_t); - vm_paddr_t (*pm_extract)(pmap_t, vm_offset_t); - vm_page_t (*pm_extract_and_hold)(pmap_t, vm_offset_t, vm_prot_t); - vm_offset_t (*pm_map)(vm_offset_t *, vm_paddr_t, vm_paddr_t, int); - void (*pm_qenter)(vm_offset_t sva, vm_page_t *, int); - void (*pm_qremove)(vm_offset_t, int); - void (*pm_release)(pmap_t); - void (*pm_protect)(pmap_t, vm_offset_t, vm_offset_t, vm_prot_t); - void (*pm_remove)(pmap_t, vm_offset_t, vm_offset_t); - void (*pm_remove_all)(vm_page_t); - void (*pm_init)(void); - void (*pm_init_pat)(void); - int (*pm_growkernel)(vm_offset_t); - void (*pm_invalidate_page)(pmap_t, vm_offset_t); - void (*pm_invalidate_range)(pmap_t, vm_offset_t, vm_offset_t); - void (*pm_invalidate_all)(pmap_t); - void (*pm_invalidate_cache)(void); - void (*pm_flush_page)(vm_page_t); - void (*pm_kenter)(vm_offset_t, vm_paddr_t); - void (*pm_kremove)(vm_offset_t); - int (*pm_sysctl_kmaps)(SYSCTL_HANDLER_ARGS); -}; - -void pmap_cold(void); -void pmap_pae_cold(void); -void pmap_nopae_cold(void); - -#endif \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/pmap_nopae.h b/lib/libc/include/x86-freebsd-none/machine/pmap_nopae.h deleted file mode 100644 index 3af191062f..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/pmap_nopae.h +++ /dev/null @@ -1,97 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991 Regents of the University of California. - * All rights reserved. - * - * Copyright (c) 2018 The FreeBSD Foundation - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and William Jolitz of UUNET Technologies Inc. - * - * Portions of this software were developed by - * Konstantin Belousov under sponsorship from - * the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Derived from hp300 version by Mike Hibler, this version by William - * Jolitz uses a recursive map [a pde points to the page directory] to - * map the page tables using the pagetables themselves. This is done to - * reduce the impact on kernel virtual memory for lots of sparse address - * space, and to reduce the cost of memory to each process. - */ - -#ifndef _MACHINE_PMAP_NOPAE_H -#define _MACHINE_PMAP_NOPAE_H - -#define NTRPPTD 1 -#define LOWPTDI 1 -#define KERNPTDI 2 - -#define NPGPTD 1 -#define NPGPTD_SHIFT 10 -#undef PDRSHIFT -#define PDRSHIFT PDRSHIFT_NOPAE -#undef NBPDR -#define NBPDR (1 << PDRSHIFT_NOPAE) /* bytes/page dir */ - -#define PG_FRAME PG_FRAME_NOPAE -#define PG_PS_FRAME PG_PS_FRAME_NOPAE - -#define KVA_PAGES (256*4) - -#ifndef NKPT -#define NKPT 30 -#endif - -typedef uint32_t pd_entry_t; -typedef uint32_t pt_entry_t; -typedef uint32_t pdpt_entry_t; /* Only to keep struct pmap layout. */ - -#define PTESHIFT (2) -#define PDESHIFT (2) - -#define pde_cmpset(pdep, old, new) atomic_cmpset_int(pdep, old, new) -#define pte_load_store(ptep, pte) atomic_swap_int(ptep, pte) -#define pte_load_clear(ptep) atomic_swap_int(ptep, 0) -#define pte_store(ptep, pte) do { \ - *(u_int *)(ptep) = (u_int)(pte); \ -} while (0) -#define pte_store_zero(ptep, pte) pte_store(ptep, pte) -#define pte_load(ptep) atomic_load_int(ptep) - -extern pt_entry_t PTmap[]; -extern pd_entry_t PTD[]; -extern pd_entry_t PTDpde[]; -extern pd_entry_t *IdlePTD_nopae; -extern pt_entry_t *KPTmap_nopae; - -struct pmap; -pt_entry_t *__CONCAT(PMTYPE, pmap_pte)(struct pmap *, vm_offset_t) __pure2; - -#endif \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/pmap_pae.h b/lib/libc/include/x86-freebsd-none/machine/pmap_pae.h deleted file mode 100644 index 859fdc59a4..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/pmap_pae.h +++ /dev/null @@ -1,129 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991 Regents of the University of California. - * All rights reserved. - * - * Copyright (c) 2018 The FreeBSD Foundation - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and William Jolitz of UUNET Technologies Inc. - * - * Portions of this software were developed by - * Konstantin Belousov under sponsorship from - * the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Derived from hp300 version by Mike Hibler, this version by William - * Jolitz uses a recursive map [a pde points to the page directory] to - * map the page tables using the pagetables themselves. This is done to - * reduce the impact on kernel virtual memory for lots of sparse address - * space, and to reduce the cost of memory to each process. - */ - -#ifndef _MACHINE_PMAP_PAE_H -#define _MACHINE_PMAP_PAE_H - -#define NTRPPTD 2 /* Number of PTDs for trampoline - mapping */ -#define LOWPTDI 2 /* low memory map pde */ -#define KERNPTDI 4 /* start of kernel text pde */ - -#define NPGPTD 4 /* Num of pages for page directory */ -#define NPGPTD_SHIFT 9 -#undef PDRSHIFT -#define PDRSHIFT PDRSHIFT_PAE -#undef NBPDR -#define NBPDR (1 << PDRSHIFT_PAE) /* bytes/page dir */ - -#define PG_FRAME PG_FRAME_PAE -#define PG_PS_FRAME PG_PS_FRAME_PAE - -/* - * Size of Kernel address space. This is the number of page table pages - * (4MB each) to use for the kernel. 256 pages == 1 Gigabyte. - * This **MUST** be a multiple of 4 (eg: 252, 256, 260, etc). - * For PAE, the page table page unit size is 2MB. This means that 512 pages - * is 1 Gigabyte. Double everything. It must be a multiple of 8 for PAE. - */ -#define KVA_PAGES (512*4) - -/* - * The initial number of kernel page table pages that are constructed - * by pmap_cold() must be sufficient to map vm_page_array. That number can - * be calculated as follows: - * max_phys / PAGE_SIZE * sizeof(struct vm_page) / NBPDR - * PAE: max_phys 16G, sizeof(vm_page) 76, NBPDR 2M, 152 page table pages. - * PAE_TABLES: max_phys 4G, sizeof(vm_page) 68, NBPDR 2M, 36 page table pages. - * Non-PAE: max_phys 4G, sizeof(vm_page) 68, NBPDR 4M, 18 page table pages. - */ -#ifndef NKPT -#define NKPT 240 -#endif - -typedef uint64_t pdpt_entry_t; -typedef uint64_t pd_entry_t; -typedef uint64_t pt_entry_t; - -#define PTESHIFT (3) -#define PDESHIFT (3) - -#define pde_cmpset(pdep, old, new) atomic_cmpset_64_i586(pdep, old, new) -#define pte_load_store(ptep, pte) atomic_swap_64_i586(ptep, pte) -#define pte_load_clear(ptep) atomic_swap_64_i586(ptep, 0) -#define pte_store(ptep, pte) atomic_store_rel_64_i586(ptep, pte) -#define pte_store_zero(ptep, pte) \ -do { \ - uint32_t *p; \ - \ - MPASS((*ptep & PG_V) == 0); \ - p = (void *)ptep; \ - *(p + 1) = (uint32_t)(pte >> 32); \ - __compiler_membar(); \ - *p = (uint32_t)pte; \ -} while (0) -#define pte_load(ptep) atomic_load_acq_64_i586(ptep) - -extern pdpt_entry_t *IdlePDPT; -extern pt_entry_t pg_nx; -extern pd_entry_t *IdlePTD_pae; /* physical address of "Idle" state directory */ - -/* - * KPTmap is a linear mapping of the kernel page table. It differs from the - * recursive mapping in two ways: (1) it only provides access to kernel page - * table pages, and not user page table pages, and (2) it provides access to - * a kernel page table page after the corresponding virtual addresses have - * been promoted to a 2/4MB page mapping. - * - * KPTmap is first initialized by pmap_cold() to support just NPKT page table - * pages. Later, it is reinitialized by pmap_bootstrap() to allow for - * expansion of the kernel page table. - */ -extern pt_entry_t *KPTmap_pae; - -#endif \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/pmc_mdep.h b/lib/libc/include/x86-freebsd-none/machine/pmc_mdep.h deleted file mode 100644 index 4b55797670..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/pmc_mdep.h +++ /dev/null @@ -1,158 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2003-2005,2008 Joseph Koshy - * Copyright (c) 2007 The FreeBSD Foundation - * All rights reserved. - * - * Portions of this software were developed by A. Joseph Koshy under - * sponsorship from the FreeBSD Foundation and Google, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_PMC_MDEP_H -#define _MACHINE_PMC_MDEP_H 1 - -#ifdef _KERNEL -struct pmc_mdep; -#endif - -/* - * On the i386 platform we support the following PMCs. - * - * TSC The timestamp counter - * K7 AMD Athlon XP/MP and other 32 bit processors. - * K8 AMD Athlon64 and Opteron PMCs in 32 bit mode. - * IAP Intel Core/Core2/Atom programmable PMCs. - * IAF Intel fixed-function PMCs. - * UCP Intel Uncore programmable PMCs. - * UCF Intel Uncore fixed-function PMCs. - */ - -#include /* K7 and K8 */ -#include -#include -#include - -/* - * Intel processors implementing V2 and later of the Intel performance - * measurement architecture have PMCs of the following classes: TSC, - * IAF, IAP, UCF and UCP. - */ -#define PMC_MDEP_CLASS_INDEX_TSC 1 -#define PMC_MDEP_CLASS_INDEX_K7 2 -#define PMC_MDEP_CLASS_INDEX_K8 2 -#define PMC_MDEP_CLASS_INDEX_IAP 2 -#define PMC_MDEP_CLASS_INDEX_IAF 3 -#define PMC_MDEP_CLASS_INDEX_UCP 4 -#define PMC_MDEP_CLASS_INDEX_UCF 5 - -/* - * Architecture specific extensions to structures. - */ - -union pmc_md_op_pmcallocate { - struct pmc_md_amd_op_pmcallocate pm_amd; - struct pmc_md_iap_op_pmcallocate pm_iap; - struct pmc_md_ucf_op_pmcallocate pm_ucf; - struct pmc_md_ucp_op_pmcallocate pm_ucp; - uint64_t __pad[4]; -}; - -/* Logging */ -#define PMCLOG_READADDR PMCLOG_READ32 -#define PMCLOG_EMITADDR PMCLOG_EMIT32 - -#ifdef _KERNEL - -/* MD extension for 'struct pmc' */ -union pmc_md_pmc { - struct pmc_md_amd_pmc pm_amd; - struct pmc_md_iaf_pmc pm_iaf; - struct pmc_md_iap_pmc pm_iap; - struct pmc_md_ucf_pmc pm_ucf; - struct pmc_md_ucp_pmc pm_ucp; -}; - -struct pmc; -struct pmc_mdep; - -#define PMC_TRAPFRAME_TO_PC(TF) ((TF)->tf_eip) -#define PMC_TRAPFRAME_TO_FP(TF) ((TF)->tf_ebp) - -/* - * The layout of the stack frame on entry into the NMI handler depends on - * whether a privilege level change (and consequent stack switch) was - * required for entry. - * - * When processing an interrupt when in user mode, the processor switches - * stacks, and saves the user mode stack pointer on the kernel stack. The - * user mode stack pointer is then available to the interrupt handler - * at frame->tf_esp. - * - * When processing an interrupt while in kernel mode, the processor - * continues to use the existing (kernel) stack. Therefore we determine - * the stack pointer for the interrupted kernel procedure by adding an - * offset to the current frame pointer. - */ - -#define PMC_TRAPFRAME_TO_USER_SP(TF) ((TF)->tf_esp) -#define PMC_TRAPFRAME_TO_KERNEL_SP(TF) ((uintptr_t) &((TF)->tf_esp)) - -#define PMC_IN_KERNEL_STACK(va) kstack_contains(curthread, (va), sizeof(va)) -#define PMC_IN_KERNEL(va) INKERNEL(va) -#define PMC_IN_USERSPACE(va) ((va) <= VM_MAXUSER_ADDRESS) - -#define PMC_IN_TRAP_HANDLER(PC) \ - ((PC) >= (uintptr_t)start_exceptions + setidt_disp && \ - (PC) < (uintptr_t) end_exceptions + setidt_disp) - -#define PMC_AT_FUNCTION_PROLOGUE_PUSH_BP(I) \ - (((I) & 0x00ffffff) == 0xe58955) /* pushl %ebp; movl %esp,%ebp */ -#define PMC_AT_FUNCTION_PROLOGUE_MOV_SP_BP(I) \ - (((I) & 0x0000ffff) == 0xe589) /* movl %esp,%ebp */ -#define PMC_AT_FUNCTION_EPILOGUE_RET(I) \ - (((I) & 0xFF) == 0xC3) /* ret */ - -/* Build a fake kernel trapframe from current instruction pointer. */ -#define PMC_FAKE_TRAPFRAME(TF) \ - do { \ - (TF)->tf_cs = 0; (TF)->tf_eflags = 0; \ - __asm __volatile("movl %%ebp,%0" : "=r" ((TF)->tf_ebp)); \ - __asm __volatile("movl %%esp,%0" : "=r" ((TF)->tf_esp)); \ - __asm __volatile("call 1f \n\t1: pop %0" : "=r"((TF)->tf_eip)); \ - } while (0) - -/* - * Prototypes - */ - -void start_exceptions(void), end_exceptions(void); - -struct pmc_mdep *pmc_amd_initialize(void); -void pmc_amd_finalize(struct pmc_mdep *_md); -struct pmc_mdep *pmc_intel_initialize(void); -void pmc_intel_finalize(struct pmc_mdep *_md); - -#endif /* _KERNEL */ -#endif /* _MACHINE_PMC_MDEP_H */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/proc.h b/lib/libc/include/x86-freebsd-none/machine/proc.h deleted file mode 100644 index 3377daab2c..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/proc.h +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_PROC_H_ -#define _MACHINE_PROC_H_ - -#include - -struct proc_ldt { - caddr_t ldt_base; - int ldt_len; - int ldt_refcnt; - u_long ldt_active; - struct segment_descriptor ldt_sd; -}; - -/* - * Machine-dependent part of the proc structure for i386. - * Table of MD locks: - * t - Descriptor tables lock - */ -struct mdthread { - int md_spinlock_count; /* (k) */ - register_t md_saved_flags; /* (k) */ - register_t md_spurflt_addr; /* (k) Spurious page fault address. */ -}; - -struct mdproc { - struct proc_ldt *md_ldt; /* (t) per-process ldt */ -}; - -#define KINFO_PROC_SIZE 768 - -#ifdef _KERNEL - -#include - -void set_user_ldt(struct mdproc *); -struct proc_ldt *user_ldt_alloc(struct mdproc *, int); -void user_ldt_free(struct thread *); -void user_ldt_deref(struct proc_ldt *pldt); - -extern struct mtx dt_lock; -#endif /* _KERNEL */ - -#endif /* !_MACHINE_PROC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/procctl.h b/lib/libc/include/x86-freebsd-none/machine/procctl.h deleted file mode 100644 index 51a8eb8fc8..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/procctl.h +++ /dev/null @@ -1,5 +0,0 @@ -/*- - * This file is in the public domain. - */ - -#include \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/profile.h b/lib/libc/include/x86-freebsd-none/machine/profile.h deleted file mode 100644 index 2789d419f5..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/profile.h +++ /dev/null @@ -1,89 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_PROFILE_H_ -#define _MACHINE_PROFILE_H_ - -#ifndef _KERNEL - -#include - -#define FUNCTION_ALIGNMENT 4 - -#define _MCOUNT_DECL static __inline void _mcount - -#define MCOUNT \ -void \ -mcount() \ -{ \ - uintfptr_t selfpc, frompc, ecx; \ - /* \ - * In gcc 4.2, ecx might be used in the caller as the arg \ - * pointer if the stack realignment option is set (-mstackrealign) \ - * or if the caller has the force_align_arg_pointer attribute \ - * (stack realignment is ALWAYS on for main). Preserve ecx \ - * here. \ - */ \ - __asm("" : "=c" (ecx)); \ - /* \ - * Find the return address for mcount, \ - * and the return address for mcount's caller. \ - * \ - * selfpc = pc pushed by call to mcount \ - */ \ - __asm("movl 4(%%ebp),%0" : "=r" (selfpc)); \ - /* \ - * frompc = pc pushed by call to mcount's caller. \ - * The caller's stack frame has already been built, so %ebp is \ - * the caller's frame pointer. The caller's raddr is in the \ - * caller's frame following the caller's caller's frame pointer.\ - */ \ - __asm("movl (%%ebp),%0" : "=r" (frompc)); \ - frompc = ((uintfptr_t *)frompc)[1]; \ - _mcount(frompc, selfpc); \ - __asm("" : : "c" (ecx)); \ -} - -typedef u_int uintfptr_t; - -/* - * An unsigned integral type that can hold non-negative difference between - * function pointers. - */ -typedef u_int fptrdiff_t; - -__BEGIN_DECLS -void mcount(void) __asm(".mcount"); -__END_DECLS - -#endif /* !_KERNEL */ - -#endif /* !_MACHINE_PROFILE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/resource.h b/lib/libc/include/x86-freebsd-none/machine/resource.h deleted file mode 100644 index 4c356f3830..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/resource.h +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * Copyright 1998 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby - * granted, provided that both the above copyright notice and this - * permission notice appear in all copies, that both the above - * copyright notice and this permission notice appear in all - * supporting documentation, and that the name of M.I.T. not be used - * in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. M.I.T. makes - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied - * warranty. - * - * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS - * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT - * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_RESOURCE_H_ -#define _MACHINE_RESOURCE_H_ 1 - -/* - * Definitions of resource types for Intel Architecture machines - * with support for legacy ISA devices and drivers. - */ - -#define SYS_RES_IRQ 1 /* interrupt lines */ -#define SYS_RES_DRQ 2 /* isa dma lines */ -#define SYS_RES_MEMORY 3 /* i/o memory */ -#define SYS_RES_IOPORT 4 /* i/o ports */ -#define PCI_RES_BUS 5 /* PCI bus numbers */ - -#endif /* !_MACHINE_RESOURCE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/sdt_machdep.h b/lib/libc/include/x86-freebsd-none/machine/sdt_machdep.h deleted file mode 100644 index 127c93cbc8..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/sdt_machdep.h +++ /dev/null @@ -1,19 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2024 Mark Johnston - */ - -#ifndef _SYS_SDT_MACHDEP_H_ -#define _SYS_SDT_MACHDEP_H_ - -#define _SDT_ASM_PATCH_INSTR "nop; nop; nop; nop; nop" - -/* - * Work around an apparent clang bug or limitation which prevents the use of the - * "i" (immediate) constraint with the probe structure. - */ -#define _SDT_ASM_PROBE_CONSTRAINT "Ws" -#define _SDT_ASM_PROBE_OPERAND "p" - -#endif \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/segments.h b/lib/libc/include/x86-freebsd-none/machine/segments.h deleted file mode 100644 index cfb3054fd8..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/segments.h +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1989, 1990 William F. Jolitz - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_SEGMENTS_H_ -#define _MACHINE_SEGMENTS_H_ - -/* - * 386 Segmentation Data Structures and definitions - * William F. Jolitz (william@ernie.berkeley.edu) 6/20/1989 - */ - -#include - -/* - * Software definitions are in this convenient format, - * which are translated into inconvenient segment descriptors - * when needed to be used by the 386 hardware - */ - -struct soft_segment_descriptor { - unsigned ssd_base ; /* segment base address */ - unsigned ssd_limit ; /* segment extent */ - unsigned ssd_type:5 ; /* segment type */ - unsigned ssd_dpl:2 ; /* segment descriptor priority level */ - unsigned ssd_p:1 ; /* segment descriptor present */ - unsigned ssd_xx:4 ; /* unused */ - unsigned ssd_xx1:2 ; /* unused */ - unsigned ssd_def32:1 ; /* default 32 vs 16 bit size */ - unsigned ssd_gran:1 ; /* limit granularity (byte/page units)*/ -}; - -/* - * region descriptors, used to load gdt/idt tables before segments yet exist. - */ -struct region_descriptor { - unsigned rd_limit:16; /* segment extent */ - unsigned rd_base:32 __packed; /* base address */ -}; - -/* - * Segment Protection Exception code bits - */ - -#define SEGEX_EXT 0x01 /* recursive or externally induced */ -#define SEGEX_IDT 0x02 /* interrupt descriptor table */ -#define SEGEX_TI 0x04 /* local descriptor table */ - /* other bits are affected descriptor index */ -#define SEGEX_IDX(s) (((s)>>3)&0x1fff) - -#ifdef _KERNEL -extern int _default_ldt; -extern union descriptor *gdt; -extern union descriptor *ldt; -extern struct soft_segment_descriptor gdt_segs[]; -extern struct gate_descriptor *idt; - -void lgdt(struct region_descriptor *rdp); -void sdtossd(struct segment_descriptor *sdp, - struct soft_segment_descriptor *ssdp); -void ssdtosd(struct soft_segment_descriptor *ssdp, - struct segment_descriptor *sdp); -#endif /* _KERNEL */ - -#endif /* !_MACHINE_SEGMENTS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/sf_buf.h b/lib/libc/include/x86-freebsd-none/machine/sf_buf.h deleted file mode 100644 index 9cf3bbbc75..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/sf_buf.h +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2014 Gleb Smirnoff - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_SF_BUF_H_ -#define _MACHINE_SF_BUF_H_ - -void sf_buf_map(struct sf_buf *, int); -int sf_buf_unmap(struct sf_buf *); -boolean_t sf_buf_invalidate_cache(vm_page_t); - -#endif /* !_MACHINE_SF_BUF_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/sigframe.h b/lib/libc/include/x86-freebsd-none/machine/sigframe.h deleted file mode 100644 index 5cb398b7fd..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/sigframe.h +++ /dev/null @@ -1,94 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1999 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MACHINE_SIGFRAME_H_ -#define _MACHINE_SIGFRAME_H_ - -/* - * Signal frames, arguments passed to application signal handlers. - */ -#ifdef _KERNEL -#ifdef COMPAT_43 -struct osigframe { - /* - * The first four members may be used by applications. - */ - - register_t sf_signum; - - /* - * Either 'int' for old-style FreeBSD handler or 'siginfo_t *' - * pointing to sf_siginfo for SA_SIGINFO handlers. - */ - register_t sf_arg2; - - /* Points to sf_siginfo.si_sc. */ - register_t sf_scp; - - register_t sf_addr; - - /* - * The following arguments are not constrained by the - * function call protocol. - * Applications are not supposed to access these members, - * except using the pointers we provide in the first three - * arguments. - */ - - union { - __osiginfohandler_t *sf_action; - __sighandler_t *sf_handler; - } sf_ahu; - - /* In the SA_SIGINFO case, sf_arg2 points here. */ - osiginfo_t sf_siginfo; -}; -#endif -#ifdef COMPAT_FREEBSD4 -/* FreeBSD 4.x */ -struct freebsd4_sigframe { - register_t sf_signum; - register_t sf_siginfo; /* code or pointer to sf_si */ - register_t sf_ucontext; /* points to sf_uc */ - register_t sf_addr; /* undocumented 4th arg */ - - union { - __siginfohandler_t *sf_action; - __sighandler_t *sf_handler; - } sf_ahu; - struct freebsd4_ucontext sf_uc; /* = *sf_ucontext */ - siginfo_t sf_si; /* = *sf_siginfo (SA_SIGINFO case) */ -}; -#endif -#endif - -#include - -#endif /* !_MACHINE_SIGFRAME_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/signal.h b/lib/libc/include/x86-freebsd-none/machine/signal.h deleted file mode 100644 index c2a08dcb75..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/signal.h +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1986, 1989, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_SIGNAL_H_ -#define _MACHINE_SIGNAL_H_ - -#include - -#if defined(_KERNEL) && defined(COMPAT_43) -/* - * Only the kernel should need these old type definitions. - */ -struct osigcontext { - int sc_onstack; /* sigstack state to restore */ - osigset_t sc_mask; /* signal mask to restore */ - int sc_esp; /* machine state follows: */ - int sc_ebp; - int sc_isp; - int sc_eip; - int sc_efl; - int sc_es; - int sc_ds; - int sc_cs; - int sc_ss; - int sc_edi; - int sc_esi; - int sc_ebx; - int sc_edx; - int sc_ecx; - int sc_eax; - int sc_gs; - int sc_fs; - int sc_trapno; - int sc_err; -}; -#endif - -#endif /* !_MACHINE_SIGNAL_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/smapi.h b/lib/libc/include/x86-freebsd-none/machine/smapi.h deleted file mode 100644 index 4e57921252..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/smapi.h +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2003 Matthew N. Dodd - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_SMAPI_H_ -#define _MACHINE_SMAPI_H_ - -#ifndef _KERNEL -#include -#endif -#include - -struct smapi_bios_header { - u_int8_t signature[4]; /* '$SMB' */ - u_int8_t version_major; - u_int8_t version_minor; - u_int8_t length; - u_int8_t checksum; - u_int16_t information; -#define SMAPI_REAL_VM86 0x0001 -#define SMAPI_PROT_16BIT 0x0002 -#define SMAPI_PROT_32BIT 0x0004 - u_int16_t reserved1; - - u_int16_t real16_offset; - u_int16_t real16_segment; - - u_int16_t reserved2; - - u_int16_t prot16_offset; - u_int32_t prot16_segment; - - u_int32_t prot32_offset; - u_int32_t prot32_segment; - -} __packed; - -struct smapi_bios_parameter { - union { - struct { - u_int8_t func; - u_int8_t sub_func; - } in; - struct { - u_int8_t rc; - u_int8_t sub_rc; - } out; - } type; - - u_int16_t param1; - u_int16_t param2; - u_int16_t param3; - - u_int32_t param4; - u_int32_t param5; - -} __packed; - -#define cmd_func type.in.func -#define cmd_sub_func type.in.sub_func -#define rsp_rc type.out.rc -#define rsp_sub_rc type.out.sub_rc - -#define SMAPIOGHEADER _IOR('$', 0, struct smapi_bios_header) -#define SMAPIOCGFUNCTION _IOWR('$', 1, struct smapi_bios_parameter) - -#endif /* _MACHINE_SMAPI_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/smp.h b/lib/libc/include/x86-freebsd-none/machine/smp.h deleted file mode 100644 index f6e470603e..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/smp.h +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - * - */ - -#ifndef _MACHINE_SMP_H_ -#define _MACHINE_SMP_H_ - -#ifdef _KERNEL - -#ifdef SMP - -#ifndef LOCORE - -#include - -#include -#include -#include -#include -#include - -inthand_t - IDTVEC(invltlb), /* TLB shootdowns - global */ - IDTVEC(invlpg), /* TLB shootdowns - 1 page */ - IDTVEC(invlrng), /* TLB shootdowns - page range */ - IDTVEC(invlcache); /* Write back and invalidate cache */ - -/* functions in mpboot.s */ -void bootMP(void); - -void invltlb_handler(void); -void invlpg_handler(void); -void invlrng_handler(void); -void invlcache_handler(void); - -#endif /* !LOCORE */ -#endif /* SMP */ - -#endif /* _KERNEL */ -#endif /* _MACHINE_SMP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/speaker.h b/lib/libc/include/x86-freebsd-none/machine/speaker.h deleted file mode 100644 index da7b4af375..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/speaker.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - */ - -#ifndef _MACHINE_SPEAKER_H_ -#define _MACHINE_SPEAKER_H_ - -#warning "machine/speaker.h is deprecated. Include dev/speaker/speaker.h instead." - -#include - -#endif /* !_MACHINE_SPEAKER_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/stack.h b/lib/libc/include/x86-freebsd-none/machine/stack.h deleted file mode 100644 index ed0e0d66f2..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/stack.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This file is in the public domain. - */ - -#ifndef _MACHINE_STACK_H_ -#define _MACHINE_STACK_H_ - -#include - -#ifdef _SYS_PROC_H_ - -/* Get the current kernel thread stack usage. */ -#define GET_STACK_USAGE(total, used) do { \ - struct thread *td = curthread; \ - (total) = (vm_offset_t)get_pcb_td(td) - td->td_kstack; \ - (used) = (vm_offset_t)get_pcb_td(td) - (vm_offset_t)&td; \ -} while (0) - -static __inline bool -kstack_contains(struct thread *td, vm_offset_t va, size_t len) -{ - return (va >= td->td_kstack && va + len >= va && - va + len <= (vm_offset_t)get_pcb_td(td)); -} - -#endif /* _SYS_PROC_H_ */ - -#endif \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/stdarg.h b/lib/libc/include/x86-freebsd-none/machine/stdarg.h deleted file mode 100644 index 20289894d6..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/stdarg.h +++ /dev/null @@ -1,5 +0,0 @@ -/*- - * This file is in the public domain. - */ - -#include \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/tss.h b/lib/libc/include/x86-freebsd-none/machine/tss.h deleted file mode 100644 index 0a59c54a60..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/tss.h +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_TSS_H_ -#define _MACHINE_TSS_H_ 1 - -/* - * Intel 386 Context Data Type - */ - -struct i386tss { - int tss_link; /* actually 16 bits: top 16 bits must be zero */ - int tss_esp0; /* kernel stack pointer privilege level 0 */ - int tss_ss0; /* actually 16 bits: top 16 bits must be zero */ - int tss_esp1; /* kernel stack pointer privilege level 1 */ - int tss_ss1; /* actually 16 bits: top 16 bits must be zero */ - int tss_esp2; /* kernel stack pointer privilege level 2 */ - int tss_ss2; /* actually 16 bits: top 16 bits must be zero */ - int tss_cr3; /* page table directory */ - int tss_eip; /* program counter */ - int tss_eflags; /* program status longword */ - int tss_eax; - int tss_ecx; - int tss_edx; - int tss_ebx; - int tss_esp; /* user stack pointer */ - int tss_ebp; /* user frame pointer */ - int tss_esi; - int tss_edi; - int tss_es; /* actually 16 bits: top 16 bits must be zero */ - int tss_cs; /* actually 16 bits: top 16 bits must be zero */ - int tss_ss; /* actually 16 bits: top 16 bits must be zero */ - int tss_ds; /* actually 16 bits: top 16 bits must be zero */ - int tss_fs; /* actually 16 bits: top 16 bits must be zero */ - int tss_gs; /* actually 16 bits: top 16 bits must be zero */ - int tss_ldt; /* actually 16 bits: top 16 bits must be zero */ - int tss_ioopt; /* options & io offset bitmap: currently zero */ - /* XXX unimplemented .. i/o permission bitmap */ -}; - -#endif /* _MACHINE_TSS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/ucontext.h b/lib/libc/include/x86-freebsd-none/machine/ucontext.h deleted file mode 100644 index 2f885f782a..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/ucontext.h +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1999 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MACHINE_UCONTEXT_H_ -#define _MACHINE_UCONTEXT_H_ - -#if defined(_KERNEL) && defined(COMPAT_FREEBSD4) -struct freebsd4_mcontext { - __register_t mc_onstack; /* XXX - sigcontext compat. */ - __register_t mc_gs; /* machine state (struct trapframe) */ - __register_t mc_fs; - __register_t mc_es; - __register_t mc_ds; - __register_t mc_edi; - __register_t mc_esi; - __register_t mc_ebp; - __register_t mc_isp; - __register_t mc_ebx; - __register_t mc_edx; - __register_t mc_ecx; - __register_t mc_eax; - __register_t mc_trapno; - __register_t mc_err; - __register_t mc_eip; - __register_t mc_cs; - __register_t mc_eflags; - __register_t mc_esp; /* machine state */ - __register_t mc_ss; - __register_t mc_fpregs[28]; /* env87 + fpacc87 + u_long */ - __register_t __spare__[17]; -}; - -struct freebsd4_ucontext { - sigset_t uc_sigmask; - struct freebsd4_mcontext uc_mcontext; - struct freebsd4_ucontext *uc_link; - stack_t uc_stack; - int __spare__[8]; -}; -#endif - -#include - -#endif /* !_MACHINE_UCONTEXT_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/vm86.h b/lib/libc/include/x86-freebsd-none/machine/vm86.h deleted file mode 100644 index b2f4108f62..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/vm86.h +++ /dev/null @@ -1,165 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 1997 Jonathan Lemon - * All rights reserved. - * - * Derived from register.h, which is - * Copyright (c) 1996 Michael Smith. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_VM86_H_ -#define _MACHINE_VM86_H_ 1 - -/* standard register representation */ -typedef union { - u_int r_ex; - struct { - u_short r_x; - u_int :16; - } r_w; - struct { - u_char r_l; - u_char r_h; - u_int :16; - } r_b; -} reg86_t; - -/* layout must match definition of struct trapframe_vm86 in */ - -struct vm86frame { - int kernel_fs; - int kernel_es; - int kernel_ds; - reg86_t edi; - reg86_t esi; - reg86_t ebp; - reg86_t isp; - reg86_t ebx; - reg86_t edx; - reg86_t ecx; - reg86_t eax; - int vmf_trapno; - int vmf_err; - reg86_t eip; - reg86_t cs; - reg86_t eflags; - reg86_t esp; - reg86_t ss; - reg86_t es; - reg86_t ds; - reg86_t fs; - reg86_t gs; -#define vmf_ah eax.r_b.r_h -#define vmf_al eax.r_b.r_l -#define vmf_ax eax.r_w.r_x -#define vmf_eax eax.r_ex -#define vmf_bh ebx.r_b.r_h -#define vmf_bl ebx.r_b.r_l -#define vmf_bx ebx.r_w.r_x -#define vmf_ebx ebx.r_ex -#define vmf_ch ecx.r_b.r_h -#define vmf_cl ecx.r_b.r_l -#define vmf_cx ecx.r_w.r_x -#define vmf_ecx ecx.r_ex -#define vmf_dh edx.r_b.r_h -#define vmf_dl edx.r_b.r_l -#define vmf_dx edx.r_w.r_x -#define vmf_edx edx.r_ex -#define vmf_si esi.r_w.r_x -#define vmf_di edi.r_w.r_x -#define vmf_cs cs.r_w.r_x -#define vmf_ds ds.r_w.r_x -#define vmf_es es.r_w.r_x -#define vmf_ss ss.r_w.r_x -#define vmf_bp ebp.r_w.r_x -#define vmf_sp esp.r_w.r_x -#define vmf_ip eip.r_w.r_x -#define vmf_flags eflags.r_w.r_x -#define vmf_eflags eflags.r_ex -}; - -#define VM86_PMAPSIZE 24 -#define VMAP_MALLOC 1 /* page was malloced by us */ - -struct vm86context { - int npages; - struct vm86pmap { - int flags; - int pte_num; - vm_offset_t kva; - uint64_t old_pte; - } pmap[VM86_PMAPSIZE]; -}; - -#define VM_USERCHANGE (PSL_USERCHANGE) -#define VME_USERCHANGE (VM_USERCHANGE | PSL_VIP | PSL_VIF) - -struct vm86_kernel { - caddr_t vm86_intmap; /* interrupt map */ - u_int vm86_eflags; /* emulated flags */ - int vm86_has_vme; /* VME support */ - int vm86_inited; /* we were initialized */ - int vm86_debug; - caddr_t vm86_sproc; /* address of sproc */ -}; - -#define VM86_INIT 1 -#define VM86_SET_VME 2 -#define VM86_GET_VME 3 -#define VM86_INTCALL 4 - -struct vm86_init_args { - int debug; /* debug flag */ - int cpu_type; /* cpu type to emulate */ - u_char int_map[32]; /* interrupt map */ -}; - -struct vm86_vme_args { - int state; /* status */ -}; - -struct vm86_intcall_args { - int intnum; - struct vm86frame vmf; -}; - -#ifdef _KERNEL -extern int vm86paddr; - -struct thread; -extern int vm86_emulate(struct vm86frame *); -extern int vm86_sysarch(struct thread *, char *); -extern void vm86_trap(struct vm86frame *); -extern int vm86_intcall(int, struct vm86frame *); -extern int vm86_datacall(int, struct vm86frame *, struct vm86context *); -extern void vm86_initialize(void); -extern vm_offset_t vm86_getpage(struct vm86context *, int); -extern vm_offset_t vm86_addpage(struct vm86context *, int, vm_offset_t); -extern int vm86_getptr(struct vm86context *, vm_offset_t, u_short *, u_short *); - -extern vm_offset_t vm86_getaddr(struct vm86context *, u_short, u_short); -#endif /* _KERNEL */ - -#endif /* _MACHINE_VM86_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86-freebsd-none/machine/vmparam.h b/lib/libc/include/x86-freebsd-none/machine/vmparam.h deleted file mode 100644 index 625944650a..0000000000 --- a/lib/libc/include/x86-freebsd-none/machine/vmparam.h +++ /dev/null @@ -1,251 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 1994 John S. Dyson - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_VMPARAM_H_ -#define _MACHINE_VMPARAM_H_ 1 - -/* - * Machine dependent constants for 386. - */ - -/* - * Virtual memory related constants, all in bytes - */ -#define MAXTSIZ (128UL*1024*1024) /* max text size */ -#ifndef DFLDSIZ -#define DFLDSIZ (128UL*1024*1024) /* initial data size limit */ -#endif -#ifndef MAXDSIZ -#define MAXDSIZ (512UL*1024*1024) /* max data size */ -#endif -#ifndef DFLSSIZ -#define DFLSSIZ (8UL*1024*1024) /* initial stack size limit */ -#endif -#ifndef MAXSSIZ -#define MAXSSIZ (64UL*1024*1024) /* max stack size */ -#endif -#ifndef SGROWSIZ -#define SGROWSIZ (128UL*1024) /* amount to grow stack */ -#endif - -/* - * Choose between DENSE and SPARSE based on whether lower execution time or - * lower kernel address space consumption is desired. Under PAE, kernel - * address space is often in short supply. - */ -#ifdef PAE -#define VM_PHYSSEG_SPARSE -#else -#define VM_PHYSSEG_DENSE -#endif - -/* - * The number of PHYSSEG entries must be one greater than the number - * of phys_avail entries because the phys_avail entry that spans the - * largest physical address that is accessible by ISA DMA is split - * into two PHYSSEG entries. - */ -#define VM_PHYSSEG_MAX 17 - -/* - * Create one free page pool. Since the i386 kernel virtual address - * space does not include a mapping onto the machine's entire physical - * memory, VM_FREEPOOL_DIRECT is defined as an alias for the default - * pool, VM_FREEPOOL_DEFAULT. - */ -#define VM_NFREEPOOL 1 -#define VM_FREEPOOL_DEFAULT 0 -#define VM_FREEPOOL_DIRECT 0 - -/* - * Create up to three free page lists: VM_FREELIST_DMA32 is for physical pages - * that have physical addresses below 4G but are not accessible by ISA DMA, - * and VM_FREELIST_ISADMA is for physical pages that are accessible by ISA - * DMA. - */ -#define VM_NFREELIST 3 -#define VM_FREELIST_DEFAULT 0 -#define VM_FREELIST_DMA32 1 -#define VM_FREELIST_LOWMEM 2 - -#define VM_LOWMEM_BOUNDARY (16 << 20) /* 16MB ISA DMA limit */ - -/* - * Always create DMA32 freelist if there is any memory above 4G. - * Bounce dma is extremely fragile and simultaneously intensively - * used. - */ -#define VM_DMA32_NPAGES_THRESHOLD 1 - -/* - * The largest allocation size is 2MB under PAE and 4MB otherwise. - */ -#define VM_NFREEORDER_PAE 10 -#define VM_NFREEORDER_NOPAE 11 -#define VM_NFREEORDER_MAX VM_NFREEORDER_NOPAE -#define VM_NFREEORDER i386_pmap_VM_NFREEORDER - -/* - * Enable superpage reservations: 1 level. - */ -#ifndef VM_NRESERVLEVEL -#define VM_NRESERVLEVEL 1 -#endif - -/* - * Level 0 reservations consist of 512 pages when PAE pagetables are - * used, and 1024 pages otherwise. - */ -#ifndef VM_LEVEL_0_ORDER -#define VM_LEVEL_0_ORDER_PAE 9 -#define VM_LEVEL_0_ORDER_NOPAE 10 -#define VM_LEVEL_0_ORDER_MAX VM_LEVEL_0_ORDER_NOPAE -#define VM_LEVEL_0_ORDER i386_pmap_VM_LEVEL_0_ORDER -#else -#define VM_LEVEL_0_ORDER_MAX VM_LEVEL_0_ORDER -#endif - -/* - * Kernel physical load address. - */ -#ifndef KERNLOAD -#define KERNLOAD (8 * 1024 * 1024) -#endif /* !defined(KERNLOAD) */ - -/* - * Virtual addresses of things. Derived from the page directory and - * page table indexes from pmap.h for precision. - * Because of the page that is both a PD and PT, it looks a little - * messy at times, but hey, we'll do anything to save a page :-) - */ - -#define VM_MAX_KERNEL_ADDRESS (0xffffffffU - 16 * 1024 * 1024 + 1) - -#define VM_MIN_KERNEL_ADDRESS 0 - -#define KERNBASE KERNLOAD - -#define UPT_MAX_ADDRESS VADDR(PTDPTDI, PTDPTDI) -#define UPT_MIN_ADDRESS VADDR(PTDPTDI, 0) - -#define VM_MAXUSER_ADDRESS (0xffffffff - 4 * 1024 * 1024 + 1) - -#define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE) -#define USRSTACK SHAREDPAGE - -#define VM_MAX_ADDRESS VADDR(PTDPTDI, 0) -#define VM_MIN_ADDRESS ((vm_offset_t)0) - -#define PMAP_TRM_MIN_ADDRESS VM_MAXUSER_ADDRESS -#define PMAP_TRM_MAX_ADDRESS 0xffffffff - -#define PMAP_MAP_LOW (4 * 1024 * 1024) - -/* - * KVA layout. The unit of the system allocation is single PDE, which - * represents NBPDR bytes, aligned to NBPDR. NBPDR is 4M for non-PAE - * page tables, and 2M for PAE, so PAE mode requires twice as many PTDs - * to create the same memory map as non-PAE. - * - * 0x00000000 - 0x003fffff Transient identity map of low memory (0-4M), - * normally disabled to catch NULL derefs. - * 0x00400000 - 0x007fffff Fixed mapping of the low memory (4-8M). - * 0x00800000 - 0xffbfffff KERNBASE (VA) == KERNLOAD (PA), kernel - * text + data and all kernel maps. Managed - * by MI VM. - * 0xffc00000 - 0xffdfffff Recursive kernel page table mapping, pointed - * to by PTmap. PTD[] recursively points - * into PTmap. - * 0xffe00000 - 0xffffffff Kernel/User mode shared PDE, contains GDT, - * IDT, TSS, LDT, trampoline code and stacks. - * Managed by pmap_trm_alloc(). - */ - -/* - * How many physical pages per kmem arena virtual page. - */ -#ifndef VM_KMEM_SIZE_SCALE -#define VM_KMEM_SIZE_SCALE (1) -#endif - -/* - * Optional floor (in bytes) on the size of the kmem arena. - */ -#ifndef VM_KMEM_SIZE_MIN -#define VM_KMEM_SIZE_MIN (12 * 1024 * 1024) -#endif - -/* - * Optional ceiling (in bytes) on the size of the kmem arena: 40% of the - * kernel map rounded to the nearest multiple of the superpage size. - */ -#ifndef VM_KMEM_SIZE_MAX -#define VM_KMEM_SIZE_MAX (((((VM_MAX_KERNEL_ADDRESS - \ - VM_MIN_KERNEL_ADDRESS) >> (PDRSHIFT - 2)) + 5) / 10) << PDRSHIFT) -#endif - -/* initial pagein size of beginning of executable file */ -#ifndef VM_INITIAL_PAGEIN -#define VM_INITIAL_PAGEIN 16 -#endif - -#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ - -#ifndef VM_MAX_AUTOTUNE_MAXUSERS -#define VM_MAX_AUTOTUNE_MAXUSERS 384 -#endif - -#define SFBUF -#define SFBUF_MAP -#define SFBUF_CPUSET -#define SFBUF_PROCESS_PAGE - -#define PMAP_HAS_DMAP 0 -#define PHYS_TO_DMAP(x) ({ panic("No direct map exists"); 0; }) -#define DMAP_TO_PHYS(x) ({ panic("No direct map exists"); 0; }) - -/* - * No non-transparent large page support in the pmap. - */ -#define PMAP_HAS_LARGEPAGES 0 - -/* - * Need a page dump array for minidump. - */ -#define MINIDUMP_PAGE_TRACKING 1 -#define MINIDUMP_STARTUP_PAGE_TRACKING 0 - -#endif /* _MACHINE_VMPARAM_H_ */ \ No newline at end of file diff --git a/lib/std/Build/Configuration.zig b/lib/std/Build/Configuration.zig index 3e163286e7..80053bc49f 100644 --- a/lib/std/Build/Configuration.zig +++ b/lib/std/Build/Configuration.zig @@ -2347,7 +2347,6 @@ pub const TargetQuery = struct { x32sf, android, - androidsf, gnu, gnuf32, diff --git a/lib/std/Target.zig b/lib/std/Target.zig index adc5a8b328..738b749361 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -806,7 +806,6 @@ pub const Abi = enum { x32sf, android, - androidsf, gnu, gnuf32, @@ -1025,7 +1024,6 @@ pub const Abi = enum { pub inline fn isAndroid(abi: Abi) bool { return switch (abi) { .android, - .androidsf, => true, else => false, }; @@ -1071,7 +1069,6 @@ pub const Abi = enum { pub inline fn float(abi: Abi) Float { return switch (abi) { - .androidsf, .gnun32sf, .gnusf, .musln32sf, @@ -2907,7 +2904,6 @@ pub const DynamicLinker = struct { .arm, .aarch64, .riscv64, - .x86, .x86_64, => init("/system/runtime_loader"), else => none, @@ -2921,7 +2917,6 @@ pub const DynamicLinker = struct { .riscv64, => if (abi == .gnu) init("/lib/ld-riscv64-lp64.so.1") else none, - .x86 => if (abi == .gnu) init("/lib/ld.so.1") else none, .x86_64 => initFmt("/lib/ld-{s}.so.1", .{switch (abi) { .gnu => "x86-64", .gnux32 => "x32", @@ -2935,15 +2930,11 @@ pub const DynamicLinker = struct { .linux => if (abi.isAndroid()) switch (arch) { - .arm => if (abi == .androidsf) init("/system/bin/linker") else none, - .aarch64, .riscv64, .x86, .x86_64, - => if (abi == .android) initFmt("/system/bin/linker{s}", .{ - if (ptrBitWidth_arch_abi(arch, abi) == 64) "64" else "", - }) else none, + => if (abi == .android) init("/system/bin/linker64") else none, else => none, } @@ -3239,11 +3230,9 @@ pub const DynamicLinker = struct { .freebsd => switch (arch) { .arm, .aarch64, - .powerpc, .powerpc64, .powerpc64le, .riscv64, - .x86, .x86_64, => init("/libexec/ld-elf.so.1"), else => none, @@ -3520,9 +3509,7 @@ pub fn stackAlignment(target: *const Target) u16 { => if (!target.cpu.has(.riscv, .e)) return 16, .x86 => switch (target.os.tag) { - .hurd, - .linux, - => return 16, + .linux => return 16, else => {}, }, @@ -3862,10 +3849,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 { .int, .uint, .float => 32, .long, .ulong => switch (target.cpu.arch) { .x86_64 => 64, - else => switch (target.abi) { - .ilp32 => 32, - else => 64, - }, + else => 64, }, .longlong, .ulonglong, .double => 64, .longdouble => switch (target.cpu.arch) { diff --git a/lib/std/c.zig b/lib/std/c.zig index 8122367edc..9e770ef8c4 100644 --- a/lib/std/c.zig +++ b/lib/std/c.zig @@ -3244,7 +3244,7 @@ const common_linux_Sigaction = extern struct { /// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name. pub const Sigaction = switch (native_os) { - .linux => if (builtin.abi.isAndroid() and builtin.target.ptrBitWidth() == 64) extern struct { + .linux => if (builtin.abi.isAndroid()) extern struct { pub const handler_fn = *align(1) const fn (SIG) callconv(.c) void; pub const sigaction_fn = *const fn (SIG, *const siginfo_t, ?*anyopaque) callconv(.c) void; @@ -7187,7 +7187,7 @@ pub const time_t = switch (native_os) { .linux => linux.time_t, .dragonfly, .illumos, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => c_long, .emscripten => emscripten.time_t, - .freebsd, .haiku => if (native_arch == .x86) c_int else c_longlong, + .freebsd, .haiku => c_longlong, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L47 .netbsd, .openbsd, .serenity => c_longlong, else => void, @@ -7266,7 +7266,7 @@ pub const PR = switch (native_os) { }; pub const _errno = switch (native_os) { .linux => switch (native_abi) { - .android, .androidsf => private.__errno, + .android => private.__errno, else => private.__errno_location, }, .emscripten => private.__errno_location, @@ -8051,15 +8051,13 @@ pub const pthread_mutex_t = switch (native_os) { => 40, else => if (@sizeOf(usize) == 8) 40 else 24, }, - .android, .androidsf => if (@sizeOf(usize) == 8) 40 else 4, + .android => if (@sizeOf(usize) == 8) 40 else 4, else => @compileError("unsupported ABI"), }; }, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { sig: c_long = 0x32AAABA7, - data: [data_len]u8 = @splat(0), - - const data_len = if (@sizeOf(usize) == 8) 56 else 40; + data: [56]u8 = @splat(0), }, .freebsd, .dragonfly, .openbsd => extern struct { inner: ?*anyopaque = null, @@ -8111,8 +8109,7 @@ pub const pthread_cond_t = switch (native_os) { }, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { sig: c_long = 0x3CB0B1BB, - data: [data_len]u8 = @splat(0), - const data_len = if (@sizeOf(usize) == 8) 40 else 24; + data: [40]u8 = @splat(0), }, .freebsd, .dragonfly, .openbsd => extern struct { inner: ?*anyopaque = null, @@ -8151,19 +8148,8 @@ pub const pthread_cond_t = switch (native_os) { }; pub const pthread_rwlock_t = switch (native_os) { - .linux => switch (native_abi) { - .android, .androidsf => switch (@sizeOf(usize)) { - 4 => extern struct { - data: [40]u8 align(@alignOf(usize)) = @splat(0), - }, - 8 => extern struct { - data: [56]u8 align(@alignOf(usize)) = @splat(0), - }, - else => @compileError("impossible pointer size"), - }, - else => extern struct { - data: [56]u8 align(@alignOf(usize)) = @splat(0), - }, + .linux => extern struct { + data: [56]u8 align(@alignOf(usize)) = @splat(0), }, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { sig: c_long = 0x2DA8B3B4, @@ -9807,7 +9793,7 @@ pub const NSIG = switch (native_os) { pub const MINSIGSTKSZ = switch (native_os) { .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => 32768, .freebsd => switch (builtin.cpu.arch) { - .powerpc64, .powerpc64le, .x86, .x86_64 => 2048, + .powerpc64, .powerpc64le, .x86_64 => 2048, .arm, .aarch64, .riscv64 => 4096, else => @compileError("unsupported arch"), }, diff --git a/lib/std/c/darwin.zig b/lib/std/c/darwin.zig index 1931b2ede0..dd4aa84b06 100644 --- a/lib/std/c/darwin.zig +++ b/lib/std/c/darwin.zig @@ -406,7 +406,7 @@ pub extern "c" fn kevent64( timeout: ?*const timespec, ) c_int; -pub const mach_hdr = if (@sizeOf(usize) == 8) mach_header_64 else mach_header; +pub const mach_hdr = mach_header_64; pub const mach_header_64 = std.macho.mach_header_64; pub const mach_header = std.macho.mach_header; diff --git a/lib/std/debug/SelfInfo/Elf.zig b/lib/std/debug/SelfInfo/Elf.zig index e6e0f46c1d..6f72795a1f 100644 --- a/lib/std/debug/SelfInfo/Elf.zig +++ b/lib/std/debug/SelfInfo/Elf.zig @@ -120,7 +120,6 @@ pub const can_unwind: bool = s: { .aarch64, .arm, .riscv64, - .x86, .x86_64, }, .illumos => &.{ @@ -178,7 +177,6 @@ pub const can_unwind: bool = s: { .aarch64, .arm, .riscv64, - .x86, .x86_64, }, // Not supported yet: hppa, mips64/mips64el, sh/sheb diff --git a/lib/std/debug/cpu_context.zig b/lib/std/debug/cpu_context.zig index 2bff33f0da..77875c39e7 100644 --- a/lib/std/debug/cpu_context.zig +++ b/lib/std/debug/cpu_context.zig @@ -2418,28 +2418,6 @@ const signal_ucontext_t = switch (native_os) { pc: u64, }, // https://github.com/freebsd/freebsd-src/blob/55c28005f544282b984ae0e15dacd0c108d8ab12/sys/x86/include/ucontext.h - .x86 => extern struct { - _onstack: i32 align(16), - _gs: i32, - _fs: i32, - _es: i32, - _ds: i32, - edi: u32, - esi: u32, - ebp: u32, - _isp: i32, - ebx: u32, - edx: u32, - ecx: u32, - eax: u32, - _trapno: i32, - _err: i32, - eip: u32, - _cs: i32, - _eflags: i32, - esp: u32, - }, - // https://github.com/freebsd/freebsd-src/blob/55c28005f544282b984ae0e15dacd0c108d8ab12/sys/x86/include/ucontext.h .x86_64 => extern struct { _onstack: i64 align(16), rdi: u64, @@ -2992,48 +2970,6 @@ const signal_ucontext_t = switch (native_os) { t3_6: [4]u64, pc: u64, }, - // https://github.com/haiku/haiku/blob/47538c534fe0aadc626c09d121773fee8ea10d71/headers/posix/arch/x86/signal.h - .x86 => extern struct { - eip: u32, - _eflags: u32, - eax: u32, - ecx: u32, - edx: u32, - esp: u32, - ebp: u32, - _reserved: u32, - _xregs: extern struct { - _fp_control: u16, - _fp_status: u16, - _fp_tag: u16, - _fp_opcode: u16, - _fp_eip: u32, - _fp_cs: u16, - _reserved1: u16, - _fp_datap: u32, - _fp_ds: u16, - _reserved2: u16, - _mxcsr: u32, - _mxcsr_mask: u32, - _mmx: [8][16]u8, - _xmmx: [8][16]u8, - _reserved3: [176]u8, - _fault_address: u32, - _error_code: u32, - _cs: u16, - _ds: u16, - _es: u16, - _fs: u16, - _gs: u16, - _ss: u16, - _trap_number: u8, - _reserved4: [27]u8, - _format: u32, - }, - edi: u32, - esi: u32, - ebx: u32, - }, // https://github.com/haiku/haiku/blob/47538c534fe0aadc626c09d121773fee8ea10d71/headers/posix/arch/x86_64/signal.h .x86_64 => extern struct { rax: u64, diff --git a/lib/std/heap.zig b/lib/std/heap.zig index c2caef2131..e4e98fe36b 100644 --- a/lib/std/heap.zig +++ b/lib/std/heap.zig @@ -573,11 +573,7 @@ const page_size_min_default: ?usize = switch (builtin.os.tag) { .windows => switch (builtin.cpu.arch) { // -- .x86, .x86_64 => 4 << 10, - // SuperH => 4 << 10, - .powerpc, .powerpcle, .powerpc64, .powerpc64le => 4 << 10, - // DEC Alpha => 8 << 10, - // Itanium => 8 << 10, - .thumb, .thumbeb, .arm, .armeb, .aarch64, .aarch64_be => 4 << 10, + .thumb, .aarch64 => 4 << 10, else => null, }, .wasi => switch (builtin.cpu.arch) { @@ -588,22 +584,22 @@ const page_size_min_default: ?usize = switch (builtin.os.tag) { .uefi => 4 << 10, .freebsd => switch (builtin.cpu.arch) { // FreeBSD/sys/* - .x86, .x86_64 => 4 << 10, - .thumb, .thumbeb, .arm, .armeb => 4 << 10, - .aarch64, .aarch64_be => 4 << 10, - .powerpc, .powerpc64, .powerpc64le, .powerpcle => 4 << 10, - .riscv32, .riscv64 => 4 << 10, + .x86_64 => 4 << 10, + .arm => 4 << 10, + .aarch64 => 4 << 10, + .powerpc64, .powerpc64le => 4 << 10, + .riscv64 => 4 << 10, else => null, }, .netbsd => switch (builtin.cpu.arch) { // NetBSD/sys/arch/* .alpha => 8 << 10, .x86, .x86_64 => 4 << 10, - .thumb, .thumbeb, .arm, .armeb => 4 << 10, + .arm, .armeb => 4 << 10, .aarch64, .aarch64_be => 4 << 10, .hppa => 4 << 10, .mips, .mipsel, .mipsf32, .mipsf32el, .mips64, .mips64el => 4 << 10, - .powerpc, .powerpc64, .powerpc64le, .powerpcle => 4 << 10, + .powerpc => 4 << 10, .sh, .sheb => 4 << 10, .sparc => 4 << 10, .sparc64 => 8 << 10, @@ -613,7 +609,7 @@ const page_size_min_default: ?usize = switch (builtin.os.tag) { else => null, }, .dragonfly => switch (builtin.cpu.arch) { - .x86, .x86_64 => 4 << 10, + .x86_64 => 4 << 10, else => null, }, .openbsd => switch (builtin.cpu.arch) { @@ -621,12 +617,12 @@ const page_size_min_default: ?usize = switch (builtin.os.tag) { .alpha => 8 << 10, .hppa => 4 << 10, .x86, .x86_64 => 4 << 10, - .thumb, .thumbeb, .arm, .armeb, .aarch64, .aarch64_be => 4 << 10, + .arm, .aarch64 => 4 << 10, .m88k => 4 << 10, .mips64 => 4 << 10, - .powerpc, .powerpc64, .powerpc64le, .powerpcle => 4 << 10, + .powerpc, .powerpc64 => 4 << 10, .riscv64 => 4 << 10, - .sh, .sheb => 4 << 10, + .sh => 4 << 10, .sparc64 => 8 << 10, else => null, }, @@ -638,26 +634,29 @@ const page_size_min_default: ?usize = switch (builtin.os.tag) { .fuchsia => switch (builtin.cpu.arch) { // fuchsia/kernel/arch/*/include/arch/defines.h .x86_64 => 4 << 10, - .aarch64, .aarch64_be => 4 << 10, + .aarch64 => 4 << 10, + .arm, .thumb => 4 << 10, .riscv64 => 4 << 10, else => null, }, // https://github.com/SerenityOS/serenity/blob/62b938b798dc009605b5df8a71145942fc53808b/Kernel/API/POSIX/sys/limits.h#L11-L13 - .serenity => 4 << 10, + .serenity => switch (builtin.cpu.arch) { + .aarch64 => 4 << 10, + .riscv64 => 4 << 10, + .x86_64 => 4 << 10, + else => null, + }, .haiku => switch (builtin.cpu.arch) { // haiku/headers/posix/arch/*/limits.h - .thumb, .thumbeb, .arm, .armeb => 4 << 10, - .aarch64, .aarch64_be => 4 << 10, - .m68k => 4 << 10, - .powerpc, .powerpc64, .powerpc64le, .powerpcle => 4 << 10, + .arm => 4 << 10, + .aarch64 => 4 << 10, .riscv64 => 4 << 10, - .sparc64 => 8 << 10, - .x86, .x86_64 => 4 << 10, + .x86_64 => 4 << 10, else => null, }, .hurd => switch (builtin.cpu.arch) { // gnumach/*/include/mach/*/vm_param.h - .x86, .x86_64 => 4 << 10, + .x86_64 => 4 << 10, .aarch64 => null, else => null, }, @@ -678,12 +677,12 @@ const page_size_min_default: ?usize = switch (builtin.os.tag) { }, .ps4 => switch (builtin.cpu.arch) { // https://github.com/ps4dev/ps4sdk/blob/4df9d001b66ae4ec07d9a51b62d1e4c5e270eecc/include/machine/param.h#L95 - .x86, .x86_64 => 4 << 10, + .x86_64 => 4 << 10, else => null, }, .ps5 => switch (builtin.cpu.arch) { // https://github.com/PS5Dev/PS5SDK/blob/a2e03a2a0231a3a3397fa6cd087a01ca6d04f273/include/machine/param.h#L95 - .x86, .x86_64 => 16 << 10, + .x86_64 => 16 << 10, else => null, }, .psp => switch (builtin.cpu.arch) { @@ -753,11 +752,7 @@ const page_size_max_default: ?usize = switch (builtin.os.tag) { .windows => switch (builtin.cpu.arch) { // -- .x86, .x86_64 => 4 << 10, - // SuperH => 4 << 10, - .powerpc, .powerpcle, .powerpc64, .powerpc64le => 4 << 10, - // DEC Alpha => 8 << 10, - // Itanium => 8 << 10, - .thumb, .thumbeb, .arm, .armeb, .aarch64, .aarch64_be => 4 << 10, + .thumb, .aarch64 => 4 << 10, else => null, }, .wasi => switch (builtin.cpu.arch) { @@ -768,22 +763,22 @@ const page_size_max_default: ?usize = switch (builtin.os.tag) { .uefi => 4 << 10, .freebsd => switch (builtin.cpu.arch) { // FreeBSD/sys/* - .x86, .x86_64 => 4 << 10, - .thumb, .thumbeb, .arm, .armeb => 4 << 10, - .aarch64, .aarch64_be => 4 << 10, - .powerpc, .powerpc64, .powerpc64le, .powerpcle => 4 << 10, - .riscv32, .riscv64 => 4 << 10, + .x86_64 => 4 << 10, + .arm => 4 << 10, + .aarch64 => 4 << 10, + .powerpc64, .powerpc64le => 4 << 10, + .riscv64 => 4 << 10, else => null, }, .netbsd => switch (builtin.cpu.arch) { // NetBSD/sys/arch/* .alpha => 8 << 10, .x86, .x86_64 => 4 << 10, - .thumb, .thumbeb, .arm, .armeb => 4 << 10, + .arm, .armeb => 4 << 10, .aarch64, .aarch64_be => 64 << 10, .hppa => 4 << 10, .mips, .mipsel, .mipsf32, .mipsf32el, .mips64, .mips64el => 16 << 10, - .powerpc, .powerpc64, .powerpc64le, .powerpcle => 16 << 10, + .powerpc, .powerpcle => 16 << 10, .sh, .sheb => 4 << 10, .sparc => 8 << 10, .sparc64 => 8 << 10, @@ -792,7 +787,7 @@ const page_size_max_default: ?usize = switch (builtin.os.tag) { else => null, }, .dragonfly => switch (builtin.cpu.arch) { - .x86, .x86_64 => 4 << 10, + .x86_64 => 4 << 10, else => null, }, .openbsd => switch (builtin.cpu.arch) { @@ -800,12 +795,12 @@ const page_size_max_default: ?usize = switch (builtin.os.tag) { .alpha => 8 << 10, .hppa => 4 << 10, .x86, .x86_64 => 4 << 10, - .thumb, .thumbeb, .arm, .armeb, .aarch64, .aarch64_be => 4 << 10, + .arm, .aarch64 => 4 << 10, .m88k => 4 << 10, .mips64 => 16 << 10, - .powerpc, .powerpc64, .powerpc64le, .powerpcle => 4 << 10, + .powerpc, .powerpc64 => 4 << 10, .riscv64 => 4 << 10, - .sh, .sheb => 4 << 10, + .sh => 4 << 10, .sparc64 => 8 << 10, else => null, }, @@ -817,26 +812,29 @@ const page_size_max_default: ?usize = switch (builtin.os.tag) { .fuchsia => switch (builtin.cpu.arch) { // fuchsia/kernel/arch/*/include/arch/defines.h .x86_64 => 4 << 10, - .aarch64, .aarch64_be => 4 << 10, + .aarch64 => 4 << 10, + .arm, .thumb => 4 << 10, .riscv64 => 4 << 10, else => null, }, // https://github.com/SerenityOS/serenity/blob/62b938b798dc009605b5df8a71145942fc53808b/Kernel/API/POSIX/sys/limits.h#L11-L13 - .serenity => 4 << 10, + .serenity => switch (builtin.cpu.arch) { + .x86_64 => 4 << 10, + .aarch64 => 4 << 10, + .riscv64 => 4 << 10, + else => null, + }, .haiku => switch (builtin.cpu.arch) { // haiku/headers/posix/arch/*/limits.h - .thumb, .thumbeb, .arm, .armeb => 4 << 10, - .aarch64, .aarch64_be => 4 << 10, - .m68k => 4 << 10, - .powerpc, .powerpc64, .powerpc64le, .powerpcle => 4 << 10, + .arm => 4 << 10, + .aarch64 => 4 << 10, .riscv64 => 4 << 10, - .sparc64 => 8 << 10, - .x86, .x86_64 => 4 << 10, + .x86_64 => 4 << 10, else => null, }, .hurd => switch (builtin.cpu.arch) { // gnumach/*/include/mach/*/vm_param.h - .x86, .x86_64 => 4 << 10, + .x86_64 => 4 << 10, .aarch64 => null, else => null, }, @@ -857,12 +855,12 @@ const page_size_max_default: ?usize = switch (builtin.os.tag) { }, .ps4 => switch (builtin.cpu.arch) { // https://github.com/ps4dev/ps4sdk/blob/4df9d001b66ae4ec07d9a51b62d1e4c5e270eecc/include/machine/param.h#L95 - .x86, .x86_64 => 4 << 10, + .x86_64 => 4 << 10, else => null, }, .ps5 => switch (builtin.cpu.arch) { // https://github.com/PS5Dev/PS5SDK/blob/a2e03a2a0231a3a3397fa6cd087a01ca6d04f273/include/machine/param.h#L95 - .x86, .x86_64 => 16 << 10, + .x86_64 => 16 << 10, else => null, }, .psp => switch (builtin.cpu.arch) { diff --git a/lib/std/zig/llvm/Builder.zig b/lib/std/zig/llvm/Builder.zig index 648378003d..be46a1f46b 100644 --- a/lib/std/zig/llvm/Builder.zig +++ b/lib/std/zig/llvm/Builder.zig @@ -108,7 +108,7 @@ pub fn tripleForTarget(allocator: Allocator, target: *const std.Target) ![]const const llvm_arch = switch (target.cpu.arch) { .arm => "arm", .armeb => "armeb", - .aarch64 => if (target.abi == .ilp32) "aarch64_32" else "aarch64", + .aarch64 => "aarch64", .aarch64_be => "aarch64_be", .arc => "arc", .avr => "avr", @@ -358,10 +358,6 @@ pub fn tripleForTarget(allocator: Allocator, target: *const std.Target) ![]const else "unknown", .android => "android", - .androidsf => if (target.cpu.arch.isArm()) - "androideabi" - else - "android", .gnu => if (target.cpu.arch.isArm()) "gnueabihf" else @@ -478,40 +474,30 @@ pub const DataLayout = struct { pub fn stringForTarget(target: *const std.Target) []const u8 { // These data layouts should match Clang. return switch (target.cpu.arch) { - .arc => "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-f32:32:32-i64:32-f64:32-a:0:32-n32", - .xcore => "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:32-f64:32-a:0:32-n32", - .hexagon => "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048", - .lanai => "E-m:e-p:32:32-i64:64-a:0:32-n32-S64", - .aarch64 => if (target.ofmt == .macho) - if (target.os.tag == .windows or target.os.tag == .uefi) - "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" - else if (target.abi == .ilp32) - "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" - else - "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" + .aarch64 => if (target.os.tag.isDarwin()) + "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" else if (target.os.tag == .windows or target.os.tag == .uefi) "e-m:w-p270:32:32-p271:32:32-p272:64:64-p:64:64-i32:32-i64:64-i128:128-n32:64-S128-Fn32" else "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32", .aarch64_be => "E-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32", - .arm => if (target.ofmt == .macho) - "e-m:o-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" - else - "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", - .armeb, .thumbeb => if (target.ofmt == .macho) - "E-m:o-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" - else - "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", - .thumb => if (target.ofmt == .macho) - "e-m:o-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" - else if (target.os.tag == .windows or target.os.tag == .uefi) + .amdgcn => "e-m:e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9", + .arc => "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-f32:32:32-i64:32-f64:32-a:0:32-n32", + .arm => "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", + .armeb, .thumbeb => "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", + .thumb => if (target.os.tag == .windows or target.os.tag == .uefi) "e-m:w-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" else "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", .avr => "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8:16-a:8", .bpfeb => "E-m:e-p:64:64-i64:64-i128:128-n32:64-S128", .bpfel => "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128", - .msp430 => "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16", + .csky => "e-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:32-v128:32:32-a:0:32-Fi32-n32", + .hexagon => "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048", + .lanai => "E-m:e-p:32:32-i64:64-a:0:32-n32-S64", + .loongarch32 => "e-m:e-p:32:32-i64:64-n32-S128", + .loongarch64 => "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128", + .m68k => "E-m:e-p:32:16:32-i8:8:8-i16:16:16-i32:16:32-n8:16:32-a:0:16-S16", .mips, .mipsf32, .mipsf64, @@ -540,7 +526,9 @@ pub const DataLayout = struct { "e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" else "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", - .m68k => "E-m:e-p:32:16:32-i8:8:8-i16:16:16-i32:16:32-n8:16:32-a:0:16-S16", + .msp430 => "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16", + .nvptx => "e-p:32:32-p6:32:32-p7:32:32-i64:64-i128:128-i256:256-v16:16-v32:32-n16:32:64", + .nvptx64 => "e-p6:32:32-i64:64-i128:128-i256:256-v16:16-v32:32-n16:32:64", .powerpc => "E-m:e-p:32:32-Fn32-i64:64-n32", .powerpcle => "e-m:e-p:32:32-Fn32-i64:64-n32", .powerpc64 => switch (target.os.tag) { @@ -552,9 +540,6 @@ pub const DataLayout = struct { "e-m:e-Fn32-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512" else "e-m:e-Fn32-i64:64-i128:128-n32:64", - .nvptx => "e-p:32:32-p6:32:32-p7:32:32-i64:64-i128:128-i256:256-v16:16-v32:32-n16:32:64", - .nvptx64 => "e-p6:32:32-i64:64-i128:128-i256:256-v16:16-v32:32-n16:32:64", - .amdgcn => "e-m:e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9", .riscv32 => if (target.cpu.has(.riscv, .e)) "e-m:e-p:32:32-i64:64-n32-S32" else @@ -571,9 +556,27 @@ pub const DataLayout = struct { "E-m:e-p:64:64-i64:64-i128:128-n32:64-S64" else "E-m:e-p:64:64-i64:64-i128:128-n32:64-S128", + .s390x => "E-S64-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64", .sparc => "E-m:e-p:32:32-i64:64-i128:128-f128:64-n32-S64", .sparc64 => "E-m:e-i64:64-i128:128-n32:64-S128", - .s390x => "E-S64-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64", + .spirv32 => switch (target.os.tag) { + .vulkan, .opengl => "e-ve-i64:64-n8:16:32:64-G10", + else => "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64-G1", + }, + .spirv64 => if (target.os.tag == .amdhsa) + "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n32:64-S32-G1-P4-A0" + else + "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64-G1", + .ve => "e-m:e-i64:64-n32:64-S128-v64:64:64-v128:64:64-v256:64:64-v512:64:64-v1024:64:64-v2048:64:64-v4096:64:64-v8192:64:64-v16384:64:64", + .wasm32 => if (target.os.tag == .emscripten) + "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-f128:64-n32:64-S128-ni:1:10:20" + else + "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20", + .wasm64 => if (target.os.tag == .emscripten) + "e-m:e-p:64:64-p10:8:8-p20:8:8-i64:64-i128:128-f128:64-n32:64-S128-ni:1:10:20" + else + "e-m:e-p:64:64-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20", + // TODO: clean this up; what is even going on in this prong? .x86, .x86c16 => if (target.os.tag == .windows or target.os.tag == .uefi) switch (target.abi) { .gnu => if (target.ofmt == .coff) "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32" @@ -595,38 +598,16 @@ pub const DataLayout = struct { else "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32"; }, - } else if (target.ofmt == .macho) - "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128" - else - "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128", - .x86_64 => if (target.os.tag.isDarwin() or target.ofmt == .macho) + } else "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128", + .x86_64 => if (target.os.tag.isDarwin()) "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" + else if (target.os.tag == .windows or target.os.tag == .uefi) + "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" else if (target.abi.isX32()) "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" - else if ((target.os.tag == .windows or target.os.tag == .uefi) and target.ofmt == .coff) - "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" else "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", - .spirv32 => switch (target.os.tag) { - .vulkan, .opengl => "e-ve-i64:64-n8:16:32:64-G10", - else => "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64-G1", - }, - .spirv64 => if (target.os.tag == .amdhsa) - "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n32:64-S32-G1-P4-A0" - else - "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64-G1", - .wasm32 => if (target.os.tag == .emscripten) - "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-f128:64-n32:64-S128-ni:1:10:20" - else - "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20", - .wasm64 => if (target.os.tag == .emscripten) - "e-m:e-p:64:64-p10:8:8-p20:8:8-i64:64-i128:128-f128:64-n32:64-S128-ni:1:10:20" - else - "e-m:e-p:64:64-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20", - .ve => "e-m:e-i64:64-n32:64-S128-v64:64:64-v128:64:64-v256:64:64-v512:64:64-v1024:64:64-v2048:64:64-v4096:64:64-v8192:64:64-v16384:64:64", - .csky => "e-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:32-v128:32:32-a:0:32-Fi32-n32", - .loongarch32 => "e-m:e-p:32:32-i64:64-n32-S128", - .loongarch64 => "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128", + .xcore => "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:32-f64:32-a:0:32-n32", .xtensa => "e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-n32", .alpha, diff --git a/lib/std/zig/target.zig b/lib/std/zig/target.zig index 5955f8acab..920f7c1e8b 100644 --- a/lib/std/zig/target.zig +++ b/lib/std/zig/target.zig @@ -219,7 +219,6 @@ pub const available_libcs = [_]ArchOsAbi{ .{ .arch = .thumbeb, .os = .linux, .abi = .musl, .os_ver = .{ .major = 2, .minor = 6, .patch = 0 } }, .{ .arch = .thumbeb, .os = .linux, .abi = .muslsf, .os_ver = .{ .major = 2, .minor = 6, .patch = 0 } }, - .{ .arch = .x86, .os = .freebsd, .abi = .none }, .{ .arch = .x86, .os = .linux, .abi = .gnu, .glibc_triple = "i686-linux-gnu" }, .{ .arch = .x86, .os = .linux, .abi = .musl }, .{ .arch = .x86, .os = .netbsd, .abi = .none }, diff --git a/src/libs/freebsd.zig b/src/libs/freebsd.zig index 487b41b147..7e6208c767 100644 --- a/src/libs/freebsd.zig +++ b/src/libs/freebsd.zig @@ -107,10 +107,8 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre try csuPath(comp, arena, switch (target.cpu.arch) { .arm => "arm", .aarch64 => "aarch64", - .powerpc => "powerpc", .powerpc64, .powerpc64le => "powerpc64", .riscv64 => "riscv", - .x86 => "i386", .x86_64 => "amd64", else => unreachable, }), @@ -166,17 +164,6 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre .condition = target.cpu.arch == .aarch64, }, - .{ - .path = "powerpc" ++ path.sep_str ++ "crt1_c.c", - .flags = cflags.items, - .condition = target.cpu.arch == .powerpc, - }, - .{ - .path = "powerpc" ++ path.sep_str ++ "crtsavres.S", - .flags = acflags.items, - .condition = target.cpu.arch == .powerpc, - }, - .{ .path = "powerpc64" ++ path.sep_str ++ "crt1_c.c", .flags = cflags.items, @@ -194,17 +181,6 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre .condition = target.cpu.arch == .riscv64, }, - .{ - .path = "i386" ++ path.sep_str ++ "crt1_c.c", - .flags = cflags.items, - .condition = target.cpu.arch == .x86, - }, - .{ - .path = "i386" ++ path.sep_str ++ "crt1_s.S", - .flags = acflags.items, - .condition = target.cpu.arch == .x86, - }, - .{ .path = "amd64" ++ path.sep_str ++ "crt1_c.c", .flags = cflags.items, diff --git a/src/link/Lld.zig b/src/link/Lld.zig index 31127a5fc5..b243b3410e 100644 --- a/src/link/Lld.zig +++ b/src/link/Lld.zig @@ -1313,25 +1313,12 @@ fn getLDMOption(target: *const std.Target) ?[]const u8 { .hexagon => "hexagonelf", .loongarch32 => "elf32loongarch", .loongarch64 => "elf64loongarch", - .mips, .mipsf32, .mipsf64, .mipsf64n8, .mipsn8, .mipsr6 => switch (target.os.tag) { - .freebsd => "elf32btsmip_fbsd", - else => "elf32btsmip", - }, - .mipsel, .mipsf32el, .mipsf64el, .mipsf64n8el, .mipsn8el, .mipsr6el => switch (target.os.tag) { - .freebsd => "elf32ltsmip_fbsd", - else => "elf32ltsmip", - }, - .mips64, .mips64n8, .mips64r6 => switch (target.os.tag) { - .freebsd => if (target.abi.isN32()) "elf32btsmipn32_fbsd" else "elf64btsmip_fbsd", - else => if (target.abi.isN32()) "elf32btsmipn32" else "elf64btsmip", - }, - .mips64el, .mips64n8el, .mips64r6el => switch (target.os.tag) { - .freebsd => if (target.abi.isN32()) "elf32ltsmipn32_fbsd" else "elf64ltsmip_fbsd", - else => if (target.abi.isN32()) "elf32ltsmipn32" else "elf64ltsmip", - }, + .mips, .mipsf32, .mipsf64, .mipsf64n8, .mipsn8, .mipsr6 => "elf32btsmip", + .mipsel, .mipsf32el, .mipsf64el, .mipsf64n8el, .mipsn8el, .mipsr6el => "elf32ltsmip", + .mips64, .mips64n8, .mips64r6 => if (target.abi.isN32()) "elf32btsmipn32" else "elf64btsmip", + .mips64el, .mips64n8el, .mips64r6el => if (target.abi.isN32()) "elf32ltsmipn32" else "elf64ltsmip", .msp430 => "msp430elf", .powerpc => switch (target.os.tag) { - .freebsd => "elf32ppc_fbsd", .linux => "elf32ppclinux", else => "elf32ppc", }, @@ -1347,10 +1334,7 @@ fn getLDMOption(target: *const std.Target) ?[]const u8 { .riscv64be => "elf64briscv", .s390x => "elf64_s390", .sparc64 => "elf64_sparc", - .x86, .x86c16 => switch (target.os.tag) { - .freebsd => "elf_i386_fbsd", - else => "elf_i386", - }, + .x86, .x86c16 => "elf_i386", .x86_64 => if (target.abi.isX32()) "elf32_x86_64" else "elf_x86_64", else => null, }; diff --git a/src/target.zig b/src/target.zig index 80236fad91..02e7fc3ea4 100644 --- a/src/target.zig +++ b/src/target.zig @@ -185,7 +185,7 @@ pub fn hasValgrindSupport(target: *const std.Target, backend: std.lang.CompilerB else => false, }, .x86 => switch (target.os.tag) { - .linux, .freebsd => true, + .linux => true, .windows => !ofmt_c_msvc, else => false, }, @@ -538,7 +538,7 @@ pub fn libcFullLinkFlags(target: *const std.Target) []const []const u8 { .illumos => &.{ "-lm", "-lsocket", "-lnsl", "-lc" }, .haiku => &.{ "-lm", "-lroot", "-lpthread", "-lc", "-lnetwork" }, .linux => switch (target.abi) { - .android, .androidsf, .ohos, .ohossf => &.{ "-lm", "-lc", "-ldl" }, + .android, .ohos, .ohossf => &.{ "-lm", "-lc", "-ldl" }, else => &.{ "-lm", "-lpthread", "-lc", "-ldl", "-lrt", "-lutil" }, }, // On SerenityOS libc includes libm, libpthread, libdl, and libssp. diff --git a/test/llvm/matrix.zon b/test/llvm/matrix.zon index 1ec42a7073..4936aae679 100644 --- a/test/llvm/matrix.zon +++ b/test/llvm/matrix.zon @@ -20,7 +20,6 @@ .{ .cpu = .{ .aarch64 = .{} }, .os = .{ .netbsd = .{} }, .abi = .{ .none = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, .{ .cpu = .{ .aarch64 = .{} }, .os = .{ .openbsd = .{} }, .abi = .{ .none = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, .{ .cpu = .{ .aarch64 = .{} }, .os = .{ .rtems = .{} }, .abi = .{ .none = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, - .{ .cpu = .{ .aarch64 = .{} }, .os = .{ .rtems = .{} }, .abi = .{ .ilp32 = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, .{ .cpu = .{ .aarch64 = .{} }, .os = .{ .serenity = .{} }, .abi = .{ .none = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, .{ .cpu = .{ .aarch64 = .{} }, .os = .{ .@"switch" = .{} }, .abi = .{ .none = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, .{ .cpu = .{ .aarch64 = .{} }, .os = .{ .tvos = .{} }, .abi = .{ .none = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .old }, @@ -28,7 +27,6 @@ .{ .cpu = .{ .aarch64 = .{} }, .os = .{ .uefi = .{} }, .abi = .{ .none = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, .{ .cpu = .{ .aarch64 = .{} }, .os = .{ .visionos = .{} }, .abi = .{ .none = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .old }, .{ .cpu = .{ .aarch64 = .{} }, .os = .{ .visionos = .{} }, .abi = .{ .simulator = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .old }, - .{ .cpu = .{ .aarch64 = .{} }, .os = .{ .watchos = .{} }, .abi = .{ .ilp32 = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .old }, .{ .cpu = .{ .aarch64 = .{} }, .os = .{ .watchos = .{} }, .abi = .{ .none = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .old }, .{ .cpu = .{ .aarch64 = .{} }, .os = .{ .watchos = .{} }, .abi = .{ .simulator = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .old }, .{ .cpu = .{ .aarch64 = .{} }, .os = .{ .windows = .{} }, .abi = .{ .gnu = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, @@ -55,7 +53,6 @@ .{ .cpu = .{ .arm = .{} }, .os = .{ .fuchsia = .{} }, .abi = .{ .none = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, .{ .cpu = .{ .arm = .{} }, .os = .{ .gba = .{} }, .abi = .{ .sf = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, .{ .cpu = .{ .arm = .{} }, .os = .{ .haiku = .{} }, .abi = .{ .none = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, - .{ .cpu = .{ .arm = .{} }, .os = .{ .linux = .{} }, .abi = .{ .androidsf = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, .{ .cpu = .{ .arm = .{} }, .os = .{ .linux = .{} }, .abi = .{ .gnu = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, .{ .cpu = .{ .arm = .{} }, .os = .{ .linux = .{} }, .abi = .{ .gnusf = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, .{ .cpu = .{ .arm = .{} }, .os = .{ .linux = .{} }, .abi = .{ .musl = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, @@ -535,9 +532,6 @@ .{ .cpu = .{ .x86 = .{} }, .os = .{ .freestanding = .{} }, .abi = .{ .none = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, .{ .cpu = .{ .x86 = .{} }, .os = .{ .freestanding = .{} }, .abi = .{ .sf = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, - .{ .cpu = .{ .x86 = .{} }, .os = .{ .haiku = .{} }, .abi = .{ .none = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, - .{ .cpu = .{ .x86 = .{} }, .os = .{ .hurd = .{} }, .abi = .{ .gnu = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, - .{ .cpu = .{ .x86 = .{} }, .os = .{ .linux = .{} }, .abi = .{ .android = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, .{ .cpu = .{ .x86 = .{} }, .os = .{ .linux = .{} }, .abi = .{ .gnu = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, .{ .cpu = .{ .x86 = .{} }, .os = .{ .linux = .{} }, .abi = .{ .musl = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, .{ .cpu = .{ .x86 = .{} }, .os = .{ .linux = .{} }, .abi = .{ .none = .{} }, .cache_mode = .whole, .backend = .llvm, .linker = .lld }, diff --git a/tools/process_headers.zig b/tools/process_headers.zig index 214be748d4..d4bfafc3a0 100644 --- a/tools/process_headers.zig +++ b/tools/process_headers.zig @@ -87,7 +87,6 @@ const freebsd_targets = [_]LibCTarget{ .{ .arch = .aarch64, .abi = .none }, .{ .arch = .powerpc64, .abi = .none }, .{ .arch = .riscv64, .abi = .none }, - .{ .arch = .x86, .abi = .none }, .{ .arch = .x86_64, .abi = .none }, }; @@ -206,11 +205,9 @@ pub fn main(init: std.process.Init) !void { .musl => std.zig.target.muslArchName(libc_target.arch, libc_target.abi), .freebsd => switch (libc_target.arch) { .arm => "armv7", - .x86 => "i386", .x86_64 => "amd64", .aarch64, - .powerpc, .powerpc64, .riscv64, => |a| @tagName(a),