//------------------------------------------------------------------- // overrun.cpp // // This program executes the 'bound' instruction to check array // bounds in a case where the 'out-of-bounds' condition obtains // in order to trigger the array-bounds exception (interrupt-5) // that we could observe if running our 'activity.cpp' program. // // to compile: $ g++ overrun.cpp -o overrun // to execute: $ ./overrun // // programmer: ALLAN CRUSE // written on: 01 SEP 2009 //------------------------------------------------------------------- int limits[ 2 ] = { 0x00000000, 0x00001000 }; int main( int argc, char **argv ) { asm(" mov $0x2000, %eax \n bound %eax, limits "); }