/* * Copyright (C) 1999-2017 Paolo Mantegazza * extensions for user space modules are jointly copyrighted (2000) with: * Pierre Cloutier , * Steve Papacharalambous . * * This 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 of the License, or (at your option) any later version. * * This 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 this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _RTAI_ASM_X86_64_LXRT_H #define _RTAI_ASM_X86_64_LXRT_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifdef __KERNEL__ #define RT_REG_ORIG_AX orig_ax #define RT_REG_SP sp #define RT_REG_SS ss #define RT_REG_FLAGS flags #define RT_REG_IP ip #define RT_REG_CS cs #define RT_REG_BP bp #define RT_REG_BX bx #define RT_REG_CX cx #define RTAI_SYSCALL_CODE di #define RTAI_SYSCALL_ARGS si #define RTAI_SYSCALL_RETPNT dx #define LINUX_SYSCALL_NR RT_REG_ORIG_AX #define LINUX_SYSCALL_REG1 di #define LINUX_SYSCALL_REG2 si #define LINUX_SYSCALL_REG3 dx #define LINUX_SYSCALL_REG4 r10 #define LINUX_SYSCALL_REG5 r8 #define LINUX_SYSCALL_REG6 r9 #define LINUX_SYSCALL_RETREG ax #define LINUX_SYSCALL_FLAGS RT_REG_FLAGS #ifdef CONFIG_RTAI_USE_STACK_ARGS // WHY THIS DOES NOT WORK ANYWAY-MORE??? /* * From Linux lib/usercopy.c. */ #define __do_strncpy_from_user(dst, src, count, res) \ do { \ long __d0, __d1, __d2; \ __asm__ __volatile__( \ " testq %1,%1\n" \ " jz 2f\n" \ "0: lodsb\n" \ " stosb\n" \ " testb %%al,%%al\n" \ " jz 1f\n" \ " decq %1\n" \ " jnz 0b\n" \ "1: subq %1,%0\n" \ "2:\n" \ ".section .fixup,\"ax\"\n" \ "3: movq %5,%0\n" \ " jmp 2b\n" \ ".previous\n" \ ".section __ex_table,\"a\"\n" \ " .align 8\n" \ " .quad 0b,3b\n" \ ".previous" \ : "=&r"(res), "=&c"(count), "=&a" (__d0), "=&S" (__d1), \ "=&D" (__d2) \ : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \ : "memory"); \ } while (0) #endif #endif /* __KERNEL__ */ #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* !_RTAI_ASM_X86_64_LXRT_H */