Changeset 5d721f0 in mainline
- Timestamp:
- 2005-07-20T16:54:13Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5d945376
- Parents:
- b4f9214
- Location:
- arch/ia32
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/include/asm.h
rb4f9214 r5d721f0 34 34 #include <mm/page.h> 35 35 #include <synch/spinlock.h> 36 #include <arch/boot/memmap.h> 36 37 37 38 extern __u32 interrupt_handler_size; -
arch/ia32/include/boot/memmap.h
rb4f9214 r5d721f0 30 30 #define __ia32_MEMMAP_H__ 31 31 32 /* E820h memory range types - other values*/33 #define MEMMAP_MEMORY_AVAILABLE 134 /* Not available for OS */35 #define MEMMAP_MEMORY_RESERVED 236 /* OS may use it after reading ACPI table */37 #define MEMMAP_MEMORY_ACPI 338 /* Unusable, required to be saved and restored across an NVS sleep */39 #define MEMMAP_MEMORY_NVS 440 /* Corrupted memory */41 #define MEMMAP_MEMORY_UNUSABLE 542 32 43 /* size of one entry */ 44 #define MEMMAP_E820_RECORD_SIZE 20 45 /* maximum entries */ 46 #define MEMMAP_E820_MAX_RECORDS 32 33 #include <arch/boot/memmapasm.h> 34 #include <arch/types.h> 35 36 struct e820memmap_ { 37 __u64 base_address; 38 __u64 size; 39 __u32 type; 40 } __attribute__ ((packed)); 41 42 extern struct e820memmap_ e820table[MEMMAP_E820_MAX_RECORDS]; 43 44 extern __u8 e820counter; 45 46 extern __u32 e801memorysize; // size of memory in KB 47 47 48 #endif -
arch/ia32/src/boot/boot.S
rb4f9214 r5d721f0 40 40 # 41 41 kernel_image_start: 42 call memmap_arch_init 42 43 cli 43 call memmap_arch_init44 44 xorw %ax,%ax 45 45 movw %ax,%ds -
arch/ia32/src/boot/memmap.S
rb4f9214 r5d721f0 28 28 29 29 30 #include <arch/boot/memmap .h>30 #include <arch/boot/memmapasm.h> 31 31 32 32 E820_RECORD_SIZE = MEMMAP_E820_RECORD_SIZE … … 35 35 36 36 .global memmap_arch_init 37 .global e820counter 38 .global e820table 39 .global e801memorysize 37 40 38 41 .code16 … … 40 43 41 44 memmap_arch_init: 42 45 43 46 e820begin: 44 47 xorl %ebx,%ebx # during first call, ebx must be 0 45 48 movw %bx,%ds 49 movw %bx,%es 46 50 movw $e820table,%di 47 51 movb $E820_MAX_RECORDS,(e820counter) 48 52 e820loop: 49 movl $E820_SMAP,%edx # constrol sequence "SMAP" 50 pushw %ds 51 popw %es # e820 buffer address 53 movl $E820_SMAP,%edx # control sequence "SMAP" 52 54 53 movl $0x e820,%eax# service55 movl $0x0000e820,%eax # service 54 56 movl $E820_RECORD_SIZE,%ecx 55 57 int $0x15 56 jc e820end 57 58 jc e820err 58 59 59 60 cmpl $E820_SMAP,%eax # verifying BIOS 60 jne e820end 61 jne e820err 62 63 cmpl $E820_RECORD_SIZE,%ecx 64 jne e820err # bad record size - bug in bios 61 65 62 66 movw %di,%ax # next record … … 71 75 72 76 e820end: 77 movb $E820_MAX_RECORDS,%al 78 subb (e820counter),%al 79 movb %al,(e820counter) # store # of valid entries in e820counter 80 81 jmp e801begin 82 83 e820err: 84 movb $0,(e820counter) 85 86 # method e801 - get size of memory 87 88 e801begin: 89 xorw %dx,%dx 90 xorw %cx,%cx 91 xorw %bx,%bx 92 movw $0xe801,%ax 93 stc 94 int $0x15 73 95 74 movb (e820counter),%al 75 negb %al 76 addb $32,%al 77 movb %al,(e820counter) # store # of valid entries in e820counter 96 jc e801end 78 97 98 # fix problem with some BIOSes which use ax:bx rather than cx:dx 99 testw %cx,%cx 100 jnz e801cxdx 101 testw %dx,%dx 102 jnz e801cxdx 103 104 movw %ax,%cx 105 movw %bx,%dx 106 107 e801cxdx: 108 andl $0xffff,%edx 109 shll $6,%edx 110 andl $0xffff,%ecx 111 addl %ecx,%edx 112 addl $0x0400,%edx # add lower 1 MB - its not count by e801 method 113 movl %edx,(e801memorysize) 114 e801end: 79 115 ret 80 116 117 #memory size in 1 kb chunks 118 e801memorysize: 119 .long 0 81 120 82 121 e820counter: 83 .byte 0 84 122 .byte 0xff 123 85 124 e820table: 86 .space (32*E820_RECORD_SIZE),0 # space for 32 records, each E820_RECORD_SIZE bytes long125 .space (32*E820_RECORD_SIZE),0xff # space for 32 records, each E820_RECORD_SIZE bytes long -
arch/ia32/src/mm/frame.c
rb4f9214 r5d721f0 31 31 #include <mm/vm.h> 32 32 #include <config.h> 33 #include <arch/boot/memmap.h> 34 35 #include <print.h> 33 36 34 37 /* … … 37 40 void frame_arch_init(void) 38 41 { 42 __u8 i; 43 39 44 if (config.cpu_active == 1) { 40 45 frame_not_free(0x0); … … 42 47 frame_region_not_free(0xa0000,0xff000); 43 48 frame_region_not_free(0xfec00000,0xffffffff); 49 50 for (i=e820counter;i>0;i--) { 51 //printf("E820 base: %Q size: %Q type: %L \n",e820table[i-1].base_address,e820table[i-1].size,e820table[i-1].type); 52 if (e820table[i-1].type!=MEMMAP_MEMORY_AVAILABLE) { 53 frame_region_not_free(e820table[i-1].base_address,e820table[i-1].size); 54 } 55 } 44 56 } 45 57 }
Note:
See TracChangeset
for help on using the changeset viewer.