installer: use sastart

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 files changed, 5 insertions(+), 72 deletions(-)

M installer/installer/Makefile
M installer/installer/linker.script
M installer/installer/loader_c.c
R installer/installer/setmode.s => 
M installer/installer/Makefile +3 -3
@@ 21,8 21,7 @@ 
 #
 
 BIN=	installer
-SRCS=	setmode.s \
-	loader_c.c \
+SRCS=	loader_c.c \
 	loader_asm.s \
 	cpio.c \
 	malloc.c \

          
@@ 31,7 30,8 @@ BITS=	64
 
 CFLAGS.OPT= -Os
 
-LD_ADD=	$(SRCTOP)/lib/lib.a
+LD_ADD=	$(SRCTOP)/lib/lib.a \
+	$(SRCTOP)/sastart/sastart.a
 
 .include <${.CURDIR:H:H}/build.mk>
 

          
M installer/installer/linker.script +1 -1
@@ 22,7 22,7 @@ 
 
 SECTIONS
 {
-  ENTRY(MAIN)
+  ENTRY(_start390)
   . = 0x100000;
 
   .text : {

          
M installer/installer/loader_c.c +1 -1
@@ 263,7 263,7 @@ static void init_io(void)
 	);
 }
 
-void load_nucleus(void)
+void start(void)
 {
 	char inp[160];
 

          
R installer/installer/setmode.s =>  +0 -67
@@ 1,67 0,0 @@ 
-/*
- * Copyright (c) 2007-2011 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-.globl MAIN
-	.type	MAIN, @function
-MAIN:
-#
-# At this point, the machine is running in ESA390 mode. Let's load a new
-# PSW, making it switch to 64-bit mode
-#
-
-	# switch to 64-bit mode
-	#
-	# Signal Processor
-	#   Order 0x12: Set Architecture
-	#   R1 bits 56-63 = 0x01 (switch all CPUs to z/Arch)
-	SR	%r1, %r1
-	LHI	%r1, 0x1	# switch all to z/Arch
-	SR	%r3, %r3	# CPU Address (CPU0000)
-	SIGP	%r1, %r3, 0x12	# Signal, order 0x12
-	SAM64
-	# On error:
-	#   Bit 55 = 1, cc1 (inval param)
-	#   Bit 54 = 1, cc1 (incorrect state)
-
-	# FIXME: check for errors?
-
-#
-# At this point, we should be in 64-bit mode
-#
-
-	#
-	# It is unfortunate that the below code is required.
-	#
-	# Let's set the stack pointer to make gcc happy
-	#
-	# A standard stack frame is 160 bytes.
-	#
-
-	# r15 = 0x100000
-	#     = (1 << 20)
-	#
-	SGR	%r15, %r15
-	LGHI	%r15, 0x1
-	SLLG	%r15, %r15, 20
-	AGHI	%r15, -160
-
-	BRC	15,load_nucleus