Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: tests/test_patching_input.S

Issue 8605003: Add logic for patching calls to the x86-64 vsyscall page (Closed) Base URL: https://seccompsandbox.googlecode.com/svn/trunk
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/test_patching.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <asm/unistd.h> 5 #include <asm/unistd.h>
6 6
7 7
8 // This performs a system call directly so that we can test 8 // This performs a system call directly so that we can test
9 // patching this instruction sequence. 9 // patching this instruction sequence.
10 10
11 .global my_getpid 11 .global my_getpid
12 .global my_getpid_end 12 .global my_getpid_end
13 my_getpid: 13 my_getpid:
14 mov $__NR_getpid, %eax 14 mov $__NR_getpid, %eax
15 #if defined(__x86_64__) 15 #if defined(__x86_64__)
16 syscall 16 syscall
17 #elif defined(__i386__) 17 #elif defined(__i386__)
18 int $0x80 18 int $0x80
19 #else 19 #else
20 # error Unsupported target platform 20 # error Unsupported target platform
21 #endif 21 #endif
22 ret 22 ret
23 my_getpid_end: 23 my_getpid_end:
24 24
25
26 // These routines call the vsyscall page, which is present on
27 // x86-64 only.
28
29 #if defined(__x86_64__)
30
31 .global my_vgettimeofday
32 .global my_vgettimeofday_end
33 my_vgettimeofday:
34 sub $8, %rsp // Align the stack
35 mov $0xffffffffff600000, %rax
36 call *%rax
37 add $8, %rsp
38 ret
39 my_vgettimeofday_end:
40
41 .global my_vtime
42 .global my_vtime_end
43 my_vtime:
44 sub $8, %rsp // Align the stack
45 mov $0xffffffffff600400, %rax
46 call *%rax
47 add $8, %rsp
48 ret
49 my_vtime_end:
50
51 .global my_vgetcpu
52 .global my_vgetcpu_end
53 my_vgetcpu:
54 sub $8, %rsp // Align the stack
55 mov $0xffffffffff600800, %rax
56 call *%rax
57 add $8, %rsp
58 ret
59 my_vgetcpu_end:
60
61 #endif
62
25 // Tell Linux not to disable no-execute protection for the process. 63 // Tell Linux not to disable no-execute protection for the process.
26 .section .note.GNU-stack,"",@progbits 64 .section .note.GNU-stack,"",@progbits
OLDNEW
« no previous file with comments | « tests/test_patching.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698