[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
I'm back (RISC OS port)
From: |
Timothy Baldwin |
Subject: |
I'm back (RISC OS port) |
Date: |
Sat, 10 Sep 2005 15:58:55 +0100 |
User-agent: |
KMail/1.8.1 |
Firstly I apologise for my absence due to a personal reason, I'd rather not
into in this list, other than to say that my first full time job is only part
of the reason.
Anyhow here is the first part of my port of GRUB to RISC OS on ARM. RISC OS is
a ROM-resident, co-operative multitasking operating system. "risc os" or
"riscos" is an entirely different unix-like OS, so incorrect capitalisation
of RISC OS may cause confusion and an unwelcome response. (trademark
lawsuits?)
"@" marks starts of the comment in ARM GNU As syntax, so include/grub/symbol.h
has been changed use double quotes instead.
The declaration in for statements feature of C99 has been used, so -std=gnu99
is passed to gcc to enable this. This is supported from at least gcc 3.0.4,
according to http://gcc.gnu.org/gcc-3.0/c99status.html.
The file include/grub/arm/RISC_OS/swis.h is a list of RISC OS system call
names and numbers, and is only included by RISC OS specific assembly files.
It therefore seems reasonable to use not to use the GRUB_ prefix, which would
suggest the system calls were implemented by GRUB, which is not the case.
RISC OS files have a 12-bit filetype attribute, this is represented on UNIX
filesystems by suffixing the filename with a comma follow by the filetype in
lowercase hex. When executing a directory under RISC OS the file or directory
called "!Run" within it is executed, furthermore if a directory's name begins
with "!", double-clicking on it will execute it. This explains the filename
boot/arm/RISC_OS/!Run,feb.
Because keeping 4 (or more) copies of the rules to compile most modules is
getting rather silly I have split them of into an new file conf/common.mk.
This patch does not alter the code for other platforms however.
This patch also fixes a bug in genmk.rb which uses the leafname rather the
full path for naming command and fs list files.
The file include/arm/libgcc.h exports several libgcc routines needed by
modules.
Module loading is supported, but embedding modules isn't. There is a GRUB
filesystem to provide access to the RISC OS filing system API. Using this the
default prefix is hardwired to "(host)/<Grub$Dir>", where "Grub$Dir" is a
RISC OS environment variable.
There is a normal mode command, system, which passes commands to the RISC OS
command line interpreter, via the C Library system() function. GRUB may be
quit using the command "system chain:quit", or by pressing Ctrl-Q which
raises SIGINT (as opposed to the RISC OS default of Escape).
Due to the requirement for ELF, GRUB can not be compiled with any released
RISC OS targeting compiler. GCC targeting arm-linux-gnu works fine.
GRUB uses the RISC OS shared C library, which is compiled to APCS26 or APCS32
ABIs with chunked stacks, GRUB is compiled to APCS32 without a chunked stack.
This means the C Library can not call functions in GRUB written in C, and
that the -fixed-reg-r10 gcc option is needed to protect the stack limit
register. The -mapcs-frame and -mpoke-function-name options are needed for
stack backtraces to work.
All C library functions have their name prefixed with grub_RISC_OS_, is this a
good idea? Or should the prefix be dropped to be consistent with other
platforms (currently grub-emu)?
Please note that division and the current implementation of pointer to nested
functions refer to their parents local variables are slow on ARM, requiring a
system call and an instruction cache invalidation.
Currently it does not shutdown the users session before booting.
Appended here is the first patch, including disk support and everything needed
to get to normal mode. It is also at:
http://www.majoroak.f2s.com/tim/grub/patches/grub2-patch3.diff
Extra diffs to my tree:
http://www.majoroak.f2s.com/tim/grub/patches/grub2-patch3-remainder.diff
sha1sums of the above files:
d12867e6b2f6f82c51b2e11fa8d3c502757db251 grub2-patch3.diff
a0f5ef9e197c41a9b806043a414175bf46f87699 grub2-patch3-remainder.diff
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x
'*.orig' -x CVS grub2-submitted/boot/arm/RISC_OS/!Run,feb
grub2-split/boot/arm/RISC_OS/!Run,feb
--- grub2-submitted/boot/arm/RISC_OS/!Run,feb 1970-01-01 01:00:00.000000000
+0100
+++ grub2-split/boot/arm/RISC_OS/!Run,feb 2005-09-09 17:19:39.000000000
+0100
@@ -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 CVS grub2-submitted/commands/arm/RISC_OS/system.c
grub2-split/commands/arm/RISC_OS/system.c
--- grub2-submitted/commands/arm/RISC_OS/system.c 1970-01-01
01:00:00.000000000 +0100
+++ grub2-split/commands/arm/RISC_OS/system.c 2005-09-09 17:19:39.000000000
+0100
@@ -0,0 +1,47 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 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/normal.h>
+#include <grub/dl.h>
+#include <grub/arg.h>
+#include <grub/arm/RISC_OS/misc.h>
+
+static grub_err_t
+grub_cmd_system (struct grub_arg_list *state, int argc, char **args)
+{
+ (void) state;
+ if (argc != 1)
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "one argument required");
+ if (grub_RISC_OS_system (args[0]))
+ return grub_RISC_OS_clib_error (GRUB_ERR_INVALID_COMMAND);
+ return GRUB_ERR_NONE;
+}
+
+GRUB_MOD_INIT
+{
+ (void) mod; /* To stop warning. */
+ grub_register_command ("system", grub_cmd_system,
+ GRUB_COMMAND_FLAG_BOTH, "system",
+ "Execute RISC OS command", 0);
+}
+
+GRUB_MOD_FINI
+{
+ grub_unregister_command ("system");
+}
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x
'*.orig' -x CVS grub2-submitted/conf/arm-RISC_OS.rmk
grub2-split/conf/arm-RISC_OS.rmk
--- grub2-submitted/conf/arm-RISC_OS.rmk 1970-01-01 01:00:00.000000000
+0100
+++ grub2-split/conf/arm-RISC_OS.rmk 2005-09-09 17:19:39.000000000 +0100
@@ -0,0 +1,71 @@
+# -*- 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/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 \
+ fs/arm/RISC_OS/hostfs.c fs/arm/RISC_OS/hostfs-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 \
+ 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 sys_RO.mod filecore.mod
+
+# For normal.mod.
+normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \
+ normal/completion.c normal/context.c normal/main.c \
+ normal/menu.c normal/menu_entry.c normal/misc.c \
+ normal/arm/setjmp.S
+normal_mod_CFLAGS = $(COMMON_CFLAGS)
+normal_mod_ASFLAGS = $(COMMON_ASFLAGS)
+
+# For sys_RO.mod
+sys_RO_mod_SOURCES = commands/arm/RISC_OS/system.c
+sys_RO_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For filecore.mod
+filecore_mod_SOURCES = disk/arm/RISC_OS/filecore.c
disk/arm/RISC_OS/filecore-asm.S
+filecore_mod_CFLAGS = $(COMMON_CFLAGS)
+filecore_mod_ASFLAGS = $(COMMON_ASFLAGS)
+
+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 CVS grub2-submitted/conf/common.rmk grub2-split/conf/common.rmk
--- grub2-submitted/conf/common.rmk 1970-01-01 01:00:00.000000000 +0100
+++ grub2-split/conf/common.rmk 2005-09-09 17:19:39.000000000 +0100
@@ -0,0 +1,111 @@
+pkgdata_MODULES += fat.mod ufs.mod ext2.mod minix.mod \
+ hfs.mod jfs.mod hello.mod font.mod boot.mod \
+ ls.mod cmp.mod cat.mod terminal.mod fshelp.mod \
+ amiga.mod apple.mod pc.mod sun.mod loopback.mod \
+ help.mod default.mod timeout.mod configfile.mod \
+ gzio.mod search.mod
+
+# For fshelp.mod.
+fshelp_mod_SOURCES = fs/fshelp.c
+fshelp_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For fat.mod.
+fat_mod_SOURCES = fs/fat.c
+fat_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For ext2.mod.
+ext2_mod_SOURCES = fs/ext2.c
+ext2_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For ufs.mod.
+ufs_mod_SOURCES = fs/ufs.c
+ufs_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For minix.mod.
+minix_mod_SOURCES = fs/minix.c
+minix_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For hfs.mod.
+hfs_mod_SOURCES = fs/hfs.c
+hfs_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For jfs.mod.
+jfs_mod_SOURCES = fs/jfs.c
+jfs_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For iso9660.mod.
+iso9660_mod_SOURCES = fs/iso9660.c
+iso9660_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For hello.mod.
+hello_mod_SOURCES = hello/hello.c
+hello_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For boot.mod.
+boot_mod_SOURCES = commands/boot.c
+boot_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For terminal.mod.
+terminal_mod_SOURCES = commands/terminal.c
+terminal_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For ls.mod.
+ls_mod_SOURCES = commands/ls.c
+ls_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For cmp.mod.
+cmp_mod_SOURCES = commands/cmp.c
+cmp_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For cat.mod.
+cat_mod_SOURCES = commands/cat.c
+cat_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For help.mod.
+help_mod_SOURCES = commands/help.c
+help_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For font.mod.
+font_mod_SOURCES = font/manager.c
+font_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For amiga.mod
+amiga_mod_SOURCES = partmap/amiga.c
+amiga_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For apple.mod
+apple_mod_SOURCES = partmap/apple.c
+apple_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For pc.mod
+pc_mod_SOURCES = partmap/pc.c
+pc_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For sun.mod
+sun_mod_SOURCES = partmap/sun.c
+sun_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For loopback.mod
+loopback_mod_SOURCES = disk/loopback.c
+loopback_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For default.mod
+default_mod_SOURCES = commands/default.c
+default_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For timeout.mod
+timeout_mod_SOURCES = commands/timeout.c
+timeout_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For configfile.mod
+configfile_mod_SOURCES = commands/configfile.c
+configfile_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For search.mod.
+search_mod_SOURCES = commands/search.c
+search_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For gzio.mod.
+gzio_mod_SOURCES = io/gzio.c
+gzio_mod_CFLAGS = $(COMMON_CFLAGS)
+
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x
'*.orig' -x CVS grub2-submitted/configure.ac grub2-split/configure.ac
--- grub2-submitted/configure.ac 2005-08-26 09:04:11.000000000 +0100
+++ grub2-split/configure.ac 2005-09-09 18:42:58.000000000 +0100
@@ -23,6 +23,7 @@ AC_CANONICAL_HOST
case "$host_cpu" in
i[[3456]]86) host_cpu=i386 ;;
powerpc) ;;
+ arm) ;;
sparc64) ;;
*) AC_MSG_ERROR([unsupported CPU type]) ;;
esac
@@ -30,6 +31,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
@@ -64,6 +66,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 CVS grub2-submitted/disk/arm/RISC_OS/filecore-asm.S
grub2-split/disk/arm/RISC_OS/filecore-asm.S
--- grub2-submitted/disk/arm/RISC_OS/filecore-asm.S 1970-01-01
01:00:00.000000000 +0100
+++ grub2-split/disk/arm/RISC_OS/filecore-asm.S 2005-09-09 17:19:39.000000000
+0100
@@ -0,0 +1,113 @@
+/* filecore-asm.S - Native RISC OS disk support */
+/*
+ * 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/symbol.h>
+#include <grub/arm/RISC_OS/swis.h>
+
+FUNCTION(grub_RISC_OS_filecore_iterate)
+ stmfd sp!, {r4, r5, r6, r7, r8, lr}
+ ldr ip, =grub_RISC_OS_filecore_base
+ ldr r7, [ip]
+ mov r6, r0
+ mov r1, #0
+ mov r2, #0
+1: mov r0, #12
+2: swi X(OS_Module)
+ movvs r0, #0
+ ldmvsfd sp!, {r4, r5, r6, r7, r8, pc}
+ teq r3, r7
+ bne 2b
+ teq r4, #0
+ beq 2b
+ stmfd sp!, {r1, r2}
+ ldr r8, [r4]
+ swi FileCore_Drives
+ mov r0, r6
+ mov r3, r5
+ bl grub_RISC_OS_filecore_iterate2
+ teq r0, #0
+ ldmfd sp!, {r1, r2}
+ beq 1b
+ ldmfd sp!, {r4, r5, r6, r7, r8, pc}
+
+FUNCTION(grub_RISC_OS_filecore_discop64)
+ stmfd sp!, {r4, r5, r8, lr}
+ mov r4, r0
+ ldr r5, [sp, #20]
+ ldr r8, [sp, #16]
+ swi X(FileCore_DiscOp64)
+ b 1f
+
+FUNCTION(grub_RISC_OS_filecore_discop)
+ stmfd sp!, {r4, r5, r8, lr}
+ mov r4, r0
+ ldr r8, [sp, #16]
+ swi X(FileCore_DiscOp)
+ b 1f
+
+FUNCTION(grub_RISC_OS_filecore_sectorop)
+ stmfd sp!, {r4, r5, r8, lr}
+ mov r4, r0
+ ldr r8, [sp, #16]
+ swi X(FileCore_SectorOp)
+1: movvc r0, #0
+ ldmfd sp!, {r4, r5, r8, pc}
+
+filecore:
+ .asciz "FileCore"
+ .align
+
+FUNCTION(grub_RISC_OS_filecore_get_base)
+ stmfd sp!, {r4, r5, lr}
+ mov r0, #18
+ adr r1, filecore
+ swi X(OS_Module)
+ movvs r0, #0
+ movvc r0, r3
+ ldmfd sp!, {r4, r5, pc}
+
+FUNCTION(grub_RISC_OS_get_private_word)
+ stmfd sp!, {r4, r5, lr}
+ mov r1, r0
+ mov r0, #18
+ swi X(OS_Module)
+ movvc r0, r4
+ movvs r0, #0
+ ldmfd sp!, {r4, r5, pc}
+
+FUNCTION(grub_RISC_OS_filecore_get_flags)
+ mov ip, r8
+ mov r8, #0
+ mov r0, #6
+ swi X(FileCore_MiscOp)
+ mov r8, ip
+ ldrvc r0, [r0]
+ movvs r0, #0
+ mov pc, lr
+
+FUNCTION(grub_RISC_OS_get_disc_record)
+ add r2, r2, #48
+ stmfd sp!, {r2, r8, lr}
+ mov r8, r0
+ mov r0, sp
+ swi X(FileCore_DescribeDisc)
+ movvc r0, #0
+ ldmfd sp!, {r2, r8, pc}
+
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x
'*.orig' -x CVS grub2-submitted/disk/arm/RISC_OS/filecore.c
grub2-split/disk/arm/RISC_OS/filecore.c
--- grub2-submitted/disk/arm/RISC_OS/filecore.c 1970-01-01 01:00:00.000000000
+0100
+++ grub2-split/disk/arm/RISC_OS/filecore.c 2005-09-09 17:19:39.000000000
+0100
@@ -0,0 +1,288 @@
+/* filecore.c - Native RISC OS disk support */
+/*
+ * 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/filecore.h>
+#include <grub/arm/RISC_OS/misc.h>
+
+#include <grub/disk.h>
+#include <grub/mm.h>
+#include <grub/misc.h>
+#include <grub/dl.h>
+
+#define FILECORE_USES_SECTORS (1 << 9) // PRM 5a-263
+
+struct grub_RISC_OS_discop64_address
+{
+ int drive;
+ grub_uint64_t byte;
+};
+
+
+
+
+extern grub_RISC_OS_error_t
+grub_RISC_OS_filecore_discop64 (unsigned long size,
+ int direction,
+ struct grub_RISC_OS_discop64_address
+ *address, void *buffer,
+ void *private_word,
+ struct grub_RISC_OS_disc_record *disc_record);
+
+extern grub_RISC_OS_error_t
+grub_RISC_OS_filecore_discop (unsigned long size,
+ int direction,
+ unsigned long address,
+ void *buffer, void *private_word);
+
+extern grub_RISC_OS_error_t
+grub_RISC_OS_filecore_sectorop (unsigned long size,
+ int direction,
+ unsigned long address,
+ void *buffer, void *private_word);
+
+extern int grub_RISC_OS_filecore_iterate (int (*hook) (const char *name));
+
+extern int grub_RISC_OS_filecore_iterate2 (int (*hook) (const char *name),
+ int floppies, int harddiscs,
+ const char *fs_name);
+
+extern grub_RISC_OS_error_t
+grub_RISC_OS_get_disc_record (void *pw,
+ struct grub_RISC_OS_disc_record *, int drive);
+
+
+extern grub_uint32_t grub_RISC_OS_filecore_get_flags (void *pw);
+extern void **grub_RISC_OS_get_private_word (const char *);
+extern void *grub_RISC_OS_filecore_get_base (void);
+extern void grub_RISC_OS_filecore_init (void);
+
+void *grub_RISC_OS_filecore_base;
+
+static int use_discop64;
+static grub_dl_t my_mod;
+
+static grub_err_t
+filecore_open (const char *name, struct grub_disk *disk)
+{
+ grub_dprintf ("filecore", "open name=%s\n", name);
+
+ grub_RISC_OS_error_t error;
+ grub_RISC_OS_filecore_data *data;
+ char *module_name = __builtin_alloca (grub_strlen (name) + 10);
+ char *p = grub_stpcpy (module_name, "FileCore%");
+
+ data = grub_malloc (sizeof (*data));
+ if (!data)
+ return grub_errno;
+
+ data->name = grub_strdup (name);
+ if (!data->name)
+ goto fail1;
+
+ while (*name && *name != ':')
+ *p++ = *name++;
+ *p = 0;
+
+ while (*name == ':')
+ ++name;
+ if (*name < '0' || *name > '9')
+ {
+ grub_errno = grub_error (GRUB_ERR_UNKNOWN_DEVICE, "parse error");
+ goto fail;
+ }
+ data->drive = *name - '0';;
+
+ grub_dprintf ("filecore", "before get private word\n");
+ disk->has_partitions = data->drive >= 4
+ || grub_memcmp (data->name, "ADFS:", 5);
+ data->private_word = *grub_RISC_OS_get_private_word (module_name);
+ if (!data->private_word)
+ {
+ grub_error(GRUB_ERR_UNKNOWN_DEVICE, "Not a filecore disk");
+ goto fail;
+ }
+
+ grub_dprintf ("filecore", "before get flags\n");
+ data->flags = grub_RISC_OS_filecore_get_flags (data->private_word);
+ disk->data = data;
+
+ grub_dprintf ("filecore", "before get disc record\n");
+ grub_memset (&data->disc_record, 0,
+ sizeof (struct grub_RISC_OS_disc_record));
+ error =
+ grub_RISC_OS_get_disc_record (data->private_word, &data->disc_record,
+ data->drive);
+ if (error)
+ {
+ grub_RISC_OS_error_convert (error, GRUB_ERR_UNKNOWN_DEVICE);
+ goto fail;
+ }
+
+ disk->total_sectors =
+ ((((grub_uint64_t) data->disc_record.disc_size2) << 32) | data->
+ disc_record.disc_size) >> data->disc_record.log2secsize;
+ disk->id = (unsigned) (data->private_word) * 2 + data->drive;
+
+ grub_dl_ref (my_mod);
+ grub_dprintf ("filecore", "open succesful\n");
+ return GRUB_ERR_NONE;
+
+fail:
+ grub_free (data->name);
+fail1:
+ grub_free (data);
+ return grub_errno;
+}
+
+static void
+filecore_close (grub_disk_t disk)
+{
+ grub_free (((grub_RISC_OS_filecore_data *) disk->data)->name);
+ grub_free (disk->data);
+ grub_dl_unref (my_mod);
+}
+
+int
+grub_RISC_OS_filecore_iterate2 (int (*hook) (const char *name), int floppies,
+ int harddiscs, const char *fs_name)
+{
+ // FIXME: Support RISC OS 5?
+ grub_dprintf ("filecore", "iterate2 fs_name=%s\n", fs_name);
+
+ if (grub_strcmp (fs_name, "Base") == 0)
+ return 0;
+ char *name = __builtin_alloca (grub_strlen (fs_name) + 80);
+ char *num = grub_stpcpy (name, fs_name);
+ num[0] = ':';
+ num[1] = ':';
+ num[3] = 0;
+ for (int i = 0; i < floppies; ++i)
+ {
+ num[2] = '0' + i;
+ int r = hook (name);
+ if (r)
+ return r;
+ }
+ for (int i = 0; i < harddiscs; ++i)
+ {
+ num[2] = '4' + i;
+ int r = hook (name);
+ if (r)
+ return r;
+ }
+ return 0;
+}
+
+static grub_err_t
+filecore_access (grub_disk_t disk, unsigned long sector, unsigned long size,
+ void *buf, unsigned direction, grub_err_t errno)
+{
+ grub_dprintf ("filecore", "access\n");
+ grub_RISC_OS_filecore_data *data = disk->data;
+ grub_uint8_t log2secsize = data->disc_record.log2secsize;
+ size <<= log2secsize;
+ unsigned r1 = direction | ((unsigned) &data->disc_record << 6);
+ grub_RISC_OS_error_t e;
+
+ if (use_discop64 && sector < (0x8000000000000000ULL >> (log2secsize - 1)))
+ {
+ struct grub_RISC_OS_discop64_address address;
+ address.drive = data->drive;
+ address.byte = ((grub_uint64_t) sector) << log2secsize;
+ e = grub_RISC_OS_filecore_discop64 (size,
+ direction, &address, buf,
+ data->private_word,
+ &data->disc_record);
+ }
+
+
+ else if (data->flags & FILECORE_USES_SECTORS && sector < 0x20000000U)
+ {
+ e = grub_RISC_OS_filecore_sectorop (size,
+ r1,
+ sector | (data->drive << 29),
+ buf, data->private_word);
+
+ }
+ else if (sector < (0x20000000U >> log2secsize))
+ {
+ e = grub_RISC_OS_filecore_discop (size,
+ r1,
+ (sector << log2secsize)
+ | (data->drive << 29),
+ buf, data->private_word);
+
+ }
+ else
+ {
+ return grub_error (errno,
+ "sector number %d too large for avaiable APIs",
+ sector);
+ }
+
+ if (e)
+ return grub_RISC_OS_error_convert (e, errno);
+
+ return GRUB_ERR_NONE;
+}
+
+static grub_err_t
+filecore_read (grub_disk_t disk, unsigned long sector, unsigned long size,
+ char *buf)
+{
+ return filecore_access (disk, sector, size, buf, 1, GRUB_ERR_READ_ERROR);
+}
+
+static grub_err_t
+filecore_write (grub_disk_t disk, unsigned long sector, unsigned long size,
+ const char *buf)
+{
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+ "Writing to filecore discs disabled - edit
disk/arm/RISC_OS/filecore.c to enable.");
+ // filecore_access(disk, sector, size, (void *)buf, 2, GRUB_ERR_WRITE_ERROR);
+}
+
+
+
+static struct grub_disk_dev filecore_driver = {
+ .name = "FileCore",
+ .id = GRUB_DISK_DEVICE_FILECORE_ID,
+ .iterate = grub_RISC_OS_filecore_iterate,
+ .open = filecore_open,
+ .close = filecore_close,
+ .read = filecore_read,
+ .write = filecore_write,
+ .next = 0
+};
+
+
+
+GRUB_MOD_INIT
+{
+ my_mod = mod;
+ grub_RISC_OS_filecore_base = grub_RISC_OS_filecore_get_base ();
+ use_discop64 = grub_RISC_OS_get_swi_number ("FileCore_DiscOp64");
+ grub_disk_dev_register (&filecore_driver);
+}
+
+GRUB_MOD_FINI
+{
+ grub_disk_dev_unregister (&filecore_driver);
+}
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x
'*.orig' -x CVS grub2-submitted/fs/arm/RISC_OS/hostfs-asm.S
grub2-split/fs/arm/RISC_OS/hostfs-asm.S
--- grub2-submitted/fs/arm/RISC_OS/hostfs-asm.S 1970-01-01 01:00:00.000000000
+0100
+++ grub2-split/fs/arm/RISC_OS/hostfs-asm.S 2005-09-09 17:19:39.000000000
+0100
@@ -0,0 +1,39 @@
+/* hostfs-asm.S - Native RISC OS filesystem support */
+/*
+ * 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/symbol.h>
+#include <grub/arm/RISC_OS/swis.h>
+
+FUNCTION(grub_RISC_OS_host_read_dir_entries)
+ stmfd sp!, {r4-r6, lr}
+ mov ip, a4
+ mov r5, a3
+ mov r2, a1
+ mov r0, #10
+ mov r3, #100
+ ldr r4, [ip]
+ mov r6, #0
+ swi X(OS_GBPB)
+ movvc r0, #0
+ str r4, [ip]
+ ldr ip, [sp, #16]
+ str r3, [ip]
+ ldmfd sp!, {r4-r6, pc}
+
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x
'*.orig' -x CVS grub2-submitted/fs/arm/RISC_OS/hostfs.c
grub2-split/fs/arm/RISC_OS/hostfs.c
--- grub2-submitted/fs/arm/RISC_OS/hostfs.c 1970-01-01 01:00:00.000000000
+0100
+++ grub2-split/fs/arm/RISC_OS/hostfs.c 2005-09-09 17:19:39.000000000 +0100
@@ -0,0 +1,304 @@
+/* hostfs.c - Native RISC OS filesystem support */
+/*
+ * 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/file.h>
+#include <grub/arm/RISC_OS/filecore.h>
+#include <grub/disk.h>
+#include <grub/mm.h>
+#include <grub/misc.h>
+#include <grub/arm/RISC_OS/misc.h>
+
+
+extern grub_RISC_OS_error_t
+grub_RISC_OS_host_read_dir_entries (void *buffer, char *dir,
+ int buffer_size, int *pointer,
+ int *count);
+
+static char *
+convert_path (grub_device_t device, const char *src)
+{
+ const char *dname;
+ int dname_len;
+ char *hname, *dst;
+
+ grub_dprintf("hostfs", "GRUB: %s\n", src);
+
+ if (device->disk->dev->id == GRUB_DISK_DEVICE_FILECORE_ID)
+ {
+ dname = ((grub_RISC_OS_filecore_data *) device->disk->data)->name;
+ dname_len = grub_strlen (dname) + 4;
+ }
+ else if (device->disk->dev->id == GRUB_DISK_DEVICE_HOSTFS_ID)
+ {
+ dname = 0;
+ dname_len = 1;
+ }
+ else
+ {
+ grub_error (GRUB_ERR_BAD_FS, "Not a filecore disc");
+ return 0;
+ }
+
+ hname = grub_malloc (dname_len + grub_strlen (src));
+ if (!hname)
+ return 0;
+
+ dst = hname;
+
+ /* If disk name provided begin with "<disc_name>.$" */
+ if (dname)
+ {
+ dst = grub_stpcpy (dst, dname);
+ *dst++ = '.';
+ *dst++ = '$';
+ }
+
+ while (1)
+ {
+
+ /* Read next non-"/" character. */
+ while (*src == '/')
+ src++;
+
+ /* Test for end of filename. */
+ if (*src == 0)
+ break;
+
+ /* Test for current directory "." */
+ if (src[0] == '.' && (src[1] == '/' || !src[1]))
+ {
+ src += 2;
+ continue;
+ }
+
+ /* Test for parent directory ".." */
+ if (src[0] == '.' && src[1] == '.' && (src[2] == '/' || !src[2]))
+ {
+ *dst++ = '^';
+ *dst++ = '.';
+ continue;
+ }
+
+ /* Copy filename compment, dropping everything after ",". */
+ while (*src && *src != '/' && *src != ',')
+ {
+ char c = *src++;
+
+ /* Convert "." to "/". */
+ if (c == '.')
+ c = '/';
+
+ *dst++ = c;
+ }
+
+ /* Skip to next componment. */
+ while (*src && *src != '/')
+ src++;
+ *dst++ = '.';
+ }
+
+ /* If path empty, use current directory ("@"). */
+ if (dst == hname)
+ *dst++ = '@';
+ else
+ dst--;
+
+ *dst = 0;
+ grub_dprintf("hostfs", "RISC OS: %s\n", hname);
+ return hname;
+}
+
+static grub_err_t
+host_open (struct grub_file *file, const char *gname)
+{
+ grub_RISC_OS_FILE *fp;
+
+ char *hname = convert_path (file->device, gname);
+ if (!hname)
+ return grub_errno;
+
+ fp = grub_RISC_OS_fopen (hname, "rb");
+ if (!fp)
+ return grub_RISC_OS_clib_error (GRUB_ERR_FILE_OPEN_ERROR);
+
+ if (grub_RISC_OS_fseek (fp, 0, SEEK_END))
+ {
+ grub_err_t err = grub_RISC_OS_clib_error (GRUB_ERR_FILE_OPEN_ERROR);
+ grub_RISC_OS_fclose (fp);
+ return err;
+ }
+ file->data = fp;
+ file->size = grub_RISC_OS_ftell (fp);
+ return GRUB_ERR_NONE;
+}
+
+static grub_err_t
+host_close (struct grub_file *file)
+{
+ if (grub_RISC_OS_fclose (file->data))
+ return grub_RISC_OS_clib_error (GRUB_ERR_FILE_CLOSE_ERROR);
+
+ return GRUB_ERR_NONE;
+}
+
+static grub_ssize_t
+host_read (grub_file_t file, char *buf, grub_ssize_t len)
+{
+ if (grub_RISC_OS_fseek (file->data, file->offset, SEEK_SET))
+ {
+ grub_RISC_OS_clib_error (GRUB_ERR_FILE_READ_ERROR);
+ return 0;
+ }
+
+ grub_RISC_OS_clib_errno = 0;
+ grub_ssize_t read = grub_RISC_OS_fread (buf, 1, len, file->data);
+
+ if (grub_RISC_OS_clib_errno)
+ grub_RISC_OS_clib_error (GRUB_ERR_FILE_READ_ERROR);
+ return read;
+}
+
+struct dirent
+{
+ unsigned load, exec, length;
+ int attributes, type;
+ char name[];
+};
+
+static grub_err_t
+host_dir (grub_device_t device, const char *gname,
+ int (*hook) (const char *filename, int dir))
+{
+ char *hname, buffer[1024];
+ grub_RISC_OS_error_t err;
+ int count, pointer = 0;
+ hname = convert_path (device, gname);
+ if (!hname)
+ return grub_errno;
+
+ while (pointer != -1)
+ {
+ err =
+ grub_RISC_OS_host_read_dir_entries (buffer, hname, sizeof (buffer),
+ &pointer, &count);
+ if (err)
+ {
+ grub_free (hname);
+ return grub_RISC_OS_error_convert (err, GRUB_ERR_DIR_READ_ERROR);
+ }
+ for (char *i = buffer; count; --count)
+ {
+ struct dirent *d = (struct dirent *) i;
+ i = d->name;
+ do
+ {
+ if (*i == '/')
+ *i = '.';
+ }
+ while (*i++);
+ i = (char *) grub_align (4, (grub_addr_t) i);
+
+ if (hook (d->name, d->type >> 1))
+ goto out;
+ }
+ }
+out:
+ grub_free (hname);
+ return GRUB_ERR_NONE;
+}
+
+static grub_err_t
+host_label (grub_device_t device, char **label)
+{
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+ "Sorry, not implemented yet");
+}
+
+static struct grub_fs grub_host_fs = {
+ .name = "RISC OS host",
+ .dir = host_dir,
+ .open = host_open,
+ .read = host_read,
+ .close = host_close,
+ .label = host_label,
+ .next = 0
+};
+
+
+static grub_err_t
+dummy_open (const char *name, struct grub_disk *disk)
+{
+ if (grub_memcmp (name, "host", 4) != 0)
+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Not hostfs");
+ disk->total_sectors = 2880;
+ return GRUB_ERR_NONE;
+}
+
+static void
+dummy_close (grub_disk_t disk)
+{
+ (void) disk;
+ return;
+}
+
+static grub_err_t
+dummy_read (grub_disk_t disk, unsigned long sector, unsigned long size,
+ char *buf)
+{
+ (void) disk;
+ (void) sector;
+ grub_memset (buf, 0, size * 512);
+ return GRUB_ERR_NONE;
+}
+
+static grub_err_t
+dummy_write (grub_disk_t disk, unsigned long sector, unsigned long size,
+ const char *buf)
+{
+ (void) disk;
+ (void) sector;
+ (void) size;
+ (void) buf;
+ return GRUB_ERR_NONE;
+}
+
+static int
+dummy_iterate (int (*hook) (const char *name))
+{
+ return hook ("host");
+}
+
+struct grub_disk_dev dummy_driver = {
+ .name = "FileSwitch",
+ .id = GRUB_DISK_DEVICE_HOSTFS_ID,
+ .iterate = dummy_iterate,
+ .open = dummy_open,
+ .close = dummy_close,
+ .read = dummy_read,
+ .write = dummy_write,
+ .next = 0
+};
+
+void
+grub_RISC_OS_host_fs_init (void)
+{
+ grub_disk_dev_register (&dummy_driver);
+ grub_fs_register (&grub_host_fs);
+}
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x
'*.orig' -x CVS grub2-submitted/genmk.rb grub2-split/genmk.rb
--- grub2-submitted/genmk.rb 2005-08-07 22:05:41.000000000 +0100
+++ grub2-split/genmk.rb 2005-09-09 17:19:39.000000000 +0100
@@ -141,8 +141,8 @@ UNDSYMFILES += #{undsym}
" + objs.collect_with_index do |obj, i|
src = sources[i]
fake_obj = File.basename(src).suffix('o')
- command = 'cmd-' + fake_obj.suffix('lst')
- fs = 'fs-' + fake_obj.suffix('lst')
+ command = 'cmd-' + obj.suffix('lst')
+ fs = 'fs-' + obj.suffix('lst')
dep = deps[i]
flag = if /\.c$/ =~ src then 'CFLAGS' else 'ASFLAGS' end
dir = File.dirname(src)
@@ -314,7 +314,7 @@ while l = gets
unless cont
s.gsub!(/\\\n/, ' ')
- if /^([a-zA-Z0-9_]+)\s*=\s*(.*?)\s*$/ =~ s
+ if /^([a-zA-Z0-9_]+)\s*\+?=\s*(.*?)\s*$/ =~ s
var, args = $1, $2
if var =~ /^([a-zA-Z0-9_]+)_([A-Z]+)$/
@@ -367,14 +367,3 @@ while l = gets
end
-puts "CLEANFILES += moddep.lst command.lst fs.lst"
-puts "pkgdata_DATA += moddep.lst command.lst fs.lst"
-puts "moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep"
-puts " cat $(DEFSYMFILES) /dev/null | ./genmoddep $(UNDSYMFILES) > $@ \\"
-puts " || (rm -f $@; exit 1)"
-puts ""
-puts "command.lst: $(COMMANDFILES)"
-puts " cat $^ /dev/null | sort > $@"
-puts ""
-puts "fs.lst: $(FSFILES)"
-puts " cat $^ /dev/null | sort > $@"
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x
'*.orig' -x CVS grub2-submitted/include/grub/arm/libgcc.h
grub2-split/include/grub/arm/libgcc.h
--- grub2-submitted/include/grub/arm/libgcc.h 1970-01-01 01:00:00.000000000
+0100
+++ grub2-split/include/grub/arm/libgcc.h 2005-09-09 17:19:39.000000000
+0100
@@ -0,0 +1,30 @@
+/* libgcc.h - libgcc */
+/*
+ * 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.
+ */
+
+#include <grub/symbol.h>
+
+extern void EXPORT_FUNC (__clear_cache) (void *start, void *end);
+
+extern int EXPORT_VAR (__udivsi3);
+extern int EXPORT_VAR (__umodsi3);
+extern int EXPORT_VAR (__divsi3);
+extern int EXPORT_VAR (__modsi3);
+extern int EXPORT_VAR (__ashldi3);
+extern int EXPORT_VAR (__lshrdi3);
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x
'*.orig' -x CVS grub2-submitted/include/grub/arm/RISC_OS/console.h
grub2-split/include/grub/arm/RISC_OS/console.h
--- grub2-submitted/include/grub/arm/RISC_OS/console.h 1970-01-01
01:00:00.000000000 +0100
+++ grub2-split/include/grub/arm/RISC_OS/console.h 2005-09-09
17:19:39.000000000 +0100
@@ -0,0 +1,56 @@
+/*
+ * 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
+
+/* Define scan codes. */
+#define GRUB_CONSOLE_KEY_LEFT 0x4B00
+#define GRUB_CONSOLE_KEY_RIGHT 0x4D00
+#define GRUB_CONSOLE_KEY_UP 0x4800
+#define GRUB_CONSOLE_KEY_DOWN 0x5000
+#define GRUB_CONSOLE_KEY_IC 0x5200
+#define GRUB_CONSOLE_KEY_DC 0x5300
+#define GRUB_CONSOLE_KEY_BACKSPACE 0x0008
+#define GRUB_CONSOLE_KEY_HOME 0x4700
+#define GRUB_CONSOLE_KEY_END 0x4F00
+#define GRUB_CONSOLE_KEY_NPAGE 0x4900
+#define GRUB_CONSOLE_KEY_PPAGE 0x5100
+
+#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 CVS grub2-submitted/include/grub/arm/RISC_OS/filecore.h
grub2-split/include/grub/arm/RISC_OS/filecore.h
--- grub2-submitted/include/grub/arm/RISC_OS/filecore.h 1970-01-01
01:00:00.000000000 +0100
+++ grub2-split/include/grub/arm/RISC_OS/filecore.h 2005-09-09
17:19:39.000000000 +0100
@@ -0,0 +1,75 @@
+/*
+ * 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_MACHINE_FILECORE_HEADER
+#define GRUB_MACHINE_FILECORE_HEADER 1
+
+#include <grub/types.h>
+#include <grub/err.h>
+#include <grub/arm/RISC_OS/misc.h>
+
+struct grub_RISC_OS_disc_record
+{
+ grub_uint8_t log2secsize;
+ grub_uint8_t secspertrack;
+ grub_uint8_t heads;
+ grub_uint8_t density;
+ grub_uint8_t idlen;
+ grub_uint8_t log2bpmb;
+ grub_uint8_t skew;
+ grub_uint8_t bootoption;
+ grub_uint8_t lowsector; // In bits 0-5, flags in bits 6 and 7.
+ grub_uint8_t nzones;
+ grub_uint16_t zone_spare;
+ grub_uint32_t root_address;
+ grub_uint32_t disc_size; // Disc size in bytes.
+ grub_uint16_t cycle_id;
+ char disc_name[10];
+ grub_uint32_t disctype; // Yes, it is 32 bits!
+ grub_uint32_t disc_size2; // Most significant part of the disc size.
+ grub_uint8_t share_size;
+ grub_uint8_t big_flag;
+ grub_uint8_t reserved[22];
+};
+
+typedef struct
+{
+ void *private_word;
+ grub_uint32_t flags;
+ struct grub_RISC_OS_disc_record disc_record;
+ char *name;
+ grub_uint8_t drive;
+} grub_RISC_OS_filecore_data;
+
+#if 0
+typedef struct
+{
+ unsigned flags;
+ unsigned fs_number;
+ const char *fs_name;
+ unsigned other[3];
+} descriptor_block;
+#endif
+
+extern void grub_RISC_OS_host_fs_init (void);
+
+
+extern void *grub_RISC_OS_filecore_base;
+
+#endif /* ! GRUB_MACHINE_FILECORE_HEADER */
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x
'*.orig' -x CVS grub2-submitted/include/grub/arm/RISC_OS/misc.h
grub2-split/include/grub/arm/RISC_OS/misc.h
--- grub2-submitted/include/grub/arm/RISC_OS/misc.h 1970-01-01
01:00:00.000000000 +0100
+++ grub2-split/include/grub/arm/RISC_OS/misc.h 2005-09-09 17:19:39.000000000
+0100
@@ -0,0 +1,80 @@
+/*
+ * 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>
+//#include <grub/memory.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 CVS grub2-submitted/include/grub/arm/RISC_OS/swis.h
grub2-split/include/grub/arm/RISC_OS/swis.h
--- grub2-submitted/include/grub/arm/RISC_OS/swis.h 1970-01-01
01:00:00.000000000 +0100
+++ grub2-split/include/grub/arm/RISC_OS/swis.h 2005-09-09 17:19:39.000000000
+0100
@@ -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 CVS grub2-submitted/include/grub/arm/RISC_OS/time.h
grub2-split/include/grub/arm/RISC_OS/time.h
--- grub2-submitted/include/grub/arm/RISC_OS/time.h 1970-01-01
01:00:00.000000000 +0100
+++ grub2-split/include/grub/arm/RISC_OS/time.h 2005-09-09 17:19:39.000000000
+0100
@@ -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 CVS grub2-submitted/include/grub/arm/setjmp.h
grub2-split/include/grub/arm/setjmp.h
--- grub2-submitted/include/grub/arm/setjmp.h 1970-01-01 01:00:00.000000000
+0100
+++ grub2-split/include/grub/arm/setjmp.h 2005-09-09 17:19:39.000000000
+0100
@@ -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 CVS grub2-submitted/include/grub/arm/types.h
grub2-split/include/grub/arm/types.h
--- grub2-submitted/include/grub/arm/types.h 1970-01-01 01:00:00.000000000
+0100
+++ grub2-split/include/grub/arm/types.h 2005-09-09 17:19:39.000000000
+0100
@@ -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 (0x1000)
+
+/* 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 CVS grub2-submitted/include/grub/disk.h
grub2-split/include/grub/disk.h
--- grub2-submitted/include/grub/disk.h 2005-08-26 09:04:13.000000000 +0100
+++ grub2-split/include/grub/disk.h 2005-09-09 17:19:39.000000000 +0100
@@ -31,7 +31,9 @@ enum grub_disk_dev_id
{
GRUB_DISK_DEVICE_BIOSDISK_ID,
GRUB_DISK_DEVICE_OFDISK_ID,
- GRUB_DISK_DEVICE_LOOPBACK_ID
+ GRUB_DISK_DEVICE_LOOPBACK_ID,
+ GRUB_DISK_DEVICE_FILECORE_ID,
+ GRUB_DISK_DEVICE_HOSTFS_ID
};
struct grub_disk;
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x
'*.orig' -x CVS grub2-submitted/include/grub/err.h
grub2-split/include/grub/err.h
--- grub2-submitted/include/grub/err.h 2005-08-26 09:04:13.000000000 +0100
+++ grub2-split/include/grub/err.h 2005-09-09 17:19:39.000000000 +0100
@@ -1,7 +1,7 @@
/* err.h - error numbers and prototypes */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 2002,2003,2004 Free Software Foundation, Inc.
+ * Copyright (C) 2002,2003,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
@@ -51,6 +51,9 @@ typedef enum
GRUB_ERR_NOT_IMPLEMENTED_YET,
GRUB_ERR_SYMLINK_LOOP,
GRUB_ERR_BAD_GZIP_DATA,
+ GRUB_ERR_FILE_CLOSE_ERROR,
+ GRUB_ERR_FILE_OPEN_ERROR,
+ GRUB_ERR_DIR_READ_ERROR,
}
grub_err_t;
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x
'*.orig' -x CVS grub2-submitted/include/grub/misc.h
grub2-split/include/grub/misc.h
--- grub2-submitted/include/grub/misc.h 2005-08-26 09:04:13.000000000 +0100
+++ grub2-split/include/grub/misc.h 2005-09-09 17:19:39.000000000 +0100
@@ -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 CVS grub2-submitted/include/grub/symbol.h
grub2-split/include/grub/symbol.h
--- grub2-submitted/include/grub/symbol.h 2004-06-19 14:43:01.000000000
+0100
+++ grub2-split/include/grub/symbol.h 2005-09-09 17:19:39.000000000 +0100
@@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc.
+ * Copyright (C) 1999,2000,2001,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
@@ -29,8 +29,8 @@
# define EXT_C(sym) sym
#endif
-#define FUNCTION(x) .globl EXT_C(x) ; .type EXT_C(x), @function ; EXT_C(x):
-#define VARIABLE(x) .globl EXT_C(x) ; .type EXT_C(x), @object ; EXT_C(x):
+#define FUNCTION(x) .globl EXT_C(x) ; .type EXT_C(x), "function" ; EXT_C(x):
+#define VARIABLE(x) .globl EXT_C(x) ; .type EXT_C(x), "object" ; EXT_C(x):
/* Mark an exported symbol. */
#define EXPORT_FUNC(x) x
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x
'*.orig' -x CVS grub2-submitted/kern/arm/aif_header.lds
grub2-split/kern/arm/aif_header.lds
--- grub2-submitted/kern/arm/aif_header.lds 1970-01-01 01:00:00.000000000
+0100
+++ grub2-split/kern/arm/aif_header.lds 2005-09-09 17:19:39.000000000 +0100
@@ -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 CVS grub2-submitted/kern/arm/aif_header.S
grub2-split/kern/arm/aif_header.S
--- grub2-submitted/kern/arm/aif_header.S 1970-01-01 01:00:00.000000000
+0100
+++ grub2-split/kern/arm/aif_header.S 2005-09-09 17:19:39.000000000 +0100
@@ -0,0 +1,59 @@
+/* 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>
+
+ .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 CVS grub2-submitted/kern/arm/dl.c grub2-split/kern/arm/dl.c
--- grub2-submitted/kern/arm/dl.c 1970-01-01 01:00:00.000000000 +0100
+++ grub2-split/kern/arm/dl.c 2005-09-09 17:19:39.000000000 +0100
@@ -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 CVS grub2-submitted/kern/arm/RISC_OS/init.c
grub2-split/kern/arm/RISC_OS/init.c
--- grub2-submitted/kern/arm/RISC_OS/init.c 1970-01-01 01:00:00.000000000
+0100
+++ grub2-split/kern/arm/RISC_OS/init.c 2005-09-09 17:19:39.000000000 +0100
@@ -0,0 +1,103 @@
+/* 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/filecore.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>");
+ grub_RISC_OS_host_fs_init ();
+
+ 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);
+
+ /* Fixme - use long long? */
+ grub_sprintf (buf, "0x%08x", grub_arm_machine_serial_number[0]);
+ grub_env_set ("grub_arm_machine_serial_number_lo", buf);
+
+ grub_sprintf (buf, "0x%08x", grub_arm_machine_serial_number[1]);
+ grub_env_set ("grub_arm_machine_serial_number_hi", 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 CVS grub2-submitted/kern/arm/RISC_OS/misc.c
grub2-split/kern/arm/RISC_OS/misc.c
--- grub2-submitted/kern/arm/RISC_OS/misc.c 1970-01-01 01:00:00.000000000
+0100
+++ grub2-split/kern/arm/RISC_OS/misc.c 2005-09-09 17:19:39.000000000 +0100
@@ -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 CVS grub2-submitted/kern/arm/RISC_OS/startup.S
grub2-split/kern/arm/RISC_OS/startup.S
--- grub2-submitted/kern/arm/RISC_OS/startup.S 1970-01-01 01:00:00.000000000
+0100
+++ grub2-split/kern/arm/RISC_OS/startup.S 2005-09-09 23:15:16.000000000
+0100
@@ -0,0 +1,361 @@
+/* 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, #7
+ 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 "No Such SWI" and we are in 26-bit PC mode try APCS R,
+ @ otherwise raise error.
+ teq pc, pc
+ swieq OS_GenerateError
+ ldr r14, [r0]
+ eor r14, r14, #ERROR_NO_SUCH_SWI & 0xff00
+ teq r14, #ERROR_NO_SUCH_SWI & 0x00ff
+ 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
+
+FUNCTION(grub_RISC_OS__OS_ReadArgs)
+ swi OS_ReadArgs
+ 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
+
+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
+
+
+ @ Read word from pointer
+FUNCTION(grub_arm_read32)
+ swi OS_EnterOS
+ ldr a1, [a1]
+ swi X(OS_LeaveOS)
+ teqvsp pc, #0x01000000
+ nop
+ swivs X(OS_GenerateError)
+ mov pc, lr
+
+#if 0
+grub_RISC_OS_prereset_error:
+ swi X(OS_WriteS)
+ .asciz "Error from Service_PreReset:\r\n"
+ .align
+ add r0, r0, #4
+ swi X(OS_Write0)
+ swi X(OS_WriteS)
+ .asciz "\r\n\nSystem stopped."
+ .align
+1: swi X(OS_IntOff)
+ b 1b
+#endif
+
+
+
+
+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
+
+#if 1
+FUNCTION(grub_ll_print)
+ swi OS_Write0
+ mov pc, lr
+#endif
+
+
+ .data
+VARIABLE(grub_end_addr)
+ .word _end
+
+ .bss
+//VARIABLE(grub_os_area_addr)
+//VARIABLE(grub_os_area_size)
+VARIABLE(grub_total_module_size)
+ .space 4
+
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x
'*.orig' -x CVS grub2-submitted/Makefile.in grub2-split/Makefile.in
--- grub2-submitted/Makefile.in 2005-08-26 09:04:10.000000000 +0100
+++ grub2-split/Makefile.in 2005-09-09 17:19:39.000000000 +0100
@@ -71,7 +71,7 @@ LIBLZO = @LIBLZO@
### General variables.
-RMKFILES = $(addprefix conf/,i386-pc.rmk powerpc-ieee1275.rmk)
+RMKFILES = $(addprefix conf/,common.rmk i386-pc.rmk powerpc-ieee1275.rmk
arm-RISC_OS.rmk)
MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES))
DATA = $(pkgdata_IMAGES) $(pkgdata_MODULES) $(pkgdata_PROGRAMS) \
@@ -100,6 +100,18 @@ include $(srcdir)/conf/$(host_cpu)-$(hos
### General targets.
+CLEANFILES += moddep.lst command.lst fs.lst
+pkgdata_DATA += moddep.lst command.lst fs.lst
+moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep
+ cat $(DEFSYMFILES) /dev/null | ./genmoddep $(UNDSYMFILES) > $@ \
+ || (rm -f $@; exit 1)
+
+command.lst: $(COMMANDFILES)
+ cat $^ /dev/null | sort > $@
+
+fs.lst: $(FSFILES)
+ cat $^ /dev/null | sort > $@
+
all-local: $(PROGRAMS) $(DATA) $(SCRIPTS) $(MKFILES)
install: install-local
@@ -241,3 +253,5 @@ config.status: configure
# Prevent an overflow.
.NOEXPORT:
+
+.DELETE_ON_ERROR:
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x
'*.orig' -x CVS grub2-submitted/normal/arm/setjmp.S
grub2-split/normal/arm/setjmp.S
--- grub2-submitted/normal/arm/setjmp.S 1970-01-01 01:00:00.000000000 +0100
+++ grub2-split/normal/arm/setjmp.S 2005-09-09 17:19:39.000000000 +0100
@@ -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 CVS grub2-submitted/term/arm/RISC_OS/console-asm.S
grub2-split/term/arm/RISC_OS/console-asm.S
--- grub2-submitted/term/arm/RISC_OS/console-asm.S 1970-01-01
01:00:00.000000000 +0100
+++ grub2-split/term/arm/RISC_OS/console-asm.S 2005-09-09 17:19:39.000000000
+0100
@@ -0,0 +1,82 @@
+/* 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>
+
+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 CVS grub2-submitted/term/arm/RISC_OS/console.c
grub2-split/term/arm/RISC_OS/console.c
--- grub2-submitted/term/arm/RISC_OS/console.c 1970-01-01 01:00:00.000000000
+0100
+++ grub2-split/term/arm/RISC_OS/console.c 2005-09-09 17:19:39.000000000
+0100
@@ -0,0 +1,193 @@
+/*
+ * 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 VGA 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 135:
+ c = GRUB_CONSOLE_KEY_END;
+ break;
+ 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);
+}
--
Member AFFS, WYLUG, SWP (UK), UAF, RESPECT, StWC
No to software patents! Victory to the iraqi resistance!
pgpW1YB0AMqgy.pgp
Description: PGP signature
- I'm back (RISC OS port),
Timothy Baldwin <=