mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-10 23:30:07 +00:00
c9cf6ddeeb
* sysdeps/unix/sysv/linux/x86_64/Makefile: New file. * sysdeps/unix/sysv/linux/x86_64/Versions: New file. * sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h: New file. * sysdeps/unix/sysv/linux/x86_64/bits/mman.h: New file. * sysdeps/unix/sysv/linux/x86_64/bits/stat.h: New file. * sysdeps/unix/sysv/linux/x86_64/bits/statfs.h: New file. * sysdeps/unix/sysv/linux/x86_64/bits/time.h: New file. * sysdeps/unix/sysv/linux/x86_64/bits/types.h: New file. * sysdeps/unix/sysv/linux/x86_64/brk.c: New file. * sysdeps/unix/sysv/linux/x86_64/clone.S: New file. * sysdeps/unix/sysv/linux/x86_64/fstatfs64.c: New file. * sysdeps/unix/sysv/linux/x86_64/ftruncate64.c: New file. * sysdeps/unix/sysv/linux/x86_64/fxstat.c: New file. * sysdeps/unix/sysv/linux/x86_64/fxstat64.c: New file. * sysdeps/unix/sysv/linux/x86_64/getdents.c: New file. * sysdeps/unix/sysv/linux/x86_64/getdents64.c: New file. * sysdeps/unix/sysv/linux/x86_64/getrlimit64.c: New file. * sysdeps/unix/sysv/linux/x86_64/gettimeofday.c: New file. * sysdeps/unix/sysv/linux/x86_64/glob64.c: New file. * sysdeps/unix/sysv/linux/x86_64/lxstat.c: New file. * sysdeps/unix/sysv/linux/x86_64/lxstat64.c: New file. * sysdeps/unix/sysv/linux/x86_64/mmap64.c: New file. * sysdeps/unix/sysv/linux/x86_64/pread64.c: New file. * sysdeps/unix/sysv/linux/x86_64/profil-counter.h: New file. * sysdeps/unix/sysv/linux/x86_64/pwrite64.c: New file. * sysdeps/unix/sysv/linux/x86_64/readdir.c: New file. * sysdeps/unix/sysv/linux/x86_64/readdir64.c: New file. * sysdeps/unix/sysv/linux/x86_64/readdir64_r.c: New file. * sysdeps/unix/sysv/linux/x86_64/readdir_r.c: New file. * sysdeps/unix/sysv/linux/x86_64/recv.c: New file. * sysdeps/unix/sysv/linux/x86_64/register-dump.h: New file. * sysdeps/unix/sysv/linux/x86_64/send.c: New file. * sysdeps/unix/sysv/linux/x86_64/setrlimit64.c: New file. * sysdeps/unix/sysv/linux/x86_64/sigaction.c: New file. * sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h: New file. * sysdeps/unix/sysv/linux/x86_64/sigpending.c: New file. * sysdeps/unix/sysv/linux/x86_64/sigprocmask.c: New file. * sysdeps/unix/sysv/linux/x86_64/sigsuspend.c: New file. * sysdeps/unix/sysv/linux/x86_64/statfs64.c: New file. * sysdeps/unix/sysv/linux/x86_64/sys/perm.h: New file. * sysdeps/unix/sysv/linux/x86_64/sys/procfs.h: New file. * sysdeps/unix/sysv/linux/x86_64/sys/reg.h: New file. * sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h: New file. * sysdeps/unix/sysv/linux/x86_64/sys/user.h: New file. * sysdeps/unix/sysv/linux/x86_64/syscall.S: New file. * sysdeps/unix/sysv/linux/x86_64/syscalls.list: New file. * sysdeps/unix/sysv/linux/x86_64/sysdep.S: New file. * sysdeps/unix/sysv/linux/x86_64/sysdep.h: New file. * sysdeps/unix/sysv/linux/x86_64/time.c: New file. * sysdeps/unix/sysv/linux/x86_64/truncate64.c: New file. * sysdeps/unix/sysv/linux/x86_64/umount.c: New file. * sysdeps/unix/sysv/linux/x86_64/vfork.S: New file. * sysdeps/unix/sysv/linux/x86_64/xstat.c: New file. * sysdeps/unix/sysv/linux/x86_64/xstat64.c: New file. * sysdeps/unix/x86_64/sysdep.S: New file. * sysdeps/unix/x86_64/sysdep.h: New file. * sysdeps/x86_64/Implies: New file. * sysdeps/x86_64/Makefile: New file. * sysdeps/x86_64/Versions: New file. * sysdeps/x86_64/__longjmp.S: New file. * sysdeps/x86_64/abort-instr.h: New file. * sysdeps/x86_64/atomicity.h: New file. * sysdeps/x86_64/bits/endian.h: New file. * sysdeps/x86_64/bits/setjmp.h: New file. * sysdeps/x86_64/bits/string.h: New file. * sysdeps/x86_64/bp-asm.h: New file. * sysdeps/x86_64/bsd-_setjmp.S: New file. * sysdeps/x86_64/bsd-setjmp.S: New file. * sysdeps/x86_64/dl-machine.h: New file. * sysdeps/x86_64/elf/initfini.c: New file. * sysdeps/x86_64/elf/start.S: New file. * sysdeps/x86_64/ffs.c: New file. * sysdeps/x86_64/ffsll.c: New file. * sysdeps/x86_64/fpu/bits/fenv.h: New file. * sysdeps/x86_64/fpu/bits/mathdef.h: New file. * sysdeps/x86_64/fpu/e_acosl.c: New file. * sysdeps/x86_64/fpu/e_atan2l.c: New file. * sysdeps/x86_64/fpu/e_exp2l.S: New file. * sysdeps/x86_64/fpu/e_expl.c: New file. * sysdeps/x86_64/fpu/e_fmodl.S: New file. * sysdeps/x86_64/fpu/e_log10l.S: New file. * sysdeps/x86_64/fpu/e_log2l.S: New file. * sysdeps/x86_64/fpu/e_logl.S: New file. * sysdeps/x86_64/fpu/e_powl.S: New file. * sysdeps/x86_64/fpu/e_rem_pio2l.c: New file. * sysdeps/x86_64/fpu/e_scalbl.S: New file. * sysdeps/x86_64/fpu/e_sqrtl.c: New file. * sysdeps/x86_64/fpu/fclrexcpt.c: New file. * sysdeps/x86_64/fpu/fedisblxcpt.c: New file. * sysdeps/x86_64/fpu/feenablxcpt.c: New file. * sysdeps/x86_64/fpu/fegetenv.c: New file. * sysdeps/x86_64/fpu/fegetexcept.c: New file. * sysdeps/x86_64/fpu/fegetround.c: New file. * sysdeps/x86_64/fpu/feholdexcpt.c: New file. * sysdeps/x86_64/fpu/fesetenv.c: New file. * sysdeps/x86_64/fpu/fesetround.c: New file. * sysdeps/x86_64/fpu/fgetexcptflg.c: New file. * sysdeps/x86_64/fpu/fraiseexcpt.c: New file. * sysdeps/x86_64/fpu/fsetexcptflg.c: New file. * sysdeps/x86_64/fpu/ftestexcept.c: New file. * sysdeps/x86_64/fpu/libm-test-ulps: New file. * sysdeps/x86_64/fpu/math_ldbl.h: New file. * sysdeps/x86_64/fpu/printf_fphex.c: New file. * sysdeps/x86_64/fpu/s_atanl.c: New file. * sysdeps/x86_64/fpu/s_cosl.S: New file. * sysdeps/x86_64/fpu/s_expm1l.S: New file. * sysdeps/x86_64/fpu/s_fpclassifyl.c: New file. * sysdeps/x86_64/fpu/s_isinfl.c: New file. * sysdeps/x86_64/fpu/s_isnanl.c: New file. * sysdeps/x86_64/fpu/s_log1pl.S: New file. * sysdeps/x86_64/fpu/s_logbl.c: New file. * sysdeps/x86_64/fpu/s_nextafterl.c: New file. * sysdeps/x86_64/fpu/s_nexttoward.c: New file. * sysdeps/x86_64/fpu/s_nexttowardf.c: New file. * sysdeps/x86_64/fpu/s_rintl.c: New file. * sysdeps/x86_64/fpu/s_significandl.c: New file. * sysdeps/x86_64/fpu/s_sincosl.S: New file. * sysdeps/x86_64/fpu/s_sinl.S: New file. * sysdeps/x86_64/fpu/s_tanl.S: New file. * sysdeps/x86_64/gmp-mparam.h: New file. * sysdeps/x86_64/hp-timing.c: New file. * sysdeps/x86_64/hp-timing.h: New file. * sysdeps/x86_64/htonl.S: New file. * sysdeps/x86_64/memusage.h: New file. * sysdeps/x86_64/setjmp.S: New file. * sysdeps/x86_64/soft-fp/sfp-machine.h: New file. * sysdeps/x86_64/stackinfo.h: New file. * sysdeps/x86_64/sysdep.h: New file. * sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed: New file.
142 lines
4.6 KiB
C
142 lines
4.6 KiB
C
/* Bounded-pointer definitions for x86-64 assembler.
|
|
Copyright (C) 2001 Free Software Foundation, Inc.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; if not, write to the Free
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
02111-1307 USA. */
|
|
|
|
#ifndef _bp_asm_h_
|
|
# define _bp_asm_h_ 1
|
|
|
|
# if __ASSEMBLER__
|
|
|
|
# if __BOUNDED_POINTERS__
|
|
|
|
/* Bounded pointers occupy three words. */
|
|
# define PTR_SIZE 24
|
|
/* Bounded pointer return values are passed back through a hidden
|
|
argument that points to caller-allocate space. The hidden arg
|
|
occupies one word on the stack. */
|
|
# define RTN_SIZE 6
|
|
/* Although the caller pushes the hidden arg, the callee is
|
|
responsible for popping it. */
|
|
# define RET_PTR ret $RTN_SIZE
|
|
/* Maintain frame pointer chain in leaf assembler functions for the benefit
|
|
of debugging stack traces when bounds violations occur. */
|
|
# define ENTER pushq %rbp; movq %rsp, %rbp
|
|
# define LEAVE movq %rbp, %rsp; popq %rbp
|
|
/* Stack space overhead of procedure-call linkage: return address and
|
|
frame pointer. */
|
|
# define LINKAGE 16
|
|
/* Stack offset of return address after calling ENTER. */
|
|
# define PCOFF 8
|
|
|
|
/* Int 5 is the "bound range" exception also raised by the "bound"
|
|
instruction. */
|
|
# define BOUNDS_VIOLATED int $5
|
|
|
|
# define CHECK_BOUNDS_LOW(VAL_REG, BP_MEM) \
|
|
cmpq 8+BP_MEM, VAL_REG; \
|
|
jae 0f; /* continue if value >= low */ \
|
|
BOUNDS_VIOLATED; \
|
|
0:
|
|
|
|
# define CHECK_BOUNDS_HIGH(VAL_REG, BP_MEM, Jcc) \
|
|
cmpq 16+BP_MEM, VAL_REG; \
|
|
Jcc 0f; /* continue if value < high */ \
|
|
BOUNDS_VIOLATED; \
|
|
0:
|
|
|
|
# define CHECK_BOUNDS_BOTH(VAL_REG, BP_MEM) \
|
|
cmpq 8+BP_MEM, VAL_REG; \
|
|
jb 1f; /* die if value < low */ \
|
|
cmpq 16+BP_MEM, VAL_REG; \
|
|
jb 0f; /* continue if value < high */ \
|
|
1: BOUNDS_VIOLATED; \
|
|
0:
|
|
|
|
# define CHECK_BOUNDS_BOTH_WIDE(VAL_REG, BP_MEM, LENGTH) \
|
|
CHECK_BOUNDS_LOW(VAL_REG, BP_MEM); \
|
|
addl LENGTH, VAL_REG; \
|
|
cmpq 16+BP_MEM, VAL_REG; \
|
|
jbe 0f; /* continue if value <= high */ \
|
|
BOUNDS_VIOLATED; \
|
|
0: subq LENGTH, VAL_REG /* restore value */
|
|
|
|
/* Take bounds from BP_MEM and affix them to the pointer
|
|
value in %rax, stuffing all into memory at RTN(%esp).
|
|
Use %rdx as a scratch register. */
|
|
|
|
# define RETURN_BOUNDED_POINTER(BP_MEM) \
|
|
movq RTN(%rsp), %rdx; \
|
|
movq %rax, 0(%rdx); \
|
|
movq 8+BP_MEM, %rax; \
|
|
movq %rax, 4(%rdx); \
|
|
movq 16+BP_MEM, %rax; \
|
|
movq %rax, 8(%rdx)
|
|
|
|
# define RETURN_NULL_BOUNDED_POINTER \
|
|
movl RTN(%rsp), %rdx; \
|
|
movl %rax, 0(%rdx); \
|
|
movl %rax, 4(%rdx); \
|
|
movl %rax, 8(%rdx)
|
|
|
|
/* The caller of __errno_location is responsible for allocating space
|
|
for the three-word BP return-value and passing pushing its address
|
|
as an implicit first argument. */
|
|
# define PUSH_ERRNO_LOCATION_RETURN \
|
|
subl $16, %esp; \
|
|
subl $8, %esp; \
|
|
pushq %rsp
|
|
|
|
/* __errno_location is responsible for popping the implicit first
|
|
argument, but we must pop the space for the BP itself. We also
|
|
dereference the return value in order to dig out the pointer value. */
|
|
# define POP_ERRNO_LOCATION_RETURN \
|
|
popq %rax; \
|
|
addq $16, %rsp
|
|
|
|
# else /* !__BOUNDED_POINTERS__ */
|
|
|
|
/* Unbounded pointers occupy one word. */
|
|
# define PTR_SIZE 8
|
|
/* Unbounded pointer return values are passed back in the register %rax. */
|
|
# define RTN_SIZE 0
|
|
/* Use simple return instruction for unbounded pointer values. */
|
|
# define RET_PTR ret
|
|
/* Don't maintain frame pointer chain for leaf assembler functions. */
|
|
# define ENTER
|
|
# define LEAVE
|
|
/* Stack space overhead of procedure-call linkage: return address only. */
|
|
# define LINKAGE 8
|
|
/* Stack offset of return address after calling ENTER. */
|
|
# define PCOFF 0
|
|
|
|
# define CHECK_BOUNDS_LOW(VAL_REG, BP_MEM)
|
|
# define CHECK_BOUNDS_HIGH(VAL_REG, BP_MEM, Jcc)
|
|
# define CHECK_BOUNDS_BOTH(VAL_REG, BP_MEM)
|
|
# define CHECK_BOUNDS_BOTH_WIDE(VAL_REG, BP_MEM, LENGTH)
|
|
# define RETURN_BOUNDED_POINTER(BP_MEM)
|
|
|
|
# define RETURN_NULL_BOUNDED_POINTER
|
|
|
|
# define PUSH_ERRNO_LOCATION_RETURN
|
|
# define POP_ERRNO_LOCATION_RETURN
|
|
|
|
# endif /* !__BOUNDED_POINTERS__ */
|
|
|
|
# endif /* __ASSEMBLER__ */
|
|
|
|
#endif /* _bp_asm_h_ */
|