diff options
author | 2004-02-27 17:36:11 +0000 | |
---|---|---|
committer | 2004-02-27 17:36:11 +0000 | |
commit | 77fd8a68cd3e1b2ccac42e4788b2531b079f8a1a (patch) | |
tree | 3733a42dd7c7f2341b32c1aa766af8317c301adf /lib/libpthread | |
parent | JVC MP-XP7250 Builtin USB WLAN (diff) | |
download | wireguard-openbsd-77fd8a68cd3e1b2ccac42e4788b2531b079f8a1a.tar.xz wireguard-openbsd-77fd8a68cd3e1b2ccac42e4788b2531b079f8a1a.zip |
change amd64's MACHINE_ARCH from x86_64 to amd64. There are many many
reasons for this, quite a few of them technical, and not all of them
in response to Intel's broken ia32e crud. The gcc toolchain stays at
x86_64 for now.
Diffstat (limited to 'lib/libpthread')
-rw-r--r-- | lib/libpthread/arch/x86_64/_atomic_lock.c | 26 | ||||
-rw-r--r-- | lib/libpthread/arch/x86_64/uthread_machdep.c | 108 | ||||
-rw-r--r-- | lib/libpthread/arch/x86_64/uthread_machdep.h | 26 | ||||
-rw-r--r-- | lib/libpthread/arch/x86_64/uthread_machdep_asm.S | 88 |
4 files changed, 0 insertions, 248 deletions
diff --git a/lib/libpthread/arch/x86_64/_atomic_lock.c b/lib/libpthread/arch/x86_64/_atomic_lock.c deleted file mode 100644 index 0d187dee87d..00000000000 --- a/lib/libpthread/arch/x86_64/_atomic_lock.c +++ /dev/null @@ -1,26 +0,0 @@ -/* $OpenBSD: _atomic_lock.c,v 1.3 2004/02/25 04:10:53 deraadt Exp $ */ - -/* David Leonard, <d@csee.uq.edu.au>. Public domain. */ - -/* - * Atomic lock for amd64 -- taken from i386 code. - */ - -#include "spinlock.h" - -int -_atomic_lock(volatile _spinlock_lock_t *lock) -{ - _spinlock_lock_t old; - - /* - * Use the eXCHanGe instruction to swap the lock value with - * a local variable containing the locked state. - */ - old = _SPINLOCK_LOCKED; - __asm__("xchg %0,%1" - : "=r" (old), "=m" (*lock) - : "0" (old), "1" (*lock)); - - return (old != _SPINLOCK_UNLOCKED); -} diff --git a/lib/libpthread/arch/x86_64/uthread_machdep.c b/lib/libpthread/arch/x86_64/uthread_machdep.c deleted file mode 100644 index c827a35a10c..00000000000 --- a/lib/libpthread/arch/x86_64/uthread_machdep.c +++ /dev/null @@ -1,108 +0,0 @@ -/* $OpenBSD: uthread_machdep.c,v 1.3 2004/02/25 04:10:53 deraadt Exp $ */ - -/* - * Copyright (c) 2004 Theo de Raadt - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - -#include <machine/param.h> -#include <pthread.h> -#include "pthread_private.h" - -struct frame { - long fr_gs; - long fr_fs; - long fr_es; - long fr_ds; - - long flag; - long fr_r15; - long fr_r14; - long fr_r13; - long fr_r12; - - long fr_r11; - long fr_r10; - long fr_r9; - long fr_r8; - - long fr_rdi; - long fr_rsi; - long fr_rbp; - - long fr_rbx; - long fr_rdx; - long fr_rcx; - long fr_rax; - - long fr_rip; - int fr_cs; /* XXX unreachable? */ - int pad; -}; - -#define copyreg(reg, lval) \ - __asm__("mov %%" #reg ", %0" : "=g"(lval)) - -/* - * Given a stack and an entry function, initialise a state - * structure that can be later switched to. - */ -void -_thread_machdep_init(struct _machdep_state* statep, void *base, int len, - void (*entry)(void)) -{ - struct frame *f; - int foo; - - /* Locate the initial frame, aligned at the top of the stack */ - f = (struct frame *)(((long)base + len - sizeof *f) & ~ALIGNBYTES); - - copyreg(cs, foo); - f->fr_cs = foo; - copyreg(ds, foo); - f->fr_ds = foo; - copyreg(es, foo); - f->fr_es = foo; - copyreg(fs, foo); - f->fr_fs = foo; - copyreg(gs, foo); - f->fr_gs = foo; - - f->fr_rbp = (long)-1; - f->fr_rip = (long)entry; - - statep->rsp = (long)f; - - _thread_machdep_save_float_state(statep); -} - -#define fxsave(addr) __asm("fxsave %0" : "=m" (*addr)) -#define fxrstor(addr) __asm("fxrstor %0" : : "m" (*addr)) -#define fwait() __asm("fwait") -#define fninit() __asm("fninit") - -void -_thread_machdep_save_float_state(struct _machdep_state *ms) -{ - fxsave(&ms->fpreg); - fninit(); - fwait(); -} - -void -_thread_machdep_restore_float_state(struct _machdep_state *ms) -{ - fxrstor(&ms->fpreg); -} diff --git a/lib/libpthread/arch/x86_64/uthread_machdep.h b/lib/libpthread/arch/x86_64/uthread_machdep.h deleted file mode 100644 index 34532db8b48..00000000000 --- a/lib/libpthread/arch/x86_64/uthread_machdep.h +++ /dev/null @@ -1,26 +0,0 @@ -/* $OpenBSD: uthread_machdep.h,v 1.3 2004/02/25 04:10:53 deraadt Exp $ */ - -/* - * Copyright (c) 2004 Theo de Raadt - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/types.h> -#include <machine/fpu.h> - -struct _machdep_state { - long rsp; - /* must be 128-bit aligned */ - struct savefpu fpreg __attribute__ ((aligned (16))); -}; diff --git a/lib/libpthread/arch/x86_64/uthread_machdep_asm.S b/lib/libpthread/arch/x86_64/uthread_machdep_asm.S deleted file mode 100644 index 818d157de93..00000000000 --- a/lib/libpthread/arch/x86_64/uthread_machdep_asm.S +++ /dev/null @@ -1,88 +0,0 @@ -/* $OpenBSD: uthread_machdep_asm.S,v 1.3 2004/02/25 04:10:53 deraadt Exp $ */ - -/* - * Copyright (c) 2004 Theo de Raadt - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <machine/asm.h> - -/* - * Switch stacks - */ - -/* void _thread_machdep_switch(new, oldsave); */ -ENTRY(_thread_machdep_switch) - pushq %rax - pushq %rcx - pushq %rdx - pushq %rbx - - pushq %rbp - pushq %rsi - pushq %rdi - - pushq %r8 - pushq %r9 - pushq %r10 - pushq %r11 - - pushq %r12 - pushq %r13 - pushq %r14 - pushq %r15 - movq $0xdeaf12345678beaf, %r15 - pushq %r15 - - movl %ds,%eax - pushq %rax - movl %es,%eax - pushq %rax - movl %fs,%eax - pushq %rax - movl %gs,%eax - pushq %rax - - movq %rsp, 0(%rsi) /* *arg2 = %rsp */ - movq 0(%rdi), %rsp /* %rsp = *arg1 */ - - popq %rax - movl %eax,%gs - popq %rax - movl %eax,%fs - popq %rax - movl %eax,%es - popq %rax - movl %eax,%ds - - popq %r15 # flag word. - popq %r15 - popq %r14 - popq %r13 - popq %r12 - - popq %r11 - popq %r10 - popq %r9 - popq %r8 - - popq %rdi - popq %rsi - popq %rbp - - popq %rbx - popq %rdx - popq %rcx - popq %rax - ret |