/usr/include/xenomai/asm-x86/hal_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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | /**
* @ingroup hal
* @file
*
* Copyright (C) 2007 Philippe Gerum <rpm@xenomai.org>.
*
* 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; 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_HAL_64_H
#define _XENO_ASM_X86_HAL_64_H
#define RTHAL_ARCH_NAME "x86_64"
#ifdef CONFIG_IPIPE_CORE
#define RTHAL_TIMER_DEVICE ipipe_timer_name()
#else /* !I-ipipe core */
#define RTHAL_TIMER_DEVICE "lapic"
#endif /* !I-ipipe core */
#define RTHAL_CLOCK_DEVICE "tsc"
#include <asm/xenomai/wrappers.h>
#include <asm-generic/xenomai/hal.h> /* Read the generic bits. */
typedef unsigned long rthal_time_t;
static inline __attribute_const__ unsigned long ffnz(unsigned long ul)
{
__asm__("bsfq %1, %0":"=r"(ul):"rm"(ul));
return ul;
}
#ifndef __cplusplus
#include <asm/io.h>
#include <asm/timex.h>
#include <asm/processor.h>
#include <asm/fixmap.h>
#include <asm/apic.h>
#include <asm/msr.h>
#include <asm/xenomai/atomic.h>
#include <asm/xenomai/smi.h>
#ifdef CONFIG_IPIPE_CORE
#define RTHAL_TIMER_IRQ __ipipe_hrtimer_irq
#define RTHAL_HOST_TICK_IRQ __ipipe_hrtimer_irq
#define RTHAL_TIMER_IPI RTHAL_HRTIMER_IPI
#else /* !I-ipipe core */
#define RTHAL_HRTIMER_VECTOR IPIPE_SERVICE_VECTOR0
#define RTHAL_APIC_TIMER_VECTOR RTHAL_HRTIMER_VECTOR
#define RTHAL_TIMER_IPI RTHAL_HRTIMER_IPI
#define RTHAL_APIC_ICOUNT ((RTHAL_TIMER_FREQ + HZ/2)/HZ)
#define RTHAL_TIMER_IRQ RTHAL_TIMER_IPI
#define RTHAL_NMICLK_FREQ RTHAL_CPU_FREQ
#define RTHAL_HOST_TICK_IRQ ipipe_apic_vector_irq(LOCAL_TIMER_VECTOR)
#define RTHAL_BCAST_TICK_IRQ 0
#endif /* !I-ipipe core */
static inline void rthal_grab_control(void)
{
rthal_smi_init();
rthal_smi_disable();
}
static inline void rthal_release_control(void)
{
rthal_smi_restore();
}
static inline unsigned long long rthal_rdtsc(void)
{
unsigned long long t;
rthal_read_tsc(t);
return t;
}
static inline void rthal_timer_program_shot(unsigned long delay)
{
#ifdef CONFIG_IPIPE_CORE
ipipe_timer_set(delay);
#else /* !I-pipe core */
/* With head-optimization, callers are expected to have switched off
hard-IRQs already -- no need for additional protection in this
case. */
#ifndef CONFIG_XENO_OPT_PIPELINE_HEAD
unsigned long flags;
rthal_local_irq_save_hw(flags);
#endif /* CONFIG_XENO_OPT_PIPELINE_HEAD */
if (likely(delay))
apic_write(APIC_TMICT,delay);
else
/* Pend the timer interrupt. */
rthal_schedule_irq_head(RTHAL_TIMER_IPI);
#ifndef CONFIG_XENO_OPT_PIPELINE_HEAD
rthal_local_irq_restore_hw(flags);
#endif /* CONFIG_XENO_OPT_PIPELINE_HEAD */
#endif /* !I-pipe core */
}
static const char *const rthal_fault_labels[] = {
[0] = "Divide error",
[1] = "Debug",
[2] = "", /* NMI is not pipelined. */
[3] = "Int3",
[4] = "Overflow",
[5] = "Bounds",
[6] = "Invalid opcode",
[7] = "FPU not available",
[8] = "Double fault",
[9] = "FPU segment overrun",
[10] = "Invalid TSS",
[11] = "Segment not present",
[12] = "Stack segment",
[13] = "General protection",
[14] = "Page fault",
[15] = "Spurious interrupt",
[16] = "FPU error",
[17] = "Alignment check",
[18] = "Machine check",
[19] = "SIMD error",
[20] = NULL,
};
#ifdef CONFIG_X86_LOCAL_APIC
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
#include <asm/mach_apic.h>
#else
#include <asm/apic.h>
#endif
static inline void rthal_setup_periodic_apic(int count, int vector)
{
apic_write(APIC_LVTT, APIC_LVT_TIMER_PERIODIC | vector);
apic_write(APIC_TMICT, count);
}
static inline void rthal_setup_oneshot_apic(int vector)
{
apic_write(APIC_LVTT, vector);
}
#endif /* !CONFIG_X86_LOCAL_APIC */
#endif /* !__cplusplus */
long rthal_strncpy_from_user(char *dst,
const char __user *src,
long count);
#endif /* !_XENO_ASM_X86_HAL_64_H */
|