xref: /haiku/src/system/boot/platform/bios_ia32/bios.h (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 /*
2  * Copyright 2004-2010, Axel Dörfler, axeld@pinc-software.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef BIOS_H
6 #define BIOS_H
7 
8 
9 #include <SupportDefs.h>
10 
11 
12 // The values in this structure are passed to the BIOS call, and
13 // are updated to the register contents after that call.
14 
15 struct bios_regs {
16 	uint32	eax;
17 	uint32	ebx;
18 	uint32	ecx;
19 	uint32	edx;
20 	uint32	esi;
21 	uint32	edi;
22 	uint16	es;
23 	uint16	flags;
24 };
25 
26 #define CARRY_FLAG	0x01
27 #define ZERO_FLAG	0x40
28 
29 #define ADDRESS_SEGMENT(address) ((addr_t)(address) >> 4)
30 #define ADDRESS_OFFSET(address) ((addr_t)(address) & 0xf)
31 #define LINEAR_ADDRESS(segment, offset) \
32 	(((addr_t)(segment) << 4) + (addr_t)(offset))
33 #define SEGMENTED_TO_LINEAR(segmented) \
34 	LINEAR_ADDRESS((addr_t)(segmented) >> 16, (addr_t)(segmented) & 0xffff)
35 
36 
37 static const addr_t kDataSegmentScratch = 0x10020;	// about 768 bytes
38 static const addr_t kDataSegmentBase = 0x10000;
39 static const addr_t kExtraSegmentScratch = 0x2000;	// about 24 kB
40 
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 void	call_bios(uint8 num, struct bios_regs* regs);
47 uint32	boot_key_in_keyboard_buffer(void);
48 
49 #ifdef __cplusplus
50 }
51 #endif
52 
53 
54 #endif	/* BIOS_H */
55