diff options
author | Alex Auvolat <alex@adnab.me> | 2016-07-30 23:39:14 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2016-07-30 23:39:14 +0200 |
commit | 2f34f0694f953fd00d2885b86634bbd618852fed (patch) | |
tree | 2eabba74b136043596e0bc6e5148184a4e7da87b | |
parent | f58f65c30de315d4419f69a92a708cbed797ff37 (diff) | |
download | kogata-2f34f0694f953fd00d2885b86634bbd618852fed.tar.gz kogata-2f34f0694f953fd00d2885b86634bbd618852fed.zip |
Fix stuff
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | src/kernel/core/kmain.c | 2 | ||||
-rw-r--r-- | src/kernel/user/syscall.c | 1 | ||||
-rw-r--r-- | src/lib/libc/stdio.c | 3 | ||||
-rwxr-xr-x | src/tests/ktests/run_qemu_test.sh | 2 | ||||
-rwxr-xr-x | src/tests/utests/run_qemu_test.sh | 2 |
6 files changed, 14 insertions, 6 deletions
@@ -1,6 +1,9 @@ all: bam +rel: + bam cdrom.rel.iso + clean: bam -c @@ -20,12 +23,15 @@ rebuild: clean all mrproper: clean run_tests: - rm build/tests/*.log build/tests/*.log.err || true - bam test + rm build/dev/tests/*.log build/dev/tests/*.log.err || true + bam test.dev run_qemu: all qemu-system-i386 -cdrom cdrom.dev.iso -serial stdio -m 12 </dev/null +run_qemu_rel: rel + qemu-system-i386 -cdrom cdrom.rel.iso -serial stdio -m 12 </dev/null + run_qemu_debug: all qemu-system-i386 -cdrom cdrom.dev.iso -serial stdio -m 12 -s -S </dev/null & \ (sleep 0.1; gdb src/kernel/kernel.bin -x gdb_cmd) diff --git a/src/kernel/core/kmain.c b/src/kernel/core/kmain.c index 8ce9f0a..95b63d5 100644 --- a/src/kernel/core/kmain.c +++ b/src/kernel/core/kmain.c @@ -74,6 +74,8 @@ void kmain(multiboot_info_t *mbd, int32_t mb_magic) { if (mbd->elf_sec.size != 0) { elf_sections = (elf_shdr_t*)(mbd->elf_sec.addr + K_HIGHHALF_ADDR); ASSERT(mbd->elf_sec.size == 0 || sizeof(elf_shdr_t) == mbd->elf_sec.size); + } else { + ASSERT(mbd->elf_sec.num == 0); } dbglog_setup(); diff --git a/src/kernel/user/syscall.c b/src/kernel/user/syscall.c index e89f62d..9497bf2 100644 --- a/src/kernel/user/syscall.c +++ b/src/kernel/user/syscall.c @@ -325,7 +325,6 @@ uint32_t select_sc(sc_args_t args) { if (h) { fds[i].got_flags = file_poll(h, &wait_objs[n_wait_objs]); if (wait_objs[n_wait_objs]) n_wait_objs++; - dbg_printf("KERNEL fds[%d].got_flags = 0x%p (fd %d)\n", i, fds[i].got_flags,fds[i].fd); if (fds[i].got_flags & fds[i].req_flags) ret = true; } } diff --git a/src/lib/libc/stdio.c b/src/lib/libc/stdio.c index 0d707ef..2872f62 100644 --- a/src/lib/libc/stdio.c +++ b/src/lib/libc/stdio.c @@ -228,7 +228,8 @@ void setlinebuf(FILE *stream) { } int setvbuf(FILE *stream, char *buf, int mode, size_t size) { if (stream == NULL || stream->fd == 0 - || !(stream->file_mode & FM_WRITE)) return EOF; + || !(stream->file_mode & FM_WRITE) + || size == 0) return EOF; if (fflush(stream) != 0) return EOF; diff --git a/src/tests/ktests/run_qemu_test.sh b/src/tests/ktests/run_qemu_test.sh index bc86f12..d27fa97 100755 --- a/src/tests/ktests/run_qemu_test.sh +++ b/src/tests/ktests/run_qemu_test.sh @@ -6,7 +6,7 @@ LOGFILE=$2 RESULTFILE=`mktemp` PIDFILE=`mktemp` -(timeout 3s qemu-system-i386 -kernel $BINFILE -serial stdio -m 16 -display none 2>/dev/null \ +(timeout 5s qemu-system-i386 -kernel $BINFILE -serial stdio -m 16 -display none 2>/dev/null \ & echo $! >$PIDFILE) \ | tee >(grep -m 1 "TEST-" >$RESULTFILE; kill -INT `cat $PIDFILE`) > $LOGFILE diff --git a/src/tests/utests/run_qemu_test.sh b/src/tests/utests/run_qemu_test.sh index b9f3c36..c66f2e1 100755 --- a/src/tests/utests/run_qemu_test.sh +++ b/src/tests/utests/run_qemu_test.sh @@ -7,7 +7,7 @@ KERNEL=$3 RESULTFILE=`mktemp` PIDFILE=`mktemp` -(timeout 3s qemu-system-i386 -kernel $KERNEL -append "init=io:/mod/`basename $BINFILE`" \ +(timeout 5s qemu-system-i386 -kernel $KERNEL -append "init=io:/mod/`basename $BINFILE`" \ -initrd "$BINFILE" -serial stdio -m 16 -display none 2>/dev/null \ & echo $! >$PIDFILE) \ | tee >(grep -m 1 "TEST-" >$RESULTFILE; kill -INT `cat $PIDFILE`) >$LOGFILE |