1. 28 Apr, 2012 5 commits
  2. 26 Apr, 2012 8 commits
  3. 25 Apr, 2012 7 commits
  4. 24 Apr, 2012 1 commit
  5. 23 Apr, 2012 7 commits
  6. 19 Apr, 2012 4 commits
  7. 18 Apr, 2012 8 commits
    • Pavel Emelyanov's avatar
      dump: Init mmap's file pos · fd85b194
      Pavel Emelyanov authored
      It's unused, but makes show command show 0, not trash.
      Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
      fd85b194
    • Cyrill Gorcunov's avatar
      syscalls: Complete redesign v9 · 2ea781a9
      Cyrill Gorcunov authored
      At early days we've been using only a few syscalls
      which together with debug compiler options always
      produce relative addresses for memory variables used
      in parasite and restorer blobs. Thus it came in unnoticed
      that there is something worng with syscalls declarations
      we use.
      
      Basically all our syscalls are just a wrappers over inline
      assembly code in form of
      
      static long syscall2(int nr, long arg0, long arg1)
      {
      	long ret;
      	asm volatile(
      		"movl %1, %%eax		\t\n"
      		"movq %2, %%rdi		\t\n"
      		"movq %3, %%rsi		\t\n"
      		"syscall		\t\n"
      		"movq %%rax, %0		\t\n"
      		: "=r"(ret)
      		: "g" ((int)nr), "g" (arg0), "g" (arg1)
      		: "rax", "rdi", "rsi", "memory");
      	return ret;
      }
      
      so every argument treated to be plain long (even if the call
      sematics implies it's a memory address passed but not some
      integer direct value) and transferred via general purpose
      register.
      
      As being mentioned it caused no problems when debug options
      specified at compile time, the compiler do not tries to optimize
      addressing but generates code which always compute them.
      
      The situation is changed if one is building crtools with
      optimization enabled -- the compiler finds that arguments
      are rather plain long numbers and might pass direct addresses
      of variables, instead of generating relative addresses
      (because function declarations have no pointers and 'g' in cope
       with 'mov' is used, which is of course wrong).
      
      To fix all this -- now syscalls declarations are generated from
      syscall.def file and function arguments are passed in conform
      with x86-64 ABI.
      
      This shrinks amount of source code needed to declare syscalls
      and opens a way to use optimization.
      Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
      2ea781a9
    • Cyrill Gorcunov's avatar
      parasite: Move bootstrap code into parasite-head-x86-64.S · 88f7ae01
      Cyrill Gorcunov authored
      Inline assembly is very convenient if a couple of
      instructions is used but when it grows better to
      move it out of wrapper C code and write in plain
      assembly, after all we need a very precise control
      in bootstrap code.
      Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
      88f7ae01
    • Cyrill Gorcunov's avatar
      make: Add own Makefile.pie for binary blobs we generate · 5fe6f90b
      Cyrill Gorcunov authored
      Since the blob files are generated a different way
      in compare with plain compiling we use for regular
      *.c files -- add own Makefile.pie for this target.
      
      This increases readability of general Makefile
      and Makefile.pie itself.
      Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
      5fe6f90b
    • Cyrill Gorcunov's avatar
      make: Generate offsets from linked files only · 4a2a2901
      Cyrill Gorcunov authored
      Instead of generating offsets from early compiled
      object files (one day the offsets obtained from
      there might be changed during linkage stage) better
      to get them from a final stage where all object
      files involved are linked into complete binary blob.
      
      That happened that at early stage we indeed were using
      only single file per parasite and restorer but at present
      there a couple of file involved (and will be more in
      future) so we need a safe approach.
      
      Also note the symbols being exported are prefixed as
      "__export_". This is easier approach for now. Putting
      such symbols into separate section requires a way
      more efforts to handle.
      
      The main reason of having two files (Elf object
      and binary blob) is to get 1:1 mapping between
      symbols definition and their position in binary
      target.
      
      The exported symbols name addresses are obtained
      from object file and used as offsets in binary
      target.
      Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
      4a2a2901
    • Cyrill Gorcunov's avatar
      make: Sanitize pie.lds.S · 662bfd5f
      Cyrill Gorcunov authored
      Build one "section for all" only. This reflects
      what we really do runtime with generated parasite
      and restorer blobs.
      
      Signle section is named as ".crblob".
      Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
      662bfd5f
    • Pavel Emelyanov's avatar
      files: Simplify fd-s restore · e2f745b9
      Pavel Emelyanov authored
      Don't re-read fdinfo image 4 times on restore, just use those collected
      on me pstree_entry instance.
      Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
      e2f745b9
    • Pavel Emelyanov's avatar
      files: Collect fdinfo-s on per-pstree_item list · a72d8586
      Pavel Emelyanov authored
      Later we'll be able to restore them without re-reading the fdinfo file again.
      Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
      a72d8586