OSdev: MM - paging

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
derva
Posts: 8
Joined: Sat Oct 19, 2024 3:46 pm

OSdev: MM - paging

Post by derva »

Hi all,

I'm trying to implement now paging, I have Physical memory manager, and start to work on Virtual Memory Manager.

As far as I understand I did everything as it should be, make page directory, load it page directory to CR3, and set CR0 32nd bit to 1.
But after I complie my OS it keeps crushing constantly

paging.asm

Code: Select all

.text
.global loadPageDirectory
.global enablePaging

loadPageDirectory:
    push %ebp
    mov %esp, %ebp
    mov 8(%esp), %eax    # Load page directory address from stack argument
    mov %eax, %cr3       # Move address to CR3 register
    mov %ebp, %esp
    pop %ebp
    ret

enablePaging:
    push %ebp
    mov %esp, %ebp
    mov %cr0, %eax
    or $0x80000000, %eax  # Set paging bit (bit 31)
    mov %eax, %cr0
    mov %ebp, %esp
    pop %ebp
    ret
   

virtual_memory_manager.c

Code: Select all

void init_paging() {
	//initialzing page directory/ies
	for (uint16_t i = 0; i < 1024; i++) {
		current_page_dir->entries[i] = 0x00000002;
	}

	//init page table
	page_table *first_page_table;
	unsigned int i;
	for (i = 0; i < 1024; i++) {
		//0x1000 = 4096
		first_page_table->entries[i] = (i * PAGE_SIZE) | 3;
	}

	current_page_dir->entries[0] = (uint32_t)first_page_table | 3;

	loadPageDirectory((unsigned int *)current_page_dir);
	enablePaging();
}

Any hints would be appreaciate, I'm not sure where my mistake is :/
OS repo can be found here https://github.com/derva/os
Last edited by derva on Sat Nov 30, 2024 12:18 pm, edited 1 time in total.
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: OSdev: MM - paging

Post by nexos »

You never initialized the first_page_table pointer, so it points to a random (invalid) address. Also how it current_page_dir initialized?
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
derva
Posts: 8
Joined: Sat Oct 19, 2024 3:46 pm

Re: OSdev: MM - paging

Post by derva »

nexos wrote: Sat Nov 30, 2024 9:17 am You never initialized the first_page_table pointer, so it points to a random (invalid) address. Also how it current_page_dir initialized?
hmm, you're correct, but shouldn't that be the correct way (for first_page_table). Here's how I see it
we need to create structure (for page table) and I initialize it at some random address then tell CPU here's first page_table (?)
source: https://wiki.osdev.org/Setting_Up_Paging

current_page_dir is initliaze at top of the file

Code: Select all

page_directory *current_page_dir = 0;

Code: Select all

typedef uint32_t pd_entry;
typedef uint32_t pt_entry;
typedef struct {
	pt_entry entries[PAGES_PER_TABLE];
} page_table;

typedef struct {
	pd_entry entries[TABLES_PER_DIRECTORY];
} page_directory;
MichaelPetch
Member
Member
Posts: 797
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: OSdev: MM - paging

Post by MichaelPetch »

I think it is worth pointing out that:

Code: Select all

    //init page table
    page_table *first_page_table;
does not initialize a page table. It creates a pointer to a `page_table` but doesn't allocate any memory for it. No, you can't just write to any old random memory address that `first_page_table` may point at. In the Wiki link it does this at global scope (not in a function):

Code: Select all

uint32_t first_page_table[1024] __attribute__((aligned(4096)));
This allocates a 4KiB (1024 32-bit unsigned integers) variable with 4KiB alignment (page tables have to be 4KiB aligned) called `first_page_table`. That actually allocates space in the kernel's `.bss` section.

If you have a functioning physical memory manager then just request a free 4KiB page frame and assign that physical address to `page_table *first_page_table`.
derva
Posts: 8
Joined: Sat Oct 19, 2024 3:46 pm

Re: OSdev: MM - paging

Post by derva »

I see

I change code to this

Code: Select all

unsigned int page_directory[1024] __attribute__((aligned(4096)));
unsigned int page_table[1024] __attribute__((aligned(4096)));

void init_paging() {
	for(int i = 0; i < 1024; i++) {
		page_directory[i] = 0x00000002;
	}

	//we will fill all 1024 entries in the table, mapping 4 megabytes
	for(unsigned int i = 0; i < 1024; i++)
	{
		// As the address is page aligned, it will always leave 12 bits zeroed.
		// Those bits are used by the attributes ;)
		page_table[i] = (i * 0x1000) | 3; // attributes: supervisor level, read/write, present.
	}

	page_directory[0] = ((unsigned int)page_table) | 3;
	
	loadPageDirectory(page_directory);
	enablePaging();
}

and call it in kernel.c like this

Code: Select all

void kernel_main(unsigned int magic, struct multiboot_info* mbt) {

	terminal_initialize();

	terminal_writestring("Memory info\n");
	initPMM(mbt);
	init_paging();
	terminal_writestring("\n");
	terminal_writestring("Paging enabled");
    
	initGdt(); //init gdt
}
but still it keeps crushing, after I run it
MichaelPetch
Member
Member
Posts: 797
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: OSdev: MM - paging

Post by MichaelPetch »

Can you update your Github to the latest version with all these changes? I noticed that what you have is older and didn't have any paging code in it.
derva
Posts: 8
Joined: Sat Oct 19, 2024 3:46 pm

Re: OSdev: MM - paging

Post by derva »

Yes, I can, thanks.

I just did it

there is new branch paging
MichaelPetch
Member
Member
Posts: 797
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: OSdev: MM - paging

Post by MichaelPetch »

I did a checkout out the `paging` branch. I ran make on it and ran it in QEMU. It worked. It said `paging enabled` and went into an infinite loop. When I used `info mem` and `info tlb` in the QEMU monitor the paging appears as it should with the first 4MiB of memory identity mapped. `info mem` and `info tlb` showed:

Code: Select all

