Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' of https://git.ipxe.org/ipxe
Conflicts:
	src/config/general.h
  • Loading branch information
Jarrod Johnson committed Oct 1, 2013
2 parents 6dd2497 + 7405685 commit d603ea6
Show file tree
Hide file tree
Showing 53 changed files with 3,127 additions and 1,238 deletions.
8 changes: 5 additions & 3 deletions src/arch/i386/drivers/net/undiload.c
Expand Up @@ -103,13 +103,15 @@ int undi_load ( struct undi_device *undi, struct undi_rom *undirom ) {

/* Call loader */
undi_loader_entry = undirom->loader_entry;
__asm__ __volatile__ ( REAL_CODE ( "pushw %%ds\n\t"
__asm__ __volatile__ ( REAL_CODE ( "pushl %%ebp\n\t" /* gcc bug */
"pushw %%ds\n\t"
"pushw %%ax\n\t"
"lcall *undi_loader_entry\n\t"
"addw $4, %%sp\n\t" )
"popl %%ebp\n\t" /* discard */
"popl %%ebp\n\t" /* gcc bug */ )
: "=a" ( exit )
: "a" ( __from_data16 ( &undi_loader ) )
: "ebx", "ecx", "edx", "esi", "edi", "ebp" );
: "ebx", "ecx", "edx", "esi", "edi" );

if ( exit != PXENV_EXIT_SUCCESS ) {
/* Clear entry point */
Expand Down
9 changes: 5 additions & 4 deletions src/arch/i386/firmware/pcbios/bios_console.c
Expand Up @@ -167,7 +167,8 @@ static void bios_putchar ( int character ) {
return;

/* Print character with attribute */
__asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
__asm__ __volatile__ ( REAL_CODE ( "pushl %%ebp\n\t" /* gcc bug */
"sti\n\t"
/* Skip non-printable characters */
"cmpb $0x20, %%al\n\t"
"jb 1f\n\t"
Expand All @@ -188,11 +189,11 @@ static void bios_putchar ( int character ) {
"xorw %%bx, %%bx\n\t"
"movb $0x0e, %%ah\n\t"
"int $0x10\n\t"
"cli\n\t" )
"cli\n\t"
"popl %%ebp\n\t" /* gcc bug */ )
: "=a" ( discard_a ), "=b" ( discard_b ),
"=c" ( discard_c )
: "a" ( character ), "b" ( bios_attr )
: "ebp" );
: "a" ( character ), "b" ( bios_attr ) );
}

/**
Expand Down
7 changes: 6 additions & 1 deletion src/arch/i386/image/bootsector.c
Expand Up @@ -80,6 +80,8 @@ int call_bootsector ( unsigned int segment, unsigned int offset,
"movw %%ss, %%ax\n\t"
"movw %%ax, %%cs:saved_ss\n\t"
"movw %%sp, %%cs:saved_sp\n\t"
/* Save frame pointer (gcc bug) */
"movl %%ebp, %%cs:saved_ebp\n\t"
/* Prepare jump to boot sector */
"pushw %%bx\n\t"
"pushw %%di\n\t"
Expand All @@ -99,11 +101,14 @@ int call_bootsector ( unsigned int segment, unsigned int offset,
"sti\n\t"
"lret\n\t"
/* Preserved variables */
"\nsaved_ebp: .long 0\n\t"
"\nsaved_ss: .word 0\n\t"
"\nsaved_sp: .word 0\n\t"
"\nsaved_retaddr: .word 0\n\t"
/* Boot failure return point */
"\nbootsector_exec_fail:\n\t"
/* Restore frame pointer (gcc bug) */
"movl %%cs:saved_ebp, %%ebp\n\t"
/* Restore stack pointer */
"movw %%cs:saved_ss, %%ax\n\t"
"movw %%ax, %%ss\n\t"
Expand All @@ -114,7 +119,7 @@ int call_bootsector ( unsigned int segment, unsigned int offset,
"=d" ( discard_d )
: "b" ( segment ), "D" ( offset ),
"d" ( drive )
: "eax", "ecx", "esi", "ebp" );
: "eax", "ecx", "esi" );

DBG ( "Booted disk returned via INT 18 or 19\n" );

Expand Down
7 changes: 4 additions & 3 deletions src/arch/i386/image/elfboot.c
Expand Up @@ -60,10 +60,11 @@ static int elfboot_exec ( struct image *image ) {

/* Jump to OS with flat physical addressing */
DBGC ( image, "ELF %p starting execution at %lx\n", image, entry );
__asm__ __volatile__ ( PHYS_CODE ( "call *%%edi\n\t" )
__asm__ __volatile__ ( PHYS_CODE ( "pushl %%ebp\n\t" /* gcc bug */
"call *%%edi\n\t"
"popl %%ebp\n\t" /* gcc bug */ )
: : "D" ( entry )
: "eax", "ebx", "ecx", "edx", "esi", "ebp",
"memory" );
: "eax", "ebx", "ecx", "edx", "esi", "memory" );

DBGC ( image, "ELF %p returned\n", image );

Expand Down
16 changes: 10 additions & 6 deletions src/arch/i386/image/nbi.c
Expand Up @@ -248,7 +248,8 @@ static int nbi_boot16 ( struct image *image, struct imgheader *imgheader ) {
imgheader->execaddr.segoff.offset );

__asm__ __volatile__ (
REAL_CODE ( "pushw %%ds\n\t" /* far pointer to bootp data */
REAL_CODE ( "pushl %%ebp\n\t" /* gcc bug */
"pushw %%ds\n\t" /* far pointer to bootp data */
"pushw %%bx\n\t"
"pushl %%esi\n\t" /* location */
"pushw %%cs\n\t" /* lcall execaddr */
Expand All @@ -258,13 +259,14 @@ static int nbi_boot16 ( struct image *image, struct imgheader *imgheader ) {
"pushl %%edi\n\t"
"lret\n\t"
"\n2:\n\t"
"addw $8,%%sp\n\t" /* clean up stack */ )
"addw $8,%%sp\n\t" /* clean up stack */
"popl %%ebp\n\t" /* gcc bug */ )
: "=a" ( rc ), "=D" ( discard_D ), "=S" ( discard_S ),
"=b" ( discard_b )
: "D" ( imgheader->execaddr.segoff ),
"S" ( imgheader->location ),
"b" ( __from_data16 ( basemem_packet ) )
: "ecx", "edx", "ebp" );
: "ecx", "edx" );

return rc;
}
Expand All @@ -288,19 +290,21 @@ static int nbi_boot32 ( struct image *image, struct imgheader *imgheader ) {

/* Jump to OS with flat physical addressing */
__asm__ __volatile__ (
PHYS_CODE ( "pushl %%ebx\n\t" /* bootp data */
PHYS_CODE ( "pushl %%ebp\n\t" /* gcc bug */
"pushl %%ebx\n\t" /* bootp data */
"pushl %%esi\n\t" /* imgheader */
"pushl %%eax\n\t" /* loaderinfo */
"call *%%edi\n\t"
"addl $12, %%esp\n\t" /* clean up stack */ )
"addl $12, %%esp\n\t" /* clean up stack */
"popl %%ebp\n\t" /* gcc bug */ )
: "=a" ( rc ), "=D" ( discard_D ), "=S" ( discard_S ),
"=b" ( discard_b )
: "D" ( imgheader->execaddr.linear ),
"S" ( ( imgheader->location.segment << 4 ) +
imgheader->location.offset ),
"b" ( virt_to_phys ( basemem_packet ) ),
"a" ( virt_to_phys ( &loaderinfo ) )
: "ecx", "edx", "ebp", "memory" );
: "ecx", "edx", "memory" );

return rc;
}
Expand Down
8 changes: 5 additions & 3 deletions src/arch/i386/interface/pxeparent/pxeparent.c
Expand Up @@ -143,16 +143,18 @@ int pxeparent_call ( SEGOFF16_t entry, unsigned int function,
/* Call real-mode entry point. This calling convention will
* work with both the !PXE and the PXENV+ entry points.
*/
__asm__ __volatile__ ( REAL_CODE ( "pushw %%es\n\t"
__asm__ __volatile__ ( REAL_CODE ( "pushl %%ebp\n\t" /* gcc bug */
"pushw %%es\n\t"
"pushw %%di\n\t"
"pushw %%bx\n\t"
"lcall *pxeparent_entry_point\n\t"
"addw $6, %%sp\n\t" )
"addw $6, %%sp\n\t"
"popl %%ebp\n\t" /* gcc bug */ )
: "=a" ( exit ), "=b" ( discard_b ),
"=D" ( discard_D )
: "b" ( function ),
"D" ( __from_data16 ( &pxeparent_params ) )
: "ecx", "edx", "esi", "ebp" );
: "ecx", "edx", "esi" );

/* Determine return status code based on PXENV_EXIT and
* PXENV_STATUS
Expand Down
6 changes: 6 additions & 0 deletions src/config/config.c
Expand Up @@ -101,6 +101,9 @@ REQUIRE_OBJECT ( debugcon );
#ifdef NET_PROTO_IPV4
REQUIRE_OBJECT ( ipv4 );
#endif
#ifdef NET_PROTO_IPV6
REQUIRE_OBJECT ( ipv6 );
#endif

/*
* Drag in all requested PXE support
Expand Down Expand Up @@ -266,6 +269,9 @@ REQUIRE_OBJECT ( pci_cmd );
#ifdef PARAM_CMD
REQUIRE_OBJECT ( param_cmd );
#endif
#ifdef NEIGHBOUR_CMD
REQUIRE_OBJECT ( neighbour_cmd );
#endif

/*
* Drag in miscellaneous objects
Expand Down
27 changes: 27 additions & 0 deletions src/config/config_route.c
@@ -0,0 +1,27 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2, or (at
* your option) any later version.
*/

FILE_LICENCE ( GPL2_OR_LATER );

#include <config/general.h>

/** @file
*
* Routing management configuration options
*
*/

/*
* Drag in routing management for relevant protocols
*
*/
#ifdef NET_PROTO_IPV4
REQUIRE_OBJECT ( route_ipv4 );
#endif
#ifdef NET_PROTO_IPV6
REQUIRE_OBJECT ( route_ipv6 );
#endif
12 changes: 12 additions & 0 deletions src/config/general.h
Expand Up @@ -40,6 +40,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
*/

#define NET_PROTO_IPV4 /* IPv4 protocol */
#undef NET_PROTO_IPV6 /* IPv6 protocol */
#undef NET_PROTO_FCOE /* Fibre Channel over Ethernet protocol */

/*
Expand Down Expand Up @@ -128,6 +129,17 @@ FILE_LICENCE ( GPL2_OR_LATER );
#define IMAGE_TRUST_CMD /* Image trust management commands */
#undef SYNC_CMD /* Sync command */
#undef NSLOOKUP_CMD /* DNS resolving command */
//#define TIME_CMD /* Time commands */
//#define DIGEST_CMD /* Image crypto digest commands */
//#define LOTEST_CMD /* Loopback testing commands */
//#define VLAN_CMD /* VLAN commands */
//#define PXE_CMD /* PXE commands */
//#define REBOOT_CMD /* Reboot command */
//#define POWEROFF_CMD /* Power off command */
//#define IMAGE_TRUST_CMD /* Image trust management commands */
//#define PCI_CMD /* PCI commands */
//#define PARAM_CMD /* Form parameter commands */
//#define NEIGHBOUR_CMD /* Neighbour management commands */

/*
* ROM-specific options
Expand Down
92 changes: 46 additions & 46 deletions src/core/settings.c
Expand Up @@ -2247,29 +2247,8 @@ struct setting priority_setting __setting ( SETTING_MISC ) = {
******************************************************************************
*/

/** A built-in setting operation */
struct builtin_setting_operation {
/** Setting */
struct setting *setting;
/** Fetch setting value
*
* @v data Buffer to fill with setting data
* @v len Length of buffer
* @ret len Length of setting data, or negative error
*/
int ( * fetch ) ( void *data, size_t len );
};

/** Built-in setting scope */
static struct settings_scope builtin_scope;

/** Error number setting */
struct setting errno_setting __setting ( SETTING_MISC ) = {
.name = "errno",
.description = "Last error",
.type = &setting_type_uint32,
.scope = &builtin_scope,
};
struct settings_scope builtin_scope;

/**
* Fetch error number setting
Expand All @@ -2289,14 +2268,20 @@ static int errno_fetch ( void *data, size_t len ) {
return sizeof ( content );
}

/** Build architecture setting */
struct setting buildarch_setting __setting ( SETTING_MISC ) = {
.name = "buildarch",
.description = "Build architecture",
.type = &setting_type_string,
/** Error number setting */
struct setting errno_setting __setting ( SETTING_MISC ) = {
.name = "errno",
.description = "Last error",
.type = &setting_type_uint32,
.scope = &builtin_scope,
};

/** Error number built-in setting */
struct builtin_setting errno_builtin_setting __builtin_setting = {
.setting = &errno_setting,
.fetch = errno_fetch,
};

/**
* Fetch build architecture setting
*
Expand All @@ -2311,14 +2296,20 @@ static int buildarch_fetch ( void *data, size_t len ) {
return ( sizeof ( buildarch ) - 1 /* NUL */ );
}

