Page MenuHomeFreeBSD

D36144.diff
No OneTemporary

D36144.diff

diff --git a/stand/i386/libi386/amd64_tramp.S b/stand/i386/libi386/amd64_tramp.S
--- a/stand/i386/libi386/amd64_tramp.S
+++ b/stand/i386/libi386/amd64_tramp.S
@@ -44,16 +44,6 @@
.p2align 12,0x40
- .globl PT4
-PT4:
- .space 0x1000
- .globl PT3
-PT3:
- .space 0x1000
- .globl PT2
-PT2:
- .space 0x1000
-
gdtdesc:
.word gdtend - gdt
.long VTOP(gdt) # low
@@ -87,8 +77,11 @@
orl $CR4_PAE, %eax
movl %eax, %cr4
- /* Set %cr3 for PT4 */
- movl $VTOP(PT4), %eax
+ /*
+ * Set %cr3 for PT4. PT4 is on top of the stack. Pop it off so the args
+ * we pass to the kernel are all that remain when we call it.
+ */
+ popl %eax
movl %eax, %cr3
/* Turn on paging (implicitly sets EFER.LMA) */
diff --git a/stand/i386/libi386/elf64_freebsd.c b/stand/i386/libi386/elf64_freebsd.c
--- a/stand/i386/libi386/elf64_freebsd.c
+++ b/stand/i386/libi386/elf64_freebsd.c
@@ -53,9 +53,9 @@
typedef uint64_t p4_entry_t;
typedef uint64_t p3_entry_t;
typedef uint64_t p2_entry_t;
-extern p4_entry_t PT4[];
-extern p3_entry_t PT3[];
-extern p2_entry_t PT2[];
+static p4_entry_t *PT4;
+static p3_entry_t *PT3;
+static p2_entry_t *PT2;
uint32_t entry_hi;
uint32_t entry_lo;
@@ -84,6 +84,10 @@
if (err != 0)
return(err);
+ PT4 = (p4_entry_t *)memalign(PAGE_SIZE, PAGE_SIZE);
+ PT3 = (p3_entry_t *)memalign(PAGE_SIZE, PAGE_SIZE);
+ PT2 = (p2_entry_t *)memalign(PAGE_SIZE, PAGE_SIZE);
+
bzero(PT4, PAGE_SIZE);
bzero(PT3, PAGE_SIZE);
bzero(PT2, PAGE_SIZE);
@@ -113,7 +117,7 @@
#endif
dev_cleanup();
- __exec((void *)VTOP(amd64_tramp), modulep, kernend);
+ __exec((void *)VTOP(amd64_tramp), PT4, modulep, kernend);
panic("exec returned");
}

File Metadata

Mime Type
text/plain
Expires
Sun, Feb 1, 6:32 AM (13 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28297466
Default Alt Text
D36144.diff (1 KB)

Event Timeline