(qemu) info mem
0000000000000000-0000000000400000 0000000000400000 -rw
(qemu) info tlb
0000000000000000: 0000000000000000 ---DA---W
0000000000001000: 0000000000001000 --------W
0000000000002000: 0000000000002000 --------W
0000000000003000: 0000000000003000 --------W
0000000000004000: 0000000000004000 --------W
0000000000005000: 0000000000005000 --------W
0000000000006000: 0000000000006000 --------W
0000000000007000: 0000000000007000 --------W
0000000000008000: 0000000000008000 --------W
0000000000009000: 0000000000009000 --------W
000000000000a000: 000000000000a000 --------W
000000000000b000: 000000000000b000 --------W
000000000000c000: 000000000000c000 --------W
000000000000d000: 000000000000d000 --------W
000000000000e000: 000000000000e000 --------W
000000000000f000: 000000000000f000 --------W
0000000000010000: 0000000000010000 --------W
0000000000011000: 0000000000011000 --------W
0000000000012000: 0000000000012000 --------W
0000000000013000: 0000000000013000 --------W
0000000000014000: 0000000000014000 --------W
0000000000015000: 0000000000015000 --------W
0000000000016000: 0000000000016000 --------W
0000000000017000: 0000000000017000 --------W
0000000000018000: 0000000000018000 --------W
0000000000019000: 0000000000019000 --------W
000000000001a000: 000000000001a000 --------W
000000000001b000: 000000000001b000 --------W
000000000001c000: 000000000001c000 --------W
000000000001d000: 000000000001d000 --------W
000000000001e000: 000000000001e000 --------W
000000000001f000: 000000000001f000 --------W
0000000000020000: 0000000000020000 --------W
0000000000021000: 0000000000021000 --------W
0000000000022000: 0000000000022000 --------W
0000000000023000: 0000000000023000 --------W
0000000000024000: 0000000000024000 --------W
0000000000025000: 0000000000025000 --------W
0000000000026000: 0000000000026000 --------W
0000000000027000: 0000000000027000 --------W
0000000000028000: 0000000000028000 --------W
0000000000029000: 0000000000029000 --------W
000000000002a000: 000000000002a000 --------W
000000000002b000: 000000000002b000 --------W
000000000002c000: 000000000002c000 --------W
000000000002d000: 000000000002d000 --------W
000000000002e000: 000000000002e000 --------W
000000000002f000: 000000000002f000 --------W
0000000000030000: 0000000000030000 --------W
0000000000031000: 0000000000031000 --------W
0000000000032000: 0000000000032000 --------W
0000000000033000: 0000000000033000 --------W
0000000000034000: 0000000000034000 --------W
0000000000035000: 0000000000035000 --------W
0000000000036000: 0000000000036000 --------W
0000000000037000: 0000000000037000 --------W
0000000000038000: 0000000000038000 --------W
0000000000039000: 0000000000039000 --------W
000000000003a000: 000000000003a000 --------W
000000000003b000: 000000000003b000 --------W
000000000003c000: 000000000003c000 --------W
000000000003d000: 000000000003d000 --------W
000000000003e000: 000000000003e000 --------W
000000000003f000: 000000000003f000 --------W
0000000000040000: 0000000000040000 --------W
0000000000041000: 0000000000041000 --------W
0000000000042000: 0000000000042000 --------W
0000000000043000: 0000000000043000 --------W
0000000000044000: 0000000000044000 --------W
0000000000045000: 0000000000045000 --------W
0000000000046000: 0000000000046000 --------W
0000000000047000: 0000000000047000 --------W
0000000000048000: 0000000000048000 --------W
0000000000049000: 0000000000049000 --------W
000000000004a000: 000000000004a000 --------W
000000000004b000: 000000000004b000 --------W
000000000004c000: 000000000004c000 --------W
000000000004d000: 000000000004d000 --------W
000000000004e000: 000000000004e000 --------W
000000000004f000: 000000000004f000 --------W
0000000000050000: 0000000000050000 --------W
0000000000051000: 0000000000051000 --------W
0000000000052000: 0000000000052000 --------W
0000000000053000: 0000000000053000 --------W
0000000000054000: 0000000000054000 --------W
0000000000055000: 0000000000055000 --------W
0000000000056000: 0000000000056000 --------W
0000000000057000: 0000000000057000 --------W
0000000000058000: 0000000000058000 --------W
0000000000059000: 0000000000059000 --------W
000000000005a000: 000000000005a000 --------W
000000000005b000: 000000000005b000 --------W
000000000005c000: 000000000005c000 --------W
000000000005d000: 000000000005d000 --------W
000000000005e000: 000000000005e000 --------W
000000000005f000: 000000000005f000 --------W
0000000000060000: 0000000000060000 --------W
0000000000061000: 0000000000061000 --------W
0000000000062000: 0000000000062000 --------W
0000000000063000: 0000000000063000 --------W
0000000000064000: 0000000000064000 --------W
0000000000065000: 0000000000065000 --------W
0000000000066000: 0000000000066000 --------W
0000000000067000: 0000000000067000 --------W
0000000000068000: 0000000000068000 --------W
0000000000069000: 0000000000069000 --------W
000000000006a000: 000000000006a000 --------W
000000000006b000: 000000000006b000 --------W
000000000006c000: 000000000006c000 --------W
000000000006d000: 000000000006d000 --------W
000000000006e000: 000000000006e000 --------W
000000000006f000: 000000000006f000 --------W
0000000000070000: 0000000000070000 --------W
0000000000071000: 0000000000071000 --------W
0000000000072000: 0000000000072000 --------W
0000000000073000: 0000000000073000 --------W
0000000000074000: 0000000000074000 --------W
0000000000075000: 0000000000075000 --------W
0000000000076000: 0000000000076000 --------W
0000000000077000: 0000000000077000 --------W
0000000000078000: 0000000000078000 --------W
0000000000079000: 0000000000079000 --------W
000000000007a000: 000000000007a000 --------W
000000000007b000: 000000000007b000 --------W
000000000007c000: 000000000007c000 --------W
000000000007d000: 000000000007d000 --------W
000000000007e000: 000000000007e000 --------W
000000000007f000: 000000000007f000 --------W
0000000000080000: 0000000000080000 --------W
0000000000081000: 0000000000081000 --------W
0000000000082000: 0000000000082000 --------W
0000000000083000: 0000000000083000 --------W
0000000000084000: 0000000000084000 --------W
0000000000085000: 0000000000085000 --------W
0000000000086000: 0000000000086000 --------W
0000000000087000: 0000000000087000 --------W
0000000000088000: 0000000000088000 --------W
0000000000089000: 0000000000089000 --------W
000000000008a000: 000000000008a000 --------W
000000000008b000: 000000000008b000 --------W
000000000008c000: 000000000008c000 --------W
000000000008d000: 000000000008d000 --------W
000000000008e000: 000000000008e000 --------W
000000000008f000: 000000000008f000 --------W
0000000000090000: 0000000000090000 --------W
0000000000091000: 0000000000091000 --------W
0000000000092000: 0000000000092000 --------W
0000000000093000: 0000000000093000 --------W
0000000000094000: 0000000000094000 --------W
0000000000095000: 0000000000095000 --------W
0000000000096000: 0000000000096000 --------W
0000000000097000: 0000000000097000 --------W
0000000000098000: 0000000000098000 --------W
0000000000099000: 0000000000099000 --------W
000000000009a000: 000000000009a000 --------W
000000000009b000: 000000000009b000 --------W
000000000009c000: 000000000009c000 --------W
000000000009d000: 000000000009d000 --------W
000000000009e000: 000000000009e000 --------W
000000000009f000: 000000000009f000 --------W
00000000000a0000: 00000000000a0000 --------W
00000000000a1000: 00000000000a1000 --------W
00000000000a2000: 00000000000a2000 --------W
00000000000a3000: 00000000000a3000 --------W
00000000000a4000: 00000000000a4000 --------W
00000000000a5000: 00000000000a5000 --------W
00000000000a6000: 00000000000a6000 --------W
00000000000a7000: 00000000000a7000 --------W
00000000000a8000: 00000000000a8000 --------W
00000000000a9000: 00000000000a9000 --------W
00000000000aa000: 00000000000aa000 --------W
00000000000ab000: 00000000000ab000 --------W
00000000000ac000: 00000000000ac000 --------W
00000000000ad000: 00000000000ad000 --------W
00000000000ae000: 00000000000ae000 --------W
00000000000af000: 00000000000af000 --------W
00000000000b0000: 00000000000b0000 --------W
00000000000b1000: 00000000000b1000 --------W
00000000000b2000: 00000000000b2000 --------W
00000000000b3000: 00000000000b3000 --------W
00000000000b4000: 00000000000b4000 --------W
00000000000b5000: 00000000000b5000 --------W
00000000000b6000: 00000000000b6000 --------W
00000000000b7000: 00000000000b7000 --------W
00000000000b8000: 00000000000b8000 ---DA---W
00000000000b9000: 00000000000b9000 --------W
00000000000ba000: 00000000000ba000 --------W
00000000000bb000: 00000000000bb000 --------W
00000000000bc000: 00000000000bc000 --------W
00000000000bd000: 00000000000bd000 --------W
00000000000be000: 00000000000be000 --------W
00000000000bf000: 00000000000bf000 --------W
00000000000c0000: 00000000000c0000 --------W
00000000000c1000: 00000000000c1000 --------W
00000000000c2000: 00000000000c2000 --------W
00000000000c3000: 00000000000c3000 --------W
00000000000c4000: 00000000000c4000 --------W
00000000000c5000: 00000000000c5000 --------W
00000000000c6000: 00000000000c6000 --------W
00000000000c7000: 00000000000c7000 --------W
00000000000c8000: 00000000000c8000 --------W
00000000000c9000: 00000000000c9000 --------W
00000000000ca000: 00000000000ca000 --------W
00000000000cb000: 00000000000cb000 --------W
00000000000cc000: 00000000000cc000 --------W
00000000000cd000: 00000000000cd000 --------W
00000000000ce000: 00000000000ce000 --------W
00000000000cf000: 00000000000cf000 --------W
00000000000d0000: 00000000000d0000 --------W
00000000000d1000: 00000000000d1000 --------W
00000000000d2000: 00000000000d2000 --------W
00000000000d3000: 00000000000d3000 --------W
00000000000d4000: 00000000000d4000 --------W
00000000000d5000: 00000000000d5000 --------W
00000000000d6000: 00000000000d6000 --------W
00000000000d7000: 00000000000d7000 --------W
00000000000d8000: 00000000000d8000 --------W
00000000000d9000: 00000000000d9000 --------W
00000000000da000: 00000000000da000 --------W
00000000000db000: 00000000000db000 --------W
00000000000dc000: 00000000000dc000 --------W
00000000000dd000: 00000000000dd000 --------W
00000000000de000: 00000000000de000 --------W
00000000000df000: 00000000000df000 --------W
00000000000e0000: 00000000000e0000 --------W
00000000000e1000: 00000000000e1000 --------W
00000000000e2000: 00000000000e2000 --------W
00000000000e3000: 00000000000e3000 --------W
00000000000e4000: 00000000000e4000 --------W
00000000000e5000: 00000000000e5000 --------W
00000000000e6000: 00000000000e6000 --------W
00000000000e7000: 00000000000e7000 --------W
00000000000e8000: 00000000000e8000 --------W
00000000000e9000: 00000000000e9000 --------W
00000000000ea000: 00000000000ea000 --------W
00000000000eb000: 00000000000eb000 --------W
00000000000ec000: 00000000000ec000 --------W
00000000000ed000: 00000000000ed000 --------W
00000000000ee000: 00000000000ee000 --------W
00000000000ef000: 00000000000ef000 --------W
00000000000f0000: 00000000000f0000 --------W
00000000000f1000: 00000000000f1000 --------W
00000000000f2000: 00000000000f2000 --------W
00000000000f3000: 00000000000f3000 --------W
00000000000f4000: 00000000000f4000 --------W
00000000000f5000: 00000000000f5000 --------W
00000000000f6000: 00000000000f6000 --------W
00000000000f7000: 00000000000f7000 --------W
00000000000f8000: 00000000000f8000 --------W
00000000000f9000: 00000000000f9000 --------W
00000000000fa000: 00000000000fa000 --------W
00000000000fb000: 00000000000fb000 --------W
00000000000fc000: 00000000000fc000 --------W
00000000000fd000: 00000000000fd000 --------W
00000000000fe000: 00000000000fe000 --------W
00000000000ff000: 00000000000ff000 --------W
0000000000100000: 0000000000100000 --------W
0000000000101000: 0000000000101000 --------W
0000000000102000: 0000000000102000 --------W
0000000000103000: 0000000000103000 --------W
0000000000104000: 0000000000104000 --------W
0000000000105000: 0000000000105000 --------W
0000000000106000: 0000000000106000 --------W
0000000000107000: 0000000000107000 --------W
0000000000108000: 0000000000108000 --------W
0000000000109000: 0000000000109000 --------W
000000000010a000: 000000000010a000 --------W
000000000010b000: 000000000010b000 --------W
000000000010c000: 000000000010c000 --------W
000000000010d000: 000000000010d000 --------W
000000000010e000: 000000000010e000 --------W
000000000010f000: 000000000010f000 --------W
0000000000110000: 0000000000110000 --------W
0000000000111000: 0000000000111000 --------W
0000000000112000: 0000000000112000 --------W
0000000000113000: 0000000000113000 --------W
0000000000114000: 0000000000114000 --------W
0000000000115000: 0000000000115000 --------W
0000000000116000: 0000000000116000 --------W
0000000000117000: 0000000000117000 --------W
0000000000118000: 0000000000118000 --------W
0000000000119000: 0000000000119000 --------W
000000000011a000: 000000000011a000 --------W
000000000011b000: 000000000011b000 --------W
000000000011c000: 000000000011c000 --------W
000000000011d000: 000000000011d000 --------W
000000000011e000: 000000000011e000 --------W
000000000011f000: 000000000011f000 --------W
0000000000120000: 0000000000120000 --------W
0000000000121000: 0000000000121000 --------W
0000000000122000: 0000000000122000 --------W
0000000000123000: 0000000000123000 --------W
0000000000124000: 0000000000124000 --------W
0000000000125000: 0000000000125000 --------W
0000000000126000: 0000000000126000 --------W
0000000000127000: 0000000000127000 --------W
0000000000128000: 0000000000128000 --------W
0000000000129000: 0000000000129000 --------W
000000000012a000: 000000000012a000 --------W
000000000012b000: 000000000012b000 --------W
000000000012c000: 000000000012c000 --------W
000000000012d000: 000000000012d000 --------W
000000000012e000: 000000000012e000 --------W
000000000012f000: 000000000012f000 --------W
0000000000130000: 0000000000130000 --------W
0000000000131000: 0000000000131000 --------W
0000000000132000: 0000000000132000 --------W
0000000000133000: 0000000000133000 --------W
0000000000134000: 0000000000134000 --------W
0000000000135000: 0000000000135000 --------W
0000000000136000: 0000000000136000 --------W
0000000000137000: 0000000000137000 --------W
0000000000138000: 0000000000138000 --------W
0000000000139000: 0000000000139000 --------W
000000000013a000: 000000000013a000 --------W
000000000013b000: 000000000013b000 --------W
000000000013c000: 000000000013c000 --------W
000000000013d000: 000000000013d000 --------W
000000000013e000: 000000000013e000 --------W
000000000013f000: 000000000013f000 --------W
0000000000140000: 0000000000140000 --------W
0000000000141000: 0000000000141000 --------W
0000000000142000: 0000000000142000 --------W
0000000000143000: 0000000000143000 --------W
0000000000144000: 0000000000144000 --------W
0000000000145000: 0000000000145000 --------W
0000000000146000: 0000000000146000 --------W
0000000000147000: 0000000000147000 --------W
0000000000148000: 0000000000148000 --------W
0000000000149000: 0000000000149000 --------W
000000000014a000: 000000000014a000 --------W
000000000014b000: 000000000014b000 --------W
000000000014c000: 000000000014c000 --------W
000000000014d000: 000000000014d000 --------W
000000000014e000: 000000000014e000 --------W
000000000014f000: 000000000014f000 --------W
0000000000150000: 0000000000150000 --------W
0000000000151000: 0000000000151000 --------W
0000000000152000: 0000000000152000 --------W
0000000000153000: 0000000000153000 --------W
0000000000154000: 0000000000154000 --------W
0000000000155000: 0000000000155000 --------W
0000000000156000: 0000000000156000 --------W
0000000000157000: 0000000000157000 --------W
0000000000158000: 0000000000158000 --------W
0000000000159000: 0000000000159000 --------W
000000000015a000: 000000000015a000 --------W
000000000015b000: 000000000015b000 --------W
000000000015c000: 000000000015c000 --------W
000000000015d000: 000000000015d000 --------W
000000000015e000: 000000000015e000 --------W
000000000015f000: 000000000015f000 --------W
0000000000160000: 0000000000160000 --------W
0000000000161000: 0000000000161000 --------W
0000000000162000: 0000000000162000 --------W
0000000000163000: 0000000000163000 --------W
0000000000164000: 0000000000164000 --------W
0000000000165000: 0000000000165000 --------W
0000000000166000: 0000000000166000 --------W
0000000000167000: 0000000000167000 --------W
0000000000168000: 0000000000168000 --------W
0000000000169000: 0000000000169000 --------W
000000000016a000: 000000000016a000 --------W
000000000016b000: 000000000016b000 --------W
000000000016c000: 000000000016c000 --------W
000000000016d000: 000000000016d000 --------W
000000000016e000: 000000000016e000 --------W
000000000016f000: 000000000016f000 --------W
0000000000170000: 0000000000170000 --------W
0000000000171000: 0000000000171000 --------W
0000000000172000: 0000000000172000 --------W
0000000000173000: 0000000000173000 --------W
0000000000174000: 0000000000174000 --------W
0000000000175000: 0000000000175000 --------W
0000000000176000: 0000000000176000 --------W
0000000000177000: 0000000000177000 --------W
0000000000178000: 0000000000178000 --------W
0000000000179000: 0000000000179000 --------W
000000000017a000: 000000000017a000 --------W
000000000017b000: 000000000017b000 --------W
000000000017c000: 000000000017c000 --------W
000000000017d000: 000000000017d000 --------W
000000000017e000: 000000000017e000 --------W
000000000017f000: 000000000017f000 --------W
0000000000180000: 0000000000180000 --------W
0000000000181000: 0000000000181000 --------W
0000000000182000: 0000000000182000 --------W
0000000000183000: 0000000000183000 --------W
0000000000184000: 0000000000184000 --------W
0000000000185000: 0000000000185000 --------W
0000000000186000: 0000000000186000 --------W
0000000000187000: 0000000000187000 --------W
0000000000188000: 0000000000188000 --------W
0000000000189000: 0000000000189000 --------W
000000000018a000: 000000000018a000 --------W
000000000018b000: 000000000018b000 --------W
000000000018c000: 000000000018c000 --------W
000000000018d000: 000000000018d000 --------W
000000000018e000: 000000000018e000 --------W
000000000018f000: 000000000018f000 --------W
0000000000190000: 0000000000190000 --------W
0000000000191000: 0000000000191000 --------W
0000000000192000: 0000000000192000 --------W
0000000000193000: 0000000000193000 --------W
0000000000194000: 0000000000194000 --------W
0000000000195000: 0000000000195000 --------W
0000000000196000: 0000000000196000 --------W
0000000000197000: 0000000000197000 --------W
0000000000198000: 0000000000198000 --------W
0000000000199000: 0000000000199000 --------W
000000000019a000: 000000000019a000 --------W
000000000019b000: 000000000019b000 --------W
000000000019c000: 000000000019c000 --------W
000000000019d000: 000000000019d000 --------W
000000000019e000: 000000000019e000 --------W
000000000019f000: 000000000019f000 --------W
00000000001a0000: 00000000001a0000 --------W
00000000001a1000: 00000000001a1000 --------W
00000000001a2000: 00000000001a2000 --------W
00000000001a3000: 00000000001a3000 --------W
00000000001a4000: 00000000001a4000 --------W
00000000001a5000: 00000000001a5000 --------W
00000000001a6000: 00000000001a6000 --------W
00000000001a7000: 00000000001a7000 --------W
00000000001a8000: 00000000001a8000 --------W
00000000001a9000: 00000000001a9000 --------W
00000000001aa000: 00000000001aa000 --------W
00000000001ab000: 00000000001ab000 --------W
00000000001ac000: 00000000001ac000 --------W
00000000001ad000: 00000000001ad000 --------W
00000000001ae000: 00000000001ae000 --------W
00000000001af000: 00000000001af000 --------W
00000000001b0000: 00000000001b0000 --------W
00000000001b1000: 00000000001b1000 --------W
00000000001b2000: 00000000001b2000 --------W
00000000001b3000: 00000000001b3000 --------W
00000000001b4000: 00000000001b4000 --------W
00000000001b5000: 00000000001b5000 --------W
00000000001b6000: 00000000001b6000 --------W
00000000001b7000: 00000000001b7000 --------W
00000000001b8000: 00000000001b8000 --------W
00000000001b9000: 00000000001b9000 --------W
00000000001ba000: 00000000001ba000 --------W
00000000001bb000: 00000000001bb000 --------W
00000000001bc000: 00000000001bc000 --------W
00000000001bd000: 00000000001bd000 --------W
00000000001be000: 00000000001be000 --------W
00000000001bf000: 00000000001bf000 --------W
00000000001c0000: 00000000001c0000 --------W
00000000001c1000: 00000000001c1000 --------W
00000000001c2000: 00000000001c2000 --------W
00000000001c3000: 00000000001c3000 --------W
00000000001c4000: 00000000001c4000 --------W
00000000001c5000: 00000000001c5000 --------W
00000000001c6000: 00000000001c6000 --------W
00000000001c7000: 00000000001c7000 --------W
00000000001c8000: 00000000001c8000 --------W
00000000001c9000: 00000000001c9000 --------W
00000000001ca000: 00000000001ca000 --------W
00000000001cb000: 00000000001cb000 --------W
00000000001cc000: 00000000001cc000 --------W
00000000001cd000: 00000000001cd000 --------W
00000000001ce000: 00000000001ce000 --------W
00000000001cf000: 00000000001cf000 --------W
00000000001d0000: 00000000001d0000 --------W
00000000001d1000: 00000000001d1000 --------W
00000000001d2000: 00000000001d2000 --------W
00000000001d3000: 00000000001d3000 --------W
00000000001d4000: 00000000001d4000 --------W
00000000001d5000: 00000000001d5000 --------W
00000000001d6000: 00000000001d6000 --------W
00000000001d7000: 00000000001d7000 --------W
00000000001d8000: 00000000001d8000 --------W
00000000001d9000: 00000000001d9000 --------W
00000000001da000: 00000000001da000 --------W
00000000001db000: 00000000001db000 --------W
00000000001dc000: 00000000001dc000 --------W
00000000001dd000: 00000000001dd000 --------W
00000000001de000: 00000000001de000 --------W
00000000001df000: 00000000001df000 --------W
00000000001e0000: 00000000001e0000 --------W
00000000001e1000: 00000000001e1000 --------W
00000000001e2000: 00000000001e2000 --------W
00000000001e3000: 00000000001e3000 --------W
00000000001e4000: 00000000001e4000 --------W
00000000001e5000: 00000000001e5000 --------W
00000000001e6000: 00000000001e6000 --------W
00000000001e7000: 00000000001e7000 --------W
00000000001e8000: 00000000001e8000 --------W
00000000001e9000: 00000000001e9000 --------W
00000000001ea000: 00000000001ea000 --------W
00000000001eb000: 00000000001eb000 --------W
00000000001ec000: 00000000001ec000 --------W
00000000001ed000: 00000000001ed000 --------W
00000000001ee000: 00000000001ee000 --------W
00000000001ef000: 00000000001ef000 --------W
00000000001f0000: 00000000001f0000 --------W
00000000001f1000: 00000000001f1000 --------W
00000000001f2000: 00000000001f2000 --------W
00000000001f3000: 00000000001f3000 --------W
00000000001f4000: 00000000001f4000 --------W
00000000001f5000: 00000000001f5000 --------W
00000000001f6000: 00000000001f6000 --------W
00000000001f7000: 00000000001f7000 --------W
00000000001f8000: 00000000001f8000 --------W
00000000001f9000: 00000000001f9000 --------W
00000000001fa000: 00000000001fa000 --------W
00000000001fb000: 00000000001fb000 --------W
00000000001fc000: 00000000001fc000 --------W
00000000001fd000: 00000000001fd000 --------W
00000000001fe000: 00000000001fe000 --------W
00000000001ff000: 00000000001ff000 --------W
0000000000200000: 0000000000200000 ----A---W
0000000000201000: 0000000000201000 --------W
0000000000202000: 0000000000202000 --------W
0000000000203000: 0000000000203000 --------W
0000000000204000: 0000000000204000 ---DA---W
0000000000205000: 0000000000205000 ---DA---W
0000000000206000: 0000000000206000 --------W
0000000000207000: 0000000000207000 --------W
0000000000208000: 0000000000208000 --------W
0000000000209000: 0000000000209000 --------W
000000000020a000: 000000000020a000 --------W
000000000020b000: 000000000020b000 --------W
000000000020c000: 000000000020c000 --------W
000000000020d000: 000000000020d000 --------W
000000000020e000: 000000000020e000 --------W
000000000020f000: 000000000020f000 --------W
0000000000210000: 0000000000210000 --------W
0000000000211000: 0000000000211000 --------W
0000000000212000: 0000000000212000 --------W
0000000000213000: 0000000000213000 --------W
0000000000214000: 0000000000214000 --------W
0000000000215000: 0000000000215000 --------W
0000000000216000: 0000000000216000 --------W
0000000000217000: 0000000000217000 --------W
0000000000218000: 0000000000218000 --------W
0000000000219000: 0000000000219000 --------W
000000000021a000: 000000000021a000 --------W
000000000021b000: 000000000021b000 --------W
000000000021c000: 000000000021c000 --------W
000000000021d000: 000000000021d000 --------W
000000000021e000: 000000000021e000 --------W
000000000021f000: 000000000021f000 --------W
0000000000220000: 0000000000220000 --------W
0000000000221000: 0000000000221000 --------W
0000000000222000: 0000000000222000 --------W
0000000000223000: 0000000000223000 --------W
0000000000224000: 0000000000224000 --------W
0000000000225000: 0000000000225000 --------W
0000000000226000: 0000000000226000 --------W
0000000000227000: 0000000000227000 --------W
0000000000228000: 0000000000228000 --------W
0000000000229000: 0000000000229000 --------W
000000000022a000: 000000000022a000 --------W
000000000022b000: 000000000022b000 --------W
000000000022c000: 000000000022c000 --------W
000000000022d000: 000000000022d000 --------W
000000000022e000: 000000000022e000 --------W
000000000022f000: 000000000022f000 --------W
0000000000230000: 0000000000230000 --------W
0000000000231000: 0000000000231000 --------W
0000000000232000: 0000000000232000 --------W
0000000000233000: 0000000000233000 --------W
0000000000234000: 0000000000234000 --------W
0000000000235000: 0000000000235000 --------W
0000000000236000: 0000000000236000 --------W
0000000000237000: 0000000000237000 --------W
0000000000238000: 0000000000238000 --------W
0000000000239000: 0000000000239000 --------W
000000000023a000: 000000000023a000 --------W
000000000023b000: 000000000023b000 --------W
000000000023c000: 000000000023c000 --------W
000000000023d000: 000000000023d000 --------W
000000000023e000: 000000000023e000 --------W
000000000023f000: 000000000023f000 --------W
0000000000240000: 0000000000240000 --------W
0000000000241000: 0000000000241000 --------W
0000000000242000: 0000000000242000 --------W
0000000000243000: 0000000000243000 --------W
0000000000244000: 0000000000244000 --------W
0000000000245000: 0000000000245000 --------W
0000000000246000: 0000000000246000 --------W
0000000000247000: 0000000000247000 --------W
0000000000248000: 0000000000248000 --------W
0000000000249000: 0000000000249000 --------W
000000000024a000: 000000000024a000 --------W
000000000024b000: 000000000024b000 --------W
000000000024c000: 000000000024c000 --------W
000000000024d000: 000000000024d000 --------W
000000000024e000: 000000000024e000 --------W
000000000024f000: 000000000024f000 --------W
0000000000250000: 0000000000250000 --------W
0000000000251000: 0000000000251000 --------W
0000000000252000: 0000000000252000 --------W
0000000000253000: 0000000000253000 --------W
0000000000254000: 0000000000254000 --------W
0000000000255000: 0000000000255000 --------W
0000000000256000: 0000000000256000 --------W
0000000000257000: 0000000000257000 --------W
0000000000258000: 0000000000258000 --------W
0000000000259000: 0000000000259000 --------W
000000000025a000: 000000000025a000 --------W
000000000025b000: 000000000025b000 --------W
000000000025c000: 000000000025c000 --------W
000000000025d000: 000000000025d000 --------W
000000000025e000: 000000000025e000 --------W
000000000025f000: 000000000025f000 --------W
0000000000260000: 0000000000260000 --------W
0000000000261000: 0000000000261000 --------W
0000000000262000: 0000000000262000 --------W
0000000000263000: 0000000000263000 --------W
0000000000264000: 0000000000264000 --------W
0000000000265000: 0000000000265000 --------W
0000000000266000: 0000000000266000 --------W
0000000000267000: 0000000000267000 --------W
0000000000268000: 0000000000268000 --------W
0000000000269000: 0000000000269000 --------W
000000000026a000: 000000000026a000 --------W
000000000026b000: 000000000026b000 --------W
000000000026c000: 000000000026c000 --------W
000000000026d000: 000000000026d000 --------W
000000000026e000: 000000000026e000 --------W
000000000026f000: 000000000026f000 --------W
0000000000270000: 0000000000270000 --------W
0000000000271000: 0000000000271000 --------W
0000000000272000: 0000000000272000 --------W
0000000000273000: 0000000000273000 --------W
0000000000274000: 0000000000274000 --------W
0000000000275000: 0000000000275000 --------W
0000000000276000: 0000000000276000 --------W
0000000000277000: 0000000000277000 --------W
0000000000278000: 0000000000278000 --------W
0000000000279000: 0000000000279000 --------W
000000000027a000: 000000000027a000 --------W
000000000027b000: 000000000027b000 --------W
000000000027c000: 000000000027c000 --------W
000000000027d000: 000000000027d000 --------W
000000000027e000: 000000000027e000 --------W
000000000027f000: 000000000027f000 --------W
0000000000280000: 0000000000280000 --------W
0000000000281000: 0000000000281000 --------W
0000000000282000: 0000000000282000 --------W
0000000000283000: 0000000000283000 --------W
0000000000284000: 0000000000284000 --------W
0000000000285000: 0000000000285000 --------W
0000000000286000: 0000000000286000 --------W
0000000000287000: 0000000000287000 --------W
0000000000288000: 0000000000288000 --------W
0000000000289000: 0000000000289000 --------W
000000000028a000: 000000000028a000 --------W
000000000028b000: 000000000028b000 --------W
000000000028c000: 000000000028c000 --------W
000000000028d000: 000000000028d000 --------W
000000000028e000: 000000000028e000 --------W
000000000028f000: 000000000028f000 --------W
0000000000290000: 0000000000290000 --------W
0000000000291000: 0000000000291000 --------W
0000000000292000: 0000000000292000 --------W
0000000000293000: 0000000000293000 --------W
0000000000294000: 0000000000294000 --------W
0000000000295000: 0000000000295000 --------W
0000000000296000: 0000000000296000 --------W
0000000000297000: 0000000000297000 --------W
0000000000298000: 0000000000298000 --------W
0000000000299000: 0000000000299000 --------W
000000000029a000: 000000000029a000 --------W
000000000029b000: 000000000029b000 --------W
000000000029c000: 000000000029c000 --------W
000000000029d000: 000000000029d000 --------W
000000000029e000: 000000000029e000 --------W
000000000029f000: 000000000029f000 --------W
00000000002a0000: 00000000002a0000 --------W
00000000002a1000: 00000000002a1000 --------W
00000000002a2000: 00000000002a2000 --------W
00000000002a3000: 00000000002a3000 --------W
00000000002a4000: 00000000002a4000 --------W
00000000002a5000: 00000000002a5000 --------W
00000000002a6000: 00000000002a6000 --------W
00000000002a7000: 00000000002a7000 --------W
00000000002a8000: 00000000002a8000 --------W
00000000002a9000: 00000000002a9000 --------W
00000000002aa000: 00000000002aa000 --------W
00000000002ab000: 00000000002ab000 --------W
00000000002ac000: 00000000002ac000 --------W
00000000002ad000: 00000000002ad000 --------W
00000000002ae000: 00000000002ae000 --------W
00000000002af000: 00000000002af000 --------W
00000000002b0000: 00000000002b0000 --------W
00000000002b1000: 00000000002b1000 --------W
00000000002b2000: 00000000002b2000 --------W
00000000002b3000: 00000000002b3000 --------W
00000000002b4000: 00000000002b4000 --------W
00000000002b5000: 00000000002b5000 --------W
00000000002b6000: 00000000002b6000 --------W
00000000002b7000: 00000000002b7000 --------W
00000000002b8000: 00000000002b8000 --------W
00000000002b9000: 00000000002b9000 --------W
00000000002ba000: 00000000002ba000 --------W
00000000002bb000: 00000000002bb000 --------W
00000000002bc000: 00000000002bc000 --------W
00000000002bd000: 00000000002bd000 --------W
00000000002be000: 00000000002be000 --------W
00000000002bf000: 00000000002bf000 --------W
00000000002c0000: 00000000002c0000 --------W
00000000002c1000: 00000000002c1000 --------W
00000000002c2000: 00000000002c2000 --------W
00000000002c3000: 00000000002c3000 --------W
00000000002c4000: 00000000002c4000 --------W
00000000002c5000: 00000000002c5000 --------W
00000000002c6000: 00000000002c6000 --------W
00000000002c7000: 00000000002c7000 --------W
00000000002c8000: 00000000002c8000 --------W
00000000002c9000: 00000000002c9000 --------W
00000000002ca000: 00000000002ca000 --------W
00000000002cb000: 00000000002cb000 --------W
00000000002cc000: 00000000002cc000 --------W
00000000002cd000: 00000000002cd000 --------W
00000000002ce000: 00000000002ce000 --------W
00000000002cf000: 00000000002cf000 --------W
00000000002d0000: 00000000002d0000 --------W
00000000002d1000: 00000000002d1000 --------W
00000000002d2000: 00000000002d2000 --------W
00000000002d3000: 00000000002d3000 --------W
00000000002d4000: 00000000002d4000 --------W
00000000002d5000: 00000000002d5000 --------W
00000000002d6000: 00000000002d6000 --------W
00000000002d7000: 00000000002d7000 --------W
00000000002d8000: 00000000002d8000 --------W
00000000002d9000: 00000000002d9000 --------W
00000000002da000: 00000000002da000 --------W
00000000002db000: 00000000002db000 --------W
00000000002dc000: 00000000002dc000 --------W
00000000002dd000: 00000000002dd000 --------W
00000000002de000: 00000000002de000 --------W
00000000002df000: 00000000002df000 --------W
00000000002e0000: 00000000002e0000 --------W
00000000002e1000: 00000000002e1000 --------W
00000000002e2000: 00000000002e2000 --------W
00000000002e3000: 00000000002e3000 --------W
00000000002e4000: 00000000002e4000 --------W
00000000002e5000: 00000000002e5000 --------W
00000000002e6000: 00000000002e6000 --------W
00000000002e7000: 00000000002e7000 --------W
00000000002e8000: 00000000002e8000 --------W
00000000002e9000: 00000000002e9000 --------W
00000000002ea000: 00000000002ea000 --------W
00000000002eb000: 00000000002eb000 --------W
00000000002ec000: 00000000002ec000 --------W
00000000002ed000: 00000000002ed000 --------W
00000000002ee000: 00000000002ee000 --------W
00000000002ef000: 00000000002ef000 --------W
00000000002f0000: 00000000002f0000 --------W
00000000002f1000: 00000000002f1000 --------W
00000000002f2000: 00000000002f2000 --------W
00000000002f3000: 00000000002f3000 --------W
00000000002f4000: 00000000002f4000 --------W
00000000002f5000: 00000000002f5000 --------W
00000000002f6000: 00000000002f6000 --------W
00000000002f7000: 00000000002f7000 --------W
00000000002f8000: 00000000002f8000 --------W
00000000002f9000: 00000000002f9000 --------W
00000000002fa000: 00000000002fa000 --------W
00000000002fb000: 00000000002fb000 --------W
00000000002fc000: 00000000002fc000 --------W
00000000002fd000: 00000000002fd000 --------W
00000000002fe000: 00000000002fe000 --------W
00000000002ff000: 00000000002ff000 --------W
0000000000300000: 0000000000300000 --------W
0000000000301000: 0000000000301000 --------W
0000000000302000: 0000000000302000 --------W
0000000000303000: 0000000000303000 --------W
0000000000304000: 0000000000304000 --------W
0000000000305000: 0000000000305000 --------W
0000000000306000: 0000000000306000 --------W
0000000000307000: 0000000000307000 --------W
0000000000308000: 0000000000308000 --------W
0000000000309000: 0000000000309000 --------W
000000000030a000: 000000000030a000 --------W
000000000030b000: 000000000030b000 --------W
000000000030c000: 000000000030c000 --------W
000000000030d000: 000000000030d000 --------W
000000000030e000: 000000000030e000 --------W
000000000030f000: 000000000030f000 --------W
0000000000310000: 0000000000310000 --------W
0000000000311000: 0000000000311000 --------W
0000000000312000: 0000000000312000 --------W
0000000000313000: 0000000000313000 --------W
0000000000314000: 0000000000314000 --------W
0000000000315000: 0000000000315000 --------W
0000000000316000: 0000000000316000 --------W
0000000000317000: 0000000000317000 --------W
0000000000318000: 0000000000318000 --------W
0000000000319000: 0000000000319000 --------W
000000000031a000: 000000000031a000 --------W
000000000031b000: 000000000031b000 --------W
000000000031c000: 000000000031c000 --------W
000000000031d000: 000000000031d000 --------W
000000000031e000: 000000000031e000 --------W
000000000031f000: 000000000031f000 --------W
0000000000320000: 0000000000320000 --------W
0000000000321000: 0000000000321000 --------W
0000000000322000: 0000000000322000 --------W
0000000000323000: 0000000000323000 --------W
0000000000324000: 0000000000324000 --------W
0000000000325000: 0000000000325000 --------W
0000000000326000: 0000000000326000 --------W
0000000000327000: 0000000000327000 --------W
0000000000328000: 0000000000328000 --------W
0000000000329000: 0000000000329000 --------W
000000000032a000: 000000000032a000 --------W
000000000032b000: 000000000032b000 --------W
000000000032c000: 000000000032c000 --------W
000000000032d000: 000000000032d000 --------W
000000000032e000: 000000000032e000 --------W
000000000032f000: 000000000032f000 --------W
0000000000330000: 0000000000330000 --------W
0000000000331000: 0000000000331000 --------W
0000000000332000: 0000000000332000 --------W
0000000000333000: 0000000000333000 --------W
0000000000334000: 0000000000334000 --------W
0000000000335000: 0000000000335000 --------W
0000000000336000: 0000000000336000 --------W
0000000000337000: 0000000000337000 --------W
0000000000338000: 0000000000338000 --------W
0000000000339000: 0000000000339000 --------W
000000000033a000: 000000000033a000 --------W
000000000033b000: 000000000033b000 --------W
000000000033c000: 000000000033c000 --------W
000000000033d000: 000000000033d000 --------W
000000000033e000: 000000000033e000 --------W
000000000033f000: 000000000033f000 --------W
0000000000340000: 0000000000340000 --------W
0000000000341000: 0000000000341000 --------W
0000000000342000: 0000000000342000 --------W
0000000000343000: 0000000000343000 --------W
0000000000344000: 0000000000344000 --------W
0000000000345000: 0000000000345000 --------W
0000000000346000: 0000000000346000 --------W
0000000000347000: 0000000000347000 --------W
0000000000348000: 0000000000348000 --------W
0000000000349000: 0000000000349000 --------W
000000000034a000: 000000000034a000 --------W
000000000034b000: 000000000034b000 --------W
000000000034c000: 000000000034c000 --------W
000000000034d000: 000000000034d000 --------W
000000000034e000: 000000000034e000 --------W
000000000034f000: 000000000034f000 --------W
0000000000350000: 0000000000350000 --------W
0000000000351000: 0000000000351000 --------W
0000000000352000: 0000000000352000 --------W
0000000000353000: 0000000000353000 --------W
0000000000354000: 0000000000354000 --------W
0000000000355000: 0000000000355000 --------W
0000000000356000: 0000000000356000 --------W
0000000000357000: 0000000000357000 --------W
0000000000358000: 0000000000358000 --------W
0000000000359000: 0000000000359000 --------W
000000000035a000: 000000000035a000 --------W
000000000035b000: 000000000035b000 --------W
000000000035c000: 000000000035c000 --------W
000000000035d000: 000000000035d000 --------W
000000000035e000: 000000000035e000 --------W
000000000035f000: 000000000035f000 --------W
0000000000360000: 0000000000360000 --------W
0000000000361000: 0000000000361000 --------W
0000000000362000: 0000000000362000 --------W
0000000000363000: 0000000000363000 --------W
0000000000364000: 0000000000364000 --------W
0000000000365000: 0000000000365000 --------W
0000000000366000: 0000000000366000 --------W
0000000000367000: 0000000000367000 --------W
0000000000368000: 0000000000368000 --------W
0000000000369000: 0000000000369000 --------W
000000000036a000: 000000000036a000 --------W
000000000036b000: 000000000036b000 --------W
000000000036c000: 000000000036c000 --------W
000000000036d000: 000000000036d000 --------W
000000000036e000: 000000000036e000 --------W
000000000036f000: 000000000036f000 --------W
0000000000370000: 0000000000370000 --------W
0000000000371000: 0000000000371000 --------W
0000000000372000: 0000000000372000 --------W
0000000000373000: 0000000000373000 --------W
0000000000374000: 0000000000374000 --------W
0000000000375000: 0000000000375000 --------W
0000000000376000: 0000000000376000 --------W
0000000000377000: 0000000000377000 --------W
0000000000378000: 0000000000378000 --------W
0000000000379000: 0000000000379000 --------W
000000000037a000: 000000000037a000 --------W
000000000037b000: 000000000037b000 --------W
000000000037c000: 000000000037c000 --------W
000000000037d000: 000000000037d000 --------W
000000000037e000: 000000000037e000 --------W
000000000037f000: 000000000037f000 --------W
0000000000380000: 0000000000380000 --------W
0000000000381000: 0000000000381000 --------W
0000000000382000: 0000000000382000 --------W
0000000000383000: 0000000000383000 --------W
0000000000384000: 0000000000384000 --------W
0000000000385000: 0000000000385000 --------W
0000000000386000: 0000000000386000 --------W
0000000000387000: 0000000000387000 --------W
0000000000388000: 0000000000388000 --------W
0000000000389000: 0000000000389000 --------W
000000000038a000: 000000000038a000 --------W
000000000038b000: 000000000038b000 --------W
000000000038c000: 000000000038c000 --------W
000000000038d000: 000000000038d000 --------W
000000000038e000: 000000000038e000 --------W
000000000038f000: 000000000038f000 --------W
0000000000390000: 0000000000390000 --------W
0000000000391000: 0000000000391000 --------W
0000000000392000: 0000000000392000 --------W
0000000000393000: 0000000000393000 --------W
0000000000394000: 0000000000394000 --------W
0000000000395000: 0000000000395000 --------W
0000000000396000: 0000000000396000 --------W
0000000000397000: 0000000000397000 --------W
0000000000398000: 0000000000398000 --------W
0000000000399000: 0000000000399000 --------W
000000000039a000: 000000000039a000 --------W
000000000039b000: 000000000039b000 --------W
000000000039c000: 000000000039c000 --------W
000000000039d000: 000000000039d000 --------W
000000000039e000: 000000000039e000 --------W
000000000039f000: 000000000039f000 --------W
00000000003a0000: 00000000003a0000 --------W
00000000003a1000: 00000000003a1000 --------W
00000000003a2000: 00000000003a2000 --------W
00000000003a3000: 00000000003a3000 --------W
00000000003a4000: 00000000003a4000 --------W
00000000003a5000: 00000000003a5000 --------W
00000000003a6000: 00000000003a6000 --------W
00000000003a7000: 00000000003a7000 --------W
00000000003a8000: 00000000003a8000 --------W
00000000003a9000: 00000000003a9000 --------W
00000000003aa000: 00000000003aa000 --------W
00000000003ab000: 00000000003ab000 --------W
00000000003ac000: 00000000003ac000 --------W
00000000003ad000: 00000000003ad000 --------W
00000000003ae000: 00000000003ae000 --------W
00000000003af000: 00000000003af000 --------W
00000000003b0000: 00000000003b0000 --------W
00000000003b1000: 00000000003b1000 --------W
00000000003b2000: 00000000003b2000 --------W
00000000003b3000: 00000000003b3000 --------W
00000000003b4000: 00000000003b4000 --------W
00000000003b5000: 00000000003b5000 --------W
00000000003b6000: 00000000003b6000 --------W
00000000003b7000: 00000000003b7000 --------W
00000000003b8000: 00000000003b8000 --------W
00000000003b9000: 00000000003b9000 --------W
00000000003ba000: 00000000003ba000 --------W
00000000003bb000: 00000000003bb000 --------W
00000000003bc000: 00000000003bc000 --------W
00000000003bd000: 00000000003bd000 --------W
00000000003be000: 00000000003be000 --------W
00000000003bf000: 00000000003bf000 --------W
00000000003c0000: 00000000003c0000 --------W
00000000003c1000: 00000000003c1000 --------W
00000000003c2000: 00000000003c2000 --------W
00000000003c3000: 00000000003c3000 --------W
00000000003c4000: 00000000003c4000 --------W
00000000003c5000: 00000000003c5000 --------W
00000000003c6000: 00000000003c6000 --------W
00000000003c7000: 00000000003c7000 --------W
00000000003c8000: 00000000003c8000 --------W
00000000003c9000: 00000000003c9000 --------W
00000000003ca000: 00000000003ca000 --------W
00000000003cb000: 00000000003cb000 --------W
00000000003cc000: 00000000003cc000 --------W
00000000003cd000: 00000000003cd000 --------W
00000000003ce000: 00000000003ce000 --------W
00000000003cf000: 00000000003cf000 --------W
00000000003d0000: 00000000003d0000 --------W
00000000003d1000: 00000000003d1000 --------W
00000000003d2000: 00000000003d2000 --------W
00000000003d3000: 00000000003d3000 --------W
00000000003d4000: 00000000003d4000 --------W
00000000003d5000: 00000000003d5000 --------W
00000000003d6000: 00000000003d6000 --------W
00000000003d7000: 00000000003d7000 --------W
00000000003d8000: 00000000003d8000 --------W
00000000003d9000: 00000000003d9000 --------W
00000000003da000: 00000000003da000 --------W
00000000003db000: 00000000003db000 --------W
00000000003dc000: 00000000003dc000 --------W
00000000003dd000: 00000000003dd000 --------W
00000000003de000: 00000000003de000 --------W
00000000003df000: 00000000003df000 --------W
00000000003e0000: 00000000003e0000 --------W
00000000003e1000: 00000000003e1000 --------W
00000000003e2000: 00000000003e2000 --------W
00000000003e3000: 00000000003e3000 --------W
00000000003e4000: 00000000003e4000 --------W
00000000003e5000: 00000000003e5000 --------W
00000000003e6000: 00000000003e6000 --------W
00000000003e7000: 00000000003e7000 --------W
00000000003e8000: 00000000003e8000 --------W
00000000003e9000: 00000000003e9000 --------W
00000000003ea000: 00000000003ea000 --------W
00000000003eb000: 00000000003eb000 --------W
00000000003ec000: 00000000003ec000 --------W
00000000003ed000: 00000000003ed000 --------W
00000000003ee000: 00000000003ee000 --------W
00000000003ef000: 00000000003ef000 --------W
00000000003f0000: 00000000003f0000 --------W
00000000003f1000: 00000000003f1000 --------W
00000000003f2000: 00000000003f2000 --------W
00000000003f3000: 00000000003f3000 --------W
00000000003f4000: 00000000003f4000 --------W
00000000003f5000: 00000000003f5000 --------W
00000000003f6000: 00000000003f6000 --------W
00000000003f7000: 00000000003f7000 --------W
00000000003f8000: 00000000003f8000 --------W
00000000003f9000: 00000000003f9000 --------W
00000000003fa000: 00000000003fa000 --------W
00000000003fb000: 00000000003fb000 --------W
00000000003fc000: 00000000003fc000 --------W
00000000003fd000: 00000000003fd000 --------W
00000000003fe000: 00000000003fe000 --------W
00000000003ff000: 00000000003ff000 --------W
I ran QEMU with:

