File tree 6 files changed +56
-2
lines changed
6 files changed +56
-2
lines changed Original file line number Diff line number Diff line change 1
1
* ~
2
2
_ *
3
3
* .o
4
+ * .a
4
5
* .d
5
6
* .asm
6
7
* .sym
Original file line number Diff line number Diff line change @@ -146,7 +146,15 @@ tags: $(OBJS) entryother.S _init
146
146
vectors.S : vectors.pl
147
147
./vectors.pl > vectors.S
148
148
149
- ULIB = ulib.o usys.o printf.o umalloc.o
149
+ # Rust library.
150
+ libxv6.a : $(shell find rust -type f -not -path "* /target/* ")
151
+ cd rust && \
152
+ cargo build --release && \
153
+ cd ../ && \
154
+ cp rust/target/i686-unknown-linux-gnu/release/libxv6.a libxv6.a
155
+
156
+ # User space libraries.
157
+ ULIB = ulib.o usys.o printf.o umalloc.o libxv6.a
150
158
151
159
_% : % .o $(ULIB )
152
160
$(LD ) $(LDFLAGS ) -N -e main -Ttext 0 -o $@ $^
@@ -170,7 +178,6 @@ mkfs: mkfs.c fs.h
170
178
171
179
UPROGS =\
172
180
_cat\
173
- _nc\
174
181
_echo\
175
182
_forktest\
176
183
_grep\
@@ -179,6 +186,7 @@ UPROGS=\
179
186
_ln\
180
187
_ls\
181
188
_mkdir\
189
+ _nc\
182
190
_rm\
183
191
_sh\
184
192
_stressfs\
Original file line number Diff line number Diff line change
1
+ [build ]
2
+ target = [" i686-unknown-linux-gnu" ]
3
+
Original file line number Diff line number Diff line change
1
+ debug /
2
+ target /
3
+ Cargo.lock
4
+ ** /* .rs.bk
5
+
Original file line number Diff line number Diff line change
1
+ [lib ]
2
+ crate-type = [ " staticlib" ]
3
+
4
+ [package ]
5
+ name = " xv6"
6
+ version = " 0.1.0"
7
+ edition = " 2021"
8
+
9
+ [profile .dev ]
10
+ panic = " abort"
11
+
12
+ [profile .release ]
13
+ panic = " abort"
Original file line number Diff line number Diff line change
1
+ #![ no_std]
2
+ #![ feature( c_variadic) ]
3
+
4
+ use core:: panic:: PanicInfo ;
5
+
6
+ #[ panic_handler]
7
+ fn panic ( _: & PanicInfo ) -> ! {
8
+ unsafe {
9
+ printf ( 1 , "panic!" . as_ptr ( ) ) ;
10
+ }
11
+ loop { }
12
+ }
13
+
14
+ extern "C" {
15
+ // printf.c
16
+ pub fn printf ( fd : i32 , c : * const u8 , args: ...) ;
17
+ }
18
+
19
+ #[ no_mangle]
20
+ fn hello_world ( ) {
21
+ unsafe {
22
+ printf ( 1 , "hello from Rust!\n " . as_bytes ( ) . as_ptr ( ) ) ;
23
+ }
24
+ }
You can’t perform that action at this time.
0 commit comments