/** Platform setting */
struct setting platform_setting __setting ( SETTING_MISC ) = {
.name = "platform",
.description = "Platform",
/** Build architecture setting */
struct setting buildarch_setting __setting ( SETTING_MISC ) = {
.name = "buildarch",
.description = "Build architecture",
.type = &setting_type_string,
.scope = &builtin_scope,
};

/** Build architecture built-in setting */
struct builtin_setting buildarch_builtin_setting __builtin_setting = {
.setting = &buildarch_setting,
.fetch = buildarch_fetch,
};

/**
* Fetch platform setting
*
Expand All @@ -2333,14 +2324,20 @@ static int platform_fetch ( void *data, size_t len ) {
return ( sizeof ( platform ) - 1 /* NUL */ );
}

/** Version setting */
struct setting version_setting __setting ( SETTING_MISC ) = {
.name = "version",
.description = "Version",
/** Platform setting */
struct setting platform_setting __setting ( SETTING_MISC ) = {
.name = "platform",
.description = "Platform",
.type = &setting_type_string,
.scope = &builtin_scope,
};

/** Platform built-in setting */
struct builtin_setting platform_builtin_setting __builtin_setting = {
.setting = &platform_setting,
.fetch = platform_fetch,
};

/**
* Fetch version setting
*
Expand All @@ -2353,12 +2350,18 @@ static int version_fetch ( void *data, size_t len ) {
return ( strlen ( product_version ) );
}

/** List of built-in setting operations */
static struct builtin_setting_operation builtin_setting_operations[] = {
{ &errno_setting, errno_fetch },
{ &buildarch_setting, buildarch_fetch },
{ &platform_setting, platform_fetch },
{ &version_setting, version_fetch },
/** Version setting */
struct setting version_setting __setting ( SETTING_MISC ) = {
.name = "version",
.description = "Version",
.type = &setting_type_string,
.scope = &builtin_scope,
};

/** Version built-in setting */
struct builtin_setting version_builtin_setting __builtin_setting = {
.setting = &version_setting,
.fetch = version_fetch,
};

/**
Expand All @@ -2373,12 +2376,9 @@ static struct builtin_setting_operation builtin_setting_operations[] = {
static int builtin_fetch ( struct settings *settings __unused,
struct setting *setting,
void *data, size_t len ) {
struct builtin_setting_operation *builtin;
unsigned int i;
struct builtin_setting *builtin;

for ( i = 0 ; i < ( sizeof ( builtin_setting_operations ) /
sizeof ( builtin_setting_operations[0] ) ) ; i++ ) {
builtin = &builtin_setting_operations[i];
for_each_table_entry ( builtin, BUILTIN_SETTINGS ) {
if ( setting_cmp ( setting, builtin->setting ) == 0 )
return builtin->fetch ( data, len );
}
Expand Down

0 comments on commit d603ea6

Please sign in to comment.