Short VBT summary in human readable form */
| 922 | |
| 923 | /* Short VBT summary in human readable form */ |
| 924 | static void print_vbt(const struct fileobject *fo) |
| 925 | { |
| 926 | const struct bdb_header *bdb; |
| 927 | |
| 928 | if (fo->size < sizeof(struct vbt_header)) |
| 929 | return; |
| 930 | |
| 931 | const struct vbt_header *head = (const struct vbt_header *)fo->data; |
| 932 | |
| 933 | print("Found VBT:\n"); |
| 934 | printt("signature: <%20.20s>\n", head->signature); |
| 935 | printt("version: %d.%02d\n", head->version / 100, head->version % 100); |
| 936 | if (head->header_size != sizeof(struct vbt_header)) |
| 937 | printt("header size: 0x%x\n", head->header_size); |
| 938 | printt("VBT size: 0x%x\n", head->vbt_size); |
| 939 | printt("VBT checksum: 0x%x\n", head->vbt_checksum); |
| 940 | |
| 941 | if (head->bdb_offset > (fo->size - sizeof(struct bdb_header))) { |
| 942 | printerr("invalid BDB offset\n"); |
| 943 | return; |
| 944 | } |
| 945 | bdb = (const struct bdb_header *) |
| 946 | ((const char *)head + head->bdb_offset); |
| 947 | |
| 948 | if (memcmp("BIOS_DATA_BLOCK ", bdb->signature, 16) != 0) { |
| 949 | printerr("invalid BDB signature:%s\n", bdb->signature); |
| 950 | return; |
| 951 | } |
| 952 | printt("BDB version: %u.%02u\n", bdb->version / 100, |
| 953 | bdb->version % 100); |
| 954 | } |
| 955 | |
| 956 | static void print_usage(const char *argv0, struct option *long_options) |
| 957 | { |