Annotation of coherent/d/PS2_KERNEL/tools/setfpe.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * setfpe - turn 80x87 support on/off
        !             3:  *
        !             4:  * All this program really does is tell the kernel to set or
        !             5:  * clear bit 2 of cr0.
        !             6:  *
        !             7:  * Usage:  setfpe {off|on}
        !             8:  *
        !             9:  * When "off", floating poing instructions will cause trap #7 (DNA),
        !            10:  * with signal 8 (SIGFPE).
        !            11:  */
        !            12: #include <stdio.h>
        !            13: #include <sys/param.h>
        !            14: 
        !            15: char * cmd;
        !            16: 
        !            17: main(argc, argv)
        !            18: int argc;
        !            19: char ** argv;
        !            20: {
        !            21:        int a2, res;
        !            22: 
        !            23:        cmd = argv[0];
        !            24:        if (argc != 2)
        !            25:                usage();
        !            26:        if (strcmp(argv[1], "on") == 0)
        !            27:                a2 = 1;
        !            28:        else if (strcmp(argv[1], "off") == 0)
        !            29:                a2 = 0;
        !            30:        else
        !            31:                usage();
        !            32:        res = cohcall(COH_SETFPE, a2);
        !            33:        if (res == -1)
        !            34:                perror("setfpe");
        !            35: }
        !            36: 
        !            37: usage()
        !            38: {
        !            39:        fprintf(stderr, "Usage: %s {off|on}\n", cmd);
        !            40:        exit(1);
        !            41: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.