void lock_mod (JGMOD *j) { int index; PATTERN_INFO *pi; if (j == null) return; #ifdef __ALLEG_DJGPP__ _go32_dpmi_lock_data(j, sizeof(JGMOD)); _go32_dpmi_lock_data(j->si, sizeof(SAMPLE_INFO) * j->no_sample); _go32_dpmi_lock_data(j->pi, sizeof(PATTERN_INFO) * j->no_pat); if (j->ii != null) _go32_dpmi_lock_data(j->ii, sizeof(INSTRUMENT_INFO) * j->no_instrument); for (index=0; index<j->no_pat; index++) { pi = j->pi + index; _go32_dpmi_lock_data(pi->ni, sizeof(NOTE_INFO) * pi->no_pos * j->no_chn); } #endif pi = j->pi; // this does nothing except to for (index=0; index < j->no_sample; index++) lock_sample (j->s + index); }
static void lockMemory( INOUT MEM_INFO_HEADER *memHdrPtr ) { assert( isWritePtr( memHdrPtr, sizeof( MEM_INFO_HEADER ) ) ); /* Under 32-bit MSDOS use the DPMI functions to lock memory */ if( _go32_dpmi_lock_data( memPtr, memHdrPtr->size ) == 0) memHdrPtr->flags |= MEM_FLAG_LOCKED; }
void init_naves() { _go32_dpmi_lock_data((void *)&nave_pos, sizeof(NavePos)); nave_pos.x = (HRES) * 0.3; nave_pos.y = (VRES) * 0.86; nave_parada = create_sprite(NaveParada_xpm); nave_esquerda = create_sprite(NaveEsquerda_xpm); nave_direita = create_sprite(NaveDireita_xpm); }
/* _lock_malloc: * Allocates a locked memory block */ void *_lock_malloc (size_t size) { void *ret = malloc (size); if (!ret) return NULL; if (_go32_dpmi_lock_data (ret, size)) { free (ret); return NULL; } return ret; }
/* * locked memory allocation */ void *pc_malloc (size_t size) { void *p = malloc(size); if (p) { if (_go32_dpmi_lock_data(p, size)) { free(p); return NULL; } } return p; }
int mouse_init(void(*isr)(void), _go32_dpmi_seginfo *prev_isr) { disable_irq(KBD_IRQ); disable_irq(MOUSE_IRQ); int sucesso = kbc_init(1); _go32_dpmi_lock_code(mouse_isr, (end_mouse_isr - mouse_isr)); _go32_dpmi_lock_data((void*) &b3, sizeof(b3)); set_isr(MOUSE_IRQ, mouse_isr, prev_isr); enable_irq(KBD_IRQ); enable_irq(MOUSE_IRQ); return sucesso; }
void keyboard_int_install() { // retrieve the current (old) keyboard handler _go32_dpmi_get_protected_mode_interrupt_vector(9, &OldHandler); // lock code and data from being paged _go32_dpmi_lock_code(myKeyInt, (long)myKeyInt_Size); _go32_dpmi_lock_data(&keyVal, (long)sizeof(keyVal)); // establish new seginfo struct NewHandler.pm_offset = (long)myKeyInt; NewHandler.pm_selector = _go32_my_cs(); // allocate the IRET wrapper _go32_dpmi_allocate_iret_wrapper(&NewHandler); // install the new keyboard ISR _go32_dpmi_set_protected_mode_interrupt_vector(9, &NewHandler); printf("new keyboard ISR installed\n"); }
static void kbd_init_common(void) { _go32_dpmi_get_protected_mode_interrupt_vector(9, &std_kbd_handler_seginfo); atexit(kbd_exit); _go32_dpmi_lock_code(my_kbd_interrupt_handler, (unsigned long)my_kbd_interrupt_handler_end - (unsigned long)my_kbd_interrupt_handler); _go32_dpmi_lock_code(queue_command, (unsigned long)queue_command_end - (unsigned long)queue_command); _go32_dpmi_lock_data(keyconvmaps, sizeof(keyconvmaps)); _go32_dpmi_lock_data(keyarr, sizeof(keyarr)); _go32_dpmi_lock_data(rev_keyarr, sizeof(rev_keyarr)); _go32_dpmi_lock_data(&modifiers, sizeof(modifiers)); _go32_dpmi_lock_data(&num_queued_commands, sizeof(num_queued_commands)); _go32_dpmi_lock_data(&command_queue, sizeof(command_queue)); num_queued_commands = 0; kbd_install(); }