Code: Select all

qemu-system-i386 -kernel os.bin -d int -no-shutdown -no-reboot -monitor stdio
The only problem I had was that your Makefile doesn't build paging.asm to paging.o, gdt.asm to gdts.o, boot.s to boot.o. I had to manually run `i686-elf-as` on each of them. You might want to clone your project in a completely new directory and run the Makefile to see what isn't being done. I assume that in your local working directory you built these .o files manually at some point in the past (or through some other means) or your Makefile is out of date.
MichaelPetch
Member
Member
Posts: 797
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: OSdev: MM - paging

Post by MichaelPetch »

What I didn't notice in the output of `info tlb` was this

Code: Select all

0000000000000000: 0000000000000000 ---DA---W 
The Dirty and Accessed bits are set. Something was accessing memory from 0x00000000 to 0x00000fff which seemed like a possible problem. I modified `init_paging` to not identity map the first physical page to see where this access was coming from. I discovered in gdt.asm you had `mov %ax, 0x10` which in at&t syntax moves contents of register AX to memory address 0x10. I believe you really want to have `.intel_syntax noprefix` specified at the top of this file then it would have been correct as moving the immediate value 0x10 to register AX. Secondly the `jmp flush2` is incorrect. It doesn't actually set the CS register. You need a far jump for that. With these fixes you file went from:

