Permalink
Browse files

. 修正批处理文件不能加载 kernel、initrd。

. 修正 mem64 不能正常工作。开放 mem64 函数。
  • Loading branch information...
yaya
yaya committed May 6, 2017
1 parent 32d31ba commit 19abfe10d5376da6e956e0ce7ed0184583fee6d0
Showing with 5 additions and 5 deletions.
  1. +3 −3 stage2/asm.S
  2. +2 −2 stage2/char_io.c
View
@@ -10972,7 +10972,7 @@ ENTRY(mem64)
movl %eax, %cr3 # load new PML4 base
movl %cr4, %eax
orb $0x20, %al # 0x80=PGE, 0x20=PAE, 0x10=PSE
orb $0x30, %al # 0x80=PGE, 0x20=PAE, 0x10=PSE
movl %eax, %cr4 # load new cr4
/* rdmsr will change EDX:EAX */
@@ -10995,7 +10995,7 @@ ENTRY(mem64)
/* 12(%ebp) = dest */
/* 8(%ebp) = func */
movl %esp, %ebp # clear upper 32-bit of %rbp
movl %ebp, %ebp # clear upper 32-bit of %rbp
movl 8(%rbp), %eax
testl %eax, %eax
jz 1f
@@ -16805,7 +16805,7 @@ default_iret:
#define memcmp ((int (*)(const char *, const char *, int))((*(int **)0x8300)[22]))
#define memmove ((void *(*)(void *, const void *, int))((*(int **)0x8300)[23]))
#define memset ((void *(*)(void *, int, int))((*(int **)0x8300)[24]))
#define mem64 ((int (*)(int, unsigned long long, unsigned long long, unsigned long long))((*(int **)0x8300)[25]))
#define mem64 ((int (*)(int, unsigned long long, unsigned long long, unsigned long long))((*(int **)0x8300)[74]))
#define open ((int (*)(char *))((*(int **)0x8300)[26]))
#define read ((unsigned long (*)(unsigned long long, unsigned long long, unsigned long))((*(int **)0x8300)[27]))
#define close ((void (*)(void))((*(int **)0x8300)[28]))
View
@@ -2451,7 +2451,7 @@ grub_memset64 (unsigned long long start, unsigned long long c, unsigned long lon
#define SRC_VIRTUAL_PTR(addr) ((void*)SRC_VIRTUAL_ADDR(addr))
// Set to 0 to test mem64 function
#define DISABLE_AMD64 1
#define DISABLE_AMD64 0
extern void memory_paging_init(void);
extern void memory_paging_enable(void);
@@ -2521,7 +2521,7 @@ void memory_paging_enable()
asm volatile (
"movl %%cr0, %0; movl %%cr4, %1; \n\t"
"orl $0x80000001,%0; \n\t" // CR0.PE(bit0)|PG(bit31)
"orl $0x00000030,%1; \n\t" // CR4.PAE(bit4)|PSE(bit5)
"orl $0x00000030,%1; \n\t" // CR4.PAE(bit5)|PSE(bit4)
"movl %1, %%cr4; \n\t" // set PAE|PSE
"movl %2, %%cr3; \n\t" // point to PDPT
"movl %0, %%cr0; \n\t" // set PE|PG

0 comments on commit 19abfe1

Please sign in to comment.