dtb.hh (242b24828472137ec4411826b86e753d49bd2c39) | dtb.hh (21d5d37ba4c0131d6c141695366e266e32cc3bc1) |
---|---|
1/*- 2 * Copyright (c) 2013 David Chisnall 3 * All rights reserved. 4 * 5 * This software was developed by SRI International and the University of 6 * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 7 * ("CTSRD"), as part of the DARPA CRASH research programme. 8 * --- 175 unchanged lines hidden (view full) --- 184 * constructed. 185 */ 186 byte_buffer buffer; 187 public: 188 /** 189 * The binary format does not support labels, so this method 190 * does nothing. 191 */ | 1/*- 2 * Copyright (c) 2013 David Chisnall 3 * All rights reserved. 4 * 5 * This software was developed by SRI International and the University of 6 * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 7 * ("CTSRD"), as part of the DARPA CRASH research programme. 8 * --- 175 unchanged lines hidden (view full) --- 184 * constructed. 185 */ 186 byte_buffer buffer; 187 public: 188 /** 189 * The binary format does not support labels, so this method 190 * does nothing. 191 */ |
192 virtual void write_label(const std::string &) {} | 192 void write_label(const std::string &) override {} |
193 /** 194 * Comments are ignored by the binary writer. 195 */ | 193 /** 194 * Comments are ignored by the binary writer. 195 */ |
196 virtual void write_comment(const std::string&) {} 197 virtual void write_string(const std::string &name); 198 virtual void write_data(uint8_t v); 199 virtual void write_data(uint32_t v); 200 virtual void write_data(uint64_t v); 201 virtual void write_to_file(int fd); 202 virtual uint32_t size(); | 196 void write_comment(const std::string&) override {} 197 void write_string(const std::string &name) override; 198 void write_data(uint8_t v) override; 199 void write_data(uint32_t v) override; 200 void write_data(uint64_t v) override; 201 void write_to_file(int fd) override; 202 uint32_t size() override; |
203}; 204/** 205 * Assembly writer. This class is responsible for writing the output in an 206 * assembly format that is suitable for linking into a kernel, loader, and so 207 * on. 208 */ 209class asm_writer : public output_writer 210{ --- 18 unchanged lines hidden (view full) --- 229 /** 230 * Writes a string directly to the output as-is. This is the function that 231 * performs the real output. 232 */ 233 void write_string(const char *c); 234 /** 235 * Write a string to the output. 236 */ | 203}; 204/** 205 * Assembly writer. This class is responsible for writing the output in an 206 * assembly format that is suitable for linking into a kernel, loader, and so 207 * on. 208 */ 209class asm_writer : public output_writer 210{ --- 18 unchanged lines hidden (view full) --- 229 /** 230 * Writes a string directly to the output as-is. This is the function that 231 * performs the real output. 232 */ 233 void write_string(const char *c); 234 /** 235 * Write a string to the output. 236 */ |
237 void write_string(const std::string &c); | 237 void write_string(const std::string &c) override; |
238 /** 239 * Writes the string, starting on a new line. 240 */ 241 void write_line(const char *c); 242 /** 243 * Writes a byte in binary format. This will emit a single .byte 244 * directive, with up to four per line. 245 */ 246 void write_byte(uint8_t b); 247 public: 248 asm_writer() : byte_count(0), bytes_written(0) {} | 238 /** 239 * Writes the string, starting on a new line. 240 */ 241 void write_line(const char *c); 242 /** 243 * Writes a byte in binary format. This will emit a single .byte 244 * directive, with up to four per line. 245 */ 246 void write_byte(uint8_t b); 247 public: 248 asm_writer() : byte_count(0), bytes_written(0) {} |
249 virtual void write_label(const std::string &name); 250 virtual void write_comment(const std::string &name); 251 virtual void write_data(uint8_t v); 252 virtual void write_data(uint32_t v); 253 virtual void write_data(uint64_t v); 254 virtual void write_to_file(int fd); 255 virtual uint32_t size(); | 249 void write_label(const std::string &name) override; 250 void write_comment(const std::string &name) override; 251 void write_data(uint8_t v) override; 252 void write_data(uint32_t v) override; 253 void write_data(uint64_t v) override; 254 void write_to_file(int fd) override; 255 uint32_t size() override; |
256}; 257 258/** 259 * Class encapsulating the device tree blob header. This class stores all of 260 * the values found in the header and is responsible for writing them to the 261 * output. 262 */ 263struct header --- 108 unchanged lines hidden --- | 256}; 257 258/** 259 * Class encapsulating the device tree blob header. This class stores all of 260 * the values found in the header and is responsible for writing them to the 261 * output. 262 */ 263struct header --- 108 unchanged lines hidden --- |