| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <asm/processor.h> | 
|  | 13 | #include <asm/ppc_asm.h> | 
| Sam Ravnborg | 0013a85 | 2005-09-09 20:57:26 +0200 | [diff] [blame] | 14 | #include <asm/asm-offsets.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #include <asm/unistd.h> | 
|  | 16 | #include <asm/vdso.h> | 
|  | 17 |  | 
|  | 18 | .text | 
|  | 19 | V_FUNCTION_BEGIN(__get_datapage) | 
|  | 20 | .cfi_startproc | 
|  | 21 | /* We don't want that exposed or overridable as we want other objects | 
|  | 22 | * to be able to bl directly to here | 
|  | 23 | */ | 
|  | 24 | .protected __get_datapage | 
|  | 25 | .hidden __get_datapage | 
|  | 26 |  | 
|  | 27 | mflr	r0 | 
|  | 28 | .cfi_register lr,r0 | 
|  | 29 |  | 
|  | 30 | bcl	20,31,1f | 
|  | 31 | .global	__kernel_datapage_offset; | 
|  | 32 | __kernel_datapage_offset: | 
|  | 33 | .long	0 | 
|  | 34 | 1: | 
|  | 35 | mflr	r3 | 
|  | 36 | mtlr	r0 | 
|  | 37 | lwz	r0,0(r3) | 
|  | 38 | add	r3,r0,r3 | 
|  | 39 | blr | 
|  | 40 | .cfi_endproc | 
|  | 41 | V_FUNCTION_END(__get_datapage) | 
|  | 42 |  | 
|  | 43 | /* | 
|  | 44 | * void *__kernel_get_syscall_map(unsigned int *syscall_count) ; | 
|  | 45 | * | 
|  | 46 | * returns a pointer to the syscall map. the map is agnostic to the | 
|  | 47 | * size of "long", unlike kernel bitops, it stores bits from top to | 
|  | 48 | * bottom so that memory actually contains a linear bitmap | 
|  | 49 | * check for syscall N by testing bit (0x80000000 >> (N & 0x1f)) of | 
|  | 50 | * 32 bits int at N >> 5. | 
|  | 51 | */ | 
|  | 52 | V_FUNCTION_BEGIN(__kernel_get_syscall_map) | 
|  | 53 | .cfi_startproc | 
|  | 54 | mflr	r12 | 
|  | 55 | .cfi_register lr,r12 | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | mr	r4,r3 | 
|  | 57 | bl	__get_datapage@local | 
|  | 58 | mtlr	r12 | 
|  | 59 | addi	r3,r3,CFG_SYSCALL_MAP32 | 
|  | 60 | cmpli	cr0,r4,0 | 
|  | 61 | beqlr | 
|  | 62 | li	r0,__NR_syscalls | 
|  | 63 | stw	r0,0(r4) | 
| Benjamin Herrenschmidt | 5d66da3 | 2005-11-16 13:54:32 +1100 | [diff] [blame] | 64 | crclr	cr0*4+so | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | blr | 
|  | 66 | .cfi_endproc | 
|  | 67 | V_FUNCTION_END(__kernel_get_syscall_map) | 
| Benjamin Herrenschmidt | a7f290d | 2005-11-11 21:15:21 +1100 | [diff] [blame] | 68 |  | 
|  | 69 | /* | 
|  | 70 | * void unsigned long long  __kernel_get_tbfreq(void); | 
|  | 71 | * | 
|  | 72 | * returns the timebase frequency in HZ | 
|  | 73 | */ | 
|  | 74 | V_FUNCTION_BEGIN(__kernel_get_tbfreq) | 
|  | 75 | .cfi_startproc | 
|  | 76 | mflr	r12 | 
|  | 77 | .cfi_register lr,r12 | 
|  | 78 | bl	__get_datapage@local | 
| Benjamin Herrenschmidt | a7f290d | 2005-11-11 21:15:21 +1100 | [diff] [blame] | 79 | lwz	r4,(CFG_TB_TICKS_PER_SEC + 4)(r3) | 
| Benjamin Herrenschmidt | 0c37ec2 | 2005-11-14 14:55:58 +1100 | [diff] [blame] | 80 | lwz	r3,CFG_TB_TICKS_PER_SEC(r3) | 
| Benjamin Herrenschmidt | a7f290d | 2005-11-11 21:15:21 +1100 | [diff] [blame] | 81 | mtlr	r12 | 
| Benjamin Herrenschmidt | 5d66da3 | 2005-11-16 13:54:32 +1100 | [diff] [blame] | 82 | crclr	cr0*4+so | 
| Benjamin Herrenschmidt | 0c37ec2 | 2005-11-14 14:55:58 +1100 | [diff] [blame] | 83 | blr | 
| Benjamin Herrenschmidt | a7f290d | 2005-11-11 21:15:21 +1100 | [diff] [blame] | 84 | .cfi_endproc | 
|  | 85 | V_FUNCTION_END(__kernel_get_tbfreq) |