aboutsummaryrefslogtreecommitdiff
path: root/slof/fs/boot.fs
diff options
context:
space:
mode:
authorNikunj A Dadhania <nikunj@linux.vnet.ibm.com>2014-03-07 11:51:56 +0530
committerAlexey Kardashevskiy <aik@ozlabs.ru>2014-03-18 17:06:47 +1100
commitc3d633a04491a959dd021a9199e3199fc3ad8a41 (patch)
tree88f7dd9e16c6b58cef6dd77e335085bad456995d /slof/fs/boot.fs
parent4099049c2588cc4ab4ce0fb7b96f8033ab03f538 (diff)
downloadSLOF-c3d633a04491a959dd021a9199e3199fc3ad8a41.zip
SLOF-c3d633a04491a959dd021a9199e3199fc3ad8a41.tar.gz
SLOF-c3d633a04491a959dd021a9199e3199fc3ad8a41.tar.bz2
ELF: Enter LE binary in LE mode
Trampoline code in the LE binary were helping fix this. This patch now takes care of switching the mode to LE for LE elf binaries. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Diffstat (limited to 'slof/fs/boot.fs')
-rw-r--r--slof/fs/boot.fs38
1 files changed, 25 insertions, 13 deletions
diff --git a/slof/fs/boot.fs b/slof/fs/boot.fs
index 97eca1e..9a0ded0 100644
--- a/slof/fs/boot.fs
+++ b/slof/fs/boot.fs
@@ -71,28 +71,40 @@ defer go ( -- )
-6d boot-exception-handler ABORT
;
-: go-64 ( args len entry r2 r12 -- )
+: go-64 ( args len entry r2 -- )
0 ciregs >r3 ! 0 ciregs >r4 !
start-elf64 client-data
claim-list elf-release 0 to claim-list
;
+: set-le ( -- )
+ 1 ciregs >r13 !
+;
+
+: set-be ( -- )
+ 0 ciregs >r13 !
+;
+
: go-64-be ( -- )
state-valid @ IF
+ set-be
go-args 2@
go-entry @
go-entry 8 + @
- 0 go-64
+ go-64
THEN
-6d boot-exception-handler ABORT
;
-\ FIXME : how to do this correctly, currently this hangs.
-: set-le ( -- )
- ." Changing endianness "
- msr@ 1 or msr!
- ." done "
- msr@ . cr
+
+: go-32-be
+ set-be
+ go-32
+;
+
+: go-32-lev1
+ set-le
+ go-32
;
: go-64-lev1
@@ -100,8 +112,7 @@ defer go ( -- )
go-args 2@
go-entry @ xbflip
go-entry 8 + @ xbflip
- 0
- \ set-le
+ set-le
go-64
THEN
-6d boot-exception-handler ABORT
@@ -110,8 +121,8 @@ defer go ( -- )
: go-64-lev2
state-valid @ IF
go-args 2@
- go-entry 0 go-entry
- \ set-le
+ go-entry 0
+ set-le
go-64
THEN
-6d boot-exception-handler ABORT
@@ -128,10 +139,11 @@ defer go ( -- )
( arg len true claim-list entry elftype )
CASE
- 1 OF ['] go-32 ENDOF ( arg len true claim-list entry go )
+ 1 OF ['] go-32-be ENDOF ( arg len true claim-list entry go )
2 OF ['] go-64-be ENDOF ( arg len true claim-list entry go )
3 OF ['] go-64-lev1 ENDOF ( arg len true claim-list entry go )
4 OF ['] go-64-lev2 ENDOF ( arg len true claim-list entry go )
+ 5 OF ['] go-32-lev1 ENDOF ( arg len true claim-list entry go )
dup OF ['] no-go to go
2drop 3drop false EXIT ENDOF ( false )
ENDCASE