Beispiel #1
0
static void bch(unsigned fn, _go32_dpmi_registers* r)
{
 static const unsigned pci_stack_size = 2048;
 _go32_dpmi_seginfo si;
 int go32_ec;

 assert(pci_stack_size <= 65536);

 r->h.ah = PCI_FUNCTION_ID;
 r->h.al = fn;

 memset(&si, 0, sizeof(si));
 si.size = (pci_stack_size + 15) / 16;
 go32_ec = _go32_dpmi_allocate_dos_memory(&si);
 if(go32_ec != 0)
 {
  fprintf(stderr, "DOS memory allocation failed: %d\n", go32_ec);
  abort();
 }
 r->x.ss = si.rm_segment;
 r->x.sp = pci_stack_size;


 go32_ec = _go32_dpmi_simulate_int(0x1A, r);
 if(go32_ec != 0)
 {
  _go32_dpmi_free_dos_memory(&si);
  fprintf(stderr, "Simulate int failed: %d\n", go32_ec);
  abort();
 }
 _go32_dpmi_free_dos_memory(&si);
}
Beispiel #2
0
/* install the real-mode critical error handler
 */
void hard_error_catch_setup(void)
{
    /* On first call, allocate some DOS memory and copy the handler into it
     */
    if(!handler_installed) {
        handler_installed = TRUE;
        new_handler_info.size = old_handler_info.size = 1;
        if (_go32_dpmi_allocate_dos_memory(&new_handler_info) != 0) {
            fprintf(stderr,"Couldn't allocate handler memory\n");
            exit(1);
        }
        dosmemput(handler, 16, new_handler_info.rm_segment * 16);
#ifdef XDEBUG
        sprintf(Tempbuf, "Handler at segment %x", new_handler_info.rm_segment);
        error_msg(Tempbuf, 0);
#endif
    }
    _go32_dpmi_get_real_mode_interrupt_vector(0x24, &old_handler_info);
    _go32_dpmi_set_real_mode_interrupt_vector(0x24, &new_handler_info);
    clear_hard_error();
    return;
}