summaryrefslogtreecommitdiff
path: root/thumb2startup.s
diff options
context:
space:
mode:
Diffstat (limited to 'thumb2startup.s')
-rw-r--r--thumb2startup.s60
1 files changed, 56 insertions, 4 deletions
diff --git a/thumb2startup.s b/thumb2startup.s
index 6ce2d2f..e7e1440 100644
--- a/thumb2startup.s
+++ b/thumb2startup.s
@@ -661,8 +661,10 @@ init_clean:
sto BSTACK_0,SCRATCH_REG,heap_size,3
add BSTACK_0,BSTACK_0,#7
+ store_global_registers
mov r0,BSTACK_0
bl malloc
+ load_global_registers
movs BSTACK_0,r0
beq no_memory_2
@@ -678,12 +680,14 @@ init_clean:
ldo ASTACK_2,ASTACK_2,ab_stack_size,1
add ASTACK_2,ASTACK_2,#3
+ store_global_registers
mov r0,ASTACK_2
.if STACK_OVERFLOW_EXCEPTION_HANDLER
bl allocate_memory_with_guard_page_at_end
.else
bl malloc
.endif
+ load_global_registers
movs BSTACK_0,r0
beq no_memory_3
@@ -872,7 +876,9 @@ no_mark2:
no_memory_2:
lao r0,out_of_memory_string_1,0
otoa r0,out_of_memory_string_1,0
+ store_global_registers
bl ew_print_string
+ load_global_registers
.ifdef _WINDOWS_
? movl $1,@execution_aborted
.endif
@@ -882,7 +888,9 @@ no_memory_2:
no_memory_3:
lao r0,out_of_memory_string_1,1
otoa r0,out_of_memory_string_1,1
+ store_global_registers
bl ew_print_string
+ load_global_registers
.ifdef _WINDOWS_
? movl $1,@execution_aborted
.endif
@@ -908,7 +916,9 @@ exit_clean:
lao r0,time_string_1,0
otoa r0,time_string_1,0
+ store_global_registers
bl ew_print_string
+ load_global_registers
lao SCRATCH_REG,execute_time,0
ldo BSTACK_0,SCRATCH_REG,execute_time,0
@@ -920,7 +930,9 @@ exit_clean:
lao r0,time_string_2,0
otoa r0,time_string_2,0
+ store_global_registers
bl ew_print_string
+ load_global_registers
lao SCRATCH_REG,garbage_collect_time,0
ldo BSTACK_0,SCRATCH_REG,garbage_collect_time,0
@@ -932,7 +944,9 @@ exit_clean:
lao r0,time_string_4,0
otoa r0,time_string_4,0
+ store_global_registers
bl ew_print_string
+ load_global_registers
lao SCRATCH_REG,execute_time,1
ldo BSTACK_0,SCRATCH_REG,execute_time,1
@@ -1090,6 +1104,7 @@ print_time:
lsr BSTACK_0,BSTACK_0,#3
.if USE_CLIB
+ store_global_registers
mov r3,BSTACK_0
mov r2,ASTACK_0
lao r1,sprintf_time_string,0
@@ -1101,9 +1116,12 @@ print_time:
lao r0,sprintf_time_buffer,1
otoa r0,sprintf_time_buffer,1
bl ew_print_string
+ load_global_registers
.else
+ store_global_registers
mov r0,ASTACK_0
bl ew_print_int
+ load_global_registers
lao ASTACK_0,sprintf_time_buffer,0
otoa ASTACK_0,sprintf_time_buffer,0
@@ -1127,9 +1145,11 @@ print_time:
strb BSTACK_4,[ASTACK_0,#1]
strb BSTACK_0,[ASTACK_0,#2]
+ store_global_registers
mov r1,#3
mov r0,ASTACK_0
bl ew_print_text
+ load_global_registers
.endif
ldr pc,[BSTACK_PTR],#4
@@ -1142,8 +1162,10 @@ print_sc:
.thumb_func
print:
+ store_global_registers
mov r0,BSTACK_0
bl w_print_string
+ load_global_registers
.thumb_func
end_print:
@@ -1253,14 +1275,18 @@ end_print_symbol:
.thumb_func
print_int_node:
+ store_global_registers
ldr r0,[ASTACK_0,#4]
bl w_print_int
+ load_global_registers
ldr pc,[BSTACK_PTR],#4
.thumb_func
print_int:
+ store_global_registers
mov r0,BSTACK_0
bl w_print_int
+ load_global_registers
ldr pc,[BSTACK_PTR],#4
.thumb_func
@@ -1268,6 +1294,7 @@ print_char_denotation:
tst BSTACK_1,BSTACK_1
bne print_char_node
+ store_global_registers
ldr SCRATCH_REG,[ASTACK_0,#4]
str SCRATCH_REG,[BSTACK_PTR,#-4]!
@@ -1280,19 +1307,24 @@ print_char_denotation:
mov r0,#0x27
bl w_print_char
+ load_global_registers
ldr pc,[BSTACK_PTR],#4
.thumb_func
print_char_node:
+ store_global_registers
ldr r0,[ASTACK_0,#4]
bl w_print_char
+ load_global_registers
ldr pc,[BSTACK_PTR],#4
.thumb_func
print_char:
+ store_global_registers
str BSTACK_0,[BSTACK_PTR,#-4]!
bl w_print_char
add BSTACK_PTR,BSTACK_PTR,#4
+ load_global_registers
ldr pc,[BSTACK_PTR],#4
.thumb_func
@@ -1303,16 +1335,20 @@ print_bool:
.thumb_func
print_true:
+ store_global_registers
lao r0,true_c_string,0
otoa r0,true_c_string,0
bl w_print_string
+ load_global_registers
ldr pc,[BSTACK_PTR],#4
.thumb_func
print_false:
+ store_global_registers
lao r0,false_c_string,0
otoa r0,false_c_string,0
bl w_print_string
+ load_global_registers
ldr pc,[BSTACK_PTR],#4
.thumb_func
@@ -1330,6 +1366,7 @@ print_real_node:
.endif
.thumb_func
print_real_:
+ store_global_registers
push {r11}
mov r11,BSTACK_PTR
bic lr,r11,#7
@@ -1337,12 +1374,15 @@ print_real_:
bl w_print_real
mov BSTACK_PTR,r11
pop {r11}
+ load_global_registers
ldr pc,[BSTACK_PTR],#4
print_string_a2:
+ store_global_registers
ldr r1,[ASTACK_2]
add r0,ASTACK_2,#4
bl w_print_text
+ load_global_registers
ldr pc,[BSTACK_PTR],#4
.thumb_func
@@ -1354,9 +1394,11 @@ print__chars__sc:
.thumb_func
print__string__:
+ store_global_registers
ldr r1,[ASTACK_0,#4]
add r0,ASTACK_0,#8
bl w_print_text
+ load_global_registers
.thumb_func
no_print_chars:
ldr pc,[BSTACK_PTR],#4
@@ -1714,6 +1756,7 @@ eqD_false:
.thumb_func
init_timer:
+ store_global_registers
sub BSTACK_PTR,BSTACK_PTR,#20
mov r0,BSTACK_PTR
bl times
@@ -1732,6 +1775,7 @@ init_timer:
lao SCRATCH_REG,IO_time,1
sto BSTACK_0,SCRATCH_REG,IO_time,1
+ load_global_registers
ldr pc,[BSTACK_PTR],#4
.thumb_func
@@ -1968,7 +2012,7 @@ collect_0:
collect_0:
.endif
collect_0_:
- stmdb BSTACK_PTR!,{r0-r4,lr}
+ store_bstack_and_lr
lao SCRATCH_REG,heap_end_after_gc,1
ldo SCRATCH_REG,SCRATCH_REG,heap_end_after_gc,1
@@ -2071,7 +2115,7 @@ found_free_memory:
ldr ASTACK_PTR,[BSTACK_PTR],#4
- ldmia BSTACK_PTR!,{r0-r4,pc}
+ load_bstack_and_pc
.thumb_func
end_bits:
@@ -2125,7 +2169,7 @@ no_mark3:
lao SCRATCH_REG,heap_end_after_gc,3
sto BSTACK_1,SCRATCH_REG,heap_end_after_gc,3
- ldmia BSTACK_PTR!,{r0-r4,pc}
+ load_bstack_and_pc
.thumb_func
.align
@@ -2141,6 +2185,7 @@ collect:
lao r0,garbage_collect_string_1,0
otoa r0,garbage_collect_string_1,0
+ store_global_registers
bl ew_print_string
mov BSTACK_0,ASTACK_PTR
@@ -2162,6 +2207,7 @@ collect:
lao r0,garbage_collect_string_3,0
otoa r0,garbage_collect_string_3,0
bl ew_print_string
+ load_global_registers
.thumb_func
no_print_stack_sizes:
@@ -2470,6 +2516,7 @@ end_garbage_collect_:
.endif
str BSTACK_0,[BSTACK_PTR,#-4]!
+ store_global_registers
lao SCRATCH_REG,flags,9
ldo SCRATCH_REG,SCRATCH_REG,flags,9
@@ -2491,6 +2538,7 @@ end_garbage_collect_:
.thumb_func
no_heap_use_message:
+ load_global_registers
.if FINALIZERS
.align
@@ -2596,7 +2644,7 @@ no_write_heap:
.endif
- ldmia BSTACK_PTR!,{r0-r4,pc}
+ load_bstack_and_pc
.ifdef PIC
.if MARK_AND_COPY_GC
@@ -3175,6 +3223,7 @@ IO_error:
lao r0,IO_error_string,0
otoa r0,IO_error_string,0
+ store_global_registers
bl ew_print_string
ldr r0,[BSTACK_PTR],#4
@@ -3183,13 +3232,16 @@ IO_error:
lao r0,new_line_string,0
otoa r0,new_line_string,0
bl ew_print_string
+ load_global_registers
b halt
.thumb_func
print_error:
mov r0,ASTACK_2
+ store_global_registers
bl ew_print_string
+ load_global_registers
.thumb_func
halt: