diff --git a/src/cmd/as/as.c b/src/cmd/as/as.c index 6b958c0..c01b922 100644 --- a/src/cmd/as/as.c +++ b/src/cmd/as/as.c @@ -83,6 +83,7 @@ enum { LIDENT, /* .ident */ LWEAK, /* .weak */ LLOCAL, /* .local */ + LNAN, /* .nan */ }; /* @@ -731,6 +732,9 @@ int lookacmd () case 'm': if (! strcmp (".mask", name)) return (LMASK); break; + case 'n': + if (! strcmp (".nan", name)) return (LNAN); + break; case 'p': if (! strcmp (".previous", name)) return (LPREVIOUS); break; @@ -2258,6 +2262,12 @@ void pass1 () uerror ("bad parameter of .end"); cval = lookname(); break; + case LNAN: + /* .nan name */ + clex = getlex (&cval); + if (clex != LNAME) + uerror ("bad parameter of .nan"); + break; case LTYPE: /* .type name,type */ if (getlex (&cval) != LNAME) @@ -2707,8 +2717,12 @@ int main (argc, argv) break; case 'I': /* include dir */ // TODO - while (*++cp); - --cp; + if (cp[1] == 0) { + i++; + } else { + while (*++cp); + --cp; + } break; case 'O': /* optimization level */ // TODO diff --git a/src/cmd/as/mips-instruction-set.txt b/src/cmd/as/mips-instruction-set.txt index 669dd78..6cd4c80 100644 --- a/src/cmd/as/mips-instruction-set.txt +++ b/src/cmd/as/mips-instruction-set.txt @@ -226,7 +226,7 @@ RDHWR Read Hardware Register Allows unprivileged acce RDPGPR Read GPR from Previous Shadow Set Rt = SGPR[SRSCtl.PSS, Rd] RESTORE Restore registers and deallocate stack See Architecture Reference Manual - frame (MIPS16eŠ only) + frame (MIPS16e only) ROTR Rotate Word Right Rd = Rt[sa-1..0] || Rt[31..sa] diff --git a/src/cmd/basic/basic.c b/src/cmd/basic/basic.c index 956ea43..4131760 100644 --- a/src/cmd/basic/basic.c +++ b/src/cmd/basic/basic.c @@ -1534,7 +1534,7 @@ int get_value() value = get_num(); else { ++cmdptr; - switch (c) { + switch ((int)c) { case '(': /* nesting */ value = eval_sub(); break; diff --git a/src/elf32-mips.ld b/src/elf32-mips.ld index 31b362b..8cf668f 100644 --- a/src/elf32-mips.ld +++ b/src/elf32-mips.ld @@ -92,7 +92,7 @@ SECTIONS *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } - .eh_frame_hdr : { *(.eh_frame_hdr) } + .eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) } .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } /* Adjust the address for the data segment. */ diff --git a/src/games/sail/sync.c b/src/games/sail/sync.c index 2522f47..426575b 100644 --- a/src/games/sail/sync.c +++ b/src/games/sail/sync.c @@ -357,7 +357,7 @@ Sync() switch (*p++ = getc(sync_fp)) { case '\n': p--; - case EOF: + case (char)EOF: break; default: if (p >= buf + sizeof buf) diff --git a/src/games/trek/main.c b/src/games/trek/main.c index f7d9fb7..c7bab1c 100644 --- a/src/games/trek/main.c +++ b/src/games/trek/main.c @@ -179,10 +179,6 @@ main(argc, argv) } if (ac > 2) syserr(0, "arg count"); - /* - if (ac > 1) - f_log = fopen(av[0], opencode); - */ printf("\n * * * S T A R T R E K * * *\n\nPress return to continue.\n"); diff --git a/sys/kernel/rdisk.c b/sys/kernel/rdisk.c index dea62b0..5a91f93 100644 --- a/sys/kernel/rdisk.c +++ b/sys/kernel/rdisk.c @@ -15,7 +15,7 @@ extern struct buf *getnewbuf(); /* * Variable naming conventions - * + * * root - this is the number of the device entry in the disks[] array * part - the minor number of a device entry, which represents the partition * number, or 0 for the whole disk @@ -75,7 +75,7 @@ const struct diskentry disks[] = { #ifdef SDRAMP_ENABLED {sdramp_preinit, no_init, no_deinit, sdramp_open, sdramp_size, sdramp_read, sdramp_write, 0, RD_PREPART}, -#endif +#endif #ifdef FLASH_ENABLED {flash_init, no_init, no_deinit, flash_open, flash_size, flash_read, flash_write, 0, RD_READONLY}, @@ -164,8 +164,9 @@ static inline int init_device(int root,int flag) for(i=0; i<4; i++) { - dflags[root].start[i] = mbr->partitions[i].lbastart>>1; - dflags[root].len[i] = mbr->partitions[i].lbalength>>1; + struct partition part = mbr->partitions[i]; + dflags[root].start[i] = part.lbastart >> 1; + dflags[root].len[i] = part.lbalength >> 1; } dflags[root].blocks = disks[root].size(unit); brelse(bp); @@ -320,7 +321,7 @@ void rdstrategy(register struct buf *bp) void update_mbr(int unit) { - + } int rdioctl (dev_t dev, register u_int cmd, caddr_t addr, int flag) @@ -337,7 +338,7 @@ int rdioctl (dev_t dev, register u_int cmd, caddr_t addr, int flag) { bflush(major(dev)); init_device(major(dev),S_SILENT); - + } return 0; } @@ -432,7 +433,7 @@ dev_t get_boot_device() rdclose(makedev(i,0),0,0); } } - + return bd; #endif } @@ -610,7 +611,7 @@ struct buf *prepartition_device(char *devname) dev[pos] = 0; p++; } - + if((*p) == ':') { p++; @@ -670,7 +671,7 @@ struct buf *prepartition_device(char *devname) p++; } } - + if(pnum > 0) { mbr->bootsig = 0xAA55; diff --git a/sys/pic32/gcc-config.mk b/sys/pic32/gcc-config.mk index ba76531..d10c4ae 100644 --- a/sys/pic32/gcc-config.mk +++ b/sys/pic32/gcc-config.mk @@ -15,18 +15,37 @@ endif # MPLABX C32 compiler doesn't support some functionality # we need, so use chipKIT compiler by default. ifndef GCCPREFIX +ifeq (/usr/local/pic32-tools/bin/pic32-gcc,$(wildcard /usr/local/pic32-tools/bin/pic32-gcc)) GCCPREFIX = /usr/local/pic32-tools/bin/pic32- LDFLAGS = -Wl,--oformat=elf32-tradlittlemips endif +endif # Generic MIPS toolchain # ~~~~~~~~~~~~~~~~~~~~~~ # You can build it from sources, as described on page # http://retrobsd.org/wiki/doku.php/doc/toolchain-mips ifndef GCCPREFIX +ifeq (/usr/local/mips-gcc-4.7.2/bin/mips-elf-gcc,$(wildcard /usr/local/mips-gcc-4.7.2/bin/mips-elf-gcc)) GCCPREFIX = /usr/local/mips-gcc-4.7.2/bin/mips-elf- LDFLAGS = endif +endif + +# Mentor Sourcery CodeBench Lite toolchain +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# You can download a Linux or Windows binary package from +# https://sourcery.mentor.com/GNUToolchain/release2641 +ifndef GCCPREFIX +ifeq (/usr/local/mips-2013.11/bin/mips-sde-elf-gcc,$(wildcard /usr/local/mips-2013.11/bin/mips-sde-elf-gcc)) + GCCPREFIX = /usr/local/mips-2013.11/bin/mips-sde-elf- + LDFLAGS = -Wl,--oformat=elf32-tradlittlemips +endif +endif + +ifndef GCCPREFIX + $(error Unable to locate any GCC MIPS toolchain!) +endif # chipKIT MPIDE on Mac OS X ifneq (,$(wildcard /Applications/Mpide.app/Contents/Resources/Java/hardware/tools/avr)) diff --git a/target.mk b/target.mk index a8baf0c..5514ec0 100644 --- a/target.mk +++ b/target.mk @@ -1,5 +1,5 @@ -MACHINE = mips -DESTDIR ?= $(TOPSRC) +MACHINE = mips +DESTDIR ?= $(TOPSRC) RELEASE = 0.0 BUILD = $(shell git rev-list HEAD --count) VERSION = $(RELEASE)-$(BUILD) @@ -22,20 +22,40 @@ endif # MPLABX C32 compiler doesn't support some functionality # we need, so use chipKIT compiler by default. ifndef GCCPREFIX +ifeq (/usr/local/pic32-tools/bin/pic32-gcc,$(wildcard /usr/local/pic32-tools/bin/pic32-gcc)) GCCPREFIX = /usr/local/pic32-tools/bin/pic32- LDFLAGS = -Wl,--oformat=elf32-tradlittlemips INCLUDES = -I/usr/local/pic32-tools/lib/gcc/pic32mx/4.5.1/include endif +endif # Generic MIPS toolchain # ~~~~~~~~~~~~~~~~~~~~~~ # You can build it from sources, as described on page # http://retrobsd.org/wiki/doku.php/doc/toolchain-mips ifndef GCCPREFIX +ifeq (/usr/local/mips-gcc-4.7.2/bin/mips-elf-gcc,$(wildcard /usr/local/mips-gcc-4.7.2/bin/mips-elf-gcc)) GCCPREFIX = /usr/local/mips-gcc-4.7.2/bin/mips-elf- LDFLAGS = INCLUDES = endif +endif + +# Mentor Sourcery CodeBench Lite toolchain +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# You can download a Linux or Windows binary package from +# https://sourcery.mentor.com/GNUToolchain/release2641 +ifndef GCCPREFIX +ifeq (/usr/local/mips-2013.11/bin/mips-sde-elf-gcc,$(wildcard /usr/local/mips-2013.11/bin/mips-sde-elf-gcc)) + GCCPREFIX = /usr/local/mips-2013.11/bin/mips-sde-elf- + LDFLAGS = -Wl,--oformat=elf32-tradlittlemips + INCLUDES = +endif +endif + +ifndef GCCPREFIX + $(error Unable to locate any GCC MIPS toolchain!) +endif CC = $(GCCPREFIX)gcc -mips32r2 -EL -msoft-float -nostdinc -fshort-double -I$(TOPSRC)/include $(INCLUDES) CXX = $(GCCPREFIX)g++ -mips32r2 -EL -msoft-float -nostdinc -fshort-double -I$(TOPSRC)/include $(INCLUDES) diff --git a/tools/elf2aout/elf2aout.c b/tools/elf2aout/elf2aout.c index 453254e..0860eb1 100644 --- a/tools/elf2aout/elf2aout.c +++ b/tools/elf2aout/elf2aout.c @@ -361,15 +361,16 @@ usage: fprintf(stderr, for (i = 0; i < ex.e_phnum; i++) { /* Section types we can ignore... */ if (ph[i].p_type == PT_NULL || ph[i].p_type == PT_NOTE || - ph[i].p_type == PT_PHDR || ph[i].p_type == PT_MIPS_REGINFO) + ph[i].p_type == PT_PHDR || ph[i].p_type == PT_MIPS_REGINFO || + ph[i].p_type == PT_GNU_EH_FRAME) continue; - /* Section types we can't handle... */ - if (ph[i].p_type != PT_LOAD) - errx(1, "Program header %d type %d can't be converted.", i, ph[i].p_type); if (verbose) printf ("Section type=%x flags=%x vaddr=%x filesz=%x\n", ph[i].p_type, ph[i].p_flags, ph[i].p_vaddr, ph[i].p_filesz); + /* Section types we can't handle... */ + if (ph[i].p_type != PT_LOAD && ph[i].p_type != PT_GNU_EH_FRAME) + errx(1, "Program header %d type %x can't be converted.", i, ph[i].p_type); /* Writable (data) segment? */ if (ph[i].p_flags & PF_W) {