ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Unix/main_unix.cpp
(Generate patch)

Comparing SheepShaver/src/Unix/main_unix.cpp (file contents):
Revision 1.38 by gbeauche, 2004-05-31T10:55:42Z vs.
Revision 1.39 by gbeauche, 2004-06-17T05:15:25Z

# Line 485 | Line 485 | int main(int argc, char **argv)
485          BusClockSpeed = 100000000;      // Default: 100MHz
486   #if EMULATED_PPC
487          PVR = 0x000c0000;                       // Default: 7400 (with AltiVec)
488 + #elif defined(__APPLE__) && defined(__MACH__)
489 +        proc_file = popen("ioreg -c IOPlatformDevice", "r");
490 +        if (proc_file) {
491 +                char line[256];
492 +                bool powerpc_node = false;
493 +                while (fgets(line, sizeof(line) - 1, proc_file)) {
494 +                        // Read line
495 +                        int len = strlen(line);
496 +                        if (len == 0)
497 +                                continue;
498 +                        line[len - 1] = 0;
499 +
500 +                        // Parse line
501 +                        if (strstr(line, "o PowerPC,"))
502 +                                powerpc_node = true;
503 +                        else if (powerpc_node) {
504 +                                uint32 value;
505 +                                char head[256];
506 +                                if (sscanf(line, "%[ |]\"cpu-version\" = <%x>", head, &value) == 2)
507 +                                        PVR = value;
508 +                                else if (sscanf(line, "%[ |]\"clock-frequency\" = <%x>", head, &value) == 2)
509 +                                        CPUClockSpeed = value;
510 +                                else if (sscanf(line, "%[ |]\"bus-frequency\" = <%x>", head, &value) == 2)
511 +                                        BusClockSpeed = value;
512 +                                else if (strchr(line, '}'))
513 +                                        powerpc_node = false;
514 +                        }
515 +                }
516 +                fclose(proc_file);
517 +        } else {
518 +                sprintf(str, GetString(STR_PROC_CPUINFO_WARN), strerror(errno));
519 +                WarningAlert(str);
520 +        }
521   #else
522          proc_file = fopen("/proc/cpuinfo", "r");
523          if (proc_file) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines