Skip to content

Commit

Permalink
Merge pull request #16 from syswonder/dev
Browse files Browse the repository at this point in the history
Merge Dev to Main
  • Loading branch information
caodg authored Oct 8, 2023
2 parents 3a882b0 + 2608519 commit 14bf167
Show file tree
Hide file tree
Showing 92 changed files with 2,373 additions and 274 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ jobs:
run: make ARCH=${{ matrix.arch }} A=apps/memtest
- name: Build exception
run: make ARCH=${{ matrix.arch }} A=apps/exception
- name: Build display
run: make ARCH=${{ matrix.arch }} A=apps/display
- name: Build display/basic_painting
run: make ARCH=${{ matrix.arch }} A=apps/display/basic_painting
- name: Build display/draw_map
run: make ARCH=${{ matrix.arch }} A=apps/display/draw_map
- name: Build task/yield
run: make ARCH=${{ matrix.arch }} A=apps/task/yield
- name: Build task/parallel
Expand Down
116 changes: 112 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ members = [
"crates/driver_net",
"crates/driver_pci",
"crates/driver_virtio",
"crates/dtb",
"crates/flatten_objects",
"crates/handler_table",
"crates/kernel_guard",
Expand Down Expand Up @@ -55,7 +56,8 @@ members = [
"ulib/axstd",
"ulib/axlibc",

"apps/display",
"apps/display/basic_painting",
"apps/display/draw_map",
"apps/exception",
"apps/helloworld",
"apps/memtest",
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# - `MODE`: Build mode: release, debug
# - `LOG:` Logging level: warn, error, info, debug, trace
# - `V`: Verbose level: (empty), 1, 2
# - `ARGS`: Command-line arguments separated by comma. Only available when feature `alloc` is enabled.
# - `ENVS`: Environment variables, separated by comma between key value pairs. Only available when feature `alloc` is enabled.
# * App options:
# - `A` or `APP`: Path to the application
# - `FEATURES`: Features os ArceOS modules to be enabled.
Expand Down Expand Up @@ -53,6 +55,10 @@ NET_DEV ?= user
IP ?= 10.0.2.15
GW ?= 10.0.2.2

# args and envs
ARGS ?=
ENVS ?=

# App type
ifeq ($(wildcard $(APP)),)
$(error Application path "$(APP)" is not valid)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,4 @@ make PLATFORM=x86_64-pc-oslab A=apps/c/redis FEATURES=driver-ixgbe,driver-ramdis

## Design

![](doc/figures/ArceOS.svg)
![](doc/figures/rukos.svg)
2 changes: 2 additions & 0 deletions api/arceos_posix_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ net = ["dep:axnet", "axfeat/net", "fd"]
pipe = ["fd"]
select = ["fd"]
epoll = ["fd"]
poll = ["fd"]

[dependencies]
# ArceOS modules
Expand All @@ -43,6 +44,7 @@ axnet = { path = "../../modules/axnet", optional = true }
# Other crates
axio = { path = "../../crates/axio" }
axerrno = { path = "../../crates/axerrno" }
memory_addr = { path = "../../crates/memory_addr" }
static_assertions = "1.1.0"
spin = { version = "0.9" }
lazy_static = { version = "1.4", features = ["spin_no_std"] }
Expand Down
34 changes: 34 additions & 0 deletions api/arceos_posix_api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,33 @@
fn main() {
use std::io::Write;

fn gen_pthread_cond(out_file: &str) -> std::io::Result<()> {
let (cond_size, _cond_init) = if cfg!(feature = "multitask") {
if cfg!(feature = "smp") {
(5, "{0, 0, 0, 0, 0}") // core::mem::transmute::<_, [usize; 6]>(axsync::Mutex::new(()))
} else {
(4, "{0, 0, 0, 0}") // core::mem::transmute::<_, [usize; 5]>(axsync::Mutex::new(()))
}
} else {
(1, "{0}")
};
let mut output = Vec::new();
writeln!(
output,
"// Generated by arceos_posix_api/build.rs, DO NOT edit!"
)?;
writeln!(
output,
r#"
typedef struct {{
long __l[{cond_size}];
}} pthread_cond_t;
"#
)?;
std::fs::write(out_file, output)?;
Ok(())
}

fn gen_pthread_mutex(out_file: &str) -> std::io::Result<()> {
// TODO: generate size and initial content automatically.
let (mutex_size, mutex_init) = if cfg!(feature = "multitask") {
Expand Down Expand Up @@ -57,11 +84,17 @@ typedef struct {{
"pthread_attr_t",
"pthread_mutex_t",
"pthread_mutexattr_t",
"pollfd",
"nfds_t",
"epoll_event",
"iovec",
"clockid_t",
"rlimit",
"aibuf",
"msghdr",
"pthread_cond_t",
"pthread_condattr_t",
"sysinfo",
];
let allow_vars = [
"O_.*",
Expand Down Expand Up @@ -111,5 +144,6 @@ typedef struct {{
}

gen_pthread_mutex("../../ulib/axlibc/include/ax_pthread_mutex.h").unwrap();
gen_pthread_cond("../../ulib/axlibc/include/ax_pthread_cond.h").unwrap();
gen_c_to_rust_bindings("ctypes.h", "src/ctypes_gen.rs");
}
2 changes: 2 additions & 0 deletions api/arceos_posix_api/ctypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
#include <netinet/in.h>
#include <pthread.h>
#include <stddef.h>
#include <poll.h>
#include <sys/epoll.h>
#include <sys/resource.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/sysinfo.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/uio.h>
Expand Down
Loading

0 comments on commit 14bf167

Please sign in to comment.