Let’s see a trivial example: int foo(int a) Whenever a branch is taken, unconditionally or not, the next instruction is always executed. Exposing micro-architecture details like this should be considered bad taste. It is a very unique design aspect of the architecture, which is considered a design flaw today because it was hard-coded to help a very specific micro-architecture. Branch delay slotsĪ very important part of MIPS is the use of a branch delay slot. Normal opcodes like arithmetic and load/store are ignored since they cannot affect control flow. In this analysis we only care about these “special” instructions. The end of a basic block occurs where we see some kind of branch instruction (except for call instructions!). Basic blockīasic blocks are represented as a starting PC and an end, where the execution flow is linear. See part 2 for more detail on what basic blocks do in LLVM. We do this by mapping out all the basic blocks. So, given a PC to execute, we’ll do some analysis where we map out all execution paths from that PC. A real emulator will have to deal with it, but self-modifying code should be rarer and rarer the more modern hardware we’re dealing with. ![]() Most likely the code for our function in particular did not change, so we can likely reuse the code blocks we generated.įor our purpose, we will not deal with self-modifying code here. Any i-cache invalidations will clear out the relevant function pointers which triggers hashing in some form. I think the solution for that is to keep a JIT block cache which translates a hash to function pointer and do some analysis of code blocks we don’t have a function pointer for yet. This is a fairly ugly topic to deal with since our previously compiled function might become invalid if the underlying code changes. Self-modifying code?Īn immediate question is self-modifying code. If we need to call a PC we have not seen before, we will need to recompile a new LLVM module, starting at that PC, and then we can execute it. We can choose a hash map (large address space) or flat array (small address space) here. The top level code fundamentally needs to be able to translate the program counter (short-hand, PC) to an executable function pointer. Strap your seatbelts, we’re going to MIPS and x86 assembly land. Q: I get ‘Recompile block too large’ error! Upon loading a game in ePSXe, you receive the following error: Make sure the file format of your game is BIN or ISO.In part 1 and part 2 we laid the groundwork to start recompiling MIPS code to LLVM IR. ![]() You’ll need to set all the plug-ins up again. Right-click it and click Delete, as shown here. I recommend Documents, Downloads, or create a folder on your desktop. IMPORTANT! ePSXe must be placed in a common folder on your computer. Not sure how to extract zip files? Here’s a video tutorial showing you how: how to unzip files on Windows. Installation is simple: just extract ePSXe from its zip file. These are often used to contain compressed versions of video game disc images. Like ISO, ECM hold other information in an archive format, usually to store files like BIN, CDI, NRG, etc. Here’s a visual example of how they look like (the icons will look differently): ePSXe ONLY supports ISO files that are in *.iso or *.bin format. Once the ISO is extracted, now take notice of the file format of the ISO.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |