aboutsummaryrefslogtreecommitdiff
path: root/tip22
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-06-19 14:17:53 +0200
committerGuido Günther <agx@sigxcpu.org>2011-06-19 14:29:03 +0200
commitbb6bd2f7ea37c471c9a6747e1473c7ad1f00a499 (patch)
tree1ca093019ea99b2a358243fad64e6284cf77b21e /tip22
parent83171b606a49b7e7b68c86901a12f7e5eded96aa (diff)
Reduced amount of #ifdef'ed code
Diffstat (limited to 'tip22')
-rw-r--r--tip22/tftpload.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/tip22/tftpload.c b/tip22/tftpload.c
index 37ca7d1..a41b051 100644
--- a/tip22/tftpload.c
+++ b/tip22/tftpload.c
@@ -18,6 +18,7 @@
#include <version.h>
#include <subarch.h>
+#include <debug.h>
#define KSEG0ADDR(addr) (((addr) & 0x1fffffff) | 0x80000000)
@@ -63,9 +64,7 @@ static void InitMalloc(void)
{
MEMORYDESCRIPTOR *current = NULL;
ULONG stack = (ULONG) & current;
-#ifdef DEBUG
- printf("stack starts at: 0x%lx\n\r", stack);
-#endif
+ debug_printf("stack starts at: 0x%lx\n\r", stack);
current = ArcGetMemoryDescriptor(current);
if(! current ) {
@@ -83,10 +82,8 @@ static void InitMalloc(void)
ULONG start = KSEG0ADDR(current->BasePage * PAGE_SIZE);
ULONG end =
start + (current->PageCount * PAGE_SIZE);
-#if DEBUG
- printf("Free Memory(%u) segment found at (0x%lx,0x%lx).\n\r",
+ debug_printf("Free Memory(%u) segment found at (0x%lx,0x%lx).\n\r",
current->Type, start, end);
-#endif
/* Leave some space for our stack */
if ((stack >= start) && (stack < end))
@@ -105,10 +102,8 @@ static void InitMalloc(void)
+ kernel_load[SUBARCH].reserved )))
end = kernel_load[SUBARCH].base;
if (end > start) {
-#ifdef DEBUG
- printf("Adding %lu bytes at 0x%lx to the list of available memory\n\r",
+ debug_printf("Adding %lu bytes at 0x%lx to the list of available memory\n\r",
end-start, start);
-#endif
arclib_malloc_add(start, end - start);
}
}
@@ -302,21 +297,21 @@ void _start(LONG argc, CHAR * argv[], CHAR * envp[])
void (*kernel_entry)(int argc, CHAR * argv[], CHAR * envp[]);
/* Print identification */
+ printf(ANSI_CLEAR "\n\r"
#if (SUBARCH == IP22)
- printf(ANSI_CLEAR "\n\rtip22: IP22 Linux tftpboot loader " __ARCSBOOT_VERSION__ "\n\r");
+ "tip22: IP22"
#elif (SUBARCH == IP32)
- printf(ANSI_CLEAR "\n\rtip32: IP32 Linux tftpboot loader " __ARCSBOOT_VERSION__ "\n\r");
+ "tip32: IP32"
#endif
+ " Linux tftpboot loader " __ARCSBOOT_VERSION__ "\n\r");
InitMalloc();
/* copy kernel and ramdisk to its load addresses */
-#ifdef DEBUG
- printf("Embedded kernel image starts 0x%p, ends 0x%p\n\r",
+ debug_printf("Embedded kernel image starts 0x%p, ends 0x%p\n\r",
&__kernel_start, &__kernel_end);
- printf("Embedded ramdisk image starts 0x%p, ends 0x%p\n\r",
+ debug_printf("Embedded ramdisk image starts 0x%p, ends 0x%p\n\r",
&__rd_start, &__rd_end);
-#endif
kernel_entry = (void (*)(int, CHAR *[], CHAR *[]))CopyKernel(&kernel_end);
/* align to page boundary */
@@ -343,8 +338,8 @@ void _start(LONG argc, CHAR * argv[], CHAR * envp[])
nargc++;
}
+ debug_printf("Arguments passed to kernel:\n\r");
#ifdef DEBUG
- printf("Arguments passed to kernel:\n\r");
for(i = 0; i < nargc; i++ )
printf("%u: %s\n\r", i, nargv[i]);
Wait("\n\r--- Debug: press <spacebar> to boot kernel ---");