why it give error message " physical memory read error "
Posted: Sun Sep 14, 2014 9:25 pm
give error message when run this program
--------------------------------------------------------
compilation
---------------------------
nasm -g -felf boot.asm
boot.asm:109: warning: dword data exceeds bounds
ld -Tkernel.ld -o kernel boot.o kernel.o
mod edit: added code tags
--------------------------------------------------------
Code: Select all
(0) [0x000000000010000c] 0008:0010000c (unk. ctxt): cmp eax, 0x2badb002 ; 3d02b0ad2b
<bochs:8> s
Next at t=77386328
(0) [0x0000000000100011] 0008:00100011 (unk. ctxt): jnz .+66 (0x00100055) ; 7542
<bochs:9>
Next at t=77386329
(0) [0x0000000000100013] 0008:00100013 (unk. ctxt): mov ecx, 0x00101000 ; b900101000
<bochs:10>
Next at t=77386330
(0) [0x0000000000100018] 0008:00100018 (unk. ctxt): mov cr3, ecx ; 0f22d9
<bochs:11>
Next at t=77386331
(0) [0x000000000010001b] 0008:0010001b (unk. ctxt): mov ecx, cr4 ; 0f20e1
<bochs:12>
Next at t=77386332
(0) [0x000000000010001e] 0008:0010001e (unk. ctxt): or ecx, 0x00000010 ; 83c910
<bochs:13>
Next at t=77386333
(0) [0x0000000000100021] 0008:00100021 (unk. ctxt): mov cr4, ecx ; 0f22e1
<bochs:14>
Next at t=77386334
(0) [0x0000000000100024] 0008:00100024 (unk. ctxt): mov ecx, cr0 ; 0f20c1
<bochs:15>
Next at t=77386335
(0) [0x0000000000100027] 0008:00100027 (unk. ctxt): or ecx, 0x80000000 ; 81c900000080
<bochs:16>
Next at t=77386336
(0) [0x000000000010002d] 0008:0010002d (unk. ctxt): mov cr0, ecx ; 0f22c1
<bochs:17>
Next at t=77386337
bx_dbg_read_linear: physical memory read error (phy=0x0000008100100030, lin=0x00100030)
Code: Select all
boot.asm
-----------------
global _loader ; Make entry point visible to linker.
extern _main ; _main is defined elsewhere
extern _ebss
global kernel_pageTable
global identity_PageTable
; setting up the Multiboot header - see GRUB docs for details
MODULEALIGN equ 1<<0 ; align loaded modules on page boundaries
MEMINFO equ 1<<1 ; provide memory map
FLAGS equ MODULEALIGN | MEMINFO ; this is the Multiboot 'flag' field
MAGIC equ 0x1BADB002 ; 'magic number' lets bootloader find the header
CHECKSUM equ -(MAGIC + FLAGS) ; checksum required
PAGESIZE equ 0x1000
KERNEL_VIRTUAL_BASE equ 0xC0000000 ; 3GB
KERNEL_PAGE_NUMBER equ (KERNEL_VIRTUAL_BASE >> 22) ; Page directory index of kernel's 4MB PTE.
IPT equ identity_PageTable - KERNEL_VIRTUAL_BASE
section .text
align 4
MultiBootHeader:
dd MAGIC
dd FLAGS
dd CHECKSUM
; reserve initial kernel stack space -- that's 16k.
STACKSIZE equ 0x4000
; setting up entry point for linker
loader equ (_loader - 0xC0000000)
global _loader
_loader:
mov ecx, (BootPageDirectory - KERNEL_VIRTUAL_BASE)
mov cr3, ecx ; Load Page Directory Base Register.
mov ecx, cr4
or ecx, 0x00000010 ; Set PSE bit in CR4 to enable 4MB pages.
mov cr4, ecx
mov ecx, cr0
or ecx, 0x80000000 ; Set PG bit in CR0 to enable paging.
mov cr0, ecx
lea ecx, [StartInHigherHalf]
jmp ecx ; NOTE: Must be absolute jump!
StartInHigherHalf:
mov dword [BootPageDirectory], 0
invlpg [0]
mov esp, stack+STACKSIZE ; set up the stack
push eax ; pass Multiboot magic number
push ebx
loop:
hlt ; halt machine should kernel return
jmp loop
section .data
align 0x1000
BootPageDirectory:
dd IPT+0x83
times (KERNEL_PAGE_NUMBER - 1) dd 0 ; Pages before kernel space.
; This page directory entry defines a 4MB page containing the kernel.
dd 0x00000083
times (1024 - KERNEL_PAGE_NUMBER - 1) dd 0 ; Pages after the kernel image.
align 4096
identity_PageTable:
%assign i 0
%rep 1024
dd i*0x1000+0x83
%assign i i+1
%endrep
section .bss
align 32
stack:
resb STACKSIZE ; reserve 16k stack on a quadword boundary
kernel.ld
------------------
ENTRY(_loader)
OUTPUT_FORMAT(elf32-i386)
SECTIONS {
/* The kernel will live at 3GB + 1MB in the virtual
address space, which will be mapped to 1MB in the
physical address space. */
. = 0xC0100000;
.text : AT(ADDR(.text) - 0xC0000000) {
*(.text)
*(.rodata*)
}
.data ALIGN (0x1000) : AT(ADDR(.data) - 0xC0000000) {
*(.data)
}
.bss : AT(ADDR(.bss) - 0xC0000000) {
_sbss = .;
*(COMMON)
*(.bss)
_ebss = .;
}
}
---------------------------
nasm -g -felf boot.asm
boot.asm:109: warning: dword data exceeds bounds
ld -Tkernel.ld -o kernel boot.o kernel.o
mod edit: added code tags