1/* 2 * Access to the shared data page by the vDSO & syscall map 3 * 4 * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), IBM Corp. 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 9 * 2 of the License, or (at your option) any later version. 10 */ 11 12#include <asm/processor.h> 13#include <asm/ppc_asm.h> 14#include <asm/asm-offsets.h> 15#include <asm/unistd.h> 16#include <asm/vdso.h> 17 18 .text 19.global __kernel_datapage_offset; 20__kernel_datapage_offset: 21 .long 0 22 23V_FUNCTION_BEGIN(__get_datapage) 24 .cfi_startproc 25 /* We don't want that exposed or overridable as we want other objects 26 * to be able to bl directly to here 27 */ 28 .protected __get_datapage 29 .hidden __get_datapage 30 31 mflr r0 32 .cfi_register lr,r0 33 34 bcl 20,31,data_page_branch 35data_page_branch: 36 mflr r3 37 mtlr r0 38 addi r3, r3, __kernel_datapage_offset-data_page_branch 39 lwz r0,0(r3) 40 add r3,r0,r3 41 blr 42 .cfi_endproc 43V_FUNCTION_END(__get_datapage) 44 45/* 46 * void *__kernel_get_syscall_map(unsigned int *syscall_count) ; 47 * 48 * returns a pointer to the syscall map. the map is agnostic to the 49 * size of "long", unlike kernel bitops, it stores bits from top to 50 * bottom so that memory actually contains a linear bitmap 51 * check for syscall N by testing bit (0x80000000 >> (N & 0x1f)) of 52 * 32 bits int at N >> 5. 53 */ 54V_FUNCTION_BEGIN(__kernel_get_syscall_map) 55 .cfi_startproc 56 mflr r12 57 .cfi_register lr,r12 58 mr r4,r3 59 bl V_LOCAL_FUNC(__get_datapage) 60 mtlr r12 61 addi r3,r3,CFG_SYSCALL_MAP64 62 cmpli cr0,r4,0 63 crclr cr0*4+so 64 beqlr 65 li r0,__NR_syscalls 66 stw r0,0(r4) 67 blr 68 .cfi_endproc 69V_FUNCTION_END(__kernel_get_syscall_map) 70 71 72/* 73 * void unsigned long __kernel_get_tbfreq(void); 74 * 75 * returns the timebase frequency in HZ 76 */ 77V_FUNCTION_BEGIN(__kernel_get_tbfreq) 78 .cfi_startproc 79 mflr r12 80 .cfi_register lr,r12 81 bl V_LOCAL_FUNC(__get_datapage) 82 ld r3,CFG_TB_TICKS_PER_SEC(r3) 83 mtlr r12 84 crclr cr0*4+so 85 blr 86 .cfi_endproc 87V_FUNCTION_END(__kernel_get_tbfreq) 88