
A little new post to keep you aware of the advancement of the sos framebuffer driver.
Right now, Buckman and I have finished the vm86 driver, allowing us to call 16bits bios interrupts from kernel land. Thanks to this vm we will be able to call the vesa functions, reachable only through 16 bit modes.
Bios interrupts are called just like in this piece of code, that allows us to get some infromation from the VBE:
In a second time we coded the vesa driver wich is a simple set of convenience functions. Here is the exhaustive list of vesa functions prototypes :
For the moment, we still have to work on the tty driver and the chardev /dev/fb.
To be concluded...
Right now, Buckman and I have finished the vm86 driver, allowing us to call 16bits bios interrupts from kernel land. Thanks to this vm we will be able to call the vesa functions, reachable only through 16 bit modes.
Bios interrupts are called just like in this piece of code, that allows us to get some infromation from the VBE:
vbe_info_block_t *get_vbe_info()
{
vbe_info_block_t *vbe;
sos_vm86_t regs;
memset(®s, 0, sizeof(sos_vm86_t));
regs.service = 0x10;
regs.ax = VBE_INFO;
regs.es = SOS_VM86_SEGMENT;
regs.di = vbe = sos_vm86_malloc(sizeof(*vbe));
strzcpy(vbe->vbe_signature, "VBE2", 4);
sos_vm86_bioscall(®s);
return (vbe);
}
{
vbe_info_block_t *vbe;
sos_vm86_t regs;
memset(®s, 0, sizeof(sos_vm86_t));
regs.service = 0x10;
regs.ax = VBE_INFO;
regs.es = SOS_VM86_SEGMENT;
regs.di = vbe = sos_vm86_malloc(sizeof(*vbe));
strzcpy(vbe->vbe_signature, "VBE2", 4);
sos_vm86_bioscall(®s);
return (vbe);
}
In a first time we will memset the structure to be sure it is initialised to 0. Then we will fill the vm86 structure with the data corresponding to interruption 0x10 and the data for this interruption in the virtual registers ax es and di. And then we call the function sos_vm86_bioscall that wraps around the interrupt. The data structure sos_vm86_t is defined as :
typedef struct
{
sos_ui8_t service; /* Numero de l interruption a appeler*/
sos_ui16_t ax;
sos_ui16_t bx;
sos_ui16_t cx;
sos_ui16_t dx;
sos_ui16_t si;
sos_ui16_t di;
sos_ui16_t es;
sos_ui16_t ds;
} sos_vm86_t;
{
sos_ui8_t service; /* Numero de l interruption a appeler*/
sos_ui16_t ax;
sos_ui16_t bx;
sos_ui16_t cx;
sos_ui16_t dx;
sos_ui16_t si;
sos_ui16_t di;
sos_ui16_t es;
sos_ui16_t ds;
} sos_vm86_t;
In a second time we coded the vesa driver wich is a simple set of convenience functions. Here is the exhaustive list of vesa functions prototypes :
void init_vesa(sos_ui16_t mode);
vbe_info_block_t *get_vbe_info();
void map_lfb(mode_info_block_t *mib);
void set_display(sos_ui16_t mode);
mode_info_block_t *get_mib_info(sos_ui16_t mode, vbe_info_block_t *vbe);
sos_bool_t is_mode_usable( sos_ui16_t mode, vbe_info_block_t *vbe);
void vesa_clear_screen(mode_info_block_t *mib, sos_ui32_t color);
void vesa_draw_rect(sos_ui32_t startx, sos_ui32_t starty, sos_ui32_t
height, sos_ui32_t width, mode_info_block_t *mib,
sos_ui32_t color);
void vesafont_draw_text(const char* s, sos_ui32_t x, sos_ui32_t y,
sos_ui32_t fg, sos_ui32_t bg,
mode_info_block_t *mib);
void vesa_draw_bitmap(sos_ui32_t x, sos_ui32_t y, sos_vaddr_t *img);
void vesa_plot_pixel(sos_ui32_t x, sos_ui32_t y, mode_info_block_t *mib,
sos_ui32_t color);
It represents our virtual machine with a set of register and the id of the interrupt to call.vbe_info_block_t *get_vbe_info();
void map_lfb(mode_info_block_t *mib);
void set_display(sos_ui16_t mode);
mode_info_block_t *get_mib_info(sos_ui16_t mode, vbe_info_block_t *vbe);
sos_bool_t is_mode_usable( sos_ui16_t mode, vbe_info_block_t *vbe);
void vesa_clear_screen(mode_info_block_t *mib, sos_ui32_t color);
void vesa_draw_rect(sos_ui32_t startx, sos_ui32_t starty, sos_ui32_t
height, sos_ui32_t width, mode_info_block_t *mib,
sos_ui32_t color);
void vesafont_draw_text(const char* s, sos_ui32_t x, sos_ui32_t y,
sos_ui32_t fg, sos_ui32_t bg,
mode_info_block_t *mib);
void vesa_draw_bitmap(sos_ui32_t x, sos_ui32_t y, sos_vaddr_t *img);
void vesa_plot_pixel(sos_ui32_t x, sos_ui32_t y, mode_info_block_t *mib,
sos_ui32_t color);
For the moment, we still have to work on the tty driver and the chardev /dev/fb.
To be concluded...

0 comments:
Post a Comment