History

Use arm assembler in lib dir

herman ten brugge committed 5 years ago

Commit b40a88e1 parent bc6c0c33 files · +9 −38Browse files

Unified · Split

3 files
  1. lib/alloca-arm.S +0 −7
  2. lib/armflush.c +7 −16
  3. lib/fetch_and_add_arm.S +2 −15
lib/alloca-arm.S+0−7
@@ -3,15 +3,8 @@ · 2 unmodified lines
33 .global alloca
44 .type alloca, %function
55 alloca:
6−#ifdef __TINYC__
7− .int 0xe060d00d
8− .int 0xe3cdd007
9− .int 0xe1a0000d
10− .int 0xe1a0f00e
11−#else
126 rsb sp, r0, sp
137 bic sp, sp, #7
148 mov r0, sp
159 mov pc, lr
16−#endif
1710 .size alloca, .-alloca
lib/armflush.c+7−16
@@ -13,13 +13,13 @@ unsigned _tccsyscall(unsigned syscall_nr, ...); · 12 unmodified lines
1313 __asm__(
1414 ".global _tccsyscall\n"
1515 "_tccsyscall:\n"
16− ".int 0xe92d4080\n" // push {r7, lr}
17− ".int 0xe1a07000\n" // mov r7, r0
18− ".int 0xe1a00001\n" // mov r0, r1
19− ".int 0xe1a01002\n" // mov r1, r2
20− ".int 0xe1a02003\n" // mov r2, r3
21− ".int 0xef000000\n" // svc 0x00000000
22− ".int 0xe8bd8080\n" // pop {r7, pc}
16+ "push {r7, lr}\n\t"
17+ "mov r7, r0\n\t"
18+ "mov r0, r1\n\t"
19+ "mov r1, r2\n\t"
20+ "mov r2, r3\n\t"
21+ "svc #0\n\t"
22+ "pop {r7, pc}"
2323 );
2424
2525 /* from unistd.h: */
@@ -47,14 +47,5 @@ void __clear_cache(void *beginning, void *end) · 21 unmodified lines
4747 {
4848 /* __ARM_NR_cacheflush is kernel private and should not be used in user space.
4949 * However, there is no ARM asm parser in tcc so we use it for now */
50−#if 1
5150 syscall(__ARM_NR_cacheflush, beginning, end, 0);
52−#else
53− __asm__ ("push {r7}\n\t"
54− "mov r7, #0xf0002\n\t"
55− "mov r2, #0\n\t"
56− "swi 0\n\t"
57− "pop {r7}\n\t"
58− "ret");
59−#endif
6051 }
lib/fetch_and_add_arm.S+2−15
@@ -3,26 +3,13 @@ · 2 unmodified lines
33 .global fetch_and_add_arm
44 .type fetch_and_add_arm, %function
55 fetch_and_add_arm:
6−#ifdef __TINYC__
7− .int 0xee070fba
8− .int 0xe1903f9f
9− .int 0xe0833001
10− .int 0xe1802f93
11− .int 0xe3520000
12− .int 0x1afffffa
13− .int 0xee070fba
14− .int 0xe12fff1e
15−#else
16− .arch armv6
17−
18− mcr p15, 0, r0, c7, c10, 5
6+ mcr p15, #0, r0, c7, c10, #5
197 .L0:
208 ldrex r3, [r0]
219 add r3, r3, r1
2210 strex r2, r3, [r0]
2311 cmp r2, #0
2412 bne .L0
25− mcr p15, 0, r0, c7, c10, 5
13+ mcr p15, #0, r0, c7, c10, #5
2614 bx lr
27−#endif
2815 .size fetch_and_add_arm, .-fetch_and_add_arm

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t