Skip to content

Commit 882f0b7

Browse files
authored
修复内存bug与grub安装脚本的错误 (#129)
* 修复内存bug与grub安装脚本的错误 * 修改小bug
1 parent adc1846 commit 882f0b7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

kernel/src/mm/mm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ void mm_init()
196196
memory_management_struct.zones_struct_len = (memory_management_struct.count_zones * sizeof(struct Zone) + sizeof(ul) - 1) & (~(sizeof(ul) - 1));
197197

198198
ZONE_DMA_INDEX = 0;
199-
ZONE_NORMAL_INDEX = 0;
199+
ZONE_NORMAL_INDEX = memory_management_struct.count_zones ;
200200
ZONE_UNMAPPED_INDEX = 0;
201201

202202
// kdebug("ZONE_DMA_INDEX=%d\tZONE_NORMAL_INDEX=%d\tZONE_UNMAPPED_INDEX=%d", ZONE_DMA_INDEX, ZONE_NORMAL_INDEX, ZONE_UNMAPPED_INDEX);
@@ -323,7 +323,7 @@ struct Page *alloc_pages(unsigned int zone_select, int num, ul flags)
323323
break;
324324
}
325325

326-
for (int i = zone_start; i <= zone_end; ++i)
326+
for (int i = zone_start; i < zone_end; ++i)
327327
{
328328
if ((memory_management_struct.zones_struct + i)->count_pages_free < num)
329329
continue;

tools/grub_auto_install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ grub_dir_i386_efi=${ABS_PREFIX}/arch/i386/efi/grub
44
grub_dir_i386_legacy=${ABS_PREFIX}/arch/i386/legacy/grub
55
grub_dir_x86_64_efi=${ABS_PREFIX}/arch/x86_64/efi/grub
66

7-
mkdir -p ${grub_dir_i386_efi}
8-
mkdir -p ${grub_dir_i386_legacy}
9-
mkdir -p ${grub_dir_x86_64_efi}
7+
sudo mkdir -p ${grub_dir_i386_efi}
8+
sudo mkdir -p ${grub_dir_i386_legacy}
9+
sudo mkdir -p ${grub_dir_x86_64_efi}
1010

1111
# 防止外层声明了环境变量,影响到grub的编译
1212
export CC=gcc

0 commit comments

Comments
 (0)