[BACK]Return to ieee_handler.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / arch / pc532 / fpu

File: [cvs.NetBSD.org] / src / sys / arch / pc532 / fpu / Attic / ieee_handler.h (download)

Revision 1.4, Wed Sep 2 19:17:12 1998 UTC (22 years, 6 months ago) by matthias
Branch: MAIN
CVS Tags: wrstuden-devbsize-base, wrstuden-devbsize-19991221, wrstuden-devbsize, thorpej_scsipi_nbase, thorpej_scsipi_beforemerge, thorpej_scsipi_base, thorpej_scsipi, thorpej-mips-cache-base, thorpej-mips-cache, thorpej-devvp-base3, thorpej-devvp-base2, thorpej-devvp-base, thorpej-devvp, pre-chs-ubcperf, post-chs-ubcperf, newlock-base, newlock, netbsd-1-6-base, netbsd-1-6-RELEASE, netbsd-1-6-RC3, netbsd-1-6-RC2, netbsd-1-6-RC1, netbsd-1-6-PATCH002-RELEASE, netbsd-1-6-PATCH002-RC4, netbsd-1-6-PATCH002-RC3, netbsd-1-6-PATCH002-RC2, netbsd-1-6-PATCH002-RC1, netbsd-1-6-PATCH002, netbsd-1-6-PATCH001-RELEASE, netbsd-1-6-PATCH001-RC3, netbsd-1-6-PATCH001-RC2, netbsd-1-6-PATCH001-RC1, netbsd-1-6-PATCH001, netbsd-1-6, netbsd-1-5-base, netbsd-1-5-RELEASE, netbsd-1-5-PATCH003, netbsd-1-5-PATCH002, netbsd-1-5-PATCH001, netbsd-1-5-BETA2, netbsd-1-5-BETA, netbsd-1-5-ALPHA2, netbsd-1-5, netbsd-1-4-base, netbsd-1-4-RELEASE, netbsd-1-4-PATCH003, netbsd-1-4-PATCH002, netbsd-1-4-PATCH001, netbsd-1-4, nathanw_sa_before_merge, minoura-xpg4dl-base, minoura-xpg4dl, kqueue-beforemerge, kqueue-base, kqueue-aftermerge, kqueue, kenh-if-detach-base, kenh-if-detach, kame_14_19990705, kame_14_19990628, kame_141_19991130, kame, ifpoll-base, gmcgarry_ucred_base, gmcgarry_ucred, gmcgarry_ctxsw_base, gmcgarry_ctxsw, gehenna-devsw-base, gehenna-devsw, fvdl_fs64_base, fvdl-softdep-base, fvdl-softdep, eeh-devprop-base, eeh-devprop, comdex-fall-1999-base, comdex-fall-1999, chs-ubc2-newbase, chs-ubc2-base, chs-ubc2, chs-ubc-base, chs-ubc
Changes since 1.3: +10 -10 lines

Get rid of vm_offset_t/vm_size_t. Resolve conflicts in pmap.new.[ch] after
last import from port-i386.

/*	$NetBSD: ieee_handler.h,v 1.4 1998/09/02 19:17:12 matthias Exp $	*/

/* 
 * IEEE floating point support for NS32081 and NS32381 fpus.
 * Copyright (c) 1995 Ian Dall
 * All Rights Reserved.
 * 
 * Permission to use, copy, modify and distribute this software and its
 * documentation is hereby granted, provided that both the copyright
 * notice and this permission notice appear in all copies of the
 * software, derivative works or modified versions, and any portions
 * thereof, and that both notices appear in supporting documentation.
 * 
 * IAN DALL ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.
 * IAN DALL DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
 * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
 */
/* 
 *	File:	ieee_handler.h
 *	Author:	Ian Dall
 *	Date:	November 1995
 *
 *	Prototypes for entry points. Customization for in kernel version
 *      or unix signal handler version.
 *
 * HISTORY
 * 02-Apr-96 Matthias Pfaller <leo@dachau.marco.de>)
 *	Add NetBSD kernel support.
 *
 * 14-Dec-95  Ian Dall (Ian.Dall@dsto.defence.gov.au)
 *	First release.
 *
 */
#ifndef _IEEE_HANDLER_H_
#define _IEEE_HANDLER_H_

#if defined(KERNEL) || defined(_KERNEL)
#ifdef MACH

#include <ns532/thread.h>
#include <mach/vm_param.h>
#include "mach_kdb.h"
#if MACH_KDB
#define DEBUG
#endif

typedef struct {
  struct ns532_saved_state *regs;
  struct ns532_fp_state *fps;
} state;

#define LREGBASE(s) ((vaddr_t) (s)->fps)
#define LREGOFFSET(n) offsetof(struct ns532_fp_state, regs.l.l ## n)
#define FREGBASE(s) ((vaddr_t) (s)->fps)
#define FREGOFFSET(n) offsetof(struct ns532_fp_state, regs.f.f ## n)
#define REGBASE(s) ((vaddr_t) (s)->regs)
#define REGOFFSET(n) offsetof(struct ns532_saved_state, r ## n)

#define FSR fps->fsr
#define FP regs->fp
#define SP regs->usp
#define SB regs->sb
#define PC regs->pc
#define PSR regs->psr

#elif defined(__NetBSD__)  /* MACH */
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/user.h>

typedef struct proc state;

#define LREGBASE(s) ((vaddr_t) (s)->p_addr->u_pcb.pcb_freg)
#define LREGOFFSET(n) (n * sizeof(double))
#define FREGBASE(s) ((vaddr_t) (s)->p_addr->u_pcb.pcb_freg)
#define FREGOFFSET(n) ((n & ~1) * sizeof(double) + (n & 1) * sizeof(float))
#define REGBASE(s) ((vaddr_t) (s)->p_md.md_regs)
#define REGOFFSET(n) offsetof(struct reg, r_r ## n)

#define FSR p_addr->u_pcb.pcb_fsr
#define FP p_md.md_regs->r_fp
#define SP p_md.md_regs->r_sp
#define SB p_md.md_regs->r_sb
#define PC p_md.md_regs->r_pc
#define PSR p_md.md_regs->r_psr

#define PSR_N	PSL_N
#define PSR_Z	PSL_Z
#define PSR_L	PSL_L

#else  /* __NetBSD__ */
#error OS unsupported
#endif /* __NetBSD__ */
#else /* KERNEL || _KERNEL */
#include <signal.h>

struct fstate {
  unsigned int fsr;
  union {
    struct { double l0, l2, l4, l6, l1, l3, l5, l7;} l;
    struct { float f0, f1, f2, f3, f4, f5, f6, f7;} f;
  } regs;
};

struct ns532_combined_state {
  struct sigcontext *scp;
  struct fstate fs;
};

typedef struct ns532_combined_state state;

#define LREG(REG) fs.regs.l.l ## REG
#define LREGBASE(s) ((vaddr_t) &(s)->fs)
#define LREGOFFSET(n) offsetof(struct fstate, regs.l.l ## n)
#define FREGBASE(s) ((vaddr_t) &(s)->fs)
#define FREGOFFSET(n) offsetof(struct fstate, regs.f.f ## n)
#define REGBASE(s) ((vaddr_t) (s)->scp)
#define REGOFFSET(n) offsetof(struct sigcontext, sc_reg[n])
#define FSR fs.fsr
#define FP scp->sc_fp
#define SP scp->sc_sp
#define SB scp->sc_sb
#define PC scp->sc_pc
#define PSR scp->sc_ps

int ieee_sig(int sig, int code, struct sigcontext *scp);

#ifdef __NetBSD__
#define PSR_N	PSL_N
#define PSR_Z	PSL_Z
#define PSR_L	PSL_L
#endif /* __NetBSD */

#endif /* KERNEL */

int ieee_handle_exception(state *state);

#endif /* _IEEE_HANDLER_H_ */