1 /* 2 * Boot-related utilities. 3 * 4 * Copyright (C) 2024 Paul Boddie <paul@boddie.org.uk> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA 20 */ 21 22 #include <stddef.h> 23 24 #include "boot.h" 25 26 27 28 // Return a pointer to any partition table in the provided data or NULL if the 29 // data appears not to contain such a table. 30 31 struct partition_table_entry *get_partition_table(uint8_t *data) 32 { 33 if ((data[0x1fe] != 0x55) || (data[0x1ff] != 0xaa)) 34 return NULL; 35 36 return (struct partition_table_entry *) &data[0x1be]; 37 }