5 #define addr(t) (((t & 0xffff0000) >> 12) + (t & 0x0000ffff))
7 void rconv_vm86_to_LRMI(struct vm86_regs
*rs
, struct LRMI_regs
*rd
)
9 memset(rd
, 0, sizeof(*rd
));
19 rd
->flags
= rs
->eflags
;
28 void rconv_LRMI_to_vm86(struct LRMI_regs
*rs
, struct vm86_regs
*rd
)
38 rd
->eflags
= rs
->flags
;
48 int err
= LRMI_init();
53 return (err
== 1) ? 0 : 1;
62 * Perform a simulated interrupt call.
64 int v86_int(int num
, struct vm86_regs
*regs
)
69 rconv_vm86_to_LRMI(regs
, &r
);
70 err
= LRMI_int(num
, &r
);
71 rconv_LRMI_to_vm86(&r
, regs
);
73 return (err
== 1) ? 0 : 1;
76 #define vbeib_get_string(name) \
79 ulog("%x %x\n", t, bufend); \
81 ib->name = t - (u32)lbuf; \
87 int v86_task(struct uvesafb_task
*tsk
, u8
*buf
)
91 /* Get the VBE Info Block */
92 if (tsk
->flags
& TF_VBEIB
) {
96 lbuf
= LRMI_alloc_real(tsk
->buf_len
);
97 memcpy(lbuf
, buf
, tsk
->buf_len
);
98 tsk
->regs
.es
= (u32
)lbuf
>> 4;
99 tsk
->regs
.edi
= 0x0000;
101 if (v86_int(0x10, &tsk
->regs
) || (tsk
->regs
.eax
& 0xffff) != 0x004f)
104 ib
= (struct vbe_ib
*)buf
;
105 bufend
= (u32
)(lbuf
+ sizeof(struct vbe_ib
));
106 memcpy(buf
, lbuf
, tsk
->buf_len
);
108 vbeib_get_string(oem_string_ptr
);
109 vbeib_get_string(oem_vendor_name_ptr
);
110 vbeib_get_string(oem_product_name_ptr
);
111 vbeib_get_string(oem_product_rev_ptr
);
112 vbeib_get_string(mode_list_ptr
);
114 LRMI_free_real(lbuf
);
117 lbuf
= LRMI_alloc_real(tsk
->buf_len
);
118 memcpy(lbuf
, buf
, tsk
->buf_len
);
121 if (tsk
->flags
& TF_BUF_ESDI
) {
122 tsk
->regs
.es
= (u32
)lbuf
>> 4;
123 tsk
->regs
.edi
= 0x0000;
126 if (tsk
->flags
& TF_BUF_ESBX
) {
127 tsk
->regs
.es
= (u32
)lbuf
>> 4;
128 tsk
->regs
.ebx
= 0x0000;
131 if (v86_int(0x10, &tsk
->regs
) || (tsk
->regs
.eax
& 0xffff) != 0x004f)
134 if (tsk
->buf_len
&& tsk
->flags
& TF_BUF_RET
) {
135 memcpy(buf
, lbuf
, tsk
->buf_len
);
139 LRMI_free_real(lbuf
);