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.
kernel.c: In function `K_initmemman':
kernel.c:73: syntax error before ':' token
kernel.c:81: syntax error before ':' token
kernel.c:110: syntax error before ':' token
I have commented in the code where these lines occur.
That bold parenthesis is closing the parenthesis following volatile, which you don't want. If you count, you'll notice you have a total of two opening and three closing parens. Also, note that there should be two more underscores after volatile, so it should be __volatile__
Just as a minor note, it may have been useful to use [tt]#line[/tt] directives rather than comments, in this case, as it would allow you to more specifically indicate the error locations, like this:
kernel.c:73: can't find a register in class `AREG' while reloading `asm'
kernel.c:81: can't find a register in class `AREG' while reloading `asm'
kernel.c:110: can't find a register in class `AREG' while reloading `asm'
int count_memory(void)
{
register unsigned long *mem;
unsigned long bse_end;
unsigned long mem_count;
unsigned long a;
unsigned short memkb;
unsigned long mem_end;
mem_count=0;
memkb=0;
do
{
memkb++;
mem_count+=1024*1024;
mem=(unsigned long*)mem_count;
a=*mem;
*mem=0x55AA55AA;
// the empty asm calls tell gcc not to rely on whats in its registers
// as saved variables (this gets us around GCC optimisations)
asm("":::"memory");
if(*mem!=0x55AA55AA)
mem_count=0;
else
{
*mem=0xAA55AA55;
asm("":::"memory");
if(*mem!=0xAA55AA55)
mem_count=0;
}
asm("":::"memory");
*mem=a;
}while(memkb<4096 && mem_count!=0);
mem_end=memkb<<20;
mem=(unsigned long*)0x413;
bse_end=((*mem)&0xFFFF)<<6;
return memkb;
}
kernel.c:73: can't find a register in class `AREG' while reloading `asm'
kernel.c:81: can't find a register in class `AREG' while reloading `asm'
kernel.c:110: can't find a register in class `AREG' while reloading `asm'
?
I'm not sure the exact details, but basically it's because you're clobbering eax, and the compiler wants it. Why not just let gcc pick a register for you instead of forcing eax? Change the three lines to those that follow:
kernel.c:73: can't find a register in class `AREG' while reloading `asm'
kernel.c:81: can't find a register in class `AREG' while reloading `asm'
kernel.c:110: can't find a register in class `AREG' while reloading `asm'
?
not sure, but it looks strange to me that you have "eax" declared as "clobbered register' and as "output register". It doesn't sound like a good idea to me ...