mirror of
http://cgit.git.savannah.gnu.org/git/grub.git
synced 2026-04-28 06:33:17 +00:00
Compare commits
19 Commits
ac042f3f58
...
phcoder/po
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c58da503f | ||
|
|
5574a209a0 | ||
|
|
739b471725 | ||
|
|
4c2055ef0b | ||
|
|
5d20f9b0e7 | ||
|
|
8d5401d29e | ||
|
|
3f170e4e73 | ||
|
|
7cb450b45e | ||
|
|
f0a52cf8d2 | ||
|
|
3c75c98572 | ||
|
|
e2977a3d68 | ||
|
|
69fbf6a348 | ||
|
|
cd4ae2e39b | ||
|
|
20fbcb1e9d | ||
|
|
2762216e13 | ||
|
|
6e8c12917b | ||
|
|
0947b55c73 | ||
|
|
8a9ece7b4c | ||
|
|
85872c8373 |
@@ -123,6 +123,7 @@ if test "x$with_platform" = x; then
|
||||
mipsel-*) platform=loongson ;;
|
||||
mips-*) platform=arc ;;
|
||||
ia64-*) platform=efi ;;
|
||||
alpha-*) platform=srm ;;
|
||||
arm-*) platform=uboot ;;
|
||||
*) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
|
||||
esac
|
||||
@@ -159,6 +160,7 @@ case "$target_cpu"-"$platform" in
|
||||
mipsel-yeeloong) platform=loongson ;;
|
||||
mipsel-fuloong) platform=loongson ;;
|
||||
mipsel-loongson) ;;
|
||||
alpha-srm ) ;;
|
||||
arm-uboot) ;;
|
||||
arm-efi) ;;
|
||||
*-emu) ;;
|
||||
@@ -197,6 +199,7 @@ case "$platform" in
|
||||
uboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_UBOOT=1" ;;
|
||||
qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
|
||||
pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
|
||||
srm) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ALPHA_SRM=1" ;;
|
||||
emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
|
||||
loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||
qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||
@@ -1386,6 +1389,7 @@ AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu =
|
||||
AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
|
||||
AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
|
||||
AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
|
||||
AM_CONDITIONAL([COND_alpha_srm], [test x$target_cpu = xalpha -a x$platform = xsrm])
|
||||
AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel])
|
||||
AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
|
||||
AM_CONDITIONAL([COND_arm], [test x$target_cpu = xarm ])
|
||||
|
||||
@@ -23,7 +23,7 @@ GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot",
|
||||
"i386_multiboot", "i386_ieee1275", "x86_64_efi",
|
||||
"mips_loongson", "sparc64_ieee1275",
|
||||
"powerpc_ieee1275", "mips_arc", "ia64_efi",
|
||||
"mips_qemu_mips", "arm_uboot", "arm_efi" ]
|
||||
"mips_qemu_mips", "alpha_srm", "arm_uboot", "arm_efi" ]
|
||||
|
||||
GROUPS = {}
|
||||
|
||||
@@ -59,7 +59,7 @@ GROUPS["videomodules"] = GRUB_PLATFORMS[:];
|
||||
for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i)
|
||||
|
||||
# Similar for terminfo
|
||||
GROUPS["terminfoinkernel"] = [ "emu", "mips_loongson", "mips_arc", "mips_qemu_mips" ] + GROUPS["ieee1275"] + GROUPS["uboot"];
|
||||
GROUPS["terminfoinkernel"] = [ "emu", "mips_loongson", "mips_arc", "mips_qemu_mips", "alpha_srm" ] + GROUPS["ieee1275"] + GROUPS["uboot"];
|
||||
GROUPS["terminfomodule"] = GRUB_PLATFORMS[:];
|
||||
for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i)
|
||||
|
||||
|
||||
@@ -142,6 +142,12 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||
endif
|
||||
|
||||
if COND_alpha_srm
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/alpha/divide.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
|
||||
endif
|
||||
|
||||
if COND_mips
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/kernel.h
|
||||
endif
|
||||
|
||||
@@ -70,6 +70,8 @@ kernel = {
|
||||
|
||||
ldadd = '$(LDADD_KERNEL)';
|
||||
|
||||
alpha_srm_cflags = '-mcpu=ev4 -mno-fp-regs -ffixed-8';
|
||||
|
||||
i386_coreboot_ldflags = '-Wl,-Ttext=0x8200';
|
||||
i386_multiboot_ldflags = '-Wl,-Ttext=0x8200';
|
||||
i386_ieee1275_ldflags = '-Wl,-Ttext=0x10000';
|
||||
@@ -78,6 +80,7 @@ kernel = {
|
||||
sparc64_ieee1275_ldflags = '-Wl,-Ttext,0x4400';
|
||||
mips_arc_ldflags = '-Wl,-Ttext,$(TARGET_LINK_ADDR)';
|
||||
mips_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000';
|
||||
alpha_srm_ldflags = '-Wl,-Ttext,0x20000000';
|
||||
|
||||
mips_arc_cppflags = '-DGRUB_DECOMPRESSOR_LINK_ADDR=$(TARGET_DECOMPRESSOR_LINK_ADDR)';
|
||||
mips_loongson_cppflags = '-DUSE_ASCII_FALLBACK';
|
||||
@@ -97,6 +100,7 @@ kernel = {
|
||||
mips_startup = kern/mips/startup.S;
|
||||
sparc64_ieee1275_startup = kern/sparc64/ieee1275/crt0.S;
|
||||
powerpc_ieee1275_startup = kern/powerpc/ieee1275/startup.S;
|
||||
alpha_srm_startup = kern/alpha/srm/startup.S;
|
||||
arm_uboot_startup = kern/arm/uboot/startup.S;
|
||||
arm_efi_startup = kern/arm/efi/startup.S;
|
||||
|
||||
@@ -125,6 +129,7 @@ kernel = {
|
||||
noemu_nodist = symlist.c;
|
||||
|
||||
mips = kern/generic/rtc_get_time_ms.c;
|
||||
alpha_srm = kern/generic/rtc_get_time_ms.c;
|
||||
|
||||
ieee1275 = disk/ieee1275/ofdisk.c;
|
||||
ieee1275 = kern/ieee1275/cmain.c;
|
||||
@@ -237,6 +242,16 @@ kernel = {
|
||||
arm = kern/arm/cache.c;
|
||||
arm = kern/arm/misc.S;
|
||||
|
||||
alpha_srm = kern/alpha/srm/dispatch.S;
|
||||
alpha_srm = kern/alpha/dl.c;
|
||||
alpha_srm = kern/alpha/cache.S;
|
||||
alpha_srm = kern/alpha/divide.S;
|
||||
alpha_srm = kern/alpha/srm/pal_init.c;
|
||||
alpha_srm = kern/alpha/srm/init.c;
|
||||
alpha_srm = term/alpha/srm/console.c;
|
||||
alpha_srm = disk/alpha/srm/srmdisk.c;
|
||||
alpha_srm = commands/boot.c;
|
||||
|
||||
emu = disk/host.c;
|
||||
emu = kern/emu/cache_s.S;
|
||||
emu = kern/emu/hostdisk.c;
|
||||
@@ -805,6 +820,8 @@ module = {
|
||||
i386_qemu = lib/i386/halt.c;
|
||||
efi = lib/efi/halt.c;
|
||||
ieee1275 = lib/ieee1275/halt.c;
|
||||
alpha_srm = lib/alpha/srm/halt.c;
|
||||
|
||||
emu = lib/emu/halt.c;
|
||||
uboot = lib/uboot/halt.c;
|
||||
};
|
||||
@@ -822,6 +839,7 @@ module = {
|
||||
mips_loongson = lib/mips/loongson/reboot.c;
|
||||
mips_qemu_mips = lib/mips/qemu_mips/reboot.c;
|
||||
uboot = lib/uboot/reboot.c;
|
||||
alpha_srm = lib/alpha/srm/reboot.c;
|
||||
common = commands/reboot.c;
|
||||
};
|
||||
|
||||
@@ -1504,6 +1522,7 @@ module = {
|
||||
powerpc_ieee1275 = lib/ieee1275/cmos.c;
|
||||
|
||||
mips_arc = lib/arc/datetime.c;
|
||||
alpha_srm = lib/alpha/srm/datetime.c;
|
||||
enable = noemu;
|
||||
};
|
||||
|
||||
@@ -1517,7 +1536,7 @@ module = {
|
||||
extra_dist = lib/powerpc/setjmp.S;
|
||||
extra_dist = lib/ia64/setjmp.S;
|
||||
extra_dist = lib/ia64/longjmp.S;
|
||||
extra_dist = lib/arm/setjmp.S;
|
||||
extra_dist = lib/alpha/setjmp.S;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
||||
@@ -70,6 +70,7 @@ get_uuid (const char *name, char **uuid, int getnative)
|
||||
case GRUB_DISK_DEVICE_ARCDISK_ID:
|
||||
case GRUB_DISK_DEVICE_HOSTDISK_ID:
|
||||
case GRUB_DISK_DEVICE_UBOOTDISK_ID:
|
||||
case GRUB_DISK_DEVICE_SRMDISK_ID:
|
||||
break;
|
||||
|
||||
/* Native disks. */
|
||||
|
||||
240
grub-core/disk/alpha/srm/srmdisk.c
Normal file
240
grub-core/disk/alpha/srm/srmdisk.c
Normal file
@@ -0,0 +1,240 @@
|
||||
/* ofdisk.c - Open Firmware disk access. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2004,2006,2007,2008,2009,2011 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/misc.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/alpha/srm/srm.h>
|
||||
|
||||
static grub_srm_fileno_t last_handle = 0;
|
||||
static char *last_path = NULL;
|
||||
|
||||
static int lnum = 0;
|
||||
|
||||
struct srmdisk_hash_ent
|
||||
{
|
||||
char *devpath;
|
||||
int num;
|
||||
struct srmdisk_hash_ent *next;
|
||||
};
|
||||
|
||||
#define SRMDISK_HASH_SZ 8
|
||||
static struct srmdisk_hash_ent *srmdisk_hash[SRMDISK_HASH_SZ];
|
||||
|
||||
static int
|
||||
srmdisk_hash_fn (const char *devpath)
|
||||
{
|
||||
int hash = 0;
|
||||
while (*devpath)
|
||||
hash ^= *devpath++;
|
||||
return (hash & (SRMDISK_HASH_SZ - 1));
|
||||
}
|
||||
|
||||
static struct srmdisk_hash_ent *
|
||||
srmdisk_hash_find (const char *devpath)
|
||||
{
|
||||
struct srmdisk_hash_ent *p = srmdisk_hash[srmdisk_hash_fn (devpath)];
|
||||
|
||||
while (p)
|
||||
{
|
||||
if (!grub_strcmp (p->devpath, devpath))
|
||||
break;
|
||||
p = p->next;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
static struct srmdisk_hash_ent *
|
||||
srmdisk_hash_add (char *devpath)
|
||||
{
|
||||
struct srmdisk_hash_ent *p;
|
||||
struct srmdisk_hash_ent **head = &srmdisk_hash[srmdisk_hash_fn(devpath)];
|
||||
|
||||
p = grub_malloc (sizeof (*p));
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
||||
p->devpath = devpath;
|
||||
p->next = *head;
|
||||
p->num = lnum++;
|
||||
*head = p;
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
grub_srmdisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data,
|
||||
grub_disk_pull_t pull)
|
||||
{
|
||||
(void) hook;
|
||||
(void) pull;
|
||||
(void) hook_data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
reopen (const char *name)
|
||||
{
|
||||
grub_uint64_t r;
|
||||
|
||||
if (last_path && grub_strcmp (last_path, name) == 0)
|
||||
{
|
||||
grub_dprintf ("srmdisk", "using already opened %s\n", name);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
if (last_path)
|
||||
{
|
||||
grub_alpha_srm_dispatch (GRUB_ALPHA_SRM_CLOSE, last_handle);
|
||||
grub_free (last_path);
|
||||
last_path = NULL;
|
||||
last_handle = 0;
|
||||
}
|
||||
|
||||
grub_dprintf ("srmdisk", "opening %s\n", name);
|
||||
r = grub_alpha_srm_dispatch (GRUB_ALPHA_SRM_OPEN, name, grub_strlen (name));
|
||||
grub_printf ("<%lx>", r);
|
||||
while (1);
|
||||
if (r & (1ULL << 63))
|
||||
{
|
||||
grub_dprintf ("srmdisk", "couldn't open %s\n", name);
|
||||
return grub_error (GRUB_ERR_IO, "couldn't open %s", name);
|
||||
}
|
||||
last_path = grub_strdup (name);
|
||||
if (!last_path)
|
||||
return grub_errno;
|
||||
last_handle = r & 0xffffffff;
|
||||
grub_dprintf ("srmdisk", "opened %s\n", name);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_srmdisk_open (const char *name, grub_disk_t disk)
|
||||
{
|
||||
char *fullname;
|
||||
grub_err_t err;
|
||||
struct srmdisk_hash_ent *hash;
|
||||
|
||||
if (grub_memcmp (name, "srm/", 4) != 0)
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not srm device");
|
||||
fullname = grub_strdup (name + 4);
|
||||
if (!fullname)
|
||||
return grub_errno;
|
||||
disk->data = fullname;
|
||||
grub_dprintf ("srmdisk", "opening %s\n", fullname);
|
||||
|
||||
hash = srmdisk_hash_find (fullname);
|
||||
if (!hash)
|
||||
hash = srmdisk_hash_add (fullname);
|
||||
if (!hash)
|
||||
return grub_errno;
|
||||
|
||||
err = reopen (fullname);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
{
|
||||
grub_uint64_t res = 0;
|
||||
int i;
|
||||
|
||||
/* FIXME: findout the block size. */
|
||||
for (i = 31; i >= 0; i--)
|
||||
{
|
||||
char buf[512];
|
||||
grub_dprintf ("srmdisk",
|
||||
"seek to 0x%" PRIxGRUB_UINT64_T "\n",
|
||||
res | (1UL << i));
|
||||
if (grub_alpha_srm_dispatch (GRUB_ALPHA_SRM_READ, last_handle, 512,
|
||||
buf, res | (1ULL << i)) & (1ULL << 63))
|
||||
continue;
|
||||
res |= (1ULL << i);
|
||||
}
|
||||
grub_dprintf ("srmdisk",
|
||||
"determined disk size 0x%" PRIxGRUB_UINT64_T "\n", res);
|
||||
disk->total_sectors = res;
|
||||
}
|
||||
|
||||
disk->id = hash->num;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static void
|
||||
grub_srmdisk_close (grub_disk_t disk)
|
||||
{
|
||||
grub_free (disk->data);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_srmdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||
grub_size_t size, char *buf)
|
||||
{
|
||||
grub_err_t err;
|
||||
|
||||
err = reopen (disk->data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* FIXME: handle incomplete read. */
|
||||
if (grub_alpha_srm_dispatch (GRUB_ALPHA_SRM_READ, last_handle,
|
||||
size << 9,
|
||||
buf, sector) & (1ULL << 63))
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "read failed");
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_srmdisk_write (grub_disk_t disk __attribute ((unused)),
|
||||
grub_disk_addr_t sector __attribute ((unused)),
|
||||
grub_size_t size __attribute ((unused)),
|
||||
const char *buf __attribute ((unused)))
|
||||
{
|
||||
return GRUB_ERR_NOT_IMPLEMENTED_YET;
|
||||
}
|
||||
|
||||
static struct grub_disk_dev grub_srmdisk_dev =
|
||||
{
|
||||
.name = "srmdisk",
|
||||
.id = GRUB_DISK_DEVICE_SRMDISK_ID,
|
||||
.iterate = grub_srmdisk_iterate,
|
||||
.open = grub_srmdisk_open,
|
||||
.close = grub_srmdisk_close,
|
||||
.read = grub_srmdisk_read,
|
||||
.write = grub_srmdisk_write,
|
||||
.next = 0
|
||||
};
|
||||
|
||||
void
|
||||
grub_srmdisk_init (void)
|
||||
{
|
||||
grub_disk_dev_register (&grub_srmdisk_dev);
|
||||
}
|
||||
|
||||
void
|
||||
grub_srmdisk_fini (void)
|
||||
{
|
||||
if (last_path)
|
||||
{
|
||||
grub_alpha_srm_dispatch (GRUB_ALPHA_SRM_CLOSE, last_handle);
|
||||
grub_free (last_path);
|
||||
last_path = NULL;
|
||||
last_handle = 0;
|
||||
}
|
||||
|
||||
grub_disk_dev_unregister (&grub_srmdisk_dev);
|
||||
}
|
||||
1
grub-core/disk/alpha/srm/srmdisk.txt
Normal file
1
grub-core/disk/alpha/srm/srmdisk.txt
Normal file
@@ -0,0 +1 @@
|
||||
SCSI 0 1004 0 2 200 0 0
|
||||
@@ -240,7 +240,12 @@ parse_angle (const char *value)
|
||||
/* Unicode symbol of degrees (a circle, U+b0). Put here in UTF-8 to
|
||||
avoid potential problem with text file reesncoding */
|
||||
|| grub_strcmp (ptr, "\xc2\xb0") == 0)
|
||||
angle = (angle * 64 + 45) / 90;
|
||||
{
|
||||
if (angle >= 0)
|
||||
angle = ((unsigned) angle * 64 + 45) / 90;
|
||||
else
|
||||
angle = -((unsigned) -angle * 64 + 45) / 90;
|
||||
}
|
||||
return angle;
|
||||
}
|
||||
|
||||
|
||||
9
grub-core/kern/alpha/cache.S
Normal file
9
grub-core/kern/alpha/cache.S
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
|
||||
FUNCTION (grub_arch_sync_all_caches)
|
||||
call_pal 134
|
||||
ret $31,($26)
|
||||
114
grub-core/kern/alpha/divide.S
Normal file
114
grub-core/kern/alpha/divide.S
Normal file
@@ -0,0 +1,114 @@
|
||||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
.set noat
|
||||
|
||||
.macro PREAMBLE
|
||||
|
||||
subq $30, 31 * 8, $30
|
||||
stq $0, (0 * 8)($30)
|
||||
stq $1, (1 * 8)($30)
|
||||
stq $2, (2 * 8)($30)
|
||||
stq $3, (3 * 8)($30)
|
||||
stq $4, (4 * 8)($30)
|
||||
stq $5, (5 * 8)($30)
|
||||
stq $6, (6 * 8)($30)
|
||||
stq $7, (7 * 8)($30)
|
||||
stq $8, (8 * 8)($30)
|
||||
stq $9, (9 * 8)($30)
|
||||
stq $10, (10 * 8)($30)
|
||||
stq $11, (11 * 8)($30)
|
||||
stq $12, (12 * 8)($30)
|
||||
stq $13, (13 * 8)($30)
|
||||
stq $14, (14 * 8)($30)
|
||||
stq $15, (15 * 8)($30)
|
||||
stq $16, (16 * 8)($30)
|
||||
stq $17, (17 * 8)($30)
|
||||
stq $18, (18 * 8)($30)
|
||||
stq $19, (19 * 8)($30)
|
||||
stq $20, (20 * 8)($30)
|
||||
stq $21, (21 * 8)($30)
|
||||
stq $22, (22 * 8)($30)
|
||||
stq $23, (23 * 8)($30)
|
||||
stq $24, (24 * 8)($30)
|
||||
stq $25, (25 * 8)($30)
|
||||
stq $26, (26 * 8)($30)
|
||||
stq $28, (28 * 8)($30)
|
||||
stq $29, (29 * 8)($30)
|
||||
addq $30, (30 * 8), $18
|
||||
/* load GP. */
|
||||
br $27, 1f
|
||||
1: ldgp $29, 0($27)
|
||||
.endm
|
||||
|
||||
.macro POSTAMBLE
|
||||
ldq $0, (0 * 8)($30)
|
||||
ldq $1, (1 * 8)($30)
|
||||
ldq $2, (2 * 8)($30)
|
||||
ldq $3, (3 * 8)($30)
|
||||
ldq $4, (4 * 8)($30)
|
||||
ldq $5, (5 * 8)($30)
|
||||
ldq $6, (6 * 8)($30)
|
||||
ldq $7, (7 * 8)($30)
|
||||
ldq $8, (8 * 8)($30)
|
||||
ldq $9, (9 * 8)($30)
|
||||
ldq $10, (10 * 8)($30)
|
||||
ldq $11, (11 * 8)($30)
|
||||
ldq $12, (12 * 8)($30)
|
||||
ldq $13, (13 * 8)($30)
|
||||
ldq $14, (14 * 8)($30)
|
||||
ldq $15, (15 * 8)($30)
|
||||
ldq $16, (16 * 8)($30)
|
||||
ldq $17, (17 * 8)($30)
|
||||
ldq $18, (18 * 8)($30)
|
||||
ldq $19, (19 * 8)($30)
|
||||
ldq $20, (20 * 8)($30)
|
||||
ldq $21, (21 * 8)($30)
|
||||
ldq $22, (22 * 8)($30)
|
||||
ldq $23, (23 * 8)($30)
|
||||
ldq $24, (24 * 8)($30)
|
||||
ldq $25, (25 * 8)($30)
|
||||
ldq $26, (26 * 8)($30)
|
||||
ldq $28, (28 * 8)($30)
|
||||
ldq $29, (29 * 8)($30)
|
||||
addq $30, 31 * 8, $30
|
||||
ret $31,($23)
|
||||
.endm
|
||||
|
||||
FUNCTION (__divqu)
|
||||
PREAMBLE
|
||||
mov $24, $16
|
||||
mov $25, $17
|
||||
jsr $26, EXT_C (grub_divmod64)
|
||||
mov $0, $27
|
||||
POSTAMBLE
|
||||
|
||||
FUNCTION (__remqu)
|
||||
PREAMBLE
|
||||
mov $24, $16
|
||||
mov $25, $17
|
||||
jsr $26, EXT_C (grub_divmod64)
|
||||
ldq $27, (30 * 8)($30)
|
||||
POSTAMBLE
|
||||
|
||||
FUNCTION (__divlu)
|
||||
PREAMBLE
|
||||
sll $24, 32, $16
|
||||
sra $16, 32, $16
|
||||
sll $25, 32, $17
|
||||
sra $17, 32, $17
|
||||
mov $24, $16
|
||||
mov $25, $17
|
||||
jsr $26, EXT_C (grub_divmod64)
|
||||
mov $0, $27
|
||||
POSTAMBLE
|
||||
|
||||
FUNCTION (__remlu)
|
||||
PREAMBLE
|
||||
sll $24, 32, $16
|
||||
sra $16, 32, $16
|
||||
sll $25, 32, $17
|
||||
sra $17, 32, $17
|
||||
jsr $26, EXT_C (grub_divmod64)
|
||||
ldq $27, (30 * 8)($30)
|
||||
POSTAMBLE
|
||||
257
grub-core/kern/alpha/dl.c
Normal file
257
grub-core/kern/alpha/dl.c
Normal file
@@ -0,0 +1,257 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2011 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/elf.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/cpu/types.h>
|
||||
#include <grub/mm.h>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||
|
||||
void
|
||||
grub_arch_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
||||
grub_size_t *got)
|
||||
{
|
||||
const Elf64_Ehdr *e = ehdr;
|
||||
grub_size_t cntt = 0, cntg = 0;;
|
||||
const Elf64_Shdr *s;
|
||||
unsigned i;
|
||||
|
||||
/* Find a symbol table. */
|
||||
for (i = 0, s = (Elf64_Shdr *) ((char *) e + grub_le_to_cpu32 (e->e_shoff));
|
||||
i < grub_le_to_cpu16 (e->e_shnum);
|
||||
i++, s = (Elf64_Shdr *) ((char *) s + grub_le_to_cpu16 (e->e_shentsize)))
|
||||
if (grub_le_to_cpu32 (s->sh_type) == SHT_SYMTAB)
|
||||
break;
|
||||
|
||||
if (i == grub_le_to_cpu16 (e->e_shnum))
|
||||
return;
|
||||
|
||||
|
||||
for (i = 0, s = (Elf64_Shdr *) ((char *) e + grub_le_to_cpu32 (e->e_shoff));
|
||||
i < grub_le_to_cpu16 (e->e_shnum);
|
||||
i++, s = (Elf64_Shdr *) ((char *) s + grub_le_to_cpu16 (e->e_shentsize)))
|
||||
if (grub_le_to_cpu32 (s->sh_type) == SHT_RELA)
|
||||
{
|
||||
Elf64_Rela *rel, *max;
|
||||
|
||||
for (rel = (Elf64_Rela *) ((char *) e + grub_le_to_cpu32 (s->sh_offset)),
|
||||
max = rel + grub_le_to_cpu32 (s->sh_size) / grub_le_to_cpu16 (s->sh_entsize);
|
||||
rel < max; rel++)
|
||||
switch (ELF64_R_TYPE (grub_le_to_cpu32 (rel->r_info)))
|
||||
{
|
||||
case R_ALPHA_LITERAL:
|
||||
cntg++;
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
}
|
||||
*tramp = cntt;
|
||||
*got = cntg;
|
||||
}
|
||||
|
||||
|
||||
/* Check if EHDR is a valid ELF header. */
|
||||
grub_err_t
|
||||
grub_arch_dl_check_header (void *ehdr)
|
||||
{
|
||||
Elf_Ehdr *e = ehdr;
|
||||
|
||||
/* Check the magic numbers. */
|
||||
if (e->e_ident[EI_CLASS] != ELFCLASS64
|
||||
|| e->e_ident[EI_DATA] != ELFDATA2LSB
|
||||
|| e->e_machine != EM_ALPHA)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "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)
|
||||
{
|
||||
Elf_Ehdr *e = ehdr;
|
||||
Elf_Shdr *s;
|
||||
Elf_Word entsize;
|
||||
unsigned i;
|
||||
grub_uint8_t *gp;
|
||||
grub_uint64_t *gpptr;
|
||||
|
||||
gp = (grub_uint8_t *) mod->got;
|
||||
gpptr = (grub_uint64_t *) mod->got;
|
||||
|
||||
/* Find a symbol table. */
|
||||
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
||||
i < e->e_shnum;
|
||||
i++, s = (Elf_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");
|
||||
|
||||
entsize = s->sh_entsize;
|
||||
|
||||
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
||||
i < e->e_shnum;
|
||||
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
||||
if (s->sh_type == SHT_RELA)
|
||||
{
|
||||
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)
|
||||
{
|
||||
Elf_Rela *rel, *max;
|
||||
|
||||
for (rel = (Elf_Rela *) ((char *) e + s->sh_offset),
|
||||
max = (Elf_Rela *) ((char *) rel + s->sh_size);
|
||||
rel < max;
|
||||
rel++)
|
||||
{
|
||||
grub_uint8_t *addr;
|
||||
Elf_Sym *sym;
|
||||
grub_uint64_t value;
|
||||
|
||||
if (seg->size < rel->r_offset)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||
"reloc offset is out of the segment");
|
||||
|
||||
addr = (grub_uint8_t *) seg->addr + rel->r_offset;
|
||||
sym = (Elf_Sym *) ((char *) mod->symtab
|
||||
+ entsize * ELF_R_SYM (rel->r_info));
|
||||
|
||||
value = sym->st_value + rel->r_addend;
|
||||
switch (ELF_R_TYPE (rel->r_info))
|
||||
{
|
||||
case R_ALPHA_REFQUAD:
|
||||
*(grub_uint64_t *) addr += value;
|
||||
break;
|
||||
case R_ALPHA_REFLONG:
|
||||
*(grub_uint32_t *) addr += value;
|
||||
break;
|
||||
|
||||
case R_ALPHA_GPREL32:
|
||||
*(grub_uint32_t *) addr += value - (grub_addr_t) gp;
|
||||
break;
|
||||
|
||||
case R_ALPHA_GPDISP:
|
||||
{
|
||||
grub_int64_t off = gp - addr;
|
||||
|
||||
if (off < (-2147483647L - 1)
|
||||
|| off > 2147483647L)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||
"gpdisp offset too large");
|
||||
/* Lower part is
|
||||
treated as signed. Hence add 0x8000 to compensate.
|
||||
*/
|
||||
*(grub_uint16_t *) addr = (off + 0x8000) >> 16;
|
||||
*(grub_uint16_t *) (addr + rel->r_addend) = off;
|
||||
break;
|
||||
}
|
||||
|
||||
case R_ALPHA_GPRELHIGH:
|
||||
{
|
||||
Elf_Rela *rel2;
|
||||
|
||||
/* Handle partner lo16 relocation. Lower part is
|
||||
treated as signed. Hence add 0x8000 to compensate.
|
||||
*/
|
||||
value += (*(grub_uint16_t *) addr << 16);
|
||||
value -= (grub_addr_t) gp;
|
||||
for (rel2 = rel + 1; rel2 < max; rel2++)
|
||||
if (ELF_R_SYM (rel2->r_info)
|
||||
== ELF_R_SYM (rel->r_info)
|
||||
&& ELF_R_TYPE (rel2->r_info) == R_ALPHA_GPRELLOW)
|
||||
{
|
||||
value += *(grub_int16_t *)
|
||||
((char *) seg->addr + rel2->r_offset);
|
||||
break;
|
||||
}
|
||||
/* Handle partner lo16 relocation. Lower part is
|
||||
treated as signed. Hence add 0x8000 to compensate.
|
||||
*/
|
||||
if ((grub_int64_t) value < (-2147483647L - 1)
|
||||
|| (grub_int64_t) value > 2147483647L)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||
"gpdisp offset too large");
|
||||
value += 0x8000;
|
||||
*(grub_uint16_t *) addr = (value >> 16) & 0xffff;
|
||||
break;
|
||||
}
|
||||
case R_ALPHA_GPRELLOW:
|
||||
value -= (grub_addr_t) gp;
|
||||
*(grub_uint16_t *) addr += value & 0xffff;
|
||||
break;
|
||||
case R_ALPHA_LITERAL:
|
||||
*gpptr = value + *(grub_uint16_t *) addr;
|
||||
*(grub_uint16_t *) addr = ((grub_uint8_t *) gpptr - gp);
|
||||
gpptr++;
|
||||
break;
|
||||
case R_ALPHA_SREL32:
|
||||
*(grub_uint32_t *) addr += value - (grub_addr_t) seg->addr;
|
||||
break;
|
||||
case R_ALPHA_BRSGP:
|
||||
value += (((*(grub_uint32_t *) addr)
|
||||
& ((1 << 21) - 1)) << 2);
|
||||
value -= (grub_addr_t) addr;
|
||||
if (sym->st_other == STO_ALPHA_STD_GPLOAD)
|
||||
value += 4;
|
||||
else
|
||||
value -= 4;
|
||||
if (value & 3)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||
"unaligned branch");
|
||||
|
||||
if ((value & ~((1UL << 22) - 1)) != 0
|
||||
&& (value & ~((1UL << 22) - 1)) != ~((1UL << 22) - 1))
|
||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||
"brs offset too large (%lx)",
|
||||
value);
|
||||
|
||||
*(grub_uint32_t *) addr
|
||||
= ((*(grub_uint32_t *) addr & ~((1 << 21) - 1))
|
||||
| ((value >> 2) & ((1 << 21) - 1)));
|
||||
break;
|
||||
|
||||
case R_ALPHA_LITUSE:
|
||||
case R_ALPHA_HINT:
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"Unknown relocation type %d\n",
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
215
grub-core/kern/alpha/srm/init.c
Normal file
215
grub-core/kern/alpha/srm/init.c
Normal file
@@ -0,0 +1,215 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2011 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/cache.h>
|
||||
#include <grub/kernel.h>
|
||||
#include <grub/memory.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/machine/srm.h>
|
||||
#include <grub/machine/console.h>
|
||||
|
||||
/* FIXME: determine va_size. */
|
||||
static void *kseg_addr = (void *) 0xfffffc0000000000;
|
||||
static grub_uint64_t log_page_size;
|
||||
|
||||
extern char _start[];
|
||||
extern char _end[];
|
||||
|
||||
grub_uint32_t grub_arch_pccclock;
|
||||
|
||||
/* FIXME: use interrupt to count high. */
|
||||
grub_uint64_t
|
||||
grub_get_rtc (void)
|
||||
{
|
||||
static grub_uint32_t high = 0;
|
||||
static grub_uint32_t last = 0;
|
||||
grub_uint32_t low;
|
||||
|
||||
asm volatile ("rpcc %0" : "=r" (low));
|
||||
if (low < last)
|
||||
high++;
|
||||
last = low;
|
||||
|
||||
return (((grub_uint64_t) high) << 32) | low;
|
||||
}
|
||||
|
||||
static grub_addr_t
|
||||
get_pfn (grub_addr_t va, grub_uint64_t ptbr)
|
||||
{
|
||||
grub_uint64_t *l1;
|
||||
grub_uint64_t l1n;
|
||||
grub_uint64_t *l2;
|
||||
grub_uint64_t l2n;
|
||||
grub_uint64_t *l3;
|
||||
grub_uint64_t l3n;
|
||||
|
||||
l3n = va >> log_page_size;
|
||||
l2n = l3n >> (log_page_size - 3);
|
||||
l1n = l2n >> (log_page_size - 3);
|
||||
l3n &= ((1 << (log_page_size - 3)) - 1);
|
||||
l2n &= ((1 << (log_page_size - 3)) - 1);
|
||||
l1n &= ((1 << (log_page_size - 3)) - 1);
|
||||
|
||||
l1 = ((grub_uint64_t *) kseg_addr + (ptbr << (log_page_size - 3))
|
||||
+ l1n);
|
||||
l2 = ((grub_uint64_t *) kseg_addr + ((*l1 >> 32) << (log_page_size - 3))
|
||||
+ l2n);
|
||||
l3 = ((grub_uint64_t *) kseg_addr + ((*l2 >> 32) << (log_page_size - 3))
|
||||
+ l3n);
|
||||
return (*l3 >> 32);
|
||||
}
|
||||
|
||||
void pal_init(void);
|
||||
|
||||
grub_addr_t grub_modbase;
|
||||
|
||||
void
|
||||
grub_machine_get_bootlocation (char **device __attribute__ ((unused)),
|
||||
char **path __attribute__ ((unused)))
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
grub_machine_init (void)
|
||||
{
|
||||
unsigned i;
|
||||
struct grub_alpha_srm_memdesc *memdesc;
|
||||
struct grub_alpha_srm_hwpcb *pcb;
|
||||
grub_addr_t a;
|
||||
grub_addr_t start, end;
|
||||
grub_uint64_t low_pfn = ~0ULL, high_pfn = 0;
|
||||
|
||||
grub_arch_pccclock = GRUB_ALPHA_SRM_HWRPB.pcc_freq;
|
||||
grub_modbase = (grub_addr_t) _end;
|
||||
|
||||
grub_console_init_early ();
|
||||
|
||||
pal_init ();
|
||||
|
||||
grub_install_get_time_ms (grub_rtc_get_time_ms);
|
||||
|
||||
for (log_page_size = 0;
|
||||
!((1 << log_page_size) & GRUB_ALPHA_SRM_HWRPB.page_size);
|
||||
log_page_size++);
|
||||
|
||||
memdesc = (struct grub_alpha_srm_memdesc *)
|
||||
(GRUB_ALPHA_SRM_HWRPB_ADDR + GRUB_ALPHA_SRM_HWRPB.memory_descriptor_table);
|
||||
|
||||
pcb = (void *) (GRUB_ALPHA_SRM_HWRPB_ADDR
|
||||
+ GRUB_ALPHA_SRM_HWRPB.cpu_slots_offset
|
||||
+ (GRUB_ALPHA_SRM_HWRPB.primary_cpu_id
|
||||
* GRUB_ALPHA_SRM_HWRPB.cpu_slot_size));
|
||||
|
||||
start = ALIGN_DOWN ((grub_addr_t) (&_start[0]),
|
||||
GRUB_ALPHA_SRM_HWRPB.page_size);
|
||||
end = ALIGN_UP (grub_modules_get_end (), GRUB_ALPHA_SRM_HWRPB.page_size);
|
||||
for (a = start; a < end; a += GRUB_ALPHA_SRM_HWRPB.page_size)
|
||||
{
|
||||
grub_uint64_t curpfn = get_pfn (a, pcb->ptbr);
|
||||
if (curpfn > high_pfn)
|
||||
high_pfn = curpfn;
|
||||
if (curpfn < low_pfn)
|
||||
low_pfn = curpfn;
|
||||
}
|
||||
|
||||
for (i = 0; i < memdesc->num_entries; i++)
|
||||
{
|
||||
grub_uint64_t from, to;
|
||||
if (memdesc->entries[i].type
|
||||
!= GRUB_ALPHA_SRM_MEMDESC_ENTRY_TYPE_AVAILABLE)
|
||||
continue;
|
||||
from = memdesc->entries[i].start_page;
|
||||
to = memdesc->entries[i].start_page + memdesc->entries[i].num_pages;
|
||||
if ((to > low_pfn) && (from < high_pfn + 1))
|
||||
{
|
||||
if (from < low_pfn)
|
||||
/* from .. (lowpfn - 1) */
|
||||
grub_mm_init_region ((char *) kseg_addr + (from << log_page_size),
|
||||
(low_pfn - from) << log_page_size);
|
||||
if (high_pfn + 1 < to)
|
||||
/* (high_pfn + 1) .. (to - 1) */
|
||||
grub_mm_init_region ((char *) kseg_addr
|
||||
+ ((high_pfn + 1) << log_page_size),
|
||||
(to - high_pfn - 1) << log_page_size);
|
||||
}
|
||||
else
|
||||
/* from .. (to - 1) */
|
||||
grub_mm_init_region ((char *) kseg_addr
|
||||
+ (from << log_page_size),
|
||||
(to - from) << log_page_size);
|
||||
}
|
||||
|
||||
grub_console_init_lately ();
|
||||
|
||||
grub_srmdisk_init ();
|
||||
|
||||
char buf[512];
|
||||
grub_alpha_srm_dispatch (0x22, 2, buf, sizeof (buf));
|
||||
grub_printf ("Hello World %s\n", buf);
|
||||
}
|
||||
|
||||
void
|
||||
grub_machine_fini (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
grub_exit (void)
|
||||
{
|
||||
while (1);
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_machine_mmap_iterate (grub_memory_hook_t hook, void *hook_data)
|
||||
{
|
||||
struct grub_alpha_srm_memdesc *memdesc;
|
||||
unsigned i;
|
||||
|
||||
memdesc = (struct grub_alpha_srm_memdesc *)
|
||||
(GRUB_ALPHA_SRM_HWRPB_ADDR + GRUB_ALPHA_SRM_HWRPB.memory_descriptor_table);
|
||||
|
||||
for (i = 0; i < memdesc->num_entries; i++)
|
||||
switch (memdesc->entries[i].type)
|
||||
{
|
||||
case GRUB_ALPHA_SRM_MEMDESC_ENTRY_TYPE_AVAILABLE:
|
||||
hook (memdesc->entries[i].start_page << log_page_size,
|
||||
memdesc->entries[i].num_pages << log_page_size,
|
||||
GRUB_MEMORY_AVAILABLE, hook_data);
|
||||
break;
|
||||
case GRUB_ALPHA_SRM_MEMDESC_ENTRY_TYPE_NONVOLATILE:
|
||||
hook (memdesc->entries[i].start_page << log_page_size,
|
||||
memdesc->entries[i].num_pages << log_page_size,
|
||||
GRUB_MEMORY_NVRAM, hook_data);
|
||||
break;
|
||||
case GRUB_ALPHA_SRM_MEMDESC_ENTRY_TYPE_RESERVED1:
|
||||
case GRUB_ALPHA_SRM_MEMDESC_ENTRY_TYPE_RESERVED2:
|
||||
default:
|
||||
hook (memdesc->entries[i].start_page << log_page_size,
|
||||
memdesc->entries[i].num_pages << log_page_size,
|
||||
GRUB_MEMORY_RESERVED, hook_data);
|
||||
break;
|
||||
}
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
54
grub-core/kern/alpha/srm/startup.S
Normal file
54
grub-core/kern/alpha/srm/startup.S
Normal file
@@ -0,0 +1,54 @@
|
||||
#include <config.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/offsets.h>
|
||||
|
||||
.set noreorder
|
||||
.globl _start
|
||||
.ent _start
|
||||
_start:
|
||||
.prologue 0
|
||||
/* load GP. */
|
||||
br $27, 1f
|
||||
1: ldgp $29, 0($27)
|
||||
|
||||
/* Move modules out of the BSS. */
|
||||
lda $1, __bss_start
|
||||
lda $2, _end
|
||||
lda $4, modsize
|
||||
ldq $3, 0($4)
|
||||
addq $3, 7, $3
|
||||
sra $3, 3, $3
|
||||
sll $3, 3, $4
|
||||
subq $4, 8, $4
|
||||
addq $1, $4, $1
|
||||
addq $2, $4, $2
|
||||
|
||||
2:
|
||||
beq $3, 3f
|
||||
ldq $4, 0($1)
|
||||
stq $4, 0($2)
|
||||
subq $3, 1, $3
|
||||
subq $1, 8, $1
|
||||
subq $2, 8, $2
|
||||
br 2b
|
||||
3:
|
||||
|
||||
/* Clean BSS. */
|
||||
lda $1, __bss_start
|
||||
lda $2, _end
|
||||
subq $2, $1, $2
|
||||
sra $2, 3, $2
|
||||
2:
|
||||
beq $2, 3f
|
||||
stq $31, 0($1)
|
||||
subq $2, 1, $2
|
||||
addq $1, 8, $1
|
||||
br 2b
|
||||
3:
|
||||
/* call main. */
|
||||
lda $27, EXT_C (grub_main)
|
||||
jmp ($27)
|
||||
.end _start
|
||||
. = _start + GRUB_KERNEL_ALPHA_SRM_TOTAL_MODULE_SIZE
|
||||
modsize:
|
||||
.quad 0
|
||||
@@ -229,7 +229,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
|
||||
unsigned i;
|
||||
Elf_Shdr *s;
|
||||
grub_size_t tsize = 0, talign = 1;
|
||||
#if defined (__ia64__) || defined (__powerpc__)
|
||||
#if defined (__ia64__) || defined (__alpha__) || defined (__powerpc__)
|
||||
grub_size_t tramp;
|
||||
grub_size_t got;
|
||||
#endif
|
||||
@@ -244,7 +244,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
|
||||
talign = s->sh_addralign;
|
||||
}
|
||||
|
||||
#if defined (__ia64__) || defined (__powerpc__)
|
||||
#if defined (__ia64__) || defined (__alpha__) || defined (__powerpc__)
|
||||
grub_arch_dl_get_tramp_got_size (e, &tramp, &got);
|
||||
tramp *= GRUB_ARCH_DL_TRAMP_SIZE;
|
||||
got *= sizeof (grub_uint64_t);
|
||||
@@ -313,7 +313,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
|
||||
mod->segment = seg;
|
||||
}
|
||||
}
|
||||
#if defined (__ia64__) || defined (__powerpc__)
|
||||
#if defined (__ia64__) || defined (__alpha__) || defined (__powerpc__)
|
||||
ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_TRAMP_ALIGN);
|
||||
mod->tramp = ptr;
|
||||
ptr += tramp;
|
||||
@@ -359,7 +359,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
|
||||
str = (char *) e + s->sh_offset;
|
||||
|
||||
for (i = 0;
|
||||
i < size / entsize;
|
||||
i * entsize < size;
|
||||
i++, sym = (Elf_Sym *) ((char *) sym + entsize))
|
||||
{
|
||||
unsigned char type = ELF_ST_TYPE (sym->st_info);
|
||||
@@ -553,11 +553,15 @@ grub_dl_unref (grub_dl_t mod)
|
||||
}
|
||||
|
||||
static void
|
||||
grub_dl_flush_cache (grub_dl_t mod)
|
||||
grub_dl_flush_cache (grub_dl_t mod __attribute__ ((unused)))
|
||||
{
|
||||
grub_dprintf ("modules", "flushing 0x%lx bytes at %p\n",
|
||||
(unsigned long) mod->sz, mod->base);
|
||||
#ifdef __alpha__
|
||||
grub_arch_sync_all_caches ();
|
||||
#else
|
||||
grub_arch_sync_caches (mod->base, mod->sz);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Load a module from core memory. */
|
||||
|
||||
@@ -557,6 +557,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r)
|
||||
*/
|
||||
#if !defined (__arm__) && !defined (__ia64__)
|
||||
/* Skip the slow computation if 32-bit arithmetic is possible. */
|
||||
#ifndef __alpha__
|
||||
if (n < 0xffffffff && d < 0xffffffff)
|
||||
{
|
||||
if (r)
|
||||
|
||||
195
grub-core/lib/alpha/setjmp.S
Normal file
195
grub-core/lib/alpha/setjmp.S
Normal file
@@ -0,0 +1,195 @@
|
||||
/* Copyright (C) 1992, 1994, 1996, 1997, 2002, 2006, 2013 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/dl.h>
|
||||
|
||||
#define JB_S0 0
|
||||
#define JB_S1 1
|
||||
#define JB_S2 2
|
||||
#define JB_S3 3
|
||||
#define JB_S4 4
|
||||
#define JB_S5 5
|
||||
#define JB_PC 6
|
||||
#define JB_FP 7
|
||||
#define JB_SP 8
|
||||
#define JB_F2 9
|
||||
#define JB_F3 10
|
||||
#define JB_F4 11
|
||||
#define JB_F5 12
|
||||
#define JB_F6 13
|
||||
#define JB_F7 14
|
||||
#define JB_F8 15
|
||||
#define JB_F9 16
|
||||
|
||||
#define v0 $0 /* function return value */
|
||||
|
||||
#define t0 $1 /* temporary registers (caller-saved) */
|
||||
#define t1 $2
|
||||
#define t2 $3
|
||||
#define t3 $4
|
||||
#define t4 $5
|
||||
#define t5 $6
|
||||
#define t6 $7
|
||||
#define t7 $8
|
||||
|
||||
#define s0 $9 /* saved-registers (callee-saved registers) */
|
||||
#define s1 $10
|
||||
#define s2 $11
|
||||
#define s3 $12
|
||||
#define s4 $13
|
||||
#define s5 $14
|
||||
#define s6 $15
|
||||
#define fp s6 /* frame-pointer (s6 in frame-less procedures) */
|
||||
|
||||
#define a0 $16 /* argument registers (caller-saved) */
|
||||
#define a1 $17
|
||||
#define a2 $18
|
||||
#define a3 $19
|
||||
#define a4 $20
|
||||
#define a5 $21
|
||||
|
||||
#define t8 $22 /* more temps (caller-saved) */
|
||||
#define t9 $23
|
||||
#define t10 $24
|
||||
#define t11 $25
|
||||
#define ra $26 /* return address register */
|
||||
#define t12 $27
|
||||
|
||||
#define pv t12 /* procedure-variable register */
|
||||
#define AT $at /* assembler temporary */
|
||||
#define gp $29 /* global pointer */
|
||||
#define sp $30 /* stack pointer */
|
||||
#define zero $31 /* reads as zero, writes are noops */
|
||||
|
||||
#define ENTRY(name) \
|
||||
.globl EXT_C(name); \
|
||||
.align 4; \
|
||||
.ent EXT_C(name), 0; \
|
||||
EXT_C(name): \
|
||||
.frame sp, 0, ra
|
||||
|
||||
|
||||
GRUB_MOD_LICENSE "GPLv3+"
|
||||
|
||||
.text
|
||||
|
||||
ENTRY(grub_setjmp)
|
||||
ldgp gp, 0(pv)
|
||||
|
||||
#ifndef PIC
|
||||
#define FRAME 16
|
||||
subq sp, FRAME, sp
|
||||
.frame sp, FRAME, ra, 0
|
||||
stq ra, 0(sp)
|
||||
.mask 0x04000000, -FRAME
|
||||
#else
|
||||
#define FRAME 0
|
||||
.frame sp, FRAME, ra, 0
|
||||
#endif
|
||||
#ifdef PROF
|
||||
.set noat
|
||||
lda AT, _mcount
|
||||
jsr AT, (AT), _mcount
|
||||
.set at
|
||||
#endif
|
||||
|
||||
.prologue 1
|
||||
mov 0, a1
|
||||
|
||||
stq s0, JB_S0*8(a0)
|
||||
stq s1, JB_S1*8(a0)
|
||||
stq s2, JB_S2*8(a0)
|
||||
stq s3, JB_S3*8(a0)
|
||||
stq s4, JB_S4*8(a0)
|
||||
stq s5, JB_S5*8(a0)
|
||||
#ifdef PTR_MANGLE
|
||||
PTR_MANGLE(t1, ra, t0)
|
||||
stq t1, JB_PC*8(a0)
|
||||
#else
|
||||
stq ra, JB_PC*8(a0)
|
||||
#endif
|
||||
#if defined(PTR_MANGLE) && FRAME == 0
|
||||
PTR_MANGLE2(t1, sp, t0)
|
||||
#else
|
||||
addq sp, FRAME, t1
|
||||
# ifdef PTR_MANGLE
|
||||
PTR_MANGLE2(t1, t1, t0)
|
||||
# endif
|
||||
#endif
|
||||
stq t1, JB_SP*8(a0)
|
||||
#ifdef PTR_MANGLE
|
||||
PTR_MANGLE2(t1, fp, t0)
|
||||
stq t1, JB_FP*8(a0)
|
||||
#else
|
||||
stq fp, JB_FP*8(a0)
|
||||
#endif
|
||||
stt $f2, JB_F2*8(a0)
|
||||
stt $f3, JB_F3*8(a0)
|
||||
stt $f4, JB_F4*8(a0)
|
||||
stt $f5, JB_F5*8(a0)
|
||||
stt $f6, JB_F6*8(a0)
|
||||
stt $f7, JB_F7*8(a0)
|
||||
stt $f8, JB_F8*8(a0)
|
||||
stt $f9, JB_F9*8(a0)
|
||||
|
||||
mov 0, v0
|
||||
ret
|
||||
|
||||
.end grub_setjmp
|
||||
|
||||
ENTRY(grub_longjmp)
|
||||
#ifdef PROF
|
||||
ldgp gp, 0(pv)
|
||||
.set noat
|
||||
lda AT, _mcount
|
||||
jsr AT, (AT), _mcount
|
||||
.set at
|
||||
.prologue 1
|
||||
#else
|
||||
.prologue 0
|
||||
#endif
|
||||
|
||||
mov a1, v0
|
||||
ldq s0, JB_S0*8(a0)
|
||||
ldq s1, JB_S1*8(a0)
|
||||
ldq s2, JB_S2*8(a0)
|
||||
ldq s3, JB_S3*8(a0)
|
||||
ldq s4, JB_S4*8(a0)
|
||||
ldq s5, JB_S5*8(a0)
|
||||
ldq ra, JB_PC*8(a0)
|
||||
ldq fp, JB_FP*8(a0)
|
||||
ldq t0, JB_SP*8(a0)
|
||||
ldt $f2, JB_F2*8(a0)
|
||||
ldt $f3, JB_F3*8(a0)
|
||||
ldt $f4, JB_F4*8(a0)
|
||||
ldt $f5, JB_F5*8(a0)
|
||||
ldt $f6, JB_F6*8(a0)
|
||||
ldt $f7, JB_F7*8(a0)
|
||||
ldt $f8, JB_F8*8(a0)
|
||||
ldt $f9, JB_F9*8(a0)
|
||||
#ifdef PTR_DEMANGLE
|
||||
PTR_DEMANGLE(ra, t1)
|
||||
PTR_DEMANGLE2(t0, t1)
|
||||
PTR_DEMANGLE2(fp, t1)
|
||||
#endif
|
||||
cmoveq v0, 1, v0
|
||||
mov t0, sp
|
||||
ret
|
||||
|
||||
.end EXT_C(grub_longjmp)
|
||||
37
grub-core/lib/alpha/srm/datetime.c
Normal file
37
grub-core/lib/alpha/srm/datetime.c
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2011 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/datetime.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
grub_err_t
|
||||
grub_get_datetime (struct grub_datetime *datetime __attribute__ ((unused)))
|
||||
{
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"getting time isn't supported");
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_set_datetime (struct grub_datetime *datetime __attribute__ ((unused)))
|
||||
{
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"setting time isn't supported");
|
||||
}
|
||||
25
grub-core/lib/alpha/srm/halt.c
Normal file
25
grub-core/lib/alpha/srm/halt.c
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2011 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/misc.h>
|
||||
|
||||
void
|
||||
grub_halt (void)
|
||||
{
|
||||
while (1);
|
||||
}
|
||||
25
grub-core/lib/alpha/srm/reboot.c
Normal file
25
grub-core/lib/alpha/srm/reboot.c
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2013 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/misc.h>
|
||||
|
||||
void
|
||||
grub_reboot (void)
|
||||
{
|
||||
while (1);
|
||||
}
|
||||
@@ -170,7 +170,7 @@ MA 02111-1307, USA. */
|
||||
(pl) = __m0 * __m1; \
|
||||
} while (0)
|
||||
#define UMUL_TIME 46
|
||||
#ifndef LONGLONG_STANDALONE
|
||||
#if 0
|
||||
#define udiv_qrnnd(q, r, n1, n0, d) \
|
||||
do { UDItype __r; \
|
||||
(q) = __udiv_qrnnd (&__r, (n1), (n0), (d)); \
|
||||
@@ -383,7 +383,7 @@ extern UDItype __udiv_qrnnd ();
|
||||
#define UMUL_TIME 40
|
||||
#define UDIV_TIME 80
|
||||
#endif
|
||||
#ifndef LONGLONG_STANDALONE
|
||||
#if 0
|
||||
#define udiv_qrnnd(q, r, n1, n0, d) \
|
||||
do { USItype __r; \
|
||||
(q) = __udiv_qrnnd (&__r, (n1), (n0), (d)); \
|
||||
@@ -1329,7 +1329,7 @@ typedef unsigned int UTItype __attribute__ ((mode (TI)));
|
||||
#define UMUL_TIME 39 /* 39 instructions */
|
||||
#endif
|
||||
#ifndef udiv_qrnnd
|
||||
#ifndef LONGLONG_STANDALONE
|
||||
#if 0
|
||||
#define udiv_qrnnd(q, r, n1, n0, d) \
|
||||
do { USItype __r; \
|
||||
(q) = __udiv_qrnnd (&__r, (n1), (n0), (d)); \
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "./ia64/longjmp.S"
|
||||
#elif defined(__arm__)
|
||||
#include "./arm/setjmp.S"
|
||||
#elif defined(__alpha__)
|
||||
#include "./alpha/setjmp.S"
|
||||
#else
|
||||
#error "Unknown target cpu type"
|
||||
#endif
|
||||
|
||||
@@ -40,7 +40,8 @@ grub_get_weekday (struct grub_datetime *datetime)
|
||||
y = datetime->year - a;
|
||||
m = datetime->month + 12 * a - 2;
|
||||
|
||||
return (datetime->day + y + y / 4 - y / 100 + y / 400 + (31 * m / 12)) % 7;
|
||||
return ((unsigned)(datetime->day + y + y / 4 - y / 100 + y / 400
|
||||
+ (31 * m / 12))) % 7;
|
||||
}
|
||||
|
||||
const char *
|
||||
|
||||
117
grub-core/term/alpha/srm/console.c
Normal file
117
grub-core/term/alpha/srm/console.c
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2011 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/machine/srm.h>
|
||||
#include <grub/machine/console.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/terminfo.h>
|
||||
|
||||
static int
|
||||
readkey (struct grub_term_input *term __attribute__ ((unused)))
|
||||
{
|
||||
grub_uint64_t c;
|
||||
c = grub_alpha_srm_dispatch (GRUB_ALPHA_SRM_GETC, 0);
|
||||
if (c & (1ULL << 63))
|
||||
return -1;
|
||||
|
||||
return c & 0xffffffff;
|
||||
}
|
||||
|
||||
#define NEWLINE " \r\n "
|
||||
|
||||
static void
|
||||
put (struct grub_term_output *term __attribute__ ((unused)), const int c)
|
||||
{
|
||||
char chr = c;
|
||||
|
||||
if (c == '\n')
|
||||
{
|
||||
const char *str = NEWLINE, *ptr;
|
||||
for (ptr = str; ptr < str + sizeof (NEWLINE) - 1; )
|
||||
ptr += (grub_alpha_srm_dispatch (GRUB_ALPHA_SRM_PUTS, 0, ptr,
|
||||
str + sizeof (NEWLINE) - 1 - ptr)
|
||||
& 0xff);
|
||||
return;
|
||||
}
|
||||
|
||||
grub_alpha_srm_dispatch (GRUB_ALPHA_SRM_PUTS, 0, &chr, 1);
|
||||
}
|
||||
|
||||
static struct grub_terminfo_output_state grub_console_terminfo_output;
|
||||
|
||||
static grub_err_t
|
||||
grub_console_init_output (struct grub_term_output *term)
|
||||
{
|
||||
/* FIXME: get dimensions. */
|
||||
grub_terminfo_output_init (term);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct grub_terminfo_input_state grub_console_terminfo_input =
|
||||
{
|
||||
.readkey = readkey
|
||||
};
|
||||
|
||||
static struct grub_terminfo_output_state grub_console_terminfo_output =
|
||||
{
|
||||
.put = put,
|
||||
.size = { 80, 24 }
|
||||
};
|
||||
|
||||
static struct grub_term_input grub_console_term_input =
|
||||
{
|
||||
.name = "console",
|
||||
.init = grub_terminfo_input_init,
|
||||
.getkey = grub_terminfo_getkey,
|
||||
.data = &grub_console_terminfo_input
|
||||
};
|
||||
|
||||
static struct grub_term_output grub_console_term_output =
|
||||
{
|
||||
.name = "console",
|
||||
.init = grub_console_init_output,
|
||||
.putchar = grub_terminfo_putchar,
|
||||
.getxy = grub_terminfo_getxy,
|
||||
.getwh = grub_terminfo_getwh,
|
||||
.gotoxy = grub_terminfo_gotoxy,
|
||||
.cls = grub_terminfo_cls,
|
||||
.setcolorstate = grub_terminfo_setcolorstate,
|
||||
.setcursor = grub_terminfo_setcursor,
|
||||
.flags = GRUB_TERM_CODE_TYPE_ASCII,
|
||||
.data = &grub_console_terminfo_output,
|
||||
.progress_update_divisor = GRUB_PROGRESS_FAST
|
||||
};
|
||||
|
||||
void
|
||||
grub_console_init_early (void)
|
||||
{
|
||||
grub_alpha_srm_dispatch (GRUB_ALPHA_SRM_OPEN_CONSOLE);
|
||||
|
||||
grub_term_register_input ("console", &grub_console_term_input);
|
||||
grub_term_register_output ("console", &grub_console_term_output);
|
||||
}
|
||||
|
||||
void
|
||||
grub_console_init_lately (void)
|
||||
{
|
||||
grub_terminfo_init ();
|
||||
/* FIXME */
|
||||
grub_terminfo_output_register (&grub_console_term_output, "srm");
|
||||
}
|
||||
|
||||
@@ -143,6 +143,19 @@ grub_terminfo_set_current (struct grub_term_output *term,
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
if (grub_strcmp ("srm", str) == 0)
|
||||
{
|
||||
data->name = grub_strdup ("srm");
|
||||
data->gotoxy = grub_strdup ("\e[%i%p1%d;%p2%dH");
|
||||
data->cls = grub_strdup ("\e[2J");
|
||||
data->reverse_video_on = grub_strdup ("\e[7m");
|
||||
data->reverse_video_off = grub_strdup ("\e[0m");
|
||||
data->cursor_on = grub_strdup ("\e[?25h");
|
||||
data->cursor_off = grub_strdup ("\e[?25l");
|
||||
data->setcolor = 0;
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
if (grub_strcmp ("ieee1275", str) == 0
|
||||
|| grub_strcmp ("ieee1275-nocursor", str) == 0)
|
||||
{
|
||||
|
||||
@@ -614,13 +614,13 @@ tparam_internal(const char *string, va_list ap)
|
||||
case '/':
|
||||
y = npop();
|
||||
x = npop();
|
||||
npush(y ? (x / y) : 0);
|
||||
npush(y ? ((unsigned) x / (unsigned) y) : 0);
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
y = npop();
|
||||
x = npop();
|
||||
npush(y ? (x % y) : 0);
|
||||
npush(y ? ((unsigned) x % (unsigned) y) : 0);
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
|
||||
5
include/grub/alpha/divide.h
Normal file
5
include/grub/alpha/divide.h
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
void EXPORT_FUNC (__remlu) (void);
|
||||
void EXPORT_FUNC (__remqu) (void);
|
||||
void EXPORT_FUNC (__divqu) (void);
|
||||
void EXPORT_FUNC (__divlu) (void);
|
||||
28
include/grub/alpha/setjmp.h
Normal file
28
include/grub/alpha/setjmp.h
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2004,2006,2007,2009 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_SETJMP_CPU_HEADER
|
||||
#define GRUB_SETJMP_CPU_HEADER 1
|
||||
|
||||
typedef long int grub_jmp_buf[17];
|
||||
|
||||
int grub_setjmp (grub_jmp_buf env) RETURNS_TWICE;
|
||||
void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));
|
||||
|
||||
#endif /* ! GRUB_SETJMP_CPU_HEADER */
|
||||
31
include/grub/alpha/srm/console.h
Normal file
31
include/grub/alpha/srm/console.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2011 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_CONSOLE_MACHINE_HEADER
|
||||
#define GRUB_CONSOLE_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
/* Initialize the console system. */
|
||||
void grub_console_init_early (void);
|
||||
void grub_console_init_lately (void);
|
||||
|
||||
/* Finish the console system. */
|
||||
void grub_console_fini (void);
|
||||
|
||||
#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */
|
||||
104
include/grub/alpha/srm/srm.h
Normal file
104
include/grub/alpha/srm/srm.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2011 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_SRM_HEADER
|
||||
#define GRUB_SRM_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
|
||||
grub_uint64_t grub_alpha_srm_dispatch (int code, ...);
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_ALPHA_SRM_GETC = 1,
|
||||
GRUB_ALPHA_SRM_PUTS = 2,
|
||||
GRUB_ALPHA_SRM_OPEN_CONSOLE = 7,
|
||||
GRUB_ALPHA_SRM_OPEN = 0x10,
|
||||
GRUB_ALPHA_SRM_CLOSE = 0x11,
|
||||
GRUB_ALPHA_SRM_READ = 0x13,
|
||||
GRUB_ALPHA_GET_ENV = 0x22
|
||||
};
|
||||
|
||||
typedef grub_uint64_t grub_srm_fileno_t;
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_ALPHA_SRM_ENV_TTY = 0x0f
|
||||
};
|
||||
|
||||
enum grub_alpha_srm_memdesc_entry_type
|
||||
{
|
||||
GRUB_ALPHA_SRM_MEMDESC_ENTRY_TYPE_AVAILABLE = 0,
|
||||
GRUB_ALPHA_SRM_MEMDESC_ENTRY_TYPE_NONVOLATILE = 1,
|
||||
GRUB_ALPHA_SRM_MEMDESC_ENTRY_TYPE_RESERVED1 = 2,
|
||||
GRUB_ALPHA_SRM_MEMDESC_ENTRY_TYPE_RESERVED2 = 3,
|
||||
};
|
||||
|
||||
struct grub_alpha_srm_memdesc_entry
|
||||
{
|
||||
grub_uint64_t start_page;
|
||||
grub_uint64_t num_pages;
|
||||
grub_uint64_t unused[4];
|
||||
grub_uint64_t type;
|
||||
};
|
||||
|
||||
struct grub_alpha_srm_memdesc
|
||||
{
|
||||
grub_uint64_t checksum;
|
||||
grub_uint64_t unused;
|
||||
grub_uint64_t num_entries;
|
||||
struct grub_alpha_srm_memdesc_entry entries[0];
|
||||
};
|
||||
|
||||
struct grub_alpha_srm_hwrpb
|
||||
{
|
||||
grub_uint64_t paddr;
|
||||
char magic[8];
|
||||
grub_uint64_t hwrpb_version;
|
||||
grub_uint64_t hwrpb_size;
|
||||
grub_uint64_t primary_cpu_id;
|
||||
grub_uint64_t page_size;
|
||||
grub_uint64_t unused1[14 - 6];
|
||||
grub_uint64_t pcc_freq;
|
||||
grub_uint64_t unused2[4];
|
||||
grub_uint64_t cpu_slot_size;
|
||||
grub_uint64_t cpu_slots_offset;
|
||||
grub_uint64_t unused3[4];
|
||||
grub_uint64_t memory_descriptor_table;
|
||||
grub_uint64_t unused4[30-26];
|
||||
grub_uint64_t vptb;
|
||||
grub_uint64_t unused5[72 - 31];
|
||||
grub_uint64_t checksum;
|
||||
};
|
||||
|
||||
struct grub_alpha_srm_hwpcb
|
||||
{
|
||||
grub_uint64_t ksp;
|
||||
grub_uint64_t esp;
|
||||
grub_uint64_t ssp;
|
||||
grub_uint64_t usp;
|
||||
grub_uint64_t ptbr;
|
||||
};
|
||||
|
||||
#define GRUB_ALPHA_SRM_HWRPB_ADDR 0x10000000
|
||||
#define GRUB_ALPHA_SRM_HWRPB (*(struct grub_alpha_srm_hwrpb *) GRUB_ALPHA_SRM_HWRPB_ADDR)
|
||||
|
||||
void grub_srmdisk_init (void);
|
||||
void grub_srmdisk_fini (void);
|
||||
|
||||
#endif
|
||||
22
include/grub/alpha/srm/time.h
Normal file
22
include/grub/alpha/srm/time.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2011 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef KERNEL_MACHINE_TIME_HEADER
|
||||
#define KERNEL_MACHINE_TIME_HEADER 1
|
||||
|
||||
#endif
|
||||
37
include/grub/alpha/time.h
Normal file
37
include/grub/alpha/time.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2011 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef KERNEL_CPU_TIME_HEADER
|
||||
#define KERNEL_CPU_TIME_HEADER 1
|
||||
|
||||
static inline void
|
||||
grub_cpu_idle(void)
|
||||
{
|
||||
}
|
||||
#ifndef GRUB_UTIL
|
||||
|
||||
#define GRUB_TICKS_PER_SECOND (grub_arch_pccclock)
|
||||
|
||||
/* Return the real time in ticks. */
|
||||
grub_uint64_t EXPORT_FUNC (grub_get_rtc) (void);
|
||||
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_pccclock);
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
31
include/grub/alpha/types.h
Normal file
31
include/grub/alpha/types.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2011 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_TYPES_CPU_HEADER
|
||||
#define GRUB_TYPES_CPU_HEADER 1
|
||||
|
||||
/* The size of void *. */
|
||||
#define GRUB_TARGET_SIZEOF_VOID_P 8
|
||||
|
||||
/* The size of long. */
|
||||
#define GRUB_TARGET_SIZEOF_LONG 8
|
||||
|
||||
/* alpha is little-endian (usually). */
|
||||
#undef GRUB_TARGET_WORDS_BIGENDIAN
|
||||
|
||||
#endif /* ! GRUB_TYPES_CPU_HEADER */
|
||||
@@ -33,6 +33,8 @@ grub_arch_sync_caches (void *address __attribute__ ((unused)),
|
||||
grub_size_t len __attribute__ ((unused)))
|
||||
{
|
||||
}
|
||||
#elif defined (__alpha__)
|
||||
void EXPORT_FUNC(grub_arch_sync_all_caches) (void);
|
||||
#else
|
||||
void EXPORT_FUNC(grub_arch_sync_caches) (void *address, grub_size_t len);
|
||||
#endif
|
||||
|
||||
@@ -48,6 +48,7 @@ enum grub_disk_dev_id
|
||||
GRUB_DISK_DEVICE_PROCFS_ID,
|
||||
GRUB_DISK_DEVICE_CBFSDISK_ID,
|
||||
GRUB_DISK_DEVICE_UBOOTDISK_ID,
|
||||
GRUB_DISK_DEVICE_SRMDISK_ID,
|
||||
};
|
||||
|
||||
struct grub_disk;
|
||||
|
||||
@@ -179,7 +179,7 @@ struct grub_dl
|
||||
Elf_Sym *symtab;
|
||||
void (*init) (struct grub_dl *mod);
|
||||
void (*fini) (void);
|
||||
#if defined (__ia64__) || defined (__powerpc__)
|
||||
#if defined (__ia64__) || defined (__alpha__) || defined (__powerpc__)
|
||||
void *got;
|
||||
void *tramp;
|
||||
#endif
|
||||
@@ -264,6 +264,12 @@ grub_arch_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
||||
#define GRUB_ARCH_DL_GOT_ALIGN 4
|
||||
#endif
|
||||
|
||||
#ifdef __alpha__
|
||||
#define GRUB_ARCH_DL_TRAMP_SIZE 0
|
||||
#define GRUB_ARCH_DL_TRAMP_ALIGN 16
|
||||
#define GRUB_ARCH_DL_GOT_ALIGN 16
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_DL_H */
|
||||
|
||||
@@ -1819,7 +1819,7 @@ typedef Elf32_Addr Elf32_Conflict;
|
||||
#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */
|
||||
#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */
|
||||
#define R_ALPHA_RELATIVE 27 /* Adjust by program base */
|
||||
#define R_ALPHA_TLS_GD_HI 28
|
||||
#define R_ALPHA_BRSGP 28
|
||||
#define R_ALPHA_TLSGD 29
|
||||
#define R_ALPHA_TLS_LDM 30
|
||||
#define R_ALPHA_DTPMOD64 31
|
||||
|
||||
@@ -78,8 +78,9 @@ struct grub_module_info64
|
||||
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) \
|
||||
|| defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) \
|
||||
|| defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_ARC) \
|
||||
|| defined (__sparc__) || defined (GRUB_MACHINE_UBOOT)
|
||||
/* FIXME: stack is between 2 heap regions. Move it. */
|
||||
|| defined (__sparc__) || defined (GRUB_MACHINE_UBOOT) \
|
||||
|| defined (GRUB_MACHINE_ALPHA_SRM)
|
||||
/* FIXME: stack is between 2 heap regions on sparc. Move it. */
|
||||
#define GRUB_KERNEL_PRELOAD_SPACE_REUSABLE 1
|
||||
#endif
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ typedef enum grub_memory_type
|
||||
GRUB_MEMORY_BADRAM = 5,
|
||||
GRUB_MEMORY_COREBOOT_TABLES = 16,
|
||||
GRUB_MEMORY_CODE = 20,
|
||||
GRUB_MEMORY_NVRAM = 22,
|
||||
/* This one is special: it's used internally but is never reported
|
||||
by firmware. Don't use -1 as it's used internally for other purposes. */
|
||||
GRUB_MEMORY_HOLE = -2,
|
||||
|
||||
@@ -90,6 +90,8 @@
|
||||
|
||||
#define GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE 0x08
|
||||
|
||||
#define GRUB_KERNEL_ALPHA_SRM_TOTAL_MODULE_SIZE 0x80
|
||||
|
||||
#define GRUB_KERNEL_I386_COREBOOT_LINK_ADDR 0x8200
|
||||
#define GRUB_KERNEL_I386_COREBOOT_MODULES_ADDR 0x100000
|
||||
|
||||
|
||||
1
stubs.txt
Normal file
1
stubs.txt
Normal file
@@ -0,0 +1 @@
|
||||
halt, exit, reboot, datetime, setjmp, console dimension, bootlocation
|
||||
@@ -66,7 +66,7 @@ struct grub_install_image_target_desc
|
||||
IMAGE_I386_IEEE1275,
|
||||
IMAGE_LOONGSON_ELF, IMAGE_QEMU, IMAGE_PPC, IMAGE_YEELOONG_FLASH,
|
||||
IMAGE_FULOONG2F_FLASH, IMAGE_I386_PC_PXE, IMAGE_MIPS_ARC,
|
||||
IMAGE_QEMU_MIPS_FLASH, IMAGE_UBOOT
|
||||
IMAGE_QEMU_MIPS_FLASH, IMAGE_UBOOT, IMAGE_ALPHA_SRM
|
||||
} id;
|
||||
enum
|
||||
{
|
||||
@@ -524,6 +524,18 @@ static const struct grub_install_image_target_desc image_targets[] =
|
||||
.pe_target = GRUB_PE32_MACHINE_ARMTHUMB_MIXED,
|
||||
.elf_target = EM_ARM,
|
||||
},
|
||||
{
|
||||
.dirname = "alpha-srm",
|
||||
.names = {"alpha-srm", NULL},
|
||||
.voidp_sizeof = 8,
|
||||
.bigendian = 0,
|
||||
.id = IMAGE_ALPHA_SRM,
|
||||
.flags = PLATFORM_FLAGS_NONE,
|
||||
.total_module_size = GRUB_KERNEL_ALPHA_SRM_TOTAL_MODULE_SIZE,
|
||||
.section_align = 8,
|
||||
.vaddr_offset = 0,
|
||||
.elf_target = EM_ALPHA,
|
||||
},
|
||||
};
|
||||
|
||||
#define grub_target_to_host32(x) (grub_target_to_host32_real (image_target, (x)))
|
||||
@@ -1143,10 +1155,16 @@ grub_install_generate_image (const char *dir, const char *prefix,
|
||||
case IMAGE_PPC:
|
||||
case IMAGE_UBOOT:
|
||||
break;
|
||||
|
||||
/* No idea. */
|
||||
case IMAGE_ALPHA_SRM:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (image_target->id)
|
||||
{
|
||||
case IMAGE_ALPHA_SRM:
|
||||
break;
|
||||
case IMAGE_I386_PC:
|
||||
case IMAGE_I386_PC_PXE:
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user