A question was asked on the IRC channel about how to get the address of a real-mode symbol -- or any assembly symbol in general. The answer is that you have to declare it global. In NASM syntax: global func func: In GAS syntax: .globl func func: -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
liu Aleaxander
2009-Jun-02 04:59 UTC
[syslinux] [Syslinux-GSoC] Exporting real-mode functions
On Tue, Jun 2, 2009 at 12:55 AM, H. Peter Anvin <hpa at zytor.com> wrote:> A question was asked on the IRC channel about how to get the address of > a real-mode symbol -- or any assembly symbol in general. > > The answer is that you have to declare it global. > > In NASM syntax: > > global func > func: > > In GAS syntax: > > .globl func > func: > >well, in fact, I did it but failed. in diskstart.inc global getlinsec getlinsec: 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 = 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. -- regards liu Aleaxander