Пример #1
0
static INLINE
void drawpixel(int x,int y,GrxColor color)
{
        GR_int32u offs;
        char *p0,*p1,*p2;
        GRX_ENTER();
        offs = FOFS(x,y,CURC->gc_line_offset);
        p0 = &CURC->gc_base_address.plane0[offs];
        p1 = &CURC->gc_base_address.plane1[offs];
        p2 = &CURC->gc_base_address.plane2[offs];
        switch(C_OPER(color)) {
          case C_XOR: poke_b_xor(p0,RD24BYTE(color,0));
                      poke_b_xor(p1,RD24BYTE(color,1));
                      poke_b_xor(p2,RD24BYTE(color,2));
                      break;
          case C_OR:  poke_b_or(p0,RD24BYTE(color,0));
                      poke_b_or(p1,RD24BYTE(color,1));
                      poke_b_or(p2,RD24BYTE(color,2));
                      break;
          case C_AND: poke_b_and(p0,RD24BYTE(color,0));
                      poke_b_and(p1,RD24BYTE(color,1));
                      poke_b_and(p2,RD24BYTE(color,2));
                      break;
          default:    poke_b(p0,RD24BYTE(color,0));
                      poke_b(p1,RD24BYTE(color,1));
                      poke_b(p2,RD24BYTE(color,2));
                      break;
        }
        GRX_LEAVE();
}
Пример #2
0
static void swapbytes(GR_int8 *b1, GR_int8 *b2) {
  GR_int8 b;
  GRX_ENTER();
  b = peek_b(b1);
  poke_b(b1, peek_b(b2));
  poke_b(b2, b);
  GRX_LEAVE();
}
Пример #3
0
void test_isr_2_process_2(PROCESS self, PARAM param)
{
    /* screen_offset points to the "Z" of process 2 */
    MEM_ADDR screen_offset = 0xb8000 + 5 * 160 + 2 * 11;

    while (42) {
        if (test_isr_2_check_sum == 80000)
	    return_to_boot();
        test_isr_2_check_sum ++;
        poke_b(screen_offset, peek_b(screen_offset) + 1);
    }
}
Пример #4
0
void dummy_timer_isr ()
{
    /*
     *		push	%eax		; Push context
     *          push    %ecx
     *          push    %edx
     *          push    %ebx
     *          push    %ebp
     *          push    %esi
     *          push    %edi
     */
    asm ("timer_isr:");
    asm ("push %eax");
    asm ("push %ecx");
    asm ("push %edx");
    asm ("push %ebx");
    asm ("push %ebp");
    asm ("push %esi");
    asm ("push %edi");
    if (!counter--) {
	counter = 20;
	poke_b(screen_offset_for_timer_isr,
	       peek_b(screen_offset_for_timer_isr) + 1);
        check_sum ++;
    }
    
    /*
     *		movb	$0x20,%al	; Reset interrupt controller
     *		outb	%al,$0x20
     *		pop	%edi	        ; Restore previously saved context
     *          pop     %esi
     *          pop     %ebp
     *          pop     %ebx
     *          pop     %edx
     *          pop     %ecx
     *          pop     %eax
     *		iret			; Return to interrupted program
     */
    asm ("movb  $0x20,%al");
    asm ("outb  %al,$0x20");
    asm ("pop	%edi");
    asm ("pop   %esi");
    asm ("pop   %ebp");
    asm ("pop   %ebx");
    asm ("pop   %edx");
    asm ("pop   %ecx");
    asm ("pop   %eax");
    asm ("iret");
}
Пример #5
0
void test_isr_1()
{
    MEM_ADDR screen_offset_for_boot_proc = 0xb8000 + 4 * 160 + 2 * 11;
    volatile int flag;
    
    test_reset();
    check_sum = 0;
    init_interrupts();
    DISABLE_INTR(flag);
    init_idt_entry(TIMER_IRQ, timer_isr);
    kprintf("=== test_isr_1 === \n");
    kprintf("This test will take a while.\n\n");
    kprintf("Timer ISR: A\n");
    kprintf("Boot proc: Z\n");
    ENABLE_INTR(flag);

    int i;
    for (i = 1; i < 700000; i++)
	poke_b(screen_offset_for_boot_proc,
	       peek_b(screen_offset_for_boot_proc) + 1);

    if (check_sum == 0)
	test_failed(70);
}