Hi folks. Right now, when you want to run a particular binary in SE mode, you assign it to the "workload" parameter of a CPU. When gem5 goes to load it, it passes it around to different loaders and sees which one knows how to load it. Then it passes it around a second time to see which process type it should be, ie 64 bit x86, 32 bit ARM, etc.
binary -> {binary format loader} -> ObjectFile -> {arch and op sys process loader} -> Process I'm working on introducing a Workload type which encapsulates SE mode, and which will have a type for each type of operating system being emulated. So for instance, if you want your system to pretend to run x86 linux, you would construct a object of type EmuX86Linux and set the system's workload parameter to it. Then you would tell that object what you wanted to load and how you wanted it to run (CPU assignments, etc.) The minor mismatch here is that many scripts, for instance configs/example/se.py, don't care what type of binary you've given it, what operating system it's for, or what the architecture is. They just pass it through, and let gem5 figure out what it can/should do with it. To address this, I'm planning to expose the ObjectFile class to python, and to add two methods to the SEWorkload SimObject type, find_compatible and init_compatible. Both methods will take a path to a binary. find_compatible will then return a list of all SEWorkload subclasses which claim to be able to run that binary. This will usually, but not necessarily, be one or zero classes. The init_compatible method calls find_compatible expecting exactly one result, and then instantiates an instance of that type using the rest of its arguments. So, if you want to run binary foo.bin, you would set your system's workload parameter like this: System(workload = SEWorkload.init_compatible("foo.bin", val1, param2=val2, etc...)) If you know which fake operating system you want and want to take advantage of non-generic features it might have, then you can just instantiate it directly like normal. System(workload = EmuArmFreeBSD(val1, freebsd_param2=val2, etc...)) An SEWorkload can claim compatibility with a binary by implementing an _is_compatible_with class method which accepts an object file as a parameter. For x86 linux that might look like this: @classmethod def _is_compatible_with(cls, obj): return obj.get_arch() in ('x86_64', 'i386') and obj.get_op_sys() == 'linux'
_______________________________________________ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s