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",
struct arbelprm_rc_send_wqe rc
__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))
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" retur dest)
#define assert(condition)
Assert a condition at run-time.
uint16_t offset
Offset to command line.
int create_fakedhcpack(struct net_device *netdev, void *data, size_t max_len)
Create fake DHCPACK packet.
#define __unused
Declare a variable or data structure as unused.
#define DHCP_EB_FEATURE_NBI
NBI format.
#define FEATURE_IMAGE
Image formats.
#define ENOEXEC
Exec format error.
#define ENODEV
No such device.
#define PROBE_NORMAL
Normal image probe priority.
#define __image_type(probe_order)
An executable image type.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static void shutdown_boot(void)
Shut down system for OS boot.
unsigned int extmemsize(void)
Get size of extended memory.
#define FEATURE(category, text, feature_opt, version)
Declare a feature.
Access to external ("user") memory.
#define REAL_CODE(asm_code_str)
#define __from_data16(pointer)
#define PHYS_CODE(asm_code_str)
#define NBI_LAST_SEGHEADER(flags)
static int nbi_boot32(struct image *image, const struct imgheader *imgheader)
Boot a 32-bit NBI image.
#define NBI_HEADER_LENGTH
NBI header length.
static int nbi_prepare_dhcp(struct image *image)
Prepare DHCP parameter block for NBI image.
#define NBI_LOADADDR_BEFORE
static int nbi_exec(struct image *image)
Execute a loaded NBI image.
#define NBI_MAGIC
NBI magic number.
#define NBI_LOADADDR_FLAGS(flags)
#define NBI_LINEAR_EXEC_ADDR(flags)
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.
#define NBI_LOADADDR_AFTER
static int nbi_boot16(struct image *image, const struct imgheader *imgheader)
Boot a 16-bit 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.
#define NBI_PROGRAM_RETURNS(flags)
static int nbi_probe(struct image *image)
Probe 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.
struct net_device * last_opened_netdev(void)
Get most recently opened network device.
Network device management.
__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")
static __always_inline void * real_to_virt(unsigned int segment, unsigned int offset)
Convert segment:offset address to virtual address.
int prep_segment(void *segment, size_t filesz, size_t memsz)
Prepare segment for loading.
Executable image segments.
char * strerror(int errno)
Retrieve string representation of error number.
An executable image type.
const void * data
Read-only data.
size_t len
Length of raw file image.
const int product_major_version
Product major version.
const int product_minor_version
Product minor version.