├── src ├── morestack.s ├── dummy-compiler-rt.s ├── arch ├── libstd └── isodir │ └── boot │ └── grub │ └── grub.cfg ├── lib └── rustlib │ └── i686-unknown-rustos-gnu │ └── lib ├── .gitignore ├── bump-pointer ├── Cargo.toml └── src │ └── lib.rs ├── default.nix ├── i686-unknown-rustos-gnu.json ├── .gitmodules ├── Cargo.toml ├── LICENSE-MIT ├── Makefile ├── README.md └── LICENSE-APACHE /src/morestack.s: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/dummy-compiler-rt.s: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/arch: -------------------------------------------------------------------------------- 1 | libstd/sys/rustos/arch/ -------------------------------------------------------------------------------- /src/libstd: -------------------------------------------------------------------------------- 1 | ../lib/rust/src/libstd/ -------------------------------------------------------------------------------- /lib/rustlib/i686-unknown-rustos-gnu/lib: -------------------------------------------------------------------------------- 1 | ../../rust/cargo/std_deps/target/i686-unknown-rustos-gnu/release/deps -------------------------------------------------------------------------------- /src/isodir/boot/grub/grub.cfg: -------------------------------------------------------------------------------- 1 | set default=0 2 | set timeout=0 3 | 4 | menuentry "myos" { 5 | multiboot /boot/boot.bin 6 | } 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.img 2 | *.swp 3 | *.bin 4 | *.o 5 | *~ 6 | *.rlib 7 | *.kateproject* 8 | *.iso 9 | *.so 10 | *.a 11 | *.bc 12 | **/target/ 13 | **/Cargo.lock 14 | 15 | # preprocessed assembly 16 | /*.s 17 | -------------------------------------------------------------------------------- /bump-pointer/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | 3 | # name is mandated by liballoc for nowx 4 | 5 | name = "external" 6 | version = "0.0.1" 7 | authors = [ "you@example.com" ] 8 | features = [ "no_std" ] 9 | 10 | [lib] 11 | name = "external" 12 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | (import {}).callPackage ( 2 | {stdenv, nasm, qemu, gdb}: stdenv.mkDerivation rec { 3 | name = "RustOS"; 4 | 5 | nativeBuildInputs = [ gdb nasm qemu ]; 6 | src = ./src; 7 | 8 | enableParallelBuilding = true; 9 | }) {} 10 | -------------------------------------------------------------------------------- /i686-unknown-rustos-gnu.json: -------------------------------------------------------------------------------- 1 | { 2 | "llvm-target": "i686-unknown-rustos-gnu", 3 | 4 | "target-endian": "little", 5 | "target-pointer-width": "32", 6 | "data-layout": "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128", 7 | "arch": "x86", 8 | "os": "rustos", 9 | 10 | "disable-redzone": true, 11 | "target-family": "rustos", 12 | "no-compiler-rt": true 13 | } 14 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/rust"] 2 | path = lib/rust 3 | url = https://github.com/ryanra/rust.git 4 | [submodule "lib/rlibc"] 5 | path = lib/rlibc 6 | url = https://github.com/ryanra/rlibc.git 7 | [submodule "lib/lazy-static-spin"] 8 | path = lib/lazy-static-spin 9 | url = https://github.com/RustOS-Fork-Holding-Ground/lazy-static-spin 10 | [submodule "lib/lazy-static.rs"] 11 | path = lib/lazy-static.rs 12 | url = https://github.com/ryanra/lazy-static.rs.git 13 | [submodule "lib/libfringe"] 14 | path = lib/libfringe 15 | url = https://github.com/nathan7/libfringe.git 16 | [submodule "lib/barn"] 17 | path = lib/barn 18 | url = https://github.com/ryanra/barn.git 19 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rustos" 3 | version = "0.0.1" 4 | authors = [ "you@example.com" ] 5 | 6 | [lib] 7 | name = "std" 8 | crate-type = [ "staticlib" ] 9 | path = "src/libstd/lib.rs" 10 | 11 | [features] 12 | rustos = [] 13 | 14 | [dependencies.external] 15 | path = "bump-pointer" 16 | 17 | [dependencies.rlibc] 18 | git = "https://github.com/alexcrichton/rlibc" 19 | rev = "defb486e765846417a8e73329e8c5196f1dca49a" 20 | 21 | [dependencies.fringe] 22 | git = "https://github.com/nathan7/libfringe" 23 | rev = "45ae3505c95f607f3d9e2618a4e619c87df13b29" 24 | 25 | [dependencies.lazy_static] 26 | path = "lib/lazy-static.rs" 27 | 28 | [dependencies.barn] 29 | path = "lib/barn" 30 | default-features = false 31 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Ryan Rasti 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # TODO(ryan): I've changed as/ld to native cross compiler ones. 2 | # Could this cause dependency problems in the future? 3 | AS=as -march=i386 --32 4 | LD=ld -melf_i386 -nostdlib 5 | QEMU=qemu-system-i386 6 | TARGET=i686-unknown-rustos-gnu 7 | TARGET_SPEC=$(shell realpath ./$(TARGET)) 8 | QEMUARGS=-device rtl8139,vlan=0 -net user,id=net0,vlan=0 -net dump,vlan=0,file=/tmp/rustos-dump.pcap 9 | SRC=src/ 10 | DEPS=lib/rust/cargo/std_deps 11 | 12 | .PHONY: all clean cleanproj run debug vb target/$(TARGET)/libstd*.a rustos 13 | 14 | all: boot.bin 15 | 16 | run: boot.bin 17 | $(QEMU) $(QEMUARGS) -kernel $< 18 | 19 | debug: boot.bin 20 | $(QEMU) $(QEMUARGS) -S -gdb tcp::3333 -kernel $< & 21 | gdb $< -ex "target remote :3333" -ex "break _start" -ex "c" 22 | 23 | vb: boot.iso 24 | virtualbox --debug --startvm rustos 25 | 26 | rustos: target/$(TARGET)/debug/libstd*.a $(SRC)/*.rs 27 | 28 | deps: lib/rust/cargo/std_deps/Cargo.toml 29 | ln -f -s $(shell realpath $(TARGET).json) $(DEPS) && cd $(DEPS) && cargo rustc --release --target $(TARGET) --verbose 30 | 31 | target/$(TARGET)/debug/libstd*.a: Cargo.toml libmorestack.a libcompiler-rt.a lib_context.a deps 32 | RUSTFLAGS="--sysroot=$(shell realpath .) -L ." cargo build --target $(TARGET) --verbose 33 | 34 | boot.bin: $(SRC)/arch/x86/link.ld boot.o target/$(TARGET)/debug/libstd*.a interrupt.o context.o dependencies.o 35 | $(LD) -o $@ -T $^ 36 | 37 | boot.iso: boot.bin 38 | cp boot.bin src/isodir/boot/ 39 | grub-mkrescue -o boot.iso src/isodir 40 | 41 | compiler-rt.o: $(SRC)/dummy-compiler-rt.s # needed for staticlib creation 42 | $(AS) -o $@ $< 43 | 44 | %.s: ../rust/src/rt/arch/i386/%.S 45 | $(CPP) -o $@ $< 46 | 47 | %.o: $(SRC)/arch/x86/%.s 48 | $(AS) -o $@ $< 49 | 50 | %.o: $(SRC)/%.s 51 | $(AS) -o $@ $< 52 | 53 | lib%.a: %.o 54 | ar rcs $@ $< 55 | 56 | 57 | clean: cleanproj 58 | cargo clean 59 | cd lib/rust/cargo/std_deps && cargo clean 60 | 61 | cleanproj: 62 | cargo clean 63 | rm -f *.bin *.img *.iso *.rlib *.a *.so *.o *.s target/$(TARGET)/debug/libstd*.a 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | RustOS 2 | ===== 3 | 4 | A simple, [language-based](https://en.wikipedia.org/wiki/Language-based_system) OS. 5 | 6 | 7 | ### Current features: 8 | * Simple VGA for seeing output 9 | * Some Rust libraries (core, alloc, collections) already in 10 | * Working (but limited) keyboard input 11 | * Beginnings of a network driver (RTL8139) and stack (it can send properly formatted UDP packets!) 12 | 13 | ### Building: 14 | 1. Dependencies: 15 | * qemu (emulator) **or** grub-mkrescue (run an iso on a VM or hardware) 16 | * as 17 | * ld 18 | * rustc (1.6.0-nightly) 19 | * cargo (1.6.0-nightly) 20 | 2. Pull this repo `git clone https://github.com/ryanra/RustOS.git` 21 | 3. Make sure to pull the submodules as well: `git submodule update --init` 22 | 4. Run: 23 | * On qemu: `make run` 24 | * Or, make an iso `make iso` and run it on a VM or real hardware! 25 | 26 | ### Organization: 27 | 1. Main kernel code now in a fork of rust's libstd 28 | 2. There is a libstd symlink to the bulk of the code (links to rust submodule at `lib/rust/src/libstd/`) 29 | 3. Almost RustOS rust code is in `src/libstd/sys/rustos/` which is a link to [`lib/rust/src/libstd/sys/rustos/`](https://github.com/ryanra/rust/tree/master/src/libstd/sys/rustos) 30 | 31 | ### Design goals: 32 | 1. Implement the entire Rust standard library *on bare metal*. Essentially, 33 | you should be able to write your program, link against `std`, add a bootloader, and run 34 | on bare metal. Of course, we'll need a little more to make the operating system extensible (specifically, 35 | an interface for adding drivers and libraries) 36 | 37 | 2. The OS will be as simple as possible with as little as possible in it. Specifically, Rust type safety allows us to omit: 38 | * Paging. CPU memory protection is unecessary if you can only execute safe code 39 | * Syscalls. You can only call functions exported in `std` (there is the issue of `unsafe` though, which will need to be considered at some point) 40 | * (This simplicitly may also end up scoring in terms of performance!) 41 | 42 | 3. Micro/Monolithic kernel is really irrelevant because everything is running in kernel mode and safety 43 | is enforced by the language, so there's no need for user mode. That said, the goal is to keep this code 44 | base small and enforce least-privledge with tight modules that also allow future additions. 45 | 46 | 3. Security. That's the big advantage that Rust would bring to an OS (i.e., memory safety) and that current OSes are really lacking. 47 | 48 | ### Short-term goals: 49 | 1. ~~Handle interrupts, specifically get the keyboard working.~~ done! 50 | 2. Threading/Multiprocessing 51 | * There's the beginnings of a single-core implementation, but it looks like `libgreen` can be slightly modified to this end 52 | 3. Other architectures: 53 | * There's some beginnings of architecture-agnostic code, but it needs to be taken further 54 | 55 | ### Longer-term goals: 56 | 57 | 1. Basic drivers 58 | * This should include a modular and secure (least privledge) interface for adding your own drivers as well 59 | 2. A filesystem 60 | 3. Network stack 61 | 4. Port `rustc` to RustOS 62 | 5. That's probably it! 63 | 64 | ### Current issues: 65 | 1. ~~Linkage probelms~~ fixed! 66 | 2. Threading is buggy and needs more attention and more features. 67 | 3. The current allocator never actually frees data and is just there to get `collections` working. 68 | 69 | ### License 70 | [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0) or the [MIT license](http://opensource.org/licenses/MIT), at your option. See LICENSE-APACHE and LICENSE-MIT for details. 71 | -------------------------------------------------------------------------------- /bump-pointer/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![feature(allocator)] 2 | #![allocator] 3 | 4 | #![no_std] 5 | 6 | extern "C" { 7 | fn memmove(dest: *mut u8, src: *mut u8, count: u32); 8 | } 9 | 10 | 11 | static mut allocator: BumpPointer = BumpPointer { 12 | start: 0 as *mut u8, 13 | stop: 0 as *mut u8, 14 | }; 15 | 16 | pub fn set_allocator(start: *mut u8, stop: *mut u8) { 17 | unsafe { 18 | allocator = BumpPointer::new(start, stop); 19 | } 20 | } 21 | 22 | pub trait Allocator 23 | { 24 | fn allocate(&mut self, size: usize, align: usize) -> Option<*mut u8>; 25 | 26 | fn deallocate(&mut self, ptr: *mut u8, old_size: usize, align: usize); 27 | 28 | fn reallocate(&mut self, ptr: *mut u8, old_size: usize, size: usize, 29 | align: usize) -> Option<*mut u8> 30 | { 31 | let attempt = self.allocate(size, align); 32 | if let Some(new) = attempt { 33 | unsafe { memmove(new, ptr, old_size as u32) }; 34 | self.deallocate(ptr, old_size, align); 35 | } 36 | attempt 37 | } 38 | 39 | fn reallocate_inplace(&mut self, _ptr: *mut u8, old_size: usize, _size: usize, 40 | _align: usize) -> usize 41 | { 42 | old_size 43 | } 44 | 45 | fn usable_size(&mut self, size: usize, _align: usize) -> usize 46 | { 47 | size 48 | } 49 | //fn stats_print(&mut self); 50 | 51 | fn debug(&mut self) -> (*mut u8, usize); 52 | } 53 | 54 | pub struct BumpPointer { 55 | start: *mut u8, 56 | stop: *mut u8, 57 | } 58 | 59 | impl BumpPointer 60 | { 61 | pub fn new(start: *mut u8, stop: *mut u8) -> BumpPointer { 62 | return BumpPointer { start: start, stop: stop }; 63 | } 64 | } 65 | 66 | impl Allocator for BumpPointer 67 | { 68 | #[inline] 69 | fn allocate(&mut self, size: usize, align: usize) -> Option<*mut u8> 70 | { 71 | let aligned: usize = { 72 | let a = self.start as usize + align - 1; 73 | a - (a % align) 74 | }; 75 | let new_start = aligned + size; 76 | 77 | if new_start > self.stop as usize { 78 | unreachable!("allocator done!"); 79 | } else { 80 | self.start = new_start as *mut u8; 81 | Some(aligned as *mut u8) 82 | } 83 | } 84 | 85 | #[inline] 86 | fn deallocate(&mut self, _ptr: *mut u8, _old_size: usize, _align: usize) { } 87 | 88 | #[inline] 89 | fn debug(&mut self) -> (*mut u8, usize) { 90 | (self.start, self.stop as usize - self.start as usize) 91 | } 92 | } 93 | 94 | #[no_mangle] 95 | pub unsafe extern fn __rust_allocate(size: usize, align: usize) -> *mut u8 { 96 | match allocator.allocate(size, align) { 97 | Some(ptr) => ptr, 98 | None => 0 as *mut u8 99 | } 100 | } 101 | 102 | #[no_mangle] 103 | pub unsafe extern fn __rust_deallocate(ptr: *mut u8, old_size: usize, align: usize) { 104 | allocator.deallocate(ptr, old_size, align) 105 | } 106 | 107 | #[no_mangle] 108 | pub unsafe extern fn __rust_reallocate(ptr: *mut u8, old_size: usize, size: usize, 109 | align: usize) -> *mut u8 { 110 | match allocator.reallocate(ptr, old_size, size, align) { 111 | Some(ptr) => ptr, 112 | None => 0 as *mut u8 113 | } 114 | } 115 | 116 | #[no_mangle] 117 | pub unsafe extern fn reallocate_inplace(ptr: *mut u8, old_size: usize, size: usize, 118 | align: usize) -> usize { 119 | allocator.reallocate_inplace(ptr, old_size, size, align) 120 | } 121 | 122 | #[no_mangle] 123 | pub extern fn usable_size(size: usize, align: usize) -> usize { 124 | unsafe { 125 | allocator.usable_size(size, align) 126 | } 127 | } 128 | 129 | pub fn stats_print() {} 130 | -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------