cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

datapage.S (1473B)


      1/* SPDX-License-Identifier: GPL-2.0-or-later */
      2/*
      3 * Access to the shared data page by the vDSO & syscall map
      4 *
      5 * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), IBM Corp.
      6 */
      7
      8#include <asm/processor.h>
      9#include <asm/ppc_asm.h>
     10#include <asm/asm-offsets.h>
     11#include <asm/unistd.h>
     12#include <asm/vdso.h>
     13#include <asm/vdso_datapage.h>
     14
     15	.text
     16
     17/*
     18 * void *__kernel_get_syscall_map(unsigned int *syscall_count) ;
     19 *
     20 * returns a pointer to the syscall map. the map is agnostic to the
     21 * size of "long", unlike kernel bitops, it stores bits from top to
     22 * bottom so that memory actually contains a linear bitmap
     23 * check for syscall N by testing bit (0x80000000 >> (N & 0x1f)) of
     24 * 32 bits int at N >> 5.
     25 */
     26V_FUNCTION_BEGIN(__kernel_get_syscall_map)
     27  .cfi_startproc
     28	mflr	r12
     29  .cfi_register lr,r12
     30	mr.	r4,r3
     31	get_datapage	r3
     32	mtlr	r12
     33#ifdef __powerpc64__
     34	addi	r3,r3,CFG_SYSCALL_MAP64
     35#else
     36	addi	r3,r3,CFG_SYSCALL_MAP32
     37#endif
     38	crclr	cr0*4+so
     39	beqlr
     40	li	r0,NR_syscalls
     41	stw	r0,0(r4)
     42	blr
     43  .cfi_endproc
     44V_FUNCTION_END(__kernel_get_syscall_map)
     45
     46/*
     47 * void unsigned long long  __kernel_get_tbfreq(void);
     48 *
     49 * returns the timebase frequency in HZ
     50 */
     51V_FUNCTION_BEGIN(__kernel_get_tbfreq)
     52  .cfi_startproc
     53	mflr	r12
     54  .cfi_register lr,r12
     55	get_datapage	r3
     56#ifndef __powerpc64__
     57	lwz	r4,(CFG_TB_TICKS_PER_SEC + 4)(r3)
     58#endif
     59	PPC_LL	r3,CFG_TB_TICKS_PER_SEC(r3)
     60	mtlr	r12
     61	crclr	cr0*4+so
     62	blr
     63  .cfi_endproc
     64V_FUNCTION_END(__kernel_get_tbfreq)