delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/08/06/18:01:28

From: "dac" <ac_nospam_ AT turdera DOT com DOT ar>
Newsgroups: comp.os.msdos.djgpp
Subject: Problem using inline assembly
Date: Mon, 6 Aug 2001 18:21:17 -0300
Lines: 46
Message-ID: <9kn1l5$57rnq$1@ID-84876.news.dfncis.de>
NNTP-Posting-Host: host007014.arnet.net.ar (200.45.7.14)
X-Trace: fu-berlin.de 997132774 5500666 200.45.7.14 (16 [84876])
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I've tried to make this little program which uses BIOS service
0xe820 to get the memory map, but my structure isn't filled...
Could someone tell me what I'm doing wrong? I tested it
in asm and work perfectly...

---
#include <stdio.h>

int main(void)
{
    static struct _map {
        unsigned long long base;
        unsigned long long len;
        unsigned long type;
    } map __attribute__((__packed__)) = {0LL, 0LL, 0xbadbadL};

    unsigned long int eax, ebx = 0;

    do {
      asm volatile (
         "movl $0x0000e820, %%eax \n"
         "movl $0x534d4150, %%edx \n"
         "movl $0x20, %%ecx       \n"
         "int $0x15               \n"
      : "=a"(eax), "=b"(ebx)
      : "D"(&map), "b"(ebx));


    printf("base = %llu\t size = %llu\ttype = %lx\n",
          map.base, map.len, map.type);

    } while ((eax == 0x534d4150) && (ebx != 0));

    return 0;
}


---

Greetings,
David.

Reply: remove the _nospam_



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019