1 /* ----------------------------------------------------------------------- *
3 * Copyright 2001-2008 H. Peter Anvin - All Rights Reserved
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 * Boston MA 02111-1307, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
11 * ----------------------------------------------------------------------- */
16 * Miscellaneous header definitions
24 /* We use the com32 interface for calling 16-bit code */
27 #define __cdecl __attribute__((cdecl,regparm(0)))
29 void __cdecl
intcall(uint8_t, com32sys_t
*, com32sys_t
*);
31 /* Structure passed in from the real-mode code */
32 struct real_mode_args
{
37 uint32_t rm_handle_interrupt
;
43 extern struct real_mode_args rm_args
;
44 #define sys_bounce ((void *)rm_args.rm_bounce)
46 /* This is the header in the boot sector/setup area */
59 uint32_t realmode_swtch
;
61 uint8_t type_of_loader
;
63 uint16_t setup_move_size
;
64 uint32_t code32_start
;
65 uint32_t ramdisk_image
;
66 uint32_t ramdisk_size
;
67 uint32_t bootsect_kludge
;
68 uint16_t head_end_ptr
;
70 uint32_t cmd_line_ptr
;
71 uint32_t initrd_addr_max
;
77 #define shdr ((struct setup_header *)rm_args.rm_base)
79 /* Standard routines */
80 void *memcpy(void *, const void *, size_t);
81 void *memset(void *, int, size_t);
82 void *memmove(void *, const void *, size_t);
84 #define strcpy(a,b) __builtin_strcpy(a,b)
86 static inline size_t strlen(const char *__a
)
91 asm("repne;scasb":"=D"(__D
), "=c"(__c
)
92 : "D"(__a
), "c"(-1), "a"(0), "m"(*__a
));
97 /* memcpy() but returns a pointer to end of buffer */
98 static inline void *mempcpy(void *__d
, const void *__s
, unsigned int __n
)
100 memcpy(__d
, __s
, __n
);
101 return (void *)((char *)__d
+ __n
);
105 static inline int memcmp(const void *__a
, const void *__b
, unsigned int __n
)
107 const unsigned char *__aa
= __a
;
108 const unsigned char *__bb
= __b
;
112 __d
= *__bb
++ - *__aa
++;
120 static inline void sti(void)
125 static inline void cli(void)
131 extern int check_zip(void *indata
, uint32_t size
, uint32_t * zbytes_p
,
132 uint32_t * dbytes_p
, uint32_t * orig_crc
,
133 uint32_t * offset_p
);
134 extern void *unzip(void *indata
, uint32_t zbytes
, uint32_t dbytes
,
135 uint32_t orig_crc
, void *target
);