/usr/include/xenomai/asm-x86/arith_64.h is in libxenomai-dev 2.6.2.1-2ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | /**
* @ingroup hal
* @file
*
* Arithmetic/conversion routines for x86_64.
*
* Copyright © 2007 Jan Kiszka.
*
* Xenomai is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, Inc., 675 Mass Ave,
* Cambridge MA 02139, USA; either version 2 of the License, or (at
* your option) any later version.
*
* Xenomai 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Xenomai; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef _XENO_ASM_X86_ARITH_64_H
#define _XENO_ASM_X86_ARITH_64_H
#define _XENO_ASM_X86_ARITH_H
#include <asm/xenomai/features.h>
static inline __attribute__((__const__)) long long
__rthal_x86_64_llimd (long long op, unsigned m, unsigned d)
{
long long result;
__asm__ (
"imul %[m]\n\t"
"idiv %[d]\n\t"
: "=a" (result)
: "a" (op), [m] "r" ((unsigned long long)m),
[d] "r" ((unsigned long long)d)
: "rdx");
return result;
}
#define rthal_llimd(ll,m,d) __rthal_x86_64_llimd((ll),(m),(d))
static inline __attribute__((__const__)) long long
__rthal_x86_64_llmulshft(long long op, unsigned m, unsigned s)
{
long long result;
__asm__ (
"imulq %[m]\n\t"
"shrd %%cl,%%rdx,%%rax\n\t"
: "=a,a" (result)
: "a,a" (op), [m] "m,r" ((unsigned long long)m),
"c,c" (s)
: "rdx");
return result;
}
#define rthal_llmulshft(op, m, s) __rthal_x86_64_llmulshft((op), (m), (s))
static inline __attribute__((__const__)) unsigned long long
__rthal_x86_64_nodiv_ullimd(unsigned long long op,
unsigned long long frac, unsigned rhs_integ)
{
register unsigned long long rl __asm__("rax") = frac;
register unsigned long long rh __asm__("rdx");
register unsigned long long integ __asm__("rsi") = rhs_integ;
register unsigned long long t __asm__("r8") = 0x80000000ULL;
__asm__ ("mulq %[op]\n\t"
"addq %[t], %[rl]\n\t"
"adcq $0, %[rh]\n\t"
"imulq %[op], %[integ]\n\t"
"leaq (%[integ], %[rh], 1),%[rl]":
[rh]"=&d"(rh), [rl]"+&a"(rl), [integ]"+S"(integ):
[op]"D"(op), [t]"r"(t): "cc");
return rl;
}
#define rthal_nodiv_ullimd(op, frac, integ) \
__rthal_x86_64_nodiv_ullimd((op), (frac), (integ))
#include <asm-generic/xenomai/arith.h>
#endif /* _XENO_ASM_X86_ARITH_64_H */
|