loader: rewrite I/O code to handle relocations more gracefully

This is some of the oldest code in the repository, and sadly it is showing
its age.  This change should be enough to get us a step closer to using the
sastart code and therefore deleting this mess completely.

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

M loader/loader/loader_asm.s
M loader/loader/loader_asm.s +11 -19
@@ 25,26 25,16 @@ 
 .globl __do_io
 	.type	__do_io, @function
 __do_io:
-	#
-	# r4 = 0x80000000
-	#
-	XGR	%r4, %r4
-	LHI	%r4, 0x8
-	SLL	%r4, 20
-	#
-	# r14 = r14 & 0x7fffffff don't ask, it's strangely retarded
-	#
-	L	%r1,ADDRMASK(%r4)
-	NR	%r14, %r1  # mask out the bit
-
 	L	%r1, 0xb8		# load subsystem ID
 	
-	SSCH	orb(%r4)		# issue IO
+	LARL	%r4, orb
+	SSCH	0(%r4)			# issue IO
 
 /*
 7) Enable the PSW for I/O interrupts and go into wait state (you need bits 6, 12 & 14 set to 1 in the PSW : X'020A000000000000' is a good example)
 */
-	LPSWE	WAITPSW(%r4)
+	LARL	%r4, WAITPSW
+	LPSWE	0(%r4)
 
 #
 # The IO interrupt handler

          
@@ 52,15 42,17 @@ 7) Enable the PSW for I/O interrupts and
 .globl IOHANDLER
 IOHANDLER:
 	# is this for us?
-	L	%r1, MAGICVAL(%r4)
+	LARL	%r1, MAGICVAL
+	L	%r1, 0(%r1)
 	C	%r1, 0xbc
-	BNE	IONOTDONE(%r4)
+	JNE	IONOTDONE
 
 	# it is!
 
-	L	%r1, 0xb8		# load subsystem ID
+	LLGF	%r1, 0xb8		# load subsystem ID
 
-	TSCH	irb(%r4)
+	LARL	%r4, irb
+	TSCH	0(%r4)
 
 /*
 FIXME: we should do more checking!

          
@@ 71,7 63,7 @@ 13) If device end : I/O Completed.. Perf
 */
 
 	# unit check? (end of media?)
-	L	%r1,irb+5(%r4)
+	L	%r1,5(%r4)
 	LA	%r0,0x02
 	NR	%r0,%r1
 	LA	%r2,1			# return 1 - end of medium