3 #define addr(t) (((t & 0xffff0000) >> 12) + (t & 0x0000ffff))
5 #define vbeib_get_string(name) \
10 ib->name = t - (u32)lbuf; \
11 } else if (t > 0xa0000 && fsize > 0) { \
12 strncpy((char*)buf, (char*)t, fsize); \
13 ib->name = tsk->buf_len - fsize; \
14 l = strlen((char*)t); \
24 int v86_task(struct uvesafb_task
*tsk
, u8
*buf
)
28 /* Get the VBE Info Block */
29 if (tsk
->flags
& TF_VBEIB
) {
35 lbuf
= v86_mem_alloc(tsk
->buf_len
);
36 memcpy(lbuf
, buf
, tsk
->buf_len
);
37 tsk
->regs
.es
= (u32
)lbuf
>> 4;
38 tsk
->regs
.edi
= 0x0000;
40 if (v86_int(0x10, &tsk
->regs
) || (tsk
->regs
.eax
& 0xffff) != 0x004f)
43 ib
= (struct vbe_ib
*)buf
;
44 bufend
= (u32
)(lbuf
+ sizeof(*ib
));
45 memcpy(buf
, lbuf
, tsk
->buf_len
);
47 /* The original VBE Info Block is 512 bytes long. */
48 fsize
= tsk
->buf_len
- 512;
50 t
= addr(ib
->mode_list_ptr
);
51 /* Mode list is in the buffer, we're good. */
53 ib
->mode_list_ptr
= t
- (u32
)lbuf
;
55 /* Mode list is in the ROM. We copy as much of it as we can
56 * to the task buffer. */
57 } else if (t
> 0xa0000) {
59 td
= (u16
*) (buf
+ 512);
61 while (fsize
> 2 && *ts
!= 0xffff) {
68 ib
->mode_list_ptr
= 512;
71 /* Mode list is somewhere else. We're seriously screwed. */
73 ulog("Can't retrieve mode list from %x\n", t
);
74 ib
->mode_list_ptr
= 0;
79 vbeib_get_string(oem_string_ptr
);
80 vbeib_get_string(oem_vendor_name_ptr
);
81 vbeib_get_string(oem_product_name_ptr
);
82 vbeib_get_string(oem_product_rev_ptr
);
87 lbuf
= v86_mem_alloc(tsk
->buf_len
);
88 memcpy(lbuf
, buf
, tsk
->buf_len
);
91 if (tsk
->flags
& TF_BUF_ESDI
) {
92 tsk
->regs
.es
= (u32
)lbuf
>> 4;
93 tsk
->regs
.edi
= 0x0000;
96 if (tsk
->flags
& TF_BUF_ESBX
) {
97 tsk
->regs
.es
= (u32
)lbuf
>> 4;
98 tsk
->regs
.ebx
= 0x0000;
101 if (v86_int(0x10, &tsk
->regs
) || (tsk
->regs
.eax
& 0xffff) != 0x004f)
104 if (tsk
->buf_len
&& tsk
->flags
& TF_BUF_RET
) {
105 memcpy(buf
, lbuf
, tsk
->buf_len
);