@@ -39,22 +39,31 @@ void heap_init() {
3939 free_blocks -> page = NULL ;
4040
4141 kprint ("Heap initialized at virtual: " );
42+ <<<<<<< HEAD
4243 kprint ("Heap initialized at virtual: " );
44+ = == == ==
45+ >>>>>>> 3f e2ead (realize paging memory , add kmalloc aligned ; todo : realize kmemdump fully )
4346 char buf [32 ] = "" ;
4447 hex_to_ascii (HEAP_VIRTUAL_START , buf );
4548 kprint (buf );
4649 kprint (", physical: " );
4750 hex_to_ascii (heap_physical_start , buf );
51+ <<<<<<< HEAD
4852 hex_to_ascii (HEAP_VIRTUAL_START , buf );
4953 kprint (buf );
5054 kprint (", physical: " );
5155 hex_to_ascii (heap_physical_start , buf );
56+ = == == ==
57+ >>>>>>> 3f e2ead (realize paging memory , add kmalloc aligned ; todo : realize kmemdump fully )
5258 kprint (buf );
5359 kprint ("\n" );
5460}
5561
5662
63+ <<<<<<< HEAD
5764
65+ == = == ==
66+ >>>>>>> 3f e2ead (realize paging memory , add kmalloc aligned ; todo : realize kmemdump fully )
5867// TODO: Paging is not implemented
5968void * get_physaddr (void * virtualaddr ) {
6069 return get_physical_address (virtualaddr );
@@ -86,6 +95,7 @@ void *kmalloc_a(u32 size) {
8695 }
8796
8897 return virtual_addr ;
98+ <<<<<<< HEAD
8999 return get_physical_address (virtualaddr );
90100}
91101
@@ -115,6 +125,8 @@ void *kmalloc_a(u32 size) {
115125 }
116126
117127 return virtual_addr ;
128+ = == == ==
129+ >>>>>>> 3f e2ead (realize paging memory , add kmalloc aligned ; todo : realize kmemdump fully )
118130}
119131
120132void * kmalloc (u32 size ) {
@@ -164,7 +176,10 @@ void *kmalloc(u32 size) {
164176
165177 current -> is_free = 0 ;
166178 return (void * )((u32 )current + sizeof (mem_block_t ));
179+ <<<<<<< HEAD
167180 return (void * )((u32 )current + sizeof (mem_block_t ));
181+ = == == ==
182+ >>>>>>> 3f e2ead (realize paging memory , add kmalloc aligned ; todo : realize kmemdump fully )
168183 }
169184 prev = current ;
170185 current = current -> next ;
@@ -284,8 +299,11 @@ meminfo_t get_meminfo() {
284299
285300 meminfo .heap_virtual_start = HEAP_VIRTUAL_START ;
286301 meminfo .heap_physical_start = heap_physical_start ;
302+ <<<<<<< HEAD
287303 meminfo .heap_virtual_start = HEAP_VIRTUAL_START ;
288304 meminfo .heap_physical_start = heap_physical_start ;
305+ = == == ==
306+ >>>>>>> 3f e2ead (realize paging memory , add kmalloc aligned ; todo : realize kmemdump fully )
289307 meminfo .heap_size = HEAP_SIZE ;
290308 meminfo .block_size = BLOCK_SIZE ;
291309 meminfo .free_blocks = free_blocks ;
@@ -299,17 +317,23 @@ meminfo_t get_meminfo() {
299317 meminfo .used_pages = 256 ; // Примерное значение
300318 meminfo .free_pages = 768 ; // Примерное значение
301319
320+ <<<<<<< HEAD
302321 // Информация о страницах (заглушка)
303322 meminfo .page_directory_phys = (u32 )get_physical_address (get_current_page_directory ());
304323 meminfo .total_pages = 1024 ; // Примерное значение
305324 meminfo .used_pages = 256 ; // Примерное значение
306325 meminfo .free_pages = 768 ; // Примерное значение
307326
327+ = == == ==
328+ >>>>>>> 3f e2ead (realize paging memory , add kmalloc aligned ; todo : realize kmemdump fully )
308329 return meminfo ;
309330}
310331
311332// Дамп информации о памяти
333+ <<<<<<< HEAD
312334// Дамп информации о памяти
335+ == = == ==
336+ >>>>>>> 3f e2ead (realize paging memory , add kmalloc aligned ; todo : realize kmemdump fully )
313337void kmemdump () {
314338 meminfo_t info = get_meminfo ();
315339 mem_block_t * current = info .free_blocks ;
@@ -319,27 +343,36 @@ void kmemdump() {
319343 info .heap_virtual_start + info .heap_size , info .heap_size );
320344 kprintf ("Heap: physical %x - %x\n" , info .heap_physical_start ,
321345 info .heap_physical_start + info .heap_size );
346+ <<<<<<< HEAD
322347 kprintf ("Heap: virtual %x - %x (%d bytes)\n" , info .heap_virtual_start ,
323348 info .heap_virtual_start + info .heap_size , info .heap_size );
324349 kprintf ("Heap: physical %x - %x\n" , info .heap_physical_start ,
325350 info .heap_physical_start + info .heap_size );
351+ = == == ==
352+ >>>>>>> 3f e2ead (realize paging memory , add kmalloc aligned ; todo : realize kmemdump fully )
326353 kprintf ("Block size: %d bytes\n" , info .block_size );
327354 kprintf ("Total: USED=%d bytes, FREE=%d bytes, in %d blocks\n" ,
328355 info .total_used , info .total_free , info .block_count );
329356 kprintf ("Pages: TOTAL=%d, USED=%d, FREE=%d\n\n" ,
330357 info .total_pages , info .used_pages , info .free_pages );
358+ <<<<<<< HEAD
331359 kprintf ("Total: USED=%d bytes, FREE=%d bytes, in %d blocks\n" ,
332360 info .total_used , info .total_free , info .block_count );
333361 kprintf ("Pages: TOTAL=%d, USED=%d, FREE=%d\n\n" ,
334362 info .total_pages , info .used_pages , info .free_pages );
363+ = == == ==
364+ >>>>>>> 3f e2ead (realize paging memory , add kmalloc aligned ; todo : realize kmemdump fully )
335365
336366 while (current ) {
337367 kprintf ("Block %d: virt=%x, phys=%x, Size=%d, %s\n" , counter ++ ,
338368 (u32 )current , (u32 )get_physical_address (current ),
339369 current -> size , current -> is_free ? "FREE" : "USED" );
370+ <<<<<<< HEAD
340371 kprintf ("Block %d: virt=%x, phys=%x, Size=%d, %s\n" , counter ++ ,
341372 (u32 )current , (u32 )get_physical_address (current ),
342373 current -> size , current -> is_free ? "FREE" : "USED" );
374+ = == == ==
375+ >>>>>>> 3f e2ead (realize paging memory , add kmalloc aligned ; todo : realize kmemdump fully )
343376 current = current -> next ;
344377 }
345378
0 commit comments