54 #define NBI_MAGIC 0x1B031336UL 57 #define NBI_NONVENDOR_LENGTH(len) ( ( (len) & 0x0f ) << 2 ) 58 #define NBI_VENDOR_LENGTH(len) ( ( (len) & 0xf0 ) >> 2 ) 59 #define NBI_LENGTH(len) ( NBI_NONVENDOR_LENGTH(len) + NBI_VENDOR_LENGTH(len) ) 62 #define NBI_PROGRAM_RETURNS(flags) ( (flags) & ( 1 << 8 ) ) 63 #define NBI_LINEAR_EXEC_ADDR(flags) ( (flags) & ( 1 << 31 ) ) 66 #define NBI_HEADER_LENGTH 512 86 #define NBI_LOADADDR_FLAGS(flags) ( (flags) & 0x03 ) 87 #define NBI_LOADADDR_ABS 0x00 88 #define NBI_LOADADDR_AFTER 0x01 89 #define NBI_LOADADDR_END 0x02 90 #define NBI_LOADADDR_BEFORE 0x03 91 #define NBI_LAST_SEGHEADER(flags) ( (flags) & ( 1 << 2 ) ) 110 void *
dest,
size_t filesz,
size_t memsz ) {
114 DBGC (
image,
"NBI %s could not prepare segment: %s\n",
133 void *
dest,
size_t filesz,
177 DBGC (
image,
"NBI %s invalid segheader length 0\n",
210 DBGC (
image,
"NBI %s segment outside file\n",
215 filesz,
memsz ) ) != 0 ) {
223 DBGC (
image,
"NBI %s header overflow\n",
231 DBGC (
image,
"NBI %s length wrong (file %zd, metadata %zd)\n",
250 DBGC (
image,
"NBI %s executing 16-bit image at %04x:%04x\n",
286 struct ebinfo loaderinfo = {
293 DBGC (
image,
"NBI %s executing 32-bit image at %lx\n",
303 "addl $12, %%esp\n\t" 311 "a" ( virt_to_phys ( &loaderinfo ) )
312 :
"ecx",
"edx",
"memory" );
328 if ( ! boot_netdev ) {
329 DBGC (
image,
"NBI %s could not identify a network device\n",
336 DBGC (
image,
"NBI %s failed to build DHCP packet\n",
391 if ( ! may_return ) {
393 DBGC (
image,
"NBI %s returned %d from non-returnable image\n",
414 DBGC (
image,
"NBI %s too short for an NBI image\n",
#define PHYS_CODE(asm_code_str)
struct arbelprm_rc_send_wqe rc
static int nbi_boot16(struct image *image, const struct imgheader *imgheader)
Boot a 16-bit NBI image.
#define NBI_LOADADDR_AFTER
const void * data
Read-only data.
#define ENOEXEC
Exec format error.
int create_fakedhcpack(struct net_device *netdev, void *data, size_t max_len)
Create fake DHCPACK packet.
An executable image type.
unsigned int extmemsize(void)
Get size of extended memory.
#define PROBE_NORMAL
Normal image probe priority.
#define DHCP_EB_FEATURE_NBI
NBI format.
#define FEATURE_IMAGE
Image formats.
#define NBI_LOADADDR_FLAGS(flags)
#define NBI_LAST_SEGHEADER(flags)
#define NBI_LOADADDR_BEFORE
char * name
Name of this image type.
static __always_inline void * real_to_virt(unsigned int segment, unsigned int offset)
Convert segment:offset address to virtual address.
Executable image segments.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define NBI_HEADER_LENGTH
NBI header length.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
Access to external ("user") memory.
#define NBI_PROGRAM_RETURNS(flags)
static int nbi_prepare_dhcp(struct image *image)
Prepare DHCP parameter block for NBI image.
#define __unused
Declare a variable or data structure as unused.
#define NBI_LINEAR_EXEC_ADDR(flags)
static int nbi_probe(struct image *image)
Probe NBI image.
struct net_device * last_opened_netdev(void)
Get most recently opened network device.
char * strerror(int errno)
Retrieve string representation of error number.
size_t len
Length of raw file image.
__asm__ __volatile__("call *%9" :"=a"(result), "=c"(discard_ecx), "=d"(discard_edx) :"d"(0), "a"(code), "b"(0), "c"(in_phys), "D"(0), "S"(out_phys), "m"(hypercall))
#define ENODEV
No such device.
static int nbi_prepare_segment(struct image *image, size_t offset __unused, void *dest, size_t filesz, size_t memsz)
Prepare a segment for an NBI image.
static int nbi_process_segments(struct image *image, const struct imgheader *imgheader, int(*process)(struct image *image, size_t offset, void *dest, size_t filesz, size_t memsz))
Process segments of an NBI image.
static int nbi_load_segment(struct image *image, size_t offset, void *dest, size_t filesz, size_t memsz __unused)
Load a segment for an NBI image.
Network device management.
const int product_major_version
Product major version.
static int nbi_boot32(struct image *image, const struct imgheader *imgheader)
Boot a 32-bit NBI image.
__asm__(".section \".rodata\", \"a\", " PROGBITS "\n\t" "\nprivate_key_data:\n\t" ".size private_key_data, ( . - private_key_data )\n\t" ".equ private_key_len, ( . - private_key_data )\n\t" ".previous\n\t")
#define __from_data16(pointer)
static int nbi_exec(struct image *image)
Execute a loaded NBI image.
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" return dest
FEATURE(FEATURE_IMAGE, "NBI", DHCP_EB_FEATURE_NBI, 1)
int prep_segment(void *segment, size_t filesz, size_t memsz)
Prepare segment for loading.
uint16_t offset
Offset to command line.
static void shutdown_boot(void)
Shut down system for OS boot.
#define REAL_CODE(asm_code_str)
const int product_minor_version
Product minor version.
struct image_type nbi_image_type __image_type(PROBE_NORMAL)
NBI image type.
#define NBI_MAGIC
NBI magic number.