aboutsummaryrefslogtreecommitdiff
path: root/sys/boot/i386
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2013-02-08 16:10:16 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2013-02-08 16:10:16 +0000
commitd9a447559bc04121f7c6682e64abe67efa154864 (patch)
treeb2f038222ff8a70f687652441df00d2b564c8abe /sys/boot/i386
parent3cbf5f97aafc2b249c509ee1162c47c9b28e591e (diff)
parentfbda3d5daeeb730a49d025b614b35a32f0319718 (diff)
downloadsrc-d9a447559bc04121f7c6682e64abe67efa154864.tar.gz
src-d9a447559bc04121f7c6682e64abe67efa154864.zip
Sync with HEAD.
Notes
Notes: svn path=/projects/bmake/; revision=246555
Diffstat (limited to 'sys/boot/i386')
-rw-r--r--sys/boot/i386/boot2/sio.S6
-rw-r--r--sys/boot/i386/common/edd.h10
-rw-r--r--sys/boot/i386/efi/Makefile2
-rw-r--r--sys/boot/i386/efi/exec.c10
-rw-r--r--sys/boot/i386/efi/ldscript.amd6424
-rw-r--r--sys/boot/i386/efi/reloc.c31
-rw-r--r--sys/boot/i386/libi386/bootinfo64.c3
-rw-r--r--sys/boot/i386/libi386/comconsole.c25
-rw-r--r--sys/boot/i386/libi386/devicename.c2
-rw-r--r--sys/boot/i386/libi386/pxe.c6
-rw-r--r--sys/boot/i386/loader/Makefile2
11 files changed, 59 insertions, 62 deletions
diff --git a/sys/boot/i386/boot2/sio.S b/sys/boot/i386/boot2/sio.S
index f2cd5c79f4d9..ca9d0a2406aa 100644
--- a/sys/boot/i386/boot2/sio.S
+++ b/sys/boot/i386/boot2/sio.S
@@ -40,13 +40,11 @@ sio_init: pushl %eax
movb $0x3,%al # Set RTS,
outb %al,(%dx) # DTR
incl %edx # Line status reg
- call sio_flush
- ret
+ # Fallthrough
/* int sio_flush(void) */
-sio_flush: xorl %eax,%eax # Return value
- xorl %ecx,%ecx # Timeout
+sio_flush: xorl %ecx,%ecx # Timeout
movb $0x80,%ch # counter
sio_flush.1: call sio_ischar # Check for character
jz sio_flush.2 # Till none
diff --git a/sys/boot/i386/common/edd.h b/sys/boot/i386/common/edd.h
index a33ce8f5f78c..4a204f7006cf 100644
--- a/sys/boot/i386/common/edd.h
+++ b/sys/boot/i386/common/edd.h
@@ -62,7 +62,7 @@ struct edd_params {
uint16_t sector_size;
uint16_t edd_params_seg;
uint16_t edd_params_off;
-};
+} __packed;
struct edd_device_path_v3 {
uint16_t key;
@@ -74,12 +74,12 @@ struct edd_device_path_v3 {
uint64_t device_path;
uint8_t reserved2[1];
uint8_t checksum;
-};
+} __packed;
struct edd_params_v3 {
struct edd_params params;
struct edd_device_path_v3 device_path;
-};
+} __packed;
struct edd_device_path_v4 {
uint16_t key;
@@ -91,12 +91,12 @@ struct edd_device_path_v4 {
uint64_t device_path[2];
uint8_t reserved2[1];
uint8_t checksum;
-};
+} __packed;
struct edd_params_v4 {
struct edd_params params;
struct edd_device_path_v4 device_path;
-};
+} __packed;
#define EDD_FLAGS_DMA_BOUNDARY_HANDLING 0x0001
#define EDD_FLAGS_REMOVABLE_MEDIA 0x0002
diff --git a/sys/boot/i386/efi/Makefile b/sys/boot/i386/efi/Makefile
index 95c219d3c257..25df59b77d71 100644
--- a/sys/boot/i386/efi/Makefile
+++ b/sys/boot/i386/efi/Makefile
@@ -36,7 +36,7 @@ FILES= loader.efi
FILESMODE_loader.efi= ${BINMODE}
LDSCRIPT= ${.CURDIR}/ldscript.i386
-LDFLAGS= -Wl,-T${LDSCRIPT} -shared -symbolic
+LDFLAGS= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared
${PROG}: ${LDSCRIPT}
diff --git a/sys/boot/i386/efi/exec.c b/sys/boot/i386/efi/exec.c
index fefbf0bb7925..579f5593b24b 100644
--- a/sys/boot/i386/efi/exec.c
+++ b/sys/boot/i386/efi/exec.c
@@ -46,14 +46,4 @@ __v86int()
void
__exec(caddr_t addr, ...)
{
- /* XXX this is wrong */
- __asm __volatile("movl %cr0, %eax");
- __asm __volatile("andl $0x7fffffff, %eax");
- __asm __volatile("mov %eax, %cr0");
- __asm __volatile("xorl %eax, %eax");
- __asm __volatile("mov %eax, %cr3");
- __asm __volatile("movl %cr0, %eax");
- __asm __volatile("andl $0xfffffffe, %eax");
- __asm __volatile("movl %eax, %cr0");
- __asm __volatile("jmp %0" :: "r" (addr));
}
diff --git a/sys/boot/i386/efi/ldscript.amd64 b/sys/boot/i386/efi/ldscript.amd64
index f99e730275de..face49e7258d 100644
--- a/sys/boot/i386/efi/ldscript.amd64
+++ b/sys/boot/i386/efi/ldscript.amd64
@@ -50,19 +50,19 @@ SECTIONS
. = ALIGN(4096);
.dynamic : { *(.dynamic) }
. = ALIGN(4096);
- .rel.dyn : {
- *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
- *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
- *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
- *(.rel.got)
- *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
- *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
- *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
- *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
- *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
- *(.rel.plt)
+ .rela.dyn : {
+ *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
+ *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
+ *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
+ *(.rela.got)
+ *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
+ *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
+ *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
+ *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
+ *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
+ *(.rela.plt)
*(.relset_*)
- *(.rel.dyn .rel.dyn.*)
+ *(.rela.dyn .rela.dyn.*)
}
. = ALIGN(4096);
.reloc : { *(.reloc) }
diff --git a/sys/boot/i386/efi/reloc.c b/sys/boot/i386/efi/reloc.c
index 96f9241a6e49..22c6642e3bfc 100644
--- a/sys/boot/i386/efi/reloc.c
+++ b/sys/boot/i386/efi/reloc.c
@@ -28,21 +28,31 @@
__FBSDID("$FreeBSD$");
#include <sys/types.h>
-#include <sys/elf32.h>
+#include <elf.h>
#include <efi.h>
#include <bootstrap.h>
+#ifdef __i386__
+#define ElfW_Rel Elf32_Rel
+#define ElfW_Dyn Elf32_Dyn
+#define ELFW_R_TYPE ELF32_R_TYPE
+#elif __amd64__
+#define ElfW_Rel Elf64_Rel
+#define ElfW_Dyn Elf64_Dyn
+#define ELFW_R_TYPE ELF64_R_TYPE
+#endif
+
/*
- * A simple relocator for IA32 EFI binaries.
+ * A simple relocator for IA32/AMD64 EFI binaries.
*/
EFI_STATUS
-_reloc(unsigned long ImageBase, Elf32_Dyn *dynamic, EFI_HANDLE image_handle,
+_reloc(unsigned long ImageBase, ElfW_Dyn *dynamic, EFI_HANDLE image_handle,
EFI_SYSTEM_TABLE *system_table)
{
unsigned long relsz, relent;
unsigned long *newaddr;
- Elf32_Rel *rel;
- Elf32_Dyn *dynp;
+ ElfW_Rel *rel;
+ ElfW_Dyn *dynp;
/*
* Find the relocation address, its size and the relocation entry.
@@ -51,14 +61,17 @@ _reloc(unsigned long ImageBase, Elf32_Dyn *dynamic, EFI_HANDLE image_handle,
relent = 0;
for (dynp = dynamic; dynp->d_tag != DT_NULL; dynp++) {
switch (dynp->d_tag) {
+ case DT_RELA:
case DT_REL:
- rel = (Elf32_Rel *) ((unsigned long) dynp->d_un.d_ptr +
+ rel = (ElfW_Rel *) ((unsigned long) dynp->d_un.d_ptr +
ImageBase);
break;
case DT_RELSZ:
+ case DT_RELASZ:
relsz = dynp->d_un.d_val;
break;
case DT_RELENT:
+ case DT_RELAENT:
relent = dynp->d_un.d_val;
break;
default:
@@ -74,7 +87,7 @@ _reloc(unsigned long ImageBase, Elf32_Dyn *dynamic, EFI_HANDLE image_handle,
CTASSERT(R_386_NONE == R_X86_64_NONE);
CTASSERT(R_386_RELATIVE == R_X86_64_RELATIVE);
for (; relsz > 0; relsz -= relent) {
- switch (ELF32_R_TYPE(rel->r_info)) {
+ switch (ELFW_R_TYPE(rel->r_info)) {
case R_386_NONE:
/* No relocation needs be performed. */
break;
@@ -85,9 +98,9 @@ _reloc(unsigned long ImageBase, Elf32_Dyn *dynamic, EFI_HANDLE image_handle,
break;
default:
/* XXX: do we need other relocations ? */
- return (EFI_LOAD_ERROR);
+ break;
}
- rel = (Elf32_Rel *) ((caddr_t) rel + relent);
+ rel = (ElfW_Rel *) ((caddr_t) rel + relent);
}
return (EFI_SUCCESS);
diff --git a/sys/boot/i386/libi386/bootinfo64.c b/sys/boot/i386/libi386/bootinfo64.c
index 0c6d077ebe2b..617414e25176 100644
--- a/sys/boot/i386/libi386/bootinfo64.c
+++ b/sys/boot/i386/libi386/bootinfo64.c
@@ -134,7 +134,8 @@ bi_checkcpu(void)
{
char *cpu_vendor;
int vendor[3];
- int eflags, regs[4];
+ int eflags;
+ unsigned int regs[4];
/* Check for presence of "cpuid". */
eflags = read_eflags();
diff --git a/sys/boot/i386/libi386/comconsole.c b/sys/boot/i386/libi386/comconsole.c
index 382259763452..e2710c163444 100644
--- a/sys/boot/i386/libi386/comconsole.c
+++ b/sys/boot/i386/libi386/comconsole.c
@@ -50,7 +50,6 @@ static int comc_init(int arg);
static void comc_putchar(int c);
static int comc_getchar(void);
static int comc_getspeed(void);
-static void set_hw_console_hint(void);
static int comc_ischar(void);
static int comc_parseint(const char *string);
static uint32_t comc_parse_pcidev(const char *string);
@@ -202,27 +201,14 @@ comc_port_set(struct env_var *ev, int flags, const void *value)
}
if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 &&
- comc_port != port) {
+ comc_port != port)
comc_setup(comc_curspeed, port);
- set_hw_console_hint();
- }
env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
return (CMD_OK);
}
-static void
-set_hw_console_hint(void)
-{
- char intbuf[64];
-
- unsetenv("hw.uart.console");
- sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed);
- env_setenv("hw.uart.console", EV_VOLATILE, intbuf,
- env_noset, env_nounset);
-}
-
/*
* Input: bus:dev:func[:bar]. If bar is not specified, it is 0x10.
* Output: bar[24:16] bus[15:8] dev[7:3] func[2:0]
@@ -288,7 +274,6 @@ comc_pcidev_handle(uint32_t locator)
comc_port_set, env_nounset);
comc_setup(comc_curspeed, port);
- set_hw_console_hint();
comc_locator = locator;
return (CMD_OK);
@@ -318,8 +303,10 @@ static void
comc_setup(int speed, int port)
{
static int TRY_COUNT = 1000000;
+ char intbuf[64];
int tries;
+ unsetenv("hw.uart.console");
comc_curspeed = speed;
comc_port = port;
@@ -334,9 +321,11 @@ comc_setup(int speed, int port)
inb(comc_port + com_data);
while (inb(comc_port + com_lsr) & LSR_RXRDY && ++tries < TRY_COUNT);
- if (tries < TRY_COUNT)
+ if (tries < TRY_COUNT) {
comconsole.c_flags |= (C_PRESENTIN | C_PRESENTOUT);
- else
+ sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed);
+ env_setenv("hw.uart.console", EV_VOLATILE, intbuf, NULL, NULL);
+ } else
comconsole.c_flags &= ~(C_PRESENTIN | C_PRESENTOUT);
}
diff --git a/sys/boot/i386/libi386/devicename.c b/sys/boot/i386/libi386/devicename.c
index 15889d3a11ef..c7705d71386f 100644
--- a/sys/boot/i386/libi386/devicename.c
+++ b/sys/boot/i386/libi386/devicename.c
@@ -128,7 +128,7 @@ i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path)
goto fail;
}
} else {
- cp = np;
+ cp = (char *)np;
}
if (*cp && (*cp != ':')) {
err = EINVAL;
diff --git a/sys/boot/i386/libi386/pxe.c b/sys/boot/i386/libi386/pxe.c
index e4ec5c073bf2..49814ddf9dbe 100644
--- a/sys/boot/i386/libi386/pxe.c
+++ b/sys/boot/i386/libi386/pxe.c
@@ -88,6 +88,12 @@ static int pxe_netif_get(struct iodesc *desc, void *pkt, size_t len,
static int pxe_netif_put(struct iodesc *desc, void *pkt, size_t len);
static void pxe_netif_end(struct netif *nif);
+#ifdef OLD_NFSV2
+int nfs_getrootfh(struct iodesc*, char*, u_char*);
+#else
+int nfs_getrootfh(struct iodesc*, char*, uint32_t*, u_char*);
+#endif
+
extern struct netif_stats pxe_st[];
extern u_int16_t __bangpxeseg;
extern u_int16_t __bangpxeoff;
diff --git a/sys/boot/i386/loader/Makefile b/sys/boot/i386/loader/Makefile
index f91715cec701..0ee8bd8b7ec5 100644
--- a/sys/boot/i386/loader/Makefile
+++ b/sys/boot/i386/loader/Makefile
@@ -103,7 +103,7 @@ FILESMODE_${LOADER}= ${BINMODE} -b
FILES+= loader.help loader.4th support.4th loader.conf
FILES+= screen.4th frames.4th beastie.4th
FILES+= brand.4th check-password.4th color.4th delay.4th
-FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th
+FILES+= menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
FILESDIR_loader.conf= /boot/defaults
.if !exists(${DESTDIR}/boot/loader.rc)