Last active
          November 13, 2020 14:52 
        
      - 
      
 - 
        
Save gordonturner/c33bcc935e32f9fa6695 to your computer and use it in GitHub Desktop.  
Revisions
- 
        
gordonturner revised this gist
Mar 7, 2016 . 1 changed file with 12 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ KVM OSX Guest SMC Read ====================== - 2015-02-20: OX 10.10.5 on Apple hardware can successfully build - NOTE: Credit and thanks to Amit Singh - Reference: @@ -90,7 +90,17 @@ gcc -Wall -o smc_read smc_read.c -framework IOKit ./smc_read ``` - On 2015-12-09 output is: ``` ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc ``` - Reference: http://www.osxbook.com/book/bonus/chapter7/tpmdrmmyth/ https://bbs.archlinux.org/viewtopic.php?id=162768 Error Compiling  - 
        
gordonturner revised this gist
Mar 6, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ KVM OSX Guest SMC Read ====================== - 2015-02-20: OX 10.11.1 on Apple hardware works - NOTE: Credit and thanks to Amit Singh - Reference:  - 
        
gordonturner revised this gist
Feb 20, 2016 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,7 @@ KVM OSX Guest SMC Read ====================== - 2015-02-20: OX 10.10.5 on Apple hardware works - NOTE: Credit and thanks to Amit Singh - Reference:  - 
        
gordonturner revised this gist
Feb 20, 2016 . 1 changed file with 1 addition and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,5 @@ - 2015-12-09: OX 10.10.5 on Apple hardware works - NOTE: Credit and thanks to Amit Singh - Reference: http://www.osxbook.com/book/bonus/chapter7/tpmdrmmyth/  - 
        
gordonturner revised this gist
Feb 20, 2016 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,5 @@ - 2016-02-20 with OX 10.11.3 works - OSX, running on Apple hardware - NOTE: Credit and thanks to Amit Singh  - 
        
gordonturner renamed this gist
Feb 20, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. - 
        
gordonturner created this gist
Feb 20, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,112 @@ - OSX, running on Apple hardware - 2016-02-20 with OX 10.11.3 works - NOTE: Credit and thanks to Amit Singh - Reference: http://www.osxbook.com/book/bonus/chapter7/tpmdrmmyth/ Build ----- - Create `smc_read.c` and paste in code: ``` vi smc_read.c ``` ``` /* * smc_read.c: Written for Mac OS X 10.5. Compile as follows: * * gcc -Wall -o smc_read smc_read.c -framework IOKit */ #include <stdio.h> #include <IOKit/IOKitLib.h> typedef struct { uint32_t key; uint8_t __d0[22]; uint32_t datasize; uint8_t __d1[10]; uint8_t cmd; uint32_t __d2; uint8_t data[32]; } AppleSMCBuffer_t; int main(void) { io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("AppleSMC")); if (!service) return -1; io_connect_t port = (io_connect_t)0; kern_return_t kr = IOServiceOpen(service, mach_task_self(), 0, &port); IOObjectRelease(service); if (kr != kIOReturnSuccess) return kr; AppleSMCBuffer_t inputStruct = { 'OSK0', {0}, 32, {0}, 5, }, outputStruct; size_t outputStructCnt = sizeof(outputStruct); kr = IOConnectCallStructMethod((mach_port_t)port, (uint32_t)2, (const void*)&inputStruct, sizeof(inputStruct), (void*)&outputStruct, &outputStructCnt); if (kr != kIOReturnSuccess) return kr; int i = 0; for (i = 0; i < 32; i++) printf("%c", outputStruct.data[i]); inputStruct.key = 'OSK1'; kr = IOConnectCallStructMethod((mach_port_t)port, (uint32_t)2, (const void*)&inputStruct, sizeof(inputStruct), (void*)&outputStruct, &outputStructCnt); if (kr == kIOReturnSuccess) for (i = 0; i < 32; i++) printf("%c", outputStruct.data[i]); printf("\n"); return IOServiceClose(port); } ``` - Compile: ``` gcc -Wall -o smc_read smc_read.c -framework IOKit ``` - Run: ``` ./smc_read ``` - On 2015-12-09 output is a constant value Error Compiling --------------- - Error message: ``` 2015-12-09 19:47:32.799 xcodebuild[9169:2013175] [MT] PluginLoading: Required plug-in compatibility UUID 7265231C-39B4-402C-89E1-16167C4CC990 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/OFPlugin.xcplugin' not present in DVTPlugInCompatibilityUUIDs ``` - Confirm that Xcode command line tools are installed: ``` xcode-select --install ```