00001
00002
00003
00004
00005
00006
00007
00008 #include <utility/ostream.h>
00009 #include <cpu.h>
00010
00011 __USING_SYS
00012
00013 int main()
00014 {
00015 OStream cout;
00016 cout << "IA32 test\n";
00017
00018 IA32 cpu;
00019
00020 {
00021 volatile bool lock = false;
00022 if(cpu.tsl(lock))
00023 cout << "tsl(): doesn't function properly!\n";
00024 else
00025 if(cpu.tsl(lock))
00026 cout << "tsl(): ok\n";
00027 else
00028 cout << "tsl(): doesn't function properly!\n";
00029 }
00030 {
00031 volatile int number = 100;
00032 volatile int tmp;
00033 if((tmp = cpu.finc(number)) != 100)
00034 cout << "finc(): doesn't function properly (n=" << tmp
00035 << ", should be 100)!\n";
00036 else
00037 if((tmp = cpu.finc(number)) != 101)
00038 cout << "finc(): doesn't function properly (n=" << tmp
00039 << ", should be 101)!\n";
00040 else
00041 cout << "finc(): ok\n";
00042 }
00043 {
00044 volatile int number = 100;
00045 volatile int tmp;
00046 if((tmp = cpu.fdec(number)) != 100)
00047 cout << "fdec(): doesn't function properly (n=" << tmp
00048 << ", should be 100)!\n";
00049 else
00050 if((tmp = cpu.fdec(number)) != 99)
00051 cout << "fdec(): doesn't function properly (n=" << tmp
00052 << ", should be 99)!\n";
00053 else
00054 cout << "fdec(): ok\n";
00055 }
00056
00057
00058 cout << "IA32 test finished\n";
00059 return 0;
00060 }