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 setup_isrs() { set_isr(0, (unsigned)isr0, 0x08, 0x8E); set_isr(1, (unsigned)isr1, 0x08, 0x8E); set_isr(2, (unsigned)isr2, 0x08, 0x8E); set_isr(3, (unsigned)isr3, 0x08, 0x8E); set_isr(4, (unsigned)isr4, 0x08, 0x8E); set_isr(5, (unsigned)isr5, 0x08, 0x8E); set_isr(6, (unsigned)isr6, 0x08, 0x8E); set_isr(7, (unsigned)isr7, 0x08, 0x8E); set_isr(8, (unsigned)isr8, 0x08, 0x8E); set_isr(9, (unsigned)isr9, 0x08, 0x8E); set_isr(10, (unsigned)isr10, 0x08, 0x8E); set_isr(11, (unsigned)isr11, 0x08, 0x8E); set_isr(12, (unsigned)isr12, 0x08, 0x8E); set_isr(13, (unsigned)isr13, 0x08, 0x8E); set_isr(14, (unsigned)isr14, 0x08, 0x8E); set_isr(15, (unsigned)isr15, 0x08, 0x8E); set_isr(16, (unsigned)isr16, 0x08, 0x8E); set_isr(17, (unsigned)isr17, 0x08, 0x8E); set_isr(18, (unsigned)isr18, 0x08, 0x8E); set_isr(19, (unsigned)isr19, 0x08, 0x8E); set_isr(20, (unsigned)isr20, 0x08, 0x8E); set_isr(21, (unsigned)isr21, 0x08, 0x8E); set_isr(22, (unsigned)isr22, 0x08, 0x8E); set_isr(23, (unsigned)isr23, 0x08, 0x8E); set_isr(24, (unsigned)isr24, 0x08, 0x8E); set_isr(25, (unsigned)isr25, 0x08, 0x8E); set_isr(26, (unsigned)isr26, 0x08, 0x8E); set_isr(27, (unsigned)isr27, 0x08, 0x8E); set_isr(28, (unsigned)isr28, 0x08, 0x8E); set_isr(29, (unsigned)isr29, 0x08, 0x8E); set_isr(30, (unsigned)isr30, 0x08, 0x8E); set_isr(31, (unsigned)isr31, 0x08, 0x8E); remap_pic(); set_isr(32, (unsigned)irq0, 0x08, 0x8E); set_isr(33, (unsigned)irq1, 0x08, 0x8E); set_isr(34, (unsigned)irq2, 0x08, 0x8E); set_isr(35, (unsigned)irq3, 0x08, 0x8E); set_isr(36, (unsigned)irq4, 0x08, 0x8E); set_isr(37, (unsigned)irq5, 0x08, 0x8E); set_isr(38, (unsigned)irq6, 0x08, 0x8E); set_isr(39, (unsigned)irq7, 0x08, 0x8E); set_isr(40, (unsigned)irq8, 0x08, 0x8E); set_isr(41, (unsigned)irq9, 0x08, 0x8E); set_isr(42, (unsigned)irq10, 0x08, 0x8E); set_isr(43, (unsigned)irq11, 0x08, 0x8E); set_isr(44, (unsigned)irq12, 0x08, 0x8E); set_isr(45, (unsigned)irq13, 0x08, 0x8E); set_isr(46, (unsigned)irq14, 0x08, 0x8E); set_isr(47, (unsigned)irq15, 0x08, 0x8E); }
static void execute(char *first, char *rest) { /* * This command (in first) was not found in the command table * * * first - first word on command line * rest - rest of command line * */ char *fullname; char *extension; assert(first); assert(rest); /* check for a drive change */ if ((strcmp(first + 1, ":") == 0) && isalpha(*first)) { changeDrive(*first); return; } if(strchr(first,'?') || strchr(first,'*')) { error_bad_command(first); return; } /* search through %PATH% for the binary */ errno = 0; fullname = find_which(first); dprintf(("[find_which(%s) returned %s]\n", first, fullname)); if(!fullname) { error_bad_command(first); return; } /* check if this is a .BAT file */ extension = strrchr(dfnfilename(fullname), '.'); assert(extension); if(stricmp(extension, ".bat") == 0) { dprintf(("[BATCH: %s %s]\n", fullname, rest)); batch(fullname, first, rest); } else if(stricmp(extension, ".exe") == 0 || stricmp(extension, ".com") == 0) { /* exec the program */ int result; dprintf(("[EXEC: %s %s]\n", fullname, rest)); if(strlen(rest) > MAX_EXTERNAL_COMMAND_SIZE) { char *fullcommandline = malloc( strlen( first ) + strlen( rest ) + 2 ); error_line_too_long(); if( fullcommandline == NULL ) return; sprintf( fullcommandline, "%s%s", first, rest ); if( chgEnv( "CMDLINE", fullcommandline ) != 0 ) { free( fullcommandline ); return; } free( fullcommandline ); } /* Prepare to call an external program */ /* Unload the message block if not loaded persistently */ if(!persistentMSGs) unloadMsgs(); /* Execute the external program */ #ifdef FEATURE_KERNEL_SWAP_SHELL if(swapOnExec == TRUE && kswapMkStruc(fullname, rest)) { /* The Criter and ^Break handlers has been installed within the PSP in kswapRegister() --> nothing to do here */ dprintf(("[EXEC: exiting to kernel swap support]\n")); exit(123); /* Let the kernel swap support do the rest */ } #ifdef DEBUG if(swapOnExec == TRUE) dprintf(("KSWAP: failed to save context, proceed without swapping\n")); #endif #endif /* Install the dummy (always abort) handler */ #ifdef FEATURE_XMS_SWAP set_isr(0x23, (void interrupt(*)()) MK_FP(FP_SEG(lowlevel_cbreak_handler)-0x10, FP_OFF(lowlevel_cbreak_handler)+0x100)); /* * some tools expect this interrupt to have the same segment as the * command.com PSP, but FreeCOM is an exe... */ #else set_isr(0x23, (void interrupt(*)()) kswapContext->cbreak_hdlr); #endif #ifdef FEATURE_XMS_SWAP { isr v; get_isr(0x2e, v); if( *(unsigned char far *)v == 0xCF && !canexit) /* IRET? */ set_isr( 0x2E, ( void interrupt(*)() ) MK_FP(FP_SEG(lowlevel_int_2e_handler)-0x10, FP_OFF(lowlevel_int_2e_handler)+0x100)); } #endif result = exec(fullname, rest, 0); set_isrfct(0x23, cbreak_handler); /* Install local CBreak handler */ /* The external command might has killed the string area. */ env_nullStrings(0); setErrorLevel(result); } else error_bad_command(first); chgEnv( "CMDLINE", NULL ); }
void i8255_init() { set_isr(0x21, i8255_isr); i8255_write_command(KBD_CMD_SELECT_SCANCODE); i8255_write_data(2); }