# define VM_PROT_SCHEME (VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE)
#endif
+static bool fp_support_present = false;
+
+void
+i386_init_hook (void)
+{
+ fp_support_present = (i386_interface_initialize ());
+
+ declare_builtin ((unsigned long)asm_scheme_to_interface, "asm_scheme_to_interface");
+ declare_builtin ((unsigned long)asm_scheme_to_interface_call, "asm_scheme_to_interface_call");
+ declare_builtin ((unsigned long)asm_trampoline_to_interface, "asm_trampoline_to_interface");
+ declare_builtin ((unsigned long)asm_interrupt_procedure, "asm_interrupt_procedure");
+ declare_builtin ((unsigned long)asm_interrupt_continuation, "asm_interrupt_continuation");
+ declare_builtin ((unsigned long)asm_interrupt_closure, "asm_interrupt_closure");
+ declare_builtin ((unsigned long)asm_interrupt_dlink, "asm_interrupt_dlink");
+ declare_builtin ((unsigned long)asm_primitive_apply, "asm_primitive_apply");
+ declare_builtin ((unsigned long)asm_primitive_lexpr_apply, "asm_primitive_lexpr_apply");
+ declare_builtin ((unsigned long)asm_assignment_trap, "asm_assignment_trap");
+ declare_builtin ((unsigned long)asm_reference_trap, "asm_reference_trap");
+ declare_builtin ((unsigned long)asm_safe_reference_trap, "asm_safe_reference_trap");
+ declare_builtin ((unsigned long)asm_link, "asm_link");
+ declare_builtin ((unsigned long)asm_error, "asm_error");
+ declare_builtin ((unsigned long)asm_primitive_error, "asm_primitive_error");
+ declare_builtin ((unsigned long)asm_short_primitive_apply, "asm_short_primitive_apply");
+ if (fp_support_present)
+ {
+ declare_builtin ((unsigned long)asm_generic_add, "asm_generic_add");
+ declare_builtin ((unsigned long)asm_generic_subtract, "asm_generic_subtract");
+ declare_builtin ((unsigned long)asm_generic_multiply, "asm_generic_multiply");
+ declare_builtin ((unsigned long)asm_generic_divide, "asm_generic_divide");
+ declare_builtin ((unsigned long)asm_generic_equal, "asm_generic_equal");
+ declare_builtin ((unsigned long)asm_generic_less, "asm_generic_less");
+ declare_builtin ((unsigned long)asm_generic_greater, "asm_generic_greater");
+ declare_builtin ((unsigned long)asm_generic_increment, "asm_generic_increment");
+ declare_builtin ((unsigned long)asm_generic_decrement, "asm_generic_decrement");
+ declare_builtin ((unsigned long)asm_generic_zero, "asm_generic_zero");
+ declare_builtin ((unsigned long)asm_generic_positive, "asm_generic_positive");
+ declare_builtin ((unsigned long)asm_generic_negative, "asm_generic_negative");
+ declare_builtin ((unsigned long)asm_generic_quotient, "asm_generic_quotient");
+ declare_builtin ((unsigned long)asm_generic_remainder, "asm_generic_remainder");
+ declare_builtin ((unsigned long)asm_generic_modulo, "asm_generic_modulo");
+ }
+ else
+ {
+ declare_builtin ((unsigned long)asm_nofp_add, "asm_nofp_add");
+ declare_builtin ((unsigned long)asm_nofp_subtract, "asm_nofp_subtract");
+ declare_builtin ((unsigned long)asm_nofp_multiply, "asm_nofp_multiply");
+ declare_builtin ((unsigned long)asm_nofp_divide, "asm_nofp_divide");
+ declare_builtin ((unsigned long)asm_nofp_equal, "asm_nofp_equal");
+ declare_builtin ((unsigned long)asm_nofp_less, "asm_nofp_less");
+ declare_builtin ((unsigned long)asm_nofp_greater, "asm_nofp_greater");
+ declare_builtin ((unsigned long)asm_nofp_increment, "asm_nofp_increment");
+ declare_builtin ((unsigned long)asm_nofp_decrement, "asm_nofp_decrement");
+ declare_builtin ((unsigned long)asm_nofp_zero, "asm_nofp_zero");
+ declare_builtin ((unsigned long)asm_nofp_positive, "asm_nofp_positive");
+ declare_builtin ((unsigned long)asm_nofp_negative, "asm_nofp_negative");
+ declare_builtin ((unsigned long)asm_nofp_quotient, "asm_nofp_quotient");
+ declare_builtin ((unsigned long)asm_nofp_remainder, "asm_nofp_remainder");
+ declare_builtin ((unsigned long)asm_nofp_modulo, "asm_nofp_modulo");
+ }
+ declare_builtin ((unsigned long)asm_sc_apply, "asm_sc_apply");
+ declare_builtin ((unsigned long)asm_sc_apply_size_1, "asm_sc_apply_size_1");
+ declare_builtin ((unsigned long)asm_sc_apply_size_2, "asm_sc_apply_size_2");
+ declare_builtin ((unsigned long)asm_sc_apply_size_3, "asm_sc_apply_size_3");
+ declare_builtin ((unsigned long)asm_sc_apply_size_4, "asm_sc_apply_size_4");
+ declare_builtin ((unsigned long)asm_sc_apply_size_5, "asm_sc_apply_size_5");
+ declare_builtin ((unsigned long)asm_sc_apply_size_6, "asm_sc_apply_size_6");
+ declare_builtin ((unsigned long)asm_sc_apply_size_7, "asm_sc_apply_size_7");
+ declare_builtin ((unsigned long)asm_sc_apply_size_8, "asm_sc_apply_size_8");
+ declare_builtin ((unsigned long)asm_interrupt_continuation_2, "asm_interrupt_continuation_2");
+ if (ia32_cpuid_needed)
+ declare_builtin ((unsigned long)asm_serialize_cache, "asm_serialize_cache");
+ else
+ declare_builtin ((unsigned long)asm_dont_serialize_cache, "asm_dont_serialize_cache");
+ declare_builtin ((unsigned long)asm_fixnum_shift, "asm_fixnum_shift");
+ declare_builtin ((unsigned long)asm_set_interrupt_enables, "asm_set_interrupt_enables");
+
+#ifdef _MACH_UNIX
+ {
+ vm_address_t addr;
+ vm_size_t size;
+ vm_prot_t prot;
+ vm_prot_t max_prot;
+ vm_inherit_t inheritance;
+ boolean_t shared;
+ port_t object;
+ vm_offset_t offset;
+
+ addr = ((vm_address_t) Heap);
+ if ((vm_region ((task_self ()), &addr, &size, &prot, &max_prot,
+ &inheritance, &shared, &object, &offset))
+ != KERN_SUCCESS)
+ {
+ outf_fatal ( "compiler_reset: vm_region() failed.\n");
+ Microcode_Termination (TERM_EXIT);
+ /*NOTREACHED*/
+ }
+ if ((prot & VM_PROT_SCHEME) != VM_PROT_SCHEME)
+ {
+ if ((max_prot & VM_PROT_SCHEME) != VM_PROT_SCHEME)
+ {
+ outf_fatal (
+ "compiler_reset: inadequate protection for Heap.\n");
+ outf_fatal ( "maximum = 0x%lx; desired = 0x%lx\n",
+ ((unsigned long) (max_prot & VM_PROT_SCHEME)),
+ ((unsigned long) VM_PROT_SCHEME));
+ Microcode_Termination (TERM_EXIT);
+ /*NOTREACHED*/
+ }
+ if ((vm_protect ((task_self ()), ((vm_address_t) Heap),
+ (((char *) constant_end) - ((char *) Heap)),
+ 0, VM_PROT_SCHEME))
+ != KERN_SUCCESS)
+ {
+ outf_fatal ("Unable to change protection for Heap.\n");
+ outf_fatal ("actual = 0x%lx; desired = 0x%lx\n",
+ ((unsigned long) (prot & VM_PROT_SCHEME)),
+ ((unsigned long) VM_PROT_SCHEME));
+ Microcode_Termination (TERM_EXIT);
+ /*NOTREACHED*/
+ }
+ }
+ }
+#endif /* _MACH_UNIX */
+}
+
#define SETUP_REGISTER(hook) do \
{ \
(* ((unsigned long *) (esi_value + offset))) \
= ((unsigned long) (hook)); \
offset += (COMPILER_HOOK_SIZE * (sizeof (SCHEME_OBJECT))); \
- declare_builtin (((unsigned long) hook), #hook); \
} while (0)
void
{
unsigned int offset = (COMPILER_REGBLOCK_N_FIXED * (sizeof (SCHEME_OBJECT)));
unsigned char * esi_value = ((unsigned char *) Registers);
- bool fp_support_present = (i386_interface_initialize ());
/* These must match machines/i386/lapgen.scm */
SETUP_REGISTER (asm_dont_serialize_cache); /* -7 */
SETUP_REGISTER (asm_fixnum_shift); /* -6 */
SETUP_REGISTER (asm_set_interrupt_enables); /* -5 */
-
-#ifdef _MACH_UNIX
- {
- vm_address_t addr;
- vm_size_t size;
- vm_prot_t prot;
- vm_prot_t max_prot;
- vm_inherit_t inheritance;
- boolean_t shared;
- port_t object;
- vm_offset_t offset;
-
- addr = ((vm_address_t) Heap);
- if ((vm_region ((task_self ()), &addr, &size, &prot, &max_prot,
- &inheritance, &shared, &object, &offset))
- != KERN_SUCCESS)
- {
- outf_fatal ( "compiler_reset: vm_region() failed.\n");
- Microcode_Termination (TERM_EXIT);
- /*NOTREACHED*/
- }
- if ((prot & VM_PROT_SCHEME) != VM_PROT_SCHEME)
- {
- if ((max_prot & VM_PROT_SCHEME) != VM_PROT_SCHEME)
- {
- outf_fatal (
- "compiler_reset: inadequate protection for Heap.\n");
- outf_fatal ( "maximum = 0x%lx; desired = 0x%lx\n",
- ((unsigned long) (max_prot & VM_PROT_SCHEME)),
- ((unsigned long) VM_PROT_SCHEME));
- Microcode_Termination (TERM_EXIT);
- /*NOTREACHED*/
- }
- if ((vm_protect ((task_self ()), ((vm_address_t) Heap),
- (((char *) constant_end) - ((char *) Heap)),
- 0, VM_PROT_SCHEME))
- != KERN_SUCCESS)
- {
- outf_fatal ("Unable to change protection for Heap.\n");
- outf_fatal ("actual = 0x%lx; desired = 0x%lx\n",
- ((unsigned long) (prot & VM_PROT_SCHEME)),
- ((unsigned long) VM_PROT_SCHEME));
- Microcode_Termination (TERM_EXIT);
- /*NOTREACHED*/
- }
- }
- }
-#endif /* _MACH_UNIX */
}
#ifndef HAVE_FENV_H