Commit 441a76a6 authored by Raymond Toy's avatar Raymond Toy
Browse files

Move the FPU save/restore stuff from os.h to arch.h

 * src/lisp/os.h
   * Move macros and definitions for FPU save/restore from here.
 * src/lisp/arch.h
   * Put architecture neutral stuff from os.h here.
 * src/lisp/ppc-arch.h
 * src/lisp/sparc-arch.h
 * src/lisp/x86-arch.h
   * Implement the FPU save/restore macros here for each supported
     architecture.
parent c07cc020
......@@ -30,18 +30,28 @@ extern lispobj funcall2(lispobj function, lispobj arg0, lispobj arg1);
extern lispobj funcall3(lispobj function, lispobj arg0, lispobj arg1,
lispobj arg2);
extern void arch_make_linkage_entry(long, void *, long);
extern long arch_linkage_entry(unsigned long);
void arch_make_lazy_linkage(long linkage_entry);
long arch_linkage_entry(unsigned long retaddr);
extern void fpu_save(void *);
extern void fpu_restore(void *);
extern void sse_save(void *);
extern void sse_restore(void *);
extern void save_fpu_state(void*);
extern void restore_fpu_state(void*);
extern void arch_make_linkage_entry(long, void *, long);
extern long arch_linkage_entry(unsigned long);
void arch_make_lazy_linkage(long linkage_entry);
long arch_linkage_entry(unsigned long retaddr);
#if defined(i386) || defined(__x86_64)
#include "x86-arch.h"
#endif
#ifdef i386
extern int arch_support_sse2(void);
#if defined(DARWIN) && defined(__ppc__)
#include "ppc-arch.h"
#endif
#if defined(sparc)
#include "sparc-arch.h"
#endif
#endif /* __ARCH_H__ */
......@@ -116,45 +116,6 @@ unsigned long *os_sigcontext_pc(ucontext_t *);
unsigned char *os_sigcontext_fpu_reg(ucontext_t *, int);
unsigned int os_sigcontext_fpu_modes(ucontext_t *);
#ifdef i386
extern boolean os_support_sse2(void);
#endif
char* convert_lisp_string(char* c_string, void* lisp_string, int len);
/*
* Define macro to allocate a local array of the appropriate size
* where the fpu state can be stored.
*/
#if defined(i386) || defined(__x86_64)
#define FPU_STATE_SIZE 27
/*
* Need 512 byte area, aligned on a 16-byte boundary. So allocate
* 512+16 bytes of space and let the routine adjust use the
* appropriate alignment.
*/
#define SSE_STATE_SIZE ((512+16)/4)
/*
* Just use the SSE size for both x87 and sse2 since the SSE size is
* enough for either.
*/
#define FPU_STATE(name) int name[SSE_STATE_SIZE];
#elif defined(sparc)
/*
* 32 (single-precision) FP registers, and the FP state register.
* But Sparc V9 has 32 double-precision registers (equivalent to 64
* single-precision, but can't be accessed), so we leave enough room
* for that.
*/
#define FPU_STATE_SIZE (((32 + 32 + 1) + 1)/2)
#define FPU_STATE(name) long long name[FPU_STATE_SIZE];
#elif defined(DARWIN) && defined(__ppc__)
#define FPU_STATE_SIZE 32
#define FPU_STATE(name) long long name[FPU_STATE_SIZE];
#endif
extern void save_fpu_state(void*);
extern void restore_fpu_state(void*);
#endif /* _OS_H_ */
/*
This code was written as part of the CMU Common Lisp project and has
been placed in the public domain.
*/
#ifndef __PPC_ARCH_H
#define __PPC_ARCH_H
/*
* Define macro to allocate a local array of the appropriate size
* where the fpu state can be stored.
*
* PPC has 32 (double-precision) floating-point registers.
*/
#define FPU_STATE_SIZE 32
#define FPU_STATE(name) long long name[FPU_STATE_SIZE];
#endif
/*
This code was written as part of the CMU Common Lisp project and has
been placed in the public domain.
*/
#ifndef __SPARC_ARCH_H
#define __SPARC_ARCH_H
/*
* Define macro to allocate a local array of the appropriate size
* where the fpu state can be stored.
*
*
* 32 (single-precision) FP registers, and the FP state register.
* But Sparc V9 has 32 double-precision registers (equivalent to 64
* single-precision, but can't be accessed), so we leave enough room
* for that.
*/
#define FPU_STATE_SIZE (((32 + 32 + 1) + 1)/2)
#define FPU_STATE(name) long long name[FPU_STATE_SIZE];
#endif
/*
This code was written as part of the CMU Common Lisp project and has
been placed in the public domain.
*/
#ifndef __X86_ARCH_H
extern int arch_support_sse2(void);
extern boolean os_support_sse2(void);
/*
* Define macro to allocate a local array of the appropriate size
* where the fpu state can be stored.
*/
#define FPU_STATE_SIZE 27
/*
* Need 512 byte area, aligned on a 16-byte boundary. So allocate
* 512+16 bytes of space and let the routine adjust the appropriate
* alignment.
*/
#define SSE_STATE_SIZE ((512+16)/4)
/*
* Just use the SSE size for both x87 and sse2 since the SSE size is
* enough for either.
*/
#define FPU_STATE(name) int name[SSE_STATE_SIZE];
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment