MCPcopy Create free account
hub / github.com/IBM/ACE-RISCV / find_placehoder

Function find_placehoder

tools/cove_tap_tool/src/attach.rs:39–55  ·  view source on GitHub ↗
(output_file_name: &str)

Source from the content-addressed store, hash-verified

37}
38
39fn find_placehoder(output_file_name: &str) -> Result<u64, Error> {
40 let output_file = OpenOptions::new().read(true).open(output_file_name)?;
41 let mut buf = BufReader::new(output_file);
42 let mut buffer = [0u8; 4];
43 let mut offset = 0u64;
44 while let Ok(bytes_read) = buf.read(&mut buffer) {
45 if bytes_read == 0 {
46 break;
47 }
48 if u32::from_le_bytes(buffer) == riscv_cove_tap::ACE_MAGIC_TAP_START {
49 println!("Found TAP placeholder at offset: {:x}", offset);
50 return Ok(offset);
51 }
52 offset += bytes_read as u64;
53 }
54 Err(Error::PlaceholderError())
55}

Callers 1

attach_tapFunction · 0.85

Calls 1

readMethod · 0.45

Tested by

no test coverage detected