Error with Count Memory function in FAQs

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Hillbillie

Error with Count Memory function in FAQs

Post by Hillbillie »

I'm having trouble compiling the direct-probing function that determines installed memory on the FAQ's part of this site. I'm using DJGPP. Here's the errors I'm getting:

system.c: In function `Get_Memory':
system.c:63: parse error before `:'
system.c:71: parse error before `:'
system.c:107: parse error before `:'

Line 63: __asm__ __volatile("movl %%cr0, %%eax":"=a"(cr0))::"eax");

Line 71: __asm__ __volatile__("movl %%eax, %%cr0", :: "a" (cr0 | 0x00000001 | 0x40000000 | 0x20000000) : "eax");

Line 107: __asm__ __volatile__("movl %%eax, %%cr0", :: "a" (cr0) : "eax");


Has anyone else received these errors? Please help.
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re: Error with Count Memory function in FAQs

Post by df »

gcc / gas has a habit of breaking inline asm every version. its a pain in the @$$.

also, the direct probing is REALLY BAD way to detect memory. stick to using the BIOS or motherboard chipset functionality.

its a bad way to just bomb values into the memory.. PCI cards, etc, map to high memory, etc...

if your using GRUB as a loader, stick to the values it returns.
-- Stu --
Hillbillie

Re: Error with Count Memory function in FAQs

Post by Hillbillie »

Okay, thanks.
Post Reply