4 #define addr(t) (((t & 0xffff0000) >> 12) + (t & 0x0000ffff))
6 #define vbeib_get_string(name) \
11 ib->name = t - lbuf; \
12 } else if (t > 0xa0000 && fsize > 0) { \
13 strncpy((char*)buf, vptr(t), fsize); \
14 ib->name = tsk->buf_len - fsize; \
15 l = strlen((char*)buf); \
25 int v86_task(struct uvesafb_task
*tsk
, u8
*buf
)
29 ulog(LOG_DEBUG
, "task flags: 0x%.2lx\n", tsk
->flags
);
30 ulog(LOG_DEBUG
, "EAX=%.8lx EBX=%.8lx ECX=%.8lx EDX=%.8lx\n",
31 tsk
->regs
.eax
, tsk
->regs
.ebx
, tsk
->regs
.ecx
, tsk
->regs
.edx
);
32 ulog(LOG_DEBUG
, "ESP=%.8lx EBP=%.8lx ESI=%.8lx EDI=%.8lx\n",
33 tsk
->regs
.esp
, tsk
->regs
.ebp
, tsk
->regs
.esi
, tsk
->regs
.edi
);
35 /* Get the VBE Info Block */
36 if (tsk
->flags
& TF_VBEIB
) {
42 lbuf
= v86_mem_alloc(tsk
->buf_len
);
43 memcpy(vptr(lbuf
), buf
, tsk
->buf_len
);
44 tsk
->regs
.es
= lbuf
>> 4;
45 tsk
->regs
.edi
= 0x0000;
47 if (v86_int(0x10, &tsk
->regs
) || (tsk
->regs
.eax
& 0xffff) != 0x004f)
50 ib
= (struct vbe_ib
*)buf
;
51 bufend
= lbuf
+ sizeof(*ib
);
52 memcpy(buf
, vptr(lbuf
), tsk
->buf_len
);
54 /* The original VBE Info Block is 512 bytes long. */
55 fsize
= tsk
->buf_len
- 512;
57 t
= addr(ib
->mode_list_ptr
);
58 /* Mode list is in the buffer, we're good. */
60 ulog(LOG_DEBUG
, "The mode list is in the buffer at %.8x.", t
);
61 ib
->mode_list_ptr
= t
- lbuf
;
63 /* Mode list is in the ROM. We copy as much of it as we can
64 * to the task buffer. */
65 } else if (t
> 0xa0000) {
68 ulog(LOG_DEBUG
, "The mode list is in the Video ROM at %.8x", t
);
70 td
= (u16
*) (buf
+ 512);
72 while (fsize
> 2 && (tmp
= v_rdw(t
)) != 0xffff) {
79 ib
->mode_list_ptr
= 512;
82 /* Mode list is somewhere else. We're seriously screwed. */
84 ulog(LOG_ERR
, "Can't retrieve mode list from %x\n", t
);
85 ib
->mode_list_ptr
= 0;
90 vbeib_get_string(oem_string_ptr
);
91 vbeib_get_string(oem_vendor_name_ptr
);
92 vbeib_get_string(oem_product_name_ptr
);
93 vbeib_get_string(oem_product_rev_ptr
);
98 lbuf
= v86_mem_alloc(tsk
->buf_len
);
99 memcpy(vptr(lbuf
), buf
, tsk
->buf_len
);
102 if (tsk
->flags
& TF_BUF_ESDI
) {
103 tsk
->regs
.es
= lbuf
>> 4;
104 tsk
->regs
.edi
= 0x0000;
107 if (tsk
->flags
& TF_BUF_ESBX
) {
108 tsk
->regs
.es
= lbuf
>> 4;
109 tsk
->regs
.ebx
= 0x0000;
112 if (v86_int(0x10, &tsk
->regs
) || (tsk
->regs
.eax
& 0xffff) != 0x004f)
115 if (tsk
->buf_len
&& tsk
->flags
& TF_BUF_RET
) {
116 memcpy(buf
, vptr(lbuf
), tsk
->buf_len
);