[video member=miotatsu stream_platform=twitch project=riscy title="Searching Raw Memory for Unix Timestamps" vod_platform=youtube id=QqMESe9o1W4 annotator=Miblo] [0:06][Recap and set the stage for the day[ref site="SiFive Forums" page="Lots of Questions… (RISCY BUSINESS Day 21)" url=https://forums.sifive.com/t/lots-of-questions-riscy-business-day-21/434]][:research] [0:40][Enable print_instructions() to print the board_id as a dereferenced int pointer] [2:34][:Run the program to see our possible board_id] [4:28][Read man 3 printf] [5:01][Enable print_instructions() to print the board_id as a %X] [5:28][:Run the program to see the same number] [6:08][Enable print_instructions() to print the board_id cast to a short] [7:29][:Run the program to see a different board_id] [8:52][@hossein1387][The print for clock frequency is also bad] [9:43][@hossein1387][No, I meant when the board printed out the value, the frequency was 600MHz] [10:10][:Run the program to confirm the core frequency] [11:34][Consult man 3 printf, and wonder whether the instability of the core frequency causes problems][:research] [13:00][Hazard a guess as to what the Unix timestamp for our board may be] [14:55][Enable print_instructions() to print the board_id cast to an int] [15:39][:Run our program to view the output, and compare it with our guess] [17:45][@hossein1387][I am getting around the same numbers] [18:22][@hossein1387][I am getting ed93db27] [18:54][Consult the table for the OTP Contents[ref site="SiFive Developers" page="SiFive HiFive1 Getting Started Guide" url=https://static.dev.sifive.com/dev-kits/hifive1/hifive1-getting-started-v1.0.2.pdf] and see if the board_id is documented in the Freedom E310-G000 Manual[ref site="SiFive Developers" page="Freedom E310-G000 Manual" url=https://www.sifive.com/documentation/chips/freedom-e310-g000-manual/]] [21:55][@hossein1387][I used uint64 and I got 12 Jun 1976] [22:56][Try to convert ED93 to human date[ref site="Epoch Converter" page="Unix Hex Timestamp Converter" url=https://www.epochconverter.com/hex]] [23:58][@hossein1387][Oh, that's the Unix base date. January 1 1970, isn't it?] [24:22][Consult Wikipedia on Unix time[ref site=Wikipedia page="Unix time" url=https://en.wikipedia.org/wiki/Unix_time]][:research] [26:32][Consult the table for the OTP Contents[ref site="SiFive Developers" page="SiFive HiFive1 Getting Started Guide" url=https://static.dev.sifive.com/dev-kits/hifive1/hifive1-getting-started-v1.0.2.pdf]][:research] [28:38][Enable print_instructions() to print the address and value of everything from 0x1004 to 0x1FE4] [32:28][:Run our program and view the output] [33:39][Pass both parameters to the printf() call in print_instructions()] [34:45][:Run our program to view the correct output, and attempt to spot a plausible Unix timestamp amongst it] [40:14][Ask @hossein1387 to print the hex value at 0x1634] [40:33][Convert our value into a timestamp[ref site="Epoch Converter" page="Unix Hex Timestamp Converter" url=https://www.epochconverter.com/hex] and consider this to be too early] [42:05][@hossein1387][I have the exact same value as you] [42:30][Enable print_instructions() to print from 0x1FE4 to 0x1FEC] [44:21][:Run our program and see the output from one iteration] [46:41][Try to enable print_instructions() to print further] [47:13][:Run our program to see less output] [48:17][Enable print_instructions() to print further] [49:28][:Run our program to see a little more] [50:34][@hossein1387][I can print from 0x0004 up to 0x2000, but 5714ae28 is the only valid one from what I can see] [51:13][Make clean, and :run our program to see two iterations, 16 bytes apart] [54:12][Try printing the lower end] [54:48][:Run our program to see that it was also printing 16 bytes apart there] [56:34][Increment the board_id pointer by one byte] [57:47][:Run the program to view our more complete output, and attempt to spot a plausible Unix timestamp amongst it] [59:44][Enable print_instructions() to only print out values between 0x57000000 and 0x58000000, but from a larger range in memory] [1:03:10][A few words on the value of what we're doing, including pointer arithmetic] [1:04:09][:Run the program to view our one hit, conclude that we do not have a reasonable Unix timestamp in that memory region, and report this on the forums[ref site="SiFive Forums" page="Lots of Questions… (RISCY BUSINESS Day 21)" url=https://forums.sifive.com/t/lots-of-questions-riscy-business-day-21/434]] [1:07:37][We are out of time for today] [/video]