Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

String linux calls

  • Loading branch information...
commit d6d1a2b5b9cec9a6d962d850509c24464950d9c8 1 parent 904c534
authored December 07, 2011
5  arm/Makefile
... ...
@@ -1,7 +1,10 @@
  1
+CC = arm-linux-gnueabi-gcc
  2
+# CC = arm-none-eabi-gcc
  3
+
1 4
 all: armforth run
2 5
 
3 6
 armforth: armforth.S
4  
-	arm-none-eabi-gcc -nostdlib -static -Wl,-Ttext,0 -Wl,--build-id=none -o armforth armforth.S
  7
+	$(CC) -nostdlib -static -Wl,-Ttext,0 -Wl,--build-id=none -o armforth armforth.S
5 8
 
6 9
 run:
7 10
 	cat ../x86/jonesforth.f - | ./armforth
58  arm/armforth.S
@@ -363,18 +363,18 @@ _DIVMOD:
363 363
 	mov	T0, #stderr
364 364
 	ldr	T1, =divmsg		@ address
365 365
 	mov	T2, #divmsgend-divmsg	@ length
366  
-	svc	__NR_write
  366
+	@ svc	__NR_write
367 367
 	mov	T0, #-1
368  
-	svc	__NR_exit
  368
+	@ svc	__NR_exit
369 369
 
370 370
 3:
371 371
 	@ division by 0 error
372 372
 	mov	T0, #stderr
373 373
 	ldr	T1, =posmsg		@ address
374 374
 	mov	T2, #posmsgend-posmsg	@ length
375  
-	svc	__NR_write
  375
+	@ svc	__NR_write
376 376
 	mov	T0, #-1
377  
-	svc	__NR_exit
  377
+	@ svc	__NR_exit
378 378
 
379 379
 	.section .rodata
380 380
 divmsg: .ascii "DIVISION BY 0!\n"
@@ -678,14 +678,6 @@ var_\name :
678 678
 	defconst "F_HIDDEN",8,,__F_HIDDEN,F_HIDDEN
679 679
 	defconst "F_LENMASK",9,,__F_LENMASK,F_LENMASK
680 680
 
681  
-	defconst "SYS_EXIT",8,,SYS_EXIT,__NR_exit
682  
-	defconst "SYS_OPEN",8,,SYS_OPEN,__NR_open
683  
-	defconst "SYS_CLOSE",9,,SYS_CLOSE,__NR_close
684  
-	defconst "SYS_READ",8,,SYS_READ,__NR_read
685  
-	defconst "SYS_WRITE",9,,SYS_WRITE,__NR_write
686  
-	defconst "SYS_CREAT",9,,SYS_CREAT,__NR_creat
687  
-	defconst "SYS_BRK",7,,SYS_BRK,__NR_brk
688  
-
689 681
 	defconst "O_RDONLY",8,,__O_RDONLY,0
690 682
 	defconst "O_WRONLY",8,,__O_WRONLY,1
691 683
 	defconst "O_RDWR",6,,__O_RDWR,2
@@ -751,7 +743,7 @@ _KEY:
751 743
 	mov	T0, #stdin
752 744
 	ldr	T1, =buffer
753 745
 	mov	T2, #BUFFER_SIZE
754  
-	svc	__NR_read
  746
+	@ svc	__NR_read
755 747
 	cmp	T0, #0			@ <= 0?
756 748
 	ble	2f			@ yes, fatal error
757 749
 	ldr	T1, =buffer
@@ -760,7 +752,7 @@ _KEY:
760 752
 	str	T1, [S2]		@ update bufftop (with length we read)
761 753
 	b	3b			@ try fast path again
762 754
 2:
763  
-	svc	__NR_exit		@ exit (with error code from NR_read)
  755
+	@ svc	__NR_exit		@ exit (with error code from NR_read)
764 756
 
765 757
 	.data
766 758
 	.align 2
@@ -780,7 +772,7 @@ _EMIT:
780 772
 	ldr	T1, =emit_scratch	@ buffer
781 773
 	strb	T0, [T1]		@ store char in buffer
782 774
 	mov	T0, #stdout
783  
-	svc	__NR_write
  775
+	@ svc	__NR_write
784 776
 	bx	lr
785 777
 
786 778
 	.data
@@ -1092,7 +1084,7 @@ _TELL:
1092 1084
 	mov	T2, T1		@ length
1093 1085
 	mov	T1, T0		@ address
1094 1086
 	mov	T0, #stdout
1095  
-	svc	__NR_write
  1087
+	@ svc	__NR_write
1096 1088
 	bx	lr
1097 1089
 
1098 1090
 	defword "QUIT",4,,QUIT
@@ -1167,7 +1159,7 @@ _TELL:
1167 1159
 	mov	T0, #stderr
1168 1160
 	ldr	T1, =errmsg		@ address
1169 1161
 	mov	T2, #errmsgend-errmsg	@ length
1170  
-	svc	__NR_write
  1162
+	@ svc	__NR_write
1171 1163
 
1172 1164
 	mov	T0, #stderr
1173 1165
 	ldr	T1, =currkey		@ address of currkey
@@ -1177,12 +1169,12 @@ _TELL:
1177 1169
 	cmp	T2, #40			@ > 40?
1178 1170
 	movgt	T2, #40			@ cap at 40
1179 1171
 	sub	T1, T1, T2		@ ??????
1180  
-	svc	__NR_write
  1172
+	@ svc	__NR_write
1181 1173
 
1182 1174
 	mov	T0, #stderr
1183 1175
 	ldr	T1, =errmsgnl		@ address
1184 1176
 	mov	T2, #1			@ length
1185  
-	svc	__NR_write
  1177
+	@ svc	__NR_write
1186 1178
 	NEXT
1187 1179
 
1188 1180
 	.section .rodata
@@ -1204,26 +1196,26 @@ errmsgnl: .ascii "\n"
1204 1196
 
1205 1197
 @ The SYSCALL? words are somewhat of a pain for OABI since we don't
1206 1198
 @ pass the syscall number in a register. So instead we need a table
1207  
-@ of svc instructions out of which we select one. This requires the
  1199
+@ of @ svc instructions out of which we select one. This requires the
1208 1200
 @ syscall numbers to be "adjusted" appropriately. For EABI we could
1209 1201
 @ do better of course...
1210 1202
 
1211 1203
 	.text
1212 1204
 oabi_syscall_table:
1213 1205
 	.space	8		@ 0 __NR_restart_syscall
1214  
-	svc	__NR_exit	@ 1
  1206
+	@ svc	__NR_exit	@ 1
1215 1207
 	bx	lr
1216 1208
 	.space	8		@ 2 __NR_fork
1217  
-	svc	__NR_read	@ 3
  1209
+	@ svc	__NR_read	@ 3
1218 1210
 	bx	lr
1219  
-	svc	__NR_write	@ 4
  1211
+	@ svc	__NR_write	@ 4
1220 1212
 	bx	lr
1221  
-	svc	__NR_open	@ 5
  1213
+	@ svc	__NR_open	@ 5
1222 1214
 	bx	lr
1223  
-	svc	__NR_close	@ 6
  1215
+	@ svc	__NR_close	@ 6
1224 1216
 	bx	lr
1225 1217
 	.space	8		@ 7 __NR_waitpid (deprecated)
1226  
-	svc	__NR_creat	@ 8
  1218
+	@ svc	__NR_creat	@ 8
1227 1219
 	bx	lr
1228 1220
 	.space	8		@ 9
1229 1221
 	.space	8		@ 10
@@ -1261,7 +1253,7 @@ oabi_syscall_table:
1261 1253
 	.space	8		@ 42
1262 1254
 	.space	8		@ 43
1263 1255
 	.space	8		@ 44
1264  
-	svc	__NR_brk	@ 45
  1256
+	@ svc	__NR_brk	@ 45
1265 1257
 	bx	lr
1266 1258
 	.space	8		@ 46
1267 1259
 	.space	8		@ 47
@@ -1335,11 +1327,11 @@ set_up_data_segment:
1335 1327
 	bx	lr
1336 1328
 @ original code to make data segment extensible
1337 1329
 @	mov	r0, #0
1338  
-@	svc	__NR_brk
  1330
+@	@ svc	__NR_brk
1339 1331
 @	ldr	r1, =var_HERE
1340 1332
 @	str	r0, [r1]
1341 1333
 @	add	r0, r0, #INITIAL_DATA_SEGMENT_SIZE
1342  
-@	svc	__NR_brk
  1334
+@	@ svc	__NR_brk
1343 1335
 @	bx	lr
1344 1336
 
1345 1337
 	.set RETURN_STACK_SIZE,8192
@@ -1352,7 +1344,7 @@ debug_ping:
1352 1344
 	mov	r0, #stderr
1353 1345
 	ldr	r1, =debugmsg		@ address
1354 1346
 	mov	r2, #debugend-debugmsg	@ length
1355  
-	svc	__NR_write
  1347
+	@ svc	__NR_write
1356 1348
 	ldmfd	sp!, {r0-r12}
1357 1349
 	bx	lr
1358 1350
 	.section .rodata
@@ -1377,17 +1369,17 @@ debug_pong:
1377 1369
 	mov	T0, #stderr
1378 1370
 	ldr	T1, =rmsg		@ address
1379 1371
 	mov	T2, #rmsgend-rmsg	@ length
1380  
-	svc	__NR_write
  1372
+	@ svc	__NR_write
1381 1373
 
1382 1374
 	mov	T0, #stderr
1383 1375
 	mov	T1, S0
1384 1376
 	mov	T2, S1
1385  
-	svc	__NR_write
  1377
+	@ svc	__NR_write
1386 1378
 
1387 1379
 	mov	T0, #stderr
1388 1380
 	ldr	T1, =rmsgnl		@ address
1389 1381
 	mov	T2, #1			@ length
1390  
-	svc	__NR_write
  1382
+	@ svc	__NR_write
1391 1383
 1:
1392 1384
 	bx	lr
1393 1385
 

0 notes on commit d6d1a2b

Please sign in to comment.
Something went wrong with that request. Please try again.