Code: Select all

.section .text
.global gdt_flush
.extern gdt_ptr

gdt_flush:
    lgdt [gdt_ptr]
    mov %ax, 0x10
    mov %ds, %ax
    mov %es, %ax
    mov %fs, %ax
    mov %gs, %ax
    mov %ss, %ax
    jmp flush2          # Jump to flush2 with the code segment selector

flush2:
    ret                       # Return from the function
to

Code: Select all

.intel_syntax noprefix

.section .text
.global gdt_flush
.extern gdt_ptr

gdt_flush:
    lgdt [gdt_ptr]
    mov %ax, 0x10
    mov %ds, %ax
    mov %es, %ax
    mov %fs, %ax
    mov %gs, %ax
    mov %ss, %ax
    jmp 0x08:flush2          # Jump to flush2 with the code segment selector

flush2:
    ret                       # Return from the function
MichaelPetch
Member
Member
Posts: 797
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: OSdev: MM - paging

Post by MichaelPetch »

Looking further you have more bugs related to the GDT. In gdt.h you have:

Code: Select all

//8 bytes long
struct gdt_segment {
    uint16_t limit_low;
    uint16_t base_low;
    uint8_t base_middle;
    uint8_t base_high;
    uint8_t access;
    uint8_t granularity;
} __attribute__((packed));
That is incorrect. It should be:

