[SeaBIOS] Little help with 16bit code

Daniel Castro evil.dani at gmail.com
Sun Oct 23 14:23:35 CEST 2011


Hello,

I am in the process of compiling the 16bit part of the code, I am in
need of a little help.

In my code I have some macros:
RING_GET_REQUEST(bi->private,bi->private->req_prod_pvt);
The macro translates to:
(&((bi->private)->sring->ring[((bi->private->req_prod_pvt) &
(((bi->private)->nr_ents) - 1))].req))
So should I use the macro like this in 16Bit code:
struct blkif_request *ring_req = MAKE_FLATPTR(GET_SEG(SS),
RING_GET_REQUEST(bi->private,bi->private->req_prod_pvt));

Also, nn the hypercall part the only real problem is the pointers that
I use as params in the calls, should I mask it before calling it, for
example something like:
   	evtchn_send_t send;
        send.port = bi->port;
        hypercall_event_channel_op(EVTCHNOP_send,MAKE_FLATPTR(GET_SEG(SS),
&send));
There is no limitation on the code that can run in 16Bit only memory
addressing, right?

As I undestand it, GET_SEG(SS) makes the pointer from that segment,
and the MAKE_FLATPTR makes it behave like segment:offset. Right? So I
do not have to worry beyond that point.

For now I am doing a copy from my front-ring memory buffer to op->lba
buffer, Its far from perfect but I have two advantages, first I do not
need to make/revoke permission in for inter-domain comunication, If I
were to manipulate it directly on the buffer, I would have to change
permision on every operation (fast but hard to manage). The ring gets
the permision before, so when the actual movement comes it is already
settled up. Second I am not creating any new structures, only pointers
to existing structures, which would make my 16Bit code simpler (at
least I hope).

Thanks for any contributions, I really appreciate the help, the
prototype is almost complete...

Thanks again,

Daniel

-- 
+-=====---------------------------+
| +---------------------------------+ | This space intentionally blank
for notetaking.
| |   | Daniel Castro,                |
| |   | Consultant/Programmer.|
| |   | U Andes                         |
+-------------------------------------+



More information about the SeaBIOS mailing list