blob: 3b2dd7d0c1ebf88453cc80b8b7ae658216a20d2e [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 <linux/config.h>
13#include <asm/processor.h>
14#include <asm/ppc_asm.h>
Sam Ravnborg0013a852005-09-09 20:57:26 +020015#include <asm/asm-offsets.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <asm/unistd.h>
17#include <asm/vdso.h>
18
19 .text
20V_FUNCTION_BEGIN(__get_datapage)
21 .cfi_startproc
22 /* We don't want that exposed or overridable as we want other objects
23 * to be able to bl directly to here
24 */
25 .protected __get_datapage
26 .hidden __get_datapage
27
28 mflr r0
29 .cfi_register lr,r0
30
31 bcl 20,31,1f
32 .global __kernel_datapage_offset;
33__kernel_datapage_offset:
34 .long 0
351:
36 mflr r3
37 mtlr r0
38 lwz r0,0(r3)
39 add r3,r0,r3
40 blr
41 .cfi_endproc
42V_FUNCTION_END(__get_datapage)
43
44/*
45 * void *__kernel_get_syscall_map(unsigned int *syscall_count) ;
46 *
47 * returns a pointer to the syscall map. the map is agnostic to the
48 * size of "long", unlike kernel bitops, it stores bits from top to
49 * bottom so that memory actually contains a linear bitmap
50 * check for syscall N by testing bit (0x80000000 >> (N & 0x1f)) of
51 * 32 bits int at N >> 5.
52 */
53V_FUNCTION_BEGIN(__kernel_get_syscall_map)
54 .cfi_startproc
55 mflr r12
56 .cfi_register lr,r12
Linus Torvalds1da177e2005-04-16 15:20:36 -070057 mr r4,r3
58 bl V_LOCAL_FUNC(__get_datapage)
59 mtlr r12
60 addi r3,r3,CFG_SYSCALL_MAP64
61 cmpli cr0,r4,0
Benjamin Herrenschmidt5d66da32005-11-16 13:54:32 +110062 crclr cr0*4+so
Linus Torvalds1da177e2005-04-16 15:20:36 -070063 beqlr
64 li r0,__NR_syscalls
65 stw r0,0(r4)
66 blr
67 .cfi_endproc
68V_FUNCTION_END(__kernel_get_syscall_map)
Benjamin Herrenschmidta7f290d2005-11-11 21:15:21 +110069
70
71/*
72 * void unsigned long __kernel_get_tbfreq(void);
73 *
74 * returns the timebase frequency in HZ
75 */
76V_FUNCTION_BEGIN(__kernel_get_tbfreq)
77 .cfi_startproc
78 mflr r12
79 .cfi_register lr,r12
80 bl V_LOCAL_FUNC(__get_datapage)
81 ld r3,CFG_TB_TICKS_PER_SEC(r3)
82 mtlr r12
Benjamin Herrenschmidt5d66da32005-11-16 13:54:32 +110083 crclr cr0*4+so
Benjamin Herrenschmidt0c37ec22005-11-14 14:55:58 +110084 blr
Benjamin Herrenschmidta7f290d2005-11-11 21:15:21 +110085 .cfi_endproc
86V_FUNCTION_END(__kernel_get_tbfreq)