Commit 94520e42 authored by Linus Torvalds's avatar Linus Torvalds

Import 2.1.51pre1

parent 6efe5c37
......@@ -586,11 +586,9 @@ S: 34131 Kassel
S: Germany
N: Richard Henderson
E: rth@tamu.edu
E: richard@gnu.ai.mit.edu
E: rth@cygnus.com
D: Alpha/ELF, gcc, binutils, and glibc
S: 304 E. North Ave.
S: Bryan, Texas 77801-3431
S: USA
N: Sebastian Hetze
E: she@lunetix.de
......@@ -929,6 +927,13 @@ S: Australian National University
S: Canberra ACT 0200
S: AUSTRALIA
N: Pavel Machek
E: pavel@atrey.karlin.mff.cuni.cz
D: Softcursor for vga, hypertech cdrom support, vcsa bugfix
S: Volkova 1131
S: 198 00 Praha 9
S: Czech Republic
N: James B. MacLean
E: macleajb@ednet.ns.ca
W: http://www.ednet.ns.ca/~macleajb/dosemu.html
......@@ -1156,7 +1161,7 @@ E: orc@pell.chi.il.us
D: improved memory detection code.
N: Avery Pennarun
E: apenwarr@foxnet.net
E: apenwarr@bond.net
D: ARCnet driver
D: "make xconfig" improvements
D: Various minor hacking
......@@ -1655,6 +1660,14 @@ S: Oosterstraat 23
S: 2611 TT Delft
S: The Netherlands
N: David Woodhouse
E: dwmw2@cam.ac.uk
D: Extensive ARCnet rewrite
D: ARCnet COM20020, COM90xx IO-MAP drivers
S: Robinson College, Grange Road
S: Cambridge. CB3 9AN
S: England
N: Frank Xia
E: qx@math.columbia.edu
D: Xiafs filesystem [defunct]
......
......@@ -95,6 +95,13 @@ M: phil@tazenda.demon.co.uk
L: linux-net@vger.rutgers.edu
S: Maintained
NI5010 NETWORK DRIVER
P: Jan-Pascal van Best and Andreas Mohr
M: jvbest@qv3pluto.leidenuniv.nl (Best)
M: 100.30936@germany.net (Mohr)
L: linux-net@vger.rutgers.edu
S: Maintained
TLAN NETWORK DRIVER
P: James Banks
M: james.banks@caldera.com
......@@ -259,9 +266,8 @@ L: linux-m68k@phil.uni-sb.de
S: Maintained
MODULE SUPPORT [GENERAL], KERNELD
P: Bjorn Ekwall
M: bj0rn@blox.se
W: http://www.pi.se/blox/modules/
P: Richard Henderson
M: richard@gnu.ai.mit.edu
L: linux-kernel@vger.rutgers.edu
S: Maintained
......
VERSION = 2
PATCHLEVEL = 1
SUBLEVEL = 50
SUBLEVEL = 51
ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/)
......@@ -149,6 +149,10 @@ ifdef CONFIG_SBUS
DRIVERS := $(DRIVERS) drivers/sbus/sbus.a
endif
ifdef CONFIG_PPC
DRIVERS := $(DRIVERS) drivers/macintosh/macintosh.a
endif
ifdef CONFIG_PNP
DRIVERS := $(DRIVERS) drivers/pnp/pnp.a
endif
......
......@@ -148,6 +148,8 @@ CONFIG_SCSI_OMIT_FLASHPOINT=y
# CONFIG_SCSI_T128 is not set
# CONFIG_SCSI_U14_34F is not set
# CONFIG_SCSI_ULTRASTOR is not set
# CONFIG_SCSI_MESH is not set
# CONFIG_SCSI_MAC53C94 is not set
#
# Network device support
......@@ -214,6 +216,7 @@ CONFIG_ISO9660_FS=y
# CONFIG_ROMFS_FS is not set
CONFIG_AUTOFS_FS=y
# CONFIG_UFS_FS is not set
# CONFIG_MAC_PARTITION is not set
#
# Character devices
......
......@@ -7,6 +7,7 @@
#include <linux/sched.h>
#include <linux/in6.h>
#include <linux/interrupt.h>
#include <linux/smp_lock.h>
#include <asm/semaphore.h>
#include <asm/processor.h>
......@@ -49,6 +50,7 @@ EXPORT_SYMBOL_NOVERS(kernel_flag);
EXPORT_SYMBOL_NOVERS(active_kernel_processor);
EXPORT_SYMBOL(smp_invalidate_needed);
EXPORT_SYMBOL_NOVERS(__lock_kernel);
EXPORT_SYMBOL(lk_lockmsg);
/* Global SMP irq stuff */
EXPORT_SYMBOL(synchronize_irq);
......
......@@ -13,7 +13,7 @@
all: kernel.o head.o
O_TARGET := kernel.o
O_OBJS := entry.o process.o traps.o ints.o signal.o ptrace.o \
setup.o bios32.o sys_m68k.o time.o
setup.o sys_m68k.o time.o
ifdef CONFIG_VT
O_OBJS += console.o
endif
......
/*
* bios 32 replacement
*/
unsigned long bios32_init(unsigned long memory_start, unsigned long memory_end)
{
return memory_start;
}
......@@ -65,7 +65,7 @@ asmlinkage int sys_idle(void)
current->priority = -100;
current->counter = -100;
for (;;){
if (!need_resched)
if (!resched_needed())
#if defined(CONFIG_ATARI) && !defined(CONFIG_AMIGA) && !defined(CONFIG_MAC)
/* block out HSYNC on the atari (falcon) */
__asm__("stop #0x2200" : : : "cc");
......
......@@ -526,7 +526,7 @@ asmlinkage void syscall_trace(void)
goto out;
current->exit_code = SIGTRAP;
current->state = TASK_STOPPED;
notify_parent(current);
notify_parent(current, SIGCHLD);
schedule();
/*
* this isn't the same as continuing with a signal, but it will do
......
......@@ -441,7 +441,7 @@ asmlinkage int do_signal(unsigned long oldmask, struct pt_regs *regs)
regs->pc -= 2;
}
}
notify_parent(current);
notify_parent(current, SIGCHLD);
schedule();
if (!(signr = current->exit_code)) {
discard_frame:
......@@ -489,7 +489,7 @@ asmlinkage int do_signal(unsigned long oldmask, struct pt_regs *regs)
current->exit_code = signr;
if (!(current->p_pptr->sig->action[SIGCHLD-1].sa_flags &
SA_NOCLDSTOP))
notify_parent(current);
notify_parent(current, SIGCHLD);
schedule();
continue;
......
......@@ -13,29 +13,30 @@
# Copyright (C) 1994, 1995, 1996 by Ralf Baechle
# DECStation modifications by Paul M. Antoine, 1996
#
# $Id: Makefile,v 1.7 1997/06/30 15:52:03 ralf Exp $
# $Id: Makefile,v 1.8 1997/08/08 18:11:35 miguel Exp $
#
#
# Select the object file format to substitute into the linker script.
#
ifdef CONFIG_CPU_LITTLE_ENDIAN
CROSS_COMPILE = mipsel-linux-
CROSS_COMPILE = mipsel-linux-
ifdef CONFIG_MIPS_ECOFF
oformat = ecoff-littlemips
oformat = ecoff-littlemips
else
oformat = elf32-littlemips
oformat = elf32-littlemips
endif
else
CROSS_COMPILE = mips-linux-
CROSS_COMPILE = mips-linux-
ifdef CONFIG_MIPS_ECOFF
oformat = ecoff-bigmips
oformat = ecoff-bigmips
else
oformat = elf32-bigmips
oformat = elf32-bigmips
endif
endif
LINKFLAGS = -static -N
MODFLAGS += -mlong-calls
#
# The new ELF GCC uses -G0 -mabicalls -fpic as default. We don't need PIC
......
......@@ -41,7 +41,6 @@ zdisk: zImage
fi
dep:
$(CPP) -M *.[cS] > .depend
clean:
rm -f zImage zImage.tmp mkboot
......
......@@ -27,6 +27,9 @@ if [ "$CONFIG_MIPS_MAGNUM_4000" = "y" -o \
fi
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
bool 'Support for SGI workstations' CONFIG_SGI
if [ "$CONFIG_SGI" = "y" ]; then
bool 'Support for SGI graphic devices' CONFIG_SGI_GRAPHICS
fi
fi
bool 'Support for SNI RM200 PCI' CONFIG_SNI_RM200_PCI
if [ "$CONFIG_DESKSTATION_RPC44" = "y" -o \
......@@ -69,6 +72,7 @@ else
fi
if [ "$CONFIG_CPU_LITTLE_ENDIAN" = "n" ]; then
define_bool CONFIG_BINFMT_IRIX y
define_bool CONFIG_FORWARD_KEYBOARD y
fi
define_bool CONFIG_BINFMT_ELF y
define_bool CONFIG_BINFMT_AOUT n
......@@ -93,12 +97,7 @@ if [ "$CONFIG_MODULES" = "y" ]; then
bool 'Kernel daemon support (e.g. autoload of modules)' CONFIG_KERNELD
fi
#
# All SGI block devices are SCSI based AFAIK. -davem
#
if [ "$CONFIG_SGI" != "y" ]; then
source drivers/block/Config.in
fi
source drivers/block/Config.in
if [ "$CONFIG_NET" = "y" ]; then
source net/Config.in
......@@ -215,3 +214,5 @@ if [ "$CONFIG_PROFILE" = "y" ]; then
int ' Profile shift count' CONFIG_PROFILE_SHIFT 2
fi
endmenu
define_bool CONFIG_VGA_CONSOLE y
......@@ -38,7 +38,7 @@ CONFIG_BINFMT_ELF=y
CONFIG_NET=y
CONFIG_SYSVIPC=y
CONFIG_SYSCTL=y
# CONFIG_PNP_PARPORT is not set
# CONFIG_PARPORT is not set
#
# Loadable module support
......@@ -133,6 +133,7 @@ CONFIG_PCNET32=y
# CONFIG_NET_POCKET is not set
# CONFIG_FDDI is not set
# CONFIG_DLCI is not set
# CONFIG_PLIP is not set
# CONFIG_PPP is not set
# CONFIG_NET_RADIO is not set
# CONFIG_SLIP is not set
......@@ -154,9 +155,6 @@ CONFIG_PCNET32=y
# Filesystems
#
# CONFIG_QUOTA is not set
# CONFIG_DCACHE_PRELOAD is not set
# CONFIG_OMIRR is not set
# CONFIG_TRANS_NAMES is not set
# CONFIG_MINIX_FS is not set
CONFIG_EXT2_FS=y
# CONFIG_FAT_FS is not set
......@@ -194,6 +192,7 @@ CONFIG_SERIAL=y
# CONFIG_APM is not set
# CONFIG_WATCHDOG is not set
# CONFIG_RTC is not set
# CONFIG_JOYSTICK is not set
#
# Sound
......
......@@ -5,10 +5,13 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1996 by Ralf Baechle
* Copyright (C) 1996, 1997 by Ralf Baechle
*
* $Id: hw-access.c,v 1.2 1997/08/08 18:11:57 miguel Exp $
*/
#include <linux/config.h>
#include <linux/delay.h>
#include <linux/kbdcntrlr.h>
#include <linux/kernel.h>
#include <linux/linkage.h>
#include <linux/types.h>
......@@ -194,3 +197,32 @@ struct feature deskstation_rpc44_feature = {
rtc_write_data
};
#endif
static unsigned char dtc_read_input(void)
{
return inb(KBD_DATA_REG);
}
static void dtc_write_output(unsigned char val)
{
outb(val, KBD_DATA_REG);
}
static void dtc_write_command(unsigned char val)
{
outb(val, KBD_CNTL_REG);
}
static unsigned char dtc_read_status(void)
{
return inb(KBD_STATUS_REG);
}
static void dtc_rm200_keyboard_setup(void)
{
kbd_read_input = dtc_read_input;
kbd_write_output = dtc_write_output;
kbd_write_command = dtc_write_command;
kbd_read_status = dtc_read_status;
request_region(0x60, 16, "keyboard");
}
......@@ -6,6 +6,8 @@
* for more details.
*
* Copyright (C) 1996, 1997 by Ralf Baechle
*
* $Id: setup.c,v 1.2 1997/08/08 18:11:59 miguel Exp $
*/
#include <linux/config.h>
#include <linux/init.h>
......@@ -102,6 +104,7 @@ __initfunc(void deskstation_setup(void))
#endif
}
fd_cacheflush = deskstation_fd_cacheflush;
keyboard_setup = dtc_keyboard_setup;
request_region(0x00,0x20,"dma1");
request_region(0x40,0x20,"timer");
request_region(0x70,0x10,"rtc");
......
......@@ -45,13 +45,13 @@ unsigned video_res_x;
/*
* Various defines for the G364
*/
#define G364_MEM_BASE 0xe0800000
#define G364_PORT_BASE 0xe0200000
#define ID_REG 0xe0200000 /* Read only */
#define BOOT_REG 0xe0280000
#define TIMING_REG 0xe0280108 /* to 0x080170 - DON'T TOUCH! */
#define MASK_REG 0xe0280200
#define CTLA_REG 0xe0280300
#define G364_MEM_BASE 0xe4400000
#define G364_PORT_BASE 0xe4000000
#define ID_REG 0xe4000000 /* Read only */
#define BOOT_REG 0xe4080000
#define TIMING_REG 0xe4080108 /* to 0x080170 - DON'T TOUCH! */
#define MASK_REG 0xe4080200
#define CTLA_REG 0xe4080300
#define CURS_TOGGLE 0x800000
#define BIT_PER_PIX 0x700000 /* bits 22 to 20 of Control A */
#define DELAY_SAMPLE 0x080000
......@@ -72,14 +72,14 @@ unsigned video_res_x;
#define INTL_STAND 0x000004
#define SCRN_FORM 0x000002
#define ENABLE_VTG 0x000001
#define TOP_REG 0xe0280400
#define CURS_PAL_REG 0xe0280508 /* to 0x080518 */
#define CHKSUM_REG 0xe0280600 /* to 0x080610 - unused */
#define CURS_POS_REG 0xe0280638
#define CLR_PAL_REG 0xe0280800 /* to 0x080ff8 */
#define CURS_PAT_REG 0xe0281000 /* to 0x081ff8 */
#define MON_ID_REG 0xe0300000 /* unused */
#define RESET_REG 0xe0380000 /* Write only */
#define TOP_REG 0xe4080400
#define CURS_PAL_REG 0xe4080508 /* to 0x080518 */
#define CHKSUM_REG 0xe4080600 /* to 0x080610 - unused */
#define CURS_POS_REG 0xe4080638
#define CLR_PAL_REG 0xe4080800 /* to 0x080ff8 */
#define CURS_PAT_REG 0xe4081000 /* to 0x081ff8 */
#define MON_ID_REG 0xe4100000 /* unused */
#define RESET_REG 0xe4180000 /* Write only */
/*
* built-in font management constants
......
......@@ -5,7 +5,7 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1995, 1996 by Ralf Baechle
* Copyright (C) 1995, 1996, 1997 by Ralf Baechle
*/
#include <linux/delay.h>
#include <linux/linkage.h>
......@@ -15,6 +15,7 @@
#include <asm/vector.h>
#include <asm/jazz.h>
#include <asm/jazzdma.h>
#include <asm/keyboard.h>
#include <asm/pgtable.h>
#include <asm/mc146818rtc.h>
......@@ -146,3 +147,35 @@ struct feature jazz_feature = {
rtc_read_data,
rtc_write_data
};
static volatile keyboard_hardware *jazz_kh = (keyboard_hardware *)JAZZ_KEYBOARD_ADDRESS;
static unsigned char jazz_read_input(void)
{
return jazz_kh->data;
}
static void jazz_write_output(unsigned char val)
{
jazz_kh->data = val;
}
static void jazz_write_command(unsigned char val)
{
jazz_kh->command = val;
}
static unsigned char jazz_read_status(void)
{
return jazz_kh->command;
}
void jazz_keyboard_setup(void)
{
kbd_read_input = jazz_read_input;
kbd_write_output = jazz_write_output;
kbd_write_command = jazz_write_command;
kbd_read_status = jazz_read_status;
request_region(0x60, 16, "keyboard");
r4030_write_reg16(JAZZ_IO_IRQ_ENABLE, r4030_read_reg16(JAZZ_IO_IRQ_ENABLE) | JAZZ_IE_KEYBOARD);
}
......@@ -514,3 +514,18 @@ int vdma_get_residue(int channel)
return residual;
}
/*
* Get DMA channel enable register
*/
int vdma_get_enable(int channel)
{
int enable;
enable = r4030_read_reg32(JAZZ_R4030_CHNL_ENABLE+(channel<<5));
if (vdma_debug)
printk("vdma_get_enable: channel %d: enable=%d\n",channel,enable);
return enable;
}
......@@ -11,13 +11,16 @@
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/mm.h>
#include <asm/bootinfo.h>
#include <asm/keyboard.h>
#include <asm/irq.h>
#include <asm/jazz.h>
#include <asm/ptrace.h>
#include <asm/reboot.h>
#include <asm/vector.h>
#include <asm/io.h>
#include <asm/pgtable.h>
/*
* Initial irq handlers.
......@@ -32,6 +35,7 @@ static struct irqaction irq2 = { no_action, 0, 0, "cascade", NULL, NULL};
extern asmlinkage void jazz_handle_int(void);
extern asmlinkage void jazz_fd_cacheflush(const void *addr, size_t size);
extern struct feature jazz_feature;
extern void jazz_keyboard_setup(void);
extern void jazz_machine_restart(char *command);
extern void jazz_machine_halt(void);
......@@ -94,8 +98,13 @@ __initfunc(void jazz_setup(void))
}
}
add_wired_entry (0x02000017, 0x03c00017, 0xe0000000, PM_64K);
add_wired_entry (0x02400017, 0x02440017, 0xe2000000, PM_16M);
add_wired_entry (0x01800017, 0x01000017, 0xe4000000, PM_4M);
irq_setup = jazz_irq_setup;
fd_cacheflush = jazz_fd_cacheflush;
keyboard_setup = jazz_keyboard_setup;
feature = &jazz_feature; // Will go away
port_base = JAZZ_PORT_BASE;
isa_slot_offset = 0xe3000000;
......
......@@ -12,7 +12,7 @@
*
* Copyright (C) 1995 Andreas Busse
*
* $Id: gdb-stub.c,v 1.4 1997/06/30 15:52:25 ralf Exp $
* $Id: gdb-stub.c,v 1.5 1997/08/08 18:12:15 miguel Exp $
*/
/*
......@@ -67,12 +67,14 @@
*/
#include <linux/string.h>
#include <linux/signal.h>
#include <linux/kernel.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <asm/asm.h>
#include <asm/mipsregs.h>
#include <asm/cachectl.h>
#include <asm/pgtable.h>
#include <asm/system.h>
#include <asm/gdb-stub.h>
......@@ -98,13 +100,11 @@ extern void adel(void);
static void getpacket(char *buffer);
static void putpacket(char *buffer);
static void set_mem_fault_trap(int enable);
static int computeSignal(int tt);
static int hex(unsigned char ch);
static int hexToInt(char **ptr, int *intValue);
static unsigned char *mem2hex(char *mem, char *buf, int count, int may_fault);
void handle_exception(struct gdb_regs *regs);
static void show_gdbregs(struct gdb_regs *regs);
/*
* BUFMAX defines the maximum number of characters in inbound/outbound buffers
......@@ -241,6 +241,21 @@ static void putpacket(char *buffer)
*/
static volatile int mem_err = 0;
#if 0
static void set_mem_fault_trap(int enable)
{
mem_err = 0;
#if 0
if (enable)
exceptionHandler(9, fltr_set_mem_err);
else
exceptionHandler(9, trap_low);
#endif
}
#endif /* dead code */
/*
* Convert the memory pointed to by mem into hex, placing result in buf.
* Return a pointer to the last char put in buf (null), in case of mem fault,
......@@ -362,19 +377,6 @@ extern void fltr_set_mem_err(void)
/* FIXME: Needs to be written... */
}
static void set_mem_fault_trap(int enable)
{
mem_err = 0;
#if 0
if (enable)
exceptionHandler(9, fltr_set_mem_err);
else
exceptionHandler(9, trap_low);
#endif
}
/*
* Convert the MIPS hardware trap type code to a unix signal number.
*/
......@@ -415,6 +417,38 @@ static int hexToInt(char **ptr, int *intValue)
return (numChars);
}
#if 0
/*
* Print registers (on target console)
* Used only to debug the stub...
*/
void show_gdbregs(struct gdb_regs * regs)
{
/*
* Saved main processor registers
*/
printk("$0 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
regs->reg0, regs->reg1, regs->reg2, regs->reg3,
regs->reg4, regs->reg5, regs->reg6, regs->reg7);
printk("$8 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
regs->reg8, regs->reg9, regs->reg10, regs->reg11,
regs->reg12, regs->reg13, regs->reg14, regs->reg15);
printk("$16: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
regs->reg16, regs->reg17, regs->reg18, regs->reg19,
regs->reg20, regs->reg21, regs->reg22, regs->reg23);
printk("$24: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
regs->reg24, regs->reg25, regs->reg26, regs->reg27,
regs->reg28, regs->reg29, regs->reg30, regs->reg31);
/*
* Saved cp0 registers
*/
printk("epc : %08lx\nStatus: %08lx\nCause : %08lx\n",
regs->cp0_epc, regs->cp0_status, regs->cp0_cause);
}
#endif /* dead code */
/*
* This function does all command processing for interfacing to gdb. It
* returns 1 if you should skip the instruction at the trap address, 0
......@@ -726,32 +760,3 @@ void adel(void)
lw $9,0($8)
");
}
/*
* Print registers (on target console)
* Used only to debug the stub...
*/
void show_gdbregs(struct gdb_regs * regs)
{
/*
* Saved main processor registers
*/
printk("$0 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
regs->reg0, regs->reg1, regs->reg2, regs->reg3,
regs->reg4, regs->reg5, regs->reg6, regs->reg7);
printk("$8 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
regs->reg8, regs->reg9, regs->reg10, regs->reg11,
regs->reg12, regs->reg13, regs->reg14, regs->reg15);
printk("$16: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
regs->reg16, regs->reg17, regs->reg18, regs->reg19,
regs->reg20, regs->reg21, regs->reg22, regs->reg23);
printk("$24: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
regs->reg24, regs->reg25, regs->reg26, regs->reg27,
regs->reg28, regs->reg29, regs->reg30, regs->reg31);
/*
* Saved cp0 registers
*/
printk("epc : %08lx\nStatus: %08lx\nCause : %08lx\n",
regs->cp0_epc, regs->cp0_status, regs->cp0_cause);
}
/* $Id: irix5sys.h,v 1.1 1997/06/06 09:32:29 ralf Exp $
/* $Id: irix5sys.h,v 1.2 1997/08/08 18:12:17 miguel Exp $
* irix5sys.h: 32-bit IRIX5 ABI system call table.
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
......
/* $Id: irixioctl.c,v 1.1 1997/06/06 09:32:33 ralf Exp $
/* $Id: irixioctl.c,v 1.2 1997/08/08 18:12:19 miguel Exp $
* irixioctl.c: A fucking mess...
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
......
/* $Id: irixsig.c,v 1.2 1997/06/13 10:11:22 ralf Exp $
/* $Id: irixsig.c,v 1.4 1997/08/08 18:12:21 miguel Exp $
* irixsig.c: WHEEE, IRIX signals! YOW, am I compatable or what?!?!
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
......@@ -142,7 +142,7 @@ asmlinkage int do_irix_signal(unsigned long oldmask, struct pt_regs * regs)
if ((current->flags & PF_PTRACED) && signr != SIGKILL) {
current->exit_code = signr;
current->state = TASK_STOPPED;
notify_parent(current);
notify_parent(current, SIGCHLD);
schedule();
if (!(signr = current->exit_code))
continue;
......@@ -180,7 +180,7 @@ asmlinkage int do_irix_signal(unsigned long oldmask, struct pt_regs * regs)
current->exit_code = signr;
if (!(current->p_pptr->sig->action[SIGCHLD-1].sa_flags &
SA_NOCLDSTOP))
notify_parent(current);
notify_parent(current, SIGCHLD);
schedule();
continue;
......@@ -593,7 +593,6 @@ asmlinkage int irix_sigpoll_sys(unsigned long *set, struct irix5_siginfo *info,
#define P_ALL 7
extern int getrusage(struct task_struct *, int, struct rusage *);
extern void release(struct task_struct * p);
#define W_EXITED 1
#define W_TRAPPED 2
......@@ -680,7 +679,7 @@ asmlinkage int irix_waitsys(int type, int pid, struct irix5_siginfo *info,
REMOVE_LINKS(p);
p->p_pptr = p->p_opptr;
SET_LINKS(p);
notify_parent(p);
notify_parent(p, SIGCHLD);
} else
release(p);
goto end_waitsys;
......
......@@ -11,7 +11,7 @@
*
* Mips support by Ralf Baechle and Andreas Busse
*
* $Id: irq.c,v 1.6 1997/06/30 15:52:34 ralf Exp $
* $Id: irq.c,v 1.7 1997/08/08 18:12:24 miguel Exp $
*/
#include <linux/config.h>
#include <linux/errno.h>
......@@ -51,6 +51,9 @@ unsigned long spurious_count = 0;
static inline void mask_irq(unsigned int irq_nr)
{
unsigned char mask;
if (irq_nr >= 16)
return;
mask = 1 << (irq_nr & 7);
if (irq_nr < 8) {
......@@ -66,6 +69,9 @@ static inline void unmask_irq(unsigned int irq_nr)
{
unsigned char mask;
if (irq_nr >= 16)
return;
mask = ~(1 << (irq_nr & 7));
if (irq_nr < 8) {
cache_21 &= mask;
......
......@@ -5,40 +5,69 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1996 by Ralf Baechle
* Copyright (C) 1996, 1997 by Ralf Baechle
*
* $Id: mips_ksyms.c,v 1.2 1997/08/08 18:12:26 miguel Exp $
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/in6.h>
#include <asm/checksum.h>
#include <asm/dma.h>
#include <asm/floppy.h>
#include <asm/io.h>
#include <asm/page.h>
#include <asm/pgtable.h>
#include <asm/sgihpc.h>
#include <asm/softirq.h>
#include <asm/uaccess.h>
EXPORT_SYMBOL(EISA_bus);
/*
* String functions
*/
EXPORT_SYMBOL_NOVERS(bcopy);
EXPORT_SYMBOL_NOVERS(memcmp);
EXPORT_SYMBOL_NOVERS(memset);
EXPORT_SYMBOL_NOVERS(memcpy);
EXPORT_SYMBOL_NOVERS(memmove);
EXPORT_SYMBOL_NOVERS(bcopy);
EXPORT_SYMBOL_NOVERS(strcat);
EXPORT_SYMBOL_NOVERS(strchr);
EXPORT_SYMBOL_NOVERS(strlen);
EXPORT_SYMBOL_NOVERS(strncat);
EXPORT_SYMBOL_NOVERS(strnlen);
EXPORT_SYMBOL_NOVERS(strrchr);
EXPORT_SYMBOL_NOVERS(strtok);
EXPORT_SYMBOL(clear_page);
EXPORT_SYMBOL(__mips_bh_counter);
EXPORT_SYMBOL(local_irq_count);
/*
* Userspace access stuff.
*/
EXPORT_SYMBOL(__copy_user);
EXPORT_SYMBOL(active_ds);
/* Networking helper routines. */
EXPORT_SYMBOL(csum_partial_copy);
/*
* Functions to control caches.
*/
EXPORT_SYMBOL(flush_page_to_ram);
EXPORT_SYMBOL(fd_cacheflush);
/*
* Base address of ports for Intel style I/O.
*/
EXPORT_SYMBOL(port_base);
#ifdef CONFIG_SGI
EXPORT_SYMBOL(hpc3c0);
#endif
......@@ -488,7 +488,7 @@ asmlinkage void syscall_trace(void)
return;
current->exit_code = SIGTRAP;
current->state = TASK_STOPPED;
notify_parent(current);
notify_parent(current, SIGCHLD);
schedule();
/*
* this isn't the same as continuing with a signal, but it will do
......
......@@ -4,7 +4,7 @@
* Copyright (C) 1991, 1992 Linus Torvalds
* Copyright (C) 1994, 1995, 1996 Ralf Baechle
*
* $Id: signal.c,v 1.7 1997/06/25 19:25:08 ralf Exp $
* $Id: signal.c,v 1.8 1997/08/08 18:12:30 miguel Exp $
*/
#include <linux/config.h>
#include <linux/sched.h>
......@@ -292,7 +292,7 @@ asmlinkage int do_signal(unsigned long oldmask, struct pt_regs * regs)
if ((current->flags & PF_PTRACED) && signr != SIGKILL) {
current->exit_code = signr;
current->state = TASK_STOPPED;
notify_parent(current);
notify_parent(current, SIGCHLD);
schedule();
if (!(signr = current->exit_code))
continue;
......@@ -332,7 +332,7 @@ asmlinkage int do_signal(unsigned long oldmask, struct pt_regs * regs)
current->exit_code = signr;
if (!(current->p_pptr->sig->action[SIGCHLD-1].sa_flags &
SA_NOCLDSTOP))
notify_parent(current);
notify_parent(current, SIGCHLD);
schedule();
continue;
......
......@@ -88,7 +88,7 @@ asmlinkage int sys_idle(void)
* possible. Should help alot for battery powered
* R4200/4300i systems.
*/
if (wait_available && !need_resched)
if (wait_available && !resched_needed())
__asm__(".set\tmips3\n\t"
"wait\n\t"
".set\tmips0\n\t");
......
......@@ -5,9 +5,9 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1995, 1996 by Ralf Baechle
* Copyright (C) 1995, 1996, 1997 by Ralf Baechle
*
* $Id: syscalls.h,v 1.6 1997/07/20 15:32:25 ralf Exp $
* $Id: syscalls.h,v 1.7 1997/08/08 18:12:32 miguel Exp $
*/
/*
......@@ -210,3 +210,5 @@ SYS(sys_poll, 3)
SYS(sys_nfsservctl, 3)
SYS(sys_setresgid, 3) /* 4190 */
SYS(sys_getresgid, 3)
SYS(sys_setresgid, 3) /* 4190 */
SYS(sys_getresgid, 3)
/* $Id: sysirix.c,v 1.3 1997/07/20 15:32:25 ralf Exp $
/* $Id: sysirix.c,v 1.4 1997/08/08 18:12:35 miguel Exp $
* sysirix.c: IRIX system call emulation.
*
* Copyright (C) 1996 David S. Miller
......@@ -751,6 +751,8 @@ asmlinkage int irix_fstatfs(unsigned int fd, struct irix_statfs *buf)
}
error = 0;
dput_and_out:
dput(dentry);
out:
unlock_kernel();
return error;
......@@ -1514,6 +1516,8 @@ asmlinkage int irix_fstatvfs(int fd, struct irix_statvfs *buf)
error = 0;
dput_and_out:
dput(dentry);
out:
unlock_kernel();
return error;
......@@ -1877,6 +1881,8 @@ asmlinkage int irix_fstatvfs64(int fd, struct irix_statvfs *buf)
error = 0;
dput_and_out:
dput(dentry);
out:
unlock_kernel();
return error;
......
......@@ -7,7 +7,7 @@
*
* Copyright (C) 1995, 1996, 1997 by Ralf Baechle
*
* $Id: sysmips.c,v 1.5 1997/07/20 15:32:27 ralf Exp $
* $Id: sysmips.c,v 1.6 1997/08/08 18:12:38 miguel Exp $
*/
#include <linux/errno.h>
#include <linux/linkage.h>
......
......@@ -6,7 +6,7 @@
* This file contains the time handling details for PC-style clocks as
* found in some MIPS systems.
*
* $Id: time.c,v 1.4 1997/06/30 15:52:40 ralf Exp $
* $Id: time.c,v 1.5 1997/08/08 18:12:39 miguel Exp $
*/
#include <linux/errno.h>
#include <linux/init.h>
......
......@@ -196,6 +196,8 @@ static void default_be_board_handler(struct pt_regs *regs)
/*
* Assume it would be too dangerous to continue ...
*/
printk ("BE HANDLER\n");
show_regs (regs);
force_sig(SIGBUS, current);
}
......
#
# Makefile for MIPS-specific library files..
#
# Many of these routines are just left over debugging trash of ancient
# times when I just make my Tyne beep and so ...
#
# ...and for when I need to get the DECStation to use the boot prom to
# do things... Paul M. Antoine.
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
......@@ -8,8 +14,8 @@
$(CC) $(CFLAGS) -c $< -o $*.o
L_TARGET = lib.a
L_OBJS = checksum.o copy_user.o csum.o dump_tlb.o io.o \
memset.o memcpy.o strlen_user.o strncpy_user.o tags.o watch.o
L_OBJS = beep.o checksum.o copy_user.o csum.o dump_tlb.o io.o memset.o \
memcpy.o strlen_user.o strncpy_user.o tags.o watch.o
ifdef CONFIG_DECSTATION
L_OBJS += pmaxcon.o pmaxio.o
......
......@@ -5,7 +5,7 @@
*
* MIPS specific IP/TCP/UDP checksumming routines
*
* Authors: Ralf Baechle, <ralf@waldorf-gmbh.de>
* Authors: Ralf Baechle, <ralf@gnu.ai.mit.edu>
* Lots of code moved from tcp.c and ip.c; see those files
* for more names.
*
......@@ -14,7 +14,7 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* $Id: checksum.c,v 1.4 1997/07/03 09:43:16 ralf Exp $
* $Id: checksum.c,v 1.5 1997/08/08 18:12:51 miguel Exp $
*/
#include <net/checksum.h>
#include <linux/types.h>
......
......@@ -16,12 +16,27 @@
#include <asm/page.h>
#include <asm/pgtable.h>
static char *region_map [] = {
"u", "s", "k", "!"
};
static char *cache_map [] = {
"c/nc/wt/nwa,",
"c/nc/wt/wa, ",
"uncached, ",
"c/nc/wb, "
"unknown, ",
"unknown, ",
"unknown, ",
"unknown, "
};
void
dump_tlb(int first, int last)
{
int i;
int wired;
unsigned int pagemask;
unsigned int pagemask, c0, c1, r;
unsigned long long entryhi, entrylo0, entrylo1;
wired = read_32bit_cp0_register(CP0_WIRED);
......@@ -48,14 +63,25 @@ dump_tlb(int first, int last)
/*
* Only print entries in use
*/
printk("\nIndex: %2d %08x", i, pagemask);
printk(" %08x %08x", (unsigned int)(entryhi >> 32),
(unsigned int) entryhi);
printk(" %08x %08x", (unsigned int)(entrylo0 >> 32),
(unsigned int) entrylo0);
printk(" %08x %08x", (unsigned int)(entrylo1 >> 32),
(unsigned int) entrylo1);
printk("\nIndex: %2d pgmask=%08x ", i, pagemask);
r = entryhi >> 62;
c0 = (entrylo0 >> 3) & 7;
c1 = (entrylo1 >> 3) & 7;
printk("%s vpn2=%08x "
"[pfn=%06x c=%d d=%d v=%d g=%d]"
"[pfn=%06x c=%d d=%d v=%d g=%d]",
region_map [r], (entryhi >> 13) & 0xffffffff,
(entrylo0 >> 6) & 0xffffff, c0,
(entrylo0 & 4) ? 1 : 0,
(entrylo0 & 2) ? 1 : 0,
(entrylo0 & 1),
(entrylo1 >> 6) & 0xffffff, c1,
(entrylo1 & 4) ? 1 : 0,
(entrylo1 & 2) ? 1 : 0,
(entrylo1 & 1));
}
}
printk("\n");
......
......@@ -11,4 +11,8 @@ O_TARGET := mm.o
O_OBJS := extable.o init.o fault.o r4xx0.o r2300.o r6000.o tfp.o \
andes.o loadmmu.o
ifdef CONFIG_SGI
O_OBJS += umap.o
endif
include $(TOPDIR)/Rules.make
/* $Id: andes.c,v 1.1 1997/06/06 09:34:31 ralf Exp $
/* $Id: andes.c,v 1.2 1997/08/08 18:13:01 miguel Exp $
* andes.c: MMU and cache operations for the R10000 (ANDES).
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
......@@ -79,6 +79,12 @@ static void andes_pgd_init(unsigned long page)
{
}
static void andes_add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
unsigned long entryhi, unsigned long pagemask)
{
/* XXX */
}
void ld_mmu_andes(void)
{
flush_cache_all = andes_flush_cache_all;
......@@ -92,6 +98,8 @@ void ld_mmu_andes(void)
flush_tlb_mm = andes_flush_tlb_mm;
flush_tlb_range = andes_flush_tlb_range;
flush_tlb_page = andes_flush_tlb_page;
add_wired_entry = andes_add_wired_entry;
load_pgd = andes_load_pgd;
pgd_init = andes_pgd_init;
......
......@@ -117,7 +117,8 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
* terminate things with extreme prejudice.
*/
printk(KERN_ALERT "Unable to handle kernel paging request at virtual "
"address %08lx, epc == %08lx\n", address, regs->cp0_epc);
"address %08lx, epc == %08lx, ra == %08lx\n",
address, regs->cp0_epc, regs->regs[31]);
die_if_kernel("Oops", regs, writeaccess);
do_exit(SIGKILL);
out:
......
/* $Id: loadmmu.c,v 1.1 1997/06/06 09:34:51 ralf Exp $
/* $Id: loadmmu.c,v 1.2 1997/08/08 18:13:05 miguel Exp $
* loadmmu.c: Setup cpu/cache specific function ptrs at boot time.
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
......@@ -41,6 +41,10 @@ void (*update_mmu_cache)(struct vm_area_struct * vma,
unsigned long address, pte_t pte);
void (*show_regs)(struct pt_regs *);
void (*add_wired_entry)(unsigned long entrylo0, unsigned long entrylo1,
unsigned long entryhi, unsigned long pagemask);
asmlinkage void (*resume)(void *tsk);
extern void ld_mmu_r2300(void);
......
......@@ -3,7 +3,7 @@
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
*
* $Id: r2300.c,v 1.2 1997/06/30 15:52:51 ralf Exp $
* $Id: r2300.c,v 1.3 1997/08/08 18:13:06 miguel Exp $
*/
#include <linux/kernel.h>
......@@ -245,6 +245,14 @@ static void r2300_show_regs(struct pt_regs * regs)
(unsigned int) regs->cp0_cause);
}
static void r2300_add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
unsigned long entryhi, unsigned long pagemask)
{
/*
* FIXME, to be done
*/
}
void ld_mmu_r2300(void)
{
clear_page = r2300_clear_page;
......@@ -267,6 +275,8 @@ void ld_mmu_r2300(void)
update_mmu_cache = r2300_update_mmu_cache;
show_regs = r2300_show_regs;
add_wired_entry = r2300_add_wired_entry;
flush_tlb_all();
}
......@@ -3,7 +3,7 @@
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
*
* $Id: r4xx0.c,v 1.4 1997/06/30 15:52:53 ralf Exp $
* $Id: r4xx0.c,v 1.5 1997/08/08 18:13:07 miguel Exp $
*/
#include <linux/config.h>
......@@ -1856,7 +1856,7 @@ static inline void r4k_flush_tlb_all(void)
set_entrylo1(0);
BARRIER;
entry = 0;
entry = get_wired();
/* Blast 'em all away. */
while(entry < NTLB_ENTRIES) {
......@@ -1943,7 +1943,7 @@ static void r4k_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
int oldpid, newpid, idx;
#ifdef DEBUG_TLB
printk("[tlbpage<%d,%08lx>]", vma->vm_mm->context, page);
printk("[tlbpage<%d,%08lx>]", vma->vm_mm->context, page);
#endif
newpid = (vma->vm_mm->context & 0xff);
page &= (PAGE_MASK << 1);
......@@ -2122,6 +2122,37 @@ static void r4k_show_regs(struct pt_regs * regs)
printk("epc : %08lx\nStatus: %08lx\nCause : %08lx\n",
regs->cp0_epc, regs->cp0_status, regs->cp0_cause);
}
static void r4k_add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
unsigned long entryhi, unsigned long pagemask)
{
unsigned long flags;
unsigned long wired;
unsigned long old_pagemask;
unsigned long old_ctx;
save_and_cli(flags);
/* Save old context and create impossible VPN2 value */
old_ctx = (get_entryhi() & 0xff);
old_pagemask = get_pagemask();
wired = get_wired();
set_wired (wired + 1);
set_index (wired);
BARRIER;
set_pagemask (pagemask);
set_entryhi(entryhi);
set_entrylo0(entrylo0);
set_entrylo1(entrylo1);
BARRIER;
tlb_write_indexed();
BARRIER;
set_entryhi(old_ctx);
BARRIER;
set_pagemask (old_pagemask);
flush_tlb_all();
restore_flags(flags);
}
/* Detect and size the various r4k caches. */
static void probe_icache(unsigned long config)
......@@ -2567,6 +2598,8 @@ void ld_mmu_r4xx0(void)
update_mmu_cache = r4k_update_mmu_cache;
show_regs = r4k_show_regs;
add_wired_entry = r4k_add_wired_entry;
flush_cache_all();
write_32bit_cp0_register(CP0_WIRED, 0);
......
/* $Id: r6000.c,v 1.1 1997/06/06 09:35:31 ralf Exp $
/* $Id: r6000.c,v 1.2 1997/08/08 18:13:11 miguel Exp $
* r6000.c: MMU and cache routines for the R6000 processors.
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
......@@ -156,6 +156,12 @@ static void r6000_show_regs(struct pt_regs * regs)
(unsigned int) regs->cp0_cause);
}
static void r6000_add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
unsigned long entryhi, unsigned long pagemask)
{
/* XXX */
}
void ld_mmu_r6000(void)
{
flush_cache_all = r6000_flush_cache_all;
......@@ -175,6 +181,8 @@ void ld_mmu_r6000(void)
update_mmu_cache = r6000_update_mmu_cache;
show_regs = r6000_show_regs;
add_wired_entry = r6000_add_wired_entry;
flush_cache_all();
flush_tlb_all();
......
/* $Id: tfp.c,v 1.1 1997/06/06 09:35:39 ralf Exp $
/* $Id: tfp.c,v 1.2 1997/08/08 18:13:13 miguel Exp $
* tfp.c: MMU and cache routines specific to the r8000 (TFP).
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
......@@ -79,6 +79,12 @@ static void tfp_pgd_init(unsigned long page)
{
}
static void tfp_add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
unsigned long entryhi, unsigned long pagemask)
{
/* XXX */
}
void ld_mmu_tfp(void)
{
flush_cache_all = tfp_flush_cache_all;
......@@ -93,9 +99,11 @@ void ld_mmu_tfp(void)
flush_tlb_range = tfp_flush_tlb_range;
flush_tlb_page = tfp_flush_tlb_page;
add_wired_entry = tfp_add_wired_entry;
load_pgd = tfp_load_pgd;
pgd_init = tfp_pgd_init;
flush_cache_all();
flush_tlb_all();
}
......
/*
* arch/mips/mm/umap.c
*
* (C) Copyright 1994 Linus Torvalds
*
* Changes:
*
* Modified from Linus source to removing active mappings from any
* task. This is required for implementing the virtual graphics
* interface for direct rendering on the SGI - miguel.
*
* Added a routine to map a vmalloc()ed area into user space, this one
* is required by the /dev/shmiq driver - miguel.
*/
#include <linux/stat.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/smp_lock.h>
#include <linux/shm.h>
#include <linux/errno.h>
#include <linux/mman.h>
#include <linux/string.h>
#include <linux/vmalloc.h>
#include <linux/swap.h>
#include <asm/system.h>
#include <asm/pgtable.h>
#include <asm/page.h>
static inline void
remove_mapping_pte_range (pmd_t *pmd, unsigned long address, unsigned long size)
{
pte_t *pte;
unsigned long end;
if (pmd_none (*pmd))
return;
if (pmd_bad (*pmd)){
printk ("remove_graphics_pte_range: bad pmd (%08lx)\n", pmd_val (*pmd));
pmd_clear (pmd);
return;
}
pte = pte_offset (pmd, address);
address &= ~PMD_MASK;
end = address + size;
if (end > PMD_SIZE)
end = PMD_SIZE;
do {
pte_t entry = *pte;
if (pte_present (entry))
set_pte (pte, pte_modify (entry, PAGE_NONE));
address += PAGE_SIZE;
pte++;
} while (address < end);
}
static inline void
remove_mapping_pmd_range (pgd_t *pgd, unsigned long address, unsigned long size)
{
pmd_t *pmd;
unsigned long end;
if (pgd_none (*pgd))
return;
if (pgd_bad (*pgd)){
printk ("remove_graphics_pmd_range: bad pgd (%08lx)\n", pgd_val (*pgd));
pgd_clear (pgd);
return;
}
pmd = pmd_offset (pgd, address);
address &= ~PGDIR_MASK;
end = address + size;
if (end > PGDIR_SIZE)
end = PGDIR_SIZE;
do {
remove_mapping_pte_range (pmd, address, end - address);
address = (address + PMD_SIZE) & PMD_MASK;
pmd++;
} while (address < end);
}
/*
* This routine is called from the page fault handler to remove a
* range of active mappings at this point
*/
void
remove_mapping (struct task_struct *task, unsigned long start, unsigned long end)
{
unsigned long beg = start;
pgd_t *dir;
down (&task->mm->mmap_sem);
dir = pgd_offset (task->mm, start);
flush_cache_range (task->mm, beg, end);
while (start < end){
remove_mapping_pmd_range (dir, start, end - start);
start = (start + PGDIR_SIZE) & PGDIR_MASK;
dir++;
}
flush_tlb_range (task->mm, beg, end);
up (&task->mm->mmap_sem);
}
void *vmalloc_uncached (unsigned long size)
{
return vmalloc_prot (size, PAGE_KERNEL_UNCACHED);
}
static inline void free_pte(pte_t page)
{
if (pte_present(page)) {
unsigned long addr = pte_page(page);
if (MAP_NR(addr) >= max_mapnr || PageReserved(mem_map+MAP_NR(addr)))
return;
free_page(addr);
if (current->mm->rss <= 0)
return;
current->mm->rss--;
return;
}
swap_free(pte_val(page));
}
static inline void forget_pte(pte_t page)
{
if (!pte_none(page)) {
printk("forget_pte: old mapping existed!\n");
free_pte(page);
}
}
/*
* maps a range of vmalloc()ed memory into the requested pages. the old
* mappings are removed.
*/
static inline void
vmap_pte_range (pte_t *pte, unsigned long address, unsigned long size, unsigned long vaddr)
{
unsigned long end;
pgd_t *vdir;
pmd_t *vpmd;
pte_t *vpte;
address &= ~PMD_MASK;
end = address + size;
if (end > PMD_SIZE)
end = PMD_SIZE;
do {
pte_t oldpage = *pte;
unsigned long page;
pte_clear(pte);
vdir = pgd_offset_k (vaddr);
vpmd = pmd_offset (vdir, vaddr);
vpte = pte_offset (vpmd, vaddr);
page = pte_page (*vpte);
set_pte(pte, mk_pte_phys(page, PAGE_USERIO));
forget_pte(oldpage);
address += PAGE_SIZE;
vaddr += PAGE_SIZE;
pte++;
} while (address < end);
}
static inline int
vmap_pmd_range (pmd_t *pmd, unsigned long address, unsigned long size, unsigned long vaddr)
{
unsigned long end;
address &= ~PGDIR_MASK;
end = address + size;
if (end > PGDIR_SIZE)
end = PGDIR_SIZE;
vaddr -= address;
do {
pte_t * pte = pte_alloc(pmd, address);
if (!pte)
return -ENOMEM;
vmap_pte_range(pte, address, end - address, address + vaddr);
address = (address + PMD_SIZE) & PMD_MASK;
pmd++;
} while (address < end);
return 0;
}
int
vmap_page_range (unsigned long from, unsigned long size, unsigned long vaddr)
{
int error = 0;
pgd_t * dir;
unsigned long beg = from;
unsigned long end = from + size;
vaddr -= from;
dir = pgd_offset(current->mm, from);
flush_cache_range(current->mm, beg, end);
while (from < end) {
pmd_t *pmd = pmd_alloc(dir, from);
error = -ENOMEM;
if (!pmd)
break;
error = vmap_pmd_range(pmd, from, end - from, vaddr + from);
if (error)
break;
from = (from + PGDIR_SIZE) & PGDIR_MASK;
dir++;
}
flush_tlb_range(current->mm, beg, end);
return error;
}
/* $Id: setup.c,v 1.2 1997/06/30 15:26:24 ralf Exp $
/*
* setup.c: SGI specific setup, including init of the feature struct.
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
*
* $Id: setup.c,v 1.3 1997/08/08 18:13:22 miguel Exp $
*/
#ifndef __GOGOGO__
#error "... about to fuckup your Indy?"
......@@ -9,6 +11,8 @@
#include <linux/kernel.h>
#include <linux/sched.h>
#include <asm/addrspace.h>
#include <asm/keyboard.h>
#include <asm/reboot.h>
#include <asm/vector.h>
#include <asm/sgialib.h>
......@@ -26,6 +30,36 @@ extern void sgi_machine_power_off(void);
struct feature sgi_feature = {
};
static volatile struct hpc_keyb *sgi_kh = (struct hpc_keyb *) (KSEG1 + 0x1fbd9800 + 64);
static unsigned char sgi_read_input(void)
{
return sgi_kh->data;
}
static void sgi_write_output(unsigned char val)
{
sgi_kh->data = val;
}
static void sgi_write_command(unsigned char val)
{
sgi_kh->command = val;
}
static unsigned char sgi_read_status(void)
{
return sgi_kh->command;
}
static void sgi_keyboard_setup(void)
{
kbd_read_input = sgi_read_input;
kbd_write_output = sgi_write_output;
kbd_write_command = sgi_write_command;
kbd_read_status = sgi_read_status;
}
static void sgi_irq_setup(void)
{
sgint_init();
......@@ -52,6 +86,7 @@ void sgi_setup(void)
irq_setup = sgi_irq_setup;
feature = &sgi_feature;
keyboard_setup = sgi_keyboard_setup;
_machine_restart = sgi_machine_restart;
_machine_halt = sgi_machine_halt;
......
......@@ -5,9 +5,12 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1996 by Ralf Baechle
* Copyright (C) 1996, 1997 by Ralf Baechle
*
* $Id: hw-access.c,v 1.2 1997/08/08 18:13:27 miguel Exp $
*/
#include <linux/delay.h>
#include <linux/kbdcntrlr.h>
#include <linux/kernel.h>
#include <linux/linkage.h>
#include <linux/types.h>
......@@ -15,6 +18,7 @@
#include <asm/bootinfo.h>
#include <asm/cachectl.h>
#include <asm/dma.h>
#include <asm/keyboard.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/mc146818rtc.h>
......@@ -157,3 +161,32 @@ struct feature sni_rm200_pci_feature = {
rtc_read_data,
rtc_write_data
};
static unsigned char sni_read_input(void)
{
return inb(KBD_DATA_REG);
}
static void sni_write_output(unsigned char val)
{
outb(val, KBD_DATA_REG);
}
static void sni_write_command(unsigned char val)
{
outb(val, KBD_CNTL_REG);
}
static unsigned char sni_read_status(void)
{
return inb(KBD_STATUS_REG);
}
void sni_rm200_keyboard_setup(void)
{
kbd_read_input = sni_read_input;
kbd_write_output = sni_write_output;
kbd_write_command = sni_write_command;
kbd_read_status = sni_read_status;
request_region(0x60, 16, "keyboard");
}
......@@ -15,6 +15,7 @@
#include <linux/timex.h>
#include <linux/pci.h>
#include <asm/bootinfo.h>
#include <asm/keyboard.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/processor.h>
......@@ -36,6 +37,7 @@ static struct irqaction irq2 = { no_action, 0, 0, "cascade", NULL, NULL};
extern asmlinkage void sni_rm200_pci_handle_int(void);
extern asmlinkage void sni_fd_cacheflush(const void *addr, size_t size);
extern struct feature sni_rm200_pci_feature;
extern void sni_rm200_keyboard_setup(void);
extern void sni_machine_restart(char *command);
extern void sni_machine_halt(void);
......@@ -127,6 +129,7 @@ __initfunc(void sni_rm200_pci_setup(void))
fd_cacheflush = sni_fd_cacheflush; // Will go away
feature = &sni_rm200_pci_feature;
port_base = SNI_PORT_BASE;
keyboard_setup = sni_rm200_keyboard_setup;
/*
* Setup (E)ISA I/O memory access stuff
......
......@@ -12,29 +12,30 @@
#
# Copyright (C) 1994 by Linus Torvalds
# Changes for PPC by Gary Thomas
# Modified by Cort Dougan
# Modified by Cort Dougan and Paul Mackerras
#
ifeq ($(CONFIG_PMAC),y)
KERNELBASE =0xc0000000
else
KERNELBASE =0x90000000
endif
# PowerPC (cross) tools
SUFFIX =
AS = as$(SUFFIX)
ASFLAGS =
LD = ld$(SUFFIX)
LINKFLAGS = -T arch/ppc/ld.script -Ttext 0x90000000
HOSTCC = gcc
CC = gcc$(SUFFIX)
ifneq ($(shell uname -m),ppc)
CROSS_COMPILE =powerpc-eabi-
endif
ASFLAGS =
LINKFLAGS = -T arch/ppc/vmlinux.lds -Ttext $(KERNELBASE) -Bstatic
CFLAGSINC = -D__KERNEL__ -I$(TOPDIR)/include -D__powerpc__
CFLAGS = $(CFLAGSINC) \
-Wstrict-prototypes -fomit-frame-pointer \
-Wall -Wstrict-prototypes -Wno-uninitialized \
-fno-builtin \
-finhibit-size-directive \
-O2 -fsigned-char -pipe -ffixed-r2 -mstring -mmultiple -msoft-float
# -fverbose-asm
-fsigned-char \
-msoft-float \
-O2 -pipe
CPP = $(CC) -E $(CFLAGS)
AR = ar$(SUFFIX)
RANLIB = ranlib$(SUFFIX)
STRIP = strip$(SUFFIX)
NM = nm$(SUFFIX)
ifdef CONFIG_601
CFLAGS := $(CFLAGS) -mcpu=601 -DCPU=601
......@@ -55,59 +56,38 @@ SUBDIRS := $(SUBDIRS) $(ARCH_SUBDIRS)
ARCHIVES := arch/ppc/kernel/kernel.o arch/ppc/mm/mm.o arch/ppc/lib/lib.o $(ARCHIVES)
CORE_FILES := arch/ppc/kernel/kernel.o arch/ppc/mm/mm.o arch/ppc/lib/lib.o $(CORE_FILES)
ifdef CONFIG_XMON
SUBDIRS += arch/ppc/xmon
CORE_FILES += arch/ppc/xmon/x.o
endif
ifdef CONFIG_PMAC
MAKEBOOT = $(MAKE) -C arch/$(ARCH)/coffboot
else
# PReP systems
MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
endif
checks:
@$(MAKE) -C arch/$(ARCH)/kernel checks
netboot: checks vmlinux
@$(MAKEBOOT) netboot
znetboot: checks vmlinux
@$(MAKEBOOT) znetboot
#rcpboot: checks vmlinux
# @$(MAKEBOOT) rcpboot
BOOT_TARGETS = netboot znetboot zImage floppy install \
vmlinux.coff znetboot.initrd zImage.initrd
zImage: checks vmlinux
@$(MAKEBOOT) zImage
$(BOOT_TARGETS): checks vmlinux
@$(MAKEBOOT) $@
floppy: checks vmlinux
@$(MAKEBOOT) floppy
install: checks vmlinux
@$(MAKEBOOT) install
vmlinux.coff : checks vmlinux
$(MAKE) -C arch/ppc/coffboot/ vmlinux.coff
arch/ppc/kernel: dummy
$(MAKE) linuxsubdirs SUBDIRS=arch/ppc/kernel
arch/ppc/mm: dummy
$(MAKE) linuxsubdirs SUBDIRS=arch/ppc/mm
arch/ppc/lib: dummy
$(MAKE) linuxsubdirs SUBDIRS=arch/ppc/lib
diffs:
arch/ppc/mkdiff
tar:
arch/ppc/mktar
tags:
etags */*.c include/{asm,linux}/*.h arch/ppc/kernel/*.{c,h}
archclean:
rm -f arch/ppc/kernel/mk_defs arch/ppc/kernel/ppc_defs.h arch/ppc/kernel/checks TAGS
rm -f `find arch/ppc/ \( -name '*.[oas]' -o -name '*~' -o -name '#*#' \) -print`
rm -f `find include/asm-ppc/ \( -name '*.[oas]' -o -name '*~' -o -name '#*#' \) -print`
rm -f arch/ppc/kernel/mk_defs arch/ppc/kernel/ppc_defs.h
rm -f arch/ppc/kernel/checks
find arch/ppc/ -name '*.o' -exec /bin/rm -f '{}' \;
find arch/ppc/ -name '*~' -exec /bin/rm -f '{}' \;
find arch/ppc/ -name '*.a' -exec /bin/rm -f '{}' \;
@$(MAKEBOOT) clean
archdep:
$(MAKE) -C arch/ppc/boot fastdep
$(MAKE) -C arch/ppc/kernel fastdep
$(MAKE) -C arch/ppc/mm fastdep
$(MAKE) -C arch/ppc/lib fastdep
tags :
etags arch/ppc/*/*.c arch/ppc/*/*.S include/asm/* */*.c
$(MAKEBOOT) fastdep
......@@ -22,14 +22,15 @@
$(CC) -D__ASSEMBLY__ -traditional -c -o $*.o $<
ZLINKFLAGS = -T ../ld.script -Ttext 0x00800000
ZLINKFLAGS = -T ../vmlinux.lds -Ttext 0x00800000
GZIP_FLAGS = -v9
SYSTEM = $(TOPDIR)/vmlinux
OBJECTS = head.o inflate.o unzip.o misc.o vreset.o
OBJECTS = head.o inflate.o unzip.o misc.o vreset.o #kbd.o
CFLAGS = -O2 -DSTDC_HEADERS -I$(TOPDIR)/include
OBJCOPY = objcopy
OBJCOPY_ARGS = -O elf32-powerpc
all: $(TOPDIR)/zImage
......@@ -39,41 +40,40 @@ mkprep : mkprep.c
find_name : find_name.c
$(HOSTCC) $(CFLAGSINC) -o find_name find_name.c
mk_type41: mk_type41.c
$(HOSTCC) $(CFLAGSINC) -o mk_type41 mk_type41.c
piggyback: piggyback.c
$(HOSTCC) $(CFLAGS) -o piggyback piggyback.c
floppy: $(TOPDIR)/vmlinux zImage
dd if=$(TOPDIR)/zImage of=/dev/fd0H1440 bs=64b
netboot : $(TOPDIR)/vmlinux mkprep
mkprep $(TOPDIR)/vmlinux $(TOPDIR)/netboot
floppy.initrd: $(TOPDIR)/vmlinux zImage
dd if=$(TOPDIR)/zImage.initrd of=/dev/fd0H1440 bs=64b
znetboot : zvmlinux mkprep
mkprep zvmlinux $(TOPDIR)/znetboot
cp $(TOPDIR)/znetboot /usr/local/tftpboot/vmlinux
znetboot : zImage mkprep
cp $(TOPDIR)/zImage /usr/local/tftpboot/vmlinux
rcpboot : znetboot
rcp $(TOPDIR)/znetboot charon:/usr/tftpboot/vmlinux
znetboot.initrd : zImage.initrd mkprep
cp $(TOPDIR)/zImage.initrd /usr/local/tftpboot/vmlinux
zImage: zvmlinux mkprep
mkprep -pbp zvmlinux $(TOPDIR)/zImage
install: zImage
dd if=$(TOPDIR)/zImage of=/dev/sda4
ln -s /dev/sda4 $(INSTALL_PATH)/vmlinuz
cp $(TOPDIR)/System.map $(INSTALL_PATH)/
zImage.initrd: zvmlinux.initrd mkprep
mkprep -pbp zvmlinux.initrd $(TOPDIR)/zImage.initrd
zvmlinux: $(OBJECTS) $(SYSTEM) mkprep find_name vmlinux.gz
$(LD) $(ZLINKFLAGS) -o zvmlinux.tmp $(OBJECTS)
$(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=vmlinux.gz \
zvmlinux.tmp $@
rm zvmlinux.tmp
vmlinux.gz: $(TOPDIR)/vmlinux
dd bs=64k skip=1 if=$(TOPDIR)/vmlinux | gzip -vf9 - > vmlinux.gz
zvmlinux: $(OBJECTS) $(SYSTEM) mkprep find_name
mkprep $(TOPDIR)/vmlinux -|gzip ${GZIP_FLAGS}|mkprep -asm - -|$(AS) -o piggy.o
$(LD) $(ZLINKFLAGS) -o zvmlinux $(OBJECTS) piggy.o
rm -f piggy.o
zvmlinux.initrd: zvmlinux
$(OBJCOPY) $(OBJCOPY_ARGS) --add-section=initrd=ramdisk.image.gz \
zvmlinux $@
clean:
rm -f piggyback zvmlinux mk_type41 mkprep mkboot find_name
rm -f $(TOPDIR)/{zImage,znetboot,netboot}
rm -f vmlinux* znetboot* zImage* zvmlinux* mkprep find_name
rm -f $(TOPDIR)/{zImage*,znetboot*,zvmlinux*,vmlinux*}
fastdep:
$(TOPDIR)/scripts/mkdep *.[Sch] > .depend
......
......@@ -13,17 +13,6 @@
start:
bl start_
start_:
/* TEMP - No residual data on BeBox (yet) */
#if 0
#define IS_BE_BOX 0x42654278 /* 'BeBx' */
lis r2,IS_BE_BOX>>16
ori r2,r2,IS_BE_BOX&0xFFFF
cmp 0,r30,r2
bne notBeBox
li r3,0
#endif
notBeBox:
/* TEMP */
mr r11,r3 /* Save pointer to residual data */
mfmsr r3 /* Turn off interrupts */
li r4,0
......@@ -48,7 +37,9 @@ notBeBox:
mtlr r21
mtctr r22
bctr /* Jump to code */
/* Relocate code to final resting spot */
/*
* no matter where we're loaded, move ourselves to -Ttext address
*/
relocate:
mflr r3 /* Compute code bias */
subi r3,r3,4
......@@ -98,13 +89,26 @@ start_ldr:
mr r5,r6 /* Checksum */
mr r6,r11 /* Residual data */
bl decompress_kernel
/*mr r29,r3*/ /* R3 = TotalMemory */
/*lis r28,hold_residual@h
ori r28,r28,hold_residual@l*/
/* changed to use r3 (as firmware does) for kernel
as ptr to residual -- Cort*/
li r5,0x100 /* Kernel code starts here */
mtlr r5
lis r6,cmd_line@h
ori r6,r6,cmd_line@l
subi r7,r7,1
00: lbzu r2,1(r12)
cmpi 0,r2,0
bne 00b
/* r4,r5 have initrd_start, size */
lis r2,initrd_start@h
ori r2,r2,initrd_start@l
lwz r4,0(r2)
lis r2,initrd_end@h
ori r2,r2,initrd_end@l
lwz r5,0(r2)
li r9,0x00c /* Kernel code starts here */
mtlr r9
blr
hang:
b hang
......@@ -141,6 +145,45 @@ _put_HID0:
mtspr HID0,r3
blr
/*
* Delay for a number of microseconds
* -- Use the BUS timer (assumes 66MHz)
*/
.globl udelay
udelay:
mfspr r4,PVR
srwi r4,r4,16
cmpi 0,r4,1 /* 601 ? */
bne .udelay_not_601
00: li r0,86 /* Instructions / microsecond? */
mtctr r0
10: addi r0,r0,0 /* NOP */
bdnz 10b
subic. r3,r3,1
bne 00b
blr
.udelay_not_601:
mulli r4,r3,1000 /* nanoseconds */
addi r4,r4,59
li r5,60
divw r4,r4,r5 /* BUS ticks */
1: mftbu r5
mftb r6
mftbu r7
cmp 0,r5,r7
bne 1b /* Get [synced] base time */
addc r9,r6,r4 /* Compute end time */
addze r8,r5
2: mftbu r5
cmp 0,r5,r8
blt 2b
bgt 3f
mftb r6
cmp 0,r6,r9
blt 2b
3: blr
/*
* This space [buffer] is used to forceably flush the data cache when
* running in copyback mode. This is necessary IFF the data cache could
......
......@@ -8,13 +8,23 @@
* puts by Nick Holloway 1993
*
* Adapted for PowerPC by Gary Thomas
* Updated and modified by Cort Dougan (cort@cs.nmt.edu)
*/
#include "gzip.h"
#include "lzw.h"
#include "asm/residual.h"
#include <elf.h>
RESIDUAL hold_residual;
unsigned long initrd_start = 0, initrd_end = 0;
char *zimage_start;
int zimage_size;
extern char input_data[];
extern int input_len;
void cksum_text(void);
void verify_data(unsigned long load_addr);
void dump_buf(unsigned char *p, int s);
#define EOF -1
......@@ -26,8 +36,7 @@ unsigned outcnt;
unsigned insize;
unsigned inptr;
extern char input_data[];
extern int input_len;
char cmd_line[256];
int input_ptr;
......@@ -56,6 +65,9 @@ int lines, cols;
int orig_x, orig_y;
void puts(const char *);
void putc(const char c);
void puthex(unsigned long val);
void _bcopy(char *src, char *dst, int len);
void *malloc(int size)
{
......@@ -77,7 +89,7 @@ void *malloc(int size)
*/
if (free_mem_ptr < (long)&end) {
if (free_mem_ptr > (long)&input_data[input_ptr])
if (free_mem_ptr > (long)&zimage_start[input_ptr])
error("\nOut of memory\n");
return p;
......@@ -87,7 +99,7 @@ void *malloc(int size)
#endif
return p;
puts("large kernel, low 1M tight...");
free_mem_ptr = (long)input_data;
free_mem_ptr = (long)zimage_start;
}
}
......@@ -114,6 +126,53 @@ static void scroll()
for ( i = ( lines - 1 ) * cols * 2; i < lines * cols * 2; i += 2 )
vidmem[i] = ' ';
}
#if 0
tstc(void)
{
return (CRT_tstc() );
}
getc(void)
{
while (1) {
if (CRT_tstc()) return (CRT_getc());
}
}
#endif
void
putc(const char c)
{
int x,y;
x = orig_x;
y = orig_y;
if ( c == '\n' ) {
x = 0;
if ( ++y >= lines ) {
scroll();
y--;
}
} else if (c == '\b') {
if (x > 0) {
x--;
}
} else {
vidmem [ ( x + cols * y ) * 2 ] = c;
if ( ++x >= cols ) {
x = 0;
if ( ++y >= lines ) {
scroll();
y--;
}
}
}
cursor(x, y);
orig_x = x;
orig_y = y;
}
void puts(const char *s)
{
......@@ -229,10 +288,10 @@ puts("*");
insize = 0;
do {
len = INBUFSIZ-insize;
if (len > (input_len-input_ptr+1)) len=input_len-input_ptr+1;
if (len > (zimage_size-input_ptr+1)) len=zimage_size-input_ptr+1;
if (len == 0 || len == EOF) break;
for (i=0;i<len;i++) inbuf[insize+i] = input_data[input_ptr+i];
for (i=0;i<len;i++) inbuf[insize+i] = zimage_start[input_ptr+i];
insize += len;
input_ptr += len;
} while (insize < INBUFSIZ);
......@@ -313,7 +372,14 @@ void error(char *x)
unsigned long
decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum, RESIDUAL *residual)
{
unsigned long TotalMemory;
int timer;
char *cp, ch;
Elf32_Ehdr *eh;
Elf32_Shdr *sh, *strtab_shdr;
char *strtab;
unsigned long i;
output_data = (char *)0x0; /* Points to 0 */
lines = 25;
cols = 80;
......@@ -339,33 +405,102 @@ decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum, R
clear_bufs();
makecrc();
puts("Loaded at "); puthex(load_addr); puts(", "); puthex(num_words); puts(" words");
puts(", cksum = "); puthex(cksum); puts("\n");
puts("Loaded at: "); puthex(load_addr); puts(" "); puthex(num_words+load_addr);
puts("\n");
/*puts("Relocated to start: "); puthex(start); puts(" ");
puthex(num_words+start);
puts("\n");*/
puts("Cksum: "); puthex(cksum); puts("\n");
if (residual) {
_bcopy(residual, &hold_residual, sizeof(hold_residual));
puts("Residual data at "); puthex(residual); puts("\n");
show_residual_data(residual);
TotalMemory = residual->TotalMemory;
} else {
TotalMemory = 0x01000000;
_bcopy((char *)residual, (char *)&hold_residual, sizeof(hold_residual));
puts("Residual data at: "); puthex((unsigned long)residual); puts(" ");
puthex((unsigned long)(residual->ResidualLength + residual)); puts("\n");
}
puts("Uncompressing Linux...");
/*
* Take care of initrd if we have one
*/
/*
* the _actual_ load addr is 64k (elf hdr size) lower but the
* firmware gives us the starting exec point not the load ptr
* -- Cort
*/
eh = (Elf32_Ehdr *)(load_addr - 65536);
sh = (Elf32_Shdr *)((unsigned long)eh + eh->e_shoff );
/*puts("Entry point: "); puthex(eh->e_entry); puts("\n");*/
/* find string table */
for ( i = 0 ; i <= eh->e_shnum ; i++,sh++)
{
/*puts("Section: "); puthex(i);
puts(" type: "); puthex(sh->sh_type);
puts(" offset: "); puthex(sh->sh_offset);
puts("\n");*/
if ( sh->sh_type == SHT_STRTAB )
{
strtab_shdr = sh;
strtab = (char *)(sh->sh_offset + (unsigned long)eh);
/*puts("Found strtab at: "); puthex((unsigned long)strtab);
puts("\n");*/
break;
}
}
method = get_method(0);
/* find the initrd and image sections */
if ( strtab_shdr )
{
sh = (Elf32_Shdr *)((unsigned long)eh + eh->e_shoff );
for ( i = 0 ; i <= eh->e_shnum ; i++,sh++)
{
if ( !memcmp("initrd", (char *)(strtab+sh->sh_name), 6 ) )
{
initrd_start = (unsigned long)eh + sh->sh_offset;
initrd_end = initrd_start + sh->sh_size;
puts("Found initrd at: "); puthex(initrd_start);
puts(" "); puthex(initrd_end);
puts("\n");
}
if ( !memcmp("image", (char *)(strtab+sh->sh_name), 5 ) )
{
zimage_start = (char *)((unsigned long)eh + sh->sh_offset);
zimage_size = sh->sh_size;
puts("Found zimage at: "); puthex((unsigned long)zimage_start);
puts(" "); puthex((unsigned long)(zimage_size+zimage_start));
puts("\n");
}
}
}
else
{
puts("Couldn't find string table for boot image!\n");
}
/* relocate initrd */
if ( initrd_start )
{
memcpy ((void *)0x00D00000,(void *)initrd_start,
initrd_end - initrd_start );
initrd_end = 0x00D00000 + initrd_end - initrd_start;
initrd_start = 0x00D00000;
puts("Moved initrd to: "); puthex(initrd_start);
puts(" "); puthex(initrd_end); puts("\n");
}
/* make the moto firmware print something */
puts("Uncompressing Linux...");
method = get_method(0);
work(0, 0);
puts("done.\n");
puts("Now booting the kernel\n");
/*return (TotalMemory);*/ /* Later this can be a pointer to saved residual data */
return &hold_residual;
return (unsigned long)&hold_residual;
}
show_residual_data(RESIDUAL *res)
{
puts("Residual data: "); puthex(res->ResidualLength); puts(" bytes\n");
puts("Total memory: "); puthex(res->TotalMemory); puts("\n");
#if 0
puts("Residual structure = "); puthex(sizeof(*res)); puts(" bytes\n");
dump_buf(&hold_residual, 32);
......@@ -407,14 +542,14 @@ cksum_data()
{
unsigned int *ptr, len, cksum, cnt;
cksum = cnt = 0;
ptr = input_data;
ptr = (unsigned int *)zimage_start;
puts("Checksums: ");
for (len = 0; len < input_len; len += 4) {
for (len = 0; len < zimage_size; len += 4) {
cksum ^= *ptr++;
if (len && ((len & 0x0FFF) == 0)) {
if (cnt == 0) {
puts("\n [");
puthex(ptr-1);
puthex((unsigned long)ptr-1);
puts("] ");
}
puthex(cksum);
......@@ -429,7 +564,7 @@ cksum_data()
puts("Data cksum = "); puthex(cksum); puts("\n");
}
cksum_text()
void cksum_text(void)
{
extern int start, etext;
unsigned int *ptr, len, text_len, cksum, cnt;
......@@ -442,7 +577,7 @@ cksum_text()
if (len && ((len & 0x0FFF) == 0)) {
if (cnt == 0) {
puts("\n [");
puthex(ptr-1);
puthex((unsigned long)ptr-1);
puts("] ");
}
puthex(cksum);
......@@ -457,24 +592,24 @@ cksum_text()
puts("TEXT cksum = "); puthex(cksum); puts("\n");
}
verify_data(unsigned long load_addr)
void verify_data(unsigned long load_addr)
{
extern int start, etext;
unsigned int *orig_ptr, *copy_ptr, len, errors;
errors = 0;
copy_ptr = input_data;
orig_ptr = (unsigned int *)(load_addr + ((unsigned int)input_data - (unsigned int)&start));
for (len = 0; len < input_len; len += 4) {
copy_ptr = (unsigned int *)zimage_start;
orig_ptr = (unsigned int *)(load_addr + ((unsigned int)zimage_start - (unsigned int)&start));
for (len = 0; len < zimage_size; len += 4) {
if (*copy_ptr++ != *orig_ptr++) {
errors++;
}
}
copy_ptr = input_data;
orig_ptr = (unsigned int *)(load_addr + ((unsigned int)input_data - (unsigned int)&start));
for (len = 0; len < input_len; len += 4) {
copy_ptr = (unsigned int *)zimage_start;
orig_ptr = (unsigned int *)(load_addr + ((unsigned int)zimage_start - (unsigned int)&start));
for (len = 0; len < zimage_size; len += 4) {
if (*copy_ptr++ != *orig_ptr++) {
dump_buf(copy_ptr-1, 128);
dump_buf(orig_ptr-1, 128);
dump_buf((unsigned char *) (copy_ptr-1), 128);
dump_buf((unsigned char *) (orig_ptr-1), 128);
puts("Total errors = "); puthex(errors*4); puts("\n");
while (1) ;
}
......@@ -486,9 +621,9 @@ test_data(unsigned long load_addr)
extern int start, etext;
unsigned int *orig_ptr, *copy_ptr, len, errors;
errors = 0;
copy_ptr = input_data;
orig_ptr = (unsigned int *)(load_addr + ((unsigned int)input_data - (unsigned int)&start));
for (len = 0; len < input_len; len += 4) {
copy_ptr = (unsigned int *)zimage_start;
orig_ptr = (unsigned int *)(load_addr + ((unsigned int)zimage_start - (unsigned int)&start));
for (len = 0; len < zimage_size; len += 4) {
if (*copy_ptr++ != *orig_ptr++) {
errors++;
}
......@@ -532,7 +667,7 @@ void dump_buf(unsigned char *p, int s)
}
while (s > 0)
{
puthex(p); puts(": ");
puthex((unsigned long)p); puts(": ");
for (i = 0; i < 16; i++)
{
if (i < s)
......
......@@ -131,17 +131,18 @@ int main(int argc, char *argv[])
argptr++;
/* skip elf header in input file */
lseek(in_fd, elfhdr_size, SEEK_SET);
if ( !prep )
lseek(in_fd, elfhdr_size, SEEK_SET);
/* write prep partition if necessary */
if ( prep )
write_prep_partition( in_fd, out_fd );
write_prep_partition( in_fd, out_fd );
/* write input image to bootimage */
if ( asmoutput )
write_asm_data( in_fd, out_fd );
write_asm_data( in_fd, out_fd );
else
copy_image(in_fd, out_fd);
copy_image(in_fd, out_fd);
return 0;
}
......@@ -161,28 +162,11 @@ void write_prep_partition(int in, int out)
}
bzero( block, sizeof block );
/* set entry point and boot image size */
*entry = cpu_to_le32(0x400);
/* need use size - elfheader? */
/* set entry point and boot image size skipping over elf header */
*entry = cpu_to_le32(0x400+65536);
*length = cpu_to_le32(info.st_size+0x400);
/*
* Writes the "boot record", which contains the partition table, to the
* diskette, followed by the dummy PC boot block and load image descriptor
* block. It returns the number of bytes it has written to the load
* image.
*
* The boot record is the first block of the diskette and identifies the
* "PReP" partition. The "PReP" partition contains the "load image" starting
* at offset zero within the partition. The first block of the load image is
* a dummy PC boot block. The second block is the "load image descriptor"
* which contains the size of the load image and the entry point into the
* image. The actual boot image starts at offset 1024 bytes (third sector)
* in the partition.
*/
/* sets magic number for msdos partition (used by linux) */
block[510] = 0x55;
block[511] = 0xAA;
......@@ -220,7 +204,7 @@ void write_prep_partition(int in, int out)
/* This has to be 0 on the PowerStack? */
pe->beginning_sector = cpu_to_le32(0);
#endif
/*pe->number_of_sectors = cpu_to_le32(2*18*80-1);*/
pe->number_of_sectors = cpu_to_le32(2*18*80-1);
write( out, block, sizeof(block) );
write( out, entry, sizeof(*entry) );
......
# Makefile for making XCOFF bootable images for booting on PowerMacs
# using Open Firmware.
#
# Paul Mackerras January 1997
# PowerPC (cross) tools
ifneq ($(shell uname -m),ppc)
CROSS_COMPILE =powerpc-eabi-
endif
HOSTCC = gcc
HOSTCFLAGS = -O -I$(TOPDIR)/include
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld
CFLAGS = -O -fno-builtin -I$(TOPDIR)/include
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJCOPY_ARGS = -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment \
--add-section=image=zImage
LD_ARGS = -e _start -T ld.script -Ttext 500000 -Tdata 510000 -Bstatic
GZIP = gzip -9
OBJS = crt0.o start.o main.o misc.o string.o zlib.o
LIBS = $(TOPDIR)/lib/lib.a
vmlinux.coff: coffboot hack-coff zImage
$(OBJCOPY) $(OBJCOPY_ARGS) coffboot $@
./hack-coff $@
vmlinux.coff.initrd: coffboot hack-coff zImage ramdisk.image.gz
$(OBJCOPY) $(OBJCOPY_ARGS) --add-section=initrd=ramdisk.image.gz \
coffboot $@
./hack-coff $@
coffboot: $(OBJS) ld.script
$(LD) -o coffboot $(LD_ARGS) $(OBJS) $(LIBS)
zImage: $(TOPDIR)/vmlinux elfextract
./elfextract $(TOPDIR)/vmlinux | $(GZIP) >zImage
hack-coff: hack-coff.c
$(HOSTCC) $(HOSTCFLAGS) -o hack-coff hack-coff.c
elfextract: elfextract.c
$(HOSTCC) $(HOSTCFLAGS) -o elfextract elfextract.c
clean:
rm -f elfextract hack-coff coffboot zImage vmlinux.coff
fastdep:
/*
* Copyright (C) Paul Mackerras 1997.
*
* 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.
*/
.text
.globl _start
_start:
.long __start,0,0
.globl __start
__start:
lis 9,_start@h
lis 8,_etext@ha
addi 8,8,_etext@l
1: dcbf 0,9
icbi 0,9
addi 9,9,0x20
cmplwi 0,9,8
blt 1b
b start
/*
* Extract the loadable program segment from an elf file.
*
* Copyright 1996 Paul Mackerras.
*
* 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.
*/
#include <stdio.h>
#include <linux/elf.h>
FILE *fi, *fo;
char *ni, *no;
char buf[65536];
void
rd(void *buf, int len)
{
int nr;
nr = fread(buf, 1, len, fi);
if (nr == len)
return;
if (ferror(fi))
fprintf(stderr, "%s: read error\n", ni);
else
fprintf(stderr, "%s: short file\n", ni);
exit(1);
}
main(int ac, char **av)
{
unsigned nb, len;
Elf32_Ehdr eh;
Elf32_Phdr ph;
if (ac > 3 || ac > 1 && av[1][0] == '-') {
fprintf(stderr, "Usage: %s [elf-file [image-file]]\n", av[0]);
exit(0);
}
fi = stdin;
ni = "(stdin)";
fo = stdout;
no = "(stdout)";
if (ac > 1) {
ni = av[1];
fi = fopen(ni, "rb");
if (fi == NULL) {
perror(ni);
exit(1);
}
}
rd(&eh, sizeof(eh));
if (eh.e_ident[EI_MAG0] != ELFMAG0
|| eh.e_ident[EI_MAG1] != ELFMAG1
|| eh.e_ident[EI_MAG2] != ELFMAG2
|| eh.e_ident[EI_MAG3] != ELFMAG3) {
fprintf(stderr, "%s: not an ELF file\n", ni);
exit(1);
}
fseek(fi, eh.e_phoff + (eh.e_phnum - 1) * sizeof(ph), 0);
rd(&ph, sizeof(ph));
if (ph.p_type != PT_LOAD) {
fprintf(stderr, "%s: doesn't have a loadable segment\n", ni);
exit(1);
}
if (ac > 2) {
no = av[2];
fo = fopen(no, "wb");
if (fo == NULL) {
perror(no);
exit(1);
}
}
fseek(fi, ph.p_offset, 0);
for (len = ph.p_filesz; len != 0; len -= nb) {
nb = len;
if (nb > sizeof(buf))
nb = sizeof(buf);
rd(buf, nb);
if (fwrite(buf, 1, nb, fo) != nb) {
fprintf(stderr, "%s: write error\n", no);
exit(1);
}
}
fclose(fo);
fclose(fi);
exit(0);
}
/*
* hack-coff.c - hack the header of an xcoff file to fill in
* a few fields needed by the Open Firmware xcoff loader on
* Power Macs but not initialized by objcopy.
*
* Copyright (C) Paul Mackerras 1997.
*
* 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.
*/
#include <stdio.h>
#include "rs6000.h"
#define AOUT_MAGIC 0x010b
#define get_16be(x) ((((unsigned char *)(x))[0] << 8) \
+ ((unsigned char *)(x))[1])
#define put_16be(x, v) (((unsigned char *)(x))[0] = (v) >> 8, \
((unsigned char *)(x))[1] = (v) & 0xff)
#define get_32be(x) ((((unsigned char *)(x))[0] << 24) \
+ (((unsigned char *)(x))[1] << 16) \
+ (((unsigned char *)(x))[2] << 8) \
+ ((unsigned char *)(x))[3])
main(int ac, char **av)
{
int fd;
int i, nsect;
int aoutsz;
struct external_filehdr fhdr;
AOUTHDR aout;
struct external_scnhdr shdr;
if (ac != 2) {
fprintf(stderr, "Usage: hack-coff coff-file\n");
exit(1);
}
if ((fd = open(av[1], 2)) == -1) {
perror(av[2]);
exit(1);
}
if (read(fd, &fhdr, sizeof(fhdr)) != sizeof(fhdr))
goto readerr;
i = get_16be(fhdr.f_magic);
if (i != U802TOCMAGIC && i != U802WRMAGIC && i != U802ROMAGIC) {
fprintf(stderr, "%s: not an xcoff file\n", av[1]);
exit(1);
}
aoutsz = get_16be(fhdr.f_opthdr);
if (read(fd, &aout, aoutsz) != aoutsz)
goto readerr;
nsect = get_16be(fhdr.f_nscns);
for (i = 0; i < nsect; ++i) {
if (read(fd, &shdr, sizeof(shdr)) != sizeof(shdr))
goto readerr;
if (strcmp(shdr.s_name, ".text") == 0) {
put_16be(aout.o_snentry, i+1);
put_16be(aout.o_sntext, i+1);
} else if (strcmp(shdr.s_name, ".data") == 0) {
put_16be(aout.o_sndata, i+1);
} else if (strcmp(shdr.s_name, ".bss") == 0) {
put_16be(aout.o_snbss, i+1);
}
}
put_16be(aout.magic, AOUT_MAGIC);
if (lseek(fd, (long) sizeof(struct external_filehdr), 0) == -1
|| write(fd, &aout, aoutsz) != aoutsz) {
fprintf(stderr, "%s: write error\n", av[1]);
exit(1);
}
close(fd);
exit(0);
readerr:
fprintf(stderr, "%s: read error or file too short\n", av[1]);
exit(1);
}
OUTPUT_ARCH(powerpc)
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
/* Do we need any of these for elf?
__DYNAMIC = 0; */
SECTIONS
{
/* Read-only sections, merged into text segment: */
. = + SIZEOF_HEADERS;
.interp : { *(.interp) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.rel.text : { *(.rel.text) }
.rela.text : { *(.rela.text) }
.rel.data : { *(.rel.data) }
.rela.data : { *(.rela.data) }
.rel.rodata : { *(.rel.rodata) }
.rela.rodata : { *(.rela.rodata) }
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rel.ctors : { *(.rel.ctors) }
.rela.ctors : { *(.rela.ctors) }
.rel.dtors : { *(.rel.dtors) }
.rela.dtors : { *(.rela.dtors) }
.rel.bss : { *(.rel.bss) }
.rela.bss : { *(.rela.bss) }
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
.init : { *(.init) } =0
.plt : { *(.plt) }
.text :
{
*(.text)
*(.rodata)
*(.rodata1)
*(.got1)
}
.fini : { *(.fini) } =0
.ctors : { *(.ctors) }
.dtors : { *(.dtors) }
_etext = .;
PROVIDE (etext = .);
/* Read-write section, merged into data segment: */
. = (. + 0x0FFF) & 0xFFFFF000;
.data :
{
*(.data)
*(.data1)
*(.sdata)
*(.sdata2)
*(.got.plt) *(.got)
*(.dynamic)
CONSTRUCTORS
}
_edata = .;
PROVIDE (edata = .);
__bss_start = .;
.bss :
{
*(.sbss) *(.scommon)
*(.dynbss)
*(.bss)
*(COMMON)
}
_end = . ;
PROVIDE (end = .);
}
/*
* Copyright (C) Paul Mackerras 1997.
*
* 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.
*/
#include "nonstdio.h"
#include "rs6000.h"
#include "zlib.h"
extern void *finddevice(const char *);
extern int getprop(void *, const char *, void *, int);
void gunzip(void *, int, unsigned char *, int *);
#define get_16be(x) (*(unsigned short *)(x))
#define get_32be(x) (*(unsigned *)(x))
#define RAM_START 0xc0000000
#define RAM_END 0xc0800000 /* only 8M mapped with BATs */
#define RAM_FREE 0xc0540000 /* after image of coffboot */
char *avail_ram;
char *end_avail;
coffboot(int a1, int a2, void *prom)
{
void *options;
unsigned loadbase;
struct external_filehdr *eh;
struct external_scnhdr *sp;
struct external_scnhdr *isect, *rsect;
int ns, oh, i;
unsigned sa, len;
void *dst;
unsigned char *im;
unsigned initrd_start, initrd_size;
printf("coffboot starting\n");
options = finddevice("/options");
if (options == (void *) -1)
exit();
if (getprop(options, "load-base", &loadbase, sizeof(loadbase))
!= sizeof(loadbase)) {
printf("error getting load-base\n");
exit();
}
setup_bats();
eh = (struct external_filehdr *) loadbase;
ns = get_16be(eh->f_nscns);
oh = get_16be(eh->f_opthdr);
sp = (struct external_scnhdr *) (loadbase + sizeof(struct external_filehdr) + oh);
isect = rsect = NULL;
for (i = 0; i < ns; ++i, ++sp) {
if (strcmp(sp->s_name, "image") == 0)
isect = sp;
else if (strcmp(sp->s_name, "initrd") == 0)
rsect = sp;
}
if (isect == NULL) {
printf("image section not found\n");
exit();
}
if (rsect != NULL && (initrd_size = get_32be(rsect->s_size)) != 0) {
initrd_start = (RAM_END - initrd_size) & ~0xFFF;
a1 = initrd_start;
a2 = initrd_size;
printf("initial ramdisk at %x (%u bytes)\n",
initrd_start, initrd_size);
memcpy((char *) initrd_start,
(char *) (loadbase + get_32be(rsect->s_scnptr)),
initrd_size);
end_avail = (char *) initrd_start;
} else {
end_avail = (char *) RAM_END;
}
im = (unsigned char *)(loadbase + get_32be(isect->s_scnptr));
len = get_32be(isect->s_size);
dst = (void *) RAM_START;
if (im[0] == 0x1f && im[1] == 0x8b) {
void *cp = (void *) RAM_FREE;
avail_ram = (void *) (RAM_FREE + ((len + 7) & -8));
memcpy(cp, im, len);
printf("gunzipping... ");
gunzip(dst, 0x400000, cp, &len);
printf("done\n");
} else {
memmove(dst, im, len);
}
flush_cache(dst, len);
sa = *(unsigned *)dst + RAM_START;
printf("start address = 0x%x\n", sa);
#if 0
pause();
#endif
(*(void (*)())sa)(a1, a2, prom);
printf("returned?\n");
pause();
}
void *zalloc(void *x, unsigned items, unsigned size)
{
void *p = avail_ram;
size *= items;
size = (size + 7) & -8;
avail_ram += size;
if (avail_ram > end_avail) {
printf("oops... out of memory\n");
pause();
}
return p;
}
void zfree(void *x, void *addr, unsigned nb)
{
}
#define HEAD_CRC 2
#define EXTRA_FIELD 4
#define ORIG_NAME 8
#define COMMENT 0x10
#define RESERVED 0xe0
#define DEFLATED 8
void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
{
z_stream s;
int r, i, flags;
/* skip header */
i = 10;
flags = src[3];
if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
printf("bad gzipped data\n");
exit();
}
if ((flags & EXTRA_FIELD) != 0)
i = 12 + src[10] + (src[11] << 8);
if ((flags & ORIG_NAME) != 0)
while (src[i++] != 0)
;
if ((flags & COMMENT) != 0)
while (src[i++] != 0)
;
if ((flags & HEAD_CRC) != 0)
i += 2;
if (i >= *lenp) {
printf("gunzip: ran out of data in header\n");
exit();
}
s.zalloc = zalloc;
s.zfree = zfree;
r = inflateInit2(&s, -MAX_WBITS);
if (r != Z_OK) {
printf("inflateInit2 returned %d\n", r);
exit();
}
s.next_in = src + i;
s.avail_in = *lenp - i;
s.next_out = dst;
s.avail_out = dstlen;
r = inflate(&s, Z_FINISH);
if (r != Z_OK && r != Z_STREAM_END) {
printf("inflate returned %d\n", r);
exit();
}
*lenp = s.next_out - (unsigned char *) dst;
inflateEnd(&s);
}
/*
* Copyright (C) Paul Mackerras 1997.
*
* 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.
*/
.text
/*
* Use the BAT0 registers to map the 1st 8MB of RAM to 0xc0000000.
*/
.globl setup_bats
setup_bats:
mfpvr 3
rlwinm 3,3,16,16,31 /* r3 = 1 for 601, 4 for 604 */
cmpi 0,3,1
lis 4,0xc000
bne 4f
ori 4,4,4 /* set up BAT registers for 601 */
li 5,0x7f
b 5f
4: ori 4,4,0xff /* set up BAT registers for 604 */
li 5,2
mtdbatu 0,4
mtdbatl 0,5
5: mtibatu 0,4
mtibatl 0,5
isync
blr
/*
* Flush the dcache and invalidate the icache for a range of addresses.
*
* flush_cache(addr, len)
*/
.global flush_cache
flush_cache:
addi 4,4,0x1f /* len = (len + 0x1f) / 0x20 */
rlwinm. 4,4,27,5,31
mtctr 4
beqlr
1: dcbf 0,3
icbi 0,3
addi 3,3,0x20
bdnz 1b
sync
isync
blr
/*
* Copyright (C) Paul Mackerras 1997.
*
* 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.
*/
typedef int FILE;
extern FILE *stdin, *stdout;
#define NULL ((void *)0)
#define EOF (-1)
#define fopen(n, m) NULL
#define fflush(f) 0
#define fclose(f) 0
extern char *fgets();
#define perror(s) printf("%s: no files!\n", (s))
/* IBM RS/6000 "XCOFF" file definitions for BFD.
Copyright (C) 1990, 1991 Free Software Foundation, Inc.
FIXME: Can someone provide a transliteration of this name into ASCII?
Using the following chars caused a compiler warning on HIUX (so I replaced
them with octal escapes), and isn't useful without an understanding of what
character set it is.
Written by Mimi Ph\373\364ng-Th\345o V\365 of IBM
and John Gilmore of Cygnus Support. */
/********************** FILE HEADER **********************/
struct external_filehdr {
char f_magic[2]; /* magic number */
char f_nscns[2]; /* number of sections */
char f_timdat[4]; /* time & date stamp */
char f_symptr[4]; /* file pointer to symtab */
char f_nsyms[4]; /* number of symtab entries */
char f_opthdr[2]; /* sizeof(optional hdr) */
char f_flags[2]; /* flags */
};
/* IBM RS/6000 */
#define U802WRMAGIC 0730 /* writeable text segments **chh** */
#define U802ROMAGIC 0735 /* readonly sharable text segments */
#define U802TOCMAGIC 0737 /* readonly text segments and TOC */
#define BADMAG(x) \
((x).f_magic != U802ROMAGIC && (x).f_magic != U802WRMAGIC && \
(x).f_magic != U802TOCMAGIC)
#define FILHDR struct external_filehdr
#define FILHSZ 20
/********************** AOUT "OPTIONAL HEADER" **********************/
typedef struct
{
unsigned char magic[2]; /* type of file */
unsigned char vstamp[2]; /* version stamp */
unsigned char tsize[4]; /* text size in bytes, padded to FW bdry */
unsigned char dsize[4]; /* initialized data " " */
unsigned char bsize[4]; /* uninitialized data " " */
unsigned char entry[4]; /* entry pt. */
unsigned char text_start[4]; /* base of text used for this file */
unsigned char data_start[4]; /* base of data used for this file */
unsigned char o_toc[4]; /* address of TOC */
unsigned char o_snentry[2]; /* section number of entry point */
unsigned char o_sntext[2]; /* section number of .text section */
unsigned char o_sndata[2]; /* section number of .data section */
unsigned char o_sntoc[2]; /* section number of TOC */
unsigned char o_snloader[2]; /* section number of .loader section */
unsigned char o_snbss[2]; /* section number of .bss section */
unsigned char o_algntext[2]; /* .text alignment */
unsigned char o_algndata[2]; /* .data alignment */
unsigned char o_modtype[2]; /* module type (??) */
unsigned char o_cputype[2]; /* cpu type */
unsigned char o_maxstack[4]; /* max stack size (??) */
unsigned char o_maxdata[4]; /* max data size (??) */
unsigned char o_resv2[12]; /* reserved */
}
AOUTHDR;
#define AOUTSZ 72
#define SMALL_AOUTSZ (28)
#define AOUTHDRSZ 72
#define RS6K_AOUTHDR_OMAGIC 0x0107 /* old: text & data writeable */
#define RS6K_AOUTHDR_NMAGIC 0x0108 /* new: text r/o, data r/w */
#define RS6K_AOUTHDR_ZMAGIC 0x010B /* paged: text r/o, both page-aligned */
/********************** SECTION HEADER **********************/
struct external_scnhdr {
char s_name[8]; /* section name */
char s_paddr[4]; /* physical address, aliased s_nlib */
char s_vaddr[4]; /* virtual address */
char s_size[4]; /* section size */
char s_scnptr[4]; /* file ptr to raw data for section */
char s_relptr[4]; /* file ptr to relocation */
char s_lnnoptr[4]; /* file ptr to line numbers */
char s_nreloc[2]; /* number of relocation entries */
char s_nlnno[2]; /* number of line number entries*/
char s_flags[4]; /* flags */
};
/*
* names of "special" sections
*/
#define _TEXT ".text"
#define _DATA ".data"
#define _BSS ".bss"
#define _PAD ".pad"
#define _LOADER ".loader"
#define SCNHDR struct external_scnhdr
#define SCNHSZ 40
/* XCOFF uses a special .loader section with type STYP_LOADER. */
#define STYP_LOADER 0x1000
/* XCOFF uses a special .debug section with type STYP_DEBUG. */
#define STYP_DEBUG 0x2000
/* XCOFF handles line number or relocation overflow by creating
another section header with STYP_OVRFLO set. */
#define STYP_OVRFLO 0x8000
/********************** LINE NUMBERS **********************/
/* 1 line number entry for every "breakpointable" source line in a section.
* Line numbers are grouped on a per function basis; first entry in a function
* grouping will have l_lnno = 0 and in place of physical address will be the
* symbol table index of the function name.
*/
struct external_lineno {
union {
char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
char l_paddr[4]; /* (physical) address of line number */
} l_addr;
char l_lnno[2]; /* line number */
};
#define LINENO struct external_lineno
#define LINESZ 6
/********************** SYMBOLS **********************/
#define E_SYMNMLEN 8 /* # characters in a symbol name */
#define E_FILNMLEN 14 /* # characters in a file name */
#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
struct external_syment
{
union {
char e_name[E_SYMNMLEN];
struct {
char e_zeroes[4];
char e_offset[4];
} e;
} e;
char e_value[4];
char e_scnum[2];
char e_type[2];
char e_sclass[1];
char e_numaux[1];
};
#define N_BTMASK (017)
#define N_TMASK (060)
#define N_BTSHFT (4)
#define N_TSHIFT (2)
union external_auxent {
struct {
char x_tagndx[4]; /* str, un, or enum tag indx */
union {
struct {
char x_lnno[2]; /* declaration line number */
char x_size[2]; /* str/union/array size */
} x_lnsz;
char x_fsize[4]; /* size of function */
} x_misc;
union {
struct { /* if ISFCN, tag, or .bb */
char x_lnnoptr[4]; /* ptr to fcn line # */
char x_endndx[4]; /* entry ndx past block end */
} x_fcn;
struct { /* if ISARY, up to 4 dimen. */
char x_dimen[E_DIMNUM][2];
} x_ary;
} x_fcnary;
char x_tvndx[2]; /* tv index */
} x_sym;
union {
char x_fname[E_FILNMLEN];
struct {
char x_zeroes[4];
char x_offset[4];
} x_n;
} x_file;
struct {
char x_scnlen[4]; /* section length */
char x_nreloc[2]; /* # relocation entries */
char x_nlinno[2]; /* # line numbers */
} x_scn;
struct {
char x_tvfill[4]; /* tv fill value */
char x_tvlen[2]; /* length of .tv */
char x_tvran[2][2]; /* tv range */
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */
struct {
unsigned char x_scnlen[4];
unsigned char x_parmhash[4];
unsigned char x_snhash[2];
unsigned char x_smtyp[1];
unsigned char x_smclas[1];
unsigned char x_stab[4];
unsigned char x_snstab[2];
} x_csect;
};
#define SYMENT struct external_syment
#define SYMESZ 18
#define AUXENT union external_auxent
#define AUXESZ 18
#define DBXMASK 0x80 /* for dbx storage mask */
#define SYMNAME_IN_DEBUG(symptr) ((symptr)->n_sclass & DBXMASK)
/********************** RELOCATION DIRECTIVES **********************/
struct external_reloc {
char r_vaddr[4];
char r_symndx[4];
char r_size[1];
char r_type[1];
};
#define RELOC struct external_reloc
#define RELSZ 10
#define DEFAULT_DATA_SECTION_ALIGNMENT 4
#define DEFAULT_BSS_SECTION_ALIGNMENT 4
#define DEFAULT_TEXT_SECTION_ALIGNMENT 4
/* For new sections we havn't heard of before */
#define DEFAULT_SECTION_ALIGNMENT 4
/*
* Copyright (C) Paul Mackerras 1997.
*
* 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.
*/
#include <stdarg.h>
int (*prom)();
void *chosen_handle;
void *stdin;
void *stdout;
void *stderr;
void exit(void);
void *finddevice(const char *name);
int getprop(void *phandle, const char *name, void *buf, int buflen);
void
start(int a1, int a2, void *promptr)
{
prom = (int (*)()) promptr;
chosen_handle = finddevice("/chosen");
if (chosen_handle == (void *) -1)
exit();
if (getprop(chosen_handle, "stdout", &stdout, sizeof(stdout)) != 4)
exit();
stderr = stdout;
if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4)
exit();
coffboot(a1, a2, promptr);
for (;;)
exit();
}
int
write(void *handle, void *ptr, int nb)
{
struct prom_args {
char *service;
int nargs;
int nret;
void *ihandle;
void *addr;
int len;
int actual;
} args;
args.service = "write";
args.nargs = 3;
args.nret = 1;
args.ihandle = handle;
args.addr = ptr;
args.len = nb;
args.actual = -1;
(*prom)(&args);
return args.actual;
}
int
read(void *handle, void *ptr, int nb)
{
struct prom_args {
char *service;
int nargs;
int nret;
void *ihandle;
void *addr;
int len;
int actual;
} args;
args.service = "read";
args.nargs = 3;
args.nret = 1;
args.ihandle = handle;
args.addr = ptr;
args.len = nb;
args.actual = -1;
(*prom)(&args);
return args.actual;
}
void
exit()
{
struct prom_args {
char *service;
} args;
for (;;) {
args.service = "exit";
(*prom)(&args);
}
}
void
pause()
{
struct prom_args {
char *service;
} args;
args.service = "enter";
(*prom)(&args);
}
void *
finddevice(const char *name)
{
struct prom_args {
char *service;
int nargs;
int nret;
const char *devspec;
void *phandle;
} args;
args.service = "finddevice";
args.nargs = 1;
args.nret = 1;
args.devspec = name;
args.phandle = (void *) -1;
(*prom)(&args);
return args.phandle;
}
int
getprop(void *phandle, const char *name, void *buf, int buflen)
{
struct prom_args {
char *service;
int nargs;
int nret;
void *phandle;
const char *name;
void *buf;
int buflen;
int size;
} args;
args.service = "getprop";
args.nargs = 4;
args.nret = 1;
args.phandle = phandle;
args.name = name;
args.buf = buf;
args.buflen = buflen;
args.size = -1;
(*prom)(&args);
return args.size;
}
int
putc(int c, void *f)
{
char ch = c;
if (c == '\n')
putc('\r', f);
return write(f, &ch, 1) == 1? c: -1;
}
int
putchar(int c)
{
return putc(c, stdout);
}
int
fputs(char *str, void *f)
{
int n = strlen(str);
return write(f, str, n) == n? 0: -1;
}
int
readchar()
{
char ch;
for (;;) {
switch (read(stdin, &ch, 1)) {
case 1:
return ch;
case -1:
printk("read(stdin) returned -1\r\n");
return -1;
}
}
}
static char line[256];
static char *lineptr;
static int lineleft;
int
getchar()
{
int c;
if (lineleft == 0) {
lineptr = line;
for (;;) {
c = readchar();
if (c == -1 || c == 4)
break;
if (c == '\r' || c == '\n') {
*lineptr++ = '\n';
putchar('\n');
break;
}
switch (c) {
case 0177:
case '\b':
if (lineptr > line) {
putchar('\b');
putchar(' ');
putchar('\b');
--lineptr;
}
break;
case 'U' & 0x1F:
while (lineptr > line) {
putchar('\b');
putchar(' ');
putchar('\b');
--lineptr;
}
break;
default:
if (lineptr >= &line[sizeof(line) - 1])
putchar('\a');
else {
putchar(c);
*lineptr++ = c;
}
}
}
lineleft = lineptr - line;
lineptr = line;
}
if (lineleft == 0)
return -1;
--lineleft;
return *lineptr++;
}
extern int vsprintf(char *buf, const char *fmt, va_list args);
static char sprint_buf[1024];
void
printk(char *fmt, ...)
{
va_list args;
int n;
va_start(args, fmt);
n = vsprintf(sprint_buf, fmt, args);
va_end(args);
write(stdout, sprint_buf, n);
}
int
printf(char *fmt, ...)
{
va_list args;
int n;
va_start(args, fmt);
n = vsprintf(sprint_buf, fmt, args);
va_end(args);
write(stdout, sprint_buf, n);
return n;
}
/*
* String handling functions for PowerPC.
*
* Copyright (C) 1996 Paul Mackerras.
*
* 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.
*/
#define r0 0
#define r3 3
#define r4 4
#define r5 5
#define r6 6
#define r7 7
#define r8 8
.globl strcpy
strcpy:
addi r5,r3,-1
addi r4,r4,-1
1: lbzu r0,1(r4)
cmpwi 0,r0,0
stbu r0,1(r5)
bne 1b
blr
.globl strncpy
strncpy:
cmpwi 0,r5,0
beqlr
mtctr r5
addi r6,r3,-1
addi r4,r4,-1
1: lbzu r0,1(r4)
cmpwi 0,r0,0
stbu r0,1(r6)
bdnzf 2,1b /* dec ctr, branch if ctr != 0 && !cr0.eq */
blr
.globl strcat
strcat:
addi r5,r3,-1
addi r4,r4,-1
1: lbzu r0,1(r5)
cmpwi 0,r0,0
bne 1b
addi r5,r5,-1
1: lbzu r0,1(r4)
cmpwi 0,r0,0
stbu r0,1(r5)
bne 1b
blr
.globl strcmp
strcmp:
addi r5,r3,-1
addi r4,r4,-1
1: lbzu r3,1(r5)
cmpwi 1,r3,0
lbzu r0,1(r4)
subf. r3,r0,r3
beqlr 1
beq 1b
blr
.globl strlen
strlen:
addi r4,r3,-1
1: lbzu r0,1(r4)
cmpwi 0,r0,0
bne 1b
subf r3,r3,r4
blr
.globl memset
memset:
rlwimi r4,r4,8,16,23
rlwimi r4,r4,16,0,15
addi r6,r3,-4
cmplwi 0,r5,4
blt 7f
stwu r4,4(r6)
beqlr
andi. r0,r6,3
add r5,r0,r5
subf r6,r0,r6
rlwinm r0,r5,32-2,2,31
mtctr r0
bdz 6f
1: stwu r4,4(r6)
bdnz 1b
6: andi. r5,r5,3
7: cmpwi 0,r5,0
beqlr
mtctr r5
addi r6,r6,3
8: stbu r4,1(r6)
bdnz 8b
blr
.globl bcopy
bcopy:
mr r6,r3
mr r3,r4
mr r4,r6
b memcpy
.globl memmove
memmove:
cmplw 0,r3,r4
bgt backwards_memcpy
/* fall through */
.globl memcpy
memcpy:
rlwinm. r7,r5,32-3,3,31 /* r0 = r5 >> 3 */
addi r6,r3,-4
addi r4,r4,-4
beq 2f /* if less than 8 bytes to do */
andi. r0,r6,3 /* get dest word aligned */
mtctr r7
bne 5f
1: lwz r7,4(r4)
lwzu r8,8(r4)
stw r7,4(r6)
stwu r8,8(r6)
bdnz 1b
andi. r5,r5,7
2: cmplwi 0,r5,4
blt 3f
lwzu r0,4(r4)
addi r5,r5,-4
stwu r0,4(r6)
3: cmpwi 0,r5,0
beqlr
mtctr r5
addi r4,r4,3
addi r6,r6,3
4: lbzu r0,1(r4)
stbu r0,1(r6)
bdnz 4b
blr
5: subfic r0,r0,4
mtctr r0
6: lbz r7,4(r4)
addi r4,r4,1
stb r7,4(r6)
addi r6,r6,1
bdnz 6b
subf r5,r0,r5
rlwinm. r7,r5,32-3,3,31
beq 2b
mtctr r7
b 1b
.globl backwards_memcpy
backwards_memcpy:
rlwinm. r7,r5,32-3,3,31 /* r0 = r5 >> 3 */
add r6,r3,r5
add r4,r4,r5
beq 2f
andi. r0,r6,3
mtctr r7
bne 5f
1: lwz r7,-4(r4)
lwzu r8,-8(r4)
stw r7,-4(r6)
stwu r8,-8(r6)
bdnz 1b
andi. r5,r5,7
2: cmplwi 0,r5,4
blt 3f
lwzu r0,-4(r4)
subi r5,r5,4
stwu r0,-4(r6)
3: cmpwi 0,r5,0
beqlr
mtctr r5
4: lbzu r0,-1(r4)
stbu r0,-1(r6)
bdnz 4b
blr
5: mtctr r0
6: lbzu r7,-1(r4)
stbu r7,-1(r6)
bdnz 6b
subf r5,r0,r5
rlwinm. r7,r5,32-3,3,31
beq 2b
mtctr r7
b 1b
.globl memcmp
memcmp:
cmpwi 0,r5,0
blelr
mtctr r5
addi r6,r3,-1
addi r4,r4,-1
1: lbzu r3,1(r6)
lbzu r0,1(r4)
subf. r3,r0,r3
bdnzt 2,1b
blr
This diff is collapsed.
This diff is collapsed.
#
# $Id: config.in,v 1.16 1997/08/11 08:37:49 cort Exp $
# For a description of the syntax of this configuration file,
# see the Configure script.
#
mainmenu_name "Linux/PowerPC Kernel Configuration"
mainmenu_option next_comment
comment 'Platform support'
define_bool CONFIG_PPC y
if [ "`uname`" != "Linux" ]; then
define_bool CONFIG_CROSSCOMPILE y
else
......@@ -12,25 +16,28 @@ fi
bool 'Build PowerMac Kernel (not PReP)?' CONFIG_PMAC
bool 'Build PReP Kernel (not PowerMac)?' CONFIG_PREP
bool 'Prompt for development and/or incomplete code/drivers' CONFIG_EXPERIMENTAL
bool 'Used Harddrive LED on IBM 83x workstations as heartbeat?' CONFIG_HEARTBEAT
bool 'Used PowerPC specific powersaving?' CONFIG_POWERSAVING
choice 'Processor type' \
"Common CONFIG_MCOMMON \
601 CONFIG_M601 \
603 CONFIG_M603 \
604 CONFIG_M604" Common
endmenu
mainmenu_option next_comment
comment 'General setup'
bool 'Prompt for development and/or incomplete code/drivers' CONFIG_EXPERIMENTAL
bool 'Enable loadable module support' CONFIG_MODULES
if [ "$CONFIG_MODULES" = "y" ]; then
bool 'Set version information on all symbols for modules' CONFIG_MODVERSIONS
bool 'Kernel daemon support (e.g. autoload of modules)' CONFIG_KERNELD
fi
mainmenu_option next_comment
define_bool CONFIG_PCI y
bool 'PCI bridge optimization (experimental)' CONFIG_PCI_OPTIMIZE
if [ "$CONFIG_PREP" = "y" ]; then
bool 'PCI bridge optimization' CONFIG_PCI_OPTIMIZE
fi
bool 'Networking support' CONFIG_NET
bool 'Sysctl support' CONFIG_SYSCTL
bool 'System V IPC' CONFIG_SYSVIPC
......@@ -41,6 +48,22 @@ define_bool CONFIG_KERNEL_ELF y
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
tristate 'Kernel support for JAVA binaries' CONFIG_BINFMT_JAVA
if [ "$CONFIG_PMAC" = "y" ]; then
define_bool CONFIG_PMAC_CONSOLE y
define_bool CONFIG_MAC_KEYBOARD y
define_bool CONFIG_MAC_FLOPPY y
bool 'Support for Open Firmware device tree in /proc' CONFIG_PROC_DEVICETREE
bool 'Include xmon kernel debugger' CONFIG_XMON
fi
if [ "$CONFIG_PMAC_CONSOLE" = "y" ]; then
bool 'Support for ATI Mach64 display cards' CONFIG_ATY_VIDEO
bool 'Support for IMS Twin Turbo display card' CONFIG_IMSTT_VIDEO
else
define_bool CONFIG_VGA_CONSOLE y
fi
endmenu
source drivers/pnp/Config.in
source drivers/block/Config.in
......@@ -83,6 +106,7 @@ fi
endmenu
source fs/Config.in
source drivers/char/Config.in
mainmenu_option next_comment
......@@ -93,12 +117,12 @@ if [ "$CONFIG_SOUND" != "n" ]; then
fi
endmenu
mainmenu_option next_comment
#mainmenu_option next_comment
#comment 'Kernel hacking'
#bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC
#bool 'Kernel profiling support' CONFIG_PROFILE
#if [ "$CONFIG_PROFILE" = "y" ]; then
# int ' Profile shift count' CONFIG_PROFILE_SHIFT 2
#fi
endmenu
#endmenu
#
# Automatically generated by make menuconfig: don't edit
#
#
# Platform support
#
CONFIG_NATIVE=y
# CONFIG_PMAC is not set
CONFIG_PREP=y
# CONFIG_HEARTBEAT is not set
# CONFIG_POWERSAVING is not set
CONFIG_MCOMMON=y
#
# Code maturity level options
# General setup
#
CONFIG_EXPERIMENTAL=y
#
# Loadable module support
#
# CONFIG_MODULES is not set
CONFIG_MODULES=y
CONFIG_MODVERSIONS=y
CONFIG_KERNELD=y
CONFIG_PCI=y
CONFIG_PCI_OPTIMIZE=y
CONFIG_NET=y
CONFIG_SYSCTL=y
CONFIG_SYSVIPC=y
# CONFIG_BINFMT_JAVA is not set
CONFIG_BINFMT_ELF=y
CONFIG_KERNEL_ELF=y
# CONFIG_BINFMT_MISC is not set
# CONFIG_BINFMT_JAVA is not set
#
# Plug and Play support
......@@ -46,10 +47,10 @@ CONFIG_BLK_DEV_IDECD=y
# CONFIG_BLK_DEV_RZ1000 is not set
# CONFIG_BLK_DEV_TRITON is not set
# CONFIG_IDE_CHIPSETS is not set
# CONFIG_BLK_DEV_LOOP is not set
CONFIG_BLK_DEV_LOOP=y
# CONFIG_BLK_DEV_MD is not set
CONFIG_BLK_DEV_RAM=y
# CONFIG_BLK_DEV_INITRD is not set
CONFIG_BLK_DEV_INITRD=y
# CONFIG_BLK_DEV_XD is not set
# CONFIG_BLK_DEV_EZ is not set
# CONFIG_BLK_DEV_HD is not set
......@@ -100,7 +101,6 @@ CONFIG_SCSI_NCR53C7xx=y
# CONFIG_SCSI_ULTRASTOR is not set
# CONFIG_SCSI_MESH is not set
# CONFIG_SCSI_MAC53C94 is not set
# CONFIG_SCSI_QLOGIC_PMAC is not set
#
# Network device support
......@@ -117,6 +117,7 @@ CONFIG_INET=y
# CONFIG_IP_ACCT is not set
# CONFIG_IP_ROUTER is not set
# CONFIG_NET_IPIP is not set
# CONFIG_SYN_COOKIES is not set
# CONFIG_INET_PCTCP is not set
# CONFIG_INET_RARP is not set
CONFIG_PATH_MTU_DISCOVERY=y
......@@ -155,6 +156,7 @@ CONFIG_DE4X5=y
# CONFIG_DEC_ELCP is not set
# CONFIG_DGRS is not set
# CONFIG_EEXPRESS_PRO100 is not set
# CONFIG_TLAN is not set
# CONFIG_ES3210 is not set
# CONFIG_ZNET is not set
# CONFIG_NET_POCKET is not set
......@@ -183,16 +185,13 @@ CONFIG_PPP=y
# CONFIG_QUOTA is not set
# CONFIG_MINIX_FS is not set
CONFIG_EXT2_FS=y
CONFIG_BEXT2_FS=y
CONFIG_FAT_FS=y
CONFIG_MSDOS_FS=y
# CONFIG_FAT_FS is not set
# CONFIG_MSDOS_FS is not set
# CONFIG_VFAT_FS is not set
# CONFIG_UMSDOS_FS is not set
CONFIG_PROC_FS=y
CONFIG_NFS_FS=y
CONFIG_ROOT_NFS=y
# CONFIG_RNFS_BOOTP is not set
# CONFIG_RNFS_RARP is not set
# CONFIG_ROOT_NFS is not set
CONFIG_NFSD=y
CONFIG_SUNRPC=y
CONFIG_LOCKD=y
......@@ -205,7 +204,6 @@ CONFIG_ISO9660_FS=y
# CONFIG_AUTOFS_FS is not set
# CONFIG_UFS_FS is not set
CONFIG_MAC_PARTITION=y
CONFIG_HFS_FS=y
#
# Character devices
......@@ -213,12 +211,7 @@ CONFIG_HFS_FS=y
CONFIG_VT=y
CONFIG_VT_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_SERIAL_EXTENDED=y
# CONFIG_SERIAL_MANY_PORTS is not set
# CONFIG_SERIAL_SHARE_IRQ is not set
# CONFIG_SERIAL_MULTIPORT is not set
# CONFIG_HUB6 is not set
# CONFIG_SERIAL_CONSOLE is not set
# CONFIG_SERIAL_EXTENDED is not set
# CONFIG_SERIAL_NONSTANDARD is not set
# CONFIG_PRINTER is not set
CONFIG_MOUSE=y
......@@ -227,13 +220,39 @@ CONFIG_MOUSE=y
# CONFIG_MS_BUSMOUSE is not set
CONFIG_PSMOUSE=y
# CONFIG_82C710_MOUSE is not set
# CONFIG_PC110_PAD is not set
# CONFIG_UMISC is not set
# CONFIG_QIC02_TAPE is not set
# CONFIG_FTAPE is not set
# CONFIG_APM is not set
# CONFIG_WATCHDOG is not set
# CONFIG_RTC is not set
# CONFIG_NVRAM is not set
# CONFIG_JOYSTICK is not set
#
# Sound
#
# CONFIG_SOUND is not set
#CONFIG_SOUND=y
# CONFIG_PAS is not set
# CONFIG_SB is not set
# CONFIG_ADLIB is not set
# CONFIG_GUS is not set
# CONFIG_MPU401 is not set
# CONFIG_PSS is not set
# CONFIG_GUS16 is not set
# CONFIG_GUSMAX is not set
# CONFIG_MSS is not set
# CONFIG_SSCAPE is not set
# CONFIG_TRIX is not set
# CONFIG_MAD16 is not set
CONFIG_CS4232=y
# CONFIG_MAUI is not set
# CONFIG_YM3812 is not set
CS4232_BASE=830
CS4232_IRQ=10
CS4232_DMA=6
CS4232_DMA2=7
CS4232_MPU_BASE=330
CS4232_MPU_IRQ=9
# CONFIG_LOWLEVEL_SOUND is not set
......@@ -7,40 +7,25 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
.c.s:
$(CC) $(CFLAGS) -S $<
.s.o:
$(AS) $(ASFLAGS) -o $*.o $<
.c.o:
$(CC) $(CFLAGS) -c $<
.S.s:
$(CPP) $(CFLAGS) -D__ASSEMBLY__ $< -o $*.s
.S.o:
$(CPP) $(CFLAGS) -D__ASSEMBLY__ $< -o $*.s
$(AS) $(ASFLAGS) -o $*.o $*.s
rm $*.s
$(CC) -D__ASSEMBLY__ -c $< -o $*.o
HOST_CC = gcc
OBJS = misc.o port_io.o pci.o traps.o process.o \
signal.o syscalls.o ptrace.o ksyms.o irq.o bitops.o strcase.o ppc_htab.o
O_TARGET := kernel.o
O_OBJS := misc.o traps.o process.o signal.o syscalls.o \
align.o ptrace.o irq.o bitops.o ppc_htab.o idle.o prom.o \
time.o prep_time.o pmac_time.o \
setup.o pmac_setup.o pmac_support.o \
pci.o prep_pci.o pmac_pci.o
OX_OBJS := ppc_ksyms.o
all: head.o kernel.o
head.o: head.S $(TOPDIR)/include/linux/tasks.h ppc_defs.h
ifeq ($(CONFIG_PREP),y)
OBJS += prep_setup.o prep_time.o
endif
ifeq ($(CONFIG_PMAC),y)
OBJS += pmac_setup.o pmac_support.o align.o pmac_time.o
O_OBJS += prep_setup.o #prep_time.o
endif
ifeq ($(CONFIG_MODULES),y)
OBJS = ksyms.o
endif
ppc_defs.h: mk_defs.c ppc_defs.head \
$(TOPDIR)/include/asm/mmu.h \
$(TOPDIR)/include/asm/processor.h \
......@@ -53,24 +38,6 @@ ppc_defs.h: mk_defs.c ppc_defs.head \
checks: checks.c
$(HOSTCC) ${CFLAGS} -o checks checks.c
checks
kernel.o: $(OBJS)
$(LD) -r -o kernel.o $(OBJS)
./checks
fastdep:
$(TOPDIR)/scripts/mkdep *.[Sch] > .depend
dep:
$(CPP) -M *.S *.c > .depend
modules:
dummy:
#
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif
include $(TOPDIR)/Rules.make
......@@ -25,7 +25,7 @@
int main(void)
{
int ret = 0;
#if 0
if ( sizeof(struct thread_struct) % 16 )
{
printf("Thread struct is not modulo 16 bytes: "
......@@ -34,6 +34,7 @@ int main(void)
sizeof(struct thread_struct)%16);
ret = -1;
}
#endif
if ( sizeof(struct pt_regs) % 16 )
{
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#include <linux/config.h>
#include <linux/module.h>
#include <linux/smp.h>
#include <linux/elfcore.h>
#include <linux/sched.h>
#include <asm/semaphore.h>
#include <asm/processor.h>
#include <asm/uaccess.h>
#include <asm/io.h>
void transfer_to_handler();
void int_return();
void syscall_trace();
void handle_IRQ();
void MachineCheckException();
void AlignmentException();
void ProgramCheckException();
void SingleStepException();
void FloatingPointCheckException();
void sys_sigreturn();
unsigned long sys_call_table[];
extern struct task_struct *current_set[1];
/* platform dependent support */
EXPORT_SYMBOL(current_set);
EXPORT_SYMBOL(do_signal);
EXPORT_SYMBOL(syscall_trace);
EXPORT_SYMBOL(transfer_to_handler);
EXPORT_SYMBOL(int_return);
EXPORT_SYMBOL(handle_IRQ);
EXPORT_SYMBOL(init_task_union);
EXPORT_SYMBOL(MachineCheckException);
EXPORT_SYMBOL(AlignmentException);
EXPORT_SYMBOL(ProgramCheckException);
EXPORT_SYMBOL(SingleStepException);
EXPORT_SYMBOL(FloatingPointCheckException);
EXPORT_SYMBOL(sys_sigreturn);
EXPORT_SYMBOL(sys_call_table);
......@@ -64,6 +64,7 @@ _GLOBAL(_hard_sti)
mtmsr r3 /* Update machine state */
blr
#if 0
/*
* Restore 'flags'
* __restore_flags(long val)
......@@ -79,11 +80,13 @@ _GLOBAL(__restore_flags)
mtmsr r3
isync
blr
#endif
/*
* We were about to enable interrupts but we have to simulate
* some interrupts that were lost by enable_irq first.
*/
.globl do_lost_interrupts
do_lost_interrupts:
stwu r1,-16(r1)
mflr r0
......@@ -243,7 +246,6 @@ _GLOBAL(_outsl)
bdnz 00b
blr
#ifdef CONFIG_PMAC
_GLOBAL(ide_insw)
mtctr r5
subi r4,r4,2
......@@ -259,7 +261,6 @@ _GLOBAL(ide_outsw)
sthx r5,0,r3
bdnz 00b
blr
#endif
/*
* Extended precision shifts
......@@ -298,7 +299,7 @@ _GLOBAL(abs)
_GLOBAL(_get_SP)
mr r3,r1 /* Close enough */
blr
_GLOBAL(_get_PVR)
mfspr r3,PVR
blr
......@@ -308,6 +309,7 @@ cvt_fd:
lfs 0,0(r3)
stfd 0,0(r4)
blr
/*
* Fetch the current SR register
* get_SR(int index)
......@@ -317,7 +319,6 @@ _GLOBAL(get_SR)
mr r3,r4
blr
_GLOBAL(cvt_df)
cvt_df:
lfd 0,0(r3)
......
......@@ -29,7 +29,6 @@
void
main(void)
{
/*DEFINE(KERNELBASE, KERNELBASE);*/
DEFINE(STATE, offsetof(struct task_struct, state));
DEFINE(NEXT_TASK, offsetof(struct task_struct, next_task));
DEFINE(COUNTER, offsetof(struct task_struct, counter));
......@@ -37,54 +36,20 @@ main(void)
DEFINE(SIGNAL, offsetof(struct task_struct, signal));
DEFINE(TSS, offsetof(struct task_struct, tss));
DEFINE(KSP, offsetof(struct thread_struct, ksp));
DEFINE(PG_TABLES, offsetof(struct thread_struct, pg_tables));
#ifdef CONFIG_PMAC
DEFINE(LAST_PC, offsetof(struct thread_struct, last_pc));
DEFINE(USER_STACK, offsetof(struct thread_struct, user_stack));
#endif
/*DEFINE(PG_TABLES, offsetof(struct thread_struct, pg_tables));*/
DEFINE(MM, offsetof(struct task_struct, mm));
DEFINE(PGD, offsetof(struct mm_struct, pgd));
DEFINE(LAST_SYSCALL, offsetof(struct thread_struct, last_syscall));
DEFINE(PT_REGS, offsetof(struct thread_struct, regs));
DEFINE(PF_TRACESYS, PF_TRACESYS);
DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));
DEFINE(TSS_FPR0, offsetof(struct thread_struct, fpr[0]));
#if 0
DEFINE(TSS_FPR1, offsetof(struct thread_struct, fpr[1]));
DEFINE(TSS_FPR2, offsetof(struct thread_struct, fpr[2]));
DEFINE(TSS_FPR3, offsetof(struct thread_struct, fpr[3]));
DEFINE(TSS_FPR4, offsetof(struct thread_struct, fpr[4]));
DEFINE(TSS_FPR5, offsetof(struct thread_struct, fpr[5]));
DEFINE(TSS_FPR6, offsetof(struct thread_struct, fpr[6]));
DEFINE(TSS_FPR7, offsetof(struct thread_struct, fpr[7]));
DEFINE(TSS_FPR8, offsetof(struct thread_struct, fpr[8]));
DEFINE(TSS_FPR9, offsetof(struct thread_struct, fpr[9]));
DEFINE(TSS_FPR10, offsetof(struct thread_struct, fpr[10]));
DEFINE(TSS_FPR11, offsetof(struct thread_struct, fpr[11]));
DEFINE(TSS_FPR12, offsetof(struct thread_struct, fpr[12]));
DEFINE(TSS_FPR13, offsetof(struct thread_struct, fpr[13]));
DEFINE(TSS_FPR14, offsetof(struct thread_struct, fpr[14]));
DEFINE(TSS_FPR15, offsetof(struct thread_struct, fpr[15]));
DEFINE(TSS_FPR16, offsetof(struct thread_struct, fpr[16]));
DEFINE(TSS_FPR17, offsetof(struct thread_struct, fpr[17]));
DEFINE(TSS_FPR18, offsetof(struct thread_struct, fpr[18]));
DEFINE(TSS_FPR19, offsetof(struct thread_struct, fpr[19]));
DEFINE(TSS_FPR20, offsetof(struct thread_struct, fpr[20]));
DEFINE(TSS_FPR21, offsetof(struct thread_struct, fpr[21]));
DEFINE(TSS_FPR22, offsetof(struct thread_struct, fpr[22]));
DEFINE(TSS_FPR23, offsetof(struct thread_struct, fpr[23]));
DEFINE(TSS_FPR24, offsetof(struct thread_struct, fpr[24]));
DEFINE(TSS_FPR25, offsetof(struct thread_struct, fpr[25]));
DEFINE(TSS_FPR26, offsetof(struct thread_struct, fpr[26]));
DEFINE(TSS_FPR27, offsetof(struct thread_struct, fpr[27]));
DEFINE(TSS_FPR28, offsetof(struct thread_struct, fpr[28]));
DEFINE(TSS_FPR29, offsetof(struct thread_struct, fpr[29]));
DEFINE(TSS_FPR30, offsetof(struct thread_struct, fpr[30]));
DEFINE(TSS_FPR31, offsetof(struct thread_struct, fpr[31]));
#endif
DEFINE(TSS_FPSCR, offsetof(struct thread_struct, fpscr));
/* Interrupt register frame */
DEFINE(TASK_UNION_SIZE, sizeof(union task_union));
DEFINE(STACK_FRAME_OVERHEAD, STACK_FRAME_OVERHEAD);
DEFINE(INT_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs));
/* in fact we only use gpr0 - gpr9 and gpr20 - gpr23 */
DEFINE(GPR0, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[0]));
DEFINE(GPR1, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[1]));
DEFINE(GPR2, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[2]));
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -187,7 +187,3 @@ n:
#define REST_8FPRS(n, base) REST_4FPRS(n, base); REST_4FPRS(n+4, base)
#define REST_16FPRS(n, base) REST_8FPRS(n, base); REST_8FPRS(n+8, base)
#define REST_32FPRS(n, base) REST_16FPRS(n, base); REST_16FPRS(n+16, base)
/* Missing instructions */
#define bdne bc 0,2,
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment