//------------------------------------------------------------------- // issuesmi.cpp // // This program uses services of our 'smram.c' device-driver to // trigger a System Management Interrupt on the processor whose // id-number is supplied as a command-line argument. // // compile using: $ g++ issuesmi.cpp -o issuesmi // execute using: $ ./issuesmi // // programmer: ALLAN CRUSE // date begun: 07 DEC 2008 //------------------------------------------------------------------- #include // for perror() #include // for open() #include // for atoi(), exit() #include // for ioctl() char devname[] = "/dev/smram"; int main( int argc, char **argv ) { int request = 0; // no destination-shorthand long cpu = 0; // default processor number // setup processor-number from command-line argument if ( argc > 1 ) cpu = atoi( argv[1] ) & 0xFF; // open the device-file int fd = open( devname, O_RDWR ); if ( fd < 0 ) { perror( devname ); exit(1); } // issue a System Management Interrupt to the processor if ( ioctl( fd, request, cpu ) < 0 ) perror( "ioctl" ); }