Commit 82d96bf6 authored by Helge Deller's avatar Helge Deller

parisc: PA-Linux requires at least 32 MB RAM

Even a 32-bit kernel requires at least 27 MB to decompress itself, so
halt the system with a message if the system has less memory than 32 MB.
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
parent b4387490
...@@ -145,14 +145,13 @@ static int putchar(int c) ...@@ -145,14 +145,13 @@ static int putchar(int c)
void __noreturn error(char *x) void __noreturn error(char *x)
{ {
puts("\n\n"); if (x) puts(x);
puts(x); puts("\n -- System halted\n");
puts("\n\n -- System halted");
while (1) /* wait forever */ while (1) /* wait forever */
; ;
} }
static int print_hex(unsigned long num) static int print_num(unsigned long num, int base)
{ {
const char hex[] = "0123456789abcdef"; const char hex[] = "0123456789abcdef";
char str[40]; char str[40];
...@@ -160,12 +159,14 @@ static int print_hex(unsigned long num) ...@@ -160,12 +159,14 @@ static int print_hex(unsigned long num)
str[i--] = '\0'; str[i--] = '\0';
do { do {
str[i--] = hex[num & 0x0f]; str[i--] = hex[num % base];
num >>= 4; num = num / base;
} while (num); } while (num);
str[i--] = 'x'; if (base == 16) {
str[i] = '0'; str[i--] = 'x';
str[i] = '0';
} else i++;
puts(&str[i]); puts(&str[i]);
return 0; return 0;
...@@ -187,8 +188,9 @@ int printf(const char *fmt, ...) ...@@ -187,8 +188,9 @@ int printf(const char *fmt, ...)
if (fmt[++i] == '%') if (fmt[++i] == '%')
goto put; goto put;
print_num(va_arg(args, unsigned long),
fmt[i] == 'x' ? 16:10);
++i; ++i;
print_hex(va_arg(args, unsigned long));
} }
va_end(args); va_end(args);
...@@ -327,8 +329,15 @@ unsigned long decompress_kernel(unsigned int started_wide, ...@@ -327,8 +329,15 @@ unsigned long decompress_kernel(unsigned int started_wide,
free_mem_end_ptr = rd_start; free_mem_end_ptr = rd_start;
#endif #endif
if (free_mem_ptr >= free_mem_end_ptr) if (free_mem_ptr >= free_mem_end_ptr) {
error("Kernel too big for machine."); int free_ram;
free_ram = (free_mem_ptr >> 20) + 1;
if (free_ram < 32)
free_ram = 32;
printf("\nKernel requires at least %d MB RAM.\n",
free_ram);
error(NULL);
}
#ifdef DEBUG #ifdef DEBUG
printf("\n"); printf("\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment