summaryrefslogtreecommitdiff
path: root/bios_extract.h
blob: a39a74770f8e65f6ceff77f4355fb49cc70bf842 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * Copyright 2009      Luc Verhaegen <libv@skynet.be>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; see the file COPYING.  If not, write to
 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef BIOS_EXTRACT_H
#define BIOS_EXTRACT_H

#define Bool int
#define FALSE 0
#define TRUE  1

#if !defined(le32toh) || !defined(le16toh)
#if BYTE_ORDER == LITTLE_ENDIAN
#define le32toh(x) (x)
#define le16toh(x) (x)
#else
#include <byteswap.h>
#define le32toh(x) bswap_32(x)
#define le16toh(x) bswap_16(x)
#endif
#endif

/* bios_extract.c */
unsigned char *MMapOutputFile(char *filename, int size);

/* ami.c */
Bool AMI95Extract(unsigned char *BIOSImage, int BIOSLength, int BIOSOffset,
		  uint32_t Offset1, uint32_t Offset2);

/* phoenix.c */
Bool PhoenixExtract(unsigned char *BIOSImage, int BIOSLength, int BIOSOffset,
		    uint32_t Offset1, uint32_t Offset2);
Bool PhoenixTrustedExtract(unsigned char *BIOSImage, int BIOSLength,
			   int BIOSOffset, uint32_t Offset1,
			   uint32_t BCPSegmentOffset);
/* award.c */
Bool AwardExtract(unsigned char *BIOSImage, int BIOSLength, int BIOSOffset,
		  uint32_t Offset1, uint32_t Offset2);

#endif /* BIOS_EXTRACT_H */