[syslinux] Com32 api problem !

PERRIN Jean-Luc perrinjl at wanadoo.fr
Tue Mar 25 10:48:52 PDT 2008


(sorry for my english if it is approximate !)

I want to access harddisk from com32 api with PXELINUX.
I try to use int 13h Extended Read Drive Parameters (48h), it doesn't works.
Here is my code, I have an error 1 in AH return code.
Int 13h Read Drive Parameters (08h) work well.

*******************************************************************************************
struct params {
  unsigned short size,info;
  unsigned long cylinders,heads,sectors;
  unsigned long long int total;
  unsigned short bytes;
} disk;

void ExtDiskInfo(int n)
{
  printf("ExtDiskInfo entry.\n");

  com32sys_t regs;
  memset(&regs,0,sizeof(regs));

  regs.eax.b[1] = 0x48;
  regs.edx.b[0] = 0x80 + n;
  regs.ds = SEG(__com32.cs_bounce);
  regs.esi.w[0]  = OFFS(__com32.cs_bounce);
  __intcall(0x13,&regs,&regs);

  if (regs.eax.b[1] == 0)
  {
    memcpy(&disk,__com32.cs_bounce,sizeof(struct params));
    size = disk.total * disk.bytes;
    printf("Total hard disk size : %lld Mb (%lld sectors)\n",size>>20,disk.total);
  }
  else printf("Disk %d error : %d\n",n,regs.eax.b[1]);

  printf("ExtDiskInfo exit.\n");
}

*******************************************************************************************

Someone has a hint ?

Thanks.
PJL.



More information about the Syslinux mailing list