grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RISC OS rescue mode


From: Timothy Baldwin
Subject: Re: RISC OS rescue mode
Date: Sat, 19 Nov 2005 11:22:02 +0000
User-agent: KMail/1.8.2

On Friday 18 Nov 2005 23:27, Hollis Blanchard wrote:
> On Friday 18 November 2005 16:37, Timothy Baldwin wrote:

>
> > 2005-08-29  Timothy Baldwin <address@hidden>
> >     * boot/arm/RISC_OS/!Run,feb: New file.
>
> What on earth is this file...? :)

A script which loads the GRUB kernel.

>
> >     * kern/arm/RISC_OS/init.c: Likewise.
>
> I'm a little confused about this "RISC_OS" naming. Is "RISC_OS" the name of
> the firmware that GRUB runs above? If not, I don't think that's an
> appropriate name.

The firmware is called "RISC OS", not to be confused with "RISC/os". Putting 
spaces in the filenames is asking for trouble.

RISC OS is a co-operative multitasking operating system and is the firmware in 
the systems on which it runs.

2005-08-29  Timothy Baldwin <address@hidden>
        * boot/arm/RISC_OS/!Run,feb: New file.
        * kern/arm/aif_header.lds: Likewise.
        * kern/arm/aif_header.S: Likewise.
        * kern/arm/dl.c: Likewise.
        * kern/arm/RISC_OS/init.c: Likewise.
        * kern/arm/RISC_OS/misc.c: Likewise.
        * kern/arm/RISC_OS/startup.S: Likewise.
        * normal/arm/setjmp.S: Likewise.
        * include/grub/arm/libgcc.h: Likewise.
        * include/grub/arm/RISC_OS/console.h: Likewise.
        * include/grub/arm/RISC_OS/misc.h: Likewise.
        * include/grub/arm/RISC_OS/swis.h: Likewise.
        * include/grub/arm/RISC_OS/time.h: Likewise.
        * include/grub/arm/setjmp.h: Likewise.
        * conf/arm-RISC_OS.rmk: Likewise.

        * include/grub/misc.h (grub_align): New macro.
        (memset): New prototype.

        * Makefile.in (RMKFILES): Add arm-RISC_OS.rmk and common.rmk to list.

        * configure.ac: Add tests for ARM and -std=gnu99 gcc option.


-- 
Member AFFS, WYLUG, SWP (UK), UAF, RESPECT, StWC
No to software patents!    Victory to the iraqi resistance!
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/boot/arm/RISC_OS/!Run,feb 
grub2-RISC_OS/boot/arm/RISC_OS/!Run,feb
--- grub2-split/boot/arm/RISC_OS/!Run,feb       1970-01-01 01:00:00.000000000 
+0100
+++ grub2-RISC_OS/boot/arm/RISC_OS/!Run,feb     2005-11-18 15:26:26.000000000 
+0000
@@ -0,0 +1,33 @@
+| !Run - start grub on RISC OS.
+
+| GRUB  --  GRand Unified Bootloader
+| Copyright (C) 2005  Free Software Foundation, Inc.
+|
+| 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.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; if not, write to the Free Software
+| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+
+| Record this directory
+Set Grub$Dir <Obey$Dir>
+Set Alias$Grub Run |<Grub$Dir>
+
+| Set text window to full screen and use default colours.
+Echo <20><26><12>
+Pointer 0
+
+| Ensure we have enough memory
+Wimpslot 256K 256K
+
+| Start grub
+Run <Grub$Dir>.grub_RO %*0
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/conf/arm-RISC_OS.rmk 
grub2-RISC_OS/conf/arm-RISC_OS.rmk
--- grub2-split/conf/arm-RISC_OS.rmk    1970-01-01 01:00:00.000000000 +0100
+++ grub2-RISC_OS/conf/arm-RISC_OS.rmk  2005-11-18 15:53:05.000000000 +0000
@@ -0,0 +1,64 @@
+# -*- makefile -*-
+
+COMMON_ASFLAGS = -nostdinc -fno-builtin -Wa,--gstabs
+COMMON_CFLAGS = -fno-builtin -ffixed-r10 -mapcs-frame -mpoke-function-name
+
+pkgdata_DATA = $(srcdir)/boot/arm/RISC_OS/!Run,feb
+
+# Images.
+pkgdata_IMAGES = grub_RO,ff8
+
+# For grub_RO.img.
+grub_RO_ff8_SOURCES = kern/arm/aif_header.S \
+       kern/main.c kern/device.c kern/parser.c \
+       kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
+       kern/misc.c  kern/loader.c kern/rescue.c kern/term.c \
+       kern/partition.c kern/env.c symlist.c \
+       kern/arm/dl.c kern/arm/RISC_OS/startup.S\
+       kern/arm/RISC_OS/init.c kern/arm/RISC_OS/misc.c \
+       term/arm/RISC_OS/console.c term/arm/RISC_OS/console-asm.S \
+       
+grub_RO_ff8_HEADERS = arg.h boot.h device.h disk.h dl.h elf.h env.h err.h \
+       file.h fs.h kernel.h loader.h misc.h mm.h net.h partition.h \
+       pc_partition.h rescue.h symbol.h term.h types.h parser.h \
+       arm/libgcc.h \
+       arm/RISC_OS/misc.h  \
+       arm/RISC_OS/time.h
+       
+grub_RO_ff8_CFLAGS = $(COMMON_CFLAGS)
+grub_RO_ff8_ASFLAGS = $(COMMON_ASFLAGS)
+grub_RO_ff8_LDFLAGS = `$(CC) -print-libgcc-file-name` 
$(srcdir)/kern/arm/aif_header.lds -nostdlib -Wl,-N,-Ttext,8000
+
+MOSTLYCLEANFILES += symlist.c grub_RO_syms.lst
+DEFSYMFILES += grub_RO_syms.lst
+
+symlist.c: $(addprefix include/grub/,$(grub_RO_ff8_HEADERS)) gensymlist.sh
+       sh $(srcdir)/gensymlist.sh $(filter %.h,$^) > $@
+
+grub_RO_syms.lst: $(addprefix include/grub/,$(grub_RO_ff8_HEADERS)) 
genkernsyms.sh
+       sh $(srcdir)/genkernsyms.sh $(filter %h,$^) > $@
+
+
+
+# Utilities.
+noinst_UTILITIES = genmoddep
+
+
+# For genmoddep.
+genmoddep_SOURCES = util/genmoddep.c
+
+# Modules.
+pkgdata_MODULES =  normal.mod 
+# For normal.mod.
+
+normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c    \
+       normal/completion.c normal/context.c normal/execute.c           \
+       normal/function.c normal/lexer.c normal/main.c normal/menu.c    \
+       normal/menu_entry.c normal/misc.c grub_script.tab.c             \
+       normal/script.c normal/arm/setjmp.S
+normal_mod_CFLAGS = $(COMMON_CFLAGS)
+normal_mod_ASFLAGS = $(COMMON_ASFLAGS)
+normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
+
+include $(top_srcdir)/conf/common.mk
\ No newline at end of file
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/configure.ac grub2-RISC_OS/configure.ac
--- grub2-split/configure.ac    2005-11-08 18:39:52.000000000 +0000
+++ grub2-RISC_OS/configure.ac  2005-11-18 15:26:26.000000000 +0000
@@ -24,6 +24,7 @@ case "$host_cpu" in
   i[[3456]]86) host_cpu=i386 ;;
   x86_64) host_cpu=i386 amd64=1 ;;
   powerpc) ;;
+  arm) ;;
   sparc64) ;;
   *) AC_MSG_ERROR([unsupported CPU type]) ;;
 esac
@@ -31,6 +32,7 @@ esac
 case "$host_cpu"-"$host_vendor" in
   i386-*) host_vendor=pc ;;
   powerpc-*) host_vendor=ieee1275 ;;
+  arm-*) host_vendor=RISC_OS ;;
   sparc64-*) host_vendor=ieee1275 ;;
   *) AC_MSG_ERROR([unsupported machine type]) ;;
 esac
@@ -66,6 +68,23 @@ if test "x$default_CFLAGS" = xyes; then
     tmp_CFLAGS="$tmp_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops"
   fi
 
+  # C99.
+  AC_CACHE_CHECK([whether -std=gnu99 works], c99_flag, [
+    CFLAGS=-std=gnu99
+    AC_TRY_COMPILE(, , c99_flag=yes, c99_flag=no)
+  ])
+  if test "x$c99_flag" = xyes; then
+    tmp_CFLAGS="$tmp_CFLAGS -std=gnu99"
+  fi
+
+  AC_CACHE_CHECK([whether -fstd=gnu9x works], c9x_flag, [
+    CFLAGS=-fstd=gnu9x
+    AC_TRY_COMPILE(, , c9x_flag=yes, c9x_flag=no)
+  ])
+  if test "x$c9x_flag" = xyes; then
+    tmp_CFLAGS="$tmp_CFLAGS -fstd=gnu9x"
+  fi
+
   # Force no alignment to save space on i386.
   if test "x$host_cpu" = xi386; then
     AC_CACHE_CHECK([whether -falign-loops works], [falign_loop_flag], [
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/include/grub/arm/libgcc.h 
grub2-RISC_OS/include/grub/arm/libgcc.h
--- grub2-split/include/grub/arm/libgcc.h       1970-01-01 01:00:00.000000000 
+0100
+++ grub2-RISC_OS/include/grub/arm/libgcc.h     2005-11-18 15:30:37.000000000 
+0000
@@ -0,0 +1,27 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004  Free Software Foundation, Inc.
+ *
+ *  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.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+void EXPORT_FUNC (__clear_cache) (void *start, void *end);
+void EXPORT_FUNC (__udivsi3) (void);
+void EXPORT_FUNC (__umodsi3) (void);
+void EXPORT_FUNC (__divsi3) (void);
+void EXPORT_FUNC (__modsi3) (void);
+void EXPORT_FUNC (__ashldi3) (void);
+void EXPORT_FUNC (__lshrdi3) (void);
+void EXPORT_FUNC (__muldi3) (void);
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/include/grub/arm/RISC_OS/console.h 
grub2-RISC_OS/include/grub/arm/RISC_OS/console.h
--- grub2-split/include/grub/arm/RISC_OS/console.h      1970-01-01 
01:00:00.000000000 +0100
+++ grub2-RISC_OS/include/grub/arm/RISC_OS/console.h    2005-11-18 
18:50:02.000000000 +0000
@@ -0,0 +1,43 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
+ *
+ *  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.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef GRUB_CONSOLE_MACHINE_HEADER
+#define GRUB_CONSOLE_MACHINE_HEADER    1
+
+#ifndef ASM_FILE
+
+#include <grub/types.h>
+#include <grub/symbol.h>
+#include <grub/term.h>
+
+/* These are global to share code between C and asm.  */
+void grub_console_real_putchar (int c);
+int EXPORT_FUNC (grub_console_checkkey) (void);
+int EXPORT_FUNC (grub_console_getkey) (void);
+grub_uint16_t grub_console_getxy (void);
+int grub_console_get_and_set_cursor_key_state (int);
+int grub_console_convert (int c);
+extern grub_uint16_t grub_console_getwh (void);
+
+/* Initialize the console system.  */
+void grub_console_initialise (void);
+int grub_console_in_taskwindow (void);
+#endif
+
+#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/include/grub/arm/RISC_OS/misc.h 
grub2-RISC_OS/include/grub/arm/RISC_OS/misc.h
--- grub2-split/include/grub/arm/RISC_OS/misc.h 1970-01-01 01:00:00.000000000 
+0100
+++ grub2-RISC_OS/include/grub/arm/RISC_OS/misc.h       2005-11-18 
16:13:50.000000000 +0000
@@ -0,0 +1,79 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004,2005  Free Software Foundation, Inc.
+ *
+ *  GRUB 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.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef GRUB_MISC_MACHINE_HEADER
+#define GRUB_MISC_MACHINE_HEADER       1
+
+#include <grub/types.h>
+#include <grub/err.h>
+#include <grub/symbol.h>
+
+typedef struct grub_RISC_OS_error
+{
+  unsigned number;
+  char message[];
+} *grub_RISC_OS_error_t;
+
+/* Number of last RISC OS error passed to grub_RISC_OS_error_convert */
+extern unsigned EXPORT_VAR (grub_RISC_OS_errno);
+
+/* ISO C */
+typedef struct
+{
+  int pad[9];
+} grub_RISC_OS_FILE;
+
+#define SEEK_SET 0
+#define SEEK_END 2
+
+extern unsigned EXPORT_VAR (grub_RISC_OS_clib_errno);
+
+/* ISO C functions */
+grub_RISC_OS_FILE *grub_RISC_OS_fopen (const char *path, const char *mode);
+int grub_RISC_OS_fclose (grub_RISC_OS_FILE * fp);
+int grub_RISC_OS_fseek (grub_RISC_OS_FILE * stream, long offset, int whence);
+grub_ssize_t grub_RISC_OS_fread (void *ptr, grub_ssize_t size,
+                                grub_ssize_t nmemb,
+                                grub_RISC_OS_FILE * stream);
+long grub_RISC_OS_ftell (grub_RISC_OS_FILE * stream);
+void *grub_RISC_OS_malloc (grub_size_t size);
+void *grub_RISC_OS_realloc (void *ptr, grub_size_t size);
+void grub_RISC_OS_free (void *ptr);
+void *EXPORT_FUNC (grub_RISC_OS_system) (const char *);
+
+/* SharedCLibrary functions */
+grub_RISC_OS_error_t *EXPORT_FUNC (grub_RISC_OS_kernel_setenv) (const char
+                                                               *name,
+                                                               const char
+                                                               *value);
+
+grub_err_t EXPORT_FUNC (grub_RISC_OS_error_convert) (grub_RISC_OS_error_t,
+                                                    grub_err_t);
+grub_err_t
+EXPORT_FUNC (grub_RISC_OS_error_convert_zero) (grub_RISC_OS_error_t,
+                                              grub_err_t);
+grub_err_t EXPORT_FUNC (grub_RISC_OS_clib_error) (grub_err_t);
+grub_RISC_OS_error_t grub_RISC_OS_kernel_last_oserror (void);
+
+int EXPORT_FUNC (grub_RISC_OS_get_swi_number) (const char *);
+
+extern unsigned grub_RISC_OS_version, grub_RISC_OS_81C710_present;
+extern const char *grub_RISC_OS_dealer;
+
+#endif /* ! GRUB_MISC_MACHINE_HEADER */
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/include/grub/arm/RISC_OS/swis.h 
grub2-RISC_OS/include/grub/arm/RISC_OS/swis.h
--- grub2-split/include/grub/arm/RISC_OS/swis.h 1970-01-01 01:00:00.000000000 
+0100
+++ grub2-RISC_OS/include/grub/arm/RISC_OS/swis.h       2005-11-18 
15:26:26.000000000 +0000
@@ -0,0 +1,83 @@
+/* swis.h - RISC OS SWI Numbers */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004  Free Software Foundation, Inc.
+ *
+ *  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.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not write to the Free Software
+ *  Foundation Inc. 675 Mass Ave Cambridge MA 02139 USA.
+ */
+
+#ifndef GRUB_MACHINE_SWI_HEADER
+#define GRUB_MACHINE_SWI_HEADER 1
+
+#define X(x) ((x) | 0x20000)
+
+#define Cache_Control 0x280
+#define Cache_Flush 0x284
+#define ColourTrans_ReturnColourNumber 0x40744
+#define FileCore_DescribeDisc 0x40545
+#define FileCore_DiscOp 0x40540
+#define FileCore_DiscOp64 0x4054E
+#define FileCore_Drives 0x40542
+#define FileCore_MiscOp 0x40549
+#define FileCore_SectorOp 0x4054A
+#define Hourglass_Off 0x406C1
+#define Hourglass_On 0x406C0
+#define Hourglass_Smash 0x406C2
+#define OS_Args 0x09
+#define OS_BreakPt 0x17
+#define OS_Byte 0x06
+#define OS_Claim 0x1F
+#define OS_Release 0x20
+#define OS_ChangeDynamicArea 0x2A
+#define OS_ChangeEnvironment 0x40
+#define OS_CLI 0x05
+#define OS_ConvertHex8 0xD4
+#define OS_EnterOS 0x16
+#define OS_Exit 0x11
+#define OS_File 0x08
+#define OS_Find 0x0D
+#define OS_FSControl 0x29
+#define OS_GBPB 0x0C
+#define OS_GenerateError 0x2B
+#define OS_GetEnv 0x10
+#define OS_LeaveOS 0x7C
+#define OS_IntOff 0x14
+#define OS_Memory 0x68
+#define OS_Module 0x1E
+#define OS_ReadArgs 0x49
+#define OS_ReadC 0x04
+#define OS_ReadDynamicArea 0x5C
+#define OS_ReadMonotonicTime 0x42
+#define OS_ReadSysInfo 0x58
+#define OS_ReadUnsigned 0x21
+#define OS_ReadVduVariables 0x31
+#define OS_RemoveCursors 0x36
+#define OS_Reset 0x6A
+#define OS_ServiceCall 0x30
+#define OS_SWINumberFromString 0x39
+#define OS_SynchroniseCodeAreas 0x006E
+#define OS_Write0 0x02
+#define OS_WriteC 0x00
+#define OS_WriteI 0x100
+#define OS_WriteN 0x46
+#define OS_WriteS 0x01
+#define SharedCLibrary_LibInitAPCS_32 0x80683
+#define SharedCLibrary_LibInitAPCS_R 0x80681
+#define TaskWindow_TaskInfo 0x43380
+
+#define Service_PreReset 0x45
+#define ERROR_NO_SUCH_SWI 0x1E6
+
+#endif /* GRUB_MACHINE_SWI_HEADER */
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/include/grub/arm/RISC_OS/time.h 
grub2-RISC_OS/include/grub/arm/RISC_OS/time.h
--- grub2-split/include/grub/arm/RISC_OS/time.h 1970-01-01 01:00:00.000000000 
+0100
+++ grub2-RISC_OS/include/grub/arm/RISC_OS/time.h       2005-11-18 
15:26:26.000000000 +0000
@@ -0,0 +1,33 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+ *
+ *  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.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef KERNEL_TIME_HEADER
+#define KERNEL_TIME_HEADER     1
+
+#ifdef GRUB_UTIL
+# include <time.h>
+# define GRUB_TICKS_PER_SECOND CLOCKS_PER_SEC
+#else
+# define GRUB_TICKS_PER_SECOND 100
+#endif
+
+/* Return the real time in ticks.  */
+grub_uint32_t EXPORT_FUNC (grub_get_rtc) (void);
+
+#endif /* ! KERNEL_TIME_HEADER */
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/include/grub/arm/setjmp.h 
grub2-RISC_OS/include/grub/arm/setjmp.h
--- grub2-split/include/grub/arm/setjmp.h       1970-01-01 01:00:00.000000000 
+0100
+++ grub2-RISC_OS/include/grub/arm/setjmp.h     2005-11-18 15:26:26.000000000 
+0000
@@ -0,0 +1,25 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004  Free Software Foundation, Inc.
+ *
+ *  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.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef GRUB_SETJMP_CPU_HEADER
+#define GRUB_SETJMP_CPU_HEADER 1
+
+typedef unsigned long grub_jmp_buf[10];
+
+#endif /* ! GRUB_SETJMP_CPU_HEADER */
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/include/grub/arm/types.h 
grub2-RISC_OS/include/grub/arm/types.h
--- grub2-split/include/grub/arm/types.h        1970-01-01 01:00:00.000000000 
+0100
+++ grub2-RISC_OS/include/grub/arm/types.h      2005-11-18 15:26:26.000000000 
+0000
@@ -0,0 +1,35 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2002,2004  Free Software Foundation, Inc.
+ *
+ *  GRUB 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.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef GRUB_TYPES_CPU_HEADER
+#define GRUB_TYPES_CPU_HEADER  1
+
+/* The size of void *.  */
+#define GRUB_HOST_SIZEOF_VOID_P        4
+
+/* The size of long.  */
+#define GRUB_HOST_SIZEOF_LONG  4
+
+/* The size of a page. */
+#define GRUB_HOST_PAGE_SIZE (0x400)
+
+/* ARM is little-endian. (Or big-endian!! - but we don't support that yet) */
+#undef GRUB_HOST_WORDS_BIGENDIAN
+
+#endif /* ! GRUB_TYPES_CPU_HEADER */
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/include/grub/misc.h 
grub2-RISC_OS/include/grub/misc.h
--- grub2-split/include/grub/misc.h     2005-10-24 11:23:46.000000000 +0100
+++ grub2-RISC_OS/include/grub/misc.h   2005-11-18 15:26:26.000000000 +0000
@@ -29,6 +29,7 @@
 #define grub_dprintf(condition, fmt, args...) grub_real_dprintf(__FILE__, 
__LINE__, condition, fmt, ## args);
 /* XXX: If grub_memmove is too slow, we must implement grub_memcpy.  */
 #define grub_memcpy(d,s,n)     grub_memmove ((d), (s), (n))
+#define grub_align(align, val) (((val) + ((align) - 1)) & ~((align) - 1))
 
 void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t n);
 char *EXPORT_FUNC(grub_strcpy) (char *dest, const char *src);
@@ -40,6 +41,7 @@ char *EXPORT_FUNC(grub_strncat) (char *d
 /* Prototypes for aliases.  */
 void *EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n);
 void *EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n);
