Skip to content

Commit 0444823

Browse files
committed
rt: Add armhf support
1 parent 9e46b51 commit 0444823

File tree

8 files changed

+90
-6
lines changed

8 files changed

+90
-6
lines changed

rt/battery.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ isTheRT = true
1616
libraries = ["pthread", "dl", "rt"]
1717

1818
# For Linux or OSX
19-
[cfg.'(osx || linux) && !aarch64']
19+
[cfg.'(osx || linux) && !armhf && !aarch64']
2020
asmFiles = ["src/vrt/gc/save_regs.asm", "src/vrt/os/eh.asm"]
2121

22+
# ARMHF has its own special assembly.
23+
[cfg.armhf]
24+
sFiles = ["src/vrt/armhf.s"]
25+
2226
# AArch has its own special assembly.
2327
[cfg.aarch64]
2428
sFiles = ["src/vrt/aarch64.s"]

rt/src/core/c/posix/fcntl.volt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ version (Linux) {
191191
enum O_DSYNC = 0x1000; // octal 010000
192192
enum O_RSYNC = O_SYNC;
193193

194-
} else version (ARM) {
194+
} else version (ARMHF) {
195195

196196
enum O_CREAT = 0x40; // octal 0100
197197
enum O_EXCL = 0x80; // octal 0200

rt/src/core/c/posix/spawn.volt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ version (Linux) {
3333
struct posix_spawn_file_actions { __data: void[80]; }
3434
struct posix_spawnattr { __data: void[336]; }
3535

36+
} else version (ARMHF) {
37+
38+
struct posix_spawn_file_actions { __data: void[76]; }
39+
struct posix_spawnattr { __data: void[336]; }
40+
3641
} else version (AArch64) {
3742

3843
struct posix_spawn_file_actions { __data: void[80]; }

rt/src/core/c/posix/sys/socket.volt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ version (Linux) {
396396
SO_TYPE = 3
397397
}
398398

399-
} else version (AArch64) {
399+
} else version (ARMHF) {
400400

401401
enum
402402
{
@@ -430,7 +430,7 @@ version (Linux) {
430430
SO_TYPE = 3
431431
}
432432

433-
} else version (ARM) {
433+
} else version (AArch64) {
434434

435435
enum
436436
{

rt/src/core/c/posix/sys/stat.volt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,33 @@ version (Linux) {
159159
__unused: slong_t[3];
160160
}
161161

162+
} else version (ARMHF) {
163+
164+
struct stat_t
165+
{
166+
st_dev: dev_t;
167+
__pad0: u16;
168+
st_ino: ino_t;
169+
st_mode: mode_t;
170+
st_nlink: nlink_t;
171+
st_uid: uid_t;
172+
st_gid: gid_t;
173+
st_rdev: dev_t;
174+
__pad1: u32;
175+
st_size: off_t;
176+
st_blksize: blksize_t;
177+
st_blocks: blkcnt_t;
178+
//{
179+
st_atime: time_t;
180+
st_atimensec: c_ulong;
181+
st_mtime: time_t;
182+
st_mtimensec: c_ulong;
183+
st_ctime: time_t;
184+
st_ctimensec: c_ulong;
185+
//}
186+
__unused: i32[1];
187+
}
188+
162189
} else version (AArch64) {
163190

164191
struct stat_t

rt/src/vrt/armhf.s

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.arch armv7-a
2+
.text
3+
.fpu vfpv3-d16
4+
5+
#
6+
# fn vrt_eh_personality_v0(...)
7+
#
8+
# This function is needed to work around the compiler getting confused
9+
# about the prototype of vrt_eh_personality_v0, and acient fixed LLD bug.
10+
#
11+
.p2align 2
12+
.global vrt_eh_personality_v0
13+
.type vrt_eh_personality_v0, %function
14+
.code 32
15+
vrt_eh_personality_v0:
16+
.fnstart
17+
b vrt_eh_personality_v0_real
18+
.Lfunc_end0:
19+
.size vrt_eh_personality_v0, .Lfunc_end0-vrt_eh_personality_v0
20+
.fnend
21+
22+
23+
#
24+
# fn __vrt_push_registers(cb: dg())
25+
#
26+
# Pushes all useful registers to the stack and calls the given delegate.
27+
#
28+
.p2align 2
29+
.globl __vrt_push_registers
30+
.type __vrt_push_registers, %function
31+
.code 32
32+
__vrt_push_registers:
33+
.fnstart
34+
.save {r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, lr}
35+
push {r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, lr}
36+
.setfp r11, sp, #40
37+
add r11, sp, #40
38+
blx r1
39+
sub sp, r11, #40
40+
pop {r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, pc}
41+
.Lfunc_end1:
42+
.size __vrt_push_registers, .Lfunc_end1-__vrt_push_registers
43+
.fnend

rt/src/vrt/os/eh/stub.volt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: BSL-1.0
33
module vrt.os.eh.stub;
44

5-
version (!Linux && !OSX && !MinGW && !Windows):
5+
version ((!Linux && !OSX && !MinGW && !Windows) || ARMHF):
66

77
import core.exception: Throwable, Error, AssertError, KeyNotFoundException;
88
import core.rt.misc: vrt_panic;

rt/src/vrt/os/eh/unwind.volt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! Exception handling using libunwind and DWARF.
44
module vrt.os.eh.unwind;
55

6-
version (Linux || OSX || MinGW):
6+
version ((Linux || OSX || MinGW) && !ARMHF):
77

88
import core.rt.misc: vrt_panic, vrt_handle_cast;
99
import core.typeinfo: TypeInfo;
@@ -28,6 +28,11 @@ version (X86) {
2828
enum vrt_eh_return_0 = 0;
2929
enum vrt_eh_return_1 = 1;
3030

31+
} else version (ARMHF) {
32+
33+
enum vrt_eh_return_0 = 0;
34+
enum vrt_eh_return_1 = 1;
35+
3136
} else version (AArch64) {
3237

3338
enum vrt_eh_return_0 = 0;

0 commit comments

Comments
 (0)