[gem5-dev] Change in gem5/gem5[master]: configs: Add --redirects for syscall emulation

2019-11-27 Thread Giacomo Travaglini (Gerrit)
Giacomo Travaglini has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/23065 )


Change subject: configs: Add --redirects for syscall emulation
..

configs: Add --redirects for syscall emulation

This is the first step towards being able to run dynamically linked
applications when the guest ISA != than host ISA.

(Like running a arm application on x86)

By using the --redirects command line option it is possible to specify
via CLI a set of path redirections to be used in SE mode.

This is needed when running a dynamically linked binary in
SE mode in a guest ISA different than the host. The linker will look
for SOs (e.g. libc.so) in /lib/, but will only find the host libraries.
With this option we can redirect to the guest toolchain/file system.

Usage:

gem5.opt [example script]
--redirects /dir1=/path/to/host/dir1 \
--redirects /dir2=/path/to/host/dir2

Change-Id: I558838be2ad6802891707e9a1cc454786859db15
Signed-off-by: Giacomo Travaglini 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23065
Reviewed-by: Jason Lowe-Power 
Maintainer: Jason Lowe-Power 
Tested-by: kokoro 
---
M configs/common/FileSystemConfig.py
M configs/common/Options.py
2 files changed, 28 insertions(+), 1 deletion(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/configs/common/FileSystemConfig.py  
b/configs/common/FileSystemConfig.py

index 1f32ec1..76ea5ff 100644
--- a/configs/common/FileSystemConfig.py
+++ b/configs/common/FileSystemConfig.py
@@ -1,3 +1,15 @@
+# Copyright (c) 2019 ARM Limited
+# All rights reserved.
+#
+# The license below extends only to copyright in the software and shall
+# not be construed as granting a license to any other intellectual
+# property including but not limited to intellectual property relating
+# to a hardware implementation of the functionality of the software
+# licensed hereunder.  You may use the software subject to the license
+# terms below provided that you ensure that this notice is replicated
+# unmodified and in its entirety in all distributions of the software,
+# modified or unmodified, in source code or in binary form.
+#
 # Copyright (c) 2015 Advanced Micro Devices, Inc.
 # All rights reserved
 #
@@ -206,6 +218,14 @@
   RedirectPath(app_path = "/tmp",
   host_paths = ["%s/fs/tmp"  % m5.options.outdir])]

+# Setting the redirect paths so that the guest dynamic linker
+# can point to the proper /lib collection (e.g. to load libc)
+redirects = getattr(options, 'redirects', [])
+for redirect in redirects:
+app_path, host_path = redirect.split("=")
+redirect_paths.append(
+RedirectPath(app_path = app_path, host_paths = [ host_path ]))
+
 chroot = getattr(options, 'chroot', None)
 if chroot:
 redirect_paths.append(
diff --git a/configs/common/Options.py b/configs/common/Options.py
index 71f9f14..855c006 100644
--- a/configs/common/Options.py
+++ b/configs/common/Options.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2013 ARM Limited
+# Copyright (c) 2013-2019 ARM Limited
 # All rights reserved.
 #
 # The license below extends only to copyright in the software and shall
@@ -381,6 +381,13 @@
"for information or functionality. Instead  
of "\
"finding files on the __HOST__ filesystem,  
the "   \
"process will find the user's replacment  
files.")

+parser.add_option("--redirects", action="append", type="string",
+  default=[],
+  help="A collection of one or more redirect paths "
+   "to be used in syscall emulation."
+   "Usage: gem5.opt [...] --redirects /dir1=/path/"
+   "to/host/dir1 --redirects  
/dir2=/path/to/host/dir2")

+


 def addFSOptions(parser):

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/23065
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I558838be2ad6802891707e9a1cc454786859db15
Gerrit-Change-Number: 23065
Gerrit-PatchSet: 4
Gerrit-Owner: Giacomo Travaglini 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Brandon Potter 
Gerrit-Reviewer: Ciro Santilli 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[master]: configs: Add --redirects for syscall emulation

2019-11-26 Thread Giacomo Travaglini (Gerrit)
Giacomo Travaglini has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/23065 )



Change subject: configs: Add --redirects for syscall emulation
..

configs: Add --redirects for syscall emulation

This is the first step towards being able to run dynamically linked
applications when the guest ISA != than host ISA.

(Like running a arm application on x86)

By using the --redirects command line option it is possible to specify
via CLI a set of path redirections to be used in SE mode.

This is needed when running a dynamically linked binary in
SE mode in a guest ISA different than the host. The linker will look
for SOs (e.g. libc.so) in /lib/, but will only find the host libraries.
With this option we can redirect to the guest toolchain/file system.

Usage:

gem5.opt [example script]
--redirects /dir1=/path/to/host/dir1 \
--redirects /dir2=/path/to/host/dir2

Change-Id: I558838be2ad6802891707e9a1cc454786859db15
Signed-off-by: Giacomo Travaglini 
---
M configs/common/FileSystemConfig.py
M configs/common/Options.py
2 files changed, 28 insertions(+), 1 deletion(-)



diff --git a/configs/common/FileSystemConfig.py  
b/configs/common/FileSystemConfig.py

index 1f32ec1..6f0dee3 100644
--- a/configs/common/FileSystemConfig.py
+++ b/configs/common/FileSystemConfig.py
@@ -1,3 +1,15 @@
+# Copyright (c) 2019 ARM Limited
+# All rights reserved.
+#
+# The license below extends only to copyright in the software and shall
+# not be construed as granting a license to any other intellectual
+# property including but not limited to intellectual property relating
+# to a hardware implementation of the functionality of the software
+# licensed hereunder.  You may use the software subject to the license
+# terms below provided that you ensure that this notice is replicated
+# unmodified and in its entirety in all distributions of the software,
+# modified or unmodified, in source code or in binary form.
+#
 # Copyright (c) 2015 Advanced Micro Devices, Inc.
 # All rights reserved
 #
@@ -206,6 +218,14 @@
   RedirectPath(app_path = "/tmp",
   host_paths = ["%s/fs/tmp"  % m5.options.outdir])]

+# Setting the reidirect paths so that the guest dynamic linker
+# can point to the proper /lib collection (e.g. to load libc)
+redirects = getattr(options, 'redirects', [])
+for redirect in redirects:
+app_path, host_path = redirect.split("=")
+redirect_paths.append(
+RedirectPath(app_path = app_path, host_paths = [ host_path ]))
+
 chroot = getattr(options, 'chroot', None)
 if chroot:
 redirect_paths.append(
diff --git a/configs/common/Options.py b/configs/common/Options.py
index 71f9f14..8c06ea5 100644
--- a/configs/common/Options.py
+++ b/configs/common/Options.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2013 ARM Limited
+# Copyright (c) 2013-2019 ARM Limited
 # All rights reserved.
 #
 # The license below extends only to copyright in the software and shall
@@ -381,6 +381,13 @@
"for information or functionality. Instead  
of "\
"finding files on the __HOST__ filesystem,  
the "   \
"process will find the user's replacment  
files.")

+parser.add_option("--redirects", action="append", type="string",
+  default=None,
+  help="A collection of one or more redirect paths "
+   "to be used in syscall emulation."
+   "Usage: gem5.opt [...] --redirects /dir1=/path/"
+   "to/host/dir1 --redirects  
/dir2=/path/to/host/dir2")

+


 def addFSOptions(parser):

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/23065
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I558838be2ad6802891707e9a1cc454786859db15
Gerrit-Change-Number: 23065
Gerrit-PatchSet: 1
Gerrit-Owner: Giacomo Travaglini 
Gerrit-MessageType: newchange
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev