[syslinux] Com32 error?

H. Peter Anvin hpa at zytor.com
Mon Nov 18 16:19:41 PST 2002


G. Murali Krishnan wrote:
> 
> #define SEGMENT(ptr) ((unsigned int)((long)(ptr) >> 16))
> #define OFFSET(ptr)  ((unsigned int)(((long)(ptr)) & 0xFFFF))
> 

I bet this is your problem.  These definitions are incorrect when
dealing with a pointer in linearized form (like a standard 32-bit
pointer.)  Rather, you want:


static inline uint16_t SEG(void *__p)
{
  return (uint16_t)(((uint32_t)__p) >> 4);
}

static inline uint16_t OFFS(void *__p)
{
  return (uint16_t)__p & 0x000F;
}

So a pointer of 0x12345 becomes 0x1234:0x0005.

I'm creating a different hello world program to test with, per your
suggestion.

	-hpa




More information about the Syslinux mailing list