Code: Select all

struct gdt_segment {
    uint16_t limit_low;
    uint16_t base_low;
    uint8_t base_middle;
    uint8_t access;
    uint8_t granularity;
    uint8_t base_high;
} __attribute__((packed));
In gdt.c you have:

Code: Select all

void initSegment(int num, uint32_t limit, uint32_t base, uint8_t access, uint8_t gran) {
    gdt_entries[num].limit_low = limit &  0xFFFF;
    gdt_entries[num].base_low = base & 0xFFFF;
    gdt_entries[num].base_middle = (base >> 16) & 0xFF;
    gdt_entries[num].base_high = (base >> 24) & 0xFF;
    gdt_entries[num].access = access;
    gdt_entries[num].granularity = (limit >> 16) & 0x0F;
    gdt_entries[num].granularity |= gdt_entries[num].granularity;
}
and I think it should be:

Code: Select all

void initSegment(int num, uint32_t limit, uint32_t base, uint8_t access, uint8_t gran) {
    gdt_entries[num].limit_low = limit &  0xFFFF;
    gdt_entries[num].base_low = base & 0xFFFF;
    gdt_entries[num].base_middle = (base >> 16) & 0xFF;
    gdt_entries[num].base_high = (base >> 24) & 0xFF;
    gdt_entries[num].access = access;
    gdt_entries[num].granularity = (limit >> 16) & 0x0F;
    gdt_entries[num].granularity |= (gran & 0xF0);
}
Your `initGdt` is this:

