diff --git a/arch/x86-64/crt0.S b/arch/x86-64/crt0.S index 6e57b093..109f94ef 100644 --- a/arch/x86-64/crt0.S +++ b/arch/x86-64/crt0.S @@ -49,6 +49,7 @@ _start: .align 8 +.type multiboot_header,STT_OBJECT multiboot_header: /* magic */ .int MULTIBOOT_HEADER_MAGIC @@ -63,7 +64,7 @@ multiboot_header: /* load_addr */ .int _start /* load_end_addr */ - .int __bss_start + .int __data_end /* bss_end_addr */ .int __bss_end /* entry_addr */ diff --git a/arch/x86-64/thread.c b/arch/x86-64/thread.c index 746ac918..2d500e41 100644 --- a/arch/x86-64/thread.c +++ b/arch/x86-64/thread.c @@ -118,8 +118,8 @@ void arch_context_switch(thread_t *oldthread, thread_t *newthread) "pushq %%r14 \n\t" "pushq %%r15 \n\t" - "movq %%rsp,%0 \n\t" - "movq %1,%%rsp \n\t" + "movq %%rsp,%[old] \n\t" + "movq %[new],%%rsp \n\t" "popq %%r15 \n\t" "popq %%r14 \n\t" @@ -140,9 +140,9 @@ void arch_context_switch(thread_t *oldthread, thread_t *newthread) "ret \n\t" "1: \n\t" - : "=g" (oldthread->arch.rsp) - : "g" (newthread->arch.rsp) + : [old] "=m" (oldthread->arch.rsp) + : [new] "g" (newthread->arch.rsp) ); } -/* vim: noexpandtab */ +/* vim: noexpandtab: */ diff --git a/arch/x86/crt0.S b/arch/x86/crt0.S index 2d38e32d..da454da3 100644 --- a/arch/x86/crt0.S +++ b/arch/x86/crt0.S @@ -45,6 +45,7 @@ _start: .align 4 +.type multiboot_header,STT_OBJECT multiboot_header: /* magic */ .int MULTIBOOT_HEADER_MAGIC @@ -59,7 +60,7 @@ multiboot_header: /* load_addr */ .int _start /* load_end_addr */ - .int __bss_start + .int __data_end /* bss_end_addr */ .int __bss_end /* entry_addr */ diff --git a/scripts/do-qemuarm b/scripts/do-qemuarm index 0cfece51..3d3cfb07 100755 --- a/scripts/do-qemuarm +++ b/scripts/do-qemuarm @@ -9,7 +9,7 @@ function HELP { echo "-t a virtio tap network device" echo "-d a virtio display" echo "-6 64bit arm" - echo "-M " + echo "-m " echo "-h for help" echo "all arguments after -- are passed to qemu directly" exit 1 diff --git a/scripts/do-qemux86 b/scripts/do-qemux86 index 222308b0..20817e19 100755 --- a/scripts/do-qemux86 +++ b/scripts/do-qemux86 @@ -1,4 +1,43 @@ -#!/bin/sh +#!/bin/bash + +function HELP { + echo "help:" + echo "-6 x86-64" + echo "-m " + echo "-h for help" + echo "all arguments after -- are passed to qemu directly" + exit 1 +} + +DO_64BIT=0 +MEMSIZE=512 +SUDO="" +MAKE_VARS="" + +while getopts bdhm:cMnt6 FLAG; do + case $FLAG in + 6) DO_64BIT=1;; + m) MEMSIZE=$OPTARG;; + h) HELP;; + \?) + echo unrecognized option + HELP + esac +done + +shift $((OPTIND-1)) + +if [ $DO_64BIT == 1 ]; then + QEMU="qemu-system-x86_64" + PROJECT="pc-x86-64-test" +else + QEMU="qemu-system-i386" + PROJECT="pc-x86-test" +fi + +ARGS=" -m $MEMSIZE -kernel build-${PROJECT}/lk.elf -nographic" + +make $MAKE_VARS $PROJECT -j4 && +echo $SUDO $QEMU $ARGS $@ && +$SUDO $QEMU $ARGS $@ -make pc-x86-test -j4 && -qemu-system-i386 -kernel build-pc-x86-test/lk.elf -nographic $@