aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2015-05-28 20:25:53 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-06-01 17:11:53 +1000
commit02e50b9149b37f6a54c12d434e74d03aa1a917bf (patch)
tree7579df27492e87ae752d1ef3df37ca35eb7aaf94 /test
parent439cb957abec3ff8a8e715bc5160f440452c1a26 (diff)
downloadskiboot-02e50b9149b37f6a54c12d434e74d03aa1a917bf.zip
skiboot-02e50b9149b37f6a54c12d434e74d03aa1a917bf.tar.gz
skiboot-02e50b9149b37f6a54c12d434e74d03aa1a917bf.tar.bz2
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 <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'test')
-rw-r--r--test/hello_world/hello_kernel/hello_kernel.S32
1 files changed, 15 insertions, 17 deletions
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 <asm-utils.h>
-
/*
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: