Skip to content

Commit

Permalink
修复bug
Browse files Browse the repository at this point in the history
  • Loading branch information
min0911Y committed Dec 14, 2024
1 parent d8cc74f commit 21426a2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/kernel/drivers/storage/fdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ static int getbyte() {
}
asm_in8(0x80); /* 延时 */
}
kloge("getbyte: timeout");
return -1; /* 没读取到 */
}

Expand Down Expand Up @@ -271,8 +270,8 @@ static int fdc_rw(int block, byte *blockbuff, int read, u64 nosectors) {
set_waiter(current_task);
int head, track, sector, tries, copycount = 0;
byte *p_tbaddr = (byte *)0x80000; // 512byte
// 缓冲区(大家可以放心,我们再page.c已经把这里设置为占用了)
byte *p_blockbuff = blockbuff; // r/w的数据缓冲区
// 缓冲区(大家可以放心,我们再page.c已经把这里设置为占用了)
byte *p_blockbuff = blockbuff; // r/w的数据缓冲区

/* 获取block对应的ths */
block2hts(block, &track, &head, &sector);
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/init/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void sysinit() {
cpuid_do_cache(); // 缓存 CPUID 信息

klogd("%s", cpuids.x2apic ? "x2apic" : "apic");
assert(!cpuids.x2apic, "x2apic is not supported");
// assert(!cpuids.x2apic, "x2apic is not supported");

IVT = page_alloc(0x500);
klogi("蹲一个 UB, 马上要把 0 地址的 IVT 备份了啊");
Expand Down
6 changes: 6 additions & 0 deletions src/pl_readline/plreadln.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ static bool pl_readline_handle_history(_self, int n) {
}

void pl_readline_insert_char_and_view(_self, char ch) {
if (self->length >= self->maxlen) {
self->maxlen *= 2;
self->buffer = realloc(self->buffer, self->maxlen);
self->input_buf = realloc(self->input_buf, self->maxlen);
if (!self->buffer) abort(); // 炸了算了
}
pl_readline_insert_char(self->buffer, ch, self->ptr++);
self->length++;
int n = self->length - self->ptr;
Expand Down

0 comments on commit 21426a2

Please sign in to comment.