Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 121358
b: refs/heads/master
c: b020632
h: refs/heads/master
v: v3
  • Loading branch information
Martin Schwidefsky committed Dec 25, 2008
1 parent 332363f commit 7ca570e
Show file tree
Hide file tree
Showing 25 changed files with 1,219 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fc5243d98ac2575ad14a974b3c097e9ba874c03d
refs/heads/master: b020632e40c3ed5e8c0c066d022672907e8401cf
3 changes: 3 additions & 0 deletions trunk/arch/s390/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ config GENERIC_HWEIGHT
config GENERIC_TIME
def_bool y

config GENERIC_TIME_VSYSCALL
def_bool y

config GENERIC_CLOCKEVENTS
def_bool y

Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/s390/include/asm/auxvec.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#ifndef __ASMS390_AUXVEC_H
#define __ASMS390_AUXVEC_H

#define AT_SYSINFO_EHDR 33

#endif
16 changes: 16 additions & 0 deletions trunk/arch/s390/include/asm/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ typedef s390_compat_regs compat_elf_gregset_t;
#include <asm/system.h> /* for save_access_regs */
#include <asm/mmu_context.h>

#include <asm/vdso.h>

extern unsigned int vdso_enabled;

/*
* This is used to ensure we don't load something for the wrong architecture.
*/
Expand Down Expand Up @@ -191,4 +195,16 @@ do { \
current->mm->context.noexec == 0; \
})

#define ARCH_DLINFO \
do { \
if (vdso_enabled) \
NEW_AUX_ENT(AT_SYSINFO_EHDR, \
(unsigned long)current->mm->context.vdso_base); \
} while (0)

struct linux_binprm;

#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
int arch_setup_additional_pages(struct linux_binprm *, int);

#endif
1 change: 1 addition & 0 deletions trunk/arch/s390/include/asm/mmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ typedef struct {
struct list_head pgtable_list;
unsigned long asce_bits;
unsigned long asce_limit;
unsigned long vdso_base;
int noexec;
int has_pgste; /* The mmu context has extended page tables */
int alloc_pgste; /* cloned contexts will have extended page tables */
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/s390/include/asm/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,6 @@ void arch_alloc_page(struct page *page, int order);
#include <asm-generic/memory_model.h>
#include <asm-generic/page.h>

#define __HAVE_ARCH_GATE_AREA 1

#endif /* _S390_PAGE_H */
39 changes: 39 additions & 0 deletions trunk/arch/s390/include/asm/vdso.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#ifndef __S390_VDSO_H__
#define __S390_VDSO_H__

#ifdef __KERNEL__

/* Default link addresses for the vDSOs */
#define VDSO32_LBASE 0
#define VDSO64_LBASE 0

#define VDSO_VERSION_STRING LINUX_2.6.26

#ifndef __ASSEMBLY__

/*
* Note about this structure:
*
* NEVER USE THIS IN USERSPACE CODE DIRECTLY. The layout of this
* structure is supposed to be known only to the function in the vdso
* itself and may change without notice.
*/

struct vdso_data {
__u64 tb_update_count; /* Timebase atomicity ctr 0x00 */
__u64 xtime_tod_stamp; /* TOD clock for xtime 0x08 */
__u64 xtime_clock_sec; /* Kernel time 0x10 */
__u64 xtime_clock_nsec; /* 0x18 */
__u64 wtom_clock_sec; /* Wall to monotonic clock 0x20 */
__u64 wtom_clock_nsec; /* 0x28 */
__u32 tz_minuteswest; /* Minutes west of Greenwich 0x30 */
__u32 tz_dsttime; /* Type of dst correction 0x34 */
};

extern struct vdso_data *vdso_data;

#endif /* __ASSEMBLY__ */

#endif /* __KERNEL__ */

#endif /* __S390_VDSO_H__ */
7 changes: 6 additions & 1 deletion trunk/arch/s390/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"'

obj-y := bitmap.o traps.o time.o process.o base.o early.o \
setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \
s390_ext.o debug.o irq.o ipl.o dis.o diag.o mem_detect.o
s390_ext.o debug.o irq.o ipl.o dis.o diag.o mem_detect.o \
vdso.o

obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o)
obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o)
Expand All @@ -39,3 +40,7 @@ S390_KEXEC_OBJS := machine_kexec.o crash.o
S390_KEXEC_OBJS += $(if $(CONFIG_64BIT),relocate_kernel64.o,relocate_kernel.o)
obj-$(CONFIG_KEXEC) += $(S390_KEXEC_OBJS)

