[Prev][Next][Index][Thread]

Re: can flux oskit help me do vesa stuff?



Mike Hibler <mike@fast.cs.utah.edu> said:
>Yeah, the documentation isn't much help there.
>
>A couple of routines are documented under the libkern section:
>
>	i16_enter_pmode()
>	i16_leave_pmode()

the docs say that this doesn't do all the things intel recommends, but
i guess that is ok. i've been trying to figure out the pxe thing and
it looks like it is doing:

        load_mbr();
        boot_mbr();


load_mbr seems to call biosread(0x80, 0, 0, 1, 1, foo);
which does the interrupt like i want to do:

int biosread([snip]):
        ts.trapno       = 0x13;
[snip]
        base_real_int(&ts);


but that enters v86 or real mode?






in the next function:

        do_16bit(KERNEL_CS, KERNEL_16_CS,
                base_i16_switch_to_real_mode();
                i16_boot_mbr();
                base_i16_switch_to_pmode();
        );

which is some function in asm (i16_boot_mbr), and somehow it does
stuff. this doesn't appear to call an interrupt but it goes into real
mode.


so i came up with:

void call_interrupt_handler(struct trap_state* ts)
{
  base_real_int(ts);
}

/*
 * get the vesa info
 * function 00h using int 10h
 * 
 * put function (00h) in AX
 * put pointer to info struct in ES:DI
 * set up us the int 10h
 * get result from AX
 */

int vbe_get_info(vbe_control_info* info)
{
  ts.eax = 0x4F000000;
  ts.es = ptr_off(info);
  ts.edi = ptr_seg(info) & 0x0000FFFF;
  ts.trapno = 0x10;

  /*
    put VBE2 into struct:
    tell vesa that we want ver 3.0 which is 512-bytes
  */

  info->vesa_signature[0]='V';
  info->vesa_signature[1]='B';
  info->vesa_signature[2]='E';
  info->vesa_signature[3]='2';

  /* go to v86 mode to be able to call the interrupt */
  call_interrupt_handler(&ts);

  /* return AX register */
  return (ts.eax & 0xFFFF0000);

}



but i don't know if that is right... i can't figure out if i'm
supposed to set up that ts struct and if it will clobber whatever gcc
puts on the registers. if i try linking i get errors:

gcc -nostdlib   -c -o vga.o vga.c
gcc -nostdlib   -c -o kernel.o kernel.c
gcc -nostdlib -c -o main.o boot.S
ld -Ttext 0x100000  vga.o kernel.o /usr/lib/liboskit_c.a /usr/lib/liboskit_kern.a  main.o -o timmy
/usr/lib/liboskit_kern.a(raw_real_int.o): In function `raw_real_int':
raw_real_int.o(.text+0x18): undefined reference to `panic'
raw_real_int.o(.text+0x47): relocation truncated to fit: R_386_16 text
/usr/lib/liboskit_kern.a(i16_raw.o): In function `real_mode':
i16_raw.o(.text+0x48): relocation truncated to fit: R_386_16 text
i16_raw.o(.text+0x52): undefined reference to `atexit'
i16_raw.o(.text+0x79): relocation truncated to fit: R_386_16 text
/usr/lib/liboskit_kern.a(i16_raw.o): In function `i16_raw_switch_to_pmode':
i16_raw.o(.text+0x91): relocation truncated to fit: R_386_16 data
i16_raw.o(.text+0x95): relocation truncated to fit: R_386_16 base_i16_enable_a20
/usr/lib/liboskit_kern.a(i16_raw.o): In function `prot_jmp':
i16_raw.o(.text+0xc7): relocation truncated to fit: R_386_16 text
i16_raw.o(.text+0xdc): relocation truncated to fit: R_386_16 text
/usr/lib/liboskit_kern.a(i16_raw.o): In function `i16_raw_switch_to_real_mode':
i16_raw.o(.text+0x119): relocation truncated to fit: R_386_16 text
i16_raw.o(.text+0x14f): relocation truncated to fit: R_386_16 text
/usr/lib/liboskit_kern.a(i16_raw.o): In function `foo':
i16_raw.o(.text+0x182): relocation truncated to fit: R_386_16 base_i16_disable_a20
i16_raw.o(.text+0x18a): relocation truncated to fit: R_386_16 data
/usr/lib/liboskit_kern.a(i16_real_int.o): In function `i16_real_int':
i16_real_int.o(.text+0x16): relocation truncated to fit: R_386_16 text
/usr/lib/liboskit_kern.a(pic.o): In function `pic_enable_irq':
pic.o(.text+0x9f): undefined reference to `panic'
/usr/lib/liboskit_kern.a(pic.o): In function `pic_disable_irq':
pic.o(.text+0x126): undefined reference to `panic'
/usr/lib/liboskit_kern.a(pic.o): In function `pic_test_irq':
pic.o(.text+0x1a8): undefined reference to `panic'
/usr/lib/liboskit_kern.a(base_irq_init.o): In function `base_irq_init':
base_irq_init.o(.text+0x18): undefined reference to `panic'
/usr/lib/liboskit_kern.a(base_irq_softint_handler.o): In function `base_irq_softint_default_handler':
base_irq_softint_handler.o(.text+0x1a): undefined reference to `panic'
/usr/lib/liboskit_kern.a(i16_abort.o): In function `i16_abort':
i16_abort.o(.text+0x14): undefined reference to `i16_puts'
i16_abort.o(.text+0x24): undefined reference to `i16_puts'
/usr/lib/liboskit_kern.a(i16_exit.o): In function `i16_exit':
i16_exit.o(.text+0x15): undefined reference to `i16_puts'
/usr/lib/liboskit_kern.a(trap_dump.o): In function `trap_dump':
trap_dump.o(.text+0x28): undefined reference to `printf'
trap_dump.o(.text+0x41): undefined reference to `printf'
trap_dump.o(.text+0x65): undefined reference to `printf'
trap_dump.o(.text+0x7b): undefined reference to `printf'
trap_dump.o(.text+0xb4): undefined reference to `printf'
/usr/lib/liboskit_kern.a(trap_dump.o)(.text+0xda): more undefined references to `printf' follow
/usr/lib/liboskit_kern.a(trap_dump_panic.o): In function `trap_dump_panic':
trap_dump_panic.o(.text+0x1a): undefined reference to `panic'
/usr/lib/liboskit_kern.a(base_irq_default_handler.o): In function `base_irq_default_handler':
base_irq_default_handler.o(.text+0x15): undefined reference to `printf'
make[2]: *** [all] Error 1
make[2]: Leaving directory `/home/timmy/prgm/os/src/kernel'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/timmy/prgm/os/src'
make: *** [kernel] Error 2


i don't really know what to do...

References: