xref: /haiku/src/system/boot/platform/bios_ia32/bios.h (revision 4f00613311d0bd6b70fa82ce19931c41f071ea4e)
1 /*
2 ** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the OpenBeOS 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) (((addr_t)(segment) << 4) + (addr_t)(offset))
32 #define SEGMENTED_TO_LINEAR(segmented) \
33 	LINEAR_ADDRESS((addr_t)(segmented) >> 16, (addr_t)(segmented) & 0xffff)
34 
35 static const addr_t kDataSegmentScratch = 0x10020;	// about 768 bytes
36 static const addr_t kDataSegmentBase = 0x10000;
37 static const addr_t kExtraSegmentScratch = 0x2000;	// about 24 kB
38 
39 extern
40 #ifdef __cplusplus
41 "C"
42 #endif
43 void call_bios(uint8 num, struct bios_regs *regs);
44 
45 #endif	/* BIOS_H */
46