From 02e50b9149b37f6a54c12d434e74d03aa1a917bf Mon Sep 17 00:00:00 2001 From: Michael Neuling Date: Thu, 28 May 2015 20:25:53 +1000 Subject: test/hello_world: Cleanup code Document it a lot more. Remove magic numbers. Remove include file. Make it more flexible. ... and most importantly remove the horrendous bloat. From 17 instructions down to 10! Signed-off-by: Michael Neuling Signed-off-by: Stewart Smith --- test/hello_world/hello_kernel/hello_kernel.S | 32 +++++++++++++--------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'test') diff --git a/test/hello_world/hello_kernel/hello_kernel.S b/test/hello_world/hello_kernel/hello_kernel.S index 41946a5..cd1d744 100644 --- a/test/hello_world/hello_kernel/hello_kernel.S +++ b/test/hello_world/hello_kernel/hello_kernel.S @@ -14,8 +14,6 @@ * limitations under the License. */ -#include - /* hello_kernel.S! --------------- @@ -25,26 +23,26 @@ */ - . = 0x0 .globl _start _start: - mr 2, 8 - li 0, 1 /* OPAL_CONSOLE_WRITE */ - li 3, 0 /* terminal 0 */ - LOAD_IMM64(29, 0x20010000) - lis 4, len@ha - addi 4,4, len@l - add 4,4,29 - lis 5, str@ha - addi 5,5, str@l - add 5,5,29 - mtctr 9 + mr %r2, %r8 /* r8 is the OPAL base passed in by skiboot */ + + bl here +here: mflr %r8 /* work out where we are running */ + + li %r0, 1 /* OPAL_CONSOLE_WRITE */ + li %r3, 0 /* terminal 0 */ + addi %r4, %r8, len - here /* ptr to length of string */ + addi %r5, %r8, str - here /* ptr to string start */ + + mtctr %r9 /* R9 is the OPAL entry point passed in by skiboot */ bctrl attn -len: +len: .long 0x00 - .long 0x0D -str: + .long (strend - str) +str: .string "Hello World!\n" +strend: -- cgit v1.1