summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2009-10-07 17:42:25 -0400
committerFrans Kaashoek <[email protected]>2009-10-07 17:42:25 -0400
commitaaf63e62d763216448854bc6f921943a5140462e (patch)
treeaba0d8124bd49710ba2e5c5904786e20e5def1db
parentab777a9ad0355e6df16ee53bad348d5fbb1f347f (diff)
parent2c536bff67ed209b1c5aa3d40e40731813bfcd9a (diff)
downloadxv6-labs-aaf63e62d763216448854bc6f921943a5140462e.tar.gz
xv6-labs-aaf63e62d763216448854bc6f921943a5140462e.tar.bz2
xv6-labs-aaf63e62d763216448854bc6f921943a5140462e.zip
Merge branch 'master' of git+ssh://amsterdam.csail.mit.edu/home/am0/6.828/xv6
-rw-r--r--.gdbinit.tmpl7
-rw-r--r--Makefile12
-rw-r--r--console.c11
-rw-r--r--string.c7
4 files changed, 28 insertions, 9 deletions
diff --git a/.gdbinit.tmpl b/.gdbinit.tmpl
index 4c4e734..f71681a 100644
--- a/.gdbinit.tmpl
+++ b/.gdbinit.tmpl
@@ -1,9 +1,5 @@
set $lastcs = -1
-# This fails on Darwin because the default gdb has no ELF support
-# echo + symbol-file obj/kern/kernel\n
-# symbol-file obj/kern/kernel
-
define hook-stop
# There doesn't seem to be a good way to detect if we're in 16- or
# 32-bit mode, but in 32-bit mode we always run with CS == 8 in the
@@ -26,3 +22,6 @@ end
echo + target remote localhost:1234\n
target remote localhost:1234
+
+echo + symbol-file kernel\n
+symbol-file kernel
diff --git a/Makefile b/Makefile
index 1e73ee1..24ba05e 100644
--- a/Makefile
+++ b/Makefile
@@ -39,7 +39,7 @@ OBJCOPY = $(TOOLPREFIX)objcopy
OBJDUMP = $(TOOLPREFIX)objdump
CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -O2 -Wall -MD -ggdb -m32
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
-ASFLAGS = -m32
+ASFLAGS = -m32 -gdwarf-2
# FreeBSD ld wants ``elf_i386_fbsd''
LDFLAGS += -m $(shell $(LD) -V | grep elf_i386 2>/dev/null)
@@ -143,9 +143,9 @@ GDBPORT = $(shell expr `id -u` % 5000 + 25000)
QEMUOPTS = -smp 2 -hdb fs.img xv6.img
qemu: fs.img xv6.img
- qemu -parallel mon:stdio $(QEMUOPTS)
+ qemu -serial mon:stdio $(QEMUOPTS)
-qemutty: fs.img xv6.img
+qemu-nox: fs.img xv6.img
qemu -nographic $(QEMUOPTS)
.gdbinit: .gdbinit.tmpl
@@ -153,7 +153,11 @@ qemutty: fs.img xv6.img
qemu-gdb: fs.img xv6.img .gdbinit
@echo "*** Now run 'gdb'." 1>&2
- qemu -parallel mon:stdio $(QEMUOPTS) -s -S -p $(GDBPORT)
+ qemu -serial mon:stdio $(QEMUOPTS) -s -S -p $(GDBPORT)
+
+qemu-gdb-nox: fs.img xv6.img .gdbinit
+ @echo "*** Now run 'gdb'." 1>&2
+ qemu -nographic $(QEMUOPTS) -s -S -p $(GDBPORT)
# CUT HERE
# prepare dist for students
diff --git a/console.c b/console.c
index 0613a47..16d0e7a 100644
--- a/console.c
+++ b/console.c
@@ -163,7 +163,12 @@ consputc(int c)
;
}
- uartputc(c);
+ if (c == BACKSPACE) {
+ uartputc('\b');
+ uartputc(' ');
+ uartputc('\b');
+ } else
+ uartputc(c);
cgaputc(c);
}
@@ -198,6 +203,7 @@ consoleintr(int (*getc)(void))
}
break;
case C('H'): // Backspace
+ case '\x7f':
if(input.e != input.w){
input.e--;
consputc(BACKSPACE);
@@ -205,6 +211,9 @@ consoleintr(int (*getc)(void))
break;
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
+ // The serial port produces 0x13, not 0x10
+ if(c == '\r')
+ c = '\n';
input.buf[input.e++ % INPUT_BUF] = c;
consputc(c);
if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
diff --git a/string.c b/string.c
index cb890ee..a557dc5 100644
--- a/string.c
+++ b/string.c
@@ -44,6 +44,13 @@ memmove(void *dst, const void *src, uint n)
return dst;
}
+// memcpy exists to placate GCC. Use memmove.
+void*
+memcpy(void *dst, const void *src, uint n)
+{
+ return memmove(dst, src, n);
+}
+
int
strncmp(const char *p, const char *q, uint n)
{