Skip to content

Commit

Permalink
bthread init
Browse files Browse the repository at this point in the history
  • Loading branch information
ravixr committed Sep 6, 2023
1 parent 64f78f0 commit 43016b7
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 17 deletions.
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*.a
*.pdf
bochsout.txt
bin/*
bin
bin/sbin/*
bin/ubin/*
doc/*-kernel
Expand All @@ -47,9 +47,13 @@ toolchain
# ISO Images
*.img
*.iso
nanvix-iso/*
nanvix-iso
tools/run/bochsrc.txt

# Exceptions.
!doc/paper/img/*.pdf
!doc/paper/*.pdf

# IDEs
.vs
.vscode
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Nanvix
# BThread - A basic user-level thread library for Nanvix

[![Join us on Slack!](https://img.shields.io/badge/chat-on%20Slack-e01563.svg)](https://join.slack.com/t/nanvix/shared_invite/zt-1yu30bs28-nsNmw8IwCyh6MBBV~B~X7w)
The Bthread library is created for the Interdisciplinary Project V subject
of the computer science course at PUC Minas.

## What Is Nanvix?

> This repository hosts the educational version of Nanvix.
Nanvix is a Unix-like operating system written by [Pedro Henrique
[Nanvix](https://github.com/nanvix/nanvix) is a Unix-like operating system written by [Pedro Henrique
Penna](https://github.com/ppenna) for educational purposes. It is designed to be
simple and small, but also modern and fully featured.

Expand All @@ -16,10 +15,20 @@ Nanvix targets 32-bit x86-based PCs and only requires a floppy or
CD-ROM drive and 16 MB of RAM. You can run it either in a real PC
or in a virtual machine, using a system image.



## License and Maintainers

### Nanvix

Nanvix is a free software that is under the GPL V3 license and is
maintained by Pedro Henrique Penna. Any questions or suggestions send him an
email: <[email protected]>

### BThread

BThread is also under the GPL V3 license and is created by:

- [Arthur Ruiz](https://github.com/ArthurSRuiz)
- [Edmar Melandes](https://github.com/Lexizz7)
- [Marco Aurélio Noronha](https://github.com/marconoronha)
- [Pedro Pampolini](https://github.com/PedroPampolini)
- [Vinicius Gabriel Santos](https://github.com/ravixr)
11 changes: 5 additions & 6 deletions doc/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ This document instructs you on how to setup your development environment.
## 1. Clone This Repository

```bash
export WORKSPACE=$HOME/nanvix # Change this if you want.
export INSTALL_DIR=$WORKSPACE # Change this if you want.
mkdir -p $WORKDIR # Create workspace.
cd $WORKDIR # Switch to workspace.
git clone https://github.com/nanvix/nanvix.git # Clone repository.
cd nanvix # Switch to source tree.
export WORKDIR=$HOME/nanvix # Change this if you want.
export INSTALL_DIR=$WORKDIR # Change this if you want.
mkdir -p $WORKDIR # Create workspace.
cd $WORKDIR # Switch to workspace.
git clone https://github.com/Bois-Barganhados-Studio/nanvix-user-level-thread.git . # Clone repository.
```

## 2. Install Dependencies
Expand Down
6 changes: 6 additions & 0 deletions include/bthread.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef BTHREAD_H_
#define BTHREAD_H_



#endif /* BTHREAD_H_ */
40 changes: 40 additions & 0 deletions src/lib/bthread/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#
# Copyright(C) 2011-2016 Pedro H. Penna <[email protected]>
#
# This file is part of Nanvix.
#
# Nanvix is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Nanvix is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Nanvix. If not, see <http://www.gnu.org/licenses/>.
#

# C source files.
C_SRC = $(wildcard *.c) \

# Object files.
OBJ = $(C_SRC:.c=.o) \

# Library name.
LIB = bthread.a

# Builds the library.
all: $(OBJ)
$(AR) $(ARFLAGS) $(LIBDIR)/$(LIB) $^

# Builds object file from C source file.
%.o: %.c
$(CC) $< $(CFLAGS) -c -o $@

# Cleans compilation files.
clean:
@rm -f $(LIBDIR)/$(LIB)
@rm -f $(OBJ)
7 changes: 6 additions & 1 deletion src/lib/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@

# Conflicts.
.PHONY: libc
.PHONY: bthread

# Builds everything.
all: libc
all: libc bthread

# Builds C library.
libc:
cd libc/ && $(MAKE) all

bthread:
cd bthread/ && $(MAKE) all

# Cleans compilation files.
clean:
cd libc && $(MAKE) clean
cd bthread && $(MAKE) clean
8 changes: 8 additions & 0 deletions src/ubin/bthd/bthd.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <stdio.h>
#include <bthread.h>

int main(/*int argc, char *const argv[]*/)
{
fprintf(stderr, "Not implemented yet!\n");
return 0;
}
7 changes: 6 additions & 1 deletion src/ubin/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@
.PHONY: clear
.PHONY: nim
.PHONY: sleep
.PHONY: bthd

# Builds everything.
all: cat chgrp chmod chown cp echo kill ln login ls mv nice pwd rm stat sync \
touch tsh ps clear nim sleep
touch tsh ps clear nim sleep bthd

# Builds cat.
cat:
Expand Down Expand Up @@ -144,6 +145,9 @@ nim:
sleep:
$(CC) $(CFLAGS) $(LDFLAGS) -D TESTE sleep/*.c -o $(UBINDIR)/sleep $(LIBDIR)/libc.a

# Builds bthd.
bthd:
$(CC) $(CFLAGS) $(LDFLAGS) bthd/*.c -o $(UBINDIR)/bthd $(LIBDIR)/*.a

# Clean compilation files.
clean:
Expand Down Expand Up @@ -171,3 +175,4 @@ clean:
@rm -f $(UBINDIR)/clear
@rm -f $(UBINDIR)/nim
@rm -f $(UBINDIR)/sleep
@rm -f $(UBINDIR)/bthd

0 comments on commit 43016b7

Please sign in to comment.