Cyrill Gorcunov
11eb2ca409
Add ALIGN helper
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-16 18:16:12 +04:00
Cyrill Gorcunov
85506595e9
restorer: Drop futex constants
...
We don't use them yet, no need to carry.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 23:05:36 +04:00
Cyrill Gorcunov
b712182308
Gather file names formats in one place
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 18:35:55 +04:00
Cyrill Gorcunov
0fd17a08cb
Bring some order in usage of VMA entries helpers
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 17:12:29 +04:00
Cyrill Gorcunov
bb15450d98
image: Drop tls_array from the image
...
We use registers set anyway
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 14:57:39 +04:00
Cyrill Gorcunov
35781a8c6d
util: Drop redundant vma_area->vma.status assignment
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 13:37:17 +04:00
Cyrill Gorcunov
33ea81e606
Drop redundant pstree_item_info
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 13:19:12 +04:00
Cyrill Gorcunov
4619e48574
dump: parasite -- Drop unneeded error codes
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 12:22:40 +04:00
Cyrill Gorcunov
f89f67914e
dump: parasite -- Drop unneeded sections
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 12:21:17 +04:00
Cyrill Gorcunov
72d3d2326a
dump: Drop parasite_complete_ip from parasite_ctl
...
It was used for debug only to be able to work without
task seizing. Not needed anymore.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 12:15:08 +04:00
Cyrill Gorcunov
417fe5d8e1
image: Drop redundant VMA_FORCE_WRITE
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 11:57:24 +04:00
Cyrill Gorcunov
2c0e5db7eb
image: Drop redundant offsetof
...
Already in compiler.h
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-15 11:54:01 +04:00
Cyrill Gorcunov
5ae9d9feb8
cleanup: parasite - Drop PARASITE_CMD_RESTORECORE
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-14 18:50:20 +04:00
Cyrill Gorcunov
6a26e75aba
cleanup: Drop elf references
...
We dont use Elf restore anymore, drop it.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-13 13:07:00 +04:00
Cyrill Gorcunov
e793eb7557
cleanup: Drop unneeded sources
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-13 13:00:32 +04:00
Cyrill Gorcunov
1e7bbd35de
restore: Add threads restoration
...
Now threads restortion (and TLS as well) works.
Threads test reports the following
2775 (main): Counter value: 3 tls_data = 1
2775 (main): ( 0) fsgs_base 7f9597aa46f0
2775 (main): ( 0) fsgs_base 0
2775 (thr3): Counter value: 4 tls_data = 4
2775 (thr3): ( 0) fsgs_base 42c57940
2775 (thr3): ( 0) fsgs_base 0
2775 (thr2): Counter value: 3 tls_data = 2
2775 (thr2): ( 0) fsgs_base 42456940
2775 (thr2): ( 0) fsgs_base 0
2775 (thr1): Counter value: 4 tls_data = 3
2775 (thr1): ( 0) fsgs_base 40c62940
2775 (thr1): ( 0) fsgs_base 0
2775 (main): Counter value: 4 tls_data = 1
2775 (main): ( 0) fsgs_base 7f9597aa46f0
2775 (main): ( 0) fsgs_base 0
2775 (thr1): Counter value: 5 tls_data = 3
2775 (thr1): ( 0) fsgs_base 40c62940
2775 (thr1): ( 0) fsgs_base 0
as expected.
This commits merges all preliminary commits into
the final one (sigreturn branch was always experimental
and forced update).
Still some problems remain:
1) While creating threads with clone() the
flags are to be revisited. We use some predefined
set here but it's not really correct.
2) No setup of pids in PCB thread zone.
3) No restore of FPU.
But at least on some basic tasks restore works well.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-12 19:26:40 +04:00
Cyrill Gorcunov
0a26593a3b
dump, restore: Add blocked signals mask
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-09 00:29:41 +04:00
Cyrill Gorcunov
566a900e4e
restore: Use prctl for vDSO restoration
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-08 17:53:47 +04:00
Cyrill Gorcunov
76df6d9ed5
syscalls: Add sys_prctl helper
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-08 16:39:21 +04:00
Cyrill Gorcunov
da8f61c1c8
dump: Add GS-TLS handling
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-07 17:44:00 +04:00
Cyrill Gorcunov
8a8850d146
dump: Dump TLS via sys_arch_prctl
...
As such -- no need for kernel patch.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-07 16:29:36 +04:00
Cyrill Gorcunov
3725fd326d
syscalls: Add sys_arch_prctl helper
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-07 15:24:07 +04:00
Cyrill Gorcunov
d6e7afe3d8
syscalls: Add sys_set/get_thread_area helpers
...
They are actually banned in kernel for now, but
we might end up needing them, so better to have
them in-place.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-07 14:47:04 +04:00
Cyrill Gorcunov
bf30aa1130
restore: Drop unused struct partial_pt_regs
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-03 19:31:07 +04:00
Cyrill Gorcunov
489745f235
restore: A number of fixups and debug printing
...
An idea is to align restorer size to be sure it
wont be stripped in a middle of code.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-03 11:58:45 +04:00
Cyrill Gorcunov
ed3c4fbacf
syscalls: Get rid of mnemonic names for registers
...
Use explicit registers name instead just to be sure it
wont cause side effects on most gcc versions.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-11-03 11:55:29 +04:00
Cyrill Gorcunov
bf41dcac48
syscalls: Get rid of register variables
...
It's been found that gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
ignores register variables so to be on a safe side rewrite
syscalls with inline assembly without them.
nb: gcc version 4.6.1 20110908 (Red Hat 4.6.1-9) (GCC)
compiles them correctly.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-31 16:33:43 +04:00
Cyrill Gorcunov
b99eae2809
restore: Add some more structures for frame setup
...
Some of them are already in system header files
but until I debug all things I simply picked up
kernel's definitions just to be more-less safe.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-29 01:13:32 +04:00
Cyrill Gorcunov
a74f379d60
syscall: Add sys_unlink
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-28 14:03:59 +04:00
Cyrill Gorcunov
98cf8f1a0f
syscall: Add getpid syscall
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-28 00:40:20 +04:00
Cyrill Gorcunov
aaf3291e00
restore: Dump current VMAs
...
Restorer needs to know which VMAs
to unmap before map a new set.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-26 22:50:46 +04:00
Cyrill Gorcunov
2cc7488de2
dump: Make VMA parsing to handle absence of map_files
...
Needed in testing purposes. Also make free_mappings
being a global one (will need it in restorer).
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-26 22:48:10 +04:00
Cyrill Gorcunov
fa56125d16
util: Move memcopy helper into the header
...
Since we will need it in parasite and restorer
code rename it to inline_memcpy to avoid name
collision.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-26 18:05:32 +04:00
Cyrill Gorcunov
168d8cf17d
restore: restorer is finally alive
...
No real restore code yet, but at least it
produce message ;)
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-26 17:35:50 +04:00
Cyrill Gorcunov
791f2c8c25
restore: Call for indirect execution
...
Doesn't work at moment but just to have
a snapshot point.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-26 11:16:00 +04:00
Cyrill Gorcunov
b016db7dea
syscall: Add sys_exit
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-26 10:58:10 +04:00
Cyrill Gorcunov
0d20dd0b41
util: Add hex_dump helper
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-26 10:10:19 +04:00
Cyrill Gorcunov
ae41bc9d2a
restore: Add restore_core_args facility
...
More convenient instead of manual offset calculations.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-26 00:30:41 +04:00
Cyrill Gorcunov
f8c46a5de1
restore: Add rt_sigframe
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-25 19:27:56 +04:00
Cyrill Gorcunov
c32845ef60
dump: Shrink struct core_entry twice
...
No need to keep it that big. Note from
this patch if we ever deside to use kernel
elf approach -- the image structures are
to be updated in kernel as well.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-25 14:59:35 +04:00
Cyrill Gorcunov
57b45ea5eb
restore: Preliminary scheme for restore
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-24 23:56:36 +04:00
Cyrill Gorcunov
63e08215aa
restore: Add restorer test
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-24 22:23:06 +04:00
Cyrill Gorcunov
0fe80627d6
syscall: Use always_inline instead of __always_inline
...
__always_inline is internal defenition
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-24 22:18:13 +04:00
Cyrill Gorcunov
79c67231a1
syscall: The should be always inlined
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-24 22:16:14 +04:00
Cyrill Gorcunov
5fd13e04ab
syscall: Add __NR_rt_sigreturn
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-24 17:17:39 +04:00
Cyrill Gorcunov
ea0f8eac1d
util: Add open_fmt_ro helper
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-24 13:56:03 +04:00
Cyrill Gorcunov
f8ad351f4d
util: Make open_fmt being more general
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-24 13:51:41 +04:00
Cyrill Gorcunov
26857cc4e5
util: Move various helpers there
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-24 13:43:21 +04:00
Cyrill Gorcunov
af647ce009
dump: Dump threads params as well
...
We only need registers at the moment
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-23 12:43:52 +04:00
Cyrill Gorcunov
611debc312
dump: Add parsing of thread pids
...
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-10-23 12:43:15 +04:00