[Skiboot] [PATCH 4/5] test/hello_world: Cleanup code
Michael Neuling
mikey at neuling.org
Thu May 28 20:25:53 AEST 2015
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 at neuling.org>
---
test/hello_world/hello_kernel/hello_kernel.S | 32 +++++++++++++---------------
1 file 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 at ha
- addi 4,4, len at l
- add 4,4,29
- lis 5, str at ha
- addi 5,5, str at 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:
--
2.1.0
More information about the Skiboot
mailing list