summaryrefslogtreecommitdiffstats
path: root/arch/alpha/boot/main.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-01-07 02:33:00 +0000
committer <ralf@linux-mips.org>1997-01-07 02:33:00 +0000
commitbeb116954b9b7f3bb56412b2494b562f02b864b1 (patch)
tree120e997879884e1b9d93b265221b939d2ef1ade1 /arch/alpha/boot/main.c
parent908d4681a1dc3792ecafbe64265783a86c4cccb6 (diff)
Import of Linux/MIPS 2.1.14
Diffstat (limited to 'arch/alpha/boot/main.c')
-rw-r--r--arch/alpha/boot/main.c53
1 files changed, 40 insertions, 13 deletions
diff --git a/arch/alpha/boot/main.c b/arch/alpha/boot/main.c
index d122eb6f6..c2d4e657e 100644
--- a/arch/alpha/boot/main.c
+++ b/arch/alpha/boot/main.c
@@ -13,9 +13,12 @@
#include <asm/system.h>
#include <asm/console.h>
#include <asm/hwrpb.h>
+#include <asm/pgtable.h>
#include <stdarg.h>
+#include "ksize.h"
+
extern int vsprintf(char *, const char *, va_list);
extern unsigned long switch_to_osf_pal(unsigned long nr,
struct pcb_struct * pcb_va, struct pcb_struct * pcb_pa,
@@ -24,13 +27,36 @@ extern unsigned long switch_to_osf_pal(unsigned long nr,
int printk(const char * fmt, ...)
{
va_list args;
- int i;
+ int i, j, written, remaining, num_nl;
static char buf[1024];
+ char * str;
va_start(args, fmt);
i = vsprintf(buf, fmt, args);
va_end(args);
- puts(buf,i);
+
+ /* expand \n into \r\n: */
+
+ num_nl = 0;
+ for (j = 0; j < i; ++j) {
+ if (buf[j] == '\n')
+ ++num_nl;
+ }
+ remaining = i + num_nl;
+ for (j = i - 1; j >= 0; --j) {
+ buf[j + num_nl] = buf[j];
+ if (buf[j] == '\n') {
+ --num_nl;
+ buf[j + num_nl] = '\r';
+ }
+ }
+
+ str = buf;
+ do {
+ written = puts(str, remaining);
+ remaining -= written;
+ str += written;
+ } while (remaining > 0);
return i;
}
@@ -125,11 +151,9 @@ void pal_init(void)
printk("Ok (rev %lx)\n", rev);
/* remove the old virtual page-table mapping */
L1[1] = 0;
- invalidate_all();
+ flush_tlb_all();
}
-extern int _end;
-
static inline long openboot(void)
{
char bootdev[256];
@@ -149,7 +173,8 @@ static inline long close(long dev)
static inline long load(long dev, unsigned long addr, unsigned long count)
{
char bootfile[256];
- long result;
+ extern char _end;
+ long result, boot_size = &_end - (char *) BOOT_ADDR;
result = dispatch(CCB_GET_ENV, ENV_BOOTED_FILE, bootfile, 255);
if (result < 0)
@@ -157,8 +182,9 @@ static inline long load(long dev, unsigned long addr, unsigned long count)
result &= 255;
bootfile[result] = '\0';
if (result)
- printk("Boot file specification (%s) not implemented\n", bootfile);
- return dispatch(CCB_READ, dev, count, addr, BOOT_SIZE/512 + 1);
+ printk("Boot file specification (%s) not implemented\n",
+ bootfile);
+ return dispatch(CCB_READ, dev, count, addr, boot_size/512 + 1);
}
/*
@@ -195,19 +221,20 @@ void start_kernel(void)
}
dev &= 0xffffffff;
printk("Loading vmlinux ...");
- i = load(dev, START_ADDR, START_SIZE);
+ i = load(dev, START_ADDR, KERNEL_SIZE);
close(dev);
- if (i != START_SIZE) {
+ if (i != KERNEL_SIZE) {
printk("Failed (%lx)\n", i);
return;
}
nbytes = dispatch(CCB_GET_ENV, ENV_BOOTED_OSFLAGS,
envval, sizeof(envval));
- if (nbytes > 0) {
- envval[nbytes] = '\0';
- strcpy((char*)ZERO_PGE, envval);
+ if (nbytes < 0) {
+ nbytes = 0;
}
+ envval[nbytes] = '\0';
+ strcpy((char*)ZERO_PAGE, envval);
printk(" Ok\nNow booting the kernel\n");
runkernel();