Commit 27267655 authored by Stafford Horne's avatar Stafford Horne
Browse files

openrisc: Support floating point user api



Add support for handling floating point exceptions and forwarding the
SIGFPE signal to processes.  Also, add fpu state to sigcontext.

Signed-off-by: default avatarStafford Horne <shorne@gmail.com>
parent 63d7f9f1
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -53,8 +53,7 @@ typedef unsigned long elf_greg_t;
#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
typedef elf_greg_t elf_gregset_t[ELF_NGREG];

/* A placeholder; OR32 does not have fp support yes, so no fp regs for now.  */
typedef unsigned long elf_fpregset_t;
typedef struct __or1k_fpu_state elf_fpregset_t;

/* EM_OPENRISC is defined in linux/elf-em.h */
#define EM_OR32         0x8472
+4 −0
Original line number Diff line number Diff line
@@ -30,6 +30,10 @@ struct user_regs_struct {
	unsigned long pc;
	unsigned long sr;
};

struct __or1k_fpu_state {
	unsigned long fpcsr;
};
#endif


+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@

struct sigcontext {
	struct user_regs_struct regs;  /* needs to be first */
	struct __or1k_fpu_state fpu;
	unsigned long oldmask;
};

+9 −2
Original line number Diff line number Diff line
@@ -848,9 +848,16 @@ _syscall_badsys:

/******* END SYSCALL HANDLING *******/

/* ---[ 0xd00: Trap exception ]------------------------------------------ */
/* ---[ 0xd00: Floating Point exception ]-------------------------------- */

UNHANDLED_EXCEPTION(_vector_0xd00,0xd00)
EXCEPTION_ENTRY(_fpe_trap_handler)
	CLEAR_LWA_FLAG(r3)
	/* r4: EA of fault (set by EXCEPTION_HANDLE) */
	l.jal   do_fpe_trap
	 l.addi  r3,r1,0 /* pt_regs */

	l.j     _ret_from_exception
	 l.nop

/* ---[ 0xe00: Trap exception ]------------------------------------------ */

+2 −2
Original line number Diff line number Diff line
@@ -424,9 +424,9 @@ _dispatch_do_ipage_fault:
    .org 0xc00
	EXCEPTION_HANDLE(_sys_call_handler)

/* ---[ 0xd00: Trap exception ]------------------------------------------ */
/* ---[ 0xd00: Floating point exception ]--------------------------------- */
    .org 0xd00
	UNHANDLED_EXCEPTION(_vector_0xd00)
	EXCEPTION_HANDLE(_fpe_trap_handler)

/* ---[ 0xe00: Trap exception ]------------------------------------------ */
    .org 0xe00
Loading