1 | #ifndef CORE_H |
---|
2 | #define CORE_H |
---|
3 | |
---|
4 | #include <klibc/compiler.h> |
---|
5 | #include <stddef.h> |
---|
6 | #include <stdlib.h> |
---|
7 | #include <stdbool.h> |
---|
8 | #include <inttypes.h> |
---|
9 | #include <stdio.h> |
---|
10 | #include <dprintf.h> |
---|
11 | #include <com32.h> |
---|
12 | #include <errno.h> |
---|
13 | #include <syslinux/pmapi.h> |
---|
14 | #include <syslinux/sysappend.h> |
---|
15 | #include <kaboom.h> |
---|
16 | #include <timer.h> |
---|
17 | |
---|
18 | extern char core_xfer_buf[65536]; |
---|
19 | extern char core_cache_buf[65536]; |
---|
20 | extern char trackbuf[]; |
---|
21 | extern char CurrentDirName[]; |
---|
22 | extern char SubvolName[]; |
---|
23 | extern char ConfigName[]; |
---|
24 | extern char config_cwd[]; |
---|
25 | extern char cmd_line[]; |
---|
26 | extern char ConfigFile[]; |
---|
27 | extern char syslinux_banner[]; |
---|
28 | extern char copyright_str[]; |
---|
29 | |
---|
30 | extern const size_t __syslinux_shuffler_size; |
---|
31 | |
---|
32 | static inline size_t syslinux_shuffler_size(void) |
---|
33 | { |
---|
34 | return __syslinux_shuffler_size; |
---|
35 | } |
---|
36 | |
---|
37 | /* |
---|
38 | * Mark symbols that are only used by BIOS as __weak until we can move |
---|
39 | * all references out of the generic (EFI + BIOS) code and into |
---|
40 | * BIOS-specific code. |
---|
41 | */ |
---|
42 | extern __weak uint16_t BIOSName; |
---|
43 | extern __weak char KernelName[]; |
---|
44 | extern __weak char StackBuf[]; |
---|
45 | |
---|
46 | extern uint8_t KbdMap[256]; |
---|
47 | |
---|
48 | extern const uint16_t IPAppends[]; |
---|
49 | extern size_t numIPAppends; |
---|
50 | |
---|
51 | extern uint16_t SerialPort; |
---|
52 | extern uint16_t BaudDivisor; |
---|
53 | extern uint8_t FlowOutput; |
---|
54 | extern uint8_t FlowInput; |
---|
55 | extern uint8_t FlowIgnore; |
---|
56 | |
---|
57 | extern uint8_t ScrollAttribute; |
---|
58 | extern uint16_t DisplayCon; |
---|
59 | |
---|
60 | /* diskstart.inc isolinux.asm*/ |
---|
61 | extern void getlinsec(void); |
---|
62 | |
---|
63 | /* pm.inc */ |
---|
64 | void core_pm_null_hook(void); |
---|
65 | extern void (*core_pm_hook)(void); |
---|
66 | |
---|
67 | /* getc.inc */ |
---|
68 | extern void core_open(void); |
---|
69 | |
---|
70 | /* adv.inc */ |
---|
71 | extern void adv_init(void); |
---|
72 | extern void adv_write(void); |
---|
73 | |
---|
74 | /* hello.c */ |
---|
75 | extern void myputs(const char*); |
---|
76 | |
---|
77 | /* idle.c */ |
---|
78 | extern int (*idle_hook_func)(void); |
---|
79 | extern void __idle(void); |
---|
80 | extern void reset_idle(void); |
---|
81 | |
---|
82 | /* mem/malloc.c, mem/free.c, mem/init.c */ |
---|
83 | extern void *lmalloc(size_t); |
---|
84 | extern void *pmapi_lmalloc(size_t); |
---|
85 | extern void *zalloc(size_t); |
---|
86 | extern void free(void *); |
---|
87 | extern void mem_init(void); |
---|
88 | |
---|
89 | /* sysappend.c */ |
---|
90 | extern void print_sysappend(void); |
---|
91 | extern const char *sysappend_strings[SYSAPPEND_MAX]; |
---|
92 | extern uint32_t SysAppends; |
---|
93 | extern void sysappend_set_uuid(const uint8_t *uuid); |
---|
94 | extern void sysappend_set_fs_uuid(void); |
---|
95 | |
---|
96 | void __cdecl core_intcall(uint8_t, const com32sys_t *, com32sys_t *); |
---|
97 | void __cdecl core_farcall(uint32_t, const com32sys_t *, com32sys_t *); |
---|
98 | int __cdecl core_cfarcall(uint32_t, const void *, uint32_t); |
---|
99 | |
---|
100 | extern const com32sys_t zero_regs; |
---|
101 | void call16(void (*)(void), const com32sys_t *, com32sys_t *); |
---|
102 | |
---|
103 | /* |
---|
104 | * __lowmem is in the low 1 MB; __bss16 in the low 64K |
---|
105 | */ |
---|
106 | #ifdef __SYSLINUX_CORE__ /* Not supported in modules */ |
---|
107 | # define __lowmem __attribute__((nocommon,section(".lowmem"))) |
---|
108 | # define __bss16 __attribute__((nocommon,section(".bss16"))) |
---|
109 | #endif |
---|
110 | |
---|
111 | /* |
---|
112 | * Helper routine to return a specific set of flags |
---|
113 | */ |
---|
114 | static inline void set_flags(com32sys_t *regs, uint32_t flags) |
---|
115 | { |
---|
116 | uint32_t eflags; |
---|
117 | |
---|
118 | eflags = regs->eflags.l; |
---|
119 | eflags &= ~(EFLAGS_CF|EFLAGS_PF|EFLAGS_AF|EFLAGS_ZF|EFLAGS_SF|EFLAGS_OF); |
---|
120 | eflags |= flags; |
---|
121 | regs->eflags.l = eflags; |
---|
122 | } |
---|
123 | |
---|
124 | extern int start_ldlinux(int argc, char **argv); |
---|
125 | extern int create_args_and_load(char *); |
---|
126 | |
---|
127 | extern void write_serial(char data); |
---|
128 | extern void writestr(char *str); |
---|
129 | extern void writechr(char data); |
---|
130 | extern void crlf(void); |
---|
131 | extern int pollchar(void); |
---|
132 | extern char getchar(char *hi); |
---|
133 | extern uint8_t kbd_shiftflags(void); |
---|
134 | static inline bool shift_is_held(void) |
---|
135 | { |
---|
136 | return !!(kbd_shiftflags() & 0x5d); /* Caps/Scroll/Alt/Shift */ |
---|
137 | } |
---|
138 | static inline bool ctrl_is_held(void) |
---|
139 | { |
---|
140 | return !!(kbd_shiftflags() & 0x04); /* Only Ctrl */ |
---|
141 | } |
---|
142 | |
---|
143 | extern void cleanup_hardware(void); |
---|
144 | extern void sirq_cleanup(void); |
---|
145 | extern void adjust_screen(void); |
---|
146 | |
---|
147 | extern void execute(const char *cmdline, uint32_t type, bool sysappend); |
---|
148 | extern void load_kernel(const char *cmdline); |
---|
149 | |
---|
150 | extern void dmi_init(void); |
---|
151 | |
---|
152 | extern void do_sysappend(char *buf); |
---|
153 | |
---|
154 | extern void load_env32(com32sys_t *regs); |
---|
155 | |
---|
156 | #endif /* CORE_H */ |
---|