Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update X86_ZLMediaKit #52

Merged
merged 2 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ rusty-tags.vi
/testcases/riscv64-linux-musl-native.tgz
/testcases/gcc/riscv64-linux-musl-native
/testcases/ZLM/MediaServer
/testcases/ZLM/ffmpeg
/testcases/ZLM/lib
testsuits-x86_64-linux-musl.tgz
.idea/
arceos-fada.bin.gz
Expand Down
12 changes: 9 additions & 3 deletions build_img.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
# MacOS : brew install dosfstools
# Ubuntu : apt-get install dosfstools
# Usage:
# build_img.sh -m [arch] -fs [ext4|fat32] -file [testcast]
# build_img.sh -m [arch] -fs [ext4|fat32] -file [testcast] -s [size]
################################################################
# default setting
arch=x86_64
fs=fat32
size=30
FILE=

display_help()
{
echo ""
echo "./build_img.sh -m [arch] -fs [filesystem] -file [testcast]"
echo " -s | --size size of the disk image in 4MB batch size, default is set to 30, which means 120MB disk image"
echo ""
exit 1
}
Expand All @@ -32,6 +34,10 @@ while [ -n "$1" ]; do
shift
FILE="$1"
;;
-s | --size )
shift
size=$1
;;
riscv64)
arch=riscv64
;;
Expand Down Expand Up @@ -96,7 +102,7 @@ if [ "$FILE" = "testsuits-x86_64-linux-musl" ] && [ ! -e testcases/$FILE ]; then
fi

rm -f disk.img
dd if=/dev/zero of=disk.img bs=4M count=30
dd if=/dev/zero of=disk.img bs=4M count=$size

if [ "$fs" = "ext4" ]; then
mkfs.ext4 -t ext4 disk.img
Expand Down Expand Up @@ -124,4 +130,4 @@ else
sudo umount mnt
sudo rm -rf mnt
sudo chmod 777 disk.img
fi
fi
2 changes: 1 addition & 1 deletion platforms/x86_64-qemu-q35.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ timer-frequency = "4_000_000_000" # 4.0GHz
# Testcase memory start address.
testcase-memory-start = "0x1_8000_0000"
# Testcase memory size.
testcase-memory-size = "0x800_0000"
testcase-memory-size = "0x1700_0000"
# The base address of the user heap.
user-heap-base = "0x3FA0_0000"
# The base address of the user stack. And the stack bottom is `user-stack-top + max-user-stack-size`.
Expand Down
6 changes: 6 additions & 0 deletions testcases/ZLM/downloads.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
rm -rf lib ffmpeg MediaServer
git clone https://gitee.com/baiqiaosen/zlm_ffmpeg.git
mv zlm_ffmpeg/lib ./
mv zlm_ffmpeg/ffmpeg ./
mv zlm_ffmpeg/MediaServer ./
rm -rf zlm_ffmpeg
5 changes: 5 additions & 0 deletions ulib/axstarry/src/syscall_mem/imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,3 +376,8 @@ pub fn syscall_shmat(args: [usize; 6]) -> SyscallResult {

Ok(addr.as_usize() as isize)
}

/// # mlock
pub fn syscall_mlock(args: [usize; 6]) -> SyscallResult {
Ok(0)
}
2 changes: 2 additions & 0 deletions ulib/axstarry/src/syscall_mem/mem_syscall_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ numeric_enum_macro::numeric_enum! {
#[derive(Eq, PartialEq, Debug, Copy, Clone)]
pub enum MemSyscallId {
// mem
MREMAP = 25,
SHMGET = 29,
SHMCTL = 31,
SHMAT = 30,
Expand All @@ -43,5 +44,6 @@ numeric_enum_macro::numeric_enum! {
MSYNC = 26,
MPROTECT = 10,
MEMBARRIER = 324,
MLOCK = 149,
}
}
2 changes: 2 additions & 0 deletions ulib/axstarry/src/syscall_mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ pub fn mem_syscall(syscall_id: mem_syscall_id::MemSyscallId, args: [usize; 6]) -
SHMGET => syscall_shmget(args),
SHMCTL => Ok(0),
SHMAT => syscall_shmat(args),
#[cfg(target_arch = "x86_64")]
MLOCK => syscall_mlock(args),
#[allow(unused)]
_ => {
panic!("Invalid Syscall Id: {:?}!", syscall_id);
Expand Down
Loading