Code: Select all

void initGdt() {
    gdt_ptr.limit = (sizeof(struct gdt_segment) * 3) - 1;
    gdt_ptr.base = (unsigned int)gdt_entries;

    initSegment(0, 0, 0, 0, 0);
    initSegment(1, 0xFFFFFFFF, 0, 0x92, 0xCF); //kernel code segment
    initSegment(2, 0, 0xFFFFFFFF, 0x92, 0xCF); //kernel data segment
    //initSegment(3, 0xFFFFFFFF, 0, 0xFA, 0xCF); //user code
    //initSegment(4, 0xFFFFFFFF, 0, 0xF2, 0xCF); //user code

    gdt_flush();
}
where it should be:

Code: Select all

void initGdt() {
    gdt_ptr.limit = (sizeof(struct gdt_segment) * 3) - 1;
    gdt_ptr.base = (unsigned int)gdt_entries;

    initSegment(0, 0, 0, 0, 0);
    initSegment(1, 0xFFFFFFFF, 0, 0x9A, 0xCF); //kernel code segment
    initSegment(2, 0xFFFFFFFF, 0, 0x92, 0xCF); //kernel data segment
    //initSegment(3, 0xFFFFFFFF, 0, 0xFA, 0xCF); //user code
    //initSegment(4, 0xFFFFFFFF, 0, 0xF2, 0xCF); //user code

    gdt_flush();
}
---
Your linker.ld is:

