Пример #1
0
/*
 * Handles completion of an extended trap and passes
 * return value from trap function to 68k space.
 */
static uae_u32 REGPARAM3 exit_trap_handler (TrapContext *dummy_ctx)
{
	TrapContext *context = current_context;

	/* Wait for trap context thread to exit. */
	uae_wait_thread (context->thread);

	/* Restore 68k state saved at trap entry. */
	regs = context->saved_regs;

	/* If trap is supposed to return a value, then store
	 * return value in D0. */
	if (context->trap_has_retval)
		m68k_dreg (regs, 0) = context->trap_retval;

	uae_sem_destroy (&context->switch_to_trap_sem);
	uae_sem_destroy (&context->switch_to_emu_sem);

	xfree (context);

	/* End critical section */
	uae_sem_post (&trap_mutex);

	/* Dummy return value. */
	return 0;
}
Пример #2
0
static void free_library_data(struct library_data *library_data) {
    if (library_data->empty_count) {
        uae_sem_destroy(&library_data->empty_count);
    }
    if (library_data->full_count) {
        uae_sem_destroy(&library_data->full_count);
    }
    free(library_data);
}
Пример #3
0
/* close device handle */
static void sys_cddev_close (struct dev_info_ioctl *ciw, int unitnum)
{
	if (ciw->open == false)
		return;
	cdda_stop (ciw);
	close_createfile (ciw);
	VirtualFree (ciw->tempbuffer, 0, MEM_RELEASE);
	ciw->tempbuffer = NULL;
	uae_sem_destroy (&ciw->sub_sem);
	uae_sem_destroy (&ciw->sub_sem2);
	ciw->open = false;
	write_log (_T("IOCTL: device '%s' closed\n"), ciw->devname, unitnum);
}
Пример #4
0
void native2amiga_install (void)
{
  if(native2amiga_pending.size != 300)
    init_comm_pipe (&native2amiga_pending, 300, 2);
  if(n2asem != 0)
    uae_sem_destroy(&n2asem);
  n2asem = 0;
  uae_sem_init (&n2asem, 0, 1);
}
Пример #5
0
void close_sound (void) {
	config_changed = 1;
	gui_data.sndbuf = 0;
	gui_data.sndbuf_status = 3;
	if (!have_sound)
		return;

	// SDL_PauseAudio (1);
	clearbuffer();
	if (in_callback) {
		closing_sound = 1;
		uae_sem_post (&data_available_sem);
	}

	write_comm_pipe_int (&to_sound_pipe, 1, 1);
	uae_sem_wait (&sound_init_sem);
	// SDL_CloseAudio ();
	uae_sem_destroy (&data_available_sem);
	uae_sem_destroy (&sound_init_sem);
	uae_sem_destroy (&callback_done_sem);
	have_sound = 0;
}
Пример #6
0
void ethernet_close (struct netdriverdata *ndd, void *vsd)
{
	if (!ndd)
		return;
	switch (ndd->type)
	{
		case UAENET_SLIRP:
		case UAENET_SLIRP_INBOUND:
		if (slirp_data) {
			slirp_data = NULL;
			slirp_end ();
			slirp_cleanup ();
			uae_sem_destroy (&slirp_sem1);
			uae_sem_destroy (&slirp_sem2);
		}
		return;
#ifdef WITH_UAENET_PCAP
		case UAENET_PCAP:
		return uaenet_close (vsd);
#endif
	}
}
Пример #7
0
void graphics_thread_leave(void)
{
	if(display_tid != 0) {
	  write_comm_pipe_u32 (display_pipe, DISPLAY_SIGNAL_QUIT, 1);
	  while(display_tid != 0) {
	    sleep_millis(10);
	  }
	  destroy_comm_pipe(display_pipe);
	  xfree(display_pipe);
	  display_pipe = 0;
	  uae_sem_destroy(&display_sem);
	  display_sem = 0;
	}
}
Пример #8
0
/*
 * Initialize the extended trap mechanism.
 */
void init_extended_traps (void)
{
    m68k_call_trapaddr = here ();
    calltrap (deftrap2 ((TrapHandler)m68k_call_handler, TRAPFLAG_NO_RETVAL, "m68k_call"));

    m68k_return_trapaddr = here();
    calltrap (deftrap2 ((TrapHandler)m68k_return_handler, TRAPFLAG_NO_RETVAL, "m68k_return"));

    exit_trap_trapaddr = here();
    calltrap (deftrap2 ((TrapHandler)exit_trap_handler, TRAPFLAG_NO_RETVAL, "exit_trap"));

    if(trap_mutex != 0)
      uae_sem_destroy(&trap_mutex);
    trap_mutex = 0;
    uae_sem_init (&trap_mutex, 0, 1);
}