Merge pull request #3326 from LemonBoy/misc-misc

Miscellaneous and very small patches regarding mipsel and musl libc
This commit is contained in:
Andrew Kelley 2019-09-27 14:53:52 -04:00 committed by GitHub
commit 70e934f116
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 26 deletions

View File

@ -12,18 +12,12 @@ longjmp:
addu $2, $2, 1
1:
#ifndef __mips_soft_float
lwc1 $20, 56($4)
lwc1 $21, 60($4)
lwc1 $22, 64($4)
lwc1 $23, 68($4)
lwc1 $24, 72($4)
lwc1 $25, 76($4)
lwc1 $26, 80($4)
lwc1 $27, 84($4)
lwc1 $28, 88($4)
lwc1 $29, 92($4)
lwc1 $30, 96($4)
lwc1 $31, 100($4)
l.d $f20, 56($4)
l.d $f22, 64($4)
l.d $f24, 72($4)
l.d $f26, 80($4)
l.d $f28, 88($4)
l.d $f30, 96($4)
#endif
lw $ra, 0($4)
lw $sp, 4($4)

View File

@ -22,18 +22,12 @@ setjmp:
sw $30, 40($4)
sw $28, 44($4)
#ifndef __mips_soft_float
swc1 $20, 56($4)
swc1 $21, 60($4)
swc1 $22, 64($4)
swc1 $23, 68($4)
swc1 $24, 72($4)
swc1 $25, 76($4)
swc1 $26, 80($4)
swc1 $27, 84($4)
swc1 $28, 88($4)
swc1 $29, 92($4)
swc1 $30, 96($4)
swc1 $31, 100($4)
s.d $f20, 56($4)
s.d $f22, 64($4)
s.d $f24, 72($4)
s.d $f26, 80($4)
s.d $f28, 88($4)
s.d $f30, 96($4)
#endif
jr $ra
li $2, 0

View File

@ -193,9 +193,29 @@ pub fn umount2(special: [*]const u8, flags: u32) usize {
pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: u32, fd: i32, offset: u64) usize {
if (@hasDecl(@This(), "SYS_mmap2")) {
return syscall6(SYS_mmap2, @ptrToInt(address), length, prot, flags, @bitCast(usize, isize(fd)), @truncate(usize, offset / MMAP2_UNIT));
// Make sure the offset is also specified in multiples of page size
if ((offset & (MMAP2_UNIT - 1)) != 0)
return @bitCast(usize, isize(-EINVAL));
return syscall6(
SYS_mmap2,
@ptrToInt(address),
length,
prot,
flags,
@bitCast(usize, isize(fd)),
@truncate(usize, offset / MMAP2_UNIT),
);
} else {
return syscall6(SYS_mmap, @ptrToInt(address), length, prot, flags, @bitCast(usize, isize(fd)), offset);
return syscall6(
SYS_mmap,
@ptrToInt(address),
length,
prot,
flags,
@bitCast(usize, isize(fd)),
offset,
);
}
}

View File

@ -140,6 +140,16 @@ const test_targets = [_]TestTarget{
},
},
},
TestTarget{
.target = Target{
.Cross = CrossTarget{
.os = .linux,
.arch = .mipsel,
.abi = .musl,
},
},
.link_libc = true,
},
TestTarget{
.target = Target{