[syslinux] [Syslinux-GSoC] Exporting real-mode functions
H. Peter Anvin
hpa at zytor.com
Mon Jun 1 22:18:42 PDT 2009
liu Aleaxander wrote:
>
> then in the cache.c
> void getoneblk(char *buf, __u32 block, int block_size)
> {
> int sec_per_block = block_size / 512; /* 512==sector size */
> uint16_t fun_seg, fun_off;
> com32sys_t regs;
>
> //extern void (*getlinsec) ();
>
> regs.eax.l = block * sec_per_block;
> regs.ebp.l = sec_per_block;
> regs.es <http://regs.es> = SEG(buf);
> regs.ebx.w[0] = OFFS(buf);
>
> fun_seg = SEG(getlinsec);
> fun_off = OFFS(getlinsec);
>
> __farcall(fun_seg, fun_off, ®s, NULL);
> }
>
> it says getlinsec not defined.
>
Ah.
On the C side, you want to do this:
void getlinsec(void); /* Prototype */
/* ... */
__farcall(0, (size_t)getlinsec, ®s, NULL);
This is really hideously ugly in terms of syntax, so I just checked in a
wrapper called call16():
call16(getlinsec, ®s, NULL);
You still need the prototype as shown. It really should be put into
core.h or another header file.
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
More information about the Syslinux
mailing list