Code: Select all

ENTRY(_start)

SECTIONS {
	. = 2M;
	.text BLOCK(4K) : ALIGN(4K) {
		*(.text)
		*(.text.*)
	}
	.rodata BLOCK(4K) : ALIGN(4K) {
		*(.rodata)
		*(.rodata.)
	}
	.data  BLOCK(4K) : ALIGN(4K) {
		*(.data)
		*(.data.)
	}
	.bss BLOCK(4K) : ALIGN(4K) {
		*(.bss)
		*(.bss.)
	}
}
A better one might be:

Code: Select all

ENTRY(_start)

SECTIONS {
    . = 2M;
    .text BLOCK(4K) : ALIGN(4K) {
        *(.multiboot)
        *(.text*)
    }
    .rodata BLOCK(4K) : ALIGN(4K) {
        *(.rodata*)
    }
    .data  BLOCK(4K) : ALIGN(4K) {
        *(.data)
    }
    .bss BLOCK(4K) : ALIGN(4K) {
        *(.bss)
        *(COMMON)
    }
}
MichaelPetch
Member
Member
Posts: 797
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: OSdev: MM - paging

Post by MichaelPetch »

I've made a pull request here https://github.com/derva/os/pull/1 with these fixes and others (including the Makefile).
derva
Posts: 8
Joined: Sat Oct 19, 2024 3:46 pm

Re: OSdev: MM - paging

Post by derva »

Thank you so much for your assistance!

The problem was indeed related to paging, and after recompiling the code, it is now functioning correctly.

I truly appreciate your help and expertise.
Post Reply