diff -rcp linux-2.4.19.org/Makefile linux-2.4.19/Makefile
*** linux-2.4.19.org/Makefile	Sat Aug  3 09:39:46 2002
--- linux-2.4.19/Makefile	Wed Nov  6 15:35:27 2002
***************
*** 1,11 ****
  VERSION = 2
  PATCHLEVEL = 4
  SUBLEVEL = 19
! EXTRAVERSION =
  
  KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
  
  ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
  KERNELPATH=kernel-$(shell echo $(KERNELRELEASE) | sed -e "s/-//g")
  
  CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
--- 1,21 ----
+ LINUX_M32R = 1
+ 
  VERSION = 2
  PATCHLEVEL = 4
  SUBLEVEL = 19
! ifneq ($(LINUX_M32R),)
! EXTRAVERSION = -m32r
! else
! EXTRAVERSION = 
! endif
  
  KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
  
+ ifneq ($(LINUX_M32R),)
+ ARCH := m32r
+ else
  ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
+ endif
  KERNELPATH=kernel-$(shell echo $(KERNELRELEASE) | sed -e "s/-//g")
  
  CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
*************** include arch/$(ARCH)/Makefile
*** 258,264 ****
  # 'kbuild_2_4_nostdinc :=' or -I/usr/include for kernel code and you are not UML
  # then your code is broken!  KAO.
  
! kbuild_2_4_nostdinc	:= -nostdinc $(shell $(CC) -print-search-dirs | sed -ne 's/install: \(.*\)/-I \1include/gp')
  export kbuild_2_4_nostdinc
  
  export	CPPFLAGS CFLAGS CFLAGS_KERNEL AFLAGS AFLAGS_KERNEL
--- 268,274 ----
  # 'kbuild_2_4_nostdinc :=' or -I/usr/include for kernel code and you are not UML
  # then your code is broken!  KAO.
  
! kbuild_2_4_nostdinc	:= -nostdinc $(shell LANG=C $(CC) -print-search-dirs | sed -ne 's/install: \(.*\)/-I \1include/gp')
  export kbuild_2_4_nostdinc
  
  export	CPPFLAGS CFLAGS CFLAGS_KERNEL AFLAGS AFLAGS_KERNEL
Only in linux-2.4.19/arch: m32r
Only in linux-2.4.19.org/arch/mips: defconfig-cobalt
diff -rcp linux-2.4.19.org/drivers/char/Config.in linux-2.4.19/drivers/char/Config.in
*** linux-2.4.19.org/drivers/char/Config.in	Sat Aug  3 09:39:43 2002
--- linux-2.4.19/drivers/char/Config.in	Wed Dec 17 10:10:26 2003
*************** if [ "$CONFIG_VT" = "y" ]; then
*** 9,15 ****
     bool '  Support for console on virtual terminal' CONFIG_VT_CONSOLE
  fi
  tristate 'Standard/generic (8250/16550 and compatible UARTs) serial support' CONFIG_SERIAL
! if [ "$CONFIG_SERIAL" = "y" ]; then
     bool '  Support for console on serial port' CONFIG_SERIAL_CONSOLE
     if [ "$CONFIG_IA64" = "y" ]; then
        bool 'Support for serial console port described by EFI HCDP table' CONFIG_SERIAL_HCDP
--- 9,15 ----
     bool '  Support for console on virtual terminal' CONFIG_VT_CONSOLE
  fi
  tristate 'Standard/generic (8250/16550 and compatible UARTs) serial support' CONFIG_SERIAL
! if [ "$CONFIG_SERIAL" = "y" -o "$CONFIG_M32R_SERIAL" = "y" ]; then
     bool '  Support for console on serial port' CONFIG_SERIAL_CONSOLE
     if [ "$CONFIG_IA64" = "y" ]; then
        bool 'Support for serial console port described by EFI HCDP table' CONFIG_SERIAL_HCDP
diff -rcp linux-2.4.19.org/drivers/char/keyboard.c linux-2.4.19/drivers/char/keyboard.c
*** linux-2.4.19.org/drivers/char/keyboard.c	Sat Aug  3 09:39:43 2002
--- linux-2.4.19/drivers/char/keyboard.c	Mon Jun 23 14:36:15 2003
*************** EXPORT_SYMBOL(kbd_ledfunc);
*** 67,74 ****
--- 67,81 ----
  
  extern void ctrl_alt_del(void);
  
+ DECLARE_WAIT_QUEUE_HEAD(keypress_wait);
  struct console;
  
+ int keyboard_wait_for_keypress(struct console *co)
+ {
+ 	sleep_on(&keypress_wait);
+ 	return 0;
+ }
+ 
  /*
   * global state includes the following, and various static variables
   * in this module: prev_scancode, shift_state, diacr, npadch, dead_key_next.
*************** void handle_scancode(unsigned char scanc
*** 312,318 ****
  			compute_shiftstate();
  			kbd->slockstate = 0; /* play it safe */
  #else
! 			keysym = U(key_maps[0][keycode]);
  			type = KTYP(keysym);
  			if (type == KT_SHIFT)
  			  (*key_handler[type])(keysym & 0xff, up_flag);
--- 319,325 ----
  			compute_shiftstate();
  			kbd->slockstate = 0; /* play it safe */
  #else
! 			keysym =  U(plain_map[keycode]);
  			type = KTYP(keysym);
  			if (type == KT_SHIFT)
  			  (*key_handler[type])(keysym & 0xff, up_flag);
*************** out:
*** 324,355 ****
  	schedule_console_callback();
  }
  
- #ifdef CONFIG_FORWARD_KEYBOARD
- extern int forward_chars;
  
  void put_queue(int ch)
  {
! 	if (forward_chars == fg_console+1){
! 		kbd_forward_char (ch);
! 	} else {
! 		if (tty) {
! 			tty_insert_flip_char(tty, ch, 0);
! 			con_schedule_flip(tty);
! 		}
! 	}
! }
! #else
! void put_queue(int ch)
! {
  	if (tty) {
  		tty_insert_flip_char(tty, ch, 0);
  		con_schedule_flip(tty);
  	}
  }
- #endif
  
  static void puts_queue(char *cp)
  {
  	if (!tty)
  		return;
  
--- 331,349 ----
  	schedule_console_callback();
  }
  
  
  void put_queue(int ch)
  {
! 	wake_up(&keypress_wait);
  	if (tty) {
  		tty_insert_flip_char(tty, ch, 0);
  		con_schedule_flip(tty);
  	}
  }
  
  static void puts_queue(char *cp)
  {
+ 	wake_up(&keypress_wait);
  	if (!tty)
  		return;
  
*************** void compute_shiftstate(void)
*** 756,762 ****
  	    k = i*BITS_PER_LONG;
  	    for(j=0; j<BITS_PER_LONG; j++,k++)
  	      if(test_bit(k, key_down)) {
! 		sym = U(key_maps[0][k]);
  		if(KTYP(sym) == KT_SHIFT || KTYP(sym) == KT_SLOCK) {
  		  val = KVAL(sym);
  		  if (val == KVAL(K_CAPSSHIFT))
--- 750,756 ----
  	    k = i*BITS_PER_LONG;
  	    for(j=0; j<BITS_PER_LONG; j++,k++)
  	      if(test_bit(k, key_down)) {
! 		sym = U(plain_map[k]);
  		if(KTYP(sym) == KT_SHIFT || KTYP(sym) == KT_SLOCK) {
  		  val = KVAL(sym);
  		  if (val == KVAL(K_CAPSSHIFT))
*************** int __init kbd_init(void)
*** 927,932 ****
--- 921,930 ----
  	struct kbd_struct kbd0;
  	extern struct tty_driver console_driver;
  
+ #if 1 /* 020501 by kondo */
+ 	return 0;
+ #endif /* 020501 by kondo */
+ 
  	kbd0.ledflagstate = kbd0.default_ledflagstate = KBD_DEFLEDS;
  	kbd0.ledmode = LED_SHOW_FLAGS;
  	kbd0.lockstate = KBD_DEFLOCK;
Only in linux-2.4.19/drivers/char: keyboard.c.org
diff -rcp linux-2.4.19.org/drivers/char/serial.c linux-2.4.19/drivers/char/serial.c
*** linux-2.4.19.org/drivers/char/serial.c	Sat Aug  3 09:39:43 2002
--- linux-2.4.19/drivers/char/serial.c	Wed Dec 17 10:10:26 2003
*************** static struct serial_uart_config uart_co
*** 297,303 ****
--- 297,307 ----
  	{ "unknown", 1, 0 }, 
  	{ "8250", 1, 0 }, 
  	{ "16450", 1, 0 }, 
+ #ifndef CONFIG_PLAT_USRV
  	{ "16550", 1, 0 }, 
+ #else	/* CONFIG_PLAT_USRV */
+ 	{ "16552D", 16, UART_CLEAR_FIFO | UART_USE_FIFO }, 
+ #endif	/* CONFIG_PLAT_USRV */
  	{ "16550A", 16, UART_CLEAR_FIFO | UART_USE_FIFO }, 
  	{ "cirrus", 1, 0 }, 	/* usurped by cyclades.c */
  	{ "ST16650", 1, UART_CLEAR_FIFO | UART_STARTECH }, 
*************** static void autoconfig(struct serial_sta
*** 3732,3737 ****
--- 3736,3742 ----
  			state->type = PORT_16550A;
  			break;
  	}
+ #ifndef CONFIG_PLAT_USRV
  	if (state->type == PORT_16550A) {
  		/* Check for Startech UART's */
  		serial_outp(info, UART_LCR, UART_LCR_DLAB);
*************** static void autoconfig(struct serial_sta
*** 3743,3748 ****
--- 3748,3756 ----
  				autoconfig_startech_uarts(info, state, flags);
  		}
  	}
+ #else	/* CONFIG_PLAT_USRV */
+ 	state->type = PORT_16550;
+ #endif	/* CONFIG_PLAT_USRV */
  	if (state->type == PORT_16550A) {
  		/* Check for TI 16750 */
  		serial_outp(info, UART_LCR, save_lcr | UART_LCR_DLAB);
diff -rcp linux-2.4.19.org/drivers/char/tty_io.c linux-2.4.19/drivers/char/tty_io.c
*** linux-2.4.19.org/drivers/char/tty_io.c	Sat Aug  3 09:39:43 2002
--- linux-2.4.19/drivers/char/tty_io.c	Wed Dec 17 10:10:26 2003
***************
*** 1,3 ****
--- 1,11 ----
+ /* 
+  * 2001.06.05  [hy]  add dbg_console_init(), dc_init()
+  */
+ 
+ static char *rcsid =
+ "$Id$";
+ static void use_rcsid(void) {rcsid = rcsid; use_rcsid();}
+ 
  /*
   *  linux/drivers/char/tty_io.c
   *
*************** void __init console_init(void)
*** 2202,2207 ****
--- 2210,2222 ----
   	mac_scc_console_init();
  #elif defined(CONFIG_PARISC)
  	pdc_console_init();
+ #elif defined(CONFIG_M32R_USE_DBG_CONSOLE)
+ 	dbg_console_init();
+ #if defined(CONFIG_PLAT_USRV) && !defined(CONFIG_SERIAL_MODULE)
+ 	serial_console_init();
+ #endif
+ #elif defined(CONFIG_M32R_PLD_SERIAL)
+ 	psio_console_init();
  #elif defined(CONFIG_SERIAL)
  	serial_console_init();
  #endif /* CONFIG_8xx */
diff -rcp linux-2.4.19.org/drivers/char/vt.c linux-2.4.19/drivers/char/vt.c
*** linux-2.4.19.org/drivers/char/vt.c	Sat Nov 17 03:08:28 2001
--- linux-2.4.19/drivers/char/vt.c	Wed Jan 23 21:53:39 2002
*************** int vt_ioctl(struct tty_struct *tty, str
*** 481,487 ****
  		ucval = keyboard_type;
  		goto setchar;
  
! #if !defined(__alpha__) && !defined(__ia64__) && !defined(__mips__) && !defined(__arm__) && !defined(__sh__)
  		/*
  		 * These cannot be implemented on any machine that implements
  		 * ioperm() in user level (such as Alpha PCs).
--- 481,487 ----
  		ucval = keyboard_type;
  		goto setchar;
  
! #if !defined(__alpha__) && !defined(__ia64__) && !defined(__mips__) && !defined(__arm__) && !defined(__sh__) && !defined(__m32r__)
  		/*
  		 * These cannot be implemented on any machine that implements
  		 * ioperm() in user level (such as Alpha PCs).
diff -rcp linux-2.4.19.org/drivers/input/keybdev.c linux-2.4.19/drivers/input/keybdev.c
*** linux-2.4.19.org/drivers/input/keybdev.c	Fri Oct 12 01:14:32 2001
--- linux-2.4.19/drivers/input/keybdev.c	Wed May 28 14:45:06 2003
***************
*** 40,46 ****
  #if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(__alpha__) || \
      defined(__mips__) || defined(CONFIG_SPARC64) || defined(CONFIG_SUPERH) || \
      defined(CONFIG_PPC) || defined(__mc68000__) || defined(__hppa__) || \
!     defined(__arm__)
  
  static int x86_sysrq_alt = 0;
  #ifdef CONFIG_SPARC64
--- 40,46 ----
  #if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(__alpha__) || \
      defined(__mips__) || defined(CONFIG_SPARC64) || defined(CONFIG_SUPERH) || \
      defined(CONFIG_PPC) || defined(__mc68000__) || defined(__hppa__) || \
!     defined(__arm__) || defined(__m32r__)
  
  static int x86_sysrq_alt = 0;
  #ifdef CONFIG_SPARC64
diff -rcp linux-2.4.19.org/drivers/mtd/bootldr.c linux-2.4.19/drivers/mtd/bootldr.c
*** linux-2.4.19.org/drivers/mtd/bootldr.c	Fri Oct  5 07:14:44 2001
--- linux-2.4.19/drivers/mtd/bootldr.c	Fri Jan  9 18:22:15 2004
*************** int parse_bootldr_partitions(struct mtd_
*** 115,122 ****
  	    return -ENOMEM;
  
  	
! 	printk(__FUNCTION__ ": magic=%#x\n", partition_table->magic);
! 	printk(__FUNCTION__ ": numPartitions=%#x\n", partition_table->npartitions);
  
  
  	/* check for partition table magic number */
--- 115,122 ----
  	    return -ENOMEM;
  
  	
! 	printk("%s: magic=%#x\n", __FUNCTION__, partition_table->magic);
! 	printk("%s: numPartitions=%#x\n", __FUNCTION__, partition_table->npartitions);
  
  
  	/* check for partition table magic number */
*************** int parse_bootldr_partitions(struct mtd_
*** 125,131 ****
  	npartitions = (partition_table->npartitions > MAX_NUM_PARTITIONS)?
  	    MAX_NUM_PARTITIONS:partition_table->npartitions;	
  
! 	printk(__FUNCTION__ ": npartitions=%#x\n", npartitions);
  
  	for (i = 0; i < npartitions; i++) {
  		namelen += strlen(partition_table->partition[i].name) + 1;
--- 125,131 ----
  	npartitions = (partition_table->npartitions > MAX_NUM_PARTITIONS)?
  	    MAX_NUM_PARTITIONS:partition_table->npartitions;	
  
! 	printk("%s: npartitions=%#x\n", __FUNCTION__, npartitions);
  
  	for (i = 0; i < npartitions; i++) {
  		namelen += strlen(partition_table->partition[i].name) + 1;
diff -rcp linux-2.4.19.org/drivers/mtd/mtdblock.c linux-2.4.19/drivers/mtd/mtdblock.c
*** linux-2.4.19.org/drivers/mtd/mtdblock.c	Sat Aug  3 09:39:44 2002
--- linux-2.4.19/drivers/mtd/mtdblock.c	Fri Jan  9 18:22:15 2004
*************** static void handle_mtdblock_request(void
*** 432,438 ****
  		res = 0;
  
  		if (MINOR(req->rq_dev) >= MAX_MTD_DEVICES)
! 			panic(__FUNCTION__": minor out of bound");
  
  		if ((req->sector + req->current_nr_sectors) > (mtdblk->mtd->size >> 9))
  			goto end_req;
--- 432,438 ----
  		res = 0;
  
  		if (MINOR(req->rq_dev) >= MAX_MTD_DEVICES)
! 			panic("%s: minor out of bound", __FUNCTION__);
  
  		if ((req->sector + req->current_nr_sectors) > (mtdblk->mtd->size >> 9))
  			goto end_req;
diff -rcp linux-2.4.19.org/drivers/net/8390.c linux-2.4.19/drivers/net/8390.c
*** linux-2.4.19.org/drivers/net/8390.c	Sat Aug  3 09:39:44 2002
--- linux-2.4.19/drivers/net/8390.c	Thu Aug 28 12:42:00 2003
*************** int ei_close(struct net_device *dev)
*** 221,226 ****
--- 221,236 ----
  
  void ei_tx_timeout(struct net_device *dev)
  {
+ #if defined(CONFIG_CHIP_M32700) && defined(CONFIG_SMP)
+ 	unsigned long flags, icucr;
+ 
+ 	printk(KERN_DEBUG "eth0 : timeout\n");
+ 	local_irq_save(flags);
+ 	icucr = inl(0x00eff200);
+ 	icucr |= 0x00000030;
+ 	outl(icucr, 0x00eff200);
+ 	local_irq_restore(flags);
+ #else	/* not CONFIG_CHIP_M32700 || not CONFIG_SMP */
  	long e8390_base = dev->base_addr;
  	struct ei_device *ei_local = (struct ei_device *) dev->priv;
  	int txsr, isr, tickssofar = jiffies - dev->trans_start;
*************** void ei_tx_timeout(struct net_device *de
*** 255,260 ****
--- 265,271 ----
  	spin_unlock(&ei_local->page_lock);
  	enable_irq(dev->irq);
  	netif_wake_queue(dev);
+ #endif	/* not CONFIG_CHIP_M32700 || not CONFIG_SMP */
  }
      
  /**
diff -rcp linux-2.4.19.org/drivers/net/Makefile linux-2.4.19/drivers/net/Makefile
*** linux-2.4.19.org/drivers/net/Makefile	Sat Aug  3 09:39:44 2002
--- linux-2.4.19/drivers/net/Makefile	Tue Oct 22 14:09:07 2002
*************** obj-$(CONFIG_ARM_ETHERH) += 8390.o
*** 121,126 ****
--- 121,127 ----
  obj-$(CONFIG_WD80x3) += wd.o 8390.o
  obj-$(CONFIG_EL2) += 3c503.o 8390.o
  obj-$(CONFIG_NE2000) += ne.o 8390.o
+ obj-$(CONFIG_MAPPI_NE2000) += 8390.o
  obj-$(CONFIG_NE2_MCA) += ne2.o 8390.o
  obj-$(CONFIG_HPLAN) += hp.o 8390.o
  obj-$(CONFIG_HPLAN_PLUS) += hp-plus.o 8390.o
diff -rcp linux-2.4.19.org/drivers/net/Space.c linux-2.4.19/drivers/net/Space.c
*** linux-2.4.19.org/drivers/net/Space.c	Sat Aug  3 09:39:44 2002
--- linux-2.4.19/drivers/net/Space.c	Fri Jun 13 22:06:09 2003
*************** extern int macsonic_probe(struct net_dev
*** 102,107 ****
--- 102,113 ----
  extern int mac8390_probe(struct net_device *dev);
  extern int mac89x0_probe(struct net_device *dev);
  extern int mc32_probe(struct net_device *dev);
+ #ifdef CONFIG_M32R_NE2000
+ extern int mappi_ne_probe(struct net_device *dev);
+ #endif /* CONFIG_MAPPI_NE2000 */
+ #ifdef CONFIG_M32R_SMC91111
+ extern int m32r_smc_init( struct net_device * );
+ #endif /* CONFIG_M32R_SMC91111 */
    
  /* Detachable devices ("pocket adaptors") */
  extern int de600_probe(struct net_device *);
*************** static struct devprobe isa_probes[] __in
*** 244,255 ****
--- 250,267 ----
  #ifdef CONFIG_NE2000		/* ISA (use ne2k-pci for PCI cards) */
  	{ne_probe, 0},
  #endif
+ #ifdef CONFIG_M32R_NE2000	/* ne2k for Mappi */
+ 	{mappi_ne_probe, 0},
+ #endif
  #ifdef CONFIG_LANCE		/* ISA/VLB (use pcnet32 for PCI cards) */
  	{lance_probe, 0},
  #endif
  #ifdef CONFIG_SMC9194
  	{smc_init, 0},
  #endif
+ #ifdef CONFIG_M32R_SMC91111	/* SMC91111 for M32R */
+ 	{m32r_smc_init, 0},
+ #endif
  #ifdef CONFIG_SEEQ8005 
  	{seeq8005_probe, 0},
  #endif
diff -rcp linux-2.4.19.org/drivers/net/wireless/hermes.h linux-2.4.19/drivers/net/wireless/hermes.h
*** linux-2.4.19.org/drivers/net/wireless/hermes.h	Sat Aug  3 09:39:44 2002
--- linux-2.4.19/drivers/net/wireless/hermes.h	Fri Jun 13 22:06:11 2003
*************** typedef struct hermes_response {
*** 287,298 ****
--- 287,307 ----
  } hermes_response_t;
  
  /* Register access convenience macros */
+ #if defined(__m32r__)
+ #define hermes_read_reg(hw, off) ((hw)->io_space ? \
+ 	le16_to_cpu(inw((hw)->iobase + ( (off) << (hw)->reg_spacing ))) : \
+ 	readw((hw)->iobase + ( (off) << (hw)->reg_spacing )))
+ #define hermes_write_reg(hw, off, val) ((hw)->io_space ? \
+ 	outw_p(cpu_to_le16((val)), (hw)->iobase + ( (off) << (hw)->reg_spacing )) : \
+ 	writew((val), (hw)->iobase + ( (off) << (hw)->reg_spacing )))
+ #else
  #define hermes_read_reg(hw, off) ((hw)->io_space ? \
  	inw((hw)->iobase + ( (off) << (hw)->reg_spacing )) : \
  	readw((hw)->iobase + ( (off) << (hw)->reg_spacing )))
  #define hermes_write_reg(hw, off, val) ((hw)->io_space ? \
  	outw_p((val), (hw)->iobase + ( (off) << (hw)->reg_spacing )) : \
  	writew((val), (hw)->iobase + ( (off) << (hw)->reg_spacing )))
+ #endif
  
  #define hermes_read_regn(hw, name) (hermes_read_reg((hw), HERMES_##name))
  #define hermes_write_regn(hw, name, val) (hermes_write_reg((hw), HERMES_##name, (val)))
diff -rcp linux-2.4.19.org/drivers/pcmcia/Config.in linux-2.4.19/drivers/pcmcia/Config.in
*** linux-2.4.19.org/drivers/pcmcia/Config.in	Sat Aug  3 09:39:44 2002
--- linux-2.4.19/drivers/pcmcia/Config.in	Wed Dec 25 18:15:56 2002
*************** if [ "$CONFIG_PCMCIA" != "n" ]; then
*** 29,33 ****
--- 29,39 ----
     if [ "$CONFIG_8xx" = "y" ]; then
        dep_tristate '  M8xx support' CONFIG_PCMCIA_M8XX $CONFIG_PCMCIA
     fi
+    if [ "$CONFIG_PLAT_MAPPI" = "y" ]; then
+       dep_bool '  M32R pc card controller support' CONFIG_M32RPCC $CONFIG_PCMCIA
+       if [ "$CONFIG_M32RPCC" = "y" ]; then
+ 	bool '   Enable M32R PCC slot2' CONFIG_M32RPCC_SLOT2
+       fi
+    fi
  fi
  endmenu
diff -rcp linux-2.4.19.org/drivers/pcmcia/Makefile linux-2.4.19/drivers/pcmcia/Makefile
*** linux-2.4.19.org/drivers/pcmcia/Makefile	Sat Aug  3 09:39:44 2002
--- linux-2.4.19/drivers/pcmcia/Makefile	Tue Oct 22 14:09:09 2002
*************** ifeq ($(CONFIG_PCMCIA),y)
*** 38,43 ****
--- 38,46 ----
    ifeq ($(CONFIG_HD64465_PCMCIA),y)
      obj-y += hd64465_ss.o
    endif
+   ifeq ($(CONFIG_M32RPCC),y)
+     obj-y += m32r_pcc.o
+   endif
  else
    ifeq ($(CONFIG_PCMCIA),m)
      obj-m   := pcmcia_core.o ds.o
diff -rcp linux-2.4.19.org/drivers/pcmcia/cistpl.c linux-2.4.19/drivers/pcmcia/cistpl.c
*** linux-2.4.19.org/drivers/pcmcia/cistpl.c	Sat Dec 22 02:41:55 2001
--- linux-2.4.19/drivers/pcmcia/cistpl.c	Thu Sep 12 15:51:14 2002
*************** static int parse_cftable_entry(tuple_t *
*** 1022,1027 ****
--- 1022,1032 ----
  			       cistpl_cftable_entry_t *entry)
  {
      u_char *p, *q, features;
+ #define MUST_ALIGNED
+ #ifdef MUST_ALIGNED
+       u_short t;
+       u_char *tp = (u_char *)&t;
+ #endif	
  
      p = tuple->TupleData;
      q = p + tuple->TupleDataLen;
*************** static int parse_cftable_entry(tuple_t *
*** 1094,1100 ****
--- 1099,1111 ----
  	break;
      case 0x20:
  	entry->mem.nwin = 1;
+ #ifdef MUST_ALIGNED
+ 	tp[0]=*p;
+ 	tp[1]=*(p+1);
+ 	entry->mem.win[0].len = le16_to_cpu(t) << 8;
+ #else
  	entry->mem.win[0].len = le16_to_cpu(*(u_short *)p) << 8;
+ #endif
  	entry->mem.win[0].card_addr = 0;
  	entry->mem.win[0].host_addr = 0;
  	p += 2;
Only in linux-2.4.19/drivers/pcmcia: m32r_pcc.c
Only in linux-2.4.19/drivers/pcmcia: m32r_pcc.h
diff -rcp linux-2.4.19.org/drivers/usb/Config.in linux-2.4.19/drivers/usb/Config.in
*** linux-2.4.19.org/drivers/usb/Config.in	Sat Aug  3 09:39:44 2002
--- linux-2.4.19/drivers/usb/Config.in	Thu Oct  9 21:42:40 2003
***************
*** 4,10 ****
  mainmenu_option next_comment
  comment 'USB support'
  
! dep_tristate 'Support for USB' CONFIG_USB $CONFIG_PCI
  if [ "$CONFIG_USB" = "y" -o  "$CONFIG_USB" = "m" ]; then
     bool '  USB verbose debug messages' CONFIG_USB_DEBUG
  
--- 4,17 ----
  mainmenu_option next_comment
  comment 'USB support'
  
! if [ "$CONFIG_PLAT_MAPPI2" = "y" -o "$CONFIG_PLAT_M32700UT" = "y" ];
! then
!   define_bool CONFIG_M32R_USB y
! fi
! 
!   dep_tristate 'Support for USB' CONFIG_USB $CONFIG_M32R_USB
! 
! 
  if [ "$CONFIG_USB" = "y" -o  "$CONFIG_USB" = "m" ]; then
     bool '  USB verbose debug messages' CONFIG_USB_DEBUG
  
*************** if [ "$CONFIG_USB" = "y" -o  "$CONFIG_US
*** 28,33 ****
--- 35,42 ----
        define_bool CONFIG_USB_UHCI_ALT n
     fi
     dep_tristate '  OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support' CONFIG_USB_OHCI $CONFIG_USB
+    dep_tristate '  ISP1362(Philips) support' CONFIG_USB_PHCI $CONFIG_USB
+    dep_tristate '    M32R HAL support' CONFIG_USB_HAL_MAPPI2 $CONFIG_USB $CONFIG_USB_PHCI
  
     comment 'USB Device Class drivers'
     dep_tristate '  USB Audio support' CONFIG_USB_AUDIO $CONFIG_USB $CONFIG_SOUND
diff -rcp linux-2.4.19.org/drivers/usb/Makefile linux-2.4.19/drivers/usb/Makefile
*** linux-2.4.19.org/drivers/usb/Makefile	Sat Aug  3 09:39:44 2002
--- linux-2.4.19/drivers/usb/Makefile	Wed May 28 14:43:38 2003
*************** O_TARGET	:= usbdrv.o
*** 10,22 ****
  
  # Objects that export symbols.
  
! export-objs		:= hcd.o usb.o ov511.o pwc-uncompress.o
  
  # Multipart objects.
  
  list-multi		:= usbcore.o hid.o pwc.o
  usbcore-objs		:= usb.o usb-debug.o hub.o
! hid-objs		:= hid-core.o
  pwc-objs		:= pwc-if.o pwc-misc.o pwc-ctrl.o pwc-uncompress.o
  
  
--- 10,22 ----
  
  # Objects that export symbols.
  
! export-objs		:= usb.o ov511.o pwc-uncompress.o
  
  # Multipart objects.
  
  list-multi		:= usbcore.o hid.o pwc.o
  usbcore-objs		:= usb.o usb-debug.o hub.o
! hid-objs		:= hid-core.o hid-input.o
  pwc-objs		:= pwc-if.o pwc-misc.o pwc-ctrl.o pwc-uncompress.o
  
  
*************** ifeq ($(CONFIG_USB_HIDDEV),y)
*** 30,39 ****
  	hid-objs	+= hiddev.o
  endif
  
- ifeq ($(CONFIG_USB_HIDINPUT),y)
- 	hid-objs	+= hid-input.o
- endif
- 
  # Object file lists.
  
  obj-y	:=
--- 30,35 ----
*************** obj-	:=
*** 44,63 ****
  # Each configuration option enables a list of files.
  
  obj-$(CONFIG_USB)		+= usbcore.o
- 
- # EHCI should initialize/link before the other HCDs
- ifeq ($(CONFIG_USB_EHCI_HCD),y)
- 	obj-y += hcd/ehci-hcd.o
- endif
- 
  obj-$(CONFIG_USB_UHCI)		+= usb-uhci.o
  obj-$(CONFIG_USB_UHCI_ALT)	+= uhci.o
  obj-$(CONFIG_USB_OHCI)		+= usb-ohci.o
! 
! ifneq ($(CONFIG_USB_EHCI_HCD),n)
! 	usbcore-objs		+= hcd.o
! endif
! subdir-$(CONFIG_USB_EHCI_HCD)	+= hcd
  
  obj-$(CONFIG_USB_MOUSE)		+= usbmouse.o
  obj-$(CONFIG_USB_HID)		+= hid.o
--- 40,50 ----
  # Each configuration option enables a list of files.
  
  obj-$(CONFIG_USB)		+= usbcore.o
  obj-$(CONFIG_USB_UHCI)		+= usb-uhci.o
  obj-$(CONFIG_USB_UHCI_ALT)	+= uhci.o
  obj-$(CONFIG_USB_OHCI)		+= usb-ohci.o
! obj-$(CONFIG_USB_PHCI)		+= usb_phci.o
! obj-$(CONFIG_USB_HAL_MAPPI2)	+= hal_mappi2.o
  
  obj-$(CONFIG_USB_MOUSE)		+= usbmouse.o
  obj-$(CONFIG_USB_HID)		+= hid.o
*************** obj-$(CONFIG_USB_SCANNER)	+= scanner.o
*** 68,74 ****
  obj-$(CONFIG_USB_ACM)		+= acm.o
  obj-$(CONFIG_USB_PRINTER)	+= printer.o
  obj-$(CONFIG_USB_AUDIO)		+= audio.o
- obj-$(CONFIG_USB_EMI26)		+= emi26.o
  obj-$(CONFIG_USB_IBMCAM)	+= ibmcam.o usbvideo.o ultracam.o
  obj-$(CONFIG_USB_PWC)		+= pwc.o
  obj-$(CONFIG_USB_DC2XX)		+= dc2xx.o
--- 55,60 ----
*************** obj-$(CONFIG_USB_OV511)		+= ov511.o
*** 80,86 ****
  obj-$(CONFIG_USB_SE401)		+= se401.o
  obj-$(CONFIG_USB_STV680)	+= stv680.o
  obj-$(CONFIG_USB_PEGASUS)	+= pegasus.o
- obj-$(CONFIG_USB_RTL8150)	+= rtl8150.o
  obj-$(CONFIG_USB_CATC)		+= catc.o
  obj-$(CONFIG_USB_KAWETH)        += kaweth.o
  obj-$(CONFIG_USB_CDCETHER)	+= CDCEther.o
--- 66,71 ----
*************** obj-$(CONFIG_USB_MICROTEK)	+= microtek.o
*** 90,100 ****
  obj-$(CONFIG_USB_HPUSBSCSI)	+= hpusbscsi.o
  obj-$(CONFIG_USB_BLUETOOTH)	+= bluetooth.o
  obj-$(CONFIG_USB_USBNET)	+= usbnet.o
- obj-$(CONFIG_USB_AUERSWALD)	+= auerswald.o
- obj-$(CONFIG_USB_BRLVGER)	+= brlvger.o
  
  # Object files in subdirectories
! mod-subdirs	:= serial hcd
  
  subdir-$(CONFIG_USB_SERIAL)	+= serial
  subdir-$(CONFIG_USB_STORAGE)	+= storage
--- 75,83 ----
  obj-$(CONFIG_USB_HPUSBSCSI)	+= hpusbscsi.o
  obj-$(CONFIG_USB_BLUETOOTH)	+= bluetooth.o
  obj-$(CONFIG_USB_USBNET)	+= usbnet.o
  
  # Object files in subdirectories
! mod-subdirs	:= serial
  
  subdir-$(CONFIG_USB_SERIAL)	+= serial
  subdir-$(CONFIG_USB_STORAGE)	+= storage
Only in linux-2.4.19/drivers/usb: hal_intf.h
Only in linux-2.4.19/drivers/usb: usb_phci.c
Only in linux-2.4.19/drivers/usb: usb_phci.h
diff -rcp linux-2.4.19.org/drivers/video/Config.in linux-2.4.19/drivers/video/Config.in
*** linux-2.4.19.org/drivers/video/Config.in	Sat Aug  3 09:39:45 2002
--- linux-2.4.19/drivers/video/Config.in	Mon Jun 23 14:36:15 2003
*************** if [ "$CONFIG_FB" = "y" ]; then
*** 119,124 ****
--- 119,200 ----
        fi
     fi
     if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
+ 
+ 
+ bool 'Epson LCD/CRT/TV controller support' CONFIG_FB_EPSON
+ if [ "$CONFIG_FB_EPSON" != "n" ]; then
+ 	define_bool CONFIG_FBCON_EPSON y
+ 	bool '  Epson S1D13504 Support' CONFIG_FB_EPSON_S1D13504
+ 	if [ "$CONFIG_FB_EPSON_S1D13504" = "y" ]; then
+ 		define_bool CONFIG_FBCON_EPSON_S1D13504 y
+ 		define_bool CONFIG_FBCON_EPSON_PCI n
+ 	fi
+ 	bool '  Epson S1D13505 Support' CONFIG_FB_EPSON_S1D13505
+ 	if [ "$CONFIG_FB_EPSON_S1D13505" = "y" ]; then
+          define_bool CONFIG_FBCON_EPSON_S1D13505 y
+          define_bool CONFIG_FBCON_EPSON_PCI n
+ 	fi
+ 	bool '  Epson S1D13506 Support' CONFIG_FB_EPSON_S1D13506
+ 	if [ "$CONFIG_FB_EPSON_S1D13506" = "y" ]; then
+ 		define_bool CONFIG_FBCON_EPSON_S1D13506 y
+ 		if [ "$CONFIG_PCI" != "n" ]; then
+ 			bool '      Epson PCI Bridge adapter support' CONFIG_FB_EPSON_PCI
+ 			if [ "$CONFIG_FB_EPSON_PCI" = "y" ]; then
+ 				define_bool CONFIG_FBCON_EPSON_PCI y
+ 			fi
+ 		fi
+ 	fi
+ 
+ 	bool '  Epson S1D13704 Support' CONFIG_FB_EPSON_S1D13704
+ 	if [ "$CONFIG_FB_EPSON_S1D13704" = "y" ]; then
+ 		define_bool CONFIG_FBCON_EPSON_S1D13704 y
+ 		define_bool CONFIG_FBCON_EPSON_PCI n
+ 	fi
+ 	bool '  Epson S1D13705 Support' CONFIG_FB_EPSON_S1D13705
+ 	if [ "$CONFIG_FB_EPSON_S1D13705" = "y" ]; then
+ 		define_bool CONFIG_FBCON_EPSON_S1D13705 y
+ 		define_bool CONFIG_FBCON_EPSON_PCI n
+ 	fi
+ 	bool '  Epson S1D13706 Support' CONFIG_FB_EPSON_S1D13706
+ 	if [ "$CONFIG_FB_EPSON_S1D13706" = "y" ]; then
+ 		define_bool CONFIG_FBCON_EPSON_S1D13706 y
+ 		if [ "$CONFIG_PCI" != "n" ]; then
+ 			bool '      Epson PCI Bridge adapter support' CONFIG_FB_EPSON_PCI
+ 			if [ "$CONFIG_FB_EPSON_PCI" = "y" ]; then
+ 				define_bool CONFIG_FBCON_EPSON_PCI y
+ 			fi
+ 		fi
+ 	fi
+ 	bool '  Epson S1D13806 Support' CONFIG_FB_EPSON_S1D13806
+ 	if [ "$CONFIG_FB_EPSON_S1D13806" = "y" ]; then
+ 		define_bool CONFIG_FBCON_EPSON_S1D13806 y
+ 		if [ "$CONFIG_PCI" != "n" ]; then
+ 			bool '      Epson PCI Bridge adapter support' CONFIG_FB_EPSON_PCI
+ 			if [ "$CONFIG_FB_EPSON_PCI" = "y" ]; then
+ 				define_bool CONFIG_FBCON_EPSON_PCI y
+ 			fi
+ 		fi
+ 	fi
+ 
+ 	bool '  Epson S1D13A03 Support' CONFIG_FB_EPSON_S1D13A03
+ 	if [ "$CONFIG_FB_EPSON_S1D13A03" = "y" ]; then
+ 		define_bool CONFIG_FBCON_EPSON_S1D13A03 y
+ 		if [ "$CONFIG_PCI" != "n" ]; then
+ 			bool '      Epson PCI Bridge adapter support' CONFIG_FB_EPSON_PCI
+ 			if [ "$CONFIG_FB_EPSON_PCI" = "y" ]; then
+ 				define_bool CONFIG_FBCON_EPSON_PCI y
+ 			fi
+ 		fi
+ 	fi
+ fi
+ 
+     # -------------------------------------------------
+     # End of Epson LCD/CRT/TV controllers configuration
+     # -------------------------------------------------
+ 
+ 
+ 
+ 
        if [ "$CONFIG_PCI" != "n" ]; then
  	 tristate '  Matrox acceleration (EXPERIMENTAL)' CONFIG_FB_MATROX
  	 if [ "$CONFIG_FB_MATROX" != "n" ]; then
Only in linux-2.4.19/drivers/video: Config.in.org
diff -rcp linux-2.4.19.org/drivers/video/Makefile linux-2.4.19/drivers/video/Makefile
*** linux-2.4.19.org/drivers/video/Makefile	Sat Aug  3 09:39:45 2002
--- linux-2.4.19/drivers/video/Makefile	Mon Jun 23 14:36:15 2003
*************** ifeq ($(CONFIG_FB_ATY),y)
*** 109,114 ****
--- 109,119 ----
  obj-y				  += aty/atyfb.o
  endif
  
+ #if 1 /* 020117 */
+ obj-$(CONFIG_FB_EPSON)            += s1d13xxxfb.o fbgen.o fbcon-cfb8.o
+ #endif /* 020117 */
+ 
+ 
  obj-$(CONFIG_FB_SUN3)             += sun3fb.o
  obj-$(CONFIG_FB_BWTWO)            += bwtwofb.o
  obj-$(CONFIG_FB_HGA)              += hgafb.o  
Only in linux-2.4.19/drivers/video: Makefile.org
diff -rcp linux-2.4.19.org/drivers/video/fbmem.c linux-2.4.19/drivers/video/fbmem.c
*** linux-2.4.19.org/drivers/video/fbmem.c	Sat Aug  3 09:39:45 2002
--- linux-2.4.19/drivers/video/fbmem.c	Tue Jun 24 16:01:39 2003
*************** extern int pvr2fb_init(void);
*** 136,141 ****
--- 136,143 ----
  extern int pvr2fb_setup(char*);
  extern int sstfb_init(void);
  extern int sstfb_setup(char*);
+ extern int s1d13xxxfb_init(void);
+ extern int s1d13xxxfb_setup(char*);
  
  static struct {
  	const char *name;
*************** static struct {
*** 154,160 ****
  	/*
  	 * Chipset specific drivers that use resource management
  	 */
! 
  #ifdef CONFIG_FB_RETINAZ3
  	{ "retz3", retz3fb_init, retz3fb_setup },
  #endif
--- 156,164 ----
  	/*
  	 * Chipset specific drivers that use resource management
  	 */
! #ifdef CONFIG_FBCON_EPSON
!        { "s1d13xxx", s1d13xxxfb_init, s1d13xxxfb_setup },
! #endif
  #ifdef CONFIG_FB_RETINAZ3
  	{ "retz3", retz3fb_init, retz3fb_setup },
  #endif
*************** fb_mmap(struct file *file, struct vm_are
*** 631,636 ****
--- 635,642 ----
  		pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S;
  	}
  #endif
+ #elif defined(__m32r__)
+ 	pgprot_val(vma->vm_page_prot) |= _PAGE_NONCACHABLE;
  #elif defined(__powerpc__)
  	pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE|_PAGE_GUARDED;
  #elif defined(__alpha__)
Only in linux-2.4.19/drivers/video: fbmem.c.org
Only in linux-2.4.19/drivers/video: s1d13806.h
Only in linux-2.4.19/drivers/video: s1d13xxxfb.c
Only in linux-2.4.19/include: asm-m32r
diff -rcp linux-2.4.19.org/include/linux/brlock.h linux-2.4.19/include/linux/brlock.h
*** linux-2.4.19.org/include/linux/brlock.h	Fri Nov 23 04:46:19 2001
--- linux-2.4.19/include/linux/brlock.h	Wed Jun 18 14:32:37 2003
*************** struct br_wrlock {
*** 73,79 ****
--- 73,84 ----
  extern struct br_wrlock __br_write_locks[__BR_IDX_MAX];
  #endif
  
+ /* FIXME : Workaround for fix compile error */
+ #if defined(CONFIG_M32R) && defined(CONFIG_SMP)
+ #define __br_lock_usage_bug()	do { } while (0)
+ #else
  extern void __br_lock_usage_bug (void);
+ #endif
  
  #ifdef __BRLOCK_USE_ATOMICS
  
diff -rcp linux-2.4.19.org/include/linux/elf.h linux-2.4.19/include/linux/elf.h
*** linux-2.4.19.org/include/linux/elf.h	Fri Nov 23 04:48:29 2001
--- linux-2.4.19/include/linux/elf.h	Tue Dec 18 18:17:59 2001
*************** typedef __s64	Elf64_Sxword;
*** 80,91 ****
--- 80,93 ----
  #define EM_S390		22	/* IBM S/390 */
  
  #define EM_CRIS         76      /* Axis Communications 32-bit embedded processor */
+ #define EM_M32R		88	/* M32R */
  
  /*
   * This is an interim value that we will use until the committee comes
   * up with a final number.
   */
  #define EM_ALPHA	0x9026
+ #define EM_CYGNUS_M32R	0x9041
  
  /*
   * This is the old interim value for S/390 architecture
Only in linux-2.4.19/include/linux: gdb.h
diff -rcp linux-2.4.19.org/include/linux/linkage.h linux-2.4.19/include/linux/linkage.h
*** linux-2.4.19.org/include/linux/linkage.h	Tue Dec 12 05:49:54 2000
--- linux-2.4.19/include/linux/linkage.h	Tue Nov 13 21:23:49 2001
***************
*** 25,30 ****
--- 25,34 ----
  #define SYMBOL_NAME_LABEL(X) X/**/:
  #endif
  
+ #ifdef __M32R__
+ #define __ALIGN	.balign 4
+ #define __ALIGN_STR ".balign 4"
+ #else  /* __M32R__ */
  #ifdef __arm__
  #define __ALIGN .align 0
  #define __ALIGN_STR ".align 0"
***************
*** 47,62 ****
  #endif /* __sh__ */
  #endif /* __mc68000__ */
  #endif /* __arm__ */
  
  #ifdef __ASSEMBLY__
  
  #define ALIGN __ALIGN
  #define ALIGN_STR __ALIGN_STR
! 
  #define ENTRY(name) \
    .globl SYMBOL_NAME(name); \
    ALIGN; \
    SYMBOL_NAME_LABEL(name)
  
  #endif
  
--- 51,75 ----
  #endif /* __sh__ */
  #endif /* __mc68000__ */
  #endif /* __arm__ */
+ #endif /* __M32R__ */
  
  #ifdef __ASSEMBLY__
  
  #define ALIGN __ALIGN
  #define ALIGN_STR __ALIGN_STR
! #ifdef __M32R__ 
! #define ENTRY(name) ENTRY_M name
!   .macro ENTRY_M name
!   .global SYMBOL_NAME(\name)
!   ALIGN
! SYMBOL_NAME_LABEL(\name)
!   .endm
! #else  /* !__M32R__ */
  #define ENTRY(name) \
    .globl SYMBOL_NAME(name); \
    ALIGN; \
    SYMBOL_NAME_LABEL(name)
+ #endif  /* __M32R__ */
  
  #endif
  
diff -rcp linux-2.4.19.org/include/linux/mtd/cfi.h linux-2.4.19/include/linux/mtd/cfi.h
*** linux-2.4.19.org/include/linux/mtd/cfi.h	Fri Oct  5 07:13:18 2001
--- linux-2.4.19/include/linux/mtd/cfi.h	Wed Dec 17 10:10:26 2003
***************
*** 1,7 ****
  
  /* Common Flash Interface structures 
   * See http://support.intel.com/design/flash/technote/index.htm
!  * $Id: cfi.h,v 1.25 2001/09/04 07:06:21 dwmw2 Exp $
   */
  
  #ifndef __MTD_CFI_H__
--- 1,7 ----
  
  /* Common Flash Interface structures 
   * See http://support.intel.com/design/flash/technote/index.htm
!  * $Id$
   */
  
  #ifndef __MTD_CFI_H__
*************** static inline void cfi_udelay(int us)
*** 377,383 ****
--- 377,387 ----
  	}
  	else
  #endif
+ #if 0 /* by kondo */
  		udelay(us);
+ #else
+ 		__const_udelay((us)*4294UL);
+ #endif
  }
  static inline void cfi_spin_lock(spinlock_t *mutex)
  {
diff -rcp linux-2.4.19.org/include/video/fbcon.h linux-2.4.19/include/video/fbcon.h
*** linux-2.4.19.org/include/video/fbcon.h	Fri Sep 14 08:25:07 2001
--- linux-2.4.19/include/video/fbcon.h	Tue Jun 24 16:01:39 2003
*************** extern int set_all_vcs(int fbidx, struct
*** 216,221 ****
--- 216,231 ----
  #define fb_writel __raw_writel
  #define fb_memset memset_io
  
+ #elif defined(__m32r__) && defined(CONFIG_PLAT_MAPPI)
+ 
+ #define fb_readb(addr) (*(volatile u8 *) (addr))
+ #define fb_readw(addr) (le16_to_cpu(*(volatile u16 *) (addr)))
+ #define fb_readl(addr) (*(volatile u32 *) (addr))
+ #define fb_writeb(b,addr) (*(volatile u8 *) (addr) = (b))
+ #define fb_writew(b,addr) (*(volatile u16 *) (addr) = cpu_to_le16(b))
+ #define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b))
+ #define fb_memset memset
+ 
  #else
  
  #define fb_readb(addr) (*(volatile u8 *) (addr))
Only in linux-2.4.19/include/video: fbcon.h.org
diff -rcp linux-2.4.19.org/mm/mmap.c linux-2.4.19/mm/mmap.c
*** linux-2.4.19.org/mm/mmap.c	Sat Aug  3 09:39:46 2002
--- linux-2.4.19/mm/mmap.c	Wed Dec  3 17:59:05 2003
*************** unsigned long do_brk(unsigned long addr,
*** 1036,1041 ****
--- 1036,1044 ----
  	if (!len)
  		return addr;
  
+         if ((addr + len) > TASK_SIZE || (addr + len) < addr)
+                 return -EINVAL;
+ 
  	/*
  	 * mlock MCL_FUTURE?
  	 */
