Browse Source

Fix the memory map.

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
53e948bba8
1 changed files with 11 additions and 6 deletions
  1. 11
    6
      src/arch/i386/image/multiboot.c

+ 11
- 6
src/arch/i386/image/multiboot.c View File

78
 	/* Translate into multiboot format */
78
 	/* Translate into multiboot format */
79
 	memset ( mbmemmap, 0, sizeof ( *mbmemmap ) );
79
 	memset ( mbmemmap, 0, sizeof ( *mbmemmap ) );
80
 	for ( i = 0 ; i < memmap.count ; i++ ) {
80
 	for ( i = 0 ; i < memmap.count ; i++ ) {
81
-		mbmemmap[i].size = sizeof ( mbmemmap[i] );
81
+		mbmemmap[i].size = ( sizeof ( mbmemmap[i] ) -
82
+				     sizeof ( mbmemmap[i].size ) );
82
 		mbmemmap[i].base_addr = memmap.regions[i].start;
83
 		mbmemmap[i].base_addr = memmap.regions[i].start;
83
 		mbmemmap[i].length = ( memmap.regions[i].end -
84
 		mbmemmap[i].length = ( memmap.regions[i].end -
84
 				       memmap.regions[i].start );
85
 				       memmap.regions[i].start );
85
 		mbmemmap[i].type = MBMEM_RAM;
86
 		mbmemmap[i].type = MBMEM_RAM;
86
 		mbinfo->mmap_length += sizeof ( mbmemmap[i] );
87
 		mbinfo->mmap_length += sizeof ( mbmemmap[i] );
87
 		if ( memmap.regions[i].start == 0 )
88
 		if ( memmap.regions[i].start == 0 )
88
-			mbinfo->mem_lower = memmap.regions[i].end;
89
+			mbinfo->mem_lower = ( memmap.regions[i].end / 1024 );
89
 		if ( memmap.regions[i].start == 0x100000 )
90
 		if ( memmap.regions[i].start == 0x100000 )
90
-			mbinfo->mem_upper = ( memmap.regions[i].end -
91
-					      0x100000 );
91
+			mbinfo->mem_upper = ( ( memmap.regions[i].end -
92
+						0x100000 ) / 1024 );
92
 	}
93
 	}
93
 }
94
 }
94
 
95
 
119
 		module->mod_start = user_to_phys ( module_image->data, 0 );
120
 		module->mod_start = user_to_phys ( module_image->data, 0 );
120
 		module->mod_end = user_to_phys ( module_image->data,
121
 		module->mod_end = user_to_phys ( module_image->data,
121
 						 module_image->len );
122
 						 module_image->len );
122
-		module->string = virt_to_phys ( image->cmdline );
123
+		module->string = virt_to_phys ( module_image->cmdline );
124
+		module->reserved = 0;
125
+		DBG ( "Multiboot module %lx is [%lx,%lx)\n",
126
+		      virt_to_phys ( module ),
127
+		      module->mod_start, module->mod_end );
123
 
128
 
124
 		/* We promise to page-align modules, so at least check */
129
 		/* We promise to page-align modules, so at least check */
125
 		assert ( ( module->mod_start & 0xfff ) == 0 );
130
 		assert ( ( module->mod_start & 0xfff ) == 0 );
150
 	
155
 	
151
 	/* Build memory map */
156
 	/* Build memory map */
152
 	multiboot_build_memmap ( &mbinfo, mbmemmap );
157
 	multiboot_build_memmap ( &mbinfo, mbmemmap );
153
-	mbinfo.mmap_addr = virt_to_phys ( &mbmemmap[0].base_addr );
158
+	mbinfo.mmap_addr = virt_to_phys ( mbmemmap );
154
 	mbinfo.flags |= ( MBI_FLAG_MEM | MBI_FLAG_MMAP );
159
 	mbinfo.flags |= ( MBI_FLAG_MEM | MBI_FLAG_MMAP );
155
 
160
 
156
 	/* Set command line */
161
 	/* Set command line */

Loading…
Cancel
Save