New OS_PlatformFeatures 0 flags
Pages: 1 2
Jon Abbott (1421) 2641 posts |
Now you’ve opened a can of worms…should OS_PlatformFeatures only return physical features or merge in virtual ones. You could add a Service call, which OS_PlatformFeatures passes round Modules before returning the result, allowing them to set the relevant bits? |
Jeffrey Lee (213) 6048 posts |
If we wanted to support instruction emulation then we’d want to have two calls for reading features – one for the physical features and one for the virtual ones. An emulated instruction is going to be at least 10x slower than the native version (just count the number of instructions needed enter the undef handler and detect/decode the instruction), probably more like 50x or 100x by the time you take into account the other overheads involved (CPU state switching, passing through other undefined instruction handlers, and the fact you’ll be using a long instruction sequence to emulate the instruction instead of a single native instruction). There may also be other limitations in the emulated instruction that might not be clear (e.g. if you’re emulating hardware divide, it’s probably a bad idea to have some code which tries to use UDIV/SDIV from abort mode) This new OS_PlatformFeatures reason code is mainly aimed at code which wants to perform micro-optimisations – swapping out different routines at runtime while keeping the rest of the binary the same, or selecting more optimal code sequences within code generators. What it doesn’t do is try and solve the problem of programs which want to select different binaries – e.g. selecting between an ARMv7 or ‘generic’ version of the main executable. To solve that we probably want something like a “*CheckArchitecture” command which can accept GCC/Norcroft-style architecture identifiers. So the !Run file for a program which has an optional ARMv7 optimised binary would be something like “If CheckArchitecture armv7 Then Run <Obey$Dir>.!RunImage7 Else Run <Obey$Dir>.!RunImage”. If we had such a command, that might be a reasonable place to insert support for emulated instructions (although we might still want to fall back to an earlier architecture binary if one was available – only use a binary which relies on emulation if there’s no native binary available) |
Pages: 1 2