+void *EXPORT_FUNC(memset) (void *s, int c, grub_size_t n);
 
 int EXPORT_FUNC(grub_memcmp) (const void *s1, const void *s2, grub_size_t n);
 int EXPORT_FUNC(grub_strcmp) (const char *s1, const char *s2);
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/include/grub/powerpc/libgcc.h 
grub2-RISC_OS/include/grub/powerpc/libgcc.h
--- grub2-split/include/grub/powerpc/libgcc.h   2005-02-13 18:54:57.000000000 
+0000
+++ grub2-RISC_OS/include/grub/powerpc/libgcc.h 2005-11-18 15:30:45.000000000 
+0000
@@ -17,7 +17,6 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-void EXPORT_FUNC (memset) (void);
 void EXPORT_FUNC (__adddf3) (void);
 void EXPORT_FUNC (__addsf3) (void);
 void EXPORT_FUNC (__ashldi3) (void);
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/kern/arm/aif_header.lds 
grub2-RISC_OS/kern/arm/aif_header.lds
--- grub2-split/kern/arm/aif_header.lds 1970-01-01 01:00:00.000000000 +0100
+++ grub2-RISC_OS/kern/arm/aif_header.lds       2005-11-18 15:26:26.000000000 
+0000
@@ -0,0 +1,23 @@
+/* aif_header.lds - Calculate values for AIF header */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004 Timothy Baldwin.
+ *
+ *  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.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+grub_text_size = __data_start - _start;
+grub_data_size = _edata - __data_start;
+grub_bss_size = _end - _edata;
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/kern/arm/aif_header.S 
grub2-RISC_OS/kern/arm/aif_header.S
--- grub2-split/kern/arm/aif_header.S   1970-01-01 01:00:00.000000000 +0100
+++ grub2-RISC_OS/kern/arm/aif_header.S 2005-11-18 15:26:26.000000000 +0000
@@ -0,0 +1,60 @@
+/* aif_header.S - AIF header */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004 Timothy Baldwin.
+ *
+ *  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.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  aword with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <config.h>
+#include <grub/symbol.h>
+
+       .align
+       .global _start
+_start:        nop
+       nop
+       bl      zeroinit
+       bl      grub_arm_startup
+lock:  b       lock    @ "Program exit instruction" (never reached)
+       .word   grub_text_size
+dsize: .word   grub_data_size
+       .word   0       @ Debug data size
+zisize:        .word   grub_bss_size
+       .word   0       @ No Debug data
+       .word   _start
+       .word   0       @ Workspace for self-moving image (not used)
+       .word   32      @ Yes, we work in 32bit PC modes.
+dstart:        .word   __data_start
+       .word   0, 0    @ Unused
+       nop             @ Initialise debugger (NOT!!)
+       
+zeroinit:
+       ldr     r0, dstart
+       ldr     r1, dsize
+       add     r0, r0, r1
+       ldr     r4, zisize
+       
+       @ Zero BSS area
+       mov     r1, #0  
+1:     str     r1, [r0], #4    
+       subs    r4, r4, #4
+       bcs     1b
+       mov     pc, lr
+       
+
+       .ltorg
+       .org    _start + 128
+       
+       @ Size of appended modules
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/kern/arm/dl.c grub2-RISC_OS/kern/arm/dl.c
--- grub2-split/kern/arm/dl.c   1970-01-01 01:00:00.000000000 +0100
+++ grub2-RISC_OS/kern/arm/dl.c 2005-11-18 15:26:26.000000000 +0000
@@ -0,0 +1,114 @@
+/* dl.c - arch-dependent part of loadable module support */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2002,2004,2005  Free Software Foundation, Inc.
+ *
+ *  GRUB 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.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <grub/dl.h>
+#include <grub/elf.h>
+#include <grub/misc.h>
+#include <grub/err.h>
+
+/* Check if EHDR is a valid ELF header.  */
+grub_err_t
+grub_arch_dl_check_header (void *ehdr)
+{
+  Elf32_Ehdr *e = ehdr;
+
+  /* Check the magic numbers.  */
+  if (e->e_ident[EI_CLASS] != ELFCLASS32
+      || e->e_ident[EI_DATA] != ELFDATA2LSB || e->e_machine != EM_ARM)
+    return grub_error (GRUB_ERR_BAD_MODULE,
+                      "invalid arch specific ELF magic");
+
+  return GRUB_ERR_NONE;
+}
+
+/* Relocate symbols.  */
+grub_err_t
+grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
+{
+  Elf32_Ehdr *e = ehdr;
+  Elf32_Shdr *s;
+  Elf32_Sym *symtab;
+  Elf32_Word entsize;
+  unsigned i;
+
+  /* Find a symbol table.  */
+  for (i = 0, s = (Elf32_Shdr *) ((char *) e + e->e_shoff);
+       i < e->e_shnum; i++, s = (Elf32_Shdr *) ((char *) s + e->e_shentsize))
+    if (s->sh_type == SHT_SYMTAB)
+      break;
+
+  if (i == e->e_shnum)
+    return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found");
+
+  symtab = (Elf32_Sym *) ((char *) e + s->sh_offset);
+  entsize = s->sh_entsize;
+
+  for (i = 0, s = (Elf32_Shdr *) ((char *) e + e->e_shoff);
+       i < e->e_shnum; i++, s = (Elf32_Shdr *) ((char *) s + e->e_shentsize))
+    if (s->sh_type == SHT_REL)
+      {
+       grub_dl_segment_t seg;
+
+       /* Find the target segment.  */
+       for (seg = mod->segment; seg; seg = seg->next)
+         if (seg->section == s->sh_info)
+           break;
+
+       if (seg)
+         {
+           Elf32_Rel *rel, *max;
+
+           for (rel = (Elf32_Rel *) ((char *) e + s->sh_offset),
+                max = rel + s->sh_size / s->sh_entsize; rel < max; rel++)
+             {
+               Elf32_Word *addr;
+               Elf32_Sym *sym;
+
+               if (seg->size < rel->r_offset)
+                 return grub_error (GRUB_ERR_BAD_MODULE,
+                                    "reloc offset is out of the segment");
+
+               addr = (Elf32_Word *) ((char *) seg->addr + rel->r_offset);
+               sym = (Elf32_Sym *) ((char *) symtab
+                                    + entsize * ELF32_R_SYM (rel->r_info));
+
+               switch (ELF32_R_TYPE (rel->r_info))
+                 {
+                 case R_ARM_ABS32:
+                   *addr += sym->st_value;
+                   break;
+
+                 case R_ARM_PC24:
+                   *addr =
+                     (*addr & 0xFF000000) |
+                     ((*addr +
+                       ((sym->st_value -
+                         ((Elf32_Word) addr)) >> 2)) & 0x00FFFFFF);
+                   break;
+                 default:
+                   return grub_error (GRUB_ERR_BAD_MODULE,
+                                      "unsupported reloc type");
+                 }
+             }
+         }
+      }
+
+  return GRUB_ERR_NONE;
+}
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/kern/arm/RISC_OS/init.c 
grub2-RISC_OS/kern/arm/RISC_OS/init.c
--- grub2-split/kern/arm/RISC_OS/init.c 1970-01-01 01:00:00.000000000 +0100
+++ grub2-RISC_OS/kern/arm/RISC_OS/init.c       2005-11-18 19:00:19.000000000 
+0000
@@ -0,0 +1,94 @@
+/* init.c - RISC OS Initialisation */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004,2005  Free Software Foundation, Inc.
+ *
+ *  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.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <grub/kernel.h>
+#include <grub/mm.h>
+#include <grub/misc.h>
+#include <grub/machine/console.h>
+#include <grub/env.h>
+#include <grub/arm/RISC_OS/misc.h>
+
+extern const char *grub_RISC_OS_kernel_command_string (void);
+
+static unsigned grub_arm_linux_sysid;
+static const char *grub_machine_type_name;
+
+extern unsigned grub_arm_machine_serial_number[2];
+
+
+static inline void
+new_init (void)
+{
+  /* RISC OS version >= 3.5 */
+
+  if (grub_RISC_OS_dealer
+      && grub_strcmp (grub_RISC_OS_dealer, "Riscstation") == 0)
+    {
+      grub_arm_linux_sysid = 46;
+      grub_machine_type_name = "RiscStation";
+    }
+  else
+    {
+      grub_arm_linux_sysid = 1;
+      grub_machine_type_name = "RiscPC";
+    }
+
+  /* FIXME: Identify Bush Internet TV */
+  /* FIXME: Identify Iynoix PC */
+
+}
+
+static inline void
+old_init (void)
+{
+  /* RISC OS version < 3.5 */
+
+  if (grub_RISC_OS_81C710_present)
+    {
+      grub_arm_linux_sysid = 11;
+      grub_machine_type_name = "A5000";
+    }
+  else
+    {
+      grub_arm_linux_sysid = 10;
+      grub_machine_type_name = "Archimedes";
+    }
+}
+
+
+void
+grub_machine_init ()
+{
+  grub_console_initialise ();
+  grub_env_set ("prefix", "(host)/<Grub$Dir>");
+
+  if (grub_RISC_OS_version < 0xA5)
+    old_init ();
+  else
+    new_init ();
+
+  char buf[20];
+
+  grub_sprintf (buf, "%d", grub_arm_linux_sysid);
+  grub_env_set ("grub_arm_linux_sysid", buf);
+
+  grub_env_set ("grub_machine_type_name", grub_machine_type_name);
+
+}
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/kern/arm/RISC_OS/misc.c 
grub2-RISC_OS/kern/arm/RISC_OS/misc.c
--- grub2-split/kern/arm/RISC_OS/misc.c 1970-01-01 01:00:00.000000000 +0100
+++ grub2-RISC_OS/kern/arm/RISC_OS/misc.c       2005-11-18 15:26:26.000000000 
+0000
@@ -0,0 +1,110 @@
+/* misc.h - misc RISC OS bits */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004,2005  Free Software Foundation, Inc.
+ *
+ *  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.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not write to the Free Software
+ *  Foundation Inc. 675 Mass Ave Cambridge MA 02139 USA.
+ */
+
+#include <grub/arm/RISC_OS/misc.h>
+#include <grub/misc.h>
+#include <grub/mm.h>
+
+unsigned grub_RISC_OS_errno;
+
+grub_err_t
+grub_RISC_OS_error_convert (grub_RISC_OS_error_t err, grub_err_t n)
+{
+  grub_RISC_OS_errno = err->number;
+
+  switch (grub_RISC_OS_errno)
+    {
+    case 0xD6:
+      n = GRUB_ERR_FILE_NOT_FOUND;
+      break;
+    case 1052:
+      n = GRUB_ERR_BAD_FS;
+      break;
+    default:
+      break;
+    }
+  grub_dprintf ("error_convert RISC OS = 0x%x GRUB = %d\n", 
grub_RISC_OS_errno, n)
+  return grub_error (n, "%s", err->message);
+}
+
+unsigned
+grub_RISC_OS_error_convert_zero (struct grub_RISC_OS_error *err,
+                                grub_err_t err2)
+{
+  grub_RISC_OS_error_convert (err, err2);
+  return 0;
+}
+
+grub_err_t
+grub_RISC_OS_clib_error (grub_err_t err)
+{
+  return grub_RISC_OS_error_convert (grub_RISC_OS_kernel_last_oserror (),
+                                    err);
+}
+
+void *
+grub_memalign (grub_size_t align, grub_size_t size)
+{
+  void **mem = grub_RISC_OS_malloc (size + align + sizeof (void *));
+  if (mem == 0)
+    {
+      grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory");
+      return 0;
+    }
+  void **result = (void **) grub_align (align, (unsigned) (mem + 1));
+  result[-1] = mem;
+  return result;
+}
+
+void *
+grub_malloc (grub_size_t size)
+{
+  void **result = grub_RISC_OS_malloc (size + sizeof (void *));
+  if (result == 0)
+    {
+      grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory");
+      return 0;
+    }
+  *result = result;
+  return result + 1;
+}
+
+void *
+grub_realloc (void *ptr, grub_size_t size)
+{
+  void **ptr2 = ptr;
+  void **result =
+    grub_RISC_OS_realloc (ptr2 ? ptr2[-1] : 0, size + sizeof (void *));
+  if (result == 0)
+    {
+      grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory");
+      return 0;
+    }
+  *result = result;
+  return result + 1;
+}
+
+void
+grub_free (void *ptr)
+{
+  void **ptr2 = ptr;
+  if (ptr2)
+    grub_RISC_OS_free (ptr2[-1]);
+}
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/kern/arm/RISC_OS/startup.S 
grub2-RISC_OS/kern/arm/RISC_OS/startup.S
--- grub2-split/kern/arm/RISC_OS/startup.S      1970-01-01 01:00:00.000000000 
+0100
+++ grub2-RISC_OS/kern/arm/RISC_OS/startup.S    2005-11-18 16:11:39.000000000 
+0000
@@ -0,0 +1,323 @@
+/* startup.S - RISC OS Initialisation*/
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004,2005  Free Software Foundation, Inc.
+ *
+ *  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.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <config.h>
+#include <grub/symbol.h>
+#include <grub/arm/RISC_OS/swis.h>
+
+
+       .bss
+       VARIABLE(grub_RISC_OS_81C710_present)
+       .space  4
+       VARIABLE(grub_arm_machine_serial_number)
+       .space  8
+       VARIABLE(grub_RISC_OS_version)
+       .space  4
+       VARIABLE(grub_RISC_OS_dealer)
+       .space  4
+       .text
+
+div0:  .word   0
+       .asciz  "Division by zero"
+c_str: .asciz  "C"
+
+load_library:
+       @ FIXME: Versions? And do we need the floating point emulator?
+       .asciz  "RMEnsure SharedCLibrary 3.75 RMLoad System:Modules.Clib"
+       .align
+       
+       .global grub_arm_startup
+grub_arm_startup:
+       swi     X(Hourglass_On)
+
+       adr     r0, load_library
+       swi     OS_CLI
+
+       ldr     r9, =grub_RISC_OS_81C710_present
+       mov     r0, #129
+       mov     r1, #0
+       mov     r2, #255
+       swi     OS_Byte
+       str     r1, [r9, #12]
+       cmp     r1, #0xA3
+       blo     1f @ Avoid RISC OS 2 OS_ReadSysInfo bug
+       
+       mov     r0, #9
+       mov     r1, #3
+       swi     X(OS_ReadSysInfo)
+       strvc   r0, [r9, #16]
+       
+       mov     r0, #2
+       swi     X(OS_ReadSysInfo)
+       stmvcia r9, {r1, r3, r4}
+               
+1:     swi     OS_GetEnv
+       mov     r2, r1 @ r2 <- End of heap
+       adr     r0, stubs
+       ldr     r1, =_end @ r1 <- Start of heap
+       mov     r3, #-1 @ Docs say so...
+       movs    r4, #0 @ Likewise
+       mov     r5, #-1 @ Likewise
+       mov     r6, #64 << 16 @ 64K stack
+       teq     pc, pc
+       orreq   r6, r6, #1 @ What is this for? (copied from gccsdk)
+       swi     X(SharedCLibrary_LibInitAPCS_32)
+       bvc     1f @ Branch if no error
+       
+       @ If error was "SWI value out of range for module SharedCLibrary"
+       @ and we are in 26-bit PC mode try APCS R, otherwise raise error.
+       teq     pc, pc
+       swieq   OS_GenerateError
+       ldr     r14, [r0]
+       ldr     r13, =0x800E85
+       teq     r14, r13
+       swine   OS_GenerateError
+       adr     r0, stubs
+       swi     SharedCLibrary_LibInitAPCS_R
+1:     mov     r4, r0
+       adr     r0, kernel_init_block
+       mov     r3, #0
+       b       grub_RISC_OS_kernel_init
+       
+stubs: .word   1
+       .word   kernel_vectors
+       .word   kernel_vectors_end
+       .word   kernel_statics
+       .word   kernel_statics_end
+       .word   2
+       .word   clib_vectors
+       .word   clib_vectors_end
+       .word   clib_statics
+       .word   clib_statics_end
+       .word   -1
+       
+       .bss
+kernel_vectors:
+       .space  48 * 4
+kernel_vectors_end:
+clib_vectors:
+       .space  183 * 4
+clib_vectors_end:
+
+kernel_statics:
+       .space  0x31C
+kernel_statics_end:
+clib_statics:
+       .space  0xB48
+clib_statics_end:
+
+       .macro  kernel, label, entry
+       .global grub_RISC_OS_kernel_\label
+       grub_RISC_OS_kernel_\label = kernel_vectors + \entry * 4
+       .endm
+       
+       .macro  clib, label, entry
+       .global grub_RISC_OS_\label
+       grub_RISC_OS_\label = clib_vectors + \entry * 4
+       .endm
+       
+       kallocExtendsWS = kernel_statics + 0x115
+       
+       .global grub_RISC_OS_clib_errno
+       grub_RISC_OS_clib_errno = clib_statics
+       
+       kernel  init, 0
+       kernel  command_string, 7
+       kernel  system, 22
+       kernel  last_oserror, 21
+       kernel  setenv, 24
+       
+       clib    malloc, 68
+       clib    free, 67
+       clib    realloc, 69
+       clib    system, 74
+       clib    atexit, 71
+       clib    exit, 72
+       clib    _clib_initialise, 20
+       clib    _clib_main, 18
+       clib    _backtrace, 21
+       
+       clib    fopen, 87
+       clib    fclose, 85
+       clib    fread, 114
+       clib    fseek, 117
+       clib    fwrite, 115
+       clib    ftell, 119
+       
+       clib    TrapHandler, 0
+       clib    UncaughtTrapHandler, 1
+       clib    EventHandler, 2
+       clib    UnhandledEventHandler, 3
+       
+       .text
+       
+       
+       .global system
+       system = grub_RISC_OS_system
+       
+kernel_init_block:
+       .word   0x8000, rts_block, rts_block_end
+
+rts_block:
+       .word   rts_block_end - rts_block
+       .word   0x8000, 0x7FFFFFFC, c_str, c_init, 0
+       .word   grub_RISC_OS_TrapHandler
+       .word   grub_RISC_OS_UncaughtTrapHandler
+       .word   grub_RISC_OS_EventHandler
+       .word   grub_RISC_OS_UnhandledEventHandler
+rts_block_end:
+       
+
+       
+c_init:        str     lr, [sp, #-4]!
+       ldr     a1, =kallocExtendsWS
+       mov     a2, #1
+       strb    a2, [a1]
+       bl      grub_RISC_OS__clib_initialise
+       adr     a1, c_run
+       teq     a1, a1
+       teq     pc, pc
+       ldmnefd sp!, {pc}^
+       ldr     pc, [sp], #4
+       
+c_run: adr     a1, atexit_wrapper
+       bl      grub_RISC_OS_atexit
+       mov     a1, #17
+       bl      grub_RISC_OS_set_escape_char
+       bl      grub_RISC_OS_kernel_command_string
+       ldr     a2, =grub_main
+       bl      grub_RISC_OS__clib_main
+FUNCTION(grub_stop)
+       mov     a1, #0
+       b       grub_RISC_OS_exit       
+
+atexit_wrapper:
+       str     lr, [sp, #-4]!
+       bl      grub_machine_fini
+       mov     a1, #27
+       bl      grub_RISC_OS_set_escape_char
+       swi     X(Hourglass_Off)
+       teq     a1, a1
+       teq     pc, pc
+       ldmnefd sp!, {pc}^
+       ldr     pc, [sp], #4
+
+       .global __div0  
+__div0:        adr     r0, div0
+       swi     OS_GenerateError
+       
+
+FUNCTION(grub_arch_modules_addr)
+       mov     a1, #0x8000
+FUNCTION(grub_mm_init_region)
+FUNCTION(grub_machine_fini)
+       mov     pc, lr
+
+FUNCTION(grub_RISC_OS_set_escape_char)
+       mov     r1, r0
+       mov     r2, #0
+       mov     r0, #220
+       swi     OS_Byte
+       mov     pc, lr
+       
+FUNCTION(grub_get_rtc)
+       swi     OS_ReadMonotonicTime
+       mov     pc, lr
+       
+       
+       .global __clear_cache
+__clear_cache:
+       stmfd   sp!, {r0-r2, lr}
+       mov     r2, r1
+       mov     r1, r0
+       mov     r0, #1
+       swi     X(OS_SynchroniseCodeAreas)
+       ldmfd   sp!, {r0-r2, pc}^
+
+FUNCTION(grub_arch_sync_caches)
+       add     r2, r1, r0
+       mov     r1, r0
+       mov     r0, #0
+       swi     X(OS_SynchroniseCodeAreas)
+       mov     pc, lr
+
+rc5pc_off:
+       .asciz  "%rc5pc off"
+       .align
+
+FUNCTION(grub_reboot)
+       adr     r0, rc5pc_off
+       swi     X(OS_CLI)
+       swi     OS_EnterOS
+       mov     r0, #23 @ Unmount filesystems
+       swi     OS_FSControl
+       swi     X(OS_Reset)     
+1:     bvc     1b
+       ldr     r1, [r0]
+       eor     r1, r1, #ERROR_NO_SUCH_SWI & 0xff00
+       teq     r1, #ERROR_NO_SUCH_SWI & 0x00ff
+       swine   OS_GenerateError
+       
+       @ If above call failed, we are running on an Archimedies.
+       mov     r0, #200
+       mov     r1, #2
+       swi     OS_Byte @ Set Full Reset
+       teqp    pc, #0x08000003 @ SVC Mode with IRQ disabled.
+       mov     r1, #Service_PreReset
+       swi     X(OS_ServiceCall)
+1:     bvs     1b
+       teqp    pc, #0x0C000003 @ SVC Mode with interrupts disabled.
+       
+       @ Copy word from start of ROM to address 0, then execute it.
+       mov     r0, #0x03800000
+       ldr     r1, [r0]
+       str     r1, [r0, -r0]
+       mov     pc, #0
+       
+       
+FUNCTION(grub_RISC_OS_get_swi_number)
+       mov     r1, a1
+       swi     X(OS_SWINumberFromString)
+       movvs   a1, #0
+       mov     pc, lr
+
+FUNCTION(grub_RISC_OS_save_file)
+       mov     r5, r3
+       mov     r4, r2
+       mov     r2, r1
+       mov     r1, r0
+       mov     r0, #10
+       swi     OS_File
+       mov     pc, lr
+
+FUNCTION(grub_RISC_OS_CLI)
+       @ May be called in SVC mode.
+       mov     ip, lr
+       swi     X(OS_CLI)
+       mov     pc, ip
+
+       .data
+VARIABLE(grub_end_addr)
+       .word   _end
+
+       .bss    
+VARIABLE(grub_total_module_size)
+       .space  4
+
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/Makefile.in grub2-RISC_OS/Makefile.in
--- grub2-split/Makefile.in     2005-11-17 19:12:30.000000000 +0000
+++ grub2-RISC_OS/Makefile.in   2005-11-18 15:46:37.000000000 +0000
@@ -72,7 +72,7 @@ LIBLZO = @LIBLZO@
 ### General variables.
 
 RMKFILES = $(addprefix conf/,common.rmk i386-pc.rmk powerpc-ieee1275.rmk \
-       sparc64-ieee1275.rmk)
+       sparc64-ieee1275.rmk arm-RISC_OS.rmk)
 MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES))
 
 DATA = $(pkgdata_IMAGES) $(pkgdata_MODULES) $(pkgdata_PROGRAMS) \
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/normal/arm/setjmp.S 
grub2-RISC_OS/normal/arm/setjmp.S
--- grub2-split/normal/arm/setjmp.S     1970-01-01 01:00:00.000000000 +0100
+++ grub2-RISC_OS/normal/arm/setjmp.S   2005-11-18 15:26:26.000000000 +0000
@@ -0,0 +1,33 @@
+/* setjmp.S - setjmp and longjmp */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004  Free Software Foundation, Inc.
+ *
+ *  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.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  aword with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <config.h>
+#include <grub/symbol.h>
+ 
+FUNCTION(grub_setjmp)
+       stmia   a1, {v1-v6, sl, fp, sp, lr}
+       mov     a1, #0
+       mov     pc, lr
+       
+FUNCTION(grub_longjmp)
+       ldmia   a1, {v1-v6, sl, fp, sp, lr}
+       movs    a1, a2
+       moveq   a1, #1
+       mov     pc, lr
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/term/arm/RISC_OS/console-asm.S 
grub2-RISC_OS/term/arm/RISC_OS/console-asm.S
--- grub2-split/term/arm/RISC_OS/console-asm.S  1970-01-01 01:00:00.000000000 
+0100
+++ grub2-RISC_OS/term/arm/RISC_OS/console-asm.S        2005-11-18 
15:26:26.000000000 +0000
@@ -0,0 +1,84 @@
+/* console-asm.S - RISC OS Console */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004 Timothy Baldwin.
+ *
+ *  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.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <config.h>
+#include <grub/symbol.h>
+#include <grub/arm/RISC_OS/swis.h>
+
+       .align
+
+FUNCTION(grub_console_real_putchar)
+       swi     OS_WriteC
+       mov     pc, lr
+
+FUNCTION(grub_console_getxy)
+       mov     r0, #165
+       swi     OS_Byte
+       orr     r0, r2, r1, lsl #8
+       mov     pc, lr
+
+FUNCTION(grub_console_getkey)
+       swi     X(Hourglass_Smash)
+       swi     OS_ReadC
+       mov     r1, r0
+       swi     X(Hourglass_On)
+       mov     r0, r1
+       b       grub_console_convert
+
+FUNCTION(grub_console_checkkey)
+       swi     X(Hourglass_Smash)
+       mov     r0, #129        @ Read key with time limit
+       mov     r1, #0          @ Timeout low byte
+       mov     r2, #0          @ Timeout high byte ( < 0x80 )
+       swi     OS_Byte
+       teq     r2, #0          @ r2 = 0 if key read
+       movne   r1, #-1         @ r1 = key if read
+       swi     X(Hourglass_On)
+       mov     r0, r1
+       b       grub_console_convert
+
+FUNCTION(grub_console_get_and_set_cursor_key_state)
+       mov     r1, a1
+       mov     r0, #4
+       swi     OS_Byte
+       mov     a1, r1
+       mov     pc, lr
+
+FUNCTION(grub_console_in_taskwindow)
+       mov     r0, #0
+       swi     X(TaskWindow_TaskInfo)
+       movvs   r0, #0
+       mov     pc, lr
+
+FUNCTION(grub_console_getwh)
+       sub     sp, sp, #20
+       adr     r0, vdu_variables
+       mov     r1, sp
+       swi     OS_ReadVduVariables
+       ldmia   sp!, {a1-a4, ip}
+       sub     a1, a3, a1 @ width  = right - left
+       add     a1, a1, #1 @          + 1
+       sub     a2, a2, a4 @ height = bottom - top
+       add     a2, a2, #1 @          + 1
+       orr     a1, a2, a1, lsl #8 @ result = (width << 8) | height
+       mov     pc, lr
+
+vdu_variables:
+       .word   0x84, 0x85, 0x86, 0x87, -1
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x 
'*.orig' -x '*.rej' -x CVS grub2-split/term/arm/RISC_OS/console.c 
grub2-RISC_OS/term/arm/RISC_OS/console.c
--- grub2-split/term/arm/RISC_OS/console.c      1970-01-01 01:00:00.000000000 
+0100
+++ grub2-RISC_OS/term/arm/RISC_OS/console.c    2005-11-18 18:54:08.000000000 
+0000
@@ -0,0 +1,190 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2002,2003  Free Software Foundation, Inc.
+ *
+ *  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.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <grub/arm/RISC_OS/console.h>
+#include <grub/term.h>
+#include <grub/types.h>
+
+
+static void
+grub_console_putchar (grub_uint32_t c)
+{
+  /* Map some unicode characters to the RISC OS font, if possible.  */
+  switch (c)
+    {
+    case 0x2190:               /* left arrow */
+      c = 0x1b;
+      break;
+    case 0x2191:               /* up arrow */
+      c = 0x18;
+      break;
+    case 0x2192:               /* right arrow */
+      c = 0x1a;
+      break;
+    case 0x2193:               /* down arrow */
+      c = 0x19;
+      break;
+    case 0x2501:               /* horizontal line */
+      c = '-';
+      break;
+    case 0x2503:               /* vertical line */
+      c = '|';
+      break;
+    case 0x250F:               /* upper-left corner */
+      c = '+';
+      break;
+    case 0x2513:               /* upper-right corner */
+      c = '+';
+      break;
+    case 0x2517:               /* lower-left corner */
+      c = '+';
+      break;
+    case 0x251B:               /* lower-right corner */
+      c = '+';
+      break;
+
+    default:
+      //c = '?';
+      break;
+
+    }
+  if (c > 0x100)
+    c = '?';
+
+  grub_console_real_putchar (c);
+}
+
+static void
+grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y)
+{
+  grub_console_real_putchar (31);
+  grub_console_real_putchar (x);
+  grub_console_real_putchar (y);
+}
+
+static void
+grub_console_cls (void)
+{
+  grub_console_real_putchar (12);
+}
+
+static void
+nulls (void)
+{
+  for (int i = 8; i != 0; --i)
+    {
+      grub_console_real_putchar (0);
+    }
+}
+
+static void
+grub_console_setcursor (int on)
+{
+  grub_console_real_putchar (23);
+  grub_console_real_putchar (1);
+  grub_console_real_putchar (on);
+  nulls ();
+}
+
+static grub_term_color_state colourstate;
+
+static void
+grub_console_setcolourstate (grub_term_color_state state)
+{
+  state &= 2;
+  if (colourstate == state)
+    return;
+  colourstate = state;
+  grub_console_real_putchar (23);
+  grub_console_real_putchar (17);
+  grub_console_real_putchar (5);
+  nulls ();
+}
+
+static int old_cursor_key_state;
+
+static grub_err_t
+grub_console_init (void)
+{
+  old_cursor_key_state = grub_console_get_and_set_cursor_key_state (1);
+  return GRUB_ERR_NONE;
+}
+
+static grub_err_t
+grub_console_fini (void)
+{
+  grub_console_get_and_set_cursor_key_state (old_cursor_key_state);
+  return GRUB_ERR_NONE;
+}
+
+int
+grub_console_convert (int c)
+{
+  switch (c)
+    {
+    case 136:
+      c = 2;
+      break;
+    case 137:
+      c = 6;
+      break;
+    case 138:
+      c = 14;
+      break;
+    case 139:
+      c = 16;
+      break;
+    }
+  return c;
+}
+
+static grub_ssize_t
+grub_console_getcharwidth (grub_uint32_t c)
+{
+  (void) c;
+  return 1;
+}
+
+static struct grub_term grub_console_term = {
+  .name = "console",
+  .init = grub_console_init,
+  .fini = grub_console_fini,
+  .putchar = grub_console_putchar,
+  .checkkey = grub_console_checkkey,
+  .getkey = grub_console_getkey,
+  .getwh = grub_console_getwh,
+  .getxy = grub_console_getxy,
+  .gotoxy = grub_console_gotoxy,
+  .cls = grub_console_cls,
+  .setcolorstate = grub_console_setcolourstate,
+  .setcolor = 0,
+  .setcursor = grub_console_setcursor,
+  .flags = 0,
+  .next = 0,
+  .getcharwidth = grub_console_getcharwidth,
+};
+
+void
+grub_console_initialise (void)
+{
+  if (grub_console_in_taskwindow ())
+    grub_console_term.flags = GRUB_TERM_DUMB;
+  grub_term_register (&grub_console_term);
+  grub_term_set_current (&grub_console_term);
+}

Attachment: pgpBA65Z06c1s.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]