diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/alpha/defconfig linux-2.5.64-ac4/arch/alpha/defconfig --- linux-2.5.64/arch/alpha/defconfig 2003-02-10 18:38:38.000000000 +0000 +++ linux-2.5.64-ac4/arch/alpha/defconfig 2003-02-14 22:35:17.000000000 +0000 @@ -19,6 +19,8 @@ CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y +# CONFIG_IKCONFIG is not set +# CONFIG_IKCONFIG_PROC is not set # # Loadable module support diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/alpha/oprofile/op_model_ev4.c linux-2.5.64-ac4/arch/alpha/oprofile/op_model_ev4.c --- linux-2.5.64/arch/alpha/oprofile/op_model_ev4.c 2003-03-03 19:20:06.000000000 +0000 +++ linux-2.5.64-ac4/arch/alpha/oprofile/op_model_ev4.c 2003-03-14 01:00:59.000000000 +0000 @@ -34,7 +34,7 @@ for these "disabled" counter overflows are ignored by the interrupt handler. - This is most irritating, becuase the hardware *can* enable and + This is most irritating, because the hardware *can* enable and disable the interrupts for these counters independently, but the wrperfmon interface doesn't allow it. */ diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/alpha/vmlinux.lds.S linux-2.5.64-ac4/arch/alpha/vmlinux.lds.S --- linux-2.5.64/arch/alpha/vmlinux.lds.S 2003-02-10 18:38:39.000000000 +0000 +++ linux-2.5.64-ac4/arch/alpha/vmlinux.lds.S 2003-03-07 14:58:19.000000000 +0000 @@ -63,6 +63,13 @@ .init.ramfs : { *(.init.ramfs) } __initramfs_end = .; + . = ALIGN(8); + .con_initcall.init : { + __con_initcall_start = .; + *(.con_initcall.init) + __con_initcall_end = .; + } + . = ALIGN(64); __per_cpu_start = .; .data.percpu : { *(.data.percpu) } diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/arm/defconfig linux-2.5.64-ac4/arch/arm/defconfig --- linux-2.5.64/arch/arm/defconfig 2003-02-10 18:38:13.000000000 +0000 +++ linux-2.5.64-ac4/arch/arm/defconfig 2003-02-14 22:35:17.000000000 +0000 @@ -80,6 +80,8 @@ CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y +# CONFIG_IKCONFIG is not set +# CONFIG_IKCONFIG_PROC is not set CONFIG_NWFPE=y CONFIG_KCORE_ELF=y # CONFIG_KCORE_AOUT is not set diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/arm/vmlinux-armo.lds.in linux-2.5.64-ac4/arch/arm/vmlinux-armo.lds.in --- linux-2.5.64/arch/arm/vmlinux-armo.lds.in 2003-02-10 18:38:54.000000000 +0000 +++ linux-2.5.64-ac4/arch/arm/vmlinux-armo.lds.in 2003-02-14 22:36:57.000000000 +0000 @@ -38,6 +38,9 @@ *(.initcall6.init) *(.initcall7.init) __initcall_end = .; + __con_initcall_start = .; + *(.con_initcall.init) + __con_initcall_end = .; . = ALIGN(32768); __init_end = .; } diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/arm/vmlinux-armv.lds.in linux-2.5.64-ac4/arch/arm/vmlinux-armv.lds.in --- linux-2.5.64/arch/arm/vmlinux-armv.lds.in 2003-02-19 15:18:29.000000000 +0000 +++ linux-2.5.64-ac4/arch/arm/vmlinux-armv.lds.in 2003-02-19 15:21:37.000000000 +0000 @@ -45,6 +45,9 @@ *(.initcall6.init) *(.initcall7.init) __initcall_end = .; + __con_initcall_start = .; + *(.con_initcall.init) + __con_initcall_end = .; . = ALIGN(32); __initramfs_start = .; usr/built-in.o(.init.ramfs) diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/cris/defconfig linux-2.5.64-ac4/arch/cris/defconfig --- linux-2.5.64/arch/cris/defconfig 2003-02-10 18:38:15.000000000 +0000 +++ linux-2.5.64-ac4/arch/cris/defconfig 2003-02-14 22:37:05.000000000 +0000 @@ -17,6 +17,8 @@ CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_SYSCTL is not set +# CONFIG_IKCONFIG is not set +# CONFIG_IKCONFIG_PROC is not set CONFIG_BINFMT_ELF=y # CONFIG_ETRAX_KGDB is not set # CONFIG_ETRAX_WATCHDOG is not set diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/cris/vmlinux.lds.S linux-2.5.64-ac4/arch/cris/vmlinux.lds.S --- linux-2.5.64/arch/cris/vmlinux.lds.S 2003-02-10 18:38:28.000000000 +0000 +++ linux-2.5.64-ac4/arch/cris/vmlinux.lds.S 2003-02-14 22:37:05.000000000 +0000 @@ -69,7 +69,12 @@ *(.initcall6.init); *(.initcall7.init); __initcall_end = .; - + } + .con_initcall.init : { + __con_initcall_start = .; + *(.con_initcall.init) + __con_initcall_end = .; + /* We fill to the next page, so we can discard all init pages without needing to consider what payload might be appended to the kernel image. */ diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/defconfig linux-2.5.64-ac4/arch/h8300/defconfig --- linux-2.5.64/arch/h8300/defconfig 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/defconfig 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,257 @@ +# +# Automatically generated by make menuconfig: don't edit +# +CONFIG_UCLINUX=y +CONFIG_UID16=y +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y + +# +# Loadable module support +# +# CONFIG_MODULES is not set + +# +# Target Selection +# +CONFIG_BOARD_GENERIC=y +# CONFIG_BOARD_AKI3068NET is not set +# CONFIG_BOARD_H8MAX is not set + +# +# Platform dependant setup +# +# CONFIG_H83002 is not set +CONFIG_H83007=y +# CONFIG_H83048 is not set +# CONFIG_H83068 is not set +CONFIG_CLK_FREQ=16000 +# CONFIG_RAMKERNEL is not set +CONFIG_ROMKERNEL=y +CONFIG_CPU_H8300H=y + +# +# General setup +# +# CONFIG_NET is not set +# CONFIG_SYSVIPC is not set +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_SYSCTL is not set +CONFIG_KCORE_ELF=y +# CONFIG_KCORE_AOUT is not set +CONFIG_BINFMT_FLAT=y +# CONFIG_BINFMT_ZFLAT is not set +# CONFIG_BINFMT_SHARED_FLAT is not set +# CONFIG_BINFMT_AOUT is not set +# CONFIG_BINFMT_ELF is not set +# CONFIG_BINFMT_MISC is not set +CONFIG_DEFAULT_CMDLINE=y +CONFIG_KERNEL_COMMAND="console=ttySC0,38400n81" + +# +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# +# Parallel port support +# +# CONFIG_PARPORT is not set + +# +# Plug and Play configuration +# +# CONFIG_PNP is not set +# CONFIG_ISAPNP is not set + +# +# Block devices +# +# CONFIG_BLK_DEV_FD is not set +# CONFIG_BLK_DEV_XD is not set +# CONFIG_PARIDE is not set +# CONFIG_BLK_CPQ_DA is not set +# CONFIG_BLK_CPQ_CISS_DA is not set +# CONFIG_CISS_SCSI_TAPE is not set +# CONFIG_BLK_DEV_DAC960 is not set +# CONFIG_BLK_DEV_UMEM is not set +# CONFIG_BLK_DEV_LOOP is not set +# CONFIG_BLK_DEV_NBD is not set +# CONFIG_BLK_DEV_RAM is not set +# CONFIG_BLK_DEV_INITRD is not set +# CONFIG_BLK_DEV_RAMDISK_DATA is not set +CONFIG_BLK_DEV_BLKMEM=y +CONFIG_NOFLASH=y +# CONFIG_AMDFLASH is not set +# CONFIG_INTELFLASH is not set + +# +# Telephony Support +# +# CONFIG_PHONE is not set +# CONFIG_PHONE_IXJ is not set +# CONFIG_PHONE_IXJ_PCMCIA is not set + +# +# ATA/IDE/MFM/RLL support +# +# CONFIG_IDE is not set +# CONFIG_BLK_DEV_IDE_MODES is not set +# CONFIG_BLK_DEV_HD is not set + +# +# Character devices +# +CONFIG_SH_SCI=y +CONFIG_SERIAL_CONSOLE=y +# CONFIG_LEDMAN is not set +# CONFIG_DS1302 is not set +# CONFIG_VT is not set +# CONFIG_SERIAL is not set +# CONFIG_SERIAL_EXTENDED is not set +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_UNIX98_PTYS is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Mice +# +# CONFIG_BUSMOUSE is not set +# CONFIG_MOUSE is not set + +# +# Joysticks +# +# CONFIG_INPUT_GAMEPORT is not set +# CONFIG_INPUT_NS558 is not set +# CONFIG_INPUT_LIGHTNING is not set +# CONFIG_INPUT_PCIGAME is not set +# CONFIG_INPUT_CS461X is not set +# CONFIG_INPUT_EMU10K1 is not set +# CONFIG_INPUT_SERIO is not set +# CONFIG_INPUT_SERPORT is not set +# CONFIG_INPUT_ANALOG is not set +# CONFIG_INPUT_A3D is not set +# CONFIG_INPUT_ADI is not set +# CONFIG_INPUT_COBRA is not set +# CONFIG_INPUT_GF2K is not set +# CONFIG_INPUT_GRIP is not set +# CONFIG_INPUT_INTERACT is not set +# CONFIG_INPUT_TMDC is not set +# CONFIG_INPUT_SIDEWINDER is not set +# CONFIG_INPUT_IFORCE_USB is not set +# CONFIG_INPUT_IFORCE_232 is not set +# CONFIG_INPUT_WARRIOR is not set +# CONFIG_INPUT_MAGELLAN is not set +# CONFIG_INPUT_SPACEORB is not set +# CONFIG_INPUT_SPACEBALL is not set +# CONFIG_INPUT_STINGER is not set +# CONFIG_INPUT_DB9 is not set +# CONFIG_INPUT_GAMECON is not set +# CONFIG_INPUT_TURBOGRAFX is not set +# CONFIG_QIC02_TAPE is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_NVRAM is not set +# CONFIG_RTC is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set +# CONFIG_APPLICOM is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_FTAPE is not set +# CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# File systems +# +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set +# CONFIG_REISERFS_FS is not set +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_ADFS_FS is not set +# CONFIG_ADFS_FS_RW is not set +# CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EXT3_FS is not set +# CONFIG_JBD is not set +# CONFIG_JBD_DEBUG is not set +# CONFIG_FAT_FS is not set +# CONFIG_MSDOS_FS is not set +# CONFIG_UMSDOS_FS is not set +# CONFIG_VFAT_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set +# CONFIG_JFFS2_FS is not set +# CONFIG_CRAMFS is not set +# CONFIG_TMPFS is not set +CONFIG_RAMFS=y +# CONFIG_ISO9660_FS is not set +# CONFIG_JOLIET is not set +# CONFIG_ZISOFS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_VXFS_FS is not set +# CONFIG_NTFS_FS is not set +# CONFIG_NTFS_RW is not set +# CONFIG_HPFS_FS is not set +CONFIG_PROC_FS=y +# CONFIG_DEVFS_FS is not set +# CONFIG_DEVFS_MOUNT is not set +# CONFIG_DEVFS_DEBUG is not set +# CONFIG_DEVPTS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX4FS_RW is not set +CONFIG_ROMFS_FS=y +# CONFIG_EXT2_FS is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UDF_FS is not set +# CONFIG_UDF_RW is not set +# CONFIG_UFS_FS is not set +# CONFIG_UFS_FS_WRITE is not set +# CONFIG_NCPFS_NLS is not set +# CONFIG_SMB_FS is not set +# CONFIG_ZISOFS_FS is not set +# CONFIG_ZLIB_FS_INFLATE is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +# CONFIG_SMB_NLS is not set +# CONFIG_NLS is not set + +# +# USB support +# +# CONFIG_USB is not set + +# +# Kernel hacking +# +CONFIG_FULLDEBUG=y +# CONFIG_MAGIC_SYSRQ is not set +# CONFIG_CONTIGUOUS_PAGE_ALLOC is not set +# CONFIG_MEM_MAP is not set +# CONFIG_PROFILE is not set +CONFIG_NO_KERNEL_MSG=y +# CONFIG_SMALL_TASKS is not set +CONFIG_GDB_EXEC=y +CONFIG_GDB_MAGICPRINT=y diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/Kconfig linux-2.5.64-ac4/arch/h8300/Kconfig --- linux-2.5.64/arch/h8300/Kconfig 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/Kconfig 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,282 @@ +# +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/config-language.txt. +# + +mainmenu "uClinux/h8300 (w/o MMU) Kernel Configuration" + +config MMU + bool + default n + +config SWAP + bool + default n + +config FPU + bool + default n + +config UID16 + bool + default y + +config RWSEM_GENERIC_SPINLOCK + bool + default y + +config RWSEM_XCHGADD_ALGORITHM + bool + default n + + +source "init/Kconfig" + +menu "Processor type and features" + +choice + prompt "H8/300 platform" + default H8300H_GENERIC + +config H8300H_GENERIC + bool "Generic" + help + H8/300H CPU Generic Hardware Support + +config H8300H_AKI3068NET + bool "AE-3068/69" + help + AKI-H8/3068F / AKI-H8/3069F Flashmicom LAN Board Suppot + More Information. (Japanese Only) + + AE-3068/69 Evalution Board Support + More Information. + + +config H8300H_H8MAX + bool "H8MAX" + help + H8MAX Evalution Board Suooprt + More Information. (Japanese Only) + + +config H8300H_SIM + bool "H8/300H Simulator" + help + GDB Simulator Support + More Information. + arch/h8300/Doc/simulator.txt + +endchoice + +choice + prompt "CPU Selection" + +config H83002 + bool "H8/3001,3002,3003" + depends on H8300H_GENERIC + +config H83007 + bool "H8/3006,3007" + depends on (H8300H_GENERIC || H8300H_SIM) + +config H83048 + bool "H8/3044,3045,3046,3047,3048,3052" + depends on H8300H_GENERIC + +config H83068 + bool "H8/3065,3066,3067,3068,3069" + depends on (H8300H_GENERIC || H8300H_AKI3068NET || H8300H_H8MAX) + +endchoice + +config H8300H + bool + depends on (H8300H_GENERIC || H8300H_AKI3068NET || H8300H_H8MAX || H8300H_SIM) + default y + +config CPU_CLOCK + int "CPU Clock Frequency (/1KHz)" + default "20000" if H8300H_AKI3068NET + default "25000" if H8300H_H8MAX + default "16000" if H8300H_SIM + default "16000" if H8300H_GENERIC + help + CPU Clock Frequency divide to 1000 +choice + prompt "Kernel executes from" + ---help--- + Choose the memory type that the kernel will be running in. + +config RAMKERNEL + bool "RAM" + help + The kernel will be resident in RAM when running. + +config ROMKERNEL + bool "ROM" + help + The kernel will be resident in FLASH/ROM when running. + +endchoice + +endmenu + +menu "Executable file formats" + +config KCORE_AOUT + bool + default y + +config KCORE_ELF + default y + +config BINFMT_FLAT + tristate "Kernel support for flat binaries" + help + Support uClinux FLAT format binaries. + +endmenu + +source "drivers/block/Kconfig" + + +menu "ATA/IDE/MFM/RLL support" + +config IDE + tristate "ATA/ATAPI/MFM/RLL device support" + ---help--- + If you say Y here, your kernel will be able to manage low cost mass + storage units such as ATA/(E)IDE and ATAPI units. The most common + cases are IDE hard drives and ATAPI CD-ROM drives. + + It only makes sense to choose this option if your board actually + has an IDE interface. If unsure, say N. + +source "drivers/ide/Kconfig" + +endmenu + +source "net/Kconfig" + + +menu "Network device support" + depends on NET + +config NETDEVICES + bool "Network device support" + ---help--- + You can say N here if you don't intend to connect your Linux box to + any other computer at all or if all your connections will be over a + telephone line with a modem either via UUCP (UUCP is a protocol to + forward mail and news between unix hosts over telephone lines; read + the UUCP-HOWTO, available from + ) or dialing up a shell + account or a BBS, even using term (term is a program which gives you + almost full Internet connectivity if you have a regular dial up + shell account on some Internet connected Unix computer. Read + ). + + You'll have to say Y if your computer contains a network card that + you want to use under Linux (make sure you know its name because you + will be asked for it and read the Ethernet-HOWTO (especially if you + plan to use more than one network card under Linux)) or if you want + to use SLIP (Serial Line Internet Protocol is the protocol used to + send Internet traffic over telephone lines or null modem cables) or + CSLIP (compressed SLIP) or PPP (Point to Point Protocol, a better + and newer replacement for SLIP) or PLIP (Parallel Line Internet + Protocol is mainly used to create a mini network by connecting the + parallel ports of two local machines) or AX.25/KISS (protocol for + sending Internet traffic over amateur radio links). + + Make sure to read the NET-3-HOWTO. Eventually, you will have to read + Olaf Kirch's excellent and free book "Network Administrator's + Guide", to be found in . If + unsure, say Y. + +source "drivers/net/Kconfig" + +source "drivers/atm/Kconfig" + +endmenu + +source "net/ax25/Kconfig" + +source "net/irda/Kconfig" + +source "drivers/isdn/Kconfig" + +source "drivers/telephony/Kconfig" + +# +# input before char - char/joystick depends on it. As does USB. +# +source "drivers/input/Kconfig" + +source "drivers/char/Kconfig" + +#source drivers/misc/Config.in +source "drivers/media/Kconfig" + +source "fs/Kconfig" + +source "drivers/usb/Kconfig" + +source "net/bluetooth/Kconfig" + + +menu "Kernel hacking" + +config FULLDEBUG + bool "Full Symbolic/Source Debugging support" + help + Enable debuging symbols on kernel build. + +config MAGIC_SYSRQ + bool "Magic SysRq key" + help + Enables console device to interprent special characters as + commands to dump state information. + +config HIGHPROFILE + bool "Use fast second timer for profiling" + help + Use a fast secondary clock to produce profiling information. + +config NO_KERNEL_MSG + bool "Suppress Kernel BUG Messages" + help + Do not output any debug BUG messages within the kernel. + +config GDB_MAGICPRINT + bool "Message Output for GDB MagicPrint service" + depends on H8300H_SIM + help + kernel messages output useing MagicPrint service from GDB + +config SYSCALL_PRINT + bool "SystemCall trace print" + help + outout history of systemcall + +config GDB_DEBUG + bool "Use gdb stub" + depends on !H8300H_SIM + help + gdb stub exception support + +config CONFIG_SH_STANDARD_BIOS + bool "Use gdb protocol serial console" + depends on !H8300H_SIM + help + serial console output using GDB protocol. + Require eCos/RedBoot + +endmenu + +source "security/Kconfig" + +source "crypto/Kconfig" + +source "lib/Kconfig" + diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/kernel/asm-offsets.c linux-2.5.64-ac4/arch/h8300/kernel/asm-offsets.c --- linux-2.5.64/arch/h8300/kernel/asm-offsets.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/kernel/asm-offsets.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,48 @@ +/* + * This program is used to generate definitions needed by + * assembly language modules. + * + * We use the technique used in the OSF Mach kernel code: + * generate asm statements containing #defines, + * compile this file to assembler, and then extract the + * #defines from the assembly-language output. + */ + +#include +#include +#include +#include +#include +#include + +#define DEFINE(sym, val) \ + asm volatile("\n->" #sym " %0 " #val : : "i" (val)) + +#define BLANK() asm volatile("\n->" : : ) + +int main(void) +{ + /* offsets into the task struct */ + DEFINE(TASK_STATE, offsetof(struct task_struct, state)); + DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags)); + DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace)); + DEFINE(TASK_BLOCKED, offsetof(struct task_struct, blocked)); + DEFINE(TASK_THREAD, offsetof(struct task_struct, thread)); + DEFINE(TASK_THREAD_INFO, offsetof(struct task_struct, thread_info)); + DEFINE(TASK_MM, offsetof(struct task_struct, mm)); + DEFINE(TASK_ACTIVE_MM, offsetof(struct task_struct, active_mm)); + + /* offsets into the irq_cpustat_t struct */ + DEFINE(CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, __softirq_pending)); + + /* offsets into the thread struct */ + DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp)); + DEFINE(THREAD_USP, offsetof(struct thread_struct, usp)); + DEFINE(THREAD_CCR, offsetof(struct thread_struct, ccr)); + DEFINE(THREAD_VFORK, offsetof(struct thread_struct, vfork_ret)); + + DEFINE(PT_PTRACED, PT_PTRACED); + DEFINE(PT_DTRACE, PT_DTRACE); + + return 0; +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/kernel/gpio.c linux-2.5.64-ac4/arch/h8300/kernel/gpio.c --- linux-2.5.64/arch/h8300/kernel/gpio.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/kernel/gpio.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,166 @@ +/* + * linux/arch/h8300/kernel/gpio.c + * + * Yoshinori Sato + * + */ + +/* + * H8/300H Internal I/O Port Management + */ + +#include +#include +#include +#include +#include +#include + +#if defined(CONFIG_H83007) || defined(CONFIG_H83068) +#define P1DDR (unsigned char *)0xfee000 +#define P2DDR (unsigned char *)0xfee001 +#define P3DDR (unsigned char *)0xfee002 +#define P4DDR (unsigned char *)0xfee003 +#define P5DDR (unsigned char *)0xfee004 +#define P6DDR (unsigned char *)0xfee005 +#define P8DDR (unsigned char *)0xfee007 +#define P9DDR (unsigned char *)0xfee008 +#define PADDR (unsigned char *)0xfee009 +#define PBDDR (unsigned char *)0xfee00A +#endif +#if defined(CONFIG_H83002) || defined(CONFIG_H8048) +#define P1DDR (unsigned char *)0xffffc0 +#define P2DDR (unsigned char *)0xffffc1 +#define P3DDR (unsigned char *)0xffffc4 +#define P4DDR (unsigned char *)0xffffc5 +#define P5DDR (unsigned char *)0xffffc8 +#define P6DDR (unsigned char *)0xffffc9 +#define P8DDR (unsigned char *)0xffffcd +#define P9DDR (unsigned char *)0xffffd0 +#define PADDR (unsigned char *)0xffffd1 +#define PBDDR (unsigned char *)0xffffd4 +#endif + +#if defined(P1DDR) + +#define MAX_PORT 11 + +static struct { + unsigned char used; + unsigned char ddr; +} gpio_regs[MAX_PORT]; + +static volatile unsigned char *ddrs[] = { + P1DDR,P2DDR,P3DDR,P4DDR,P5DDR,P6DDR,NULL,P8DDR,P9DDR,PADDR,PBDDR, +}; + +extern char *_platform_gpio_table(int length); + +int h8300_reserved_gpio(int port, unsigned int bits) +{ + unsigned char *used; + if (port < 0 || port >= MAX_PORT) + return -1; + used = &(gpio_regs[port].used); + if ((*used & bits) != 0) + return 0; + *used |= bits; + return 1; +} + +int h8300_free_gpio(int port, unsigned int bits) +{ + unsigned char *used; + if (port < 0 || port >= MAX_PORT) + return -1; + used = &(gpio_regs[port].used); + if ((*used & bits) != bits) + return 0; + *used &= (~bits); + return 1; +} + +int h8300_set_gpio_dir(int port_bit,int dir) +{ + const unsigned char mask[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}; + int port = (port_bit >> 8) & 0xff; + int bit = port_bit & 0x07; + if (ddrs[port] == NULL) + return 0; + if (gpio_regs[port].used & mask[bit]) { + if (dir) + gpio_regs[port].ddr |= mask[bit]; + else + gpio_regs[port].ddr &= ~mask[bit]; + *ddrs[port] = gpio_regs[port].ddr; + return 1; + } else + return 0; +} + +int h8300_get_gpio_dir(int port_bit) +{ + const unsigned char mask[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}; + int port = (port_bit >> 8) & 0xff; + int bit = port_bit & 0x07; + if (ddrs[port] == NULL) + return 0; + if (gpio_regs[port].used & mask[bit]) { + return (gpio_regs[port].ddr & mask[bit]) != 0; + } else + return -1; +} + +#if defined(CONFIG_PROC_FS) +static char *port_status(int portno) +{ + static char result[10]; + const static char io[2]={'I','O'}; + char *rp; + int c; + unsigned char used,ddr; + + used = gpio_regs[portno].used; + ddr = gpio_regs[portno].ddr; + result[8]='\0'; + rp = result + 7; + for (c = 8; c > 0; c--,rp--,used >>= 1, ddr >>= 1) + if (used & 0x01) + *rp = io[ ddr & 0x01]; + else + *rp = '-'; + return result; +} + +static int gpio_proc_read(char *buf, char **start, off_t offset, int len, int unused) +{ + int c,outlen; + const static char port_name[]="123456789AB"; + outlen = 0; + for (c = 0; c < MAX_PORT; c++) { + if (ddrs[c] == NULL) + continue ; + len = sprintf(buf,"P%c: %s\n",port_name[c],port_status(c)); + buf += len; + outlen += len; + } + return outlen; +} + +static const struct proc_dir_entry proc_gpio = { + 0, 4,"gpio",S_IFREG | S_IRUGO, 1, 0, 0, 0, NULL, gpio_proc_read, +}; +#endif + +int h8300_gpio_init(void) +{ + memcpy(gpio_regs,_platform_gpio_table(sizeof(gpio_regs)),sizeof(gpio_regs)); +#if 0 && defined(CONFIG_PROC_FS) + proc_register(&proc_root,&proc_gpio); +#endif + return 0; +} + +#else +#error Unsuppoted CPU Selection +#endif diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/kernel/h8300_ksyms.c linux-2.5.64-ac4/arch/h8300/kernel/h8300_ksyms.c --- linux-2.5.64/arch/h8300/kernel/h8300_ksyms.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/kernel/h8300_ksyms.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,113 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//asmlinkage long long __ashrdi3 (long long, int); +//asmlinkage long long __lshrdi3 (long long, int); +extern char h8300_debug_device[]; + +extern void dump_thread(struct pt_regs *, struct user *); + +/* platform dependent support */ + +EXPORT_SYMBOL(dump_thread); +EXPORT_SYMBOL(strnlen); +EXPORT_SYMBOL(strrchr); +EXPORT_SYMBOL(strstr); +EXPORT_SYMBOL(strchr); +EXPORT_SYMBOL(strcat); +EXPORT_SYMBOL(strlen); +EXPORT_SYMBOL(strcmp); +EXPORT_SYMBOL(strncmp); + +EXPORT_SYMBOL(ip_fast_csum); + +EXPORT_SYMBOL(mach_enable_irq); +EXPORT_SYMBOL(mach_disable_irq); +EXPORT_SYMBOL(kernel_thread); + +/* Networking helper routines. */ +EXPORT_SYMBOL(csum_partial_copy); + +/* The following are special because they're not called + explicitly (the C compiler generates them). Fortunately, + their interface isn't gonna change any time soon now, so + it's OK to leave it out of version control. */ +//EXPORT_SYMBOL_NOVERS(__ashrdi3); +//EXPORT_SYMBOL_NOVERS(__lshrdi3); +EXPORT_SYMBOL_NOVERS(memcpy); +EXPORT_SYMBOL_NOVERS(memset); +EXPORT_SYMBOL_NOVERS(memcmp); +EXPORT_SYMBOL_NOVERS(memscan); +EXPORT_SYMBOL_NOVERS(memmove); + +EXPORT_SYMBOL(get_wchan); + +/* + * libgcc functions - functions that are used internally by the + * compiler... (prototypes are not correct though, but that + * doesn't really matter since they're not versioned). + */ +extern void __gcc_bcmp(void); +extern void __ashldi3(void); +extern void __ashrdi3(void); +extern void __cmpdi2(void); +extern void __divdi3(void); +extern void __divsi3(void); +extern void __lshrdi3(void); +extern void __moddi3(void); +extern void __modsi3(void); +extern void __muldi3(void); +extern void __mulsi3(void); +extern void __negdi2(void); +extern void __ucmpdi2(void); +extern void __udivdi3(void); +extern void __udivmoddi4(void); +extern void __udivsi3(void); +extern void __umoddi3(void); +extern void __umodsi3(void); + + /* gcc lib functions */ +EXPORT_SYMBOL_NOVERS(__gcc_bcmp); +EXPORT_SYMBOL_NOVERS(__ashldi3); +EXPORT_SYMBOL_NOVERS(__ashrdi3); +EXPORT_SYMBOL_NOVERS(__cmpdi2); +EXPORT_SYMBOL_NOVERS(__divdi3); +EXPORT_SYMBOL_NOVERS(__divsi3); +EXPORT_SYMBOL_NOVERS(__lshrdi3); +EXPORT_SYMBOL_NOVERS(__moddi3); +EXPORT_SYMBOL_NOVERS(__modsi3); +EXPORT_SYMBOL_NOVERS(__muldi3); +EXPORT_SYMBOL_NOVERS(__mulsi3); +EXPORT_SYMBOL_NOVERS(__negdi2); +EXPORT_SYMBOL_NOVERS(__ucmpdi2); +EXPORT_SYMBOL_NOVERS(__udivdi3); +EXPORT_SYMBOL_NOVERS(__udivmoddi4); +EXPORT_SYMBOL_NOVERS(__udivsi3); +EXPORT_SYMBOL_NOVERS(__umoddi3); +EXPORT_SYMBOL_NOVERS(__umodsi3); + +EXPORT_SYMBOL_NOVERS(_current_task); + +EXPORT_SYMBOL_NOVERS(is_in_rom); + +EXPORT_SYMBOL_NOVERS(h8300_reserved_gpio) +EXPORT_SYMBOL_NOVERS(h8300_free_gpio) +EXPORT_SYMBOL_NOVERS(h8300_set_gpio_dir) diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/kernel/init_task.c linux-2.5.64-ac4/arch/h8300/kernel/init_task.c --- linux-2.5.64/arch/h8300/kernel/init_task.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/kernel/init_task.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,37 @@ +/* + * linux/arch/h8300/kernel/init_task.c + */ +#include +#include +#include +#include +#include + +#include +#include + +static struct fs_struct init_fs = INIT_FS; +static struct files_struct init_files = INIT_FILES; +static struct signal_struct init_signals = INIT_SIGNALS(init_signals); +struct mm_struct init_mm = INIT_MM(init_mm); + +/* + * Initial task structure. + * + * All other task structs will be allocated on slabs in fork.c + */ +__asm__(".align 4"); +struct task_struct init_task = INIT_TASK(init_task); + + +/* + * Initial thread structure. + * + * We need to make sure that this is 8192-byte aligned due to the + * way process stacks are handled. This is done by having a special + * "init_task" linker map entry.. + */ +union thread_union init_thread_union + __attribute__((__section__(".data.init_task"))) = + { INIT_THREAD_INFO(init_task) }; + diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/kernel/Makefile linux-2.5.64-ac4/arch/h8300/kernel/Makefile --- linux-2.5.64/arch/h8300/kernel/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/kernel/Makefile 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,18 @@ +# +# Makefile for the linux kernel. +# +# Note! Dependencies are done automagically by 'make dep', which also +# removes any old dependencies. DON'T put your own dependencies here +# unless it's something special (ie not a .c file). +# +# Note 2! The CFLAGS definitions are now in the main makefile... + +obj-y := process.o traps.o ptrace.o \ + sys_h8300.o time.o semaphore.o signal.o \ + setup.o h8300_ksyms.o gpio.o init_task.o \ + syscalls.o + +export-objs := h8300_ksyms.o + +include $(TOPDIR)/Rules.make + diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/kernel/process.c linux-2.5.64-ac4/arch/h8300/kernel/process.c --- linux-2.5.64/arch/h8300/kernel/process.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/kernel/process.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,316 @@ +/* + * linux/arch/h8300/kernel/process.c + * + * Yoshinori Sato + * + * Based on: + * + * linux/arch/m68knommu/kernel/process.c + * + * Copyright (C) 1998 D. Jeff Dionne , + * Kenneth Albanowski , + * The Silver Hammer Group, Ltd. + * + * linux/arch/m68k/kernel/process.c + * + * Copyright (C) 1995 Hamish Macdonald + * + * 68060 fixes by Jesper Skov + */ + +/* + * This file handles the architecture-dependent parts of process handling.. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +asmlinkage void ret_from_exception(void); + +/* + * The idle loop on an H8/300.. + */ +#if !defined(CONFIG_H8300H_SIM) +void default_idle(void) +{ + while(1) { + if (need_resched()) { + sti(); + __asm__("sleep"); + cli(); + } + schedule(); + } +} +#else +void default_idle(void) +{ + while(1) { + if (need_resched()) + schedule(); + } +} +#endif +void (*idle)(void) = default_idle; + +/* + * The idle thread. There's no useful work to be + * done, so just try to conserve power and have a + * low exit latency (ie sit in a loop waiting for + * somebody to say that they'd like to reschedule) + */ +void cpu_idle(void) +{ + idle(); +} + +void machine_restart(char * __unused) +{ + cli(); + __asm__("jmp @@0"); +} + +void machine_halt(void) +{ + cli(); + __asm__("sleep"); + for (;;); +} + +void machine_power_off(void) +{ + cli(); + __asm__("sleep"); + for (;;); +} + +void show_regs(struct pt_regs * regs) +{ + printk("\n"); + printk("PC: %08lx Status: %02x\n", + regs->pc, regs->ccr); + printk("ORIG_ER0: %08lx ER0: %08lx ER1: %08lx\n", + regs->orig_er0, regs->er0, regs->er1); + printk("ER2: %08lx ER3: %08lx\n", + regs->er2, regs->er3); + if (!(regs->ccr & 0x10)) + printk("USP: %08lx\n", rdusp()); +} + +/* + * Create a kernel thread + */ +int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) +{ + long retval; + register long clone_arg asm("er1"); + mm_segment_t fs; + + fs = get_fs(); + set_fs (KERNEL_DS); + clone_arg = flags | CLONE_VM; + + __asm__ __volatile__ ( + "mov.l sp, er2\n\t" + "mov.l %1,er0\n\t" + "mov.l %5,er1\n\t" + "trapa #0\n\t" + "cmp.l sp, er2\n\t" + "beq 1f\n\t" + "mov.l %3, er0\n\t" + "jsr @%4\n\t" + "mov.l %2, er0\n\t" + "trapa #0\n" + "1:" + : "=r" (retval) + : "i" (__NR_clone), + "i" (__NR_exit), + "r" (arg), + "r" (fn), + "r" (clone_arg) + : "cc", "er0", "er1", "er2", "er3"); + + set_fs (fs); + return retval; +} + +void flush_thread(void) +{ +} + +/* + * "h8300_fork()".. By the time we get here, the + * non-volatile registers have also been saved on the + * stack. We do some ugly pointer stuff here.. (see + * also copy_thread) + */ + +asmlinkage int h8300_fork(struct pt_regs *regs) +{ + return -EINVAL; +} + +asmlinkage int h8300_vfork(struct pt_regs *regs) +{ + struct task_struct *p; + p = do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(), regs, 0, NULL, NULL); + return IS_ERR(p) ? PTR_ERR(p) : p->pid; +} + +asmlinkage int h8300_clone(struct pt_regs *regs) +{ + unsigned long clone_flags; + unsigned long newsp; + struct task_struct *p; + + /* syscall2 puts clone_flags in er1 and usp in er2 */ + clone_flags = regs->er1; + newsp = regs->er2; + if (!newsp) + newsp = rdusp(); + p = do_fork(clone_flags & ~CLONE_IDLETASK, newsp, regs, 0, NULL, NULL); + return IS_ERR(p) ? PTR_ERR(p) : p->pid; + +} + +int copy_thread(int nr, unsigned long clone_flags, + unsigned long usp, unsigned long topstk, + struct task_struct * p, struct pt_regs * regs) +{ + struct pt_regs * childregs; + struct switch_stack * childstack, *stack; + unsigned long stack_offset, *retp; + + stack_offset = KTHREAD_SIZE - sizeof(struct pt_regs); + childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) p->thread_info)) - 1; + + *childregs = *regs; + + retp = (unsigned long *) regs-2; + stack = ((struct switch_stack *) retp) - 1; + + childstack = ((struct switch_stack *) childregs) - 1; + *childstack = *stack; + childregs->er0 = 0; + childstack->retpc = (unsigned long) ret_from_exception; + + p->thread.usp = usp; + p->thread.ksp = (unsigned long)childstack; + p->thread.vfork_ret = 0; + + return 0; +} + +/* + * fill in the user structure for a core dump.. + */ +void dump_thread(struct pt_regs * regs, struct user * dump) +{ + struct switch_stack *sw; + +/* changed the size calculations - should hopefully work better. lbt */ + dump->magic = CMAGIC; + dump->start_code = 0; + dump->start_stack = rdusp() & ~(PAGE_SIZE - 1); + dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT; + dump->u_dsize = ((unsigned long) (current->mm->brk + + (PAGE_SIZE-1))) >> PAGE_SHIFT; + dump->u_dsize -= dump->u_tsize; + dump->u_ssize = 0; + + dump->u_ar0 = (struct user_regs_struct *)(((int)(&dump->regs)) -((int)(dump))); + sw = ((struct switch_stack *)regs) - 1; + dump->regs.er0 = regs->er0; + dump->regs.er1 = regs->er1; + dump->regs.er2 = regs->er2; + dump->regs.er3 = regs->er3; + dump->regs.er4 = sw->er4; + dump->regs.er5 = sw->er5; + dump->regs.er6 = sw->er6; + dump->regs.orig_er0 = regs->orig_er0; + dump->regs.ccr = regs->ccr; + dump->regs.pc = regs->pc; +} + +/* + * sys_execve() executes a new program. + */ +asmlinkage int sys_execve(char *name, char **argv, char **envp,int dummy,...) +{ + int error; + char * filename; + struct pt_regs *regs = (struct pt_regs *) ((unsigned char *)&dummy+4); + + lock_kernel(); + filename = getname(name); + error = PTR_ERR(filename); + if (IS_ERR(filename)) + goto out; + error = do_execve(filename, argv, envp, regs); + putname(filename); +out: + unlock_kernel(); + return error; +} + +/* + * These bracket the sleeping functions.. + */ +extern void scheduling_functions_start_here(void); +extern void scheduling_functions_end_here(void); +#define first_sched ((unsigned long) scheduling_functions_start_here) +#define last_sched ((unsigned long) scheduling_functions_end_here) + +unsigned long thread_saved_pc(struct task_struct *tsk) +{ + struct switch_stack *sw = (struct switch_stack *)(tsk->thread.ksp); + + /* Check whether the thread is blocked in resume() */ + if (sw->retpc > (unsigned long)scheduling_functions_start_here && + sw->retpc < (unsigned long)scheduling_functions_end_here) + return ((unsigned long *)sw->er6)[1]; + else + return sw->retpc; +} + +unsigned long get_wchan(struct task_struct *p) +{ + unsigned long fp, pc; + unsigned long stack_page; + int count = 0; + if (!p || p == current || p->state == TASK_RUNNING) + return 0; + + stack_page = (unsigned long)p; + fp = ((struct switch_stack *)p->thread.ksp)->er6; + do { + if (fp < stack_page+sizeof(struct task_struct) || + fp >= 8184+stack_page) + return 0; + pc = ((unsigned long *)fp)[1]; + /* FIXME: This depends on the order of these functions. */ + if (pc < first_sched || pc >= last_sched) + return pc; + fp = *(unsigned long *) fp; + } while (count++ < 16); + return 0; +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/kernel/ptrace.c linux-2.5.64-ac4/arch/h8300/kernel/ptrace.c --- linux-2.5.64/arch/h8300/kernel/ptrace.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/kernel/ptrace.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,470 @@ +/* + * linux/arch/h8300/kernel/ptrace.c + * + * Yoshinori Sato + * + * Based on: + * linux/arch/m68k/kernel/ptrace.c + * + * Copyright (C) 1994 by Hamish Macdonald + * Taken from linux/kernel/ptrace.c and modified for M680x0. + * linux/kernel/ptrace.c is by Ross Biro 1/23/92, edited by Linus Torvalds + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file COPYING in the main directory of + * this archive for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * does not yet catch signals sent when the child dies. + * in exit.c or in signal.c. + */ + +/* determines which bits in the SR the user has access to. */ +/* 1 = access 0 = no access */ +#define SR_MASK 0x001f + +/* sets the trace bits. */ +#define TRACE_BITS 0x8000 + +/* Find the stack offset for a register, relative to thread.esp0. */ +#define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg) +#define SW_REG(reg) ((long)&((struct switch_stack *)0)->reg \ + - sizeof(struct switch_stack)) +/* Mapping from PT_xxx to the stack offset at which the register is + saved. Notice that usp has no stack-slot and needs to be treated + specially (see get_reg/put_reg below). */ +static const int regoff[] = { + PT_REG(er1), PT_REG(er2), PT_REG(er3), SW_REG(er4), + SW_REG(er5), SW_REG(er6), PT_REG(er0), PT_REG(orig_er0), + PT_REG(ccr), PT_REG(pc) +}; + +/* + * Get contents of register REGNO in task TASK. + */ +static inline long get_reg(struct task_struct *task, int regno) +{ + unsigned long *addr; + + if (regno == PT_USP) + addr = &task->thread.usp; + else if (regno < sizeof(regoff)/sizeof(regoff[0])) + addr = (unsigned long *)(task->thread.esp0 + regoff[regno]); + else + return 0; + return *addr; +} + +/* + * Write contents of register REGNO in task TASK. + */ +static inline int put_reg(struct task_struct *task, int regno, + unsigned long data) +{ + unsigned long *addr; + + if (regno == PT_USP) + addr = &task->thread.usp; + else if (regno < sizeof(regoff)/sizeof(regoff[0])) + addr = (unsigned long *) (task->thread.esp0 + regoff[regno]); + else + return -1; + *addr = data; + return 0; +} + +/* + * Called by kernel/ptrace.c when detaching.. + * + * Make sure the single step bit is not set. + */ +int ptrace_cancel_bpt(struct task_struct *child) +{ + int i,r=0; + + for(i=0; i<4; i++) { + if (child->thread.debugreg[i]) { + if (child->thread.debugreg[i] != ~0) + put_user(child->thread.debugreg[i+4], + (unsigned short *)child->thread.debugreg[i]); + r = 1; + child->thread.debugreg[i] = 0; + } + } + return r; +} + +const static unsigned char opcode0[]={ + 0x04,0x02,0x04,0x02,0x04,0x02,0x04,0x02, /* 0x58 */ + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, /* 0x60 */ + 0x02,0x02,0x11,0x11,0x02,0x02,0x04,0x04, /* 0x68 */ + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, /* 0x70 */ + 0x08,0x04,0x06,0x04,0x04,0x04,0x04,0x04}; /* 0x78 */ + +static int table_parser01(unsigned char *pc); +static int table_parser02(unsigned char *pc); +static int table_parser100(unsigned char *pc); +static int table_parser101(unsigned char *pc); + +const static int (*parsers[])(unsigned char *pc)={table_parser01,table_parser02}; + +static int insn_length(unsigned char *pc) +{ + if (*pc == 0x01) + return table_parser01(pc+1); + if (*pc < 0x58 || *pc>=0x80) + return 2; + else + if (opcode0[*pc-0x58]<0x10) + return opcode0[*pc-0x58]; + else + return (*parsers[opcode0[*pc-0x58]-0x10])(pc+1); +} + +static int table_parser01(unsigned char *pc) +{ + const unsigned char codelen[]={0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00, + 0x02,0x00,0x00,0x00,0x04,0x04,0x00,0x04}; + const static int (*parsers[])(unsigned char *)={table_parser100,table_parser101}; + unsigned char second_index; + second_index = (*pc) >> 4; + if (codelen[second_index]<0x10) + return codelen[second_index]; + else + return parsers[codelen[second_index]-0x10](pc); +} + +static int table_parser02(unsigned char *pc) +{ + return (*pc & 0x20)?0x06:0x04; +} + +static int table_parser100(unsigned char *pc) +{ + return (*(pc+2) & 0x02)?0x08:0x06; +} + +static int table_parser101(unsigned char *pc) +{ + return (*(pc+2) & 0x02)?0x08:0x06; +} + +#define BREAK_INST 0x5730 /* TRAPA #3 */ + +int ptrace_set_bpt(struct task_struct *child) +{ + unsigned long pc,next; + unsigned short insn; + pc = get_reg(child,PT_PC); + next = insn_length((unsigned char *)pc) + pc; + get_user(insn,(unsigned short *)pc); + if (insn == 0x5470) { + /* rts */ + unsigned long sp; + sp = get_reg(child,PT_USP); + get_user(next,(unsigned long *)sp); + } else if ((insn & 0xfb00) != 0x5800) { + /* jmp / jsr */ + int regs; + const short reg_tbl[]={PT_ER0,PT_ER1,PT_ER2,PT_ER3, + PT_ER4,PT_ER5,PT_ER6,PT_USP}; + switch(insn & 0xfb00) { + case 0x5900: + regs = (insn & 0x0070) >> 8; + next = get_reg(child,reg_tbl[regs]); + break; + case 0x5a00: + get_user(next,(unsigned long *)(pc+2)); + next &= 0x00ffffff; + break; + case 0x5b00: + /* unneccessary? */ + next = *(unsigned long *)(insn & 0xff); + break; + } + } else if (((insn & 0xf000) == 0x4000) || ((insn &0xff00) == 0x5500)) { + /* b**:8 */ + unsigned long dsp; + dsp = (long)(insn && 0xff)+pc+2; + child->thread.debugreg[1] = dsp; + get_user(child->thread.debugreg[5],(unsigned short *)dsp); + put_user(BREAK_INST,(unsigned short *)dsp); + } else if (((insn & 0xff00) == 0x5800) || ((insn &0xff00) == 0x5c00)) { + /* b**:16 */ + unsigned long dsp; + get_user(dsp,(unsigned short *)(pc+2)); + dsp = (long)dsp+pc+4; + child->thread.debugreg[1] = dsp; + get_user(child->thread.debugreg[5],(unsigned short *)dsp); + put_user(BREAK_INST,(unsigned short *)dsp); + } + child->thread.debugreg[0] = next; + get_user(child->thread.debugreg[4],(unsigned short *)next); + put_user(BREAK_INST,(unsigned short *)next); + return 0; +} + +inline +static int read_long(struct task_struct * tsk, unsigned long addr, + unsigned long * result) +{ + *result = *(unsigned long *)addr; + return 0; +} + +void ptrace_disable(struct task_struct *child) +{ + ptrace_cancel_bpt(child); +} + +asmlinkage int sys_ptrace(long request, long pid, long addr, long data) +{ + struct task_struct *child; + int ret; + + lock_kernel(); + ret = -EPERM; + if (request == PTRACE_TRACEME) { + /* are we already being traced? */ + if (current->ptrace & PT_PTRACED) + goto out; + /* set the ptrace bit in the process flags. */ + current->ptrace |= PT_PTRACED; + ret = 0; + goto out; + } + ret = -ESRCH; + read_lock(&tasklist_lock); + child = find_task_by_pid(pid); + if (child) + get_task_struct(child); + read_unlock(&tasklist_lock); + if (!child) + goto out; + + ret = -EPERM; + if (pid == 1) /* you may not mess with init */ + goto out_tsk; + + if (request == PTRACE_ATTACH) { + ret = ptrace_attach(child); + goto out_tsk; + } + ret = -ESRCH; + if (!(child->ptrace & PT_PTRACED)) + goto out_tsk; + if (child->state != TASK_STOPPED) { + if (request != PTRACE_KILL) + goto out_tsk; + } + ret = ptrace_check_attach(child, request == PTRACE_KILL); + if (ret < 0) + goto out_tsk; + + switch (request) { + case PTRACE_PEEKTEXT: /* read word at location addr. */ + case PTRACE_PEEKDATA: { + unsigned long tmp; + + ret = read_long(child, addr, &tmp); + if (ret < 0) + break ; + ret = verify_area(VERIFY_WRITE, (void *) data, sizeof(long)); + if (!ret) + put_user(tmp, (unsigned long *) data); + break ; + } + + /* read the word at location addr in the USER area. */ + case PTRACE_PEEKUSR: { + unsigned long tmp; + + if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) + ret = -EIO; + + ret = verify_area(VERIFY_WRITE, (void *) data, + sizeof(long)); + if (ret) + break ; + tmp = 0; /* Default return condition */ + addr = addr >> 2; /* temporary hack. */ + if (addr < 10) + tmp = get_reg(child, addr); + else { + ret = -EIO; + break ; + } + put_user(tmp,(unsigned long *) data); + ret = 0; + break ; + } + + /* when I and D space are separate, this will have to be fixed. */ + case PTRACE_POKETEXT: /* write the word at location addr. */ + case PTRACE_POKEDATA: + ret = 0; + if (access_process_vm(child, addr, &data, sizeof(data), 1) == sizeof(data)) + break; + ret = -EIO; + break; + + case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ + if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) { + ret = -EIO; + break ; + } + addr = addr >> 2; /* temporary hack. */ + + if (addr == PT_ORIG_ER0) { + ret = -EIO; + break ; + } + if (addr == PT_CCR) { + data &= SR_MASK; + } + if (addr < 10) { + if (put_reg(child, addr, data)) + ret = -EIO; + else + ret = 0; + break ; + } + ret = -EIO; + break ; + case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ + case PTRACE_CONT: { /* restart after signal. */ + ret = -EIO; + if ((unsigned long) data >= _NSIG) + break ; + if (request == PTRACE_SYSCALL) + set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); + else + clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); + child->exit_code = data; + wake_up_process(child); + /* make sure the single step bit is not set. */ + ptrace_cancel_bpt(child); + ret = 0; + } + +/* + * make the child exit. Best I can do is send it a sigkill. + * perhaps it should be put in the status that it wants to + * exit. + */ + case PTRACE_KILL: { + + ret = 0; + if (child->state == TASK_ZOMBIE) /* already dead */ + break; + child->exit_code = SIGKILL; + ptrace_cancel_bpt(child); + wake_up_process(child); + break; + } + + case PTRACE_SINGLESTEP: { /* set the trap flag. */ + ret = -EIO; + if ((unsigned long) data > _NSIG) + break; + clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); + child->thread.debugreg[0]=-1; + child->exit_code = data; + wake_up_process(child); + ret = 0; + break; + } + + case PTRACE_DETACH: /* detach a process that was attached. */ + ret = ptrace_detach(child, data); + break; + + case PTRACE_GETREGS: { /* Get all gp regs from the child. */ + int i; + unsigned long tmp; + for (i = 0; i < 19; i++) { + tmp = get_reg(child, i); + if (put_user(tmp, (unsigned long *) data)) { + ret = -EFAULT; + break; + } + data += sizeof(long); + } + ret = 0; + break; + } + + case PTRACE_SETREGS: { /* Set all gp regs in the child. */ + int i; + unsigned long tmp; + for (i = 0; i < 10; i++) { + if (get_user(tmp, (unsigned long *) data)) { + ret = -EFAULT; + break; + } + put_reg(child, i, tmp); + data += sizeof(long); + } + ret = 0; + break; + } + + default: + ret = -EIO; + break; + } +out_tsk: + put_task_struct(child); +out: + unlock_kernel(); + return ret; +} + +asmlinkage void syscall_trace(void) +{ + if (!test_thread_flag(TIF_SYSCALL_TRACE)) + return; + if (!(current->ptrace & PT_PTRACED)) + return; + current->exit_code = SIGTRAP; + current->state = TASK_STOPPED; + notify_parent(current, SIGCHLD); + schedule(); + /* + * this isn't the same as continuing with a signal, but it will do + * for normal use. strace only continues with a signal if the + * stopping signal is not SIGTRAP. -brl + */ + if (current->exit_code) { + send_sig(current->exit_code, current, 1); + current->exit_code = 0; + } +} + +asmlinkage void trace_trap(unsigned long bp) +{ + if (current->thread.debugreg[0] == bp || + current->thread.debugreg[1] == bp) { + ptrace_cancel_bpt(current); + force_sig(SIGTRAP,current); + } else + force_sig(SIGILL,current); +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/kernel/semaphore.c linux-2.5.64-ac4/arch/h8300/kernel/semaphore.c --- linux-2.5.64/arch/h8300/kernel/semaphore.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/kernel/semaphore.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,132 @@ +/* + * Generic semaphore code. Buyer beware. Do your own + * specific changes in + */ + +#include +#include +#include + +#ifndef CONFIG_RMW_INSNS +spinlock_t semaphore_wake_lock; +#endif + +/* + * Semaphores are implemented using a two-way counter: + * The "count" variable is decremented for each process + * that tries to sleep, while the "waking" variable is + * incremented when the "up()" code goes to wake up waiting + * processes. + * + * Notably, the inline "up()" and "down()" functions can + * efficiently test if they need to do any extra work (up + * needs to do something only if count was negative before + * the increment operation. + * + * waking_non_zero() (from asm/semaphore.h) must execute + * atomically. + * + * When __up() is called, the count was negative before + * incrementing it, and we need to wake up somebody. + * + * This routine adds one to the count of processes that need to + * wake up and exit. ALL waiting processes actually wake up but + * only the one that gets to the "waking" field first will gate + * through and acquire the semaphore. The others will go back + * to sleep. + * + * Note that these functions are only called when there is + * contention on the lock, and as such all this is the + * "non-critical" part of the whole semaphore business. The + * critical part is the inline stuff in + * where we want to avoid any extra jumps and calls. + */ +void __up(struct semaphore *sem) +{ + wake_one_more(sem); + wake_up(&sem->wait); +} + +/* + * Perform the "down" function. Return zero for semaphore acquired, + * return negative for signalled out of the function. + * + * If called from __down, the return is ignored and the wait loop is + * not interruptible. This means that a task waiting on a semaphore + * using "down()" cannot be killed until someone does an "up()" on + * the semaphore. + * + * If called from __down_interruptible, the return value gets checked + * upon return. If the return value is negative then the task continues + * with the negative value in the return register (it can be tested by + * the caller). + * + * Either form may be used in conjunction with "up()". + * + */ + + +#define DOWN_HEAD(task_state) \ + \ + \ + current->state = (task_state); \ + add_wait_queue(&sem->wait, &wait); \ + \ + /* \ + * Ok, we're set up. sem->count is known to be less than zero \ + * so we must wait. \ + * \ + * We can let go the lock for purposes of waiting. \ + * We re-acquire it after awaking so as to protect \ + * all semaphore operations. \ + * \ + * If "up()" is called before we call waking_non_zero() then \ + * we will catch it right away. If it is called later then \ + * we will have to go through a wakeup cycle to catch it. \ + * \ + * Multiple waiters contend for the semaphore lock to see \ + * who gets to gate through and who has to wait some more. \ + */ \ + for (;;) { + +#define DOWN_TAIL(task_state) \ + current->state = (task_state); \ + } \ + current->state = TASK_RUNNING; \ + remove_wait_queue(&sem->wait, &wait); + +void __down(struct semaphore * sem) +{ + DECLARE_WAITQUEUE(wait, current); + + DOWN_HEAD(TASK_UNINTERRUPTIBLE) + if (waking_non_zero(sem)) + break; + schedule(); + DOWN_TAIL(TASK_UNINTERRUPTIBLE) +} + +int __down_interruptible(struct semaphore * sem) +{ + DECLARE_WAITQUEUE(wait, current); + int ret = 0; + + DOWN_HEAD(TASK_INTERRUPTIBLE) + + ret = waking_non_zero_interruptible(sem, current); + if (ret) + { + if (ret == 1) + /* ret != 0 only if we get interrupted -arca */ + ret = 0; + break; + } + schedule(); + DOWN_TAIL(TASK_INTERRUPTIBLE) + return ret; +} + +int __down_trylock(struct semaphore * sem) +{ + return waking_non_zero_trylock(sem); +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/kernel/setup.c linux-2.5.64-ac4/arch/h8300/kernel/setup.c --- linux-2.5.64/arch/h8300/kernel/setup.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/kernel/setup.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,231 @@ +/* + * linux/arch/h8300h/kernel/setup.c + * + * Copyleft ()) 2000 James D. Schettine {james@telos-systems.com} + * Copyright (C) 1999,2000 Greg Ungerer (gerg@snapgear.com) + * Copyright (C) 1998,1999 D. Jeff Dionne + * Copyright (C) 1998 Kenneth Albanowski + * Copyright (C) 1995 Hamish Macdonald + * Copyright (C) 2000 Lineo Inc. (www.lineo.com) + * Copyright (C) 2001 Lineo, Inc. + * + * H8/300H porting Yoshinori Sato + */ + +/* + * This file handles the architecture-dependent parts of system setup + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#ifdef CONFIG_BLK_DEV_INITRD +#include +#include +#endif + +#if defined(CONFIG_H8300H) +#define CPU "H8/300H" +#endif + +unsigned long rom_length; +unsigned long memory_start; +unsigned long memory_end; + +struct task_struct *_current_task; + +char command_line[512]; +char saved_command_line[512]; + +extern int _stext, _etext, _sdata, _edata, _sbss, _ebss, _end; +extern int _ramstart, _ramend; +extern char _target_name[]; + +#if defined(CONFIG_H8300H_SIM) && defined(CONFIG_GDB_MAGICPRINT) +/* printk with gdb service */ +static void gdb_console_output(struct console *c, char *msg, unsigned len) +{ + for (; len > 0; len--) { + asm("mov.w %0,r2\n\t" + "jsr @0xc4"::"r"(*msg++):"er2"); + } +} + +/* + * Setup initial baud/bits/parity. We do two things here: + * - construct a cflag setting for the first rs_open() + * - initialize the serial port + * Return non-zero if we didn't find a serial port. + */ +static int __init gdb_console_setup(struct console *co, char *options) +{ + return 0; +} + +static const struct console gdb_console = { + name: "gdb", + write: gdb_console_output, + device: NULL, + setup: gdb_console_setup, + flags: CON_PRINTBUFFER, + index: -1, +}; +#endif + +void setup_arch(char **cmdline_p) +{ + int bootmap_size; + + memory_start = PAGE_ALIGN((unsigned long)(&_ramstart)); + memory_end = &_ramend; /* by now the stack is part of the init task */ + + init_mm.start_code = (unsigned long) &_stext; + init_mm.end_code = (unsigned long) &_etext; + init_mm.end_data = (unsigned long) &_edata; + init_mm.brk = (unsigned long) 0; + +#if defined(CONFIG_H8300H_SIM) && defined(CONFIG_GDB_MAGICPRINT) + register_console(&gdb_console); +#endif + + printk("\x0F\r\n\nuClinux " CPU "\n"); + printk("Target Hardware: %s\n",_target_name); + printk("Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne\n"); + printk("H8/300H support by Yoshinori Sato \n"); + +#ifdef DEBUG + printk("KERNEL -> TEXT=0x%06x-0x%06x DATA=0x%06x-0x%06x " + "BSS=0x%06x-0x%06x\n", (int) &_stext, (int) &_etext, + (int) &_sdata, (int) &_edata, + (int) &_sbss, (int) &_ebss); + printk("KERNEL -> ROMFS=0x%06x-0x%06x MEM=0x%06x-0x%06x " + "STACK=0x%06x-0x%06x\n", + (int) &_ebss, (int) memory_start, + (int) memory_start, (int) memory_end, + (int) memory_end, (int) &_ramend); +#endif + +#ifdef CONFIG_BLK_DEV_BLKMEM + ROOT_DEV = MKDEV(BLKMEM_MAJOR,0); +#endif + +#ifdef CONFIG_DEFAULT_CMDLINE + /* set from default command line */ + if (*command_line == '\0') + strcpy(command_line,CONFIG_KERNEL_COMMAND); +#endif + /* Keep a copy of command line */ + *cmdline_p = &command_line[0]; + memcpy(saved_command_line, command_line, sizeof(saved_command_line)); + saved_command_line[sizeof(saved_command_line)-1] = 0; + +#ifdef DEBUG + if (strlen(*cmdline_p)) + printk("Command line: '%s'\n", *cmdline_p); +#endif + + /* + * give all the memory to the bootmap allocator, tell it to put the + * boot mem_map at the start of memory + */ + bootmap_size = init_bootmem_node( + NODE_DATA(0), + memory_start >> PAGE_SHIFT, /* map goes here */ + PAGE_OFFSET >> PAGE_SHIFT, /* 0 on coldfire */ + memory_end >> PAGE_SHIFT); + /* + * free the usable memory, we have to make sure we do not free + * the bootmem bitmap so we then reserve it after freeing it :-) + */ + free_bootmem(memory_start, memory_end - memory_start); + reserve_bootmem(memory_start, bootmap_size); + /* + * get kmalloc into gear + */ + paging_init(); +#ifdef DEBUG + printk("Done setup_arch\n"); +#endif +} + +int get_cpuinfo(char * buffer) +{ + char *cpu; + u_long clockfreq; + + cpu = CPU; + + clockfreq = CONFIG_CPU_CLOCK; + + return(sprintf(buffer, "CPU:\t\t%s\n" + "Clock:\t%lu.%1luMHz\n" + "BogoMips:\t%lu.%02lu\n" + "Calibration:\t%lu loops\n", + cpu, + clockfreq/100,clockfreq%100, + (loops_per_jiffy*HZ)/500000,((loops_per_jiffy*HZ)/5000)%100, + (loops_per_jiffy*HZ))); + +} + +/* + * Get CPU information for use by the procfs. + */ + +static int show_cpuinfo(struct seq_file *m, void *v) +{ + char *cpu; + u_long clockfreq; + + cpu = CPU; + + clockfreq = CONFIG_CPU_CLOCK; + + seq_printf(m, "CPU:\t\t%s\n" + "Clock:\t%lu.%1luMHz\n" + "BogoMips:\t%lu.%02lu\n" + "Calibration:\t%lu loops\n", + cpu, + clockfreq/100,clockfreq%100, + (loops_per_jiffy*HZ)/500000,((loops_per_jiffy*HZ)/5000)%100, + (loops_per_jiffy*HZ)); + + return 0; +} + +static void *c_start(struct seq_file *m, loff_t *pos) +{ + return *pos < NR_CPUS ? ((void *) 0x12345678) : NULL; +} + +static void *c_next(struct seq_file *m, void *v, loff_t *pos) +{ + ++*pos; + return c_start(m, pos); +} + +static void c_stop(struct seq_file *m, void *v) +{ +} + +struct seq_operations cpuinfo_op = { + start: c_start, + next: c_next, + stop: c_stop, + show: show_cpuinfo, +}; diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/kernel/signal.c linux-2.5.64-ac4/arch/h8300/kernel/signal.c --- linux-2.5.64/arch/h8300/kernel/signal.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/kernel/signal.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,637 @@ +/* + * linux/arch/h8300/kernel/signal.c + * + * Copyright (C) 1991, 1992 Linus Torvalds + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive + * for more details. + */ + +/* + * uClinux H8/300 support by Yoshinori Sato + * + * Based on + * Linux/m68k by Hamish Macdonald + */ + +/* + * ++roman (07/09/96): implemented signal stacks (specially for tosemu on + * Atari :-) Current limitation: Only one sigstack can be active at one time. + * If a second signal with SA_ONSTACK set arrives while working on a sigstack, + * SA_ONSTACK is ignored. This behaviour avoids lots of trouble with nested + * signal handlers! + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) + +asmlinkage long sys_wait4(pid_t pid, unsigned int * stat_addr, int options, + struct rusage * ru); +asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs); + +/* + * Atomically swap in the new signal mask, and wait for a signal. + */ +asmlinkage int do_sigsuspend(struct pt_regs *regs) +{ + old_sigset_t mask = regs->er3; + sigset_t saveset; + + mask &= _BLOCKABLE; + spin_lock_irq(¤t->sig->siglock); + saveset = current->blocked; + siginitset(¤t->blocked, mask); + recalc_sigpending(); + spin_unlock_irq(¤t->sig->siglock); + + regs->er0 = -EINTR; + while (1) { + current->state = TASK_INTERRUPTIBLE; + schedule(); + if (do_signal(&saveset, regs)) + return -EINTR; + } +} + +asmlinkage int +do_rt_sigsuspend(struct pt_regs *regs) +{ + sigset_t *unewset = (sigset_t *)regs->er1; + size_t sigsetsize = (size_t)regs->er2; + sigset_t saveset, newset; + + /* XXX: Don't preclude handling different sized sigset_t's. */ + if (sigsetsize != sizeof(sigset_t)) + return -EINVAL; + + if (copy_from_user(&newset, unewset, sizeof(newset))) + return -EFAULT; + sigdelsetmask(&newset, ~_BLOCKABLE); + + spin_lock_irq(¤t->sig->siglock); + saveset = current->blocked; + current->blocked = newset; + recalc_sigpending(); + spin_unlock_irq(¤t->sig->siglock); + + regs->er0 = -EINTR; + while (1) { + current->state = TASK_INTERRUPTIBLE; + schedule(); + if (do_signal(&saveset, regs)) + return -EINTR; + } +} + +asmlinkage int +sys_sigaction(int sig, const struct old_sigaction *act, + struct old_sigaction *oact) +{ + struct k_sigaction new_ka, old_ka; + int ret; + + if (act) { + old_sigset_t mask; + if (verify_area(VERIFY_READ, act, sizeof(*act)) || + __get_user(new_ka.sa.sa_handler, &act->sa_handler) || + __get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) + return -EFAULT; + __get_user(new_ka.sa.sa_flags, &act->sa_flags); + __get_user(mask, &act->sa_mask); + siginitset(&new_ka.sa.sa_mask, mask); + } + + ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); + + if (!ret && oact) { + if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || + __put_user(old_ka.sa.sa_handler, &oact->sa_handler) || + __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) + return -EFAULT; + __put_user(old_ka.sa.sa_flags, &oact->sa_flags); + __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask); + } + + return ret; +} + +asmlinkage int +sys_sigaltstack(const stack_t *uss, stack_t *uoss) +{ + return do_sigaltstack(uss, uoss, rdusp()); +} + + +/* + * Do a signal return; undo the signal stack. + * + * Keep the return code on the stack quadword aligned! + * That makes the cache flush below easier. + */ + +struct sigframe +{ + char *pretcode; + int sig; + int code; + struct sigcontext *psc; + char retcode[6]; + unsigned long extramask[_NSIG_WORDS-1]; + struct sigcontext sc; +}; + +struct rt_sigframe +{ + char *pretcode; + int sig; + struct siginfo *pinfo; + void *puc; + char retcode[6]; + struct siginfo info; + struct ucontext uc; +}; + + +static inline int +restore_sigcontext(struct pt_regs *regs, struct sigcontext *usc, void *fp, + int *pd0) +{ + struct sigcontext context; + int err = 0; + + /* get previous context */ + if (copy_from_user(&context, usc, sizeof(context))) + goto badframe; + + /* restore passed registers */ + regs->er1 = context.sc_er1; + regs->er2 = context.sc_er2; + regs->er3 = context.sc_er3; + regs->ccr = (regs->ccr & 0x10)|(context.sc_ccr & 0xef); + regs->pc = context.sc_pc; + regs->orig_er0 = -1; /* disable syscall checks */ + wrusp(context.sc_usp); + + *pd0 = context.sc_er0; + return err; + +badframe: + return 1; +} + +static inline int +rt_restore_ucontext(struct pt_regs *regs, struct switch_stack *sw, + struct ucontext *uc, int *pd0) +{ + int temp; + greg_t *gregs = uc->uc_mcontext.gregs; + unsigned long usp; + int err; + + err = __get_user(temp, &uc->uc_mcontext.version); + if (temp != MCONTEXT_VERSION) + goto badframe; + /* restore passed registers */ + err |= __get_user(regs->er0, &gregs[0]); + err |= __get_user(regs->er1, &gregs[1]); + err |= __get_user(regs->er2, &gregs[2]); + err |= __get_user(regs->er3, &gregs[3]); + err |= __get_user(sw->er4, &gregs[4]); + err |= __get_user(sw->er5, &gregs[5]); + err |= __get_user(sw->er6, &gregs[6]); + err |= __get_user(usp, &gregs[7]); + wrusp(usp); + err |= __get_user(regs->pc, &gregs[8]); + err |= __get_user(temp, &gregs[9]); + regs->ccr = (regs->ccr & 0x10) | (temp & 0xef); + regs->orig_er0 = -1; /* disable syscall checks */ + + if (do_sigaltstack(&uc->uc_stack, NULL, usp) == -EFAULT) + goto badframe; + + *pd0 = regs->er0; + return err; + +badframe: + return 1; +} + +asmlinkage int do_sigreturn(unsigned long __unused,...) +{ + struct switch_stack *sw = (struct switch_stack *) &__unused; + struct pt_regs *regs = (struct pt_regs *) (sw + 1); + unsigned long usp = rdusp(); + struct sigframe *frame = (struct sigframe *)(usp - 4); + sigset_t set; + int er0; + + if (verify_area(VERIFY_READ, frame, sizeof(*frame))) + goto badframe; + if (__get_user(set.sig[0], &frame->sc.sc_mask) || + (_NSIG_WORDS > 1 && + __copy_from_user(&set.sig[1], &frame->extramask, + sizeof(frame->extramask)))) + goto badframe; + + sigdelsetmask(&set, ~_BLOCKABLE); + spin_lock_irq(¤t->sig->siglock); + current->blocked = set; + recalc_sigpending(); + spin_unlock_irq(¤t->sig->siglock); + + if (restore_sigcontext(regs, &frame->sc, frame + 1, &er0)) + goto badframe; + return er0; + +badframe: + force_sig(SIGSEGV, current); + return 0; +} + +asmlinkage int do_rt_sigreturn(unsigned long __unused,...) +{ + struct switch_stack *sw = (struct switch_stack *) &__unused; + struct pt_regs *regs = (struct pt_regs *) (sw + 1); + unsigned long usp = rdusp(); + struct rt_sigframe *frame = (struct rt_sigframe *)(usp - 4); + sigset_t set; + int er0; + + if (verify_area(VERIFY_READ, frame, sizeof(*frame))) + goto badframe; + if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) + goto badframe; + + sigdelsetmask(&set, ~_BLOCKABLE); + spin_unlock_irq(¤t->sig->siglock); + current->blocked = set; + recalc_sigpending(); + spin_lock_irq(¤t->sig->siglock); + + if (rt_restore_ucontext(regs, sw, &frame->uc, &er0)) + goto badframe; + return er0; + +badframe: + force_sig(SIGSEGV, current); + return 0; +} + +static void setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, + unsigned long mask) +{ + sc->sc_mask = mask; + sc->sc_usp = rdusp(); + sc->sc_er0 = regs->er0; + sc->sc_er1 = regs->er1; + sc->sc_er2 = regs->er2; + sc->sc_er3 = regs->er3; + sc->sc_ccr = regs->ccr; + sc->sc_pc = regs->pc; +} + +static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs) +{ + struct switch_stack *sw = (struct switch_stack *)regs - 1; + greg_t *gregs = uc->uc_mcontext.gregs; + int err = 0; + + err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version); + err |= __put_user(regs->er0, &gregs[0]); + err |= __put_user(regs->er1, &gregs[1]); + err |= __put_user(regs->er2, &gregs[2]); + err |= __put_user(regs->er3, &gregs[3]); + err |= __put_user(sw->er4, &gregs[4]); + err |= __put_user(sw->er5, &gregs[5]); + err |= __put_user(sw->er6, &gregs[6]); + err |= __put_user(rdusp(), &gregs[7]); + err |= __put_user(regs->pc, &gregs[8]); + err |= __put_user(regs->ccr, &gregs[9]); + return err; +} + +static inline void * +get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) +{ + unsigned long usp; + + /* Default to using normal stack. */ + usp = rdusp(); + + /* This is the X/Open sanctioned signal stack switching. */ + if (ka->sa.sa_flags & SA_ONSTACK) { + if (!on_sig_stack(usp)) + usp = current->sas_ss_sp + current->sas_ss_size; + } + return (void *)((usp - frame_size) & -8UL); +} + +static void setup_frame (int sig, struct k_sigaction *ka, + sigset_t *set, struct pt_regs *regs) +{ + struct sigframe *frame; + struct sigcontext context; + int err = 0; + + frame = get_sigframe(ka, regs, sizeof(*frame)); + + err |= __put_user((current_thread_info()->exec_domain + && current_thread_info()->exec_domain->signal_invmap + && sig < 32 + ? current_thread_info()->exec_domain->signal_invmap[sig] + : sig), + &frame->sig); + + err |= __put_user(&frame->sc, &frame->psc); + + if (_NSIG_WORDS > 1) + err |= copy_to_user(frame->extramask, &set->sig[1], + sizeof(frame->extramask)); + + setup_sigcontext(&context, regs, set->sig[0]); + err |= copy_to_user (&frame->sc, &context, sizeof(context)); + + /* Set up to return from userspace. */ + err |= __put_user(frame->retcode, &frame->pretcode); + + /* sub.l er0,er0; mov.b #__NR_sigreturn,r0l; trapa #0 */ + err != __put_user(0x1a80f800 + (__NR_sigreturn & 0xff), + (long *)(frame->retcode + 0)); + err |= __put_user(0x5700, (short *)(frame->retcode + 4)); + + + if (err) + goto give_sigsegv; + + /* Set up registers for signal handler */ + wrusp ((unsigned long) frame); + regs->pc = (unsigned long) ka->sa.sa_handler; + + return; + +give_sigsegv: + if (sig == SIGSEGV) + ka->sa.sa_handler = SIG_DFL; + force_sig(SIGSEGV, current); +} + +static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info, + sigset_t *set, struct pt_regs *regs) +{ + struct rt_sigframe *frame; + int err = 0; + + frame = get_sigframe(ka, regs, sizeof(*frame)); + + err |= __put_user((current_thread_info()->exec_domain + && current_thread_info()->exec_domain->signal_invmap + && sig < 32 + ? current_thread_info()->exec_domain->signal_invmap[sig] + : sig), + &frame->sig); + err |= __put_user(&frame->info, &frame->pinfo); + err |= __put_user(&frame->uc, &frame->puc); + err |= copy_siginfo_to_user(&frame->info, info); + + /* Create the ucontext. */ + err |= __put_user(0, &frame->uc.uc_flags); + err |= __put_user(0, &frame->uc.uc_link); + err |= __put_user((void *)current->sas_ss_sp, + &frame->uc.uc_stack.ss_sp); + err |= __put_user(sas_ss_flags(rdusp()), + &frame->uc.uc_stack.ss_flags); + err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); + err |= rt_setup_ucontext(&frame->uc, regs); + err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set)); + + /* Set up to return from userspace. */ + err |= __put_user(frame->retcode, &frame->pretcode); + + /* moveq #,d0; notb d0; movea.l #,a5; trap #0 */ + /* sub.l er0,er0; mov.b #__NR_rt_sigreturn,r0l; trapa #0 */ + err != __put_user(0x1a80f800 + (__NR_rt_sigreturn & 0xff), + (long *)(frame->retcode + 0)); + err |= __put_user(0x5700, (short *)(frame->retcode + 4)); + + if (err) + goto give_sigsegv; + + /* Set up registers for signal handler */ + wrusp ((unsigned long) frame); + regs->pc = (unsigned long) ka->sa.sa_handler; + + return; + +give_sigsegv: + if (sig == SIGSEGV) + ka->sa.sa_handler = SIG_DFL; + force_sig(SIGSEGV, current); +} + +static inline void +handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler) +{ + switch (regs->er0) { + case -ERESTARTNOHAND: + if (!has_handler) + goto do_restart; + regs->er0 = -EINTR; + break; + + case -ERESTARTSYS: + if (has_handler && !(ka->sa.sa_flags & SA_RESTART)) { + regs->er0 = -EINTR; + break; + } + /* fallthrough */ + case -ERESTARTNOINTR: + do_restart: + regs->er0 = regs->orig_er0; + regs->pc -= 2; + break; + } +} + +/* + * OK, we're invoking a handler + */ +static void +handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, + sigset_t *oldset, struct pt_regs *regs) +{ + /* are we from a system call? */ + if (regs->orig_er0 >= 0) + /* If so, check system call restarting.. */ + handle_restart(regs, ka, 1); + + /* set up the stack frame */ + if (ka->sa.sa_flags & SA_SIGINFO) + setup_rt_frame(sig, ka, info, oldset, regs); + else + setup_frame(sig, ka, oldset, regs); + + if (ka->sa.sa_flags & SA_ONESHOT) + ka->sa.sa_handler = SIG_DFL; + + if (!(ka->sa.sa_flags & SA_NODEFER)) { + spin_lock_irq(¤t->sig->siglock); + sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); + sigaddset(¤t->blocked,sig); + recalc_sigpending(); + spin_unlock_irq(¤t->sig->siglock); + } +} + +/* + * Note that 'init' is a special process: it doesn't get signals it doesn't + * want to handle. Thus you cannot kill init even with a SIGKILL even by + * mistake. + * + * Note that we go through the signals twice: once to check the signals + * that the kernel can handle, and then we build all the user-level signal + * handling stack-frames in one go after that. + */ +asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs) +{ + siginfo_t info; + struct k_sigaction *ka; + + current->thread.esp0 = (unsigned long) regs; + + if (!oldset) + oldset = ¤t->blocked; + + for (;;) { + int signr; + + signr = get_signal_to_deliver(&info, regs); + + if (!signr) + break; + + if ((current->ptrace & PT_PTRACED) && signr != SIGKILL) { + current->exit_code = signr; + current->state = TASK_STOPPED; + + /* Did we come from a system call? */ + if (regs->orig_er0 >= 0) { + /* Restart the system call the same way as + if the process were not traced. */ + struct k_sigaction *ka = + ¤t->sig->action[signr-1]; + int has_handler = + (ka->sa.sa_handler != SIG_IGN && + ka->sa.sa_handler != SIG_DFL); + handle_restart(regs, ka, has_handler); + } + notify_parent(current, SIGCHLD); + schedule(); + + /* We're back. Did the debugger cancel the sig? */ + if (!(signr = current->exit_code)) { + discard_frame: + continue; + } + current->exit_code = 0; + + /* The debugger continued. Ignore SIGSTOP. */ + if (signr == SIGSTOP) + goto discard_frame; + + /* Update the siginfo structure. Is this good? */ + if (signr != info.si_signo) { + info.si_signo = signr; + info.si_errno = 0; + info.si_code = SI_USER; + info.si_pid = current->parent->pid; + info.si_uid = current->parent->uid; + } + + /* If the (new) signal is now blocked, requeue it. */ + if (sigismember(¤t->blocked, signr)) { + send_sig_info(signr, &info, current); + continue; + } + } + + ka = ¤t->sig->action[signr-1]; + if (ka->sa.sa_handler == SIG_IGN) { + if (signr != SIGCHLD) + continue; + /* Check for SIGCHLD: it's special. */ + while (sys_wait4(-1, NULL, WNOHANG, NULL) > 0) + /* nothing */; + continue; + } + + if (ka->sa.sa_handler == SIG_DFL) { + int exit_code = signr; + + if (current->pid == 1) + continue; + + switch (signr) { + case SIGCONT: case SIGCHLD: + case SIGWINCH: case SIGURG: + continue; + + case SIGTSTP: case SIGTTIN: case SIGTTOU: + if (is_orphaned_pgrp(current->pgrp)) + continue; + /* FALLTHRU */ + + case SIGSTOP: { + struct signal_struct *sig; + current->state = TASK_STOPPED; + current->exit_code = signr; + sig = current->parent->sig; + if (sig && !(sig->action[SIGCHLD-1].sa.sa_flags +& SA_NOCLDSTOP)) + notify_parent(current, SIGCHLD); + schedule(); + continue; + } + + case SIGQUIT: case SIGILL: case SIGTRAP: + case SIGIOT: case SIGFPE: case SIGSEGV: + case SIGBUS: case SIGSYS: case SIGXCPU: case SIGXFSZ: + if (do_coredump(signr, regs)) + exit_code |= 0x80; + /* FALLTHRU */ + + default: + sig_exit(signr, exit_code, &info); + /* NOTREACHED */ + } + } + + /* Whee! Actually deliver the signal. */ + handle_signal(signr, ka, &info, oldset, regs); + return 1; + } + + /* Did we come from a system call? */ + if (regs->orig_er0 >= 0) + /* Restart the system call - no handlers present */ + handle_restart(regs, NULL, 0); + + return 0; +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/kernel/sys_h8300.c linux-2.5.64-ac4/arch/h8300/kernel/sys_h8300.c --- linux-2.5.64/arch/h8300/kernel/sys_h8300.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/kernel/sys_h8300.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,289 @@ +/* + * linux/arch/h8300/kernel/sys_h8300.c + * + * This file contains various random system calls that + * have a non-standard calling sequence on the H8/300 + * platform. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +/* + * sys_pipe() is the normal C calling standard for creating + * a pipe. It's not the way unix traditionally does this, though. + */ +asmlinkage int sys_pipe(unsigned long * fildes) +{ + int fd[2]; + int error; + + error = do_pipe(fd); + if (!error) { + if (copy_to_user(fildes, fd, 2*sizeof(int))) + error = -EFAULT; + } + return error; +} + +/* common code for old and new mmaps */ +static inline long do_mmap2( + unsigned long addr, unsigned long len, + unsigned long prot, unsigned long flags, + unsigned long fd, unsigned long pgoff) +{ + int error = -EBADF; + struct file * file = NULL; + + flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); + if (!(flags & MAP_ANONYMOUS)) { + file = fget(fd); + if (!file) + goto out; + } + + down_write(¤t->mm->mmap_sem); + error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); + up_write(¤t->mm->mmap_sem); + + if (file) + fput(file); +out: + return error; +} + +asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, + unsigned long prot, unsigned long flags, + unsigned long fd, unsigned long pgoff) +{ + return do_mmap2(addr, len, prot, flags, fd, pgoff); +} + +/* + * Perform the select(nd, in, out, ex, tv) and mmap() system + * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to + * handle more than 4 system call parameters, so these system calls + * used a memory block for parameter passing.. + */ + +struct mmap_arg_struct { + unsigned long addr; + unsigned long len; + unsigned long prot; + unsigned long flags; + unsigned long fd; + unsigned long offset; +}; + +asmlinkage int old_mmap(struct mmap_arg_struct *arg) +{ + struct mmap_arg_struct a; + int error = -EFAULT; + + if (copy_from_user(&a, arg, sizeof(a))) + goto out; + + error = -EINVAL; + if (a.offset & ~PAGE_MASK) + goto out; + + a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); + + error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); +out: + return error; +} + +#if 0 /* DAVIDM - do we want this */ +struct mmap_arg_struct64 { + __u32 addr; + __u32 len; + __u32 prot; + __u32 flags; + __u64 offset; /* 64 bits */ + __u32 fd; +}; + +asmlinkage long sys_mmap64(struct mmap_arg_struct64 *arg) +{ + int error = -EFAULT; + struct file * file = NULL; + struct mmap_arg_struct64 a; + unsigned long pgoff; + + if (copy_from_user(&a, arg, sizeof(a))) + return -EFAULT; + + if ((long)a.offset & ~PAGE_MASK) + return -EINVAL; + + pgoff = a.offset >> PAGE_SHIFT; + if ((a.offset >> PAGE_SHIFT) != pgoff) + return -EINVAL; + + if (!(a.flags & MAP_ANONYMOUS)) { + error = -EBADF; + file = fget(a.fd); + if (!file) + goto out; + } + a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); + + down_write(¤t->mm->mmap_sem); + error = do_mmap_pgoff(file, a.addr, a.len, a.prot, a.flags, pgoff); + up_write(¤t->mm->mmap_sem); + if (file) + fput(file); +out: + return error; +} +#endif + +extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); + +struct sel_arg_struct { + unsigned long n; + fd_set *inp, *outp, *exp; + struct timeval *tvp; +}; + +asmlinkage int old_select(struct sel_arg_struct *arg) +{ + struct sel_arg_struct a; + + if (copy_from_user(&a, arg, sizeof(a))) + return -EFAULT; + /* sys_select() does the appropriate kernel locking */ + return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); +} + +/* + * sys_ipc() is the de-multiplexer for the SysV IPC calls.. + * + * This is really horribly ugly. + */ +asmlinkage int sys_ipc (uint call, int first, int second, + int third, void *ptr, long fifth) +{ + int version, ret; + + version = call >> 16; /* hack for backward compatibility */ + call &= 0xffff; + + if (call <= SEMCTL) + switch (call) { + case SEMOP: + return sys_semop (first, (struct sembuf *)ptr, second); + case SEMGET: + return sys_semget (first, second, third); + case SEMCTL: { + union semun fourth; + if (!ptr) + return -EINVAL; + if (get_user(fourth.__pad, (void **) ptr)) + return -EFAULT; + return sys_semctl (first, second, third, fourth); + } + default: + return -EINVAL; + } + if (call <= MSGCTL) + switch (call) { + case MSGSND: + return sys_msgsnd (first, (struct msgbuf *) ptr, + second, third); + case MSGRCV: + switch (version) { + case 0: { + struct ipc_kludge tmp; + if (!ptr) + return -EINVAL; + if (copy_from_user (&tmp, + (struct ipc_kludge *)ptr, + sizeof (tmp))) + return -EFAULT; + return sys_msgrcv (first, tmp.msgp, second, + tmp.msgtyp, third); + } + default: + return sys_msgrcv (first, + (struct msgbuf *) ptr, + second, fifth, third); + } + case MSGGET: + return sys_msgget ((key_t) first, second); + case MSGCTL: + return sys_msgctl (first, second, + (struct msqid_ds *) ptr); + default: + return -EINVAL; + } + if (call <= SHMCTL) + switch (call) { + case SHMAT: + switch (version) { + default: { + ulong raddr; + ret = sys_shmat (first, (char *) ptr, + second, &raddr); + if (ret) + return ret; + return put_user (raddr, (ulong *) third); + } + } + case SHMDT: + return sys_shmdt ((char *)ptr); + case SHMGET: + return sys_shmget (first, second, third); + case SHMCTL: + return sys_shmctl (first, second, + (struct shmid_ds *) ptr); + default: + return -EINVAL; + } + + return -EINVAL; +} + +asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on) +{ + return -ENOSYS; +} + +/* sys_cacheflush -- no support. */ +asmlinkage int +sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len) +{ + return -EINVAL; +} + +asmlinkage int sys_getpagesize(void) +{ + return PAGE_SIZE; +} + +#if defined(CONFIG_SYSCALL_PRINT) +asmlinkage void syscall_print(void *dummy,...) +{ + struct pt_regs *regs = (struct pt_regs *) ((unsigned char *)&dummy); + unsigned long *usp=rdusp()+8; + printk("call %06x:%d 1:%08x,2:%08x,3:%08x,ret:%08x\n", + ((*usp) & 0xffffff)-2,regs->orig_er0,regs->er1,regs->er2,regs->er3,regs->er0); +} +#endif diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/kernel/sys_h8300.c.new linux-2.5.64-ac4/arch/h8300/kernel/sys_h8300.c.new --- linux-2.5.64/arch/h8300/kernel/sys_h8300.c.new 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/kernel/sys_h8300.c.new 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,299 @@ +/* + * linux/arch/h8300/kernel/sys_h8300.c + * + * This file contains various random system calls that + * have a non-standard calling sequence on the H8/300 + * platform. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +/* + * sys_pipe() is the normal C calling standard for creating + * a pipe. It's not the way unix traditionally does this, though. + */ +asmlinkage int sys_pipe(unsigned long * fildes) +{ + int fd[2]; + int error; + + error = do_pipe(fd); + if (!error) { + if (copy_to_user(fildes, fd, 2*sizeof(int))) + error = -EFAULT; + } + return error; +} + +/* common code for old and new mmaps */ +static inline long do_mmap2( + unsigned long addr, unsigned long len, + unsigned long prot, unsigned long flags, + unsigned long fd, unsigned long pgoff) +{ + int error = -EBADF; + struct file * file = NULL; + + flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); + if (!(flags & MAP_ANONYMOUS)) { + file = fget(fd); + if (!file) + goto out; + } + + down_write(¤t->mm->mmap_sem); + error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); + up_write(¤t->mm->mmap_sem); + + if (file) + fput(file); +out: + return error; +} + +asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, + unsigned long prot, unsigned long flags, + unsigned long fd, unsigned long pgoff) +{ + return do_mmap2(addr, len, prot, flags, fd, pgoff); +} + +/* + * Perform the select(nd, in, out, ex, tv) and mmap() system + * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to + * handle more than 4 system call parameters, so these system calls + * used a memory block for parameter passing.. + */ + +struct mmap_arg_struct { + unsigned long addr; + unsigned long len; + unsigned long prot; + unsigned long flags; + unsigned long fd; + unsigned long offset; +}; + +asmlinkage int old_mmap(struct mmap_arg_struct *arg) +{ + struct mmap_arg_struct a; + int error = -EFAULT; + + if (copy_from_user(&a, arg, sizeof(a))) + goto out; + + error = -EINVAL; + if (a.offset & ~PAGE_MASK) + goto out; + + a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); + + error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); +out: + return error; +} + +#if 0 /* DAVIDM - do we want this */ +struct mmap_arg_struct64 { + __u32 addr; + __u32 len; + __u32 prot; + __u32 flags; + __u64 offset; /* 64 bits */ + __u32 fd; +}; + +asmlinkage long sys_mmap64(struct mmap_arg_struct64 *arg) +{ + int error = -EFAULT; + struct file * file = NULL; + struct mmap_arg_struct64 a; + unsigned long pgoff; + + if (copy_from_user(&a, arg, sizeof(a))) + return -EFAULT; + + if ((long)a.offset & ~PAGE_MASK) + return -EINVAL; + + pgoff = a.offset >> PAGE_SHIFT; + if ((a.offset >> PAGE_SHIFT) != pgoff) + return -EINVAL; + + if (!(a.flags & MAP_ANONYMOUS)) { + error = -EBADF; + file = fget(a.fd); + if (!file) + goto out; + } + a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); + + down_write(¤t->mm->mmap_sem); + error = do_mmap_pgoff(file, a.addr, a.len, a.prot, a.flags, pgoff); + up_write(¤t->mm->mmap_sem); + if (file) + fput(file); +out: + return error; +} +#endif + +extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); + +struct sel_arg_struct { + unsigned long n; + fd_set *inp, *outp, *exp; + struct timeval *tvp; +}; + +asmlinkage int old_select(struct sel_arg_struct *arg) +{ + struct sel_arg_struct a; + + if (copy_from_user(&a, arg, sizeof(a))) + return -EFAULT; + /* sys_select() does the appropriate kernel locking */ + return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); +} + +/* + * sys_ipc() is the de-multiplexer for the SysV IPC calls.. + * + * This is really horribly ugly. + */ +asmlinkage int sys_ipc (uint call, int first, int second, + int third, void *ptr, long fifth) +{ + int version, ret; + + version = call >> 16; /* hack for backward compatibility */ + call &= 0xffff; + + if (call <= SEMCTL) + switch (call) { + case SEMOP: + return sys_semop (first, (struct sembuf *)ptr, second); + case SEMGET: + return sys_semget (first, second, third); + case SEMCTL: { + union semun fourth; + if (!ptr) + return -EINVAL; + if (get_user(fourth.__pad, (void **) ptr)) + return -EFAULT; + return sys_semctl (first, second, third, fourth); + } + default: + return -EINVAL; + } + if (call <= MSGCTL) + switch (call) { + case MSGSND: + return sys_msgsnd (first, (struct msgbuf *) ptr, + second, third); + case MSGRCV: + switch (version) { + case 0: { + struct ipc_kludge tmp; + if (!ptr) + return -EINVAL; + if (copy_from_user (&tmp, + (struct ipc_kludge *)ptr, + sizeof (tmp))) + return -EFAULT; + return sys_msgrcv (first, tmp.msgp, second, + tmp.msgtyp, third); + } + default: + return sys_msgrcv (first, + (struct msgbuf *) ptr, + second, fifth, third); + } + case MSGGET: + return sys_msgget ((key_t) first, second); + case MSGCTL: + return sys_msgctl (first, second, + (struct msqid_ds *) ptr); + default: + return -EINVAL; + } + if (call <= SHMCTL) + switch (call) { + case SHMAT: + switch (version) { + default: { + ulong raddr; + ret = sys_shmat (first, (char *) ptr, + second, &raddr); + if (ret) + return ret; + return put_user (raddr, (ulong *) third); + } + } + case SHMDT: + return sys_shmdt ((char *)ptr); + case SHMGET: + return sys_shmget (first, second, third); + case SHMCTL: + return sys_shmctl (first, second, + (struct shmid_ds *) ptr); + default: + return -EINVAL; + } + + return -EINVAL; +} + +asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on) +{ + return -ENOSYS; +} + +/* sys_cacheflush -- no support. */ +asmlinkage int +sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len) +{ + return -EINVAL; +} + +asmlinkage int sys_getpagesize(void) +{ + return PAGE_SIZE; +} + +/* + * Old cruft + */ +asmlinkage int sys_pause(void) +{ + current->state = TASK_INTERRUPTIBLE; + schedule(); + return -ERESTARTNOHAND; +} + +#if defined(CONFIG_SYSCALL_PRINT) +asmlinkage void syscall_print(void *dummy,...) +{ + struct pt_regs *regs = (struct pt_regs *) ((unsigned char *)&dummy); + unsigned long *usp=rdusp()+8; + printk("call %06x:%d 1:%08x,2:%08x,3:%08x,ret:%08x\n", + ((*usp) & 0xffffff)-2,regs->orig_er0,regs->er1,regs->er2,regs->er3,regs->er0); +} +#endif diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/kernel/time.c linux-2.5.64-ac4/arch/h8300/kernel/time.c --- linux-2.5.64/arch/h8300/kernel/time.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/kernel/time.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,162 @@ +/* + * linux/arch/h8300/kernel/time.c + * + * Yoshinori Sato + * + * Copied/hacked from: + * + * linux/arch/m68k/kernel/time.c + * + * Copyright (C) 1991, 1992, 1995 Linus Torvalds + * + * This file contains the m68k-specific time handling details. + * Most of the stuff is located in the machine specific files. + * + * 1997-09-10 Updated NTP code according to technical memorandum Jan '96 + * "A Kernel Model for Precision Timekeeping" by Dave Mills + */ + +#include /* CONFIG_HEARTBEAT */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define TICK_SIZE (tick_nsec / 1000) + +u64 jiffies_64; + +static inline void do_profile (unsigned long pc) +{ + if (prof_buffer && current->pid) { + extern int _stext; + pc -= (unsigned long) &_stext; + pc >>= prof_shift; + if (pc < prof_len) + ++prof_buffer[pc]; + else + /* + * Don't ignore out-of-bounds PC values silently, + * put them into the last histogram slot, so if + * present, they will show up as a sharp peak. + */ + ++prof_buffer[prof_len-1]; + } +} + +/* + * timer_interrupt() needs to keep up the real-time clock, + * as well as call the "do_timer()" routine every clocktick + */ +static void timer_interrupt(int irq, void *dummy, struct pt_regs * regs) +{ + /* last time the cmos clock got updated */ + static long last_rtc_update=0; + + /* may need to kick the hardware timer */ + platform_timer_eoi(); + + do_timer(regs); + + if (!user_mode(regs)) + do_profile(regs->pc); + +#ifdef CONFIG_HEARTBEAT + /* use power LED as a heartbeat instead -- much more useful + for debugging -- based on the version for PReP by Cort */ + /* acts like an actual heart beat -- ie thump-thump-pause... */ + if (mach_heartbeat) { + static unsigned cnt = 0, period = 0, dist = 0; + + if (cnt == 0 || cnt == dist) + mach_heartbeat( 1 ); + else if (cnt == 7 || cnt == dist+7) + mach_heartbeat( 0 ); + + if (++cnt > period) { + cnt = 0; + /* The hyperbolic function below modifies the heartbeat period + * length in dependency of the current (5min) load. It goes + * through the points f(0)=126, f(1)=86, f(5)=51, + * f(inf)->30. */ + period = ((672<= 1000000) { + usec -= 1000000; + sec++; + } + + tv->tv_sec = sec; + tv->tv_usec = usec; +} + +void do_settimeofday(struct timeval *tv) +{ + write_lock_irq(&xtime_lock); + /* This is revolting. We need to set the xtime.tv_usec + * correctly. However, the value in this location is + * is value at the last tick. + * Discover what correction gettimeofday + * would have done, and then undo it! + */ + while (tv->tv_usec < 0) { + tv->tv_usec += 1000000; + tv->tv_sec--; + } + + xtime.tv_sec = tv->tv_sec; + xtime.tv_nsec = (tv->tv_usec * 1000); + time_adjust = 0; /* stop active adjtime() */ + time_status |= STA_UNSYNC; + time_maxerror = NTP_PHASE_LIMIT; + time_esterror = NTP_PHASE_LIMIT; + write_unlock_irq(&xtime_lock); +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/kernel/traps.c linux-2.5.64-ac4/arch/h8300/kernel/traps.c --- linux-2.5.64/arch/h8300/kernel/traps.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/kernel/traps.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,124 @@ +/* + * linux/arch/h8300/boot/traps.c -- general exception handling code + * H8/300 support Yoshinori Sato + * + * Cloned from Linux/m68k. + * + * No original Copyright holder listed, + * Probabily original (C) Roman Zippel (assigned DJD, 1999) + * + * Copyright 1999-2000 D. Jeff Dionne, + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive + * for more details. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +/* + * this must be called very early as the kernel might + * use some instruction that are emulated on the 060 + */ + +void __init base_trap_init(void) +{ +} + +void __init trap_init (void) +{ +} + +asmlinkage void set_esp0 (unsigned long ssp) +{ + current->thread.esp0 = ssp; +} + +/* + * Generic dumping code. Used for panic and debug. + */ + +static void dump(struct pt_regs *fp) +{ + unsigned long *sp; + unsigned char *tp; + int i; + + printk("\nCURRENT PROCESS:\n\n"); +#if 0 +{ + extern int swt_lastjiffies, swt_reference; + printk("WATCHDOG: jiffies=%d lastjiffies=%d [%d] reference=%d\n", + jiffies, swt_lastjiffies, (swt_lastjiffies - jiffies), + swt_reference); +} +#endif + printk("COMM=%s PID=%d\n", current->comm, current->pid); + if (current->mm) { + printk("TEXT=%08x-%08x DATA=%08x-%08x BSS=%08x-%08x\n", + (int) current->mm->start_code, + (int) current->mm->end_code, + (int) current->mm->start_data, + (int) current->mm->end_data, + (int) current->mm->end_data, + (int) current->mm->brk); + printk("USER-STACK=%08x KERNEL-STACK=%08x\n\n", + (int) current->mm->start_stack, + (int) PAGE_SIZE+(unsigned long)current); + } + + printk("PC: %08lx\n", (long)fp->pc); + printk("CCR: %08lx SP: %08lx\n", fp->ccr, (long) fp); + printk("ER0: %08lx ER1: %08lx ER2: %08lx ER3: %08lx\n", + fp->er0, fp->er1, fp->er2, fp->er3); + printk("\nCODE:"); + tp = ((unsigned char *) fp->pc) - 0x20; + for (sp = (unsigned long *) tp, i = 0; (i < 0x40); i += 4) { + if ((i % 0x10) == 0) + printk("\n%08x: ", (int) (tp + i)); + printk("%08x ", (int) *sp++); + } + printk("\n"); + + printk("\nKERNEL STACK:"); + tp = ((unsigned char *) fp) - 0x40; + for (sp = (unsigned long *) tp, i = 0; (i < 0xc0); i += 4) { + if ((i % 0x10) == 0) + printk("\n%08x: ", (int) (tp + i)); + printk("%08x ", (int) *sp++); + } + printk("\n"); + if (STACK_MAGIC != *(unsigned long *)((unsigned long)current+PAGE_SIZE)) + printk("(Possibly corrupted stack page??)\n"); + + printk("\n\n"); +} + +void show_trace_task(struct task_struct *tsk) +{ + /* DAVIDM: we can do better, need a proper stack dump */ + printk("STACK ksp=0x%lx, usp=0x%lx\n", tsk->thread.ksp, tsk->thread.usp); +} + +void die_if_kernel (char *str, struct pt_regs *fp, int nr) +{ + extern int console_loglevel; + + if (!(fp->ccr & PS_S)) + return; + + console_loglevel = 15; + dump(fp); + + do_exit(SIGSEGV); +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/lib/ashrdi3.c linux-2.5.64-ac4/arch/h8300/lib/ashrdi3.c --- linux-2.5.64/arch/h8300/lib/ashrdi3.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/lib/ashrdi3.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,63 @@ +/* ashrdi3.c extracted from gcc-2.7.2/libgcc2.c which is: */ +/* Copyright (C) 1989, 1992, 1993, 1994, 1995 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. + +GNU CC 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. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#define BITS_PER_UNIT 8 + +typedef int SItype __attribute__ ((mode (SI))); +typedef unsigned int USItype __attribute__ ((mode (SI))); +typedef int DItype __attribute__ ((mode (DI))); +typedef int word_type __attribute__ ((mode (__word__))); + +struct DIstruct {SItype high, low;}; + +typedef union +{ + struct DIstruct s; + DItype ll; +} DIunion; + +DItype +__ashrdi3 (DItype u, word_type b) +{ + DIunion w; + word_type bm; + DIunion uu; + + if (b == 0) + return u; + + uu.ll = u; + + bm = (sizeof (SItype) * BITS_PER_UNIT) - b; + if (bm <= 0) + { + /* w.s.high = 1..1 or 0..0 */ + w.s.high = uu.s.high >> (sizeof (SItype) * BITS_PER_UNIT - 1); + w.s.low = uu.s.high >> -bm; + } + else + { + USItype carries = (USItype)uu.s.high << bm; + w.s.high = uu.s.high >> b; + w.s.low = ((USItype)uu.s.low >> b) | carries; + } + + return w.ll; +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/lib/checksum.c linux-2.5.64-ac4/arch/h8300/lib/checksum.c --- linux-2.5.64/arch/h8300/lib/checksum.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/lib/checksum.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,156 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * IP/TCP/UDP checksumming routines + * + * Authors: Jorge Cwik, + * Arnt Gulbrandsen, + * Tom May, + * Andreas Schwab, + * Lots of code moved from tcp.c and ip.c; see those files + * for more names. + * + * 03/02/96 Jes Sorensen, Andreas Schwab, Roman Hodek: + * Fixed some nasty bugs, causing some horrible crashes. + * A: At some points, the sum (%0) was used as + * length-counter instead of the length counter + * (%1). Thanks to Roman Hodek for pointing this out. + * B: GCC seems to mess up if one uses too many + * data-registers to hold input values and one tries to + * specify d0 and d1 as scratch registers. Letting gcc choose these + * registers itself solves the problem. + * + * This program 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 of the License, or (at your option) any later version. + */ + +/* Revised by Kenneth Albanowski for m68knommu. Basic problem: unaligned access kills, so most + of the assembly has to go. */ + +#include + +static inline unsigned short from32to16(unsigned long x) +{ + /* add up 16-bit and 16-bit for 16+c bit */ + x = (x & 0xffff) + (x >> 16); + /* add up carry.. */ + x = (x & 0xffff) + (x >> 16); + return x; +} + +static unsigned long do_csum(const unsigned char * buff, int len) +{ + int odd, count; + unsigned long result = 0; + + if (len <= 0) + goto out; + odd = 1 & (unsigned long) buff; + if (odd) { + result = *buff; + len--; + buff++; + } + count = len >> 1; /* nr of 16-bit words.. */ + if (count) { + if (2 & (unsigned long) buff) { + result += *(unsigned short *) buff; + count--; + len -= 2; + buff += 2; + } + count >>= 1; /* nr of 32-bit words.. */ + if (count) { + unsigned long carry = 0; + do { + unsigned long w = *(unsigned long *) buff; + count--; + buff += 4; + result += carry; + result += w; + carry = (w > result); + } while (count); + result += carry; + result = (result & 0xffff) + (result >> 16); + } + if (len & 2) { + result += *(unsigned short *) buff; + buff += 2; + } + } + if (len & 1) + result += (*buff << 8); + result = from32to16(result); + if (odd) + result = ((result >> 8) & 0xff) | ((result & 0xff) << 8); +out: + return result; +} + +/* + * This is a version of ip_compute_csum() optimized for IP headers, + * which always checksum on 4 octet boundaries. + */ +unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl) +{ + return ~do_csum(iph,ihl*4); +} + +/* + * computes the checksum of a memory block at buff, length len, + * and adds in "sum" (32-bit) + * + * returns a 32-bit number suitable for feeding into itself + * or csum_tcpudp_magic + * + * this function must be called with even lengths, except + * for the last fragment, which may be odd + * + * it's best to have buff aligned on a 32-bit boundary + */ +unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) +{ + unsigned int result = do_csum(buff, len); + + /* add in old sum, and carry.. */ + result += sum; + /* 16+c bits -> 16 bits */ + result = (result & 0xffff) + (result >> 16); + return result; +} + +/* + * this routine is used for miscellaneous IP-like checksums, mainly + * in icmp.c + */ +unsigned short ip_compute_csum(const unsigned char * buff, int len) +{ + return ~do_csum(buff,len); +} + +/* + * copy from fs while checksumming, otherwise like csum_partial + */ + +unsigned int +csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *csum_err) +{ + if (csum_err) *csum_err = 0; + memcpy(dst, src, len); + return csum_partial(dst, len, sum); +} + +/* + * copy from ds while checksumming, otherwise like csum_partial + */ + +unsigned int +csum_partial_copy(const char *src, char *dst, int len, int sum) +{ + memcpy(dst, src, len); + return csum_partial(dst, len, sum); +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/lib/Makefile linux-2.5.64-ac4/arch/h8300/lib/Makefile --- linux-2.5.64/arch/h8300/lib/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/lib/Makefile 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,11 @@ +# +# Makefile for H8/300-specific library files.. +# + +.S.o: + $(CC) $(AFLAGS) -D__ASSEMBLY__ -c $< -o $@ + +L_TARGET = lib.a +obj-y = ashrdi3.o checksum.o memcpy.o memset.o abs.o + +include $(TOPDIR)/Rules.make diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/lib/memcpy.S linux-2.5.64-ac4/arch/h8300/lib/memcpy.S --- linux-2.5.64/arch/h8300/lib/memcpy.S 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/lib/memcpy.S 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,79 @@ +;;; memcpy.S + +#include + + .h8300h + + .text +.global SYMBOL_NAME(memcpy) + +;;; void *memcpy(void *to, void *from, size_t n) +SYMBOL_NAME_LABEL(memcpy) + mov.l er2,er2 + bne 1f + rts +1: + ;; address check + bld #0,r0l + bxor #0,r1l + bcs 4f + mov.l er4,@-sp + mov.l er0,@-sp + btst #0,r0l + beq 1f + ;; (aligned even) odd address + mov.b @er1,r3l + mov.b r3l,@er0 + adds #1,er1 + adds #1,er0 + dec.l #1,er2 + beq 3f +1: + ;; n < sizeof(unsigned long) check + sub.l er4,er4 + adds #4,er4 ; loop count check value + cmp.l er4,er2 + blo 2f + ;; unsigned long copy +1: + mov.l @er1,er3 + mov.l er3,@er0 + adds #4,er0 + adds #4,er1 + subs #4,er2 + cmp.l er4,er2 + bcc 1b + ;; rest +2: + mov.l er2,er2 + beq 3f +1: + mov.b @er1,r3l + mov.b r3l,@er0 + adds #1,er1 + adds #1,er0 + dec.l #1,er2 + bne 1b +3: + mov.l @sp+,er0 + mov.l @sp+,er4 + rts + + ;; odd <- even / even <- odd +4: + mov.l er4,er3 + mov.l er2,er4 + mov.l er5,er2 + mov.l er1,er5 + mov.l er6,er1 + mov.l er0,er6 +1: + eepmov.w + mov.w r4,r4 + bne 1b + dec.w #1,e4 + bpl 1b + mov.l er1,er6 + mov.l er2,er5 + mov.l er3,er4 + rts diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/lib/memset.S linux-2.5.64-ac4/arch/h8300/lib/memset.S --- linux-2.5.64/arch/h8300/lib/memset.S 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/lib/memset.S 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,56 @@ +/* memset.S */ + +#include + + .h8300h + .text + +.global SYMBOL_NAME(memset) + +;;void *memset(*ptr, int c, size_t count) +;; ptr = er0 +;; c = er1(r1l) +;; count = er2 +SYMBOL_NAME_LABEL(memset) + mov.l er2,er2 + beq 7f + mov.l er0,@-sp + btst #0,r0l + beq 2f + + ;; odd address +1: + mov.b r1l,@er0 + adds #1,er0 + dec.l #1,er2 + beq 6f + + ;; even address +2: + mov.l er2,er3 + cmp.l #4,er2 + blo 4f + ;; count>=4 -> count/4 + shlr.l er2 + shlr.l er2 + ;; byte -> long + mov.b r1l,r1h + mov.w r1,e1 +3: + mov.l er1,@er0 + adds #4,er0 + dec.l #1,er2 + bne 3b +4: + ;; count % 4 + and.b #3,r3l + beq 6f +5: + mov.b r1l,@er0 + adds #1,er0 + dec.b r3l + bne 5b +6: + mov.l @sp+,er0 +7: + rts diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/Makefile linux-2.5.64-ac4/arch/h8300/Makefile --- linux-2.5.64/arch/h8300/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/Makefile 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,62 @@ +# +# arch/h8300/Makefile +# +# This file is subject to the terms and conditions of the GNU General Public +# License. See the file "COPYING" in the main directory of this archive +# for more details. +# +# (C) Copyright 2002, Yoshinori Sato +# +ifndef include-config +-include $(TOPDIR)/.config +endif + +platform-$(CONFIG_H8300H) := h8300h +PLATFORM := $(platform-y) + +board-$(CONFIG_H8300H_GENERIC) := generic +board-$(CONFIG_H8300H_AKI3068NET) := ucsimm +board-$(CONFIG_H8300H_H8MAX) := ucdimm +board-$(CONFIG_H8300H_SIM) := generic +BOARD := $(board-y) + +model-$(CONFIG_RAMKERNEL) := ram +model-$(CONFIG_ROMKERNEL) := rom +MODEL := $(model-y) + +cflags-$(CONFIG_H8300H) := -mh +ldflags-$(CONFIG_H8300H) := -mh8300helf + +CFLAGS += $(cflags-y) +CFLAGS += -mint32 -fno-builtin +CFLAGS += -O2 -g +CFLAGS += -D__linux__ +CFLAGS += -DUTS_SYSNAME=\"uClinux\" -DTARGET=$(BOARD) +AFLAGS += -DPLATFORM=$(PLATFORM) -DTARGET=$(BOARD) -DMODEL=$(MODEL) +LDFLAGS += $(ldflags-y) + +CROSS_COMPILE = h8300-elf- +HEAD := arch/$(ARCH)/platform/$(platform-y)/$(board-y)/crt0_$(model-y).o +LIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(CFLAGS) -print-libgcc-file-name) + +core-y += arch/$(ARCH)/kernel/ \ + arch/$(ARCH)/mm/ \ + arch/$(ARCH)/platform/$(PLATFORM)/ \ + arch/$(ARCH)/platform/$(PLATFORM)/$(BOARD)/ + +libs-y += arch/$(ARCH)/lib/ $(LIBGCC) + +export MODEL + +archmrproper: + +archclean: + $(call descend arch/$(ARCH)/platform, subdirclean) + +prepare: include/asm-$(ARCH)/asm-offsets.h + +include/asm-$(ARCH)/asm-offsets.h: arch/$(ARCH)/kernel/asm-offsets.s \ + include/asm include/linux/version.h + @echo -n ' Generating $@' + @$(generate-asm-offsets.h) < $< > $@.tmp + @$(update-if-changed) diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/mm/fault.c linux-2.5.64-ac4/arch/h8300/mm/fault.c --- linux-2.5.64/arch/h8300/mm/fault.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/mm/fault.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,58 @@ +/* + * linux/arch/h8300/mm/fault.c + * + * Copyright (C) 1998 D. Jeff Dionne , + * Copyright (C) 2000 Lineo, Inc. (www.lineo.com) + * + * Based on: + * + * linux/arch/m68knommu/mm/fault.c + * linux/arch/m68k/mm/fault.c + * + * Copyright (C) 1995 Hamish Macdonald + */ + +#include +#include +#include +#include + +#include +#include + +extern void die_if_kernel(char *, struct pt_regs *, long); + +/* + * This routine handles page faults. It determines the problem, and + * then passes it off to one of the appropriate routines. + * + * error_code: + * bit 0 == 0 means no page found, 1 means protection fault + * bit 1 == 0 means read, 1 means write + * + * If this routine detects a bad access, it returns 1, otherwise it + * returns 0. + */ +asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address, + unsigned long error_code) +{ +#ifdef DEBUG + printk ("regs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld\n", + regs->sr, regs->pc, address, error_code); +#endif + +/* + * Oops. The kernel tried to access some bad page. We'll have to + * terminate things with extreme prejudice. + */ + if ((unsigned long) address < PAGE_SIZE) { + printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); + } else + printk(KERN_ALERT "Unable to handle kernel access"); + printk(" at virtual address %08lx\n",address); + die_if_kernel("Oops", regs, error_code); + do_exit(SIGKILL); + + return 1; +} + diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/mm/init.c linux-2.5.64-ac4/arch/h8300/mm/init.c --- linux-2.5.64/arch/h8300/mm/init.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/mm/init.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,235 @@ +/* + * linux/arch/h8300/mm/init.c + * + * Copyright (C) 1998 D. Jeff Dionne , + * Kenneth Albanowski , + * Copyright (C) 2000 Lineo, Inc. (www.lineo.com) + * + * Based on: + * + * linux/arch/m68knommu/mm/init.c + * linux/arch/m68k/mm/init.c + * + * Copyright (C) 1995 Hamish Macdonald + * + * JAN/1999 -- hacked to support ColdFire (gerg@snapgear.com) + * DEC/2000 -- linux 2.4 support + */ + +#include +#include +#include +#include +#include +#include +#include +#ifdef CONFIG_BLK_DEV_RAM +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#undef DEBUG + +extern void die_if_kernel(char *,struct pt_regs *,long); +extern void free_initmem(void); + +/* + * BAD_PAGE is the page that is used for page faults when linux + * is out-of-memory. Older versions of linux just did a + * do_exit(), but using this instead means there is less risk + * for a process dying in kernel mode, possibly leaving a inode + * unused etc.. + * + * BAD_PAGETABLE is the accompanying page-table: it is initialized + * to point to BAD_PAGE entries. + * + * ZERO_PAGE is a special page that is used for zero-initialized + * data and COW. + */ +static unsigned long empty_bad_page_table; + +static unsigned long empty_bad_page; + +unsigned long empty_zero_page; + +extern unsigned long rom_length; + +void show_mem(void) +{ + unsigned long i; + int free = 0, total = 0, reserved = 0, shared = 0; + int cached = 0; + + printk("\nMem-info:\n"); + show_free_areas(); + i = max_mapnr; + while (i-- > 0) { + total++; + if (PageReserved(mem_map+i)) + reserved++; + else if (PageSwapCache(mem_map+i)) + cached++; + else if (!page_count(mem_map+i)) + free++; + else + shared += page_count(mem_map+i) - 1; + } + printk("%d pages of RAM\n",total); + printk("%d free pages\n",free); + printk("%d reserved pages\n",reserved); + printk("%d pages shared\n",shared); + printk("%d pages swap cached\n",cached); +} + +extern unsigned long memory_start; +extern unsigned long memory_end; + +/* + * paging_init() continues the virtual memory environment setup which + * was begun by the code in arch/head.S. + * The parameters are pointers to where to stick the starting and ending + * addresses of available kernel virtual memory. + */ +void paging_init(void) +{ + /* + * Make sure start_mem is page aligned, otherwise bootmem and + * page_alloc get different views og the world. + */ +#ifdef DEBUG + unsigned long start_mem = PAGE_ALIGN(memory_start); +#endif + unsigned long end_mem = memory_end & PAGE_MASK; + +#ifdef DEBUG + printk ("start_mem is %#lx\nvirtual_end is %#lx\n", + start_mem, end_mem); +#endif + + /* + * Initialize the bad page table and bad page to point + * to a couple of allocated pages. + */ + empty_bad_page_table = (unsigned long)alloc_bootmem_pages(PAGE_SIZE); + empty_bad_page = (unsigned long)alloc_bootmem_pages(PAGE_SIZE); + empty_zero_page = (unsigned long)alloc_bootmem_pages(PAGE_SIZE); + memset((void *)empty_zero_page, 0, PAGE_SIZE); + + /* + * Set up SFC/DFC registers (user data space). + */ + set_fs (USER_DS); + +#ifdef DEBUG + printk ("before free_area_init\n"); + + printk ("free_area_init -> start_mem is %#lx\nvirtual_end is %#lx\n", + start_mem, end_mem); +#endif + + { + unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0}; + + zones_size[ZONE_DMA] = 0 >> PAGE_SHIFT; + zones_size[ZONE_NORMAL] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT; +#ifdef CONFIG_HIGHMEM + zones_size[ZONE_HIGHMEM] = 0; +#endif + free_area_init(zones_size); + } +} + +void mem_init(void) +{ + int codek = 0, datak = 0, initk = 0; + /* DAVIDM look at setup memory map generically with reserved area */ + unsigned long tmp; + extern char _etext, _stext, _sdata, _ebss, __init_begin, __init_end; + extern unsigned char _ramend, _ramstart; + unsigned long len = &_ramend - &_ramstart; + unsigned long start_mem = memory_start; /* DAVIDM - these must start at end of kernel */ + unsigned long end_mem = memory_end; /* DAVIDM - this must not include kernel stack at top */ + +#ifdef DEBUG + printk("Mem_init: start=%lx, end=%lx\n", start_mem, end_mem); +#endif + + end_mem &= PAGE_MASK; + high_memory = (void *) end_mem; + + start_mem = PAGE_ALIGN(start_mem); + max_mapnr = num_physpages = MAP_NR(high_memory); + + /* this will put all memory onto the freelists */ + totalram_pages = free_all_bootmem(); + + codek = (&_etext - &_stext) >> 10; + datak = (&_ebss - &_sdata) >> 10; + initk = (&__init_begin - &__init_end) >> 10; + + tmp = nr_free_pages() << PAGE_SHIFT; + printk("Memory available: %luk/%luk RAM, %luk/%luk ROM (%dk kernel code, %dk data)\n", + tmp >> 10, + len >> 10, + (rom_length > 0) ? ((rom_length >> 10) - codek) : 0, + rom_length >> 10, + codek, + datak + ); +} + + +#ifdef CONFIG_BLK_DEV_INITRD +void free_initrd_mem(unsigned long start, unsigned long end) +{ + int pages = 0; + for (; start < end; start += PAGE_SIZE) { + ClearPageReserved(virt_to_page(start)); + set_page_count(virt_to_page(start), 1); + free_page(start); + totalram_pages++; + pages++; + } + printk ("Freeing initrd memory: %dk freed\n", pages); +} +#endif + +void +free_initmem() +{ +#ifdef CONFIG_RAMKERNEL + unsigned long addr; + extern char __init_begin, __init_end; +/* + * the following code should be cool even if these sections + * are not page aligned. + */ + addr = PAGE_ALIGN((unsigned long)(&__init_begin)); + /* next to check that the page we free is not a partial page */ + for (; addr + PAGE_SIZE < (unsigned long)(&__init_end); addr +=PAGE_SIZE) { + ClearPageReserved(virt_to_page(addr)); + set_page_count(virt_to_page(addr), 1); + free_page(addr); + totalram_pages++; + } + printk("Freeing unused kernel memory: %ldk freed (0x%x - 0x%x)\n", + (addr - PAGE_ALIGN((long) &__init_begin)) >> 10, + (int)(PAGE_ALIGN((unsigned long)(&__init_begin))), + (int)(addr - PAGE_SIZE)); +#endif +} + diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/mm/kmap.c linux-2.5.64-ac4/arch/h8300/mm/kmap.c --- linux-2.5.64/arch/h8300/mm/kmap.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/mm/kmap.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,59 @@ +/* + * linux/arch/h8300/mm/kmap.c + * + * Based on + * linux/arch/m68knommu/mm/kmap.c + * + * Copyright (C) 2000 Lineo, + * Copyright (C) 2000-2002 David McCullough + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#undef DEBUG + +/* + * Map some physical address range into the kernel address space. + */ +void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag) +{ + return (void *)physaddr; +} + +/* + * Unmap a ioremap()ed region again. + */ +void iounmap(void *addr) +{ +} + +/* + * __iounmap unmaps nearly everything, so be careful + * it doesn't free currently pointer/page tables anymore but it + * wans't used anyway and might be added later. + */ +void __iounmap(void *addr, unsigned long size) +{ +} + +/* + * Set new cache mode for some kernel address space. + * The caller must push data for that range itself, if such data may already + * be in the cache. + */ +void kernel_set_cachemode(void *addr, unsigned long size, int cmode) +{ +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/mm/Makefile linux-2.5.64-ac4/arch/h8300/mm/Makefile --- linux-2.5.64/arch/h8300/mm/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/mm/Makefile 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,12 @@ +# +# Makefile for the linux m68k-specific parts of the memory manager. +# +# Note! Dependencies are done automagically by 'make dep', which also +# removes any old dependencies. DON'T put your own dependencies here +# unless it's something special (ie not a .c file). +# +# Note 2! The CFLAGS definition is now in the main makefile... + +obj-y := init.o fault.o memory.o kmap.o + +include $(TOPDIR)/Rules.make diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/mm/memory.c linux-2.5.64-ac4/arch/h8300/mm/memory.c --- linux-2.5.64/arch/h8300/mm/memory.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/mm/memory.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,70 @@ +/* + * linux/arch/h8300/mm/memory.c + * + * Copyright (C) 2002 Yoshinori Sato , + * + * Based on: + * + * linux/arch/m68knommu/mm/memory.c + * + * Copyright (C) 1998 Kenneth Albanowski , + * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com) + * + * Based on: + * + * linux/arch/m68k/mm/memory.c + * + * Copyright (C) 1995 Hamish Macdonald + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +void cache_clear (unsigned long paddr, int len) +{ +} + + +void cache_push (unsigned long paddr, int len) +{ +} + +void cache_push_v (unsigned long vaddr, int len) +{ +} + +/* Map some physical address range into the kernel address space. The + * code is copied and adapted from map_chunk(). + */ + +unsigned long kernel_map(unsigned long paddr, unsigned long size, + int nocacheflag, unsigned long *memavailp ) +{ + return paddr; +} + +#ifdef MAGIC_ROM_PTR + +int is_in_rom(unsigned long addr) +{ + /* Anything not in operational RAM is returned as in rom! */ + if (addr < _ramstart || addr >= _ramend) + return 1; + else + return 0; +} + +#endif + diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/platform/h8300h/aki3068net/crt0_ram.S linux-2.5.64-ac4/arch/h8300/platform/h8300h/aki3068net/crt0_ram.S --- linux-2.5.64/arch/h8300/platform/h8300h/aki3068net/crt0_ram.S 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/platform/h8300h/aki3068net/crt0_ram.S 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,109 @@ +/* + * linux/arch/h8300/platform/h8300h/aki3068net/crt0_ram.S + * + * Yoshinori Sato + * + * Platform depend startup for uClinux-2.4.x + * Target Archtecture: AE-3068 (aka. aki3068net) + * Memory Layout : RAM + */ + +#define ASSEMBLY + +#include +#include + + .global SYMBOL_NAME(_start) + .global SYMBOL_NAME(command_line) + .global SYMBOL_NAME(_platform_gpio_table) + .global SYMBOL_NAME(_target_name) + + .h8300h + + .section .text + .file "crt0_ram.S" + + /* CPU Reset entry */ +SYMBOL_NAME_LABEL(_start) + mov.l #__ramend,sp + ldc #0x80,ccr + + /* Peripheral Setup */ + + /* .bss clear */ + mov.l #__sbss,er5 + mov.l er5,er6 + inc.l #1,er6 + mov.l #__ebss,er4 + sub.l er5,er4 + sub.w r0,r0 + mov.b r0l,@er5 +1: + eepmov.w + dec.w #1,e4 + bpl 1b + + /* copy kernel commandline */ + mov.l #COMMAND_START,er5 + mov.l #SYMBOL_NAME(command_line),er6 + mov.w #512,r4 + eepmov.w + + /* RAM Interrupt Vector Table Setup */ +#if defined(CONFIG_GDB_DEBUG) + mov.l @SYMBOL_NAME(interrupt_redirect_table)+11*4,er0 +#endif + mov.l #SYMBOL_NAME(_vector_lma),er5 + mov.l #SYMBOL_NAME(interrupt_redirect_table),er6 + mov.w #0x100,r4 + eepmov.w +#if defined(CONFIG_GDB_DEBUG) + mov.l er0,@SYMBOL_NAME(interrupt_redirect_table)+11*4 +#endif + + /* uClinux kernel start */ + ldc #0x90,ccr /* running kernel */ + mov.l #SYMBOL_NAME(init_task_union),sp + mov.l sp,@SYMBOL_NAME(_current_task) + add.l #0x2000,sp + jsr @_start_kernel +_exit: + + jmp _exit + + rts + + /* I/O port assign information */ +__platform_gpio_table: + mov.l #gpio_table,er0 + rts + +gpio_table: + ;; P1DDR + .byte 0xff,0xff + ;; P2DDR + .byte 0xff,0xff + ;; P3DDR + .byte 0xff,0x00 + ;; P4DDR + .byte 0x00,0x00 + ;; P5DDR + .byte 0x01,0x01 + ;; P6DDR + .byte 0x00,0x00 + ;; dummy + .byte 0x00,0x00 + ;; P8DDR + .byte 0x0c,0x0c + ;; P9DDR + .byte 0x00,0x00 + ;; PADDR + .byte 0x00,0x00 + ;; PBDDR + .byte 0x30,0x30 + +__target_name: + .asciz "AE-3068" + + .section .bootvec,"ax" + jmp @SYMBOL_NAME(_start) diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/platform/h8300h/aki3068net/Makefile linux-2.5.64-ac4/arch/h8300/platform/h8300h/aki3068net/Makefile --- linux-2.5.64/arch/h8300/platform/h8300h/aki3068net/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/platform/h8300h/aki3068net/Makefile 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,18 @@ +# +# Makefile for the linux kernel. +# +# Note! Dependencies are done automagically by 'make dep', which also +# removes any old dependencies. DON'T put your own dependencies here +# unless it's something special (ie not a .c file). +# + +all: $(BOARD).o +O_TARGET := $(BOARD).o +obj-y := timer.o + +timer.o: timer.c + +clean: + rm -f *.[oa] + +include $(TOPDIR)/Rules.make diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/platform/h8300h/aki3068net/ram.ld linux-2.5.64-ac4/arch/h8300/platform/h8300h/aki3068net/ram.ld --- linux-2.5.64/arch/h8300/platform/h8300h/aki3068net/ram.ld 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/platform/h8300h/aki3068net/ram.ld 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,90 @@ +/* AE-3068 (aka. aki3068net) RAM */ + +OUTPUT_ARCH(h8300h) +ENTRY("__start") + +MEMORY + { + ram : ORIGIN = 0x400000, LENGTH = 0x600000-0x400000-0x80000 + disk : ORIGIN = 0x600000-0x80000, LENGTH = 0x60000 + eram : ORIGIN = 0x600000, LENGTH = 0 + iram : ORIGIN = 0xffbf20, LENGTH = 0x4000 + } + +SECTIONS +{ + .bootvec : + { + *(.bootvec) + } > ram + .text : + { + __stext = . ; + *(.text) + . = ALIGN(0x4) ; + *(.text.*) + . = ALIGN(0x4) ; + *(.kstrtab) + . = ALIGN(0x4) ; + *(.rodata*) + . = ALIGN(16); /* Exception table */ + ___start___ex_table = .; + *(__ex_table) + ___stop___ex_table = .; + + ___start___ksymtab = .; /* Kernel symbol table */ + *(__ksymtab) + ___stop___ksymtab = .; + + . = ALIGN(0x4) ; + __etext = . ; + } > ram + .data : + { + __sdata = . ; + ___data_start = . ; + *(.data) + *(.data.*) + *(.exitcall.exit) + + . = ALIGN(0x2000) ; + *(.data.init_task) + . = ALIGN(0x2000) ; + ___init_begin = .; + *(.text.init) + *(.data.init) + . = ALIGN(16); + ___setup_start = .; + *(.setup.init) + ___setup_end = .; + ___initcall_start = .; + *(.initcall.init) + . = ALIGN(4) ; + ___initcall_end = .; + ___init_end = .; + __edata = . ; + . = ALIGN(0x4) ; + __sbss = . ; + *(.bss) + . = ALIGN(0x4) ; + *(COMMON) + . = ALIGN(0x4) ; + __ebss = . ; + __end = . ; + __ramstart = .; + } > ram + .blkimg : + { + __ramend = . ; + __blkimg = . ; + } > disk + .ram_vec : AT(ADDR(.data) + SIZEOF(.data)) + { + *(.int_redirect) + } > iram + __vector_lma = LOADADDR(.ram_vec); + .dummy2 : + { + COMMAND_START = . - 0x200 ; + } > eram +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/platform/h8300h/aki3068net/timer.c linux-2.5.64-ac4/arch/h8300/platform/h8300h/aki3068net/timer.c --- linux-2.5.64/arch/h8300/platform/h8300h/aki3068net/timer.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/platform/h8300h/aki3068net/timer.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,46 @@ +/* + * linux/arch/h8300/platform/h8300h/aki3068net/timer.c + * + * Yoshinori Sato + * + * Platform depend Timer Handler + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#define TMR8CMA2 0x00ffff94 +#define TMR8TCSR2 0x00ffff92 +#define TMR8TCNT2 0x00ffff90 +#define CMFA 6 + +int platform_timer_setup(void (*timer_int)(int, void *, struct pt_regs *)) +{ + outb(CONFIG_CLK_FREQ*10/8192,TMR8CMA2); + outb(0x00,TMR8TCSR2); + request_irq(40,timer_int,0,"timer",0); + outb(0x40|0x08|0x03,TMR8TCNT2); +} + +void platform_timer_eoi(void) +{ + *(unsigned char *)TMR8TCSR2 &= ~(1 << CMFA); +} + +void platform_gettod(int *year, int *mon, int *day, int *hour, + int *min, int *sec) +{ + *year = *mon = *day = *hour = *min = *sec = 0; +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/platform/h8300h/entry.S linux-2.5.64-ac4/arch/h8300/platform/h8300h/entry.S --- linux-2.5.64/arch/h8300/platform/h8300h/entry.S 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/platform/h8300h/entry.S 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,391 @@ +/* -*- mode: asm -*- + * + * linux/arch/h8300/platform/h8300h/entry.S + * + * Yoshinori Sato + * + */ + +/* + * entry.S + * include exception/interrupt gateway + * system call entry + */ + +#include +#include +#include +#include +#include +#include + +#define PT_PTRACED 0x00000001 +#define PT_TRACESYS 0x00000002 +#define PT_DTRACE 0x00000004 /* delayed trace (used on m68k, i386) */ +#define PT_TRACESYSGOOD 0x00000008 +#define PT_PTRACE_CAP 0x00000010 /* ptracer can follow suid-exec */ + +ENOSYS = 38 + +LSIGTRAP = 5 + +SOFTIRQ_PENDING = 0 + +/* + * these are offsets into the task-struct + */ +state = 0 +flags = 4 +sigpending = 8 +need_resched = 20 +ptrace = 24 + +/* the following macro is used when enabling interrupts */ + +LER3 = 0 +LER2 = 4 +LER1 = 8 +LORIG = 12 +LCCR = 16 +LER0 = 18 +LVEC = 22 +LRET = 24 + + .h8300h + +/* CPU context save/restore macros. */ + + .macro SAVE_ALL + mov.l er0,@-sp + stc ccr,r0l + orc #0x10,ccr + btst #4,r0l + bne 1f + mov.l sp,@SYMBOL_NAME(sw_usp) + mov.l @sp,er0 + mov.l @SYMBOL_NAME(sw_ksp),sp + mov.l er0,@-sp + stc ccr,r0l + and #0xef,r0l + mov.w r0,@-sp + mov.l @(2:16,sp),er0 + bra 2f +1: + mov.l @sp,er0 + stc ccr,@-sp +2: + mov.l er0,@-sp + mov.l er1,@-sp + mov.l er2,@-sp + mov.l er3,@-sp + .endm + + .macro RESTORE_REGS + mov.w @(LCCR:16,sp),r0 + btst #4,r0l + bne 1f + mov.l @SYMBOL_NAME(sw_usp),er0 + mov.l @(LER0:16,sp),er1 + mov.l er1,@er0 +/* + mov.l @(LRET:16,sp),er1 + mov.l er1,@(8:16,er0) +*/ + mov.l @sp+,er3 + mov.l @sp+,er2 + mov.l @sp+,er1 + add.l #10,sp + mov.l sp,@SYMBOL_NAME(sw_ksp) + mov.l er0,sp + bra 2f +1: + mov.l @sp+,er3 + mov.l @sp+,er2 + mov.l @sp+,er1 + adds #4,sp + adds #2,sp +2: + mov.l @sp+,er0 + adds #4,sp + .endm + + .macro RESTORE_ALL + RESTORE_REGS + rte + .endm + +#define SWITCH_STACK_SIZE (3*4+12) /* includes return address */ + + .macro SAVE_SWITCH_STACK + mov.l er4,@-sp + mov.l er5,@-sp + mov.l er6,@-sp + .endm + + .macro RESTORE_SWITCH_STACK + mov.l @sp+,er6 + mov.l @sp+,er5 + mov.l @sp+,er4 + .endm + +.globl SYMBOL_NAME(system_call) +.globl SYMBOL_NAME(ret_from_exception) +.globl SYMBOL_NAME(ret_from_signal) +.globl SYMBOL_NAME(ret_from_interrupt), SYMBOL_NAME(bad_interrupt) +.globl SYMBOL_NAME(interrupt_redirect_table) +.globl SYMBOL_NAME(sw_ksp),SYMBOL_NAME(sw_usp) +.globl SYMBOL_NAME(resume) +.globl SYMBOL_NAME(sys_vfork) +.globl SYMBOL_NAME(syscall_trampoline) + + .section .int_redirect,"ax" +SYMBOL_NAME_LABEL(interrupt_redirect_table) + .rept 7 + .long 0 + .endr + jsr @interrupt_entry /* NMI */ + jmp @SYMBOL_NAME(system_call) /* TRAPA #0 (System call) */ + .long 0 + .long 0 + jmp @SYMBOL_NAME(trace_break) /* TRAPA #3 (breakpoint) */ + .rept 64-12 + jsr @interrupt_entry + .endr + + .section .text + .align 2 +interrupt_entry: + SAVE_ALL + mov.w @(LCCR,sp),r0 + btst #4,r0l + bne 1f + mov.l @SYMBOL_NAME(sw_usp),er0 + mov.l @(4:16,er0),er0 + bra 2f +1: + mov.l @(LVEC,sp),er0 +2: + sub.l #SYMBOL_NAME(interrupt_redirect_table),er0 + shlr.l er0 + shlr.l er0 + dec.l #1,er0 + mov.l sp,er1 + jsr @SYMBOL_NAME(process_int) + mov.l @SYMBOL_NAME(irq_stat)+SOFTIRQ_PENDING,er0 + beq 1f + jsr @SYMBOL_NAME(do_softirq) +1: + jmp @SYMBOL_NAME(ret_from_exception) + +SYMBOL_NAME_LABEL(reschedule) + /* save top of frame */ + mov.l sp,er0 + mov.l er0,@-sp + jsr @SYMBOL_NAME(set_esp0) + adds #4,sp + + mov.l #SYMBOL_NAME(ret_from_exception),er0 + mov.l er0,@-sp + jmp @SYMBOL_NAME(schedule) + +SYMBOL_NAME_LABEL(system_call) + subs #4,sp + SAVE_ALL + mov.l er0,er3 + mov.l #-ENOSYS,er0 + mov.l er0,@(LER0:16,sp) + + /* save top of frame */ + mov.l sp,er0 + mov.l er3,@-sp + jsr @SYMBOL_NAME(set_esp0) + mov.l @sp+,er3 + cmp.l #NR_syscalls,er3 + bcc SYMBOL_NAME(ret_from_exception):16 + shll.l er3 + shll.l er3 + mov.l #SYMBOL_NAME(sys_call_table),er0 + add.l er3,er0 + mov.l @er0,er0 + mov.l er0,er3 + beq SYMBOL_NAME(ret_from_exception):16 + mov.l @SYMBOL_NAME(_current_task),er2 + mov.b @((flags+3-(PT_TRACESYS >> 3)):16,er2),r2l + btst #(PT_TRACESYS & 7),r2l + bne 1f + mov.l @(LER1:16,sp),er0 + mov.l @(LER2:16,sp),er1 + mov.l @(LER3:16,sp),er2 + mov.l er5,@-sp + mov.l er4,@-sp + jsr @er3 + adds #4,sp + adds #4,sp + mov.l er0,@(LER0,sp) /* save the return value */ +#if defined(CONFIG_SYSCALL_PRINT) + jsr @SYMBOL_NAME(syscall_print) +#endif + jmp @SYMBOL_NAME(ret_from_exception) +1: + SAVE_SWITCH_STACK + mov.l er3,er5 /* save syscall entry */ + jsr SYMBOL_NAME(syscall_trace) + mov.l er5,er3 + RESTORE_SWITCH_STACK + mov.l @(LER1:16,sp),er0 + mov.l @(LER2:16,sp),er1 + mov.l @(LER3:16,sp),er2 + mov.l er4,@-sp + jsr @er3 + adds #4,sp + mov.l er0,@(LER0:16,sp) /* save the return value */ + SAVE_SWITCH_STACK + jsr SYMBOL_NAME(syscall_trace) + +SYMBOL_NAME_LABEL(ret_from_signal) + RESTORE_SWITCH_STACK + +SYMBOL_NAME_LABEL(ret_from_exception) + mov.b @(LCCR+1:16,sp),r0l + btst #4,r0l /* check if returning to kernel */ + bne 3f:16 /* if so, skip resched, signals */ + mov.l @SYMBOL_NAME(_current_task),er0 + mov.l @(need_resched:16,er0),er0 + beq 1f + jmp @SYMBOL_NAME(reschedule) +1: + mov.l @SYMBOL_NAME(_current_task),er0 + mov.l @(sigpending:16,er0),er1 + beq 2f:16 + mov.b @((flags+(PT_DTRACE >> 3)):16,er0),r1l + mov.b r1l,r1h + bclr #(PT_DTRACE & 7),r1h + mov.b r1h,@((flags+3-(PT_DTRACE >> 3)):16,er0) + btst #(PT_DTRACE & 7),r1l /* check for delayed trace */ + beq 1f + sub.l er2,er2 + inc.l #1,er2 + mov.l er0,er1 + sub.l er0,er0 + mov.b #LSIGTRAP,r0l + jsr @SYMBOL_NAME(send_sig) /* send_sig(LSIGTRAP,_current_task,1) */ + mov.l @SYMBOL_NAME(_current_task),er0 +1: + mov.l @(state:16,er0),er1 /* state */ + beq 1f + jmp @SYMBOL_NAME(reschedule) +1: + mov.l @(sigpending:16,er0),er1 + bne Lsignal_return:16 +2: + mov.l @((TASK_THREAD+THREAD_VFORK):16,er0),er1 + bne Lvfork_return +3: + RESTORE_ALL /* Does RTE */ + +Lvfork_return: + sub.l er2,er2 + mov.l er2,@((TASK_THREAD+THREAD_VFORK):16,er0) + mov.l @SYMBOL_NAME(sw_usp),er0 + mov.l er1,@(8:16,er0) + RESTORE_ALL + +Lsignal_return: + SAVE_SWITCH_STACK + mov.l sp,er1 + add #12,er1 + mov.l er2,er0 + jsr @SYMBOL_NAME(do_signal) + RESTORE_SWITCH_STACK + RESTORE_ALL + + SYMBOL_NAME_LABEL(resume) + /* + * Beware - when entering resume, offset of tss is in d1, + * prev (the current task) is in a0, next (the new task) + * is in a1 and d2.b is non-zero if the mm structure is + * shared between the tasks, so don't change these + * registers until their contents are no longer needed. + */ + + /* save sr */ + sub.w r3,r3 + stc ccr,r3l + mov.w r3,@(THREAD_CCR:16,er0) + SAVE_SWITCH_STACK + + /* disable interrupts */ + orc #0x80,ccr + mov.l @SYMBOL_NAME(sw_usp),er3 + mov.l er3,@(THREAD_USP:16,er0) + mov.l sp,@(THREAD_KSP:16,er0) + + /* get pointer to tss struct (a1 contains new task) */ + mov.l er1,@SYMBOL_NAME(_current_task) + + /* Skip address space switching if they are the same. */ + /* FIXME: what did we hack out of here, this does nothing! */ + + mov.l @(THREAD_USP:16,er1),er0 + mov.l er0,@SYMBOL_NAME(sw_usp) + mov.l @(THREAD_KSP:16,er1),sp + RESTORE_SWITCH_STACK + + /* restore status register */ + mov.w @(THREAD_CCR:16,er1),r3 + + ldc r3l,ccr + + rts + +/* Handler for uninitialized and spurious interrupts */ + +SYMBOL_NAME_LABEL(bad_interrupt) + mov.l @SYMBOL_NAME(num_spurious),er0 + inc.l #1,er0 + mov.l er0,@SYMBOL_NAME(num_spurious) + rts + +SYMBOL_NAME_LABEL(trace_break) + subs #4,sp + SAVE_ALL + sub.l er1,er1 + dec.l #1,er1 + mov.l er1,@(LORIG,sp) + mov.l sp,er0 + jsr @SYMBOL_NAME(set_esp0) + mov.l @SYMBOL_NAME(sw_usp),er0 + mov.l @er0,er1 + subs #2,er1 + mov.l er1,@er0 + and.w #0xff,e1 + mov.l er1,er0 + jsr @SYMBOL_NAME(trace_trap) + jmp @SYMBOL_NAME(ret_from_exception) + +SYMBOL_NAME_LABEL(sys_vfork) + SAVE_SWITCH_STACK + mov.l @SYMBOL_NAME(sw_usp),er6 + mov.l @(8:16,er6),er6 + mov.l sp,er0 + add.l #SWITCH_STACK_SIZE,er0 + jsr @SYMBOL_NAME(h8300_vfork) + mov.l @SYMBOL_NAME(_current_task),er5 + mov.l er6,@((TASK_THREAD+THREAD_VFORK):16,er5) + RESTORE_SWITCH_STACK + rts + +SYMBOL_NAME_LABEL(syscall_trampoline) + SAVE_SWITCH_STACK + mov.l er0,er6 + mov.l sp,er0 + add.l #SWITCH_STACK_SIZE,er0 + jsr @er6 + RESTORE_SWITCH_STACK + rts + + .section .bss +SYMBOL_NAME_LABEL(sw_ksp) + .space 4 +SYMBOL_NAME_LABEL(sw_usp) + .space 4 diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/platform/h8300h/generic/crt0_rom.S linux-2.5.64-ac4/arch/h8300/platform/h8300h/generic/crt0_rom.S --- linux-2.5.64/arch/h8300/platform/h8300h/generic/crt0_rom.S 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/platform/h8300h/generic/crt0_rom.S 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,118 @@ +/* + * linux/arch/h8300/platform/h8300h/generic/crt0_rom.S + * + * Yoshinori Sato + * + * Platform depend startup for uClinux-2.4.x + * Target Archtecture: generic + * Memory Layout : ROM + */ + +#define ASSEMBLY + +#include +#include + + .global SYMBOL_NAME(_start) + .global SYMBOL_NAME(_command_line) + .global SYMBOL_NAME(_platform_gpio_table) + .global SYMBOL_NAME(_target_name) + + .h8300h + .section .text + .file "crt0_rom.S" + + /* CPU Reset entry */ +SYMBOL_NAME_LABEL(_start) + mov.l #__ramend,sp + ldc #0x80,ccr + + /* Peripheral Setup */ + + /* .bss clear */ + mov.l #__sbss,er5 + mov.l er5,er6 + inc.l #1,er6 + mov.l #__ebss,er4 + sub.l er5,er4 + sub.w r0,r0 + mov.b r0l,@er5 +1: + eepmov.w + dec.w #1,e4 + bpl 1b + + /* copy .data */ +#if !defined(CONFIG_H8300H_SIM) + mov.l #__begin_data,er5 + mov.l #__sdata,er6 + mov.l #__edata,er4 + sub.l er6,er4 +1: + eepmov.w + dec.w #1,e4 + bpl 1b +#endif + + /* copy kernel commandline */ + mov.l #COMMAND_START,er5 + mov.l #SYMBOL_NAME(_command_line),er6 + mov.w #512,r4 + eepmov.w + + /* uClinux kernel start */ + ldc #0x90,ccr /* running kernel */ + mov.l #SYMBOL_NAME(init_thread_union),sp + mov.l sp,@SYMBOL_NAME(_current_task) + add.l #0x2000,sp + jsr @_start_kernel +_exit: + + jmp _exit + + rts + + /* I/O port assign information */ +__platform_gpio_table: + mov.l #gpio_table,er0 + rts + +gpio_table: + ;; P1DDR + .byte 0x00,0x00 + ;; P2DDR + .byte 0x00,0x00 + ;; P3DDR + .byte 0x00,0x00 + ;; P4DDR + .byte 0x00,0x00 + ;; P5DDR + .byte 0x00,0x00 + ;; P6DDR + .byte 0x00,0x00 + ;; dummy + .byte 0x00,0x00 + ;; P8DDR + .byte 0x00,0x00 + ;; P9DDR + .byte 0x00,0x00 + ;; PADDR + .byte 0x00,0x00 + ;; PBDDR + .byte 0x00,0x00 + +__target_name: + .asciz "generic" + + .section .bss +__command_line: + .space 512 + + /* interrupt vector */ + .section .vectors,"ax" + .long __start +vector = 1 + .rept 64-1 + .long _interrupt_redirect_table+vector*4 +vector = vector + 1 + .endr diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/platform/h8300h/generic/Makefile linux-2.5.64-ac4/arch/h8300/platform/h8300h/generic/Makefile --- linux-2.5.64/arch/h8300/platform/h8300h/generic/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/platform/h8300h/generic/Makefile 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,16 @@ +# +# Makefile for the linux kernel. +# +# Note! Dependencies are done automagically by 'make dep', which also +# removes any old dependencies. DON'T put your own dependencies here +# unless it's something special (ie not a .c file). +# + +obj-y := timer.o + +EXTRA_TARGETS := crt0_$(MODEL).o + +clean: + rm -f *.[oa] + +include $(TOPDIR)/Rules.make diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/platform/h8300h/generic/ram.ld linux-2.5.64-ac4/arch/h8300/platform/h8300h/generic/ram.ld --- linux-2.5.64/arch/h8300/platform/h8300h/generic/ram.ld 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/platform/h8300h/generic/ram.ld 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,76 @@ +/* AKI3068NET RAM */ + +OUTPUT_ARCH(h8300h) +ENTRY("__start") + +MEMORY + { + ram : ORIGIN = 0x400000, LENGTH = 0xA0000 +/* rdisk : ORIGIN = 0x4A0000, LENGTH = 0x70000 */ +/* uram : ORIGIN = 0x510000, LENGTH = 0xF0000 */ + uram : ORIGIN = 0x4A0000, LENGTH = 0x160000 + eram : ORIGIN = 0x600000, LENGTH = 0 + iram : ORIGIN = 0xffbf20, LENGTH = 0x4000 + } + +SECTIONS +{ + .bootvec : + { + *(.bootvec) + } > ram + .text : + { + __stext = . ; + *(.text) + __etext = . ; + } > ram + .rodata : + { + ___data_rom_start = ALIGN ( 4 ) ; + } > ram + .erom : + { + __erom = . ; + } > ram + .data : + { + __ramstart = . ; + __sdata = . ; + ___data_start = . ; + *(.data) + __edata = . ; + edata = ALIGN( 0x10 ) ; + ___data_end = ALIGN( 0x10 ) ; + } > ram + .bss : + { + __sbss = . ; + ___bss_start = . ; + *(.bss) + *(COMMON) + __ebss = . ; + ___bss_end = . ; + } > ram +/* + .rootimg : + { + __rootimage = . ; + } > rdisk +*/ + .dummy1 : + { + end = ALIGN( 0x10 ) ; + __end = ALIGN( 0x10 ) ; + } > uram + .ram_vec : AT(___bss_end) + { + __ram_vector = . ; + } > iram + __ram_vector_image = LOADADDR(.ram_vec) ; + .dummy2 : + { + _COMMAND_START = . - 0x200 ; + __ramend = . ; + } > eram +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/platform/h8300h/generic/rom.ld linux-2.5.64-ac4/arch/h8300/platform/h8300h/generic/rom.ld --- linux-2.5.64/arch/h8300/platform/h8300h/generic/rom.ld 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/platform/h8300h/generic/rom.ld 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,117 @@ +OUTPUT_ARCH(h8300h) +ENTRY("__start") + +/*INPUT(rootimage.o)*/ + +_jiffies = _jiffies_64 + 4; + +MEMORY + { + vector : ORIGIN = 0x000000, LENGTH = 0x000100 + rom : ORIGIN = 0x000100, LENGTH = 0x200000-0x000100 + erom : ORIGIN = 0x200000, LENGTH = 1 + ram : ORIGIN = 0x200000, LENGTH = 0x100000 + eram : ORIGIN = 0x2fa000, LENGTH = 1 + } + +SECTIONS +{ + .vectors : + { + __vector = . ; + *(.vectors*) + } > vector + .text : + { + *(.int_redirect) + __stext = . ; + *(.text) + . = ALIGN(0x4) ; + *(.exit.text) + *(.text.*) + . = ALIGN(0x4) ; + *(.exitcall.exit) + . = ALIGN(0x4) ; + *(.kstrtab) + . = ALIGN(0x4) ; + *(.rodata*) + . = ALIGN(16); /* Exception table */ + ___start___ex_table = .; + *(__ex_table) + ___stop___ex_table = .; + + ___start___ksymtab = .; /* Kernel symbol table */ + *(__ksymtab) + ___stop___ksymtab = .; + + . = ALIGN(0x4) ; + __etext = . ; + } > rom + .data : AT( ADDR(.text)+SIZEOF(.text)) + { + __sdata = . ; + ___data_start = . ; + + . = ALIGN(0x2000) ; + *(.data.init_task) + . = ALIGN(0x4) ; + *(.data) + . = ALIGN(0x4) ; + *(.data.*) + + . = ALIGN(0x4) ; + ___init_begin = .; + *(.init.text) + *(.init.data) + . = ALIGN(0x4) ; + ___setup_start = .; + *(.init.setup) + . = ALIGN(0x4) ; + ___setup_end = .; + + . = ALIGN(0x4) ; + ___initcall_start = .; + *(.initcall1.init) + *(.initcall2.init) + *(.initcall3.init) + *(.initcall4.init) + *(.initcall5.init) + *(.initcall6.init) + *(.initcall7.init) + ___initcall_end = .; + ___initramfs_start = .; + *(.init.initramfs) + ___initramfs_end = .; + . = ALIGN(0x4) ; + ___init_end = .; + + __edata = . ; + } > ram + __begin_data = LOADADDR(.data) ; + .blkimg : AT( LOADADDR(.data) + SIZEOF(.data)) + { + __blkimg = . ; + *(.rootimg*) + } > rom + .erom : + { + __erom = . ; + } > erom + .bss : + { + . = ALIGN(0x4) ; + __sbss = . ; + *(.bss) + . = ALIGN(0x4) ; + *(COMMON) + . = ALIGN(0x4) ; + __ebss = . ; + __end = . ; + __ramstart = .; + } > ram + .dummy : + { + COMMAND_START = . - 0x200 ; + __ramend = . ; + } > eram +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/platform/h8300h/generic/timer.c linux-2.5.64-ac4/arch/h8300/platform/h8300h/generic/timer.c --- linux-2.5.64/arch/h8300/platform/h8300h/generic/timer.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/platform/h8300h/generic/timer.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,81 @@ +/* + * linux/arch/h8300/platform/h8300h/generic/timer.c + * + * Yoshinori Sato + * + * Platform depend Timer Handler + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#if defined(CONFIG_H83007) || defined(CONFIG_H83068) +#define TMR8CMA2 0x00ffff94 +#define TMR8TCSR2 0x00ffff92 +#define TMR8TCNT2 0x00ffff90 + +int platform_timer_setup(void (*timer_int)(int, void *, struct pt_regs *)) +{ + outb(H8300_TIMER_COUNT_DATA,TMR8CMA2); + outb(0x00,TMR8TCSR2); + request_irq(40,timer_int,0,"timer",0); + outb(0x40|0x08|0x03,TMR8TCNT2); +} + +void platform_timer_eoi(void) +{ + __asm__("bclr #6,@0xffff92:8"); +} +#endif + +#if defined(H8_3002) || defined(CONFIG_H83048) +#define TSTR 0x00ffff60 +#define TSNC 0x00ffff61 +#define TMDR 0x00ffff62 +#define TFCR 0x00ffff63 +#define TOER 0x00ffff90 +#define TOCR 0x00ffff91 +#define TCR 0x00ffff64 +#define TIOR 0x00ffff65 +#define TIER 0x00ffff66 +#define TSR 0x00ffff67 +#define TCNT 0x00ffff68 +#define GRA 0x00ffff6a +#define GRB 0x00ffff6c + +int platform_timer_setup(void (*timer_int)(int, void *, struct pt_regs *)) +{ + *(unsigned short *)GRA= H8300_TIMER_COUNT_DATA; + *(unsigned short *)TCNT=0; + outb(0x23,TCR); + outb(0x00,TIOR); + request_irq(26,timer_int,0,"timer",0); + outb(inb(TIER) | 0x01,TIER); + outb(inb(TSNC) & ~0x01,TSNC); + outb(inb(TMDR) & ~0x01,TMDR); + outb(inb(TSTR) | 0x01,TSTR); +} + +void platform_timer_eoi(void) +{ + outb(inb(TSR) & ~0x01,TSR); +} +#endif + +void platform_gettod(int *year, int *mon, int *day, int *hour, + int *min, int *sec) +{ + *year = *mon = *day = *hour = *min = *sec = 0; +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/platform/h8300h/h8max/crt0_ram.S linux-2.5.64-ac4/arch/h8300/platform/h8300h/h8max/crt0_ram.S --- linux-2.5.64/arch/h8300/platform/h8300h/h8max/crt0_ram.S 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/platform/h8300h/h8max/crt0_ram.S 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,109 @@ +/* + * linux/arch/h8300/platform/h8300h/h8max/crt0_ram.S + * + * Yoshinori Sato + * + * Platform depend startup for uClinux-2.4.x + * Target Archtecture: H8MAX + * Memory Layout : RAM + */ + +#define ASSEMBLY + +#include +#include + + .global SYMBOL_NAME(_start) + .global SYMBOL_NAME(command_line) + .global SYMBOL_NAME(_platform_gpio_table) + .global SYMBOL_NAME(_target_name) + + .h8300h + + .section .text + .file "crt0_ram.S" + + /* CPU Reset entry */ +SYMBOL_NAME_LABEL(_start) + mov.l #__ramend,sp + ldc #0x80,ccr + + /* Peripheral Setup */ + + /* .bss clear */ + mov.l #__sbss,er5 + mov.l er5,er6 + inc.l #1,er6 + mov.l #__ebss,er4 + sub.l er5,er4 + sub.w r0,r0 + mov.b r0l,@er5 +1: + eepmov.w + dec.w #1,e4 + bpl 1b + + /* copy kernel commandline */ + mov.l #COMMAND_START,er5 + mov.l #SYMBOL_NAME(command_line),er6 + mov.w #512,r4 + eepmov.w + + /* RAM Interrupt Vector Table Setup */ +#if defined(CONFIG_GDB_DEBUG) + mov.l @SYMBOL_NAME(interrupt_redirect_table)+11*4,er0 +#endif + mov.l #SYMBOL_NAME(_vector_lma),er5 + mov.l #SYMBOL_NAME(interrupt_redirect_table),er6 + mov.w #0x100,r4 + eepmov.w +#if defined(CONFIG_GDB_DEBUG) + mov.l er0,@SYMBOL_NAME(interrupt_redirect_table)+11*4 +#endif + + /* uClinux kernel start */ + ldc #0x90,ccr /* running kernel */ + mov.l #SYMBOL_NAME(init_task_union),sp + mov.l sp,@SYMBOL_NAME(_current_task) + add.l #0x2000,sp + jsr @_start_kernel +_exit: + + jmp _exit + + rts + + /* I/O port assign information */ +__platform_gpio_table: + mov.l #gpio_table,er0 + rts + +gpio_table: + ;; P1DDR + .byte 0xff,0xff + ;; P2DDR + .byte 0xff,0xff + ;; P3DDR + .byte 0x00,0x00 + ;; P4DDR + .byte 0x00,0x00 + ;; P5DDR + .byte 0x01,0x01 + ;; P6DDR + .byte 0xf6,0xf6 + ;; dummy + .byte 0x00,0x00 + ;; P8DDR + .byte 0xee,0xee + ;; P9DDR + .byte 0x00,0x00 + ;; PADDR + .byte 0x00,0x00 + ;; PBDDR + .byte 0x30,0x30 + +__target_name: + .asciz "H8MAX" + + .section .bootvec,"ax" + jmp @SYMBOL_NAME(_start) diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/platform/h8300h/h8max/Makefile linux-2.5.64-ac4/arch/h8300/platform/h8300h/h8max/Makefile --- linux-2.5.64/arch/h8300/platform/h8300h/h8max/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/platform/h8300h/h8max/Makefile 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,18 @@ +# +# Makefile for the linux kernel. +# +# Note! Dependencies are done automagically by 'make dep', which also +# removes any old dependencies. DON'T put your own dependencies here +# unless it's something special (ie not a .c file). +# + +all: $(BOARD).o +O_TARGET := $(BOARD).o +obj-y := timer.o + +timer.o: timer.c + +clean: + rm -f *.[oa] + +include $(TOPDIR)/Rules.make diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/platform/h8300h/h8max/ram.ld linux-2.5.64-ac4/arch/h8300/platform/h8300h/h8max/ram.ld --- linux-2.5.64/arch/h8300/platform/h8300h/h8max/ram.ld 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/platform/h8300h/h8max/ram.ld 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,90 @@ +/* H8MAX RAM */ + +OUTPUT_ARCH(h8300h) +ENTRY("__start") + +MEMORY + { + ram : ORIGIN = 0x400000, LENGTH = 0x600000-0x400000-0xc000 + disk : ORIGIN = 0x600000-0xc000, LENGTH = 0xc000 + eram : ORIGIN = 0x600000, LENGTH = 0 + iram : ORIGIN = 0xfffd20, LENGTH = 0x100 + } + +SECTIONS +{ + .bootvec : + { + *(.bootvec) + } > ram + .text : + { + __stext = . ; + *(.text) + . = ALIGN(0x4) ; + *(.text.*) + . = ALIGN(0x4) ; + *(.kstrtab) + . = ALIGN(0x4) ; + *(.rodata*) + . = ALIGN(16); /* Exception table */ + ___start___ex_table = .; + *(__ex_table) + ___stop___ex_table = .; + + ___start___ksymtab = .; /* Kernel symbol table */ + *(__ksymtab) + ___stop___ksymtab = .; + + . = ALIGN(0x4) ; + __etext = . ; + } > ram + .data : + { + __sdata = . ; + ___data_start = . ; + *(.data) + *(.data.*) + *(.exitcall.exit) + + . = ALIGN(0x2000) ; + *(.data.init_task) + . = ALIGN(0x2000) ; + ___init_begin = .; + *(.text.init) + *(.data.init) + . = ALIGN(16); + ___setup_start = .; + *(.setup.init) + ___setup_end = .; + ___initcall_start = .; + *(.initcall.init) + . = ALIGN(4) ; + ___initcall_end = .; + ___init_end = .; + __edata = . ; + . = ALIGN(0x4) ; + __sbss = . ; + *(.bss) + . = ALIGN(0x4) ; + *(COMMON) + . = ALIGN(0x4) ; + __ebss = . ; + __end = . ; + __ramstart = .; + } > ram + .blkimg : + { + __ramend = . ; + __blkimg = . ; + } > disk + .ram_vec : AT(ADDR(.data) + SIZEOF(.data)) + { + *(.int_redirect) + } > iram + __vector_lma = LOADADDR(.ram_vec); + .dummy2 : + { + COMMAND_START = . - 0x200 ; + } > eram +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/platform/h8300h/h8max/timer.c linux-2.5.64-ac4/arch/h8300/platform/h8300h/h8max/timer.c --- linux-2.5.64/arch/h8300/platform/h8300h/h8max/timer.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/platform/h8300h/h8max/timer.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,46 @@ +/* + * linux/arch/h8300/platform/h8300h/h8max/timer.c + * + * Yoshinori Sato + * + * Platform depend Timer Handler + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#define TMR8CMA2 0x00ffff94 +#define TMR8TCSR2 0x00ffff92 +#define TMR8TCNT2 0x00ffff90 +#define CMFA 6 + +int platform_timer_setup(void (*timer_int)(int, void *, struct pt_regs *)) +{ + outb(CONFIG_CLK_FREQ*10/8192,TMR8CMA2); + outb(0x00,TMR8TCSR2); + request_irq(40,timer_int,0,"timer",0); + outb(0x40|0x08|0x03,TMR8TCNT2); +} + +void platform_timer_eoi(void) +{ + *(unsigned char *)TMR8TCSR2 &= ~(1 << CMFA); +} + +void platform_gettod(int *year, int *mon, int *day, int *hour, + int *min, int *sec) +{ + *year = *mon = *day = *hour = *min = *sec = 0; +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/platform/h8300h/ints.c linux-2.5.64-ac4/arch/h8300/platform/h8300h/ints.c --- linux-2.5.64/arch/h8300/platform/h8300h/ints.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/platform/h8300h/ints.c 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,251 @@ +/* + * linux/arch/h8300/platform/h8300h/ints.c + * + * Yoshinori Sato + * + * Based on linux/arch/$(ARCH)/platform/$(PLATFORM)/ints.c + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive + * for more details. + * + * Copyright 1996 Roman Zippel + * Copyright 1999 D. Jeff Dionne + */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#define INTERNAL_IRQS (64) + +#define EXT_IRQ0 12 +#define EXT_IRQ1 13 +#define EXT_IRQ2 14 +#define EXT_IRQ3 15 +#define EXT_IRQ4 16 +#define EXT_IRQ5 17 +#define EXT_IRQ6 18 +#define EXT_IRQ7 19 + +#define WDT_IRQ 20 + +/* table for system interrupt handlers */ +static irq_handler_t irq_list[SYS_IRQS]; + +/* The number of spurious interrupts */ +volatile unsigned int num_spurious; + +/* assembler routines */ +asmlinkage void system_call(void); +asmlinkage void bad_interrupt(void); + +/* irq node variables for the 32 (potential) on chip sources */ +/*static irq_node_t *int_irq_list[INTERNAL_IRQS];*/ +static int int_irq_count[INTERNAL_IRQS]; + +#if 0 +static void int_badint(int irq, void *dev_id, struct pt_regs *fp) +{ + num_spurious += 1; +} +#endif + +void init_IRQ(void) +{ + int i; + + for (i = 0; i < SYS_IRQS; i++) { + irq_list[i].handler = NULL; + irq_list[i].flags = 0; + irq_list[i].devname = NULL; + irq_list[i].dev_id = NULL; + } + +} + +int request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *), + unsigned long flags, const char *devname, void *dev_id) +{ + if (irq >= EXT_IRQ0 && irq <= EXT_IRQ3) { + if (H8300_GPIO_RESERVE(H8300_GPIO_P8, 1 << (irq - EXT_IRQ0)) == 0) + return 1; + H8300_GPIO_DDR(H8300_GPIO_P8, (irq - EXT_IRQ0), 0); + } + if (irq >= EXT_IRQ4 && irq <= EXT_IRQ5) { + if (H8300_GPIO_RESERVE(H8300_GPIO_P9, 1 << (irq - EXT_IRQ0)) == 0) + return 1; + H8300_GPIO_DDR(H8300_GPIO_P9, (irq - EXT_IRQ0), 0); + } + irq_list[irq].handler = handler; + irq_list[irq].flags = flags; + irq_list[irq].devname = devname; + irq_list[irq].dev_id = dev_id; + if (irq >= EXT_IRQ0 && irq <= EXT_IRQ5) + *(volatile unsigned char *)IER |= 1 << (irq - EXT_IRQ0); + return 0; +} + +void free_irq(unsigned int irq, void *dev_id) +{ + if (irq_list[irq].dev_id != dev_id) + printk("%s: Removing probably wrong IRQ %d from %s\n", + __FUNCTION__, irq, irq_list[irq].devname); + if (irq >= EXT_IRQ0 && irq <= EXT_IRQ5) + *(volatile unsigned char *)IER &= ~(1 << (irq - EXT_IRQ0)); + irq_list[irq].handler = NULL; + irq_list[irq].flags = 0; + irq_list[irq].dev_id = NULL; + irq_list[irq].devname = NULL; +} + +/* + * Do we need these probe functions on the m68k? + */ +unsigned long probe_irq_on (void) +{ + return 0; +} + +int probe_irq_off (unsigned long irqs) +{ + return 0; +} + +struct int_regs { + unsigned long ier; + unsigned long isr; + unsigned char mask; +}; + +#define REGS_DEF(ier,isr,mask) {ier,isr,mask} + +const struct int_regs interrupt_registers[]= { + REGS_DEF(IER,ISR,0x01), + REGS_DEF(IER,ISR,0x02), + REGS_DEF(IER,ISR,0x04), + REGS_DEF(IER,ISR,0x08), + REGS_DEF(IER,ISR,0x10), + REGS_DEF(IER,ISR,0x20), + REGS_DEF(IER,ISR,0x40), + REGS_DEF(IER,ISR,0x80), + REGS_DEF(TCSR,TCSR,0x20), + REGS_DEF(RTMCSR,RTMCSR,0x40), + REGS_DEF(0,0,0), + REGS_DEF(ADCSR,ADCSR,0x40), + REGS_DEF(TISRA,TISRA,0x10), + REGS_DEF(TISRB,TISRB,0x10), + REGS_DEF(TISRC,TISRC,0x10), + REGS_DEF(0,0,0), + REGS_DEF(TISRA,TISRA,0x20), + REGS_DEF(TISRB,TISRB,0x20), + REGS_DEF(TISRC,TISRC,0x20), + REGS_DEF(0,0,0), + REGS_DEF(TISRA,TISRA,0x40), + REGS_DEF(TISRB,TISRB,0x40), + REGS_DEF(TISRC,TISRC,0x40), + REGS_DEF(0,0,0), + REGS_DEF(_8TCR0,_8TCSR0,0x40), + REGS_DEF(_8TCR0,_8TCSR0,0x80), + REGS_DEF(_8TCR1,_8TCSR1,0xC0), + REGS_DEF(_8TCR0,_8TCSR0,0x20), + REGS_DEF(_8TCR2,_8TCSR2,0x40), + REGS_DEF(_8TCR2,_8TCSR2,0x80), + REGS_DEF(_8TCR3,_8TCSR3,0xC0), + REGS_DEF(_8TCR2,_8TCSR2,0x20), + REGS_DEF(DTCR0A,DTCR0A,0x0), + REGS_DEF(DTCR0B,DTCR0B,0x0), + REGS_DEF(DTCR1A,DTCR1A,0x0), + REGS_DEF(DTCR1B,DTCR1B,0x0), + REGS_DEF(0,0,0), + REGS_DEF(0,0,0), + REGS_DEF(0,0,0), + REGS_DEF(0,0,0), + REGS_DEF(SCR0,SSR0,0x40), + REGS_DEF(SCR0,SSR0,0x40), + REGS_DEF(SCR0,SSR0,0x80), + REGS_DEF(SCR0,SSR0,0x04), + REGS_DEF(SCR1,SSR1,0x40), + REGS_DEF(SCR1,SSR1,0x40), + REGS_DEF(SCR1,SSR1,0x80), + REGS_DEF(SCR1,SSR1,0x04), + REGS_DEF(SCR2,SSR2,0x40), + REGS_DEF(SCR2,SSR2,0x40), + REGS_DEF(SCR2,SSR2,0x80), + REGS_DEF(SCR2,SSR2,0x04) +}; + +void enable_irq(unsigned int irq) +{ + unsigned char ier; + const struct int_regs *regs=&interrupt_registers[irq - 12]; + if (irq == WDT_IRQ) { + ier = ctrl_inb(TCSR); + ier |= 0x20; + ctrl_outb((0xa500 | ier),TCSR); + } else { + if ((irq > 12) && regs->ier) { + ier = ctrl_inb(regs->ier); + ier |= regs->mask; + ctrl_outb(ier, regs->ier); + } else + panic("Unknown interrupt vector"); + } +} + +void disable_irq(unsigned int irq) +{ + unsigned char ier; + const struct int_regs *regs=&interrupt_registers[irq - 12]; + if (irq == WDT_IRQ) { + ier = ctrl_inb(TCSR); + ier &= ~0x20; + ctrl_outb((0xa500 | ier),TCSR); + } else { + if ((irq > 12) && regs->ier) { + ier = ctrl_inb(regs->ier); + ier &= ~(regs->mask); + ctrl_outb(ier, regs->ier); + } else + panic("Unknown interrupt vector"); + } +} + +asmlinkage void process_int(unsigned long vec, struct pt_regs *fp) +{ + irq_enter(); + if (irq_list[vec].handler) { + irq_list[vec].handler(vec, irq_list[vec].dev_id, fp); + int_irq_count[vec]++; + } else + panic("No interrupt handler for %ld\n", vec); + if (vec >= EXT_IRQ0 && vec <= EXT_IRQ5) + *(volatile unsigned char *)ISR &= ~(1 << (vec - EXT_IRQ0)); + irq_exit(); +} + +int show_interrupts(struct seq_file *p, void *v) +{ + int i; + + for (i = 0; i < NR_IRQS; i++) { + seq_printf(p, "%3d: %10u ",int_irq_count[i]); + seq_printf(p, "%s\n", irq_list[i].devname); + } + + return 0; +} + +void init_irq_proc(void) +{ +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/platform/h8300h/Makefile linux-2.5.64-ac4/arch/h8300/platform/h8300h/Makefile --- linux-2.5.64/arch/h8300/platform/h8300h/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/platform/h8300h/Makefile 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,24 @@ +# +# Makefile for the linux kernel. +# +# Reuse any files we can from the H8/300H +# + +#VPATH := $(VPATH):$(BOARD) + +# Note! Dependencies are done automagically by 'make dep', which also +# removes any old dependencies. DON'T put your own dependencies here +# unless it's something special (ie not a .c file). +# +.S.o: + $(CC) -D__ASSEMBLY__ $(AFLAGS) -I. -c $< -o $*.o + +obj-y := entry.o ints.o + +$(BOARD)/crt0_$(MODEL).o: $(BOARD)/crt0_$(MODEL).S + +entry.o: entry.S + +ints.o: ints.c + +include $(TOPDIR)/Rules.make diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/platform/h8300h/Rules.make linux-2.5.64-ac4/arch/h8300/platform/h8300h/Rules.make --- linux-2.5.64/arch/h8300/platform/h8300h/Rules.make 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/platform/h8300h/Rules.make 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,51 @@ +# +# h8300h/Makefile +# +# This file is included by the global makefile so that you can add your own +# platform-specific flags and dependencies. +# +# This file is subject to the terms and conditions of the GNU General Public +# License. See the file "COPYING" in the main directory of this archive +# for more details. +# +# Copyright (c) 2001 Lineo, Inc, +# Copyright (c) 2000,2001 D. Jeff Dionne +# Copyright (c) 1998,1999 D. Jeff Dionne +# Copyright (C) 1998 Kenneth Albanowski +# Copyright (C) 1994 Hamish Macdonald +# +# 68VZ328 Fixes By Evan Stawnyczy +# H8/300H Modify By Yoshinori Sato + +CROSS_COMPILE = h8300-elf- + +GCC_DIR = $(shell $(CC) -v 2>&1 | grep specs | sed -e 's/.* \(.*\)specs/\1\./') + +INCGCC = $(GCC_DIR)/include +LIBGCC = $(GCC_DIR)/h8300h/int32/libgcc.a + +CFLAGS := -fno-builtin -DNO_CACHE $(CFLAGS) -pipe -DNO_MM -DNO_FPU -DNO_CACHE -mh -mint32 -D__ELF__ -DNO_FORGET -DUTS_SYSNAME=\"uClinux\" -D__linux__ -DTARGET=$(BOARD) +AFLAGS := $(AFLAGS) -pipe -DNO_MM -DNO_FPU -DNO_CACHE -mh -D__ELF__ -DUTS_SYSNAME=\"uClinux\" + +LINKFLAGS = -T arch/$(ARCH)/platform/$(PLATFORM)/$(BOARD)/$(MODEL).ld +LDFLAGS := $(LDFLAGS) -mh8300helf + +HEAD := arch/$(ARCH)/platform/$(PLATFORM)/$(BOARD)/crt0_$(MODEL).o + +SUBDIRS := arch/$(ARCH)/kernel arch/$(ARCH)/mm arch/$(ARCH)/lib \ + arch/$(ARCH)/platform/$(PLATFORM) \ + arch/$(ARCH)/platform/$(PLATFORM)/$(BOARD) \ + $(SUBDIRS) + +CORE_FILES := arch/$(ARCH)/kernel/kernel.o arch/$(ARCH)/mm/mm.o \ + arch/$(ARCH)/platform/$(PLATFORM)/platform.o \ + arch/$(ARCH)/platform/$(PLATFORM)/$(BOARD)/$(BOARD).o \ + $(CORE_FILES) + +LIBS += arch/$(ARCH)/lib/lib.a $(LIBGCC) + +linux.bin: linux + $(OBJCOPY) -O binary linux linux.bin + +archclean: + rm -f linux diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/README linux-2.5.64-ac4/arch/h8300/README --- linux-2.5.64/arch/h8300/README 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/README 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,35 @@ +uClinux-2.4 for H8/300 README +Yoshinori Sato + +* Supported CPU +H8/300H +H8S is planning. + +* Supported Target +1.simulator of GDB + require patches. + +2.AE 3068/AE 3069 + more information + MICROTRONIQUE + Akizuki Denshi Tsusho Ltd. (Japanese Only) + +3.H8MAX + Under development + see http://www.strawbelly-linux.com (Japanese Only) + +* Toolchain Version +gcc-3.1 or higher and patch +see arch/h8300/tools_patch/README +binutils-2.12 or higher +gdb-5.2 or higher +The environment that can compile a h8300-elf binary is necessary. + +* Userland Develop enviroment +Tempolary used h8300-hms(h8300-coff) Toolchain. +I prepare toolchain corresponding to h8300-elf. + +* A few words of thanks +Porting to H8/300H is support of Information-technology Promotion Agency, Japan. +I thank support. +and All developer/user. diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/tools_patch/gcc.diff linux-2.5.64-ac4/arch/h8300/tools_patch/gcc.diff --- linux-2.5.64/arch/h8300/tools_patch/gcc.diff 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/tools_patch/gcc.diff 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,278 @@ +diff -Nru gcc-3.1.1/gcc/config/float-h8300.h gcc-3.1.1.dblfix/gcc/config/float-h8300.h +--- gcc-3.1.1/gcc/config/float-h8300.h Thu Jan 1 09:00:00 1970 ++++ gcc-3.1.1.dblfix/gcc/config/float-h8300.h Mon Sep 23 00:40:52 2002 +@@ -0,0 +1,128 @@ ++/* float.h for target h8300-elf with optional IEEE 32 bit double format: based float-sh.h */ ++#ifndef _FLOAT_H_ ++#define _FLOAT_H_ ++#include "config/h8300/h8300.h" ++ ++/* Produced by enquire version 4.3, CWI, Amsterdam */ ++ ++ /* Radix of exponent representation */ ++#undef FLT_RADIX ++#define FLT_RADIX 2 ++ /* Number of base-FLT_RADIX digits in the significand of a float */ ++#undef FLT_MANT_DIG ++#define FLT_MANT_DIG 24 ++ /* Number of decimal digits of precision in a float */ ++#undef FLT_DIG ++#define FLT_DIG 6 ++ /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown */ ++#undef FLT_ROUNDS ++#define FLT_ROUNDS 1 ++ /* Difference between 1.0 and the minimum float greater than 1.0 */ ++#undef FLT_EPSILON ++#define FLT_EPSILON 1.19209290e-07F ++ /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */ ++#undef FLT_MIN_EXP ++#define FLT_MIN_EXP (-125) ++ /* Minimum normalised float */ ++#undef FLT_MIN ++#define FLT_MIN 1.17549435e-38F ++ /* Minimum int x such that 10**x is a normalised float */ ++#undef FLT_MIN_10_EXP ++#define FLT_MIN_10_EXP (-37) ++ /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */ ++#undef FLT_MAX_EXP ++#define FLT_MAX_EXP 128 ++ /* Maximum float */ ++#undef FLT_MAX ++#define FLT_MAX 3.40282347e+38F ++ /* Maximum int x such that 10**x is a representable float */ ++#undef FLT_MAX_10_EXP ++#define FLT_MAX_10_EXP 38 ++ ++ /* Number of base-FLT_RADIX digits in the significand of a double */ ++#undef DBL_MANT_DIG ++#define DBL_MANT_DIG (DOUBLE_TYPE_SIZE == 64?53:24) ++ /* Number of decimal digits of precision in a double */ ++#undef DBL_DIG ++#define DBL_DIG (DOUBLE_TYPE_SIZE == 64?15:6) ++ /* Difference between 1.0 and the minimum double greater than 1.0 */ ++#undef DBL_EPSILON ++#define DBL_EPSILON (DOUBLE_TYPE_SIZE == 64?2.2204460492503131e-16:1.19209290e-07F) ++ /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */ ++#undef DBL_MIN_EXP ++#define DBL_MIN_EXP (DOUBLE_TYPE_SIZE == 64?(-1021):(-125)) ++ /* Minimum normalised double */ ++#undef DBL_MIN ++#define DBL_MIN (DOUBLE_TYPE_SIZE == 64?2.2250738585072014e-308:1.17549435e-38F) ++ /* Minimum int x such that 10**x is a normalised double */ ++#undef DBL_MIN_10_EXP ++#define DBL_MIN_10_EXP (DOUBLE_TYPE_SIZE == 64?(-307):(-37)) ++ /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */ ++#undef DBL_MAX_EXP ++#define DBL_MAX_EXP (DOUBLE_TYPE_SIZE == 64?1024:128) ++ /* Maximum double */ ++#undef DBL_MAX ++#define DBL_MAX (DOUBLE_TYPE_SIZE == 64?1.7976931348623157e+308:3.40282347e+38F) ++ /* Maximum int x such that 10**x is a representable double */ ++#undef DBL_MAX_10_EXP ++#define DBL_MAX_10_EXP (DOUBLE_TYPE_SIZE == 64?308:38) ++ ++/* Because -m3e and -m4-single-only have 32-bit doubles, we append L ++ to the doubles below, so that they're not truncated. */ ++ ++ /* Number of base-FLT_RADIX digits in the significand of a long double */ ++#undef LDBL_MANT_DIG ++#define LDBL_MANT_DIG (DOUBLE_TYPE_SIZE == 64?53:24) ++ /* Number of decimal digits of precision in a long double */ ++#undef LDBL_DIG ++#define LDBL_DIG (DOUBLE_TYPE_SIZE == 64?15:6) ++ /* Difference between 1.0 and the minimum long double greater than 1.0 */ ++#undef LDBL_EPSILON ++#define LDBL_EPSILON (DOUBLE_TYPE_SIZE == 64?2.2204460492503131e-16L:1.19209290e-07F) ++ /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */ ++#undef LDBL_MIN_EXP ++#define LDBL_MIN_EXP (DOUBLE_TYPE_SIZE == 64?(-1021):(-125)) ++ /* Minimum normalised long double */ ++#undef LDBL_MIN ++#define LDBL_MIN (DOUBLE_TYPE_SIZE == 64?2.2250738585072014e-308L:1.17549435e-38F) ++ /* Minimum int x such that 10**x is a normalised long double */ ++#undef LDBL_MIN_10_EXP ++#define LDBL_MIN_10_EXP (DOUBLE_TYPE_SIZE == 64?(-307):(-37)) ++ /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */ ++#undef LDBL_MAX_EXP ++#define LDBL_MAX_EXP (DOUBLE_TYPE_SIZE == 64?1024:128) ++ /* Maximum long double */ ++#undef LDBL_MAX ++#define LDBL_MAX (DOUBLE_TYPE_SIZE == 64?1.7976931348623157e+308L:3.40282347e+38F) ++ /* Maximum int x such that 10**x is a representable long double */ ++#undef LDBL_MAX_10_EXP ++#define LDBL_MAX_10_EXP (DOUBLE_TYPE_SIZE == 64?308:38) ++ ++#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L ++ /* The floating-point expression evaluation method. ++ -1 indeterminate ++ 0 evaluate all operations and constants just to the range and ++ precision of the type ++ 1 evaluate operations and constants of type float and double ++ to the range and precision of the double type, evaluate ++ long double operations and constants to the range and ++ precision of the long double type ++ 2 evaluate all operations and constants to the range and ++ precision of the long double type ++ */ ++# undef FLT_EVAL_METHOD ++# define FLT_EVAL_METHOD 0 ++ ++ /* Number of decimal digits to enable rounding to the given number of ++ decimal digits without loss of precision. ++ if FLT_RADIX == 10^n: #mantissa * log10 (FLT_RADIX) ++ else : ceil (1 + #mantissa * log10 (FLT_RADIX)) ++ where #mantissa is the number of bits in the mantissa of the widest ++ supported floating-point type. ++ */ ++# undef DECIMAL_DIG ++# define DECIMAL_DIG 17 ++ ++#endif /* C99 */ ++ ++#endif /* _FLOAT_H_ */ +diff -Nru gcc-3.1.1/gcc/config/h8300/extfloatlib.c gcc-3.1.1.dblfix/gcc/config/h8300/extfloatlib.c +--- gcc-3.1.1/gcc/config/h8300/extfloatlib.c Thu Jan 1 09:00:00 1970 ++++ gcc-3.1.1.dblfix/gcc/config/h8300/extfloatlib.c Sun Sep 22 23:06:11 2002 +@@ -0,0 +1,11 @@ ++/* from /gcc/config/m68k/fpgnulib.c */ ++ ++/* convert float to int */ ++long ++__fixdfsi (double a1); ++int ++__fixsfsi (float a1) ++{ ++ double foo = a1; ++ return __fixdfsi (foo); ++} +diff -Nru gcc-3.1.1/gcc/config/h8300/h8300.h gcc-3.1.1.dblfix/gcc/config/h8300/h8300.h +--- gcc-3.1.1/gcc/config/h8300/h8300.h Wed May 22 08:44:58 2002 ++++ gcc-3.1.1.dblfix/gcc/config/h8300/h8300.h Sun Sep 22 23:06:11 2002 +@@ -38,9 +38,12 @@ + extern const char * const *h8_reg_names; + + /* Names to predefine in the preprocessor for this target machine. */ +- ++/* + #define CPP_PREDEFINES \ + "-D__LONG_MAX__=2147483647L -D__LONG_LONG_MAX__=2147483647L" ++*/ ++#define CPP_PREDEFINES \ ++"-D__LONG_MAX__=2147483647L" + + #define CPP_SPEC \ + "%{!mh:%{!ms:-D__H8300__}} %{mh:-D__H8300H__} %{ms:-D__H8300S__} \ +@@ -51,6 +54,7 @@ + %{mh:-Acpu=h8300h -Amachine=h8300h} \ + %{ms:-Acpu=h8300s -Amachine=h8300s} \ + %{!mint32:-D__INT_MAX__=32767} %{mint32:-D__INT_MAX__=2147483647} \ ++ %{!mint32:-D__LONG_LONG_MAX__=2147483647L} %{mint32:-D__LONG_LONG_MAX__=9223372036854775807LL} \ + %(subtarget_cpp_spec)" + + #define SUBTARGET_CPP_SPEC "" +@@ -220,9 +224,9 @@ + #define SHORT_TYPE_SIZE 16 + #define INT_TYPE_SIZE (TARGET_INT32 ? 32 : 16) + #define LONG_TYPE_SIZE 32 +-#define LONG_LONG_TYPE_SIZE 32 ++#define LONG_LONG_TYPE_SIZE (TARGET_INT32 ? 64 : 32) + #define FLOAT_TYPE_SIZE 32 +-#define DOUBLE_TYPE_SIZE 32 ++#define DOUBLE_TYPE_SIZE (TARGET_INT32 ? 64 : 32) + #define LONG_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE + + #define MAX_FIXED_MODE_SIZE 32 +@@ -1337,4 +1341,20 @@ + + #define MOVE_RATIO 3 + ++#ifdef IN_LIBGCC2 ++#undef LONG_LONG_TYPE_SIZE ++#undef DOUBLE_TYPE_SIZE ++#undef LONG_DOUBLE_TYPE_SIZE ++#if __INT_MAX__ == 32767 ++#define DI SI ++#define DF SF ++#define LONG_LONG_TYPE_SIZE 32 ++#define DOUBLE_TYPE_SIZE 32 ++#else ++#define LONG_LONG_TYPE_SIZE 64 ++#define DOUBLE_TYPE_SIZE 64 ++#endif ++#define LONG_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE ++#endif ++ + #endif /* ! GCC_H8300_H */ +diff -Nru gcc-3.1.1/gcc/config/h8300/t-h8300 gcc-3.1.1.dblfix/gcc/config/h8300/t-h8300 +--- gcc-3.1.1/gcc/config/h8300/t-h8300 Fri Aug 31 02:51:04 2001 ++++ gcc-3.1.1.dblfix/gcc/config/h8300/t-h8300 Sun Sep 22 23:06:11 2002 +@@ -5,25 +5,7 @@ + LIB1ASMFUNCS = _cmpsi2 _ucmpsi2 _divhi3 _divsi3 _mulhi3 _mulsi3 \ + _floatdisf _fixsfdi _fixunssfdi _fixunssfsi_asm + +-LIB2FUNCS_EXTRA = $(srcdir)/config/h8300/fixunssfsi.c +- +-# We do not have DF or DI types, so fake out the libgcc2 compilation. +-TARGET_LIBGCC2_CFLAGS = -DDF=SF -DDI=SI +- +-# We want fine grained libraries, so use the new code to build the +-# floating point emulation libraries. +-FPBIT = fp-bit.c +- +-fp-bit.c: $(srcdir)/config/fp-bit.c +- echo '#define FLOAT' > fp-bit.c +- echo '#define FLOAT_ONLY' >> fp-bit.c +- echo '#define SMALL_MACHINE' >> fp-bit.c +- echo '#ifdef __H8300__' >> fp-bit.c +- echo '#define CMPtype HItype' >> fp-bit.c +- echo '#else' >> fp-bit.c +- echo '#define CMPtype SItype' >> fp-bit.c +- echo '#endif' >> fp-bit.c +- cat $(srcdir)/config/fp-bit.c >> fp-bit.c ++LIB2FUNCS_EXTRA = $(srcdir)/config/h8300/fixunssfsi.c $(srcdir)/floatlib.c $(srcdir)/config/h8300/extfloatlib.c + + MULTILIB_OPTIONS = mh/ms mint32 + MULTILIB_DIRNAMES = h8300h h8300s int32 +diff -Nru gcc-3.1.1/gcc/config.gcc gcc-3.1.1.dblfix/gcc/config.gcc +--- gcc-3.1.1/gcc/config.gcc Sat Jun 8 08:35:31 2002 ++++ gcc-3.1.1.dblfix/gcc/config.gcc Sun Sep 22 23:23:29 2002 +@@ -852,7 +852,7 @@ + h8300-*-elf*) + tmake_file="h8300/t-h8300 h8300/t-elf" + tm_file="h8300/h8300.h h8300/elf.h" +- float_format=i32 ++ float_format=h8300 + ;; + h8300-*-*) + float_format=i32 +diff -Nru gcc-3.1.1/gcc/cp/decl.c gcc-3.1.1.dblfix/gcc/cp/decl.c +--- gcc-3.1.1/gcc/cp/decl.c Wed Jul 10 08:46:07 2002 ++++ gcc-3.1.1.dblfix/gcc/cp/decl.c Sun Sep 22 23:06:11 2002 +@@ -3500,7 +3500,7 @@ + except for any that we copy here from the old type. */ + DECL_ATTRIBUTES (newdecl) + = (*targetm.merge_decl_attributes) (olddecl, newdecl); +- decl_attributes (&newdecl, DECL_ATTRIBUTES (newdecl), 0); ++ /*decl_attributes (&newdecl, DECL_ATTRIBUTES (newdecl), 0);*/ + + if (TREE_CODE (newdecl) == TEMPLATE_DECL) + { +diff -Nru gcc-3.1.1/gcc/floatlib.c gcc-3.1.1.dblfix/gcc/floatlib.c +--- gcc-3.1.1/gcc/floatlib.c Thu Oct 11 12:15:38 2001 ++++ gcc-3.1.1.dblfix/gcc/floatlib.c Sun Sep 22 23:06:11 2002 +@@ -430,13 +430,13 @@ + float + __floatsisf (long a1) + { +- (float)__floatsidf(a1); ++ return (float)__floatsidf(a1); + } + + float + __floatdisf (long long a1) + { +- (float)__floatdidf(a1); ++ return (float)__floatdidf(a1); + } + + /* negate a float */ diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/tools_patch/gdd.diff linux-2.5.64-ac4/arch/h8300/tools_patch/gdd.diff --- linux-2.5.64/arch/h8300/tools_patch/gdd.diff 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/tools_patch/gdd.diff 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,687 @@ +diff -Nru gdb-5.2.1/gdb/config/h8300/tm-h8300.h gdb-5.2.1.h8sim/gdb/config/h8300/tm-h8300.h +--- gdb-5.2.1/gdb/config/h8300/tm-h8300.h Tue Jan 29 13:42:36 2002 ++++ gdb-5.2.1.h8sim/gdb/config/h8300/tm-h8300.h Wed Sep 11 23:50:22 2002 +@@ -89,7 +89,7 @@ + #define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) + + /*#define BREAKPOINT {0x7A, 0xFF} */ +-#define BREAKPOINT {0x01, 0x80} /* Sleep */ ++#define BREAKPOINT {0x01, 0x81} /* bkpt(?) */ + #define REMOTE_BREAKPOINT { 0x57, 0x30} /* trapa #3 */ + /* If your kernel resets the pc after the trap happens you may need to + define this before including this file. */ +diff -Nru gdb-5.2.1/include/opcode/h8300.h gdb-5.2.1.h8sim/include/opcode/h8300.h +--- gdb-5.2.1/include/opcode/h8300.h Mon Jan 21 23:03:26 2002 ++++ gdb-5.2.1.h8sim/include/opcode/h8300.h Wed Sep 11 23:50:22 2002 +@@ -304,7 +304,8 @@ + #define O_LDM 85 + #define O_STM 86 + #define O_STMAC 87 +-#define O_LAST 88 ++#define O_BKPT 88 ++#define O_LAST 89 + #define SB 0 + #define SW 1 + #define SL 2 +@@ -375,6 +376,8 @@ + EBITOP(O(O_BTST,SB), IMM3|B30,"btst",0x6,0x3,0x7,0xC,0x7,0xE,0x0), + BITOP(O(O_BXOR,SB), IMM3|B30,"bxor",0x7,0x5,0x7,0xC,0x7,0xE,0x0), + ++ SOP(O(O_BKPT,SN),2,"bkpt"),{{E,0,0}},{{ 0x0,0x1,0x8,0x1,E,0,0,0,0}} EOP, ++ + TWOOP(O(O_CMP,SB), "cmp.b",0xA,0x1,0xC), + WTWOP(O(O_CMP,SW), "cmp.w",0x1,0xD), + +diff -Nru gdb-5.2.1/sim/h8300/Makefile.in gdb-5.2.1.h8sim/sim/h8300/Makefile.in +--- gdb-5.2.1/sim/h8300/Makefile.in Fri Apr 16 10:35:02 1999 ++++ gdb-5.2.1.h8sim/sim/h8300/Makefile.in Wed Sep 11 23:50:22 2002 +@@ -18,7 +18,7 @@ + + ## COMMON_PRE_CONFIG_FRAG + +-SIM_OBJS = compile.o sim-load.o ++SIM_OBJS = compile.o sim-load.o io.o + + ## COMMON_POST_CONFIG_FRAG + +diff -Nru gdb-5.2.1/sim/h8300/compile.c gdb-5.2.1.h8sim/sim/h8300/compile.c +--- gdb-5.2.1/sim/h8300/compile.c Fri May 17 22:24:13 2002 ++++ gdb-5.2.1.h8sim/sim/h8300/compile.c Fri Oct 18 12:56:11 2002 +@@ -81,7 +81,7 @@ + #define HIGH_BYTE(x) (((x) >> 8) & 0xff) + #define P(X,Y) ((X << 8) | Y) + +-#define BUILDSR() cpu.ccr = (N << 3) | (Z << 2) | (V << 1) | C; ++#define BUILDSR() cpu.ccr = (cpu.ccr & 0xf0) | (N << 3) | (Z << 2) | (V<<1) | C; + + #define GETSR() \ + c = (cpu.ccr >> 0) & 1;\ +@@ -319,6 +319,10 @@ + + bit = thisnib; + } ++ else if (looking_for & (L_2 | IMM)) ++ { ++ plen = 1; ++ } + else if (looking_for == E) + { + dst->op = q; +@@ -443,7 +447,7 @@ + return; + } + else +- printf ("Don't understand %x \n", looking_for); ++ printf ("Don't understand %x:%x \n", addr, looking_for); + } + + len++; +@@ -485,6 +489,8 @@ + cpu.cache_idx[pc] = idx; + } + ++extern int iosimulation(cpu_state_type *cpu,int cycles); ++extern void init_ioregs(cpu_state_type *cpu); + + static unsigned char *breg[18]; + static unsigned short *wreg[18]; +@@ -515,18 +521,33 @@ + (x < memory_size ? (cpu.memory[x]) : (cpu.eightbit[x & 0xff])) + + #define SET_MEMORY_L(x,y) \ ++if (x >= 0x100) \ + { register unsigned char *_p; register int __y = y; \ + _p = (x < memory_size ? cpu.memory+x : cpu.eightbit + (x & 0xff)); \ + _p[0] = (__y)>>24; _p[1] = (__y)>>16; \ +- _p[2] = (__y)>>8; _p[3] = (__y)>>0;} ++ _p[2] = (__y)>>8; _p[3] = (__y)>>0;} \ ++else \ ++{ cpu.state = SIM_STATE_STOPPED; \ ++ cpu.exception = SIGSEGV; \ ++} + + #define SET_MEMORY_W(x,y) \ ++if (x >= 0x100) \ + { register unsigned char *_p; register int __y = y; \ + _p = (x < memory_size ? cpu.memory+x : cpu.eightbit + (x & 0xff)); \ +- _p[0] = (__y)>>8; _p[1] =(__y);} ++ _p[0] = (__y)>>8; _p[1] =(__y);} \ ++else \ ++{ cpu.state = SIM_STATE_STOPPED; \ ++ cpu.exception = SIGSEGV; \ ++} + + #define SET_MEMORY_B(x,y) \ +- (x < memory_size ? (cpu.memory[(x)] = y) : (cpu.eightbit[x & 0xff] = y)) ++if (x >= 0x100) { \ ++ (x < memory_size ? (cpu.memory[(x)] = y) : (cpu.eightbit[x & 0xff] = y)); \ ++} else \ ++{ cpu.state = SIM_STATE_STOPPED; \ ++ cpu.exception = SIGSEGV; \ ++} + + int + fetch (arg, n) +@@ -918,12 +939,13 @@ + return 1; + } + ++ + void + sim_resume (sd, step, siggnal) + SIM_DESC sd; + { + static int init1; +- int cycles = 0; ++ static int cycles = 0; + int insts = 0; + int tick_start = get_now (); + void (*prev) (); +@@ -936,6 +958,7 @@ + int pc; + int c, nz, v, n; + int oldmask; ++ int vector; + init_pointers (); + + prev = signal (SIGINT, control_c); +@@ -994,6 +1017,15 @@ + + #endif + ++ if ((vector=iosimulation(&cpu,cycles)) && !(cpu.ccr & 0x80)) ++ { ++ BUILDSR(); ++ cpu.regs[7]-=4; ++ SET_MEMORY_L(cpu.regs[7],(cpu.ccr<<24)|pc); ++ pc=GET_MEMORY_L(vector*(h8300hmode?4:2)); ++ cpu.ccr|=0x80; ++ goto top; ++ } + if (code->opcode) + { + cycles += code->cycles; +@@ -1066,12 +1098,21 @@ + + case O (O_MOV_TO_MEM, SB): + res = GET_B_REG (code->src.reg); ++ if ( (code->dst.type == X (OP_DEC, SB)) && ++ (code->src.reg == code->dst.reg)) ++ res -= 1; + goto log8; + case O (O_MOV_TO_MEM, SW): + res = GET_W_REG (code->src.reg); ++ if ( (code->dst.type == X (OP_DEC, SW)) && ++ (code->src.reg == code->dst.reg)) ++ res -= 2; + goto log16; + case O (O_MOV_TO_MEM, SL): + res = GET_L_REG (code->src.reg); ++ if ( (code->dst.type == X (OP_DEC, SL)) && ++ (code->src.reg == code->dst.reg)) ++ res -= 4; + goto log32; + + +@@ -1355,6 +1396,7 @@ + cpu.state = SIM_STATE_STOPPED; + cpu.exception = SIGILL; + goto end; ++#if 0 + case O (O_SLEEP, SN): + /* FIXME: Doesn't this break for breakpoints when r0 + contains just the right (er, wrong) value? */ +@@ -1368,6 +1410,29 @@ + else + cpu.exception = SIGTRAP; + goto end; ++#endif ++#define SIM_WIFEXITED(v) (((v) & 0xff) == 0) ++#define SIM_WIFSIGNALED(v) (((v) & 0x7f) > 0 && (((v) & 0x7f) < 0x7f)) ++ case O (O_SLEEP, SN): ++ if (cpu.ccr & 0x80) ++ { ++ cpu.state = SIM_STATE_STOPPED; ++ cpu.exception = SIGTRAP; ++ } else ++ while (cpu.state = SIM_STATE_RUNNING) { ++ if ((vector=iosimulation(&cpu,cycles)) && !(cpu.ccr & 0x80)) ++ { ++ usleep(100); ++ BUILDSR(); ++ cpu.regs[7]-=4; ++ SET_MEMORY_L(cpu.regs[7],(cpu.ccr<<24)|pc+2); ++ pc=GET_MEMORY_L(vector*(h8300hmode?4:2)); ++ cpu.ccr|=0x80; ++ goto top; ++ } ++ cycles++; ++ } ++ goto end; + case O (O_BPT, SN): + cpu.state = SIM_STATE_STOPPED; + cpu.exception = SIGTRAP; +@@ -1528,7 +1593,143 @@ + } + } + goto next; +- ++ case O (O_LDC, SB): ++ { ++ switch(GET_MEMORY_B(pc)) { ++ case 0x03: ++ cpu.ccr = GET_B_REG(code->src.reg); ++ break; ++ case 0x07: ++ cpu.ccr = code->src.literal; ++ break; ++ case 0x01: ++ { ++ switch(GET_MEMORY_B(pc+2)) { ++ case 0x69: ++ cpu.ccr = GET_MEMORY_W(GET_L_REG(code->dst.reg)); ++ break; ++ case 0x6f: ++ case 0x78: ++ code->src.type=X(OP_DISP,SW); ++ cpu.ccr = fetch (&code->src); ++ break; ++ case 0x6d: ++ code->src.type=X(OP_INC,SW); ++ cpu.ccr = fetch (&code->src); ++ break; ++ case 0x6b: ++ cpu.ccr = GET_MEMORY_W(code->src.literal); ++ break; ++ } ++ } ++ } ++ GETSR(); ++ } ++ goto next; ++ case O (O_STC, SB): ++ { ++ BUILDSR(); ++ switch(GET_MEMORY_B(pc)) { ++ case 0x02: ++ SET_B_REG(code->dst.reg,cpu.ccr); ++ break; ++ case 0x01: ++ switch(GET_MEMORY_B(pc+2)) { ++ case 0x69: ++ SET_MEMORY_W(GET_L_REG(code->dst.reg),cpu.ccr); ++ break; ++ case 0x6f: ++ case 0x78: ++ code->dst.type=X(OP_DISP,SW); ++ store (&code->dst,cpu.ccr); ++ break; ++ case 0x6d: ++ code->dst.type=X(OP_DEC,SW); ++ store (&code->dst,cpu.ccr); ++ break; ++ case 0x6b: ++ SET_MEMORY_W(code->dst.literal,cpu.ccr); ++ break; ++ } ++ } ++ } ++ goto next; ++ case O (O_EEPMOV, SB): ++ { ++ int cnt=GET_B_REG(4); ++ if(cnt==0) cnt=0x100; ++ while(cnt!=0) { ++ SET_MEMORY_B(cpu.regs[6],GET_MEMORY_B(cpu.regs[5])); ++ cpu.regs[5]++; ++ cpu.regs[6]++; ++ --cnt; ++ } ++ SET_B_REG(4,cnt); ++ } ++ goto next; ++ case O (O_EEPMOV, SW): ++ { ++ int cnt=GET_W_REG(4); ++ if(cnt==0) cnt=0x10000; ++ while(cnt!=0) { ++ SET_MEMORY_B(cpu.regs[6],GET_MEMORY_B(cpu.regs[5])); ++ cpu.regs[5]++; ++ cpu.regs[6]++; ++ --cnt; ++ } ++ SET_W_REG(4,cnt); ++ } ++ goto next; ++ case O (O_RTE, SN): ++ { ++ unsigned int frame; ++ frame = GET_MEMORY_L (cpu.regs[7]); ++ cpu.ccr=frame>>24; ++ GETSR(); ++ pc=frame & 0xffffff; ++ cpu.regs[7]+=4; ++ }; ++ goto end; ++ case O (O_TRAPA, SB): ++ { ++ int v; ++ v=GET_MEMORY_W(pc)>>4; ++ v&=3; ++ BUILDSR(); ++ cpu.regs[7]-=4; ++ SET_MEMORY_L(cpu.regs[7],(cpu.ccr<<24)|code->next_pc); ++ pc=GET_MEMORY_L(v*(h8300hmode?4:2)+0x08*(h8300hmode?4:2)); ++ cpu.ccr|=0x80; ++ }; ++ goto end; ++ case O (O_BKPT, SN): ++ /* The format of r0 is defined by devo/include/wait.h. */ ++#if 0 /* FIXME: Ugh. A breakpoint is the sleep insn. */ ++ if (WIFEXITED (cpu.regs[0])) ++ { ++ cpu.state = SIM_STATE_EXITED; ++ cpu.exception = WEXITSTATUS (cpu.regs[0]); ++ } ++ else if (WIFSTOPPED (cpu.regs[0])) ++ { ++ cpu.state = SIM_STATE_STOPPED; ++ cpu.exception = WSTOPSIG (cpu.regs[0]); ++ } ++ else ++ { ++ cpu.state = SIM_STATE_SIGNALLED; ++ cpu.exception = WTERMSIG (cpu.regs[0]); ++ } ++#else ++ /* FIXME: Doesn't this break for breakpoints when r0 ++ contains just the right (er, wrong) value? */ ++ cpu.state = SIM_STATE_STOPPED; ++ if (! SIM_WIFEXITED (cpu.regs[0]) && SIM_WIFSIGNALED (cpu.regs[0])) ++ cpu.exception = SIGILL; ++ else ++ cpu.exception = SIGTRAP; ++#endif ++ goto end; + default: + cpu.state = SIM_STATE_STOPPED; + cpu.exception = SIGILL; +@@ -2016,10 +2217,14 @@ + char **argv; + { + /* FIXME: Much of the code in sim_load can be moved here. */ ++ char *ptyname; + + sim_kind = kind; + myname = argv[0]; + sim_callback = ptr; ++ if((ptyname=openpty())!=NULL) ++ (*sim_callback->printf_filtered) (sim_callback, ++ "SCI0 = %s\n",ptyname); + /* Fudge our descriptor. */ + return (SIM_DESC) 1; + } +@@ -2030,6 +2235,7 @@ + int quitting; + { + /* Nothing to do. */ ++ closepty(); + } + + /* Called by gdb to load a program into memory. */ +@@ -2100,6 +2306,7 @@ + abort (); + cpu.mask = memory_size - 1; + ++ init_ioregs(&cpu); + if (sim_load_file (sd, myname, sim_callback, prog, prog_bfd, + sim_kind == SIM_OPEN_DEBUG, + 0, sim_write) +diff -Nru gdb-5.2.1/sim/h8300/inst.h gdb-5.2.1.h8sim/sim/h8300/inst.h +--- gdb-5.2.1/sim/h8300/inst.h Fri Apr 16 10:35:02 1999 ++++ gdb-5.2.1.h8sim/sim/h8300/inst.h Wed Sep 11 23:50:22 2002 +@@ -15,7 +15,7 @@ + can only happen when simulating H8/300H programs). We make no attempt + to catch overlapping addresses, wrapped addresses, etc etc. */ + #define H8300_MSIZE (1<<16) +-#define H8300H_MSIZE (1<<18) ++#define H8300H_MSIZE (1<<24) + + #define CSIZE 1000 + +diff -Nru gdb-5.2.1/sim/h8300/io.c gdb-5.2.1.h8sim/sim/h8300/io.c +--- gdb-5.2.1/sim/h8300/io.c Thu Jan 1 09:00:00 1970 ++++ gdb-5.2.1.h8sim/sim/h8300/io.c Mon Sep 16 12:01:28 2002 +@@ -0,0 +1,272 @@ ++/* ++ H8 simulator Internal Peripheral Support ++*/ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "inst.h" ++ ++#define SMR (cpu->memory[0xffffb0]) ++#define BRR (cpu->memory[0xffffb1]) ++#define SCR (cpu->memory[0xffffb2]) ++#define TDR (cpu->memory[0xffffb3]) ++#define SSR (cpu->memory[0xffffb4]) ++#define RDR (cpu->memory[0xffffb5]) ++ ++#define TCR 0 ++#define TCSR 2 ++#define TCORA 4 ++#define TCORB 6 ++#define TCNT 8 ++ ++static int scifd=-1; ++static struct termios old_attr; ++static unsigned char ssr=0; ++static unsigned char tcsr[4]={0x00,0x00,0x00,0x00}; ++static int prescale[3]={8,64,8192}; ++const int base[4]={0xffff80,0xffff81,0xffff90,0xffff91}; ++const int prescale_div[3]={8,64,8192}; ++static unsigned int prev_cycle=0; ++ ++static void ++timer8(cpu_state_type *cpu,int cycles) ++{ ++ int tm,cnt,cyc,pcnt; ++ cyc=(unsigned int)cycles-prev_cycle; ++ prev_cycle=cycles; ++ for (pcnt = 0; pcnt < 3; pcnt++) { ++ prescale[pcnt] -= cyc; ++ if (prescale[pcnt]<=0) ++ { ++ for(tm=0;tm<4;tm++) { ++ tcsr[tm] &= (cpu->memory[base[tm]+TCSR] & 0xe0); ++ if ((cpu->memory[base[tm]+TCR]&0x07) == (pcnt+1)) ++ { ++ cnt=++cpu->memory[base[tm]+TCNT]; ++ if (cnt>=0x100) ++ { ++ tcsr[tm]|=0x20; ++ cnt=0; ++ } ++ cpu->memory[base[tm]+TCNT]=cnt; ++ } ++ if (cpu->memory[base[tm]+TCNT] >= cpu->memory[base[tm]+TCORA]) ++ { ++ tcsr[tm]|=0x40; ++ if ((cpu->memory[base[tm]+TCR]&0x18) == 0x08) ++ cpu->memory[base[tm]+TCNT] = 0; ++ } ++ if (cpu->memory[base[tm]+TCNT] >= cpu->memory[base[tm]+TCORB]) ++ { ++ tcsr[tm]|=0x80; ++ if ((cpu->memory[base[tm]+TCR]&0x18) == 0x10) ++ cpu->memory[base[tm]+TCNT] = 0; ++ } ++ cpu->memory[base[tm]+TCSR] &= 0x1f; ++ cpu->memory[base[tm]+TCSR] |= (tcsr[tm] & 0xe0); ++ } ++ prescale[pcnt]+=prescale_div[pcnt]; ++ } ++ } ++} ++ ++static unsigned int complete_time(cpu_state_type *cpu,int cycles) ++{ ++ int length; ++ int div[]={1,4,16,64}; ++ length=(SMR & 0x40)?7:8; ++ length+=(SMR & 0x20)?1:0; ++ length+=(SMR & 0x08)?1:0; ++ length+=2; ++ return length*32*div[SMR & 0x03]*BRR+cycles; ++} ++ ++static void send_data(int txd) ++{ ++ char dt; ++ dt=txd; ++ write(scifd,&dt,1); ++ fsync(scifd); ++} ++ ++static int rcv_data(int *rxd) ++{ ++ char rd; ++ if(read(scifd,&rd,1)>0) { ++ *rxd=rd; ++ return 1; ++ } else ++ return 0; ++} ++ ++static int sci(cpu_state_type *cpu,int cycles) ++{ ++ static int tx_end_time=0; ++ static int rx_end_time=0; ++ static int data=-1; ++ ssr &= SSR; ++ if((SCR & 0x20) && !(ssr & 0x80)) { ++ send_data(TDR); ++ ssr |= 0x80; ++ tx_end_time=complete_time(cpu,cycles); ++ } ++ if ((data == -1) && !rcv_data(&data)) ++ data = -1; ++ if((data != -1) && (SCR & 0x10) && ((rx_end_time==0) || (rx_end_time-cycles)<0)) { ++ if(ssr & 0x40) { ++ ssr |= 0x20; ++ } else { ++ RDR=data; ++ ssr |= 0x40; ++ data=-1; ++ } ++ rx_end_time=complete_time(cpu,cycles); ++ } ++ if((tx_end_time>0) && (tx_end_time-cycles)<0) { ++ if(ssr & 0x80) { ++ ssr |= 0x04; ++ } ++ } ++ SSR = ssr; ++} ++ ++static int ++intcont(cpu_state_type *cpu) ++{ ++ struct INT_LIST { ++ int vector; ++ int isr_adr; ++ unsigned char isr_mask; ++ int ier_adr; ++ unsigned char ier_mask; ++ } int_table[]= { ++ {36,0xffff82,0x40,0xffff80,0x40}, ++ {37,0xffff82,0x80,0xffff80,0x80}, ++ {38,0xffff83,0x40,0xffff81,0x40}, ++ {38,0xffff83,0x80,0xffff81,0x40}, ++ {39,0xffff82,0x20,0xffff80,0x20}, ++ {39,0xffff83,0x20,0xffff81,0x20}, ++ {40,0xffff92,0x40,0xffff90,0x40}, ++ {41,0xffff92,0x80,0xffff90,0x80}, ++ {42,0xffff93,0x40,0xffff91,0x40}, ++ {42,0xffff93,0x80,0xffff91,0x40}, ++ {43,0xffff92,0x20,0xffff90,0x20}, ++ {43,0xffff93,0x20,0xffff91,0x20}, ++ {52,0xffffb4,0x38,0xffffb2,0x40}, ++ {53,0xffffb4,0x40,0xffffb2,0x40}, ++ {54,0xffffb4,0x80,0xffffb2,0x80}, ++ {55,0xffffb4,0x04,0xffffb2,0x04} ++ }; ++ int irqno; ++ for (irqno=0;irqnomemory[int_table[irqno].ier_adr]&int_table[irqno].ier_mask) ++ if(cpu->memory[int_table[irqno].isr_adr]&int_table[irqno].isr_mask) ++ return int_table[irqno].vector; ++ } ++ return 0; ++} ++ ++int ++iosimulation(cpu_state_type *cpu,int cycles) ++{ ++ timer8(cpu,cycles); ++ sci(cpu,cycles); ++ return intcont(cpu); ++} ++ ++void init_ioregs(cpu_state_type *cpu) ++{ ++ struct INITTABLE { ++ int addr; ++ short data; ++ } reg_ini[] = { ++ 0xffff80,0x00, ++ 0xffff81,0x00, ++ 0xffff82,0x00, ++ 0xffff83,0x00, ++ 0xffff84,0xff, ++ 0xffff85,0xff, ++ 0xffff86,0xff, ++ 0xffff87,0xff, ++ 0xffff88,0x00, ++ 0xffff89,0x00, ++ 0xffff90,0x00, ++ 0xffff91,0x00, ++ 0xffff92,0x00, ++ 0xffff93,0x00, ++ 0xffff94,0xff, ++ 0xffff95,0xff, ++ 0xffff96,0xff, ++ 0xffff97,0xff, ++ 0xffff98,0x00, ++ 0xffff99,0x00, ++ 0xffffb0,0x00, ++ 0xffffb1,0xff, ++ 0xffffb2,0x00, ++ 0xffffb3,0xff, ++ 0xffffb4,0x84, ++ 0xffffb8,0x00, ++ 0xffffb9,0xff, ++ 0xffffba,0x00, ++ 0xffffbb,0xff, ++ 0xffffbc,0x84, ++ 0xffffc0,0x00, ++ 0xffffc1,0xff, ++ 0xffffc2,0x00, ++ 0xffffc3,0xff, ++ 0xffffc4,0x84, ++ }; ++ int c; ++ for(c=0;cmemory[reg_ini[c].addr]=reg_ini[c].data; ++ ssr = 0x84; ++} ++ ++char *openpty(void) ++{ ++ const char nm[]="0123456789ABCDEF"; ++ static char ptyname[16]; ++ int c1,c2,fd; ++ struct termios attr; ++ fd = open("/dev/ptmx",O_RDWR|O_NONBLOCK); ++ if(fd >= 0) { ++ grantpt(fd); ++ unlockpt(fd); ++ strncpy(ptyname,ptsname(fd),sizeof(ptyname)-1); ++ ptyname[sizeof(ptyname)-1]='\0'; ++ } else { ++ for(c1='a';c1<='z';c1++) ++ for(c2=0;c2= 0) { ++ scifd=fd; ++ tcgetattr(scifd,&attr); ++ memcpy(&old_attr,&attr,sizeof(struct termios)); ++ attr.c_lflag&=~ICANON; ++ attr.c_cc[VMIN]=0; ++ attr.c_cc[VTIME]=0; ++ tcsetattr(scifd,TCSAFLUSH,&attr); ++ return ptyname; ++ } else ++ return NULL; ++} ++ ++void closepty(void) ++{ ++ struct termios attr; ++ if(scifd!=-1) { ++ tcsetattr(scifd,TCSAFLUSH,&old_attr); ++ close(scifd); ++ } ++} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/tools_patch/README linux-2.5.64-ac4/arch/h8300/tools_patch/README --- linux-2.5.64/arch/h8300/tools_patch/README 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/tools_patch/README 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,23 @@ +gcc.diff +Please compile it after applying a patch in gcc. +It is gcc-3.1.1 only. + +Procedure +$ tar xzf gcc-3.1.1.tar.gz +$ cd gcc-3.1.1 +$ patch -p1 < gcc.diff +$ configure --target=h8300-elf --disable-nls -enable-languages='c,c++' +$ make +$ make install + +gdb.diff +It is necessary when I execute it on GDB sim. +It is gdb-5.2.1 only. + +Procedure +$ tar xzf gdb-5.2.1.tar.gz +$ cd gdb-5.2.1 +$ patch -p1 < gdb.diff +$ configure --target=h8300-elf +$ make +$ make install diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/h8300/vmlinux.lds.S linux-2.5.64-ac4/arch/h8300/vmlinux.lds.S --- linux-2.5.64/arch/h8300/vmlinux.lds.S 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/h8300/vmlinux.lds.S 2003-02-17 00:01:58.000000000 +0000 @@ -0,0 +1,38 @@ +#include + +#ifdef CONFIG_H8300H_GENERIC +#ifdef CONFIG_ROMKERNEL +#include "platform/h8300h/generic/rom.ld" +#endif +#ifdef CONFIG_RAMKERNEL +#include "platform/h8300h/generic/ram.ld" +#endif +#endif + +#ifdef CONFIG_H8300H_AKI3068NET +#ifdef CONFIG_ROMKERNEL +#include "platform/h8300h/aki3068net/rom.ld" +#endif +#ifdef CONFIG_RAMKERNEL +#include "platform/h8300h/aki3068net/ram.ld" +#endif +#endif + +#ifdef CONFIG_H8300H_H8MAX +#ifdef CONFIG_ROMKERNEL +#include "platform/h8300h/h8max/rom.ld" +#endif +#ifdef CONFIG_RAMKERNEL +#include "platform/h8300h/h8max/ram.ld" +#endif +#endif + +#ifdef CONFIG_H8300H_SIM +#ifdef CONFIG_ROMKERNEL +#include "platform/h8300h/generic/rom.ld" +#endif +#ifdef CONFIG_RAMKERNEL +#include "platform/h8300h/generic/ram.ld" +#endif +#endif + diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/i386/boot/Makefile linux-2.5.64-ac4/arch/i386/boot/Makefile --- linux-2.5.64/arch/i386/boot/Makefile 2003-02-10 18:38:26.000000000 +0000 +++ linux-2.5.64-ac4/arch/i386/boot/Makefile 2003-03-06 23:26:21.000000000 +0000 @@ -32,6 +32,10 @@ host-progs := tools/build +ifdef CONFIG_X86_HAL +AFLAGS += -DNO_X86_HAL_INCLUDES +endif + # --------------------------------------------------------------------------- $(obj)/zImage: IMAGE_OFFSET := 0x1000 diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/i386/boot98/bootsect.S linux-2.5.64-ac4/arch/i386/boot98/bootsect.S --- linux-2.5.64/arch/i386/boot98/bootsect.S 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/i386/boot98/bootsect.S 2003-02-14 22:38:01.000000000 +0000 @@ -0,0 +1,397 @@ +/* + * bootsect.S - boot sector for NEC PC-9800 series + * + * Linux/98 project at Kyoto University Microcomputer Club (KMC) + * FUJITA Norimasa, TAKAI Kousuke 1997-1998 + * rewritten by TAKAI Kousuke (as86 -> gas), Nov 1999 + * + * Based on: + * bootsect.S Copyright (C) 1991, 1992 Linus Torvalds + * modified by Drew Eckhardt + * modified by Bruce Evans (bde) + * + * bootsect.S is loaded at 0x1FC00 or 0x1FE00 by the bios-startup routines, + * and moves itself out of the way to address 0x90000, and jumps there. + * + * It then loads 'setup' directly after itself (0x90200), and the system + * at 0x10000, using BIOS interrupts. + * + * NOTE! currently system is at most (8*65536-4096) bytes long. This should + * be no problem, even in the future. I want to keep it simple. This 508 kB + * kernel size should be enough, especially as this doesn't contain the + * buffer cache as in minix (and especially now that the kernel is + * compressed :-) + * + * The loader has been made as simple as possible, and continuous + * read errors will result in a unbreakable loop. Reboot by hand. It + * loads pretty fast by getting whole tracks at a time whenever possible. + */ + +#include /* for CONFIG_ROOT_RDONLY */ +#include + +SETUPSECTS = 4 /* default nr of setup-sectors */ +BOOTSEG = 0x1FC0 /* original address of boot-sector */ +INITSEG = DEF_INITSEG /* we move boot here - out of the way */ +SETUPSEG = DEF_SETUPSEG /* setup starts here */ +SYSSEG = DEF_SYSSEG /* system loaded at 0x10000 (65536) */ +SYSSIZE = DEF_SYSSIZE /* system size: # of 16-byte clicks */ + /* to be loaded */ +ROOT_DEV = 0 /* ROOT_DEV is now written by "build" */ +SWAP_DEV = 0 /* SWAP_DEV is now written by "build" */ + +#ifndef SVGA_MODE +#define SVGA_MODE ASK_VGA +#endif + +#ifndef RAMDISK +#define RAMDISK 0 +#endif + +#ifndef ROOT_RDONLY +#define ROOT_RDONLY 1 +#endif + +/* normal/hireso text VRAM segments */ +#define NORMAL_TEXT 0xa000 +#define HIRESO_TEXT 0xe000 + +/* bios work area addresses */ +#define EXPMMSZ 0x0401 +#define BIOS_FLAG 0x0501 +#define DISK_BOOT 0x0584 + +.code16 +.text + +.global _start +_start: + +#if 0 /* hook for debugger, harmless unless BIOS is fussy (old HP) */ + int $0x3 +#endif + jmp real_start + .ascii "Linux 98" + .word 0 +real_start: + xorw %di, %di /* %di = 0 */ + movw %di, %ss /* %ss = 0 */ + movw $0x03F0, %sp + pushw %cx /* for hint */ + + movw $0x0A00, %ax /* normal mode defaults (80x25) */ + + testb $0x08, %ss:BIOS_FLAG /* check hi-reso bit */ + jnz set_crt_mode +/* + * Hi-Reso (high-resolution) machine. + * + * Some hi-reso machines have no RAMs on bank 8/A (0x080000 - 0x0BFFFF). + * On such machines we get two RAM banks from top of protect menory and + * map them on bank 8/A. + * These work-around must be done before moving myself on INITSEG (0x090000-). + */ + movw $(HIRESO_TEXT >> 8), %cs:(vram + 1) /* text VRAM segment */ + + /* set memory window */ + movb $0x08, %al + outb %al, $0x91 /* map native RAM (if any) */ + movb $0x0A, %al + outb %al, $0x93 + + /* check bank ram A */ + pushw $0xA500 + popw %ds + movw (%di), %cx /* %si == 0 from entry */ + notw %cx + movw %cx, (%di) + + movw $0x43F, %dx /* cache flush for 486 and up. */ + movb $0xA0, %al + outb %al, %dx + + cmpw %cx, (%di) + je hireso_done + + /* + * Write test failed; we have no native RAM on 080000h - 0BFFFFh. + * Take 256KB of RAM from top of protected memory. + */ + movb %ss:EXPMMSZ, %al + subb $2, %al /* reduce 2 x 128KB */ + movb %al, %ss:EXPMMSZ + addb %al, %al + addb $0x10, %al + outb %al, $0x91 + addb $2, %al + outb %al, $0x93 + +hireso_done: + movb $0x10, %al /* CRT mode 80x31, %ah still 0Ah */ + +set_crt_mode: + int $0x18 /* set CRT mode */ + + movb $0x0C, %ah /* turn on text displaying */ + int $0x18 + + xorw %dx, %dx /* position cursor to home */ + movb $0x13, %ah + int $0x18 + + movb $0x11, %ah /* turn cursor displaying on */ + int $0x18 + + /* move 1 kilobytes from [BOOTSEG:0000h] to [INITSEG:0000h] */ + cld + xorw %si, %si + pushw $INITSEG + popw %es + movw $512, %cx /* %di == 0 from entry */ + rep + cs + movsw + + ljmp $INITSEG, $go + +go: + pushw %cs + popw %ds /* %ds = %cs */ + + popw %dx /* %dh = saved %ch passed from BIOS */ + movb %ss:DISK_BOOT, %al + andb $0xf0, %al /* %al = Device Address */ + movb $18, %ch /* 18 secs/track, 512 b/sec (1440 KB) */ + cmpb $0x30, %al + je try512 + cmpb $0x90, %al /* 1 MB I/F, 1 MB floppy */ + je try1.2M + cmpb $0xf0, %al /* 640 KB I/F, 1 MB floppy */ + je try1.2M + movb $9, %ch /* 9 secs/track, 512 b/sec ( 720 KB) */ + cmpb $0x10, %al /* 1 MB I/F, 640 KB floppy */ + je try512 + cmpb $0x70, %al /* 640 KB I/F, 640 KB floppy */ + jne error /* unknown device? */ + + /* XXX: Does it make sense to support 8 secs/track, 512 b/sec + (640 KB) floppy? */ + +try512: movb $2, %cl /* 512 b/sec */ +lasttry:call tryload +/* + * Display error message and halt + */ +error: movw $error_msg, %si + call print +wait_reboot: + movb $0x0, %ah + int $0x18 /* wait keyboard input */ +1: movb $0, %al + outb %al, $0xF0 /* reset CPU */ + jmp 1b /* just in case... */ + +try1.2M:cmpb $2, %dh + je try2HC + movw $0x0803, %cx /* 8 secs/track, 1024 b/sec (1232 KB) */ + call tryload + movb $15, %ch /* 15 secs/track, 512 b/sec (1200 KB) */ + jmp try512 +try2HC: movw $0x0F02, %cx /* 15 secs/track, 512 b/sec (1200 KB) */ + call tryload + movw $0x0803, %cx /* 8 secs/track, 1024 b/sec (1232 KB) */ + jmp lasttry + +/* + * Try to load SETUP and SYSTEM provided geometry information in %cx. + * This routine *will not* return on successful load... + */ +tryload: + movw %cx, sectlen + movb %ss:DISK_BOOT, %al + movb $0x7, %ah /* recalibrate the drive */ + int $0x1b + jc error /* recalibration should succeed */ + + /* + * Load SETUP into memory. It is assumed that SETUP fits into + * first cylinder (2 tracks, 9KB on 2DD, 15-18KB on 2HD). + */ + movb $0, %bl + movb setup_sects, %bh + incb %bh + shlw %bx /* %bx = (setup_sects + 1) * 512 */ + movw $128, %bp + shlw %cl, %bp /* %bp = */ + subw %bp, %bx /* length to load */ + movw $0x0002, %dx /* head 0, sector 2 */ + movb %cl, %ch /* `N' for sector address */ + movb $0, %cl /* cylinder 0 */ + pushw %cs + popw %es /* %es = %cs (= INITSEG) */ + movb $0xd6, %ah /* read, multi-track, MFM */ + int $0x1b /* load it! */ + jc read_error + + movw $loading_msg, %si + call print + + movw $SYSSEG, %ax + movw %ax, %es /* %es = SYSSEG */ + +/* + * This routine loads the system at address 0x10000, making sure + * no 64kB boundaries are crossed. We try to load it as fast as + * possible, loading whole tracks whenever we can. + * + * in: es - starting address segment (normally 0x1000) + */ + movb %ch, %cl + addb $7, %cl /* %cl = log2 */ + shrw %cl, %bx /* %bx = # of phys. sectors in SETUP */ + addb %bl, %dl /* %dl = start sector # of SYSTEM */ + decb %dl /* %dl is 0-based in below loop */ + +rp_read_newseg: + xorw %bp, %bp /* = starting address within segment */ +#ifdef __BIG_KERNEL__ + bootsect_kludge = 0x220 /* 0x200 (size of bootsector) + 0x20 (offset */ + lcall *bootsect_kludge /* of bootsect_kludge in setup.S */ +#else + movw %es, %ax + subw $SYSSEG, %ax +#endif + cmpw syssize, %ax + ja boot /* done! */ + +rp_read: + movb sectors, %al + addb %al, %al + movb %al, %ch /* # of sectors on both surface */ + subb %dl, %al /* # of sectors left on this track */ + movb $0, %ah + shlw %cl, %ax /* # of bytes left on this track */ + movw %ax, %bx /* transfer length */ + addw %bp, %ax /* cross 64K boundary? */ + jnc 1f /* ok. */ + jz 1f /* also ok. */ + /* + * Oops, we are crossing 64K boundary... + * Adjust transfer length to make transfer fit in the boundary. + * + * Note: sector size is assumed to be a measure of 65536. + */ + xorw %bx, %bx + subw %bp, %bx +1: pushw %dx + movw $dot_msg, %si /* give progress message */ + call print + xchgw %ax, %dx + movb $0, %ah + divb sectors + xchgb %al, %ah + xchgw %ax, %dx /* %dh = head # / %dl = sector # */ + incb %dl /* fix %dl to 1-based */ + pushw %cx + movw cylinder, %cx + movb $0xd6, %ah /* read, multi-track, seek, MFM */ + movb %ss:DISK_BOOT, %al + int $0x1b + popw %cx + popw %dx + jc read_error + movw %bx, %ax /* # of bytes just read */ + shrw %cl, %ax /* %ax = # of sectors just read */ + addb %al, %dl /* advance sector # */ + cmpb %ch, %dl /* %ch = # of sectors/cylinder */ + jb 2f + incb cylinder /* next cylinder */ + xorb %dl, %dl /* sector 0 */ +2: addw %bx, %bp /* advance offset pointer */ + jnc rp_read + /* offset pointer wrapped; advance segment pointer. */ + movw %es, %ax + addw $0x1000, %ax + movw %ax, %es + jmp rp_read_newseg + +read_error: + ret + +boot: movw %cs, %ax /* = INITSEG */ + /* movw %ax, %ds */ + movw %ax, %ss + movw $0x4000, %sp /* 0x4000 is arbitrary value >= + * length of bootsect + length of + * setup + room for stack; + * PC-9800 never have BIOS workareas + * on high memory. + */ +/* + * After that we check which root-device to use. If the device is + * not defined, /dev/fd0 (2, 0) will be used. + */ + cmpw $0, root_dev + jne 3f + movb $2, root_dev+1 +3: + +/* + * After that (everything loaded), we jump to the setup-routine + * loaded directly after the bootblock: + */ + ljmp $SETUPSEG, $0 + +/* + * Subroutine for print string on console. + * %cs:%si - pointer to message + */ +print: + pushaw + pushw %ds + pushw %es + pushw %cs + popw %ds + lesw curpos, %di /* %es:%di = current text VRAM addr. */ +1: xorw %ax, %ax + lodsb + testb %al, %al + jz 2f /* end of string */ + stosw /* character code */ + movb $0xE1, %es:0x2000-2(%di) /* character attribute */ + jmp 1b +2: movw %di, %dx + movb $0x13, %ah + int $0x18 /* move cursor to current point */ + popw %es + popw %ds + popaw + ret + +loading_msg: + .string "Loading" +dot_msg: + .string "." +error_msg: + .string "Read Error!" + + .org 490 + +curpos: .word 160 /* current cursor position */ +vram: .word NORMAL_TEXT /* text VRAM segment */ + +cylinder: .byte 0 /* current cylinder (lower byte) */ +sectlen: .byte 0 /* (log2 of ) - 7 */ +sectors: .byte 0x0F /* default is 2HD (15 sector/track) */ + +# XXX: This is a fairly snug fit. + +.org 497 +setup_sects: .byte SETUPSECTS +root_flags: .word ROOT_RDONLY +syssize: .word SYSSIZE +swap_dev: .word SWAP_DEV +ram_size: .word RAMDISK +vid_mode: .word SVGA_MODE +root_dev: .word ROOT_DEV +boot_flag: .word 0xAA55 diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/i386/boot98/compressed/head.S linux-2.5.64-ac4/arch/i386/boot98/compressed/head.S --- linux-2.5.64/arch/i386/boot98/compressed/head.S 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/i386/boot98/compressed/head.S 2003-02-14 22:38:01.000000000 +0000 @@ -0,0 +1,128 @@ +/* + * linux/boot/head.S + * + * Copyright (C) 1991, 1992, 1993 Linus Torvalds + */ + +/* + * head.S contains the 32-bit startup code. + * + * NOTE!!! Startup happens at absolute address 0x00001000, which is also where + * the page directory will exist. The startup code will be overwritten by + * the page directory. [According to comments etc elsewhere on a compressed + * kernel it will end up at 0x1000 + 1Mb I hope so as I assume this. - AC] + * + * Page 0 is deliberately kept safe, since System Management Mode code in + * laptops may need to access the BIOS data stored there. This is also + * useful for future device drivers that either access the BIOS via VM86 + * mode. + */ + +/* + * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996 + */ +.text + +#include +#include + + .globl startup_32 + +startup_32: + cld + cli + movl $(__BOOT_DS),%eax + movl %eax,%ds + movl %eax,%es + movl %eax,%fs + movl %eax,%gs + + lss stack_start,%esp + xorl %eax,%eax +1: incl %eax # check that A20 really IS enabled + movl %eax,0x000000 # loop forever if it isn't + cmpl %eax,0x100000 + je 1b + +/* + * Initialize eflags. Some BIOS's leave bits like NT set. This would + * confuse the debugger if this code is traced. + * XXX - best to initialize before switching to protected mode. + */ + pushl $0 + popfl +/* + * Clear BSS + */ + xorl %eax,%eax + movl $_edata,%edi + movl $_end,%ecx + subl %edi,%ecx + cld + rep + stosb +/* + * Do the decompression, and jump to the new kernel.. + */ + subl $16,%esp # place for structure on the stack + movl %esp,%eax + pushl %esi # real mode pointer as second arg + pushl %eax # address of structure as first arg + call decompress_kernel + orl %eax,%eax + jnz 3f + popl %esi # discard address + popl %esi # real mode pointer + xorl %ebx,%ebx + ljmp $(__BOOT_CS), $0x100000 + +/* + * We come here, if we were loaded high. + * We need to move the move-in-place routine down to 0x1000 + * and then start it with the buffer addresses in registers, + * which we got from the stack. + */ +3: + movl $move_routine_start,%esi + movl $0x1000,%edi + movl $move_routine_end,%ecx + subl %esi,%ecx + addl $3,%ecx + shrl $2,%ecx + cld + rep + movsl + + popl %esi # discard the address + popl %ebx # real mode pointer + popl %esi # low_buffer_start + popl %ecx # lcount + popl %edx # high_buffer_start + popl %eax # hcount + movl $0x100000,%edi + cli # make sure we don't get interrupted + ljmp $(__BOOT_CS), $0x1000 # and jump to the move routine + +/* + * Routine (template) for moving the decompressed kernel in place, + * if we were high loaded. This _must_ PIC-code ! + */ +move_routine_start: + movl %ecx,%ebp + shrl $2,%ecx + rep + movsl + movl %ebp,%ecx + andl $3,%ecx + rep + movsb + movl %edx,%esi + movl %eax,%ecx # NOTE: rep movsb won't move if %ecx == 0 + addl $3,%ecx + shrl $2,%ecx + rep + movsl + movl %ebx,%esi # Restore setup pointer + xorl %ebx,%ebx + ljmp $(__BOOT_CS), $0x100000 +move_routine_end: diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/i386/boot98/compressed/Makefile linux-2.5.64-ac4/arch/i386/boot98/compressed/Makefile --- linux-2.5.64/arch/i386/boot98/compressed/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/i386/boot98/compressed/Makefile 2003-02-20 16:28:06.000000000 +0000 @@ -0,0 +1,25 @@ +# +# linux/arch/i386/boot/compressed/Makefile +# +# create a compressed vmlinux image from the original vmlinux +# + +EXTRA_TARGETS := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o +EXTRA_AFLAGS := -traditional + +LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32 + +$(obj)/vmlinux: $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE + $(call if_changed,ld) + @: + +$(obj)/vmlinux.bin: vmlinux FORCE + $(call if_changed,objcopy) + +$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE + $(call if_changed,gzip) + +LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T + +$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE + $(call if_changed,ld) diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/i386/boot98/compressed/misc.c linux-2.5.64-ac4/arch/i386/boot98/compressed/misc.c --- linux-2.5.64/arch/i386/boot98/compressed/misc.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/i386/boot98/compressed/misc.c 2003-02-14 22:38:01.000000000 +0000 @@ -0,0 +1,379 @@ +/* + * misc.c + * + * This is a collection of several routines from gzip-1.0.3 + * adapted for Linux. + * + * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 + * puts by Nick Holloway 1993, better puts by Martin Mares 1995 + * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996 + */ + +#include +#include +#include +#include +#ifdef STANDARD_MEMORY_BIOS_CALL +#undef STANDARD_MEMORY_BIOS_CALL +#endif + +/* + * gzip declarations + */ + +#define OF(args) args +#define STATIC static + +#undef memset +#undef memcpy + +/* + * Why do we do this? Don't ask me.. + * + * Incomprehensible are the ways of bootloaders. + */ +static void* memset(void *, int, size_t); +static void* memcpy(void *, __const void *, size_t); +#define memzero(s, n) memset ((s), 0, (n)) + +typedef unsigned char uch; +typedef unsigned short ush; +typedef unsigned long ulg; + +#define WSIZE 0x8000 /* Window size must be at least 32k, */ + /* and a power of two */ + +static uch *inbuf; /* input buffer */ +static uch window[WSIZE]; /* Sliding window buffer */ + +static unsigned insize = 0; /* valid bytes in inbuf */ +static unsigned inptr = 0; /* index of next byte to be processed in inbuf */ +static unsigned outcnt = 0; /* bytes in output buffer */ + +/* gzip flag byte */ +#define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */ +#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ +#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ +#define COMMENT 0x10 /* bit 4 set: file comment present */ +#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ +#define RESERVED 0xC0 /* bit 6,7: reserved */ + +#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) + +/* Diagnostic functions */ +#ifdef DEBUG +# define Assert(cond,msg) {if(!(cond)) error(msg);} +# define Trace(x) fprintf x +# define Tracev(x) {if (verbose) fprintf x ;} +# define Tracevv(x) {if (verbose>1) fprintf x ;} +# define Tracec(c,x) {if (verbose && (c)) fprintf x ;} +# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;} +#else +# define Assert(cond,msg) +# define Trace(x) +# define Tracev(x) +# define Tracevv(x) +# define Tracec(c,x) +# define Tracecv(c,x) +#endif + +static int fill_inbuf(void); +static void flush_window(void); +static void error(char *m); +static void gzip_mark(void **); +static void gzip_release(void **); + +/* + * This is set up by the setup-routine at boot-time + */ +static unsigned char *real_mode; /* Pointer to real-mode data */ + +#define EXT_MEM_K (*(unsigned short *)(real_mode + 0x2)) +#ifndef STANDARD_MEMORY_BIOS_CALL +#define ALT_MEM_K (*(unsigned long *)(real_mode + 0x1e0)) +#endif +#define SCREEN_INFO (*(struct screen_info *)(real_mode+0)) + +extern char input_data[]; +extern int input_len; + +static long bytes_out = 0; +static uch *output_data; +static unsigned long output_ptr = 0; + +static void *malloc(int size); +static void free(void *where); + +static void puts(const char *); + +extern int end; +static long free_mem_ptr = (long)&end; +static long free_mem_end_ptr; + +#define INPLACE_MOVE_ROUTINE 0x1000 +#define LOW_BUFFER_START 0x2000 +#define LOW_BUFFER_MAX 0x90000 +#define HEAP_SIZE 0x3000 +static unsigned int low_buffer_end, low_buffer_size; +static int high_loaded =0; +static uch *high_buffer_start /* = (uch *)(((ulg)&end) + HEAP_SIZE)*/; + +static char *vidmem = (char *)0xa0000; +static int lines, cols; + +#ifdef CONFIG_X86_NUMAQ +static void * xquad_portio = NULL; +#endif + +#include "../../../../lib/inflate.c" + +static void *malloc(int size) +{ + void *p; + + if (size <0) error("Malloc error\n"); + if (free_mem_ptr <= 0) error("Memory error\n"); + + free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ + + p = (void *)free_mem_ptr; + free_mem_ptr += size; + + if (free_mem_ptr >= free_mem_end_ptr) + error("\nOut of memory\n"); + + return p; +} + +static void free(void *where) +{ /* Don't care */ +} + +static void gzip_mark(void **ptr) +{ + *ptr = (void *) free_mem_ptr; +} + +static void gzip_release(void **ptr) +{ + free_mem_ptr = (long) *ptr; +} + +static void scroll(void) +{ + int i; + + memcpy ( vidmem, vidmem + cols * 2, ( lines - 1 ) * cols * 2 ); + for ( i = ( lines - 1 ) * cols * 2; i < lines * cols * 2; i += 2 ) + vidmem[i] = ' '; +} + +static void puts(const char *s) +{ + int x,y,pos; + char c; + + x = SCREEN_INFO.orig_x; + y = SCREEN_INFO.orig_y; + + while ( ( c = *s++ ) != '\0' ) { + if ( c == '\n' ) { + x = 0; + if ( ++y >= lines ) { + scroll(); + y--; + } + } else { + vidmem [ ( x + cols * y ) * 2 ] = c; + if ( ++x >= cols ) { + x = 0; + if ( ++y >= lines ) { + scroll(); + y--; + } + } + } + } + + SCREEN_INFO.orig_x = x; + SCREEN_INFO.orig_y = y; + + pos = x + cols * y; /* Update cursor position */ + while (!(inb_p(0x60) & 4)); + outb_p(0x49, 0x62); + outb_p(pos & 0xff, 0x60); + outb_p((pos >> 8) & 0xff, 0x60); +} + +static void* memset(void* s, int c, size_t n) +{ + int i; + char *ss = (char*)s; + + for (i=0;i> 8); + } + crc = c; + bytes_out += (ulg)outcnt; + output_ptr += (ulg)outcnt; + outcnt = 0; +} + +static void flush_window_high(void) +{ + ulg c = crc; /* temporary variable */ + unsigned n; + uch *in, ch; + in = window; + for (n = 0; n < outcnt; n++) { + ch = *output_data++ = *in++; + if ((ulg)output_data == low_buffer_end) output_data=high_buffer_start; + c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); + } + crc = c; + bytes_out += (ulg)outcnt; + outcnt = 0; +} + +static void flush_window(void) +{ + if (high_loaded) flush_window_high(); + else flush_window_low(); +} + +static void error(char *x) +{ + puts("\n\n"); + puts(x); + puts("\n\n -- System halted"); + + while(1); /* Halt */ +} + +#define STACK_SIZE (4096) + +long user_stack [STACK_SIZE]; + +struct { + long * a; + short b; + } stack_start = { & user_stack [STACK_SIZE] , __BOOT_DS }; + +static void setup_normal_output_buffer(void) +{ +#ifdef STANDARD_MEMORY_BIOS_CALL + if (EXT_MEM_K < 1024) error("Less than 2MB of memory.\n"); +#else + if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < 1024) error("Less than 2MB of memory.\n"); +#endif + output_data = (char *)0x100000; /* Points to 1M */ + free_mem_end_ptr = (long)real_mode; +} + +struct moveparams { + uch *low_buffer_start; int lcount; + uch *high_buffer_start; int hcount; +}; + +static void setup_output_buffer_if_we_run_high(struct moveparams *mv) +{ + high_buffer_start = (uch *)(((ulg)&end) + HEAP_SIZE); +#ifdef STANDARD_MEMORY_BIOS_CALL + if (EXT_MEM_K < (3*1024)) error("Less than 4MB of memory.\n"); +#else + if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < (3*1024)) error("Less than 4MB of memory.\n"); +#endif + mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START; + low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX + ? LOW_BUFFER_MAX : (unsigned int)real_mode) & ~0xfff; + low_buffer_size = low_buffer_end - LOW_BUFFER_START; + high_loaded = 1; + free_mem_end_ptr = (long)high_buffer_start; + if ( (0x100000 + low_buffer_size) > ((ulg)high_buffer_start)) { + high_buffer_start = (uch *)(0x100000 + low_buffer_size); + mv->hcount = 0; /* say: we need not to move high_buffer */ + } + else mv->hcount = -1; + mv->high_buffer_start = high_buffer_start; +} + +static void close_output_buffer_if_we_run_high(struct moveparams *mv) +{ + if (bytes_out > low_buffer_size) { + mv->lcount = low_buffer_size; + if (mv->hcount) + mv->hcount = bytes_out - low_buffer_size; + } else { + mv->lcount = bytes_out; + mv->hcount = 0; + } +} + + +asmlinkage int decompress_kernel(struct moveparams *mv, void *rmode) +{ + real_mode = rmode; + + vidmem = (char *)(((unsigned int)SCREEN_INFO.orig_video_page) << 4); + + lines = SCREEN_INFO.orig_video_lines; + cols = SCREEN_INFO.orig_video_cols; + + if (free_mem_ptr < 0x100000) setup_normal_output_buffer(); + else setup_output_buffer_if_we_run_high(mv); + + makecrc(); + puts("Uncompressing Linux... "); + gunzip(); + puts("Ok, booting the kernel.\n"); + if (high_loaded) close_output_buffer_if_we_run_high(mv); + return high_loaded; +} + +/* We don't actually check for stack overflows this early. */ +__asm__(".globl mcount ; mcount: ret\n"); + diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/i386/boot98/compressed/vmlinux.scr linux-2.5.64-ac4/arch/i386/boot98/compressed/vmlinux.scr --- linux-2.5.64/arch/i386/boot98/compressed/vmlinux.scr 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/i386/boot98/compressed/vmlinux.scr 2003-02-14 22:38:01.000000000 +0000 @@ -0,0 +1,9 @@ +SECTIONS +{ + .data : { + input_len = .; + LONG(input_data_end - input_data) input_data = .; + *(.data) + input_data_end = .; + } +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/i386/boot98/install.sh linux-2.5.64-ac4/arch/i386/boot98/install.sh --- linux-2.5.64/arch/i386/boot98/install.sh 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/i386/boot98/install.sh 2003-02-14 22:38:01.000000000 +0000 @@ -0,0 +1,40 @@ +#!/bin/sh +# +# arch/i386/boot/install.sh +# +# This file is subject to the terms and conditions of the GNU General Public +# License. See the file "COPYING" in the main directory of this archive +# for more details. +# +# Copyright (C) 1995 by Linus Torvalds +# +# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin +# +# "make install" script for i386 architecture +# +# Arguments: +# $1 - kernel version +# $2 - kernel image file +# $3 - kernel map file +# $4 - default install path (blank if root directory) +# + +# User may have a custom install script + +if [ -x ~/bin/installkernel ]; then exec ~/bin/installkernel "$@"; fi +if [ -x /sbin/installkernel ]; then exec /sbin/installkernel "$@"; fi + +# Default install - same as make zlilo + +if [ -f $4/vmlinuz ]; then + mv $4/vmlinuz $4/vmlinuz.old +fi + +if [ -f $4/System.map ]; then + mv $4/System.map $4/System.old +fi + +cat $2 > $4/vmlinuz +cp $3 $4/System.map + +if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/i386/boot98/Makefile linux-2.5.64-ac4/arch/i386/boot98/Makefile --- linux-2.5.64/arch/i386/boot98/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/i386/boot98/Makefile 2003-03-14 01:03:19.000000000 +0000 @@ -0,0 +1,76 @@ +# +# arch/i386/boot/Makefile +# +# This file is subject to the terms and conditions of the GNU General Public +# License. See the file "COPYING" in the main directory of this archive +# for more details. +# +# Copyright (C) 1994 by Linus Torvalds +# + +# ROOT_DEV specifies the default root-device when making the image. +# This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case +# the default of FLOPPY is used by 'build'. + +ROOT_DEV := CURRENT + +# If you want to preset the SVGA mode, uncomment the next line and +# set SVGA_MODE to whatever number you want. +# Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode. +# The number is the same as you would ordinarily press at bootup. + +SVGA_MODE := -DSVGA_MODE=NORMAL_VGA + +# If you want the RAM disk device, define this to be the size in blocks. + +#RAMDISK := -DRAMDISK=512 + +EXTRA_TARGETS := vmlinux.bin bootsect bootsect.o \ + setup setup.o zImage bzImage + +subdir- := compressed + +host-progs := tools/build + +# --------------------------------------------------------------------------- + +$(obj)/zImage: IMAGE_OFFSET := 0x1000 +$(obj)/zImage: EXTRA_AFLAGS := -traditional $(SVGA_MODE) $(RAMDISK) +$(obj)/bzImage: IMAGE_OFFSET := 0x100000 +$(obj)/bzImage: EXTRA_AFLAGS := -traditional $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__ +$(obj)/bzImage: BUILDFLAGS := -b + +quiet_cmd_image = BUILD $@ +cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \ + $(obj)/vmlinux.bin $(ROOT_DEV) > $@ + +$(obj)/zImage $(obj)/bzImage: $(obj)/bootsect $(obj)/setup \ + $(obj)/vmlinux.bin $(obj)/tools/build FORCE + $(call if_changed,image) + @echo 'Kernel: $@ is ready' + +$(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE + $(call if_changed,objcopy) + +LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary +LDFLAGS_setup := -Ttext 0x0 -s --oformat binary -e begtext + +$(obj)/setup $(obj)/bootsect: %: %.o FORCE + $(call if_changed,ld) + +$(obj)/compressed/vmlinux: FORCE + $(Q)$(MAKE) -f scripts/Makefile.build obj=$(obj)/compressed \ + IMAGE_OFFSET=$(IMAGE_OFFSET) $@ + +zdisk: $(BOOTIMAGE) + dd bs=8192 if=$(BOOTIMAGE) of=/dev/fd0 + +zlilo: $(BOOTIMAGE) + if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi + if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi + cat $(BOOTIMAGE) > $(INSTALL_PATH)/vmlinuz + cp System.map $(INSTALL_PATH)/ + if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi + +install: $(BOOTIMAGE) + sh $(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/i386/boot98/setup.S linux-2.5.64-ac4/arch/i386/boot98/setup.S --- linux-2.5.64/arch/i386/boot98/setup.S 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/i386/boot98/setup.S 2003-02-14 22:38:01.000000000 +0000 @@ -0,0 +1,961 @@ +/* + * setup.S Copyright (C) 1991, 1992 Linus Torvalds + * + * setup.s is responsible for getting the system data from the BIOS, + * and putting them into the appropriate places in system memory. + * both setup.s and system has been loaded by the bootblock. + * + * This code asks the bios for memory/disk/other parameters, and + * puts them in a "safe" place: 0x90000-0x901FF, ie where the + * boot-block used to be. It is then up to the protected mode + * system to read them from there before the area is overwritten + * for buffer-blocks. + * + * Move PS/2 aux init code to psaux.c + * (troyer@saifr00.cfsat.Honeywell.COM) 03Oct92 + * + * some changes and additional features by Christoph Niemann, + * March 1993/June 1994 (Christoph.Niemann@linux.org) + * + * add APM BIOS checking by Stephen Rothwell, May 1994 + * (sfr@canb.auug.org.au) + * + * High load stuff, initrd support and position independency + * by Hans Lermen & Werner Almesberger, February 1996 + * , + * + * Video handling moved to video.S by Martin Mares, March 1996 + * + * + * Extended memory detection scheme retwiddled by orc@pell.chi.il.us (david + * parsons) to avoid loadlin confusion, July 1997 + * + * Transcribed from Intel (as86) -> AT&T (gas) by Chris Noe, May 1999. + * + * + * Fix to work around buggy BIOSes which dont use carry bit correctly + * and/or report extended memory in CX/DX for e801h memory size detection + * call. As a result the kernel got wrong figures. The int15/e801h docs + * from Ralf Brown interrupt list seem to indicate AX/BX should be used + * anyway. So to avoid breaking many machines (presumably there was a reason + * to orginally use CX/DX instead of AX/BX), we do a kludge to see + * if CX/DX have been changed in the e801 call and if so use AX/BX . + * Michael Miller, April 2001 + * + * New A20 code ported from SYSLINUX by H. Peter Anvin. AMD Elan bugfixes + * by Robert Schwebel, December 2001 + * + * Heavily modified for NEC PC-9800 series by Kyoto University Microcomputer + * Club (KMC) Linux/98 project , 1997-1999 + */ + +#include +#include +#include +#include +#include +#include +#include + +/* Signature words to ensure LILO loaded us right */ +#define SIG1 0xAA55 +#define SIG2 0x5A5A + +#define HIRESO_TEXT 0xe000 +#define NORMAL_TEXT 0xa000 + +#define BIOS_FLAG2 0x0400 +#define BIOS_FLAG5 0x0458 +#define RDISK_EQUIP 0x0488 +#define BIOS_FLAG 0x0501 +#define KB_SHFT_STS 0x053a +#define DISK_EQUIP 0x055c + +INITSEG = DEF_INITSEG # 0x9000, we move boot here, out of the way +SYSSEG = DEF_SYSSEG # 0x1000, system loaded at 0x10000 (65536). +SETUPSEG = DEF_SETUPSEG # 0x9020, this is the current segment + # ... and the former contents of CS + +DELTA_INITSEG = SETUPSEG - INITSEG # 0x0020 + +.code16 +.globl begtext, begdata, begbss, endtext, enddata, endbss + +.text +begtext: +.data +begdata: +.bss +begbss: +.text + +start: + jmp trampoline + +# This is the setup header, and it must start at %cs:2 (old 0x9020:2) + + .ascii "HdrS" # header signature + .word 0x0203 # header version number (>= 0x0105) + # or else old loadlin-1.5 will fail) +realmode_swtch: .word 0, 0 # default_switch, SETUPSEG +start_sys_seg: .word SYSSEG + .word kernel_version # pointing to kernel version string + # above section of header is compatible + # with loadlin-1.5 (header v1.5). Don't + # change it. + +type_of_loader: .byte 0 # = 0, old one (LILO, Loadlin, + # Bootlin, SYSLX, bootsect...) + # See Documentation/i386/boot.txt for + # assigned ids + +# flags, unused bits must be zero (RFU) bit within loadflags +loadflags: +LOADED_HIGH = 1 # If set, the kernel is loaded high +CAN_USE_HEAP = 0x80 # If set, the loader also has set + # heap_end_ptr to tell how much + # space behind setup.S can be used for + # heap purposes. + # Only the loader knows what is free +#ifndef __BIG_KERNEL__ + .byte 0 +#else + .byte LOADED_HIGH +#endif + +setup_move_size: .word 0x8000 # size to move, when setup is not + # loaded at 0x90000. We will move setup + # to 0x90000 then just before jumping + # into the kernel. However, only the + # loader knows how much data behind + # us also needs to be loaded. + +code32_start: # here loaders can put a different + # start address for 32-bit code. +#ifndef __BIG_KERNEL__ + .long 0x1000 # 0x1000 = default for zImage +#else + .long 0x100000 # 0x100000 = default for big kernel +#endif + +ramdisk_image: .long 0 # address of loaded ramdisk image + # Here the loader puts the 32-bit + # address where it loaded the image. + # This only will be read by the kernel. + +ramdisk_size: .long 0 # its size in bytes + +bootsect_kludge: + .word bootsect_helper, SETUPSEG + +heap_end_ptr: .word modelist+1024 # (Header version 0x0201 or later) + # space from here (exclusive) down to + # end of setup code can be used by setup + # for local heap purposes. + +pad1: .word 0 +cmd_line_ptr: .long 0 # (Header version 0x0202 or later) + # If nonzero, a 32-bit pointer + # to the kernel command line. + # The command line should be + # located between the start of + # setup and the end of low + # memory (0xa0000), or it may + # get overwritten before it + # gets read. If this field is + # used, there is no longer + # anything magical about the + # 0x90000 segment; the setup + # can be located anywhere in + # low memory 0x10000 or higher. + +ramdisk_max: .long __MAXMEM-1 # (Header version 0x0203 or later) + # The highest safe address for + # the contents of an initrd + +trampoline: call start_of_setup + .space 1024 +# End of setup header ##################################################### + +start_of_setup: +# Set %ds = %cs, we know that SETUPSEG = %cs at this point + movw %cs, %ax # aka SETUPSEG + movw %ax, %ds +# Check signature at end of setup + cmpw $SIG1, setup_sig1 + jne bad_sig + + cmpw $SIG2, setup_sig2 + jne bad_sig + + jmp good_sig1 + +# Routine to print asciiz string at ds:si +prtstr: + lodsb + andb %al, %al + jz fin + + call prtchr + jmp prtstr + +fin: ret + +no_sig_mess: .string "No setup signature found ..." + +good_sig1: + jmp good_sig + +# We now have to find the rest of the setup code/data +bad_sig: + movw %cs, %ax # SETUPSEG + subw $DELTA_INITSEG, %ax # INITSEG + movw %ax, %ds + xorb %bh, %bh + movb (497), %bl # get setup sect from bootsect + subw $4, %bx # LILO loads 4 sectors of setup + shlw $8, %bx # convert to words (1sect=2^8 words) + movw %bx, %cx + shrw $3, %bx # convert to segment + addw $SYSSEG, %bx + movw %bx, %cs:start_sys_seg +# Move rest of setup code/data to here + movw $2048, %di # four sectors loaded by LILO + subw %si, %si + pushw %cs + popw %es + movw $SYSSEG, %ax + movw %ax, %ds + rep + movsw + movw %cs, %ax # aka SETUPSEG + movw %ax, %ds + cmpw $SIG1, setup_sig1 + jne no_sig + + cmpw $SIG2, setup_sig2 + jne no_sig + + jmp good_sig + +no_sig: + lea no_sig_mess, %si + call prtstr + +no_sig_loop: + hlt + jmp no_sig_loop + +good_sig: + movw %cs, %ax # aka SETUPSEG + subw $DELTA_INITSEG, %ax # aka INITSEG + movw %ax, %ds +# Check if an old loader tries to load a big-kernel + testb $LOADED_HIGH, %cs:loadflags # Do we have a big kernel? + jz loader_ok # No, no danger for old loaders. + + cmpb $0, %cs:type_of_loader # Do we have a loader that + # can deal with us? + jnz loader_ok # Yes, continue. + + pushw %cs # No, we have an old loader, + popw %ds # die. + lea loader_panic_mess, %si + call prtstr + + jmp no_sig_loop + +loader_panic_mess: .string "Wrong loader, giving up..." + +loader_ok: +# Get memory size (extended mem, kB) + +# On PC-9800, memory size detection is done completely in 32-bit +# kernel initialize code (kernel/setup.c). + pushw %es + xorl %eax, %eax + movw %ax, %es + movb %al, (E820NR) # PC-9800 has no E820 + movb %es:(0x401), %al + shll $7, %eax + addw $1024, %ax + movw %ax, (2) + movl %eax, (0x1e0) + movw %es:(0x594), %ax + shll $10, %eax + addl %eax, (0x1e0) + popw %es + +# Check for video adapter and its parameters and allow the +# user to browse video modes. + call video # NOTE: we need %ds pointing + # to bootsector + +# Get text video mode + movb $0x0B, %ah + int $0x18 # CRT mode sense + movw $(20 << 8) + 40, %cx + testb $0x10, %al + jnz 3f + movb $20, %ch + testb $0x01, %al + jnz 1f + movb $25, %ch + jmp 1f +3: # If bit 4 was 1, it means either 1) 31 lines for hi-reso mode, + # or 2) 30 lines for PC-9821. + movb $31, %ch # hireso mode value + pushw $0 + popw %es + testb $0x08, %es:BIOS_FLAG + jnz 1f + movb $30, %ch +1: # Now we got # of rows in %ch + movb %ch, (14) + + testb $0x02, %al + jnz 2f + movb $80, %cl +2: # Now we got # of columns in %cl + movb %cl, (7) + + # Next, get horizontal frequency if supported + movw $0x3100, %ax + int $0x18 # Call CRT bios + movb %al, (6) # If 31h is unsupported, %al remains 0 + +# Get hd0-3 data... + pushw %ds # aka INITSEG + popw %es + xorw %ax, %ax + movw %ax, %ds + cld + movw $0x0080, %di + movb DISK_EQUIP+1, %ah + movb $0x80, %al + +get_hd_info: + shrb %ah + pushw %ax + jnc 1f + movb $0x84, %ah + int $0x1b + jnc 2f # Success +1: xorw %cx, %cx # `0 cylinders' means no drive +2: # Attention! Work area (drive_info) is arranged for PC-9800. + movw %cx, %ax # # of cylinders + stosw + movw %dx, %ax # # of sectors / # of heads + stosw + movw %bx, %ax # sector size in bytes + stosw + popw %ax + incb %al + cmpb $0x84, %al + jb get_hd_info + +# Get fd data... + movw DISK_EQUIP, %ax + andw $0xf00f, %ax + orb %al, %ah + movb RDISK_EQUIP, %al + notb %al + andb %al, %ah # ignore all `RAM drive' + + movb $0x30, %al + +get_fd_info: + shrb %ah + pushw %ax + jnc 1f + movb $0xc4, %ah + int $0x1b + movb %ah, %al + andb $4, %al # 1.44MB support flag + shrb %al + addb $2, %al # %al = 2 (1.2MB) or 4 (1.44MB) + jmp 2f +1: movb $0, %al # no drive +2: stosb + popw %ax + incb %al + testb $0x04, %al + jz get_fd_info + + addb $(0xb0 - 0x34), %al + jnc get_fd_info # check FDs on 640KB I/F + + pushw %es + popw %ds # %ds got bootsector again +#if 0 + mov $0, (0x1ff) # default is no pointing device +#endif + +#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE) +# Then check for an APM BIOS... + # %ds points to the bootsector + movw $0, 0x40 # version = 0 means no APM BIOS + movw $0x09a00, %ax # APM BIOS installation check + xorw %bx, %bx + int $0x1f + jc done_apm_bios # Nope, no APM BIOS + + cmpw $0x0504d, %bx # Check for "PM" signature + jne done_apm_bios # No signature, no APM BIOS + + testb $0x02, %cl # Is 32 bit supported? + je done_apm_bios # No 32-bit, no (good) APM BIOS + + movw $0x09a04, %ax # Disconnect first just in case + xorw %bx, %bx + int $0x1f # ignore return code + movw $0x09a03, %ax # 32 bit connect + xorl %ebx, %ebx + int $0x1f + jc no_32_apm_bios # Ack, error. + + movw %ax, (66) # BIOS code segment + movl %ebx, (68) # BIOS entry point offset + movw %cx, (72) # BIOS 16 bit code segment + movw %dx, (74) # BIOS data segment + movl %esi, (78) # BIOS code segment length + movw %di, (82) # BIOS data segment length +# Redo the installation check as the 32 bit connect +# modifies the flags returned on some BIOSs + movw $0x09a00, %ax # APM BIOS installation check + xorw %bx, %bx + int $0x1f + jc apm_disconnect # error -> shouldn't happen + + cmpw $0x0504d, %bx # check for "PM" signature + jne apm_disconnect # no sig -> shouldn't happen + + movw %ax, (64) # record the APM BIOS version + movw %cx, (76) # and flags + jmp done_apm_bios + +apm_disconnect: # Tidy up + movw $0x09a04, %ax # Disconnect + xorw %bx, %bx + int $0x1f # ignore return code + + jmp done_apm_bios + +no_32_apm_bios: + andw $0xfffd, (76) # remove 32 bit support bit +done_apm_bios: +#endif + +# Pass cursor position to kernel... + movw %cs:cursor_address, %ax + shrw %ax # cursor_address is 2 bytes unit + movb $80, %cl + divb %cl + xchgb %al, %ah # (0) = %al = X, (1) = %ah = Y + movw %ax, (0) + +#if 0 + movw $msg_cpos, %si + call prtstr_cs + call prthex + call prtstr_cs + movw %ds, %ax + call prthex + call prtstr_cs + movb $0x11, %ah + int $0x18 + movb $0, %ah + int $0x18 + .section .rodata, "a" +msg_cpos: .string "Cursor position: 0x" + .string ", %ds:0x" + .string "\r\n" + .previous +#endif + +# Now we want to move to protected mode ... + cmpw $0, %cs:realmode_swtch + jz rmodeswtch_normal + + lcall *%cs:realmode_swtch + + jmp rmodeswtch_end + +rmodeswtch_normal: + pushw %cs + call default_switch + +rmodeswtch_end: +# we get the code32 start address and modify the below 'jmpi' +# (loader may have changed it) + movl %cs:code32_start, %eax + movl %eax, %cs:code32 + +# Now we move the system to its rightful place ... but we check if we have a +# big-kernel. In that case we *must* not move it ... + testb $LOADED_HIGH, %cs:loadflags + jz do_move0 # .. then we have a normal low + # loaded zImage + # .. or else we have a high + # loaded bzImage + jmp end_move # ... and we skip moving + +do_move0: + movw $0x100, %ax # start of destination segment + movw %cs, %bp # aka SETUPSEG + subw $DELTA_INITSEG, %bp # aka INITSEG + movw %cs:start_sys_seg, %bx # start of source segment + cld +do_move: + movw %ax, %es # destination segment + incb %ah # instead of add ax,#0x100 + movw %bx, %ds # source segment + addw $0x100, %bx + subw %di, %di + subw %si, %si + movw $0x800, %cx + rep + movsw + cmpw %bp, %bx # assume start_sys_seg > 0x200, + # so we will perhaps read one + # page more than needed, but + # never overwrite INITSEG + # because destination is a + # minimum one page below source + jb do_move + +end_move: +# then we load the segment descriptors + movw %cs, %ax # aka SETUPSEG + movw %ax, %ds + +# Check whether we need to be downward compatible with version <=201 + cmpl $0, cmd_line_ptr + jne end_move_self # loader uses version >=202 features + cmpb $0x20, type_of_loader + je end_move_self # bootsect loader, we know of it + +# Boot loader doesnt support boot protocol version 2.02. +# If we have our code not at 0x90000, we need to move it there now. +# We also then need to move the params behind it (commandline) +# Because we would overwrite the code on the current IP, we move +# it in two steps, jumping high after the first one. + movw %cs, %ax + cmpw $SETUPSEG, %ax + je end_move_self + + cli # make sure we really have + # interrupts disabled ! + # because after this the stack + # should not be used + subw $DELTA_INITSEG, %ax # aka INITSEG + movw %ss, %dx + cmpw %ax, %dx + jb move_self_1 + + addw $INITSEG, %dx + subw %ax, %dx # this will go into %ss after + # the move +move_self_1: + movw %ax, %ds + movw $INITSEG, %ax # real INITSEG + movw %ax, %es + movw %cs:setup_move_size, %cx + std # we have to move up, so we use + # direction down because the + # areas may overlap + movw %cx, %di + decw %di + movw %di, %si + subw $move_self_here+0x200, %cx + rep + movsb + ljmp $SETUPSEG, $move_self_here + +move_self_here: + movw $move_self_here+0x200, %cx + rep + movsb + movw $SETUPSEG, %ax + movw %ax, %ds + movw %dx, %ss + +end_move_self: # now we are at the right place + lidt idt_48 # load idt with 0,0 + xorl %eax, %eax # Compute gdt_base + movw %ds, %ax # (Convert %ds:gdt to a linear ptr) + shll $4, %eax + addl $gdt, %eax + movl %eax, (gdt_48+2) + lgdt gdt_48 # load gdt with whatever is + # appropriate + +# that was painless, now we enable A20 + + outb %al, $0xf2 # A20 on + movb $0x02, %al + outb %al, $0xf6 # also A20 on; making ITF's + # way our model + + # PC-9800 seems to enable A20 at the moment of `outb'; + # so we don't wait unlike IBM PCs (see ../setup.S). + +# enable DMA to access memory over 0x100000 (1MB). + + movw $0x439, %dx + inb %dx, %al + andb $(~4), %al + outb %al, %dx + +# Set DMA to increment its bank address automatically at 16MB boundary. +# Initial setting is 64KB boundary mode so that we can't run DMA crossing +# physical address 0xXXXXFFFF. + + movb $0x0c, %al + outb %al, $0x29 # ch. 0 + movb $0x0d, %al + outb %al, $0x29 # ch. 1 + movb $0x0e, %al + outb %al, $0x29 # ch. 2 + movb $0x0f, %al + outb %al, $0x29 # ch. 3 + movb $0x50, %al + outb %al, $0x11 # reinitialize DMAC + +# make sure any possible coprocessor is properly reset.. + movb $0, %al + outb %al, $0xf8 + outb %al, $0x5f # delay + +# well, that went ok, I hope. Now we mask all interrupts - the rest +# is done in init_IRQ(). + movb $0xFF, %al # mask all interrupts for now + outb %al, $0x0A + outb %al, $0x5f # delay + + movb $0x7F, %al # mask all irq's but irq7 which + outb %al, $0x02 # is cascaded + +# Well, that certainly wasn't fun :-(. Hopefully it works, and we don't +# need no steenking BIOS anyway (except for the initial loading :-). +# The BIOS-routine wants lots of unnecessary data, and it's less +# "interesting" anyway. This is how REAL programmers do it. +# +# Well, now's the time to actually move into protected mode. To make +# things as simple as possible, we do no register set-up or anything, +# we let the gnu-compiled 32-bit programs do that. We just jump to +# absolute address 0x1000 (or the loader supplied one), +# in 32-bit protected mode. +# +# Note that the short jump isn't strictly needed, although there are +# reasons why it might be a good idea. It won't hurt in any case. + movw $1, %ax # protected mode (PE) bit + lmsw %ax # This is it! + jmp flush_instr + +flush_instr: + xorw %bx, %bx # Flag to indicate a boot + xorl %esi, %esi # Pointer to real-mode code + movw %cs, %si + subw $DELTA_INITSEG, %si + shll $4, %esi # Convert to 32-bit pointer +# NOTE: For high loaded big kernels we need a +# jmpi 0x100000,__BOOT_CS +# +# but we yet haven't reloaded the CS register, so the default size +# of the target offset still is 16 bit. +# However, using an operand prefix (0x66), the CPU will properly +# take our 48 bit far pointer. (INTeL 80386 Programmer's Reference +# Manual, Mixing 16-bit and 32-bit code, page 16-6) + + .byte 0x66, 0xea # prefix + jmpi-opcode +code32: .long 0x1000 # will be set to 0x100000 + # for big kernels + .word __BOOT_CS + +# Here's a bunch of information about your current kernel.. +kernel_version: .ascii UTS_RELEASE + .ascii " (" + .ascii LINUX_COMPILE_BY + .ascii "@" + .ascii LINUX_COMPILE_HOST + .ascii ") " + .ascii UTS_VERSION + .byte 0 + +# This is the default real mode switch routine. +# to be called just before protected mode transition +default_switch: + cli # no interrupts allowed ! + outb %al, $0x50 # disable NMI for bootup + # sequence + lret + +# This routine only gets called, if we get loaded by the simple +# bootsect loader _and_ have a bzImage to load. +# Because there is no place left in the 512 bytes of the boot sector, +# we must emigrate to code space here. +bootsect_helper: + cmpw $0, %cs:bootsect_es + jnz bootsect_second + + movb $0x20, %cs:type_of_loader + movw %es, %ax + shrw $4, %ax + movb %ah, %cs:bootsect_src_base+2 + movw %es, %ax + movw %ax, %cs:bootsect_es + subw $SYSSEG, %ax + lret # nothing else to do for now + +bootsect_second: + pushw %bx + pushw %cx + pushw %si + pushw %di + testw %bp, %bp # 64K full ? + jne bootsect_ex + + xorw %cx, %cx # zero means full 64K + pushw %cs + popw %es + movw $bootsect_gdt, %bx + xorw %si, %si # source address + xorw %di, %di # destination address + movb $0x90, %ah + int $0x1f + jc bootsect_panic # this, if INT1F fails + + movw %cs:bootsect_es, %es # we reset %es to always point + incb %cs:bootsect_dst_base+2 # to 0x10000 +bootsect_ex: + movb %cs:bootsect_dst_base+2, %ah + shlb $4, %ah # we now have the number of + # moved frames in %ax + xorb %al, %al + popw %di + popw %si + popw %cx + popw %bx + lret + +bootsect_gdt: + .word 0, 0, 0, 0 + .word 0, 0, 0, 0 + +bootsect_src: + .word 0xffff + +bootsect_src_base: + .byte 0x00, 0x00, 0x01 # base = 0x010000 + .byte 0x93 # typbyte + .word 0 # limit16,base24 =0 + +bootsect_dst: + .word 0xffff + +bootsect_dst_base: + .byte 0x00, 0x00, 0x10 # base = 0x100000 + .byte 0x93 # typbyte + .word 0 # limit16,base24 =0 + .word 0, 0, 0, 0 # BIOS CS + .word 0, 0, 0, 0 # BIOS DS + +bootsect_es: + .word 0 + +bootsect_panic: + pushw %cs + popw %ds + cld + leaw bootsect_panic_mess, %si + call prtstr + +bootsect_panic_loop: + jmp bootsect_panic_loop + +bootsect_panic_mess: + .string "INT1F refuses to access high mem, giving up." + +# This routine prints one character (in %al) on console. +# PC-9800 doesn't have BIOS-function to do it like IBM PC's INT 10h - 0Eh, +# so we hardcode `prtchr' subroutine here. +prtchr: + pushaw + pushw %es + cmpb $0, %cs:prtchr_initialized + jnz prtchr_ok + xorw %cx, %cx + movw %cx, %es + testb $0x8, %es:BIOS_FLAG + jz 1f + movb $(HIRESO_TEXT >> 8), %cs:cursor_address+3 + movw $(80 * 31 * 2), %cs:max_cursor_offset +1: pushw %ax + call get_cursor_position + movw %ax, %cs:cursor_address + popw %ax + movb $1, %cs:prtchr_initialized +prtchr_ok: + lesw %cs:cursor_address, %di + movw $160, %bx + movb $0, %ah + cmpb $13, %al + je do_cr + cmpb $10, %al + je do_lf + + # normal (printable) character + stosw + movb $0xe1, %es:0x2000-2(%di) + jmp 1f + +do_cr: movw %di, %ax + divb %bl # %al = Y, %ah = X * 2 + mulb %bl + movw %ax, %dx + jmp 2f + +do_lf: addw %bx, %di +1: movw %cs:max_cursor_offset, %cx + cmpw %cx, %di + movw %di, %dx + jb 2f + # cursor reaches bottom of screen; scroll it + subw %bx, %dx + xorw %di, %di + movw %bx, %si + cld + subw %bx, %cx + shrw %cx + pushw %cx + rep; es; movsw + movb $32, %al # clear bottom line characters + movb $80, %cl + rep; stosw + movw $0x2000, %di + popw %cx + leaw (%bx,%di), %si + rep; es; movsw + movb $0xe1, %al # clear bottom line attributes + movb $80, %cl + rep; stosw +2: movw %dx, %cs:cursor_address + movb $0x13, %ah # move cursor to right position + int $0x18 + popw %es + popaw + ret + +cursor_address: + .word 0 + .word NORMAL_TEXT +max_cursor_offset: + .word 80 * 25 * 2 # for normal 80x25 mode + +# putstr may called without running through start_of_setup (via bootsect_panic) +# so we should initialize ourselves on demand. +prtchr_initialized: + .byte 0 + +# This routine queries GDC (graphic display controller) for current cursor +# position. Cursor position is returned in %ax (CPU offset address). +get_cursor_position: +1: inb $0x60, %al + outb %al, $0x5f # delay + outb %al, $0x5f # delay + testb $0x04, %al # Is FIFO empty? + jz 1b # no -> wait until empty + + movb $0xe0, %al # CSRR command + outb %al, $0x62 # command write + outb %al, $0x5f # delay + outb %al, $0x5f # delay + +2: inb $0x60, %al + outb %al, $0x5f # delay + outb %al, $0x5f # delay + testb $0x01, %al # Is DATA READY? + jz 2b # no -> wait until ready + + inb $0x62, %al # read xAD (L) + outb %al, $0x5f # delay + outb %al, $0x5f # delay + movb %al, %ah + inb $0x62, %al # read xAD (H) + outb %al, $0x5f # delay + outb %al, $0x5f # delay + xchgb %al, %ah # correct byte order + pushw %ax + inb $0x62, %al # read yAD (L) + outb %al, $0x5f # delay + outb %al, $0x5f # delay + inb $0x62, %al # read yAD (M) + outb %al, $0x5f # delay + outb %al, $0x5f # delay + inb $0x62, %al # read yAD (H) + # yAD is not our interest, + # so discard it. + popw %ax + addw %ax, %ax # convert to CPU address + ret + +# Descriptor tables +# +# NOTE: The intel manual says gdt should be sixteen bytes aligned for +# efficiency reasons. However, there are machines which are known not +# to boot with misaligned GDTs, so alter this at your peril! If you alter +# GDT_ENTRY_BOOT_CS (in asm/segment.h) remember to leave at least two +# empty GDT entries (one for NULL and one reserved). +# +# NOTE: On some CPUs, the GDT must be 8 byte aligned. This is +# true for the Voyager Quad CPU card which will not boot without +# This directive. 16 byte aligment is recommended by intel. +# + .align 16 +gdt: + .fill GDT_ENTRY_BOOT_CS,8,0 + + .word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb) + .word 0 # base address = 0 + .word 0x9A00 # code read/exec + .word 0x00CF # granularity = 4096, 386 + # (+5th nibble of limit) + + .word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb) + .word 0 # base address = 0 + .word 0x9200 # data read/write + .word 0x00CF # granularity = 4096, 386 + # (+5th nibble of limit) +gdt_end: + .align 4 + + .word 0 # alignment byte +idt_48: + .word 0 # idt limit = 0 + .word 0, 0 # idt base = 0L + + .word 0 # alignment byte +gdt_48: + .word gdt_end - gdt - 1 # gdt limit + .word 0, 0 # gdt base (filled in later) + +# Include video setup & detection code + +#include "video.S" + +# Setup signature -- must be last +setup_sig1: .word SIG1 +setup_sig2: .word SIG2 + +# After this point, there is some free space which is used by the video mode +# handling code to store the temporary mode table (not used by the kernel). + +modelist: + +.text +endtext: +.data +enddata: +.bss +endbss: diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/i386/boot98/tools/build.c linux-2.5.64-ac4/arch/i386/boot98/tools/build.c --- linux-2.5.64/arch/i386/boot98/tools/build.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/i386/boot98/tools/build.c 2003-02-14 22:38:01.000000000 +0000 @@ -0,0 +1,188 @@ +/* + * $Id: build.c,v 1.5 1997/05/19 12:29:58 mj Exp $ + * + * Copyright (C) 1991, 1992 Linus Torvalds + * Copyright (C) 1997 Martin Mares + */ + +/* + * This file builds a disk-image from three different files: + * + * - bootsect: exactly 512 bytes of 8086 machine code, loads the rest + * - setup: 8086 machine code, sets up system parm + * - system: 80386 code for actual system + * + * It does some checking that all files are of the correct type, and + * just writes the result to stdout, removing headers and padding to + * the right amount. It also writes some system data to stderr. + */ + +/* + * Changes by tytso to allow root device specification + * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996 + * Cross compiling fixes by Gertjan van Wingerde, July 1996 + * Rewritten by Martin Mares, April 1997 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef unsigned char byte; +typedef unsigned short word; +typedef unsigned long u32; + +#define DEFAULT_MAJOR_ROOT 0 +#define DEFAULT_MINOR_ROOT 0 + +/* Minimal number of setup sectors (see also bootsect.S) */ +#define SETUP_SECTS 4 + +byte buf[1024]; +int fd; +int is_big_kernel; + +void die(const char * str, ...) +{ + va_list args; + va_start(args, str); + vfprintf(stderr, str, args); + fputc('\n', stderr); + exit(1); +} + +void file_open(const char *name) +{ + if ((fd = open(name, O_RDONLY, 0)) < 0) + die("Unable to open `%s': %m", name); +} + +void usage(void) +{ + die("Usage: build [-b] bootsect setup system [rootdev] [> image]"); +} + +int main(int argc, char ** argv) +{ + unsigned int i, c, sz, setup_sectors; + u32 sys_size; + byte major_root, minor_root; + struct stat sb; + + if (argc > 2 && !strcmp(argv[1], "-b")) + { + is_big_kernel = 1; + argc--, argv++; + } + if ((argc < 4) || (argc > 5)) + usage(); + if (argc > 4) { + if (!strcmp(argv[4], "CURRENT")) { + if (stat("/", &sb)) { + perror("/"); + die("Couldn't stat /"); + } + major_root = major(sb.st_dev); + minor_root = minor(sb.st_dev); + } else if (strcmp(argv[4], "FLOPPY")) { + if (stat(argv[4], &sb)) { + perror(argv[4]); + die("Couldn't stat root device."); + } + major_root = major(sb.st_rdev); + minor_root = minor(sb.st_rdev); + } else { + major_root = 0; + minor_root = 0; + } + } else { + major_root = DEFAULT_MAJOR_ROOT; + minor_root = DEFAULT_MINOR_ROOT; + } + fprintf(stderr, "Root device is (%d, %d)\n", major_root, minor_root); + + file_open(argv[1]); + i = read(fd, buf, sizeof(buf)); + fprintf(stderr,"Boot sector %d bytes.\n",i); + if (i != 512) + die("Boot block must be exactly 512 bytes"); + if (buf[510] != 0x55 || buf[511] != 0xaa) + die("Boot block hasn't got boot flag (0xAA55)"); + buf[508] = minor_root; + buf[509] = major_root; + if (write(1, buf, 512) != 512) + die("Write call failed"); + close (fd); + + file_open(argv[2]); /* Copy the setup code */ + for (i=0 ; (c=read(fd, buf, sizeof(buf)))>0 ; i+=c ) + if (write(1, buf, c) != c) + die("Write call failed"); + if (c != 0) + die("read-error on `setup'"); + close (fd); + + setup_sectors = (i + 511) / 512; /* Pad unused space with zeros */ + if (!(setup_sectors & 1)) + setup_sectors++; /* setup_sectors must be odd on NEC PC-9800 */ + fprintf(stderr, "Setup is %d bytes.\n", i); + memset(buf, 0, sizeof(buf)); + while (i < setup_sectors * 512) { + c = setup_sectors * 512 - i; + if (c > sizeof(buf)) + c = sizeof(buf); + if (write(1, buf, c) != c) + die("Write call failed"); + i += c; + } + + file_open(argv[3]); + if (fstat (fd, &sb)) + die("Unable to stat `%s': %m", argv[3]); + sz = sb.st_size; + fprintf (stderr, "System is %d kB\n", sz/1024); + sys_size = (sz + 15) / 16; + /* 0x28000*16 = 2.5 MB, conservative estimate for the current maximum */ + if (sys_size > (is_big_kernel ? 0x28000 : DEF_SYSSIZE)) + die("System is too big. Try using %smodules.", + is_big_kernel ? "" : "bzImage or "); + if (sys_size > 0xefff) + fprintf(stderr,"warning: kernel is too big for standalone boot " + "from floppy\n"); + while (sz > 0) { + int l, n; + + l = (sz > sizeof(buf)) ? sizeof(buf) : sz; + if ((n=read(fd, buf, l)) != l) { + if (n < 0) + die("Error reading %s: %m", argv[3]); + else + die("%s: Unexpected EOF", argv[3]); + } + if (write(1, buf, l) != l) + die("Write failed"); + sz -= l; + } + close(fd); + + if (lseek(1, 497, SEEK_SET) != 497) /* Write sizes to the bootsector */ + die("Output: seek failed"); + buf[0] = setup_sectors; + if (write(1, buf, 1) != 1) + die("Write of setup sector count failed"); + if (lseek(1, 500, SEEK_SET) != 500) + die("Output: seek failed"); + buf[0] = (sys_size & 0xff); + buf[1] = ((sys_size >> 8) & 0xff); + if (write(1, buf, 2) != 2) + die("Write of image length failed"); + + return 0; /* Everything is OK */ +} diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/i386/boot98/video.S linux-2.5.64-ac4/arch/i386/boot98/video.S --- linux-2.5.64/arch/i386/boot98/video.S 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5.64-ac4/arch/i386/boot98/video.S 2003-02-14 22:38:01.000000000 +0000 @@ -0,0 +1,262 @@ +/* video.S + * + * Video mode setup, etc. for NEC PC-9800 series. + * + * Copyright (C) 1997,98,99 Linux/98 project + * + * Based on the video.S for IBM PC: + * copyright (C) Martin Mares + */ + +/* Positions of various video parameters passed to the kernel */ +/* (see also include/linux/tty.h) */ +#define PARAM_CURSOR_POS 0x00 +#define PARAM_VIDEO_PAGE 0x04 +#define PARAM_VIDEO_MODE 0x06 +#define PARAM_VIDEO_COLS 0x07 +#define PARAM_VIDEO_EGA_BX 0x0a +#define PARAM_VIDEO_LINES 0x0e +#define PARAM_HAVE_VGA 0x0f +#define PARAM_FONT_POINTS 0x10 + +#define PARAM_VIDEO98_COMPAT 0x0a +#define PARAM_VIDEO98_HIRESO 0x0b +#define PARAM_VIDEO98_MACHTYPE 0x0c +#define PARAM_VIDEO98_LINES 0x0e +#define PARAM_VIDEO98_COLS 0x0f + +# PARAM_LFB_* and PARAM_VESAPM_* are unused on PC-9800. + +# This is the main entry point called by setup.S +# %ds *must* be pointing to the bootsector +video: xorw %ax, %ax + movw %ax, %es # %es = 0 + + movb %es:BIOS_FLAG, %al + movb %al, PARAM_VIDEO_MODE + + movb $0, PARAM_VIDEO98_HIRESO # 0 = normal + movw $NORMAL_TEXT, PARAM_VIDEO_PAGE + testb $0x8, %al + movw $(80 * 256 + 25), %ax + jz 1f + # hireso machine. + movb $1, PARAM_VIDEO98_HIRESO # !0 = hi-reso + movb $(HIRESO_TEXT >> 8), PARAM_VIDEO_PAGE + 1 + movw $(80 * 256 + 31), %ax +1: movw %ax, PARAM_VIDEO98_LINES # also sets VIDEO98_COLS + + movb $0xc0, %ch # 400-line graphic mode + movb $0x42, %ah + int $0x18 + + movw $80, PARAM_VIDEO_COLS + + movw $msg_probing, %si + call prtstr_cs + +# Check vendor from font pattern of `A'... + +1: inb $0x60, %al # wait V-sync + testb $0x20, %al + jnz 1b +2: inb $0x60, %al + testb $0x20, %al + jz 2b + + movb $0x00, %al # select font of `A' + outb %al, $0xa1 + movb $0x41, %al + outb %al, $0xa3 + + movw $8, %cx + movw PARAM_VIDEO_PAGE, %ax + cmpw $NORMAL_TEXT, %ax + je 3f + movb $24, %cl # for hi-reso machine +3: addw $0x400, %ax # %ax = CG window segment + pushw %ds + movw %ax, %ds + xorw %dx, %dx # get sum of `A' pattern... + xorw %si, %si +4: lodsw + addw %ax, %dx + loop 4b + popw %ds + + movw %dx, %ax + movw $msg_nec, %si + xorw %bx, %bx # vendor info will go into %bx + testb $8, %es:BIOS_FLAG + jnz check_hireso_vendor + cmpw $0xc7f8, %ax + je 5f + jmp 6f +check_hireso_vendor: + cmpw $0x9639, %ax # XXX: NOT VERIFIED!!! + je 5f +6: incw %bx # compatible machine + movw $msg_compat, %si +5: movb %bl, PARAM_VIDEO98_COMPAT + call prtstr_cs + + movw $msg_fontdata, %si + call prtstr_cs # " (CG sum of A = 0x" + movw %dx, %ax + call prthex + call prtstr_cs # ") PC-98" + + movb $'0', %al + pushw %ds + pushw $0xf8e8 + popw %ds + cmpw $0x2198, (0) + popw %ds + jne 7f + movb $'2', %al +7: call prtchr + call prtstr_cs # "1 " + + movb $0, PARAM_VIDEO98_MACHTYPE +#if 0 /* XXX - This check is bogus? [0000:BIOS_FLAG2]-bit7 does NOT + indicate whether it is a note machine, but merely indicates + whether it has ``RAM drive''. */ +# check note machine + testb $0x80, %es:BIOS_FLAG2 + jnz is_note + pushw %ds + pushw $0xfd80 + popw %ds + movb (4), %al + popw %ds + cmpb $0x20, %al # EPSON note A + je epson_note + cmpb $0x22, %al # EPSON note W + je epson_note + cmpb $0x27, %al # EPSON note AE + je epson_note + cmpb $0x2a, %al # EPSON note WR + jne note_done +epson_note: + movb $1, PARAM_VIDEO98_MACHTYPE + movw $msg_note, %si + call prtstr_cs +note_done: +#endif + +# print h98 ? (only NEC) + cmpb $0, PARAM_VIDEO98_COMPAT + jnz 8f # not NEC -> not H98 + + testb $0x80, %es:BIOS_FLAG5 + jz 8f # have NESA bus -> H98 + movw $msg_h98, %si + call prtstr_cs + orb $2, PARAM_VIDEO98_MACHTYPE +8: testb $0x40, %es:BIOS_FLAG5 + jz 9f + movw $msg_gs, %si + call prtstr_cs # only prints it :-) +9: + movw $msg_normal, %si # "normal" + testb $0x8, %es:BIOS_FLAG + jz 1f + movw $msg_hireso, %si +1: call prtstr_cs + + movw $msg_sysclk, %si + call prtstr_cs + movb $'5', %al + testb $0x80, %es:BIOS_FLAG + jz 2f + movb $'8', %al +2: call prtchr + call prtstr_cs + +#if 0 + testb $0x40, %es:(0x45c) + jz no_30line # no 30-line support + + movb %es:KB_SHFT_STS, %al + testb $0x01, %al # is SHIFT key pressed? + jz no_30line + + testb $0x10, %al # is CTRL key pressed? + jnz line40 + + # switch to 30-line mode + movb $30, PARAM_VIDEO98_LINES + movw $msg_30line, %si + jmp 3f + +line40: + movb $37, PARAM_VIDEO98_LINES + movw $40, PARAM_VIDEO_LINES + movw $msg_40line, %si +3: call prtstr_cs + + movb $0x32, %bh + movw $0x300c, %ax + int $0x18 # switch video mode + movb $0x0c, %ah + int $0x18 # turn on text plane + movw %cs:cursor_address, %dx + movb $0x13, %ah + int $0x18 # move cursor to correct place + mov $0x11, %ah + int $0x18 # turn on text plane + + call prtstr_cs # "Ok.\r\n" +no_30line: +#endif + ret + +prtstr_cs: + pushw %ds + pushw %cs + popw %ds + call prtstr + popw %ds + ret + +# prthex is for debugging purposes, and prints %ax in hexadecimal. +prthex: pushw %cx + movw $4, %cx +1: rolw $4, %ax + pushw %ax + andb $0xf, %al + cmpb $10, %al + sbbb $0x69, %al + das + call prtchr + popw %ax + loop 1b + popw %cx + ret + +msg_probing: .string "Probing machine: " + +msg_nec: .string "NEC" +msg_compat: .string "compatible" + +msg_fontdata: .string " (CG sum of A = 0x" + .string ") PC-98" + .string "1 " + +msg_gs: .string "(GS) " +msg_h98: .string "(H98) " + +msg_normal: .string "normal" +msg_hireso: .string "Hi-reso" + +msg_sysclk: .string " mode, system clock " + .string "MHz\r\n" + +#if 0 +msg_40line: # cpp will concat following lines, so the assembler can deal. + .ascii "\ +Video mode will be adjusted to 37-line (so-called ``40-line'') mode later.\r\n\ +THIS MODE MAY DAMAGE YOUR MONITOR PHYSICALLY. USE AT YOUR OWN RISK.\r\n" +msg_30line: .string "Switching video mode to 30-line (640x480) mode... " + .string "Ok.\r\n" +#endif diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/i386/defconfig linux-2.5.64-ac4/arch/i386/defconfig --- linux-2.5.64/arch/i386/defconfig 2003-02-10 18:38:45.000000000 +0000 +++ linux-2.5.64-ac4/arch/i386/defconfig 2003-02-14 22:38:07.000000000 +0000 @@ -19,6 +19,8 @@ CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y +# CONFIG_IKCONFIG is not set +# CONFIG_IKCONFIG_PROC is not set # # Loadable module support diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.64/arch/i386/Kconfig linux-2.5.64-ac4/arch/i386/Kconfig --- linux-2.5.64/arch/i386/Kconfig 2003-03-06 17:04:22.000000000 +0000 +++ linux-2.5.64-ac4/arch/i386/Kconfig 2003-03-14 01:01:47.000000000 +0000 @@ -23,9 +23,9 @@ default y help This option allows you to choose whether you want to have support - for socalled swap devices or swap files in your kernel that are + for so-called swap devices or swap files in your kernel that are used to provide more virtual memory than the actual RAM present - in your computer. If unusre say Y. + in your computer. If unsure say Y. config SBUS bool @@ -61,7 +61,7 @@ *** WARNING *** If you do not specifically know you have a Voyager based machine, - say N here otherwise the kernel you build will not be bootable. + say N here, otherwise the kernel you build will not be bootable. config X86_NUMAQ bool "NUMAQ (IBM/Sequent)" @@ -151,7 +151,7 @@ config M486 bool "486" help - Select this for a x486 processor, ether Intel or one of the + Select this for a 486 series processor, either Intel or one of the compatible processors from AMD, Cyrix, IBM, or Intel. Includes DX, DX2, and DX4 variants; also SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5D or U5S. @@ -159,8 +159,8 @@ config M586 bool "586/K5/5x86/6x86/6x86MX" help - Select this for an x586 or x686 processor such as the AMD K5, the - Intel 5x86 or 6x86, or the Intel 6x86MX. This choice does not + Select this for an 586 or 686 series processor such as the AMD K5, + the Intel 5x86 or 6x86, or the Intel 6x86MX. This choice does not assume the RDTSC (Read Time Stamp Counter) instruction. config M586TSC @@ -235,28 +235,28 @@ config MCRUSOE bool "Crusoe" help - Select this for Transmeta Crusoe processor. Treats the processor + Select this for a Transmeta Crusoe processor. Treats the processor like a 586 with TSC, and sets some GCC optimization flags (like a Pentium Pro with no alignment requirements). config MWINCHIPC6 bool "Winchip-C6" help - Select this for a IDT Winchip C6 chip. Linux and GCC + Select this for an IDT Winchip C6 chip. Linux and GCC treat this chip as a 586TSC with some extended instructions and alignment requirements. config MWINCHIP2 bool "Winchip-2" help - Select this for a IDT Winchip-2. Linux and GCC + Select this for an IDT Winchip-2. Linux and GCC treat this chip as a 586TSC with some extended instructions and alignment requirements. config MWINCHIP3D bool "Winchip-2A/Winchip-3" help - Select this for a IDT Winchip-2A or 3. Linux and GCC + Select this for an IDT Winchip-2A or 3. Linux and GCC treat this chip as a 586TSC with some extended instructions and alignment reqirements. Development kernels also enable out of order memory stores for this CPU, which can increase @@ -269,15 +269,15 @@ treat this chip as a generic 586. Whilst the CPU is 686 class, it lacks the cmov extension which gcc assumes is present when generating 686 code. - Note, that Nehemiah (Model 9) and above will not boot with this - kernel due to them lacking the 3dnow instructions used in earlier + Note that Nehemiah (Model 9) and above will not boot with this + kernel due to them lacking the 3DNow! instructions used in earlier incarnations of the CPU. config MVIAC3_2 bool "VIA C3-2 (Nehemiah)" help - Select this for a VIA C3 "Nehemiah". Selecting this enables usage of SSE - and tells gcc to treat the CPU as a 686. + Select this for a VIA C3 "Nehemiah". Selecting this enables usage + of SSE and tells gcc to treat the CPU as a 686. Note, this kernel will not boot on older (pre model 9) C3s. endchoice @@ -444,7 +444,8 @@ enable and use it. If you say Y here even though your machine doesn't have a local APIC, then the kernel will still run with no slowdown at all. The local APIC supports CPU-generated self-interrupts (timer, - performance counters), and the NMI watchdog which detects hard lockups. + performance counters), and the NMI watchdog which detects hard + lockups. If you have a system with several CPUs, you do not need to say Y here: the local APIC will be used automatically. @@ -546,7 +547,7 @@ ---help--- This adds a driver to safely access the System Management Mode of the CPU on Toshiba portables with a genuine Toshiba BIOS. It does - not work on models with a Pheonix BIOS. The System Management Mode + not work on models with a Phoenix BIOS. The System Management Mode is used to set the BIOS and power saving options on Toshiba portables. For information on utilities to make use of this driver see the @@ -560,20 +561,24 @@ tristate "Dell laptop support" ---help--- This adds a driver to safely access the System Management Mode - of the CPU on the Dell Inspiron 8000. The System Management Mode - is used to read cpu temperature and cooling fan status and to - control the fans on the I8K portables. - - This driver has been tested only on the Inspiron 8000 but it may - also work with other Dell laptops. You can force loading on other - models by passing the parameter `force=1' to the module. Use at - your own risk. + of the CPU on several Dell Inspiron 8000 series compatible notebooks + and Latitude Cxxx series compatible notebooks. + The System Management Mode is used to read CPU temperature + and cooling fan status and to control the fans on the I8K portables. + + This driver has been tested only on the Inspiron 8000 but it will + also work with some other Dell laptops. You can force loading + on other models by passing the parameter `force=1' to the module. + Use at your own risk. For information on utilities to make use of this driver see the I8K Linux utilities web site at: - Say Y if you intend to run this kernel on a Dell Inspiron 8000. + Inspiron 5000 and 7000 series are not supported; use ACPI features + instead. + + Say Y if you intend to run this kernel on a I8K compatible notebook. Say N otherwise. config MICROCODE @@ -619,8 +624,8 @@ depends on EXPERIMENTAL help Say Y or M here if you want to enable BIOS Enhanced Disk Drive - Services real mode BIOS calls to determine which disk - BIOS tries boot from. This information is then exported via driverfs. + Services real mode BIOS calls to determine which disk the BIOS + tries to boot from. This information is then exported via driverfs. This option is experimental, but believed to be safe, and most disk controller BIOS vendors do not yet implement this feature. @@ -799,24 +804,26 @@ bool "Software Suspend (EXPERIMENTAL)" depends on EXPERIMENTAL && PM ---help--- - Enable the possibilty of suspendig machine. It doesn't need APM. - You may suspend your machine by 'swsusp' or 'shutdown -z