Adding upstream version 3.50~pre5.
[syslinux-debian/hramrach.git] / com32 / include / syslinux / movebits.h
blob60fcebd753f3f1bfe450e2ad798d458890b34848
1 #ifndef _SYSLINUX_MOVEBITS_H
2 #define _SYSLINUX_MOVEBITS_H
4 #include <inttypes.h>
5 #include <stdio.h>
7 typedef uint32_t addr_t;
9 /*
10 * A syslinux_movelist is a linked list of move operations. The ordering
11 * is important, so no sorting requirement can be imposed.
13 struct syslinux_movelist {
14 addr_t dst;
15 addr_t src;
16 addr_t len;
17 struct syslinux_movelist *next;
21 * A syslinux_memmap is a sorted, linked list of memory regions,
22 * guaranteed to satisfy the constraint that no adjacent zones have
23 * the same type. Undefined memory ranges are represented with entries;
24 * they have type SMT_UNDEFINED.
26 * Note that there is no length field. The length of a region is obtained
27 * by looking at the start of the next entry in the chain.
29 enum syslinux_memmap_types {
30 SMT_ERROR = -2, /* Internal error token */
31 SMT_END = -1, /* End of list */
32 SMT_UNDEFINED = 0, /* Unknown range */
33 SMT_FREE = 1, /* Available memory */
34 SMT_RESERVED, /* Unusable memory */
35 SMT_ALLOC, /* Memory allocated by user */
36 SMT_ZERO, /* Memory that should be zeroed */
39 struct syslinux_memmap {
40 addr_t start;
41 enum syslinux_memmap_types type;
42 struct syslinux_memmap *next;
46 /* Defined in <syslinux/bootpm.h> and <syslinux/bootrm.h> respectively */
47 struct syslinux_pm_regs;
48 struct syslinux_rm_regs;
51 * moves is computed from "fraglist" and "memmap". Areas that are
52 * to be zeroed should be marked as such in the memmap, not in the
53 * fraglist.
56 int syslinux_compute_movelist(struct syslinux_movelist **movelist,
57 struct syslinux_movelist *fraglist,
58 struct syslinux_memmap *memmap);
60 struct syslinux_memmap *syslinux_memory_map(void);
61 void syslinux_free_movelist(struct syslinux_movelist *);
62 int syslinux_add_movelist(struct syslinux_movelist **,
63 addr_t dst, addr_t src, addr_t len);
64 int syslinux_allocate_from_list(struct syslinux_movelist **freelist,
65 addr_t dst, addr_t len);
66 int syslinux_prepare_shuffle(struct syslinux_movelist *fraglist,
67 struct syslinux_memmap *memmap);
68 int syslinux_shuffle_boot_rm(struct syslinux_movelist *fraglist,
69 struct syslinux_memmap *memmap,
70 uint16_t bootflags,
71 struct syslinux_rm_regs *regs);
72 int syslinux_shuffle_boot_pm(struct syslinux_movelist *fraglist,
73 struct syslinux_memmap *memmap,
74 uint16_t bootflags,
75 struct syslinux_pm_regs *regs);
77 /* Operatons on struct syslinux_memmap */
78 struct syslinux_memmap *syslinux_init_memmap(void);
79 int syslinux_add_memmap(struct syslinux_memmap **list,
80 addr_t start, addr_t len,
81 enum syslinux_memmap_types type);
82 enum syslinux_memmap_types syslinux_memmap_type(struct syslinux_memmap *list,
83 addr_t start, addr_t len);
84 int syslinux_memmap_largest(struct syslinux_memmap *list,
85 enum syslinux_memmap_types type,
86 addr_t *start, addr_t *len);
87 void syslinux_free_memmap(struct syslinux_memmap *list);
88 struct syslinux_memmap *syslinux_dup_memmap(struct syslinux_memmap *list);
90 /* Debugging functions */
91 void syslinux_dump_movelist(FILE *file, struct syslinux_movelist *ml);
92 void syslinux_dump_memmap(FILE *file, struct syslinux_memmap *memmap);
94 #endif /* _SYSLINUX_MOVEBITS_H */