Raspberry Pi alignment exceptions
Pages: 1 2
Andrew Conroy (370) 740 posts |
Ok, there’s a quick version as a Configure plug-in up here It defaults to not allowing alignment exceptions. Can someone try it out and let me know if it works as expected. Also, am I using the right terminology? I’ve not really followed the discussions that closely due to taking a self-enforced break from participating in the forums to avoid possible claims of ‘conflict of interest’ due to work planning on selling RPi stuff. Should add – it goes in !Boot.RO5Hook.Res.Configure |
Wouter Rademaker (458) 197 posts |
I have tried it on a Pandaboard, it worked as expected. I think it needs a less cryptic name, some tweaking of the texts and the help-texts. A name like “processor features”? Is it “allow rotated loads” or “emulate rotated loads”? The help texts should say which processor version is emulated: |
Chris Hall (132) 3554 posts |
I don’t think the ‘emulate rorated loads’ works on ARMv7 – I think it is an ‘ARMv6 only’ feature? In fact would there be a simple piece of code that tests for ARMv6 behaviour that could be used to produce an error on any non-Raspberry Pi machines? That way software could be built specisally for ‘Pi-only’ which might help with some concerns from authors about wider distribution? |
Andrew Conroy (370) 740 posts |
It’s a Raspberry Pi configure plug-in, so testing it on a PandaBoard isn’t really very helpful. I’m more concerned about checking it’s doing what people want it to do before I change the cosmetics around it. I agree it needs some better help text etc., and Processor features sounds good for a title, thanks. |
Jess Hampshire (158) 865 posts |
I just tried it on my pi. I got parmesan running, phoenix, oregano and firefox (though the latter complained about a sprite and gave no icon on the bar.) Certainly looks like when sound and screen work fully, most Iyonix software ought to run. |
Andrew Conroy (370) 740 posts |
Right, I’ve tweaked it a bit, given it a new icon and new name, so it can now be downloaded from here Anyone who downloaded the earlier version the other day will need to remove that and the AlignSetup Obey file in PreDesk before putting this into !Boot.RO500Hook.Res.Configure I’m away for a few days or so now, but I’d appreciate it if someone could check that it works as expected and how people want. I’ll fix any problems etc. when I’m back. |
chris davey (1534) 5 posts |
Andrew One issue in PROCwrite_config_file is writing the apps name as !AlExSetup rather that !CPUSetup |
Andrew Conroy (370) 740 posts |
Oops, uploaded the wrong version, sorry! Try again now! |
Theo Markettos (89) 919 posts |
Just given it a try. Firefox does indeed do what it did previously with and without alignment exceptions. Question: do we actually ever want rotated loads to be disabled when alignment exceptions are off? CP15 c1 register bit 22 = 1, bit 1 = 0? That’s the ARMv7 behaviour when alignment exceptions are off, but it’s potentially confusing to allow that since it won’t obviously show up problems until programs get confused/start corrupting data. Subject to the above, do you want to have the wording emphasise the outcome, not the mechanics? For example
On BeagleBoard, grey out the ARMv5 option. Maybe on RPi grey out the ARMv7 lax option? Perhaps also have a ‘Help’ button that pops up a window explaining what this is all about. Sample text: Older programs written for processors such as the ARM2/3/610/710, StrongARM and XScale (up to ARM version 5) may not run directly on ARM version 7 processors due to a changed behaviour of ‘unaligned loads’. ARMv7 processors can either give errors when they find these, to aid with converting old programs, or run with the new behaviour (specially-written new software can run faster, old software may crash). ARMv6 processors can do either, or emulate ARMv5 behaviour to run old software. Old software will need conversion to run on ARMv7 I know there’s Interactive Help, but it really needs an obvious in-your-face explanation. Perhaps also you could put an icon at the top that says ‘your machine is ARM architecture version X’ (is there a way to read the arch number from the CPU?) to avoid confusion! Also, you haven’t put an licensing information in it! Could I suggest you release it under the BSD licence? [Point of my confusion: what happens on ARMv7 with old programs? Alignment exceptions on – programs fall over, does anything fix them up? Exceptions off – programs try to run but crash if they get confused?] |
Jeffrey Lee (213) 6048 posts |
Since rotated loads are supported by the hardware, it’s not exactly emulating them, is it? To me, emulation implies that there’s some software layer involved.
Yes, although it’s not as straightforward as it used to be. Previously you only had to read the main ID register, but ARMv7 CPUs and some ARMv6 CPUs (like the ARM1176JZF-S in the Pi) both have an architecture of ‘&F’. The only (or easiest) way I’ve found to work out which is which is to check the cache type register, which on ARMv7 will have the top bit set.
At the moment there’s nothing in place to fix up unaligned loads/stores. |
Theo Markettos (89) 919 posts |
Maybe, though ‘emulate’ rather implies the feature is fragile (ie it goes away in the next CPU version). And hardware emulation has a long and venerable tradition (even in RISC OS land – need I mention the Omega?) I found the way Linux works out the ARM arch. |
Theo Markettos (89) 919 posts |
Hi Andrew, Just been looking at your code. I don’t know specifically what you mean by the command line flags (no documentation ;-) and config file settings, but they’re potentially confusing:
allowR is confusing because it specifically doesn’t enable alignment exceptions on ARMv6, but does on ARMv7. The rotated loads flag overrides the exception flag according to the ARM documentation, but you have it the other way around. That’s not a problem as such, but to avoid confusion I’d suggest -allowR does’t enable exceptions. That makes no difference on ARMv6, but on ARMv7 the behaviour is more like what you’d expect. Or you could just document what the flags actually do in each case :) Ah, just noticed that’s reflected in the GUI too – when rotated loads are on, we don’t care about alignment exceptions, while the GUI is the other way around. Might I suggest some radio buttons instead (ARMv5, ARMv7 strict, ARMv7 lax) with appropriate greying, as I outlined above? |
Theo Markettos (89) 919 posts |
Argh, I think I’m talking rubbish above. ARM’s documentation is even more confusing. They say (A=bit 1, U=bit 22, of CP15 register C1)
I think that makes more sense. Ah, I’ve figured out why. Andrew’s code has procedures to ‘allow align exceptions’ which turn alignment exceptions off. That’s not allowing them, that’s disabling them! |
Andrew Conroy (370) 740 posts |
Yes, I got myself into complete pickle with the syntax. I’ll come back to it and try to sort things out shortly. |
Theo Markettos (89) 919 posts |
Quick question if anyone’s listening… what mode does a virgin BeagleBoard boot up in – alignment exceptions on or off? |
Ben Avison (25) 445 posts |
Before or after RISC OS boots? After RISC OS boots, exceptions are on; not sure about before. |
Theo Markettos (89) 919 posts |
Updated version of Andrew’s configure plugin (temporary location, it’ll eventually be a standard configure plugin). There are three modes as I outlined above (renamed ‘ARMv7 lax’ to ‘ARMv7 fast’ to make it a bit more appealing). Currently it doesn’t know what sort of processor you have, so you can set rotated loads on a BeagleBoard which won’t do anything. |
Martin Avison (27) 1494 posts |
Is this updated version by Theo the latest version of CpuSetup ? |
Steve Pampling (1551) 8170 posts |
On a beagleboard the settings template doesn’t seem quite right – the OK button is virtually out of the visible window to the bottom and right. NB. Incorporation of cpu speed control would be nice. |
Chris Johnson (125) 825 posts |
There is, of course, my CPUClock app which works on BB and PB. There is a configure tool version as well as the normal app. |
Andrew Conroy (370) 740 posts |
I sent Theo an updated Templates file which should have fixed this. I thought the updated one was now part of the distribution version. |
Steve Pampling (1551) 8170 posts |
Not in the version in the link Theo gave. I work on the basis that is the reason for pointing us at these things: checks by multiple people that everything is as it should be. Quick check, quick fix. No point in labelling anything as beta if people don’t check things. |
Steve Pampling (1551) 8170 posts |
I was thinking that CPU speed could logically sit in the same configuration window as the mode. |
Andrew Conroy (370) 740 posts |
Ah, ok. I think it’s now incorporated into the version distributed with the Pi, however. |
Pages: 1 2