Page MenuHomeFreeBSD

D49861.diff
No OneTemporary

D49861.diff

diff --git a/stand/kboot/kboot/main.c b/stand/kboot/kboot/main.c
--- a/stand/kboot/kboot/main.c
+++ b/stand/kboot/kboot/main.c
@@ -49,9 +49,23 @@
extern int command_fdt_internal(int argc, char *argv[]);
+/*
+ * On amd64, KERNSTART is where the first actual kernel page is mapped, after
+ * the compatibility mapping. We reserve 2MB at the start of the address space
+ * for the page tables, etc, and so need to offset this there (and only there).
+ * The loader needs to know about this so we can pad everything to the proper
+ * place in PA. Ideally, we'd include vmparam.h to figure this out, but the
+ * macros it uses are not easily available in this compile environment, so we
+ * hard code that knowledge here.
+ */
+#if defined(__amd64__)
+#define KERN_PADDING (2 << 20)
+#else
+#define KERN_PADDING 0
+#endif
+
#define PA_INVAL (vm_offset_t)-1
static vm_offset_t pa_start = PA_INVAL;
-static vm_offset_t padding;
static vm_offset_t offset;
static uint64_t commit_limit;
@@ -386,6 +400,8 @@
bootdev = getenv("currdev");
}
#endif
+ if (bootdev == NULL)
+ bootdev = "host:/";
if (bootdev != NULL) {
/*
* Otherwise, honor what's on the command line. If we've been
@@ -514,15 +530,13 @@
if (pa_start == PA_INVAL) {
pa_start = kboot_get_phys_load_segment();
-// padding = 2 << 20; /* XXX amd64: revisit this when we make it work */
- padding = 0;
offset = dest;
get_phys_buffer(pa_start, len, &destbuf);
}
remainder = len;
do {
- segsize = get_phys_buffer(dest + pa_start + padding - offset, remainder, &destbuf);
+ segsize = get_phys_buffer(dest + pa_start + KERN_PADDING - offset, remainder, &destbuf);
bcopy(src, destbuf, segsize);
remainder -= segsize;
src += segsize;
@@ -540,7 +554,7 @@
remainder = len;
do {
- segsize = get_phys_buffer(src + pa_start + padding - offset, remainder, &srcbuf);
+ segsize = get_phys_buffer(src + pa_start + KERN_PADDING - offset, remainder, &srcbuf);
bcopy(srcbuf, dest, segsize);
remainder -= segsize;
src += segsize;

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 27, 8:17 AM (12 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26250132
Default Alt Text
D49861.diff (1 KB)

Event Timeline