# vdso
obj-$(CONFIG_64BIT) += vdso64/
obj-$(CONFIG_32BIT) += vdso32/
obj-$(CONFIG_COMPAT) += vdso32/
15 changes: 15 additions & 0 deletions trunk/arch/s390/kernel/asm-offsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <linux/sched.h>
#include <linux/kbuild.h>
#include <asm/vdso.h>

int main(void)
{
Expand Down Expand Up @@ -38,5 +39,19 @@ int main(void)
DEFINE(__SF_BACKCHAIN, offsetof(struct stack_frame, back_chain));
DEFINE(__SF_GPRS, offsetof(struct stack_frame, gprs));
DEFINE(__SF_EMPTY, offsetof(struct stack_frame, empty1));
BLANK();
/* timeval/timezone offsets for use by vdso */
DEFINE(__VDSO_UPD_COUNT, offsetof(struct vdso_data, tb_update_count));
DEFINE(__VDSO_XTIME_STAMP, offsetof(struct vdso_data, xtime_tod_stamp));
DEFINE(__VDSO_XTIME_SEC, offsetof(struct vdso_data, xtime_clock_sec));
DEFINE(__VDSO_XTIME_NSEC, offsetof(struct vdso_data, xtime_clock_nsec));
DEFINE(__VDSO_WTOM_SEC, offsetof(struct vdso_data, wtom_clock_sec));
DEFINE(__VDSO_WTOM_NSEC, offsetof(struct vdso_data, wtom_clock_nsec));
DEFINE(__VDSO_TIMEZONE, offsetof(struct vdso_data, tz_minuteswest));
/* constants used by the vdso */
DEFINE(CLOCK_REALTIME, CLOCK_REALTIME);
DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC);
DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);

return 0;
}
31 changes: 31 additions & 0 deletions trunk/arch/s390/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <asm/delay.h>
#include <asm/s390_ext.h>
#include <asm/div64.h>
#include <asm/vdso.h>
#include <asm/irq.h>
#include <asm/irq_regs.h>
#include <asm/timer.h>
Expand Down Expand Up @@ -223,6 +224,36 @@ static struct clocksource clocksource_tod = {
};


void update_vsyscall(struct timespec *wall_time, struct clocksource *clock)
{
if (clock != &clocksource_tod)
return;

/* Make userspace gettimeofday spin until we're done. */
++vdso_data->tb_update_count;
smp_wmb();
vdso_data->xtime_tod_stamp = clock->cycle_last;
vdso_data->xtime_clock_sec = xtime.tv_sec;
vdso_data->xtime_clock_nsec = xtime.tv_nsec;
vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec;
vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec;
smp_wmb();
++vdso_data->tb_update_count;
}

extern struct timezone sys_tz;

void update_vsyscall_tz(void)
{
/* Make userspace gettimeofday spin until we're done. */
++vdso_data->tb_update_count;
smp_wmb();
vdso_data->tz_minuteswest = sys_tz.tz_minuteswest;
vdso_data->tz_dsttime = sys_tz.tz_dsttime;
smp_wmb();
++vdso_data->tb_update_count;
}

/*
* Initialize the TOD clock and the CPU timer of
* the boot cpu.
Expand Down
Loading

0 comments on commit 7ca570e

Please sign in to comment.