Skip to content
Snippets Groups Projects
  1. Nov 02, 2022
  2. Oct 26, 2022
  3. Oct 25, 2022
    • Helge Deller's avatar
      linux-user: Add guest memory layout to exception dump · bd5ccd61
      Helge Deller authored
      
      When the emulation stops with a hard exception it's very useful for
      debugging purposes to dump the current guest memory layout (for an
      example see /proc/self/maps) beside the CPU registers.
      
      The open_self_maps() function provides such a memory dump, but since
      it's located in the syscall.c file, various changes (add #includes, make
      this function externally visible, ...) are needed to be able to call it
      from the existing EXCP_DUMP() macro.
      
      This patch takes another approach by re-defining EXCP_DUMP() to call
      target_exception_dump(), which is in syscall.c, consolidates the log
      print functions and allows to add the call to dump the memory layout.
      
      Beside a reduced code footprint, this approach keeps the changes across
      the various callers minimal, and keeps EXCP_DUMP() highlighted as
      important macro/function.
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Message-Id: <Y1bzAWbw07WBKPxw@p100>
      [lv: remove pc declaration and setting]
      Signed-off-by: default avatarLaurent Vivier <laurent@vivier.eu>
      bd5ccd61
  4. Oct 21, 2022
  5. Oct 17, 2022
    • WANG Xuerui's avatar
      linux-user: Fix struct statfs ABI on loongarch64 · 7bf36a5c
      WANG Xuerui authored
      
      Previously the 32-bit version was incorrectly chosen, leading to funny
      but incorrect output from e.g. df(1). Simply select the version
      corresponding to the 64-bit asm-generic definition.
      
      For reference, this program should produce the same output no matter
      natively compiled or not, for loongarch64 or not:
      
      ```c
      #include <stdio.h>
      #include <sys/statfs.h>
      
      int main(int argc, const char *argv[])
      {
        struct statfs b;
        if (statfs(argv[0], &b))
          return 1;
      
        printf("f_type = 0x%lx\n", b.f_type);
        printf("f_bsize = %ld\n", b.f_bsize);
        printf("f_blocks = %ld\n", b.f_blocks);
        printf("f_bfree = %ld\n", b.f_bfree);
        printf("f_bavail = %ld\n", b.f_bavail);
      
        return 0;
      }
      
      // Example output on my amd64 box, with the test binary residing on a
      // btrfs partition.
      
      // Native and emulated output after the fix:
      //
      // f_type = 0x9123683e
      // f_bsize = 4096
      // f_blocks = 268435456
      // f_bfree = 168406890
      // f_bavail = 168355058
      
      // Output before the fix, note the messed layout:
      //
      // f_type = 0x10009123683e
      // f_bsize = 723302085239504896
      // f_blocks = 168355058
      // f_bfree = 2250817541779750912
      // f_bavail = 1099229433104
      ```
      
      Fixes: 1f630196 ("linux-user: Add LoongArch syscall support")
      Signed-off-by: default avatarWANG Xuerui <xen0n@gentoo.org>
      Cc: Song Gao <gaosong@loongson.cn>
      Cc: Xiaojuan Yang <yangxiaojuan@loongson.cn>
      Cc: Andreas K. Hüttel <dilfridge@gentoo.org>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Tested-by: default avatarAndreas K. Huettel <dilfridge@gentoo.org>
      Message-Id: <20221006100710.427252-1-xen0n@gentoo.org>
      Signed-off-by: default avatarSong Gao <gaosong@loongson.cn>
      7bf36a5c
  6. Oct 11, 2022
  7. Oct 06, 2022
  8. Oct 04, 2022
  9. Sep 28, 2022
  10. Sep 27, 2022
Loading