svn commit: r320467 - in head/sys/boot/i386: libi386 loader
Toomas Soome
tsoome at FreeBSD.org
Thu Jun 29 04:33:57 UTC 2017
Author: tsoome
Date: Thu Jun 29 04:33:55 2017
New Revision: 320467
URL: https://svnweb.freebsd.org/changeset/base/320467
Log:
loader: chain load relocate data declaration is bad
The implementation is using fixed size array allocated in asm module,
need to use proper array declaration for C source.
CID: 1376405
Reported by: Coverity, cem
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D11321
Modified:
head/sys/boot/i386/libi386/libi386.h
head/sys/boot/i386/loader/chain.c
Modified: head/sys/boot/i386/libi386/libi386.h
==============================================================================
--- head/sys/boot/i386/libi386/libi386.h Thu Jun 29 03:59:02 2017 (r320466)
+++ head/sys/boot/i386/libi386/libi386.h Thu Jun 29 04:33:55 2017 (r320467)
@@ -71,7 +71,10 @@ struct relocate_data {
extern void relocater(void);
-extern uint32_t relocater_data;
+/*
+ * The relocater_data[] is fixed size array allocated in relocater_tramp.S
+ */
+extern struct relocate_data relocater_data[];
extern uint32_t relocater_size;
extern uint16_t relocator_ip;
Modified: head/sys/boot/i386/loader/chain.c
==============================================================================
--- head/sys/boot/i386/loader/chain.c Thu Jun 29 03:59:02 2017 (r320466)
+++ head/sys/boot/i386/loader/chain.c Thu Jun 29 04:33:55 2017 (r320467)
@@ -58,7 +58,6 @@ command_chain(int argc, char *argv[])
int fd, len, size = SECTOR_SIZE;
struct stat st;
vm_offset_t mem = 0x100000;
- uint32_t *uintptr = &relocater_data;
struct i386_devdesc *rootdev;
if (argc == 1) {
@@ -108,9 +107,9 @@ command_chain(int argc, char *argv[])
return (CMD_ERROR);
}
- uintptr[0] = mem;
- uintptr[1] = 0x7C00;
- uintptr[2] = SECTOR_SIZE;
+ relocater_data[0].src = mem;
+ relocater_data[0].dest = 0x7C00;
+ relocater_data[0].size = SECTOR_SIZE;
relocator_edx = bd_unit2bios(rootdev->d_unit);
relocator_esi = relocater_size;
More information about the svn-src-head
mailing list