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

Re: [Xen-devel] [PATCH ARM v6 14/14] mini-os: arm: show registers, stack and exception vector on fault



On 28 July 2014 12:13, Ian Campbell <Ian.Campbell@xxxxxxxxxx> wrote:
> On Wed, 2014-07-16 at 12:07 +0100, Thomas Leonard wrote:
>> +@ We want to store a unique value to identify this handler, without 
>> corrupting
>> +@ any of the registers. So, we store r15 (which will point just after the 
>> branch).
>> +@ Later, we subtract 12 so the user gets pointed at the start of the 
>> exception
>> +@ handler.
>
> You do corrupt r13 though.

r13 is banked for all faults except SVC. Possibly for SVC we should do
something different (though you'll always lose r14 anyway if SVC code
makes an SVC call for some reason).

> The way many OSes handle this is to make at least the initial saving
> (i.e. that which you have at fault:) into a macro and inlining a copy at
> each entry point. They also arrange for each SP_$mode to always point to
> something useful (in your case fault_dump, I guess) to avoid using a
> register as the save target.

You mean dumping the registers to the SVC stack in the SVC fault
handler? That might cause another fault if the stack is full, but I
may be misunderstanding you.

> BTW you can infer the same information as you do all this -12 stuff for
> from the saved CPSR.

You mean by looking at the processor mode? There are two exceptions
that both go to Abort mode though. I haven't checked to see whether
the information could be recovered some other way; substracting 12
seemed pretty easy.


-- 
Dr Thomas Leonard        http://0install.net/
GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1
GPG: DA98 25AE CAD0 8975 7CDA  BD8E 0713 3F96 CA74 D8BA

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.