From afcf062044151518ad5f8031c42ed9d8f344d2b3 Mon Sep 17 00:00:00 2001 From: reccetear <16102666004@qq.com> Date: Wed, 26 Apr 2017 01:16:37 +0800 Subject: [PATCH] fix Makefile bug dont need bal --- Makefile | 4 +-- am/arch/mips32-npc/img/boot/Makefile | 2 +- am/arch/mips32-npc/img/boot/start.S | 2 -- am/arch/mips32-npc/src/asym.c | 40 ++++++++++++++++------------ am/arch/mips32-npc/src/time.c | 22 --------------- am/arch/mips32-npc/src/trm.c | 12 ++++++++- 6 files changed, 37 insertions(+), 45 deletions(-) delete mode 100644 am/arch/mips32-npc/src/time.c diff --git a/Makefile b/Makefile index 5c87a6c0..237db9c6 100644 --- a/Makefile +++ b/Makefile @@ -54,9 +54,9 @@ ASFLAGS += -I./am/ -I./$(AM_PATH)/include -I./$(APP_PATH)/include -M # Arch-dependent compilation flags ifeq ($(ARCH), mips32-npc) CXX = $(CROSS_COMPILE)g++-5 -CFLAGS += -fno-pic -static -fno-strict-aliasing -fno-builtin -fno-stack-protector -fno-delayed-branch -mno-abicalls -march=mips32 -mno-check-zero-division -EL +CFLAGS += -MD -fno-pic -static -fno-strict-aliasing -fno-builtin -fno-stack-protector -fno-delayed-branch -mno-abicalls -march=mips32 -mno-check-zero-division -EL CXXFLAGS += -fno-pic -static -fno-strict-aliasing -fno-builtin -fno-stack-protector -fno-delayed-branch -mno-abicalls -march=mips32 -ffreestanding -fno-rtti -fno-exceptions -mno-check-zero-division -EL -ASFLAGS += -march=mips32 -EL +ASFLAGS += -march=mips32 -EL -MD -mno-check-zero-division -O0 -mno-abicalls -fno-pic -fno-delayed-branch endif ifeq ($(ARCH), x86-qemu) CFLAGS += -m32 -fno-builtin -fno-stack-protector -fno-omit-frame-pointer diff --git a/am/arch/mips32-npc/img/boot/Makefile b/am/arch/mips32-npc/img/boot/Makefile index ee46aa14..00d53d77 100644 --- a/am/arch/mips32-npc/img/boot/Makefile +++ b/am/arch/mips32-npc/img/boot/Makefile @@ -1,2 +1,2 @@ start.o: start.S - mips-linux-gnu-as -EL -march=mips32 start.S -o start.o + mips-linux-gnu-gcc -EL -march=mips32 -fno-pic -MD -mno-abicalls -fno-delayed-branch -c start.S -o start.o diff --git a/am/arch/mips32-npc/img/boot/start.S b/am/arch/mips32-npc/img/boot/start.S index 93e40c55..1df18e0e 100644 --- a/am/arch/mips32-npc/img/boot/start.S +++ b/am/arch/mips32-npc/img/boot/start.S @@ -6,9 +6,7 @@ _start: li $sp, 0x0000fffc jal main - nop _qemu: nop jal main - nop diff --git a/am/arch/mips32-npc/src/asym.c b/am/arch/mips32-npc/src/asym.c index db7f37aa..49601f46 100644 --- a/am/arch/mips32-npc/src/asym.c +++ b/am/arch/mips32-npc/src/asym.c @@ -2,12 +2,18 @@ #include #include +void _asye_init(){ + u32 count= GetCount(); + _putc('g'); + SetCompare(count + 20000); +} + void _listen(_RegSet* (*l)(int ex, _RegSet *regs)){ } _RegSet *_make(_Area kstack, void *entry){ - _RegSet *r = (void *)0; - return r; + _RegSet *r = (void *)0; + return r; } void _trap(){ @@ -28,19 +34,19 @@ int _istatus(){ void irq_handle(struct TrapFrame *tf){ //TODO:handle - u32 arg = 0; - asm volatile("add %0,$k1,$zero\n\t":"=r"(arg)); - tf = (void *)arg; - u32 intr = 0; - asm volatile("add %0,$k0,$zero\n\t":"=r"(intr)); - switch(intr){ - case 0x80://time interrupt - { - u32 count= GetCount(); - _putc('g'); - SetCompare(count + 20000); - }break; - default:_putc('0' + intr); - } - asm volatile("nop"); + u32 arg = 0; + asm volatile("add %0,$k1,$zero\n\t":"=r"(arg)); + tf = (void *)arg; + u32 intr = 0; + asm volatile("add %0,$k0,$zero\n\t":"=r"(intr)); + switch(intr){ + case 0x80://time interrupt + { + u32 count= GetCount(); + _putc('g'); + SetCompare(count + 20000); + }break; + default:_putc('0' + intr); + } + asm volatile("nop"); } diff --git a/am/arch/mips32-npc/src/time.c b/am/arch/mips32-npc/src/time.c deleted file mode 100644 index b7c0ee11..00000000 --- a/am/arch/mips32-npc/src/time.c +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include - -u32 GetCount(){ - u32 tick = 0; - asm volatile("mfc0 %0, $9\n\t":"=r"(tick)); - return tick; -} - -void SetCompare(u32 compare){ - asm volatile("mtc0 %0, $11\n\t"::"r"(compare)); -} - -ulong npc_time = 0; - -ulong _uptime() { - return npc_time ++; -} - -ulong _cycles(){ - return 0; -} diff --git a/am/arch/mips32-npc/src/trm.c b/am/arch/mips32-npc/src/trm.c index ac58ac30..9e28392b 100644 --- a/am/arch/mips32-npc/src/trm.c +++ b/am/arch/mips32-npc/src/trm.c @@ -25,12 +25,22 @@ void _halt(int code) { while(1); } +u32 GetCount(){ + u32 tick = 0; + asm volatile("mfc0 %0, $9\n\t":"=r"(tick)); + return tick; +} + +void SetCompare(u32 compare){ + asm volatile("mtc0 %0, $11\n\t"::"r"(compare)); +} + ulong _uptime() { return npc_time ++; } ulong _cycles(){ - return npc_cycles ++; + return 0; } void memory_init(){