68000: switch to 32bit integer type
authorAlan Cox <alan@linux.intel.com>
Tue, 13 Sep 2016 23:02:52 +0000 (00:02 +0100)
committerAlan Cox <alan@linux.intel.com>
Tue, 13 Sep 2016 23:02:52 +0000 (00:02 +0100)
Kernel/cpu-68000/cpu.h
Kernel/cpu-68000/rules.mk
Kernel/lowlevel-68000.S
Kernel/platform-v68/p68000.S

index ff48232..b4a1bed 100644 (file)
@@ -58,10 +58,7 @@ extern uint16_t swab(uint16_t);
 #define cpu_to_le16(x) le16_to_cpu(x)
 #define le16_to_cpu(x) (uint16_t)(__builtin_bswap16((uint16_t)(x)))
 #define cpu_to_le32(x) le32_to_cpu(x)
-extern uint32_t le32_to_cpu(uint32_t);
-
-/* This is broken on the Fedora m68k gcc 5.3.1 */
-//#define le32_to_cpu(x)       (uint32_t)(__builtin_bswap32((uint32_t)(x)))
+#define le32_to_cpu(x) (uint32_t)(__builtin_bswap32((uint32_t)(x)))
 
 /* We don't need any banking bits really */
 #define CODE1
index 5166840..68b7ab8 100644 (file)
@@ -1,7 +1,7 @@
 export CROSS_LD=m68k-linux-gnu-ld
 export CROSS_CC = m68k-linux-gnu-gcc
 # Do not use the Fedora gcc 5.3.1. It miscompiles stuff badly.
-export CROSS_CCOPTS=-c -fno-builtin -Wall -m68000 -mshort -I$(ROOT_DIR)/cpu-68000 -I$(ROOT_DIR)/platform-$(TARGET) -I$(ROOT_DIR)/include
+export CROSS_CCOPTS=-c -Os -fno-strict-aliasing -fomit-frame-pointer -fno-builtin -Wall -m68000 -I$(ROOT_DIR)/cpu-68000 -I$(ROOT_DIR)/platform-$(TARGET) -I$(ROOT_DIR)/include
 export CROSS_AS=$(CROSS_CC) $(CROSS_CCOPTS) #-Wa,-M
 export CROSS_CC_SEG1=
 export CROSS_CC_SEG2=
index 468949e..52f07df 100644 (file)
@@ -267,6 +267,114 @@ L2:       subql   IMM (1),d4
 #endif /* __mcf5200__ || __mcoldfire__ */
 
 
+/* libgcc1 routines for 68000 w/o floating-point hardware.
+   Copyright (C) 1994, 1996, 1997, 1998 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file with other programs, and to distribute
+those programs without any restriction coming from the use of this
+file.  (The General Public License restrictions do apply in other
+respects; for example, they cover modification of the file, and
+distribution when not linked into another program.)
+
+This file is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details. */
+
+/* As a special exception, if you link this library with files
+   compiled with GCC to produce an executable, this does not cause
+   the resulting executable to be covered by the GNU General Public License.
+   This exception does not however invalidate any other reasons why
+   the executable file might be covered by the GNU General Public License.  */
+
+/* Use this one for any 680x0; assumes no floating point hardware.
+   The trailing " '" appearing on some lines is for ANSI preprocessors.  Yuk.
+   Some of this code comes from MINIX, via the folks at ericsson.
+   D. V. Henkel-Wallace (gumby@cygnus.com) Fete Bastille, 1992
+*/
+
+/* These are predefined by new versions of GNU cpp.  */
+
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+#ifndef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__
+#endif
+
+#ifndef __IMMEDIATE_PREFIX__
+#define __IMMEDIATE_PREFIX__ #
+#endif
+
+/* ANSI concatenation macros.  */
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels.  */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
+/* Use the right prefix for registers.  */
+
+#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
+
+/* Use the right prefix for immediate values.  */
+
+#define IMM(x) CONCAT1 (__IMMEDIATE_PREFIX__, x)
+
+#define d0 REG (d0)
+#define d1 REG (d1)
+#define d2 REG (d2)
+#define d3 REG (d3)
+#define d4 REG (d4)
+#define d5 REG (d5)
+#define d6 REG (d6)
+#define d7 REG (d7)
+#define a0 REG (a0)
+#define a1 REG (a1)
+#define a2 REG (a2)
+#define a3 REG (a3)
+#define a4 REG (a4)
+#define a5 REG (a5)
+#define a6 REG (a6)
+#define fp REG (fp)
+#define sp REG (sp)
+
+       .text
+       .proc
+       .globl  SYM (__umodsi3)
+SYM (__umodsi3):
+       movel   sp@(8), d1      /* d1 = divisor */
+       movel   sp@(4), d0      /* d0 = dividend */
+       movel   d1, sp@-
+       movel   d0, sp@-
+       jbsr    SYM (__udivsi3)
+       addql   IMM (8), sp
+       movel   sp@(8), d1      /* d1 = divisor */
+#if !(defined(__mcf5200__) || defined(__mcoldfire__))
+       movel   d1, sp@-
+       movel   d0, sp@-
+       jbsr    SYM (__mulsi3)  /* d0 = (a/b)*b */
+       addql   IMM (8), sp
+#else
+       mulsl   d1,d0
+#endif
+       movel   sp@(4), d1      /* d1 = dividend */
+       subl    d0, d1          /* d1 = a - (a/b)*b */
+       movel   d1, d0
+       rts
+
 
                .globl di,ei,irqrestore
                .globl doexec
index 10ac3c3..647eb19 100644 (file)
@@ -11,7 +11,6 @@
                .globl udata_block
                .globl devide_read_data
                .globl devide_write_data
-               .globl le32_to_cpu
 
 .mri 1
 trap_reboot:
@@ -135,15 +134,6 @@ devide_write_l:
        move.w (a0)+,$00F01000
        dbra d0,devide_write_l
        rts
-;
-;      Bits we need to deal with breakages in gcc
-;
-le32_to_cpu:
-       move.l 4(sp),d0
-       ror.w #8,d0
-       swap d0
-       ror.w #8,d0
-       rts
 
 .section data