[syslinux] [Syslinux-GSoC] Exporting real-mode functions

liu Aleaxander aleaxander at gmail.com
Tue Jun 2 01:43:19 PDT 2009


On Tue, Jun 2, 2009 at 1:18 PM, H. Peter Anvin <hpa at zytor.com> wrote:

> 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, &regs, 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, &regs, NULL);
>
>
> This is really hideously ugly in terms of syntax, so I just checked in a
> wrapper called call16():
>
>        call16(getlinsec, &regs, NULL);
>
> You still need the prototype as shown.  It really should be put into
> core.h or another header file.
>

well, I have to say it alos does not work.

I have published the code on my git
web<http://git.zytor.com/?p=users/liu/gsoc09_liu.git>.(seems
I'm not skill at git either)
here is the commit<http://git.zytor.com/?p=users/liu/gsoc09_liu.git;a=commit;h=5e45fe5a4284dd362bbccd71bebaa3838d77591b>
:

here is the comment:
Convert the cache code to C and implement the core printf function

for the cahce part, I do get the error message says that undefined reference
to `getlinsec'. I'm abort to implement a C version one.

for the printf function, it works somehow, but doesn't work well. With the
test,
it seems it can NOT(sorry for the wrong typing on the git web) handle the
format output correctly. And I haven't debugged it, so I have no idea for
now.



-- 
regards
liu Aleaxander



More information about the Syslinux mailing list