[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: gcl and reverse dependencies on arm



On Wed, Jan 27, 2010 at 04:56:22PM -0500, Camm Maguire wrote:
> Greetings!  OK I think we've found it.
> 
> A long time ago, some very helpful arm developer told me how to clear
> the instruction and data caches.  GCL needs to do this as it loads
> compiled code into its .data section, relocates it, clears the cache,
> and then executes.  
 
> Here is the arm bit:
> 
> #define CLEAR_CACHE do {\
>   void *v=memory->cfd.cfd_start,*ve=v+memory->cfd.cfd_size; \
>   register unsigned long _beg __asm ("a1") = (unsigned long)(v);	\
>   register unsigned long _end __asm ("a2") = (unsigned long)(ve);\
>   register unsigned long _flg __asm ("a3") = 0;			\
>   __asm __volatile ("swi 0x9f0002		@ sys_cacheflush"	\
> 		    : "=r" (_beg)				\
> 		    : "0" (_beg), "r" (_end), "r"(_flg));	\
> } while (0)

swi 0x9f0002 is a old way to call syscalls. in EABI things were changed.
Some buildd's still have old-abi compat enabled in kernel, which is why
the code works on them.

But we now have a gcc built-in that does the right thing on both old and
new abi:

  __clear_cache (beg, end);
 
> 
> Since this time, many architectures use more portable alternatives
> like mprotect.  In any case, the above seems to be fine on agricola:
> 
> =============================================================================
> Processor	: XScale-80219 rev 0 (v5l)
> BogoMIPS	: 593.10
> Features	: swp half thumb fastmult edsp 
> CPU implementer	: 0x69
> CPU architecture: 5TE
> CPU variant	: 0x0
> CPU part	: 0x2e3
> CPU revision	: 0
> Cache type	: undefined 5
> Cache clean	: undefined 5
> Cache lockdown	: undefined 5
> Cache format	: Harvard
> I size		: 32768
> I assoc		: 32
> I line length	: 32
> I sets		: 32
> D size		: 32768
> D assoc		: 32
> D line length	: 32
> D sets		: 32
> 
> Hardware	: Thecus N2100
> Revision	: 0000
> Serial		: 0000000000000000
> =============================================================================
> and muscat
> =============================================================================
> Processor	: XScale-80219 rev 0 (v5l)
> BogoMIPS	: 593.10
> Features	: swp half thumb fastmult edsp 
> CPU implementer	: 0x69
> CPU architecture: 5TE
> CPU variant	: 0x0
> CPU part	: 0x2e3
> CPU revision	: 0
> 
> Hardware	: Thecus N2100
> Revision	: 0000
> Serial		: 0000000000000000
> =============================================================================
> but not your machine:
> =============================================================================
> Processor	: Feroceon rev 0 (v5l)
> BogoMIPS	: 999.42
> Features	: swp half thumb fastmult vfp edsp 
> CPU implementer	: 0x41
> CPU architecture: 5TE
> CPU variant	: 0x1
> CPU part	: 0x926
> CPU revision	: 0
> 
> Hardware	: Marvell DB-78x00-BP Development Board
> Revision	: 0000
> Serial		: 0000000000000000
> =============================================================================
> 
> Oddly, it works for many addresses, but faults on some.  This is even
> with the /proc/cpu/alignment flag being 0 ("ignored").
> 
> Suggestions?
> 
> Thanks again!
> 
> Riku Voipio <riku.voipio@iki.fi> writes:
> 
> > Greetings and sorry for the delay,
> >
> > ssh -p 2224 camm@kos.to
> > sudo /usr/sbin/chroot /home/camm/chroot su - camm
> >
> > gcl, maxima and acl and extracted there already and have
> > ther build-deps installed.
> >
> > On Mon, Jan 25, 2010 at 10:52:30AM -0500, Camm Maguire wrote:
> >> Greetings!  This might be a duplicate -- if so, my apologies!
> >> 
> >> Thanks again!
> >> 
> >> Riku Voipio <riku.voipio@iki.fi> writes:
> >> 
> >> > On Sat, Jan 23, 2010 at 11:36:30AM -0500, Camm Maguire wrote:
> >> >> Thank you so much.  I'll wait to here from you then.  The issues of
> >> >> importance are segafaults on object code loading, e.g.
> >> >
> >> > Ok. I can reproduce the issues on experimental buildd. Please send me
> >> > a ssh key in a pgp signed mail with your preferred account name and I'll
> >> > create a account for you.
> >> >
> >> > Riku
> >> >
> >> >
> >> >
> >> >
> >> 
> >> -- 
> >> Camm Maguire			     		    camm@maguirefamily.org
> >> ==========================================================================
> >> "The earth is but one country, and mankind its citizens."  --  Baha'u'llah
> >
> >> -----BEGIN PGP SIGNED MESSAGE-----
> >> Hash: SHA1
> >> 
> >> Username: camm
> >> 
> >> ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAtseLLbrS7utxoresgHYJtfUCLckotAcc6SfOqjg1MVrV77GNSuNfR+6iX7ahLDnbNtGzauDJM+8/H0hx2dM0+UMy92betwF+2TYjHfSucsoWhb2kSNUwIFiq714NdSa1vdcEEV/jLQ2v4fDCMew9X2NnzAxovCTSEcRCmMEenaU= camm@wisdom
> >> -----BEGIN PGP SIGNATURE-----
> >> Version: GnuPG v1.4.10 (GNU/Linux)
> >> 
> >> iEYEARECAAYFAktdvdgACgkQczG1wFfwRdwtRgCeOKbBmnQrvdVQsbGGUXjMNtmY
> >> FIAAoLh5uXAEFQGB5N1EKxJFmoYZsXR4
> >> =nDYr
> >> -----END PGP SIGNATURE-----
> >
> >
> >
> >
> >
> 
> -- 
> Camm Maguire			     		    camm@maguirefamily.org
> ==========================================================================
> "The earth is but one country, and mankind its citizens."  --  Baha'u'llah


Reply to: