RISC OS Open
A fast and easily customised operating system for ARM devices
ROOL
Home | News | Downloads | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account
Forums → Bugs →

Unaligned STM in FileCore30

Subscribe to Unaligned STM in FileCore30 7 posts, 2 voices

 
Oct 21, 2015 6:56pm
Avatar Jon Abbott (1421) 2172 posts

And the programmer even kindly commented its reliance on unaligned STM’s working.

I’ve just seen a FileCore Abort caused by an STM in FileCore30 at line 1402 that fails on ARMv7, due to its reliance on STM ignoring bits 0 and 1 of Rd.

EDIT: A possible fix is to change:

ADR     R0, ConvDiscErr+NewDiscErrorBit
STMIA   R0, {R2, R4, LR}
Pull    "R2-R4"

to

ADR     R0, ConvDiscErr+NewDiscErrorBit
BIC     R3, R0, #3
STMIA   R3, {R2, R4, LR}
Pull    "R2-R4"
 
Oct 21, 2015 11:28pm
Avatar Jon Abbott (1421) 2172 posts

And there’s another reliance on unaligned LDM behaviour in adfs20 at line 312

Possibly fix via changing:

ASSERT  NewDiscErrorBit < bit2
LDMIA   R0, {R1,R2,R3}

to

ASSERT  NewDiscErrorBit < bit2
BIC     R3, R0, #3
LDMIA   R3, {R1,R2,R3}
 
Oct 24, 2015 1:46am
Avatar Jon Abbott (1421) 2172 posts

I should have stated that these issues are caused by the new style sector error returned by FileCore_DiscOp

This issue could also potentially affect any software that doesn’t clear bits 0/1 of the error pointer returned, either due to it not expecting a new style error or as in RISCOS, relies on an unaligned LDM to work.

Are there any plans to implement unaligned STM/LDM in the RISCOS Abort handler?

 
Oct 27, 2015 10:54pm
Avatar Sprow (202) 951 posts

I’ve just seen a FileCore Abort caused by an STM in FileCore30 at line 1402 that fails on ARMv7, due to its reliance on STM ignoring bits 0 and 1 of Rd.

Out of interest, what filing system were you using at the time? The code path you’ve highlighted only applies when the FS doesn’t support the new style error scheme.

A possible fix is

I think the cunning ADR and STM with no writeback is to ensure we exit the function with a new style disc error pointer in R0. So we need to keep bit 0 set overall. An aligned ADR/STM/ORR looks like it’d achieve that.

 
Oct 28, 2015 1:35am
Avatar Jon Abbott (1421) 2172 posts

Out of interest, what filing system were you using at the time?

ADFS – legacy software accessing floppies, checking for disc protection.

An aligned ADR/STM/ORR looks like it’d achieve that.

It would indeed.

 
Oct 28, 2015 6:26pm
Avatar Sprow (202) 951 posts
Out of interest, what filing system were you using at the time? The code path you’ve highlighted only applies when the FS doesn’t support the new style error scheme.

ADFS – legacy software accessing floppies, checking for disc protection.

Now I’m even more baffled, since ADFS registers with FileCore_Create with the NewErrorBit set in its flags word. Plus, the only platforms supporting floppies are the Iyonix (ARMv5) and Risc PC/A7k/A7k+ (ARMv3 or 4) none of which would trigger the unaligned fault.

Or have I missed something obvious?

 
Oct 28, 2015 6:33pm
Avatar Jon Abbott (1421) 2172 posts

The software raising the floppy request is 26bit running under ADFFS and expects old style errors. ADFS doesn’t come with the Pi build as you’ve noted, so a shim ADFS Module is loaded by ADFFS to match the expected behaviour of RO3.1

Reply

To post replies, please first log in.

Forums → Bugs →

Search forums

Social

Follow us on and

ROOL Store

Buy RISC OS Open merchandise here, including SD cards for Raspberry Pi and more.

Donate! Why?

Help ROOL make things happen – please consider donating!

RISC OS IPR

RISC OS is an Open Source operating system owned by RISC OS Developments Ltd and licensed primarily under the Apache 2.0 license.

Description

Bug discussions that aren’t covered by the bugs database.

Voices

  • Jon Abbott (1421)
  • Sprow (202)

Options

  • Forums
  • Login
Site design © RISC OS Open Limited 2018 except where indicated
The RISC OS Open Beast theme is based on Beast's default layout

Valid XHTML 1.0  |  Valid CSS

Powered by Beast © 2006 Josh Goebel and Rick Olson
This site runs on Rails

Hosted by Arachsys