redo restore after syscall with builder
This commit is contained in:
parent
55bc9c5273
commit
fb54d68020
@ -111,21 +111,18 @@ module Risc
|
||||
#
|
||||
def save_message(builder)
|
||||
r8 = RegisterValue.new( :r8 , :Message)
|
||||
builder.add_code Risc.transfer("save_message", Risc.message_reg , r8 )
|
||||
builder.add_transfer("save_message", Risc.message_reg , r8 )
|
||||
end
|
||||
|
||||
def restore_message(builder)
|
||||
r8 = RegisterValue.new( :r8 , :Message)
|
||||
return_tmp = builder.compiler.use_reg :fixnum
|
||||
source = "_restore_message"
|
||||
# get the sys return out of the way
|
||||
builder.add_code Risc.transfer(source, Risc.message_reg , return_tmp )
|
||||
# load the stored message into the base register
|
||||
builder.add_code Risc.transfer(source, r8 , Risc.message_reg )
|
||||
int = builder.compiler.use_reg(:Integer)
|
||||
builder.add_new_int(source , return_tmp , int )
|
||||
# save the return value into the message
|
||||
builder.add_code Risc.reg_to_slot( source , int , Risc.message_reg , :return_value )
|
||||
builder.build do
|
||||
integer_reg << message
|
||||
message << r8
|
||||
add_new_int( "_restore_message", integer_reg , int )
|
||||
message[:return_value] << int
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -45,8 +45,8 @@ module Risc
|
||||
sl = main_ticks(22)
|
||||
assert_equal Transfer , sl.class
|
||||
assert_equal :r0 , sl.from.symbol
|
||||
assert_equal :r2 , sl.to.symbol
|
||||
assert_equal 11 , @interpreter.get_register(:r2)
|
||||
assert_equal :r3 , sl.to.symbol
|
||||
assert_equal 11 , @interpreter.get_register(:r3)
|
||||
end
|
||||
def test_restore_message
|
||||
sl = main_ticks(23)
|
||||
@ -58,8 +58,8 @@ module Risc
|
||||
def test_save_sys_return
|
||||
sl = main_ticks(28)
|
||||
assert_equal RegToSlot , sl.class
|
||||
assert_equal :r2 , sl.register.symbol #return
|
||||
assert_equal :r3 , sl.array.symbol #parfait integer
|
||||
assert_equal :r3 , sl.register.symbol #return
|
||||
assert_equal :r2 , sl.array.symbol #parfait integer
|
||||
assert_equal 2 , sl.index
|
||||
end
|
||||
def test_return
|
||||
|
Loading…
Reference in New Issue
Block a user