Fork us on GitHub Follow us on Facebook Follow us on Twitter

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#93 closed defect (fixed)

Exception stack frame should not be constructed by a C function on arm32

Reported by: Jakub Jermář Owned by: Vineeth Pillai
Priority: major Milestone: 0.4.1
Component: helenos/kernel/arm32 Version: mainline
Keywords: arm32 Cc:
Blocker for: Depends on:
See also:

Description

The idea of setting the kernel stack and saving registers to it from a C function, which can have a compiler generated prologue, does not look as a good idea:

inline static void setup_stack_and_save_regs()
{
        asm volatile (
                "ldr r13, =exc_stack\n"
                "stmfd r13!, {r0}\n"
                "mrs r0, spsr\n"
                "and r0, r0, #0x1f\n"
                "cmp r0, #0x10\n"
                "bne 1f\n"

It looks like that we have been lucky so far.

The following functionality of exception.c needs to be moved to a proper .S file and gotten rid of the C wrapper or called from a proper ABI environment:

setup_stack_and_save_regs()
load_regs()
switch_to_irq_servicing_mode()
CALL_EXC_DISPATCH()
PROCESS_EXCEPTION()
reset_exception_entry()
swi_exception_entry()
undef_instr_exception_entry()
fiq_exception_entry()
prefetch_abort_exception_entry()
data_abort_exception_entry()
irq_exception_entry()
swi_exception()
irq_exception()

Change History (4)

comment:1 Changed 10 years ago by Vineeth Pillai

Status: newaccepted

comment:2 Changed 10 years ago by Vineeth Pillai

The fix for this is committed to the arm branch(revision 4666).

A new file exc_handler.S is added which contains the assembly implementation of the the exception handlers.

comment:3 Changed 10 years ago by Jakub Jermář

Resolution: fixed
Status: acceptedclosed

Fixed in revision 4666 and merged into trunk in revision 4669.

comment:4 Changed 10 years ago by Jakub Jermář

Milestone: 0.5.00.4.1
Note: See TracTickets for help on using tickets.