| 400 | } |
| 401 | |
| 402 | static void WriteCIE(TArray<uint8_t> &stream, const TArray<uint8_t> &cieInstructions, uint8_t returnAddressReg) |
| 403 | { |
| 404 | unsigned int lengthPos = stream.Size(); |
| 405 | WriteUInt32(stream, 0); // Length |
| 406 | WriteUInt32(stream, 0); // CIE ID |
| 407 | |
| 408 | WriteUInt8(stream, 1); // CIE Version |
| 409 | WriteUInt8(stream, 'z'); |
| 410 | WriteUInt8(stream, 'R'); // fde encoding |
| 411 | WriteUInt8(stream, 0); |
| 412 | WriteULEB128(stream, 1); |
| 413 | WriteSLEB128(stream, -1); |
| 414 | WriteULEB128(stream, returnAddressReg); |
| 415 | |
| 416 | WriteULEB128(stream, 1); // LEB128 augmentation size |
| 417 | WriteUInt8(stream, 0); // DW_EH_PE_absptr (FDE uses absolute pointers) |
| 418 | |
| 419 | for (unsigned int i = 0; i < cieInstructions.Size(); i++) |
| 420 | stream.Push(cieInstructions[i]); |
| 421 | |
| 422 | WritePadding(stream); |
| 423 | WriteLength(stream, lengthPos, stream.Size() - lengthPos - 4); |
| 424 | } |
| 425 | |
| 426 | static void WriteFDE(TArray<uint8_t> &stream, const TArray<uint8_t> &fdeInstructions, uint32_t cieLocation, unsigned int &functionStart) |
| 427 | { |
no test coverage detected