Subversion Repositories HelenOS

Compare Revisions

No changes between revisions

Ignore whitespace Rev 2017 → Rev 2018

/trunk/kernel/kernel.config
146,4 → 146,4
! CONFIG_TEST (choice)
 
# Benchmark test
! [CONFIG_TEST!=] CONFIG_BENCH (y/n)
! [CONFIG_TEST!=] CONFIG_BENCH (n/y)
/trunk/kernel/arch/ia32xen/include/cycle.h
0,0 → 1,0
link ../../ia32/include/cycle.h
Property changes:
Added: svn:special
+*
\ No newline at end of property
/trunk/kernel/arch/ia32xen/include/asm.h
218,15 → 218,6
return v;
}
 
static inline uint64_t rdtsc(void)
{
uint64_t v;
__asm__ volatile("rdtsc\n" : "=A" (v));
return v;
}
 
/** Return current IP address */
static inline uintptr_t * get_ip()
{
/trunk/kernel/arch/amd64/include/cycle.h
0,0 → 1,43
/*
* Copyright (C) 2006 Martin Decky
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup amd64
* @{
*/
/** @file
*/
 
#ifndef KERN_amd64_CYCLE_H_
#define KERN_amd64_CYCLE_H_
 
extern uint64_t get_cycle(void);
 
#endif
 
/** @}
*/
/trunk/kernel/arch/amd64/include/cpuid.h
57,9 → 57,6
 
extern void cpuid(uint32_t cmd, cpu_info_t *info);
 
 
extern uint64_t rdtsc(void);
 
#endif /* !def __ASM__ */
#endif
 
/trunk/kernel/arch/amd64/src/asm_utils.S
62,7 → 62,7
 
.global cpuid
.global has_cpuid
.global rdtsc
.global get_cycle
.global read_efer_flag
.global set_efer_flag
.global memcpy
146,7 → 146,7
movq %r10, %rbx
ret
 
rdtsc:
get_cycle:
xorq %rax,%rax
rdtsc
ret
/trunk/kernel/arch/ia32/include/cycle.h
0,0 → 1,53
/*
* Copyright (C) 2001-2004 Jakub Jermar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup ia32
* @{
*/
/** @file
*/
 
#ifndef KERN_ia32_CYCLE_H_
#define KERN_ia32_CYCLE_H_
 
static inline uint64_t get_cycle(void)
{
uint64_t v;
asm volatile(
"rdtsc\n"
: "=A" (v)
);
return v;
}
 
#endif
 
/** @}
*/
/trunk/kernel/arch/ia32/include/asm.h
228,15 → 228,6
return v;
}
 
static inline uint64_t rdtsc(void)
{
uint64_t v;
__asm__ volatile("rdtsc\n" : "=A" (v));
return v;
}
 
/** Return current IP address */
static inline uintptr_t * get_ip()
{
/trunk/kernel/arch/ia32/src/drivers/i8254.c
39,6 → 39,7
#include <arch/types.h>
#include <time/clock.h>
#include <time/delay.h>
#include <arch/cycle.h>
#include <arch/interrupt.h>
#include <arch/drivers/i8259.h>
#include <arch/drivers/i8254.h>
137,11 → 138,11
 
CPU->delay_loop_const = ((MAGIC_NUMBER*LOOPS)/1000) / ((t1-t2)-(o1-o2)) + (((MAGIC_NUMBER*LOOPS)/1000) % ((t1-t2)-(o1-o2)) ? 1 : 0);
 
clk1 = rdtsc();
delay(1<<SHIFT);
clk2 = rdtsc();
clk1 = get_cycle();
delay(1 << SHIFT);
clk2 = get_cycle();
CPU->frequency_mhz = (clk2-clk1)>>SHIFT;
CPU->frequency_mhz = (clk2 - clk1) >> SHIFT;
 
return;
}