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.
I'm not very familiar with the AT&T syntax but I think the mistake is one line later. 0 is a constant value and I think in the AT&T syntax you have to use a Dollarsign before each constant. Try if this code works:
I tried your code here, with %1 changed to %0, and with the 4%0 and 8%0 corrections, but when I print the string I get just one ASCII character out. It was the white smileyface at position 0,1 in this chart
I tried it in both Bochs and on my Pentium III 1GHz, but the same output. Did you get it to work properly?
Well, I got the inline ASM problem worked out as above, but the CPUID code I had I dropped because I needed to go back and gain a better understanding of what was being done earlier in my kernel. Therefore I sorta scrapped and am rebuliding the kernel. I can, however, give you a nice place for the CPUID function....
int main(void)
{
printf("CPU Family detector v0.0.1\n\nCPU Type:\t");
DetectCPUFamily();
}
To compile:
gcc -c FILENAME.C
Link and make exe:
gcc -o EXENAME FILENAME.O
About putting 1 in %eax, or 2, as intial value, here is what intel maual 2 says,
Initial Information Provided about the Processor
EAX
Value
0 EAX-Maximum CPUID Input Value (2 for the P6
family processors and 1 for the Pentium ?
processor and the later versions of Intel486?
processor that support the CPUID instruction).
EBX-"Genu"
ECX-"ntel"
EDX-"ineI"
1 EAX- Version Information (Type, Family, Model, and
Stepping ID)
EBX- Reserved
ECX- Reserved
EDX- Feature Information
2 EAX- Cache and TLB Information
EBX- Cache and TLB Information
ECX- Cache and TLB Information
EDX- Cache and TLB Information
See pg 3-111 ( as per Acrobat viewer - Page 151) of Intel Architecture Software Developer?s Manual Volume 2:Instruction Set Reference.
Thanks for suggestion for using objdump / ndiasmw. Never came to my mind.
Well other than that my question is can I use NASM for Windows for OS developement? or should I use DJGPP ? I am using DJGPP GCC for OS. is there any clear and distinct advantage for choosing one over another? any links or pointers welcome!
Thanks!
BTW, code you mentioned give compile time error to me too!