Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.acorn.programmer > #1822
| From | druck <news@druck.org.uk> |
|---|---|
| Newsgroups | comp.sys.acorn.programmer |
| Subject | Re: Alignment exception examples |
| Date | 2012-06-24 11:35 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <js6qi6$71i$1@dont-email.me> (permalink) |
| References | <js5701$ium$1@dont-email.me> <cb1d41a1-9593-4bdd-81be-3837bf4da461@googlegroups.com> |
On 23/06/2012 21:21, chrisbazley@bigfoot.com wrote: > I don't believe it is possible to detect misaligned data accesses > using static analysis It is not possible to spot ALL misaligned access, but it is possible to spot some. > because you can't know what addresses in > registers are - only constant shifts, rotations and offsets. ARMalyser can already work out what some register contents are from immediate values, loads from absolute or PC relative addresses, and subsequent arithmetic instructions and and write backs. Use the -r option to see. > I > suppose that you could flag instructions such as LDR a1,[v1,v2,LSL#1] > as 'likely' to be unaligned data accesses, but it is equally possible > that the values of v2 are constrained such that odd values never > occur. It can certainly any word load/store where the address is altered by a non multiple of 4, even where the actual address isn't known. > I think your best bet would be to look at the code generated by the > Norcroft C compiler for 'short int' types, because it was used to > compile most RISC OS applications and is presumably responsible for > the majority of unaligned data accesses. The above should spot such code. > > The general pattern is the following code, which loads a signed > integer halfword regardless of whether Rn is word-aligned or > half-word-aligned, provided that<offset> is a multiple of 2: > > LDR<cond> Rd,[Rn,#<offset>] MOV<cond> Rd,Rd,LSL #16 MOV<cond> > Rd,Rd,ASR #16 > > Someone clever could probably use the AppPatcher mechanism to > substitute: > > LDR<cond>SH Rd,[Rn,#<offset>] MOV R0,R0 MOV R0,R0 That's beyond the scope of ARMalyser, although it was written to be the first set in automatic 32bit porting with a dynamic component like Aemulor to come later, but Aemulor got there first. > That would break compatibility with older ARM architectures, but if > the patching were done at run time, that wouldn't matter, right? Correct > Of course, for programs such as Star Fighter 3000 which use runtime > code generation, static analysis would be useless. Yes, but the days of the ARM2 are long gone, dynamic code became impractical when the separate caches of the Strong ARM come in. > I still think recompiling all RISC OS software is a futile cause, > despite having grudgingly invested several weekends in Schema 2 and > its peripheral applications so that someone can carry on using the > same spreadsheet application they've been using for about a quarter > of a century. Its the best way unless you want each later generation of ARM processor to run existing software slower and more buggierly than the last. Especially when native hardware is up against emulators on x86 which can run the oldest software perfectly at vastly faster speeds. ---druck
Back to comp.sys.acorn.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Alignment exception examples druck <news@druck.org.uk> - 2012-06-23 20:55 +0100
Re: Alignment exception examples chrisbazley@bigfoot.com - 2012-06-23 13:21 -0700
Re: Alignment exception examples druck <news@druck.org.uk> - 2012-06-24 11:35 +0100
Re: Alignment exception examples chrisbazley@bigfoot.com - 2012-06-24 04:02 -0700
Re: Alignment exception examples druck <news@druck.freeuk.com> - 2012-06-24 17:29 +0100
Re: Alignment exception examples Theo Markettos <theom+news@chiark.greenend.org.uk> - 2012-06-26 00:02 +0100
Re: Alignment exception examples chrisbazley@bigfoot.com - 2012-06-26 01:15 -0700
Re: Alignment exception examples Theo Markettos <theom+news@chiark.greenend.org.uk> - 2012-06-26 11:51 +0100
Re: Alignment exception examples chrisbazley@bigfoot.com - 2012-06-27 05:40 -0700
Re: Alignment exception examples druck <news@druck.org.uk> - 2012-06-27 22:43 +0100
Re: Alignment exception examples Martin Bazley <martin.bazley@blueyonder.co.uk> - 2012-06-26 14:06 +0100
Re: Alignment exception examples druck <news@druck.org.uk> - 2012-06-26 21:57 +0100
Re: Alignment exception examples Martin Bazley <martin.bazley@blueyonder.co.uk> - 2012-06-26 23:20 +0100
Re: Alignment exception examples druck <news@druck.org.uk> - 2012-06-27 22:51 +0100
Re: Alignment exception examples chrisbazley@bigfoot.com - 2012-06-26 15:17 -0700
Re: Alignment exception examples Theo Markettos <theom+news@chiark.greenend.org.uk> - 2012-06-27 00:23 +0100
Re: Alignment exception examples chrisbazley@bigfoot.com - 2012-06-27 05:52 -0700
Re: Alignment exception examples druck <news@druck.org.uk> - 2012-06-27 22:46 +0100
Re: Alignment exception examples Nick Roberts <tigger@orpheusinternet.co.uk> - 2012-06-28 18:28 +0100
Re: Alignment exception examples Theo Markettos <theom+news@chiark.greenend.org.uk> - 2012-06-29 18:38 +0100
Re: Alignment exception examples Nick Roberts <tigger@orpheusinternet.co.uk> - 2012-06-29 20:14 +0100
Re: Alignment exception examples druck <news@druck.freeuk.com> - 2012-07-04 20:50 +0100
Re: Alignment exception examples spampling <spam.pling@btinternet.com> - 2012-06-27 07:58 +0100
Re: Alignment exception examples chrisbazley@bigfoot.com - 2012-06-27 05:44 -0700
Re: Alignment exception examples spampling <spam.pling@btinternet.com> - 2012-06-27 18:13 +0100
Re: Alignment exception examples druck <news@druck.org.uk> - 2012-06-27 22:47 +0100
Re: Alignment exception examples druck <news@druck.org.uk> - 2012-06-27 23:04 +0100
Re: Alignment exception examples chrisbazley@bigfoot.com - 2012-06-28 15:43 -0700
Re: Alignment exception examples Thomas Milius <Thomas-Milius@t-online.de> - 2012-06-24 08:24 +0200
Re: Alignment exception examples druck <news@druck.org.uk> - 2012-06-24 11:37 +0100
Re: Alignment exception examples Thomas Milius <Thomas-Milius@t-online.de> - 2012-06-24 12:49 +0200
Re: Alignment exception examples druck <news@druck.freeuk.com> - 2012-06-24 17:01 +0100
Re: Alignment exception examples Thomas Milius <Thomas-Milius@t-online.de> - 2012-06-24 19:16 +0100
Re: Alignment exception examples "Ste (news)" <steve@revi11.plus.com> - 2012-07-10 00:14 +0100
Re: Alignment exception examples Steve Fryatt <news@stevefryatt.org.uk> - 2012-06-24 09:42 +0100
Re: Alignment exception examples Martin <News03@avisoft.f9.co.uk> - 2012-06-27 15:36 +0100
csiph-web