Compare commits
13 Commits
pmm
...
huge_refactor
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ed3b73df8 | |||
| ad5edb57db | |||
| 394e932b9c | |||
| fdd556f742 | |||
| 4bad44e475 | |||
| 096a66adbb | |||
| 53d325749d | |||
| 8a3e9e3afc | |||
| e38c20dbd3 | |||
| c8bb85364c | |||
| fe18004f7d | |||
| 0b3dbed4be | |||
| 3b6e272fd2 |
+1
-1
@@ -1,5 +1,5 @@
|
||||
[build]
|
||||
target = "x86_64-kernel"
|
||||
target = "x86_64-kernel.json"
|
||||
target-dir = "build/target"
|
||||
|
||||
[unstable]
|
||||
|
||||
Generated
+2
@@ -4,6 +4,8 @@
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/kernel/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/lib_example/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/libk/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/libm/src" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
|
||||
Vendored
+3
-1
@@ -1,9 +1,11 @@
|
||||
{
|
||||
"rust-analyzer.cargo.allTargets": false,
|
||||
"rust-analyzer.cargo.target": "x86_64-kernel",
|
||||
"rust-analyzer.cargo.target": "x86_64-kernel.json",
|
||||
"[rust]": {
|
||||
"editor.defaultFormatter": "rust-lang.rust-analyzer",
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"rust-analyzer.check.command": "clippy",
|
||||
"rust-analyzer.procMacro.attributes.enable": true,
|
||||
"rust-analyzer.cargo.buildScripts.enable": true
|
||||
}
|
||||
Generated
+5
-45
@@ -22,9 +22,9 @@ checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.15"
|
||||
version = "1.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c736e259eea577f443d5c86c304f9f4ae0295c43f3ba05c21f1d66b5f06001af"
|
||||
checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c"
|
||||
dependencies = [
|
||||
"shlex",
|
||||
]
|
||||
@@ -35,20 +35,10 @@ version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8"
|
||||
dependencies = [
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-queue",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.9.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
|
||||
dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-queue"
|
||||
version = "0.3.12"
|
||||
@@ -110,7 +100,9 @@ name = "foundry_os"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libk",
|
||||
"crossbeam",
|
||||
"futures-util",
|
||||
"libm",
|
||||
"limine",
|
||||
"pc-keyboard",
|
||||
"pic8259",
|
||||
@@ -148,20 +140,6 @@ version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||
|
||||
[[package]]
|
||||
name = "libk"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"crossbeam",
|
||||
"futures-util",
|
||||
"libm",
|
||||
"limine",
|
||||
"linked_list_allocator",
|
||||
"pc-keyboard",
|
||||
"spin",
|
||||
"x86_64",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.1.0"
|
||||
@@ -181,15 +159,6 @@ dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linked_list_allocator"
|
||||
version = "0.10.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286"
|
||||
dependencies = [
|
||||
"spinning_top",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.12"
|
||||
@@ -272,15 +241,6 @@ dependencies = [
|
||||
"lock_api",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spinning_top"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b9eb1a2f4c41445a3a0ff9abc5221c5fcd28e1f13cd7c0397706f9ac938ddb0"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.11.1"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
[workspace]
|
||||
members = ["kernel", "libk", "libm"]
|
||||
members = ["kernel", "libm"]
|
||||
resolver = "2"
|
||||
|
||||
[workspace.package]
|
||||
|
||||
Vendored
+3
-1
@@ -1 +1,3 @@
|
||||
{}
|
||||
{
|
||||
"cssTheme": "Dark Moss"
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
[]
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"id": "obsidian-excalidraw-plugin",
|
||||
"name": "Excalidraw",
|
||||
"version": "2.8.3",
|
||||
"minAppVersion": "1.1.6",
|
||||
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
|
||||
"author": "Zsolt Viczian",
|
||||
"authorUrl": "https://www.zsolt.blog",
|
||||
"fundingUrl": "https://ko-fi.com/zsolt",
|
||||
"helpUrl": "https://github.com/zsviczian/obsidian-excalidraw-plugin#readme",
|
||||
"isDesktopOnly": false
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Vendored
+20
-33
@@ -4,41 +4,21 @@
|
||||
"type": "split",
|
||||
"children": [
|
||||
{
|
||||
"id": "a20540b7c1ddbfca",
|
||||
"id": "c178a2dff57ae0aa",
|
||||
"type": "tabs",
|
||||
"children": [
|
||||
{
|
||||
"id": "e1fb15cab546d0b6",
|
||||
"id": "6d395e6a4c72e1c8",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "Usage/Building The Kernel.md",
|
||||
"file": "Planning & To-Dos.md",
|
||||
"mode": "source",
|
||||
"source": false
|
||||
},
|
||||
"icon": "lucide-file",
|
||||
"title": "Building The Kernel"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "6bf1f87bf81a3031",
|
||||
"type": "tabs",
|
||||
"children": [
|
||||
{
|
||||
"id": "add883d295e04659",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "Usage/Building The Kernel.md",
|
||||
"mode": "preview",
|
||||
"source": false
|
||||
},
|
||||
"icon": "lucide-file",
|
||||
"title": "Building The Kernel"
|
||||
"title": "Planning & To-Dos"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -73,7 +53,7 @@
|
||||
"state": {
|
||||
"type": "search",
|
||||
"state": {
|
||||
"query": "tag:#usage",
|
||||
"query": "",
|
||||
"matchingCase": false,
|
||||
"explainSearch": false,
|
||||
"collapseAll": false,
|
||||
@@ -98,8 +78,7 @@
|
||||
}
|
||||
],
|
||||
"direction": "horizontal",
|
||||
"width": 200,
|
||||
"collapsed": true
|
||||
"width": 307.5
|
||||
},
|
||||
"right": {
|
||||
"id": "baa2a8e61b737fa6",
|
||||
@@ -177,7 +156,8 @@
|
||||
}
|
||||
],
|
||||
"direction": "horizontal",
|
||||
"width": 300
|
||||
"width": 300,
|
||||
"collapsed": true
|
||||
},
|
||||
"left-ribbon": {
|
||||
"hiddenItems": {
|
||||
@@ -185,14 +165,21 @@
|
||||
"graph:Open graph view": false,
|
||||
"canvas:Create new canvas": false,
|
||||
"daily-notes:Open today's daily note": false,
|
||||
"templates:Insert template": false,
|
||||
"command-palette:Open command palette": false
|
||||
"command-palette:Open command palette": false,
|
||||
"templates:Insert template": false
|
||||
}
|
||||
},
|
||||
"active": "add883d295e04659",
|
||||
"active": "6d395e6a4c72e1c8",
|
||||
"lastOpenFiles": [
|
||||
"Usage/Building The Kernel.md",
|
||||
"Planning & To-Dos.md",
|
||||
"structure/idk.canvas",
|
||||
"structure/kernel.md",
|
||||
"structure/libk.md",
|
||||
"structure/libm.md",
|
||||
"structure/libk",
|
||||
"structure",
|
||||
"Usage",
|
||||
"Welcome.md",
|
||||
"Usage/Building The Kernel.md"
|
||||
"Welcome.md"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
> [!todo] Testing
|
||||
> - [ ] setup custom test frameworks (Use CrystalOS-V2 as a reference)
|
||||
> - [ ] write a sub-crate for tests
|
||||
> - [ ] implement several unit tests on things that we are likely to break often
|
||||
> - [ ] setup Git CI/CD pipeline with testing
|
||||
> - [ ] figure out how to run QEMU in the test environment
|
||||
> - [ ] write a script to run tests
|
||||
> - [ ] a release should only be published if all tests pass
|
||||
>
|
||||
> [!todo] HAL (Hardware Abstraction Layer)
|
||||
> - [ ] use either traits or cfg attributes to support more than just x86_64
|
||||
> - [ ] prefer writing cross platform code (I am aware I made the problem slightly worse by merging libk with the kernel sources)
|
||||
>
|
||||
> [!todo] Allocator
|
||||
> - [ ] learn about several allocator designs and decide on the optimal one
|
||||
> - [ ] implementation
|
||||
> - [ ] implement an allocate method
|
||||
> - [ ] implement a deallocate method
|
||||
> - [ ] set the global allocator
|
||||
> - [ ] testing
|
||||
> - [ ] write unit tests
|
||||
> - [ ] many allocations
|
||||
> - [ ] large allocations
|
||||
> - [ ] allocating more memory than is available
|
||||
> - [ ] pass unit tests
|
||||
|
||||
> [!todo] Threading
|
||||
> - [ ] implement thread switching functionality
|
||||
> - [ ] switch stacks
|
||||
> - [ ] implement multi-threading
|
||||
> - [ ] figure out how to turn on another core
|
||||
> - [ ] Scheduler
|
||||
> - [ ] which task goes on which thread?
|
||||
> - [ ] round robin / time slicing algorithm
|
||||
> - [ ] switch tasks on a given core
|
||||
> - [ ] push registers
|
||||
> - [ ] switch stacks
|
||||
> - [ ] ensure the scheduler knows where to find the stack for each thread
|
||||
> - [ ] move a given task to a new core
|
||||
> - [ ] differentiate between kernel threads and user threads
|
||||
> - [ ] create syscall to create a new thread
|
||||
|
||||
> [!todo] Filesystem
|
||||
> - [ ] AHCI Implementation
|
||||
> - [ ] figure out what hard drives are attached
|
||||
> - [ ] read data
|
||||
> - [ ] write data
|
||||
> - [ ] FAT32 Implementation
|
||||
> - [ ] parse FAT header
|
||||
> - [ ] figure out where files are / what files are what
|
||||
> - [ ] parse file metadata / figure out type of file
|
||||
> - [ ] reading the entirety of a file into memory
|
||||
> - [ ] *(extension)* ext2 Implementation
|
||||
> - [ ] Syscall API
|
||||
> - [ ] provide a user program with file read / write access given a filename
|
||||
> - [ ] translate a filename into a disk location of data & the size of the data
|
||||
> - [ ] provide an interface to read from a file or write to a file
|
||||
|
||||
> [!todo] APIC
|
||||
> - [ ] Enable APIC
|
||||
> - [x] Get apic location from MSR
|
||||
> - [x] Enable APIC bit flag
|
||||
> - [x] Disable Legacy PIC
|
||||
> - [ ] Map physical APIC address to virtual memory
|
||||
>
|
||||
>> [!error]
|
||||
>> Page fault exception occurs when APIC is activated
|
||||
>
|
||||
>- [ ] Setup Interrupt handlers to handle interrupts generated by the APIC
|
||||
> - [ ] Timer Interrupts
|
||||
> - [ ] Keyboard Interrupts
|
||||
|
||||
> [!todo] Userspace (req: Threading, Filesystem)
|
||||
> - [ ] Load program into memory from disk
|
||||
> - [ ] requires:
|
||||
> - [ ] Program Loader
|
||||
> - [ ] Parse ELF File
|
||||
> - [ ] Load file into memory
|
||||
> - [ ] Filesystem
|
||||
> - [ ] Scheduler (to start and manage the process)
|
||||
> - [ ] Start a user process
|
||||
> - [ ] switch stacks
|
||||
> - [ ] jump to user code
|
||||
|
||||
>[!todo] User Interface
|
||||
>- This will be a library so that programs in userspace can provide a user interface rather than relying on text commands from a basic terminal
|
||||
>- features required:
|
||||
> - [ ] Rendering frames to a display buffer
|
||||
> - [ ] requires: Frame rendering Syscall
|
||||
> - [ ] I/O
|
||||
> - [ ] syncio
|
||||
> - [ ] keystrokes
|
||||
> - [ ] asyncio
|
||||
> - [ ] keystrokes
|
||||
> - [ ] requires: I/O Syscalls
|
||||
> - [ ] Window struct
|
||||
> - [ ] stores it's size and location
|
||||
> - [ ] handles rendering pixels to the screen
|
||||
> - [ ] Widgets
|
||||
> - [ ] textbox / label
|
||||
> - [ ] single line text input
|
||||
> - [ ] how do we capture keyboard inputs?
|
||||
> - [ ] multiline text input
|
||||
> - [ ] how do we capture keyboard inputs?
|
||||
> - [ ] button
|
||||
> - [ ] dialog
|
||||
> - [ ] box widget
|
||||
> - [ ] figure out how to nest other widgets inside it
|
||||
>```rust
|
||||
>pub struct Window {
|
||||
> position;
|
||||
> dimensions;
|
||||
>}
|
||||
>
|
||||
>impl Window {
|
||||
> fn display(&self, frame: &Frame) -> Result<(), RenderError>;
|
||||
>}
|
||||
>
|
||||
>pub struct Frame<'a> {
|
||||
> window: &'a Window,
|
||||
> data: <"... a suitable type to store pixels">
|
||||
>}
|
||||
>
|
||||
>impl<'a> Frame<'a> {
|
||||
> pub fn display(&self) -> Result<(), RenderError> {
|
||||
> self.window.display(self)
|
||||
> }
|
||||
>}
|
||||
>
|
||||
> pub trait Widget {
|
||||
> fn render(&self) -> Frame;
|
||||
> }
|
||||
>```
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"nodes":[
|
||||
{"id":"8391ed519ab6cb3d","type":"group","x":-920,"y":600,"width":1595,"height":360,"label":"Hardware Layer"},
|
||||
{"id":"967decfbdbf166e2","type":"group","x":-920,"y":120,"width":1595,"height":320,"label":"Kernel Layer (kernelspace)"},
|
||||
{"id":"efd3cf75db396678","type":"group","x":-920,"y":-280,"width":1595,"height":240,"label":"System Layer (userspace)"},
|
||||
{"id":"d577e6c4fa3d7479","type":"group","x":-920,"y":-600,"width":1595,"height":140,"label":"User Layer (userspace)"},
|
||||
{"id":"549099b4188ff073","type":"text","text":"Interrupt handling & initialisation","x":-204,"y":320,"width":250,"height":60,"color":"2"},
|
||||
{"id":"d0c73e9e86edba62","type":"text","text":"Kernel #kernel","x":-220,"y":260,"width":281,"height":140,"color":"2"},
|
||||
{"id":"4fdc8ae730503ad0","type":"text","text":"libk #kernel","x":-880,"y":260,"width":280,"height":140,"color":"2"},
|
||||
{"id":"4839a4f4f0980254","type":"text","text":"System Libraries #userspace","x":-220,"y":-240,"width":281,"height":160,"color":"3"},
|
||||
{"id":"ba48ee2ccc891a62","type":"text","text":"Scheduler","x":-880,"y":160,"width":280,"height":60,"color":"2"},
|
||||
{"id":"3d31fc276e0ba4a0","type":"text","text":"UI Shell #userspace","x":-880,"y":-560,"width":280,"height":60,"color":"4"},
|
||||
{"id":"6b5e17c10589a7b6","type":"text","text":"Generic Application #userspace","x":-219,"y":-560,"width":281,"height":60,"color":"4"},
|
||||
{"id":"0a47f47a2c7b3609","type":"text","text":"CPU #hardware","x":-880,"y":640,"width":280,"height":280,"color":"1"},
|
||||
{"id":"a7002e4427f0540d","type":"text","text":"lib_io","x":-200,"y":-160,"width":122,"height":60,"color":"3"},
|
||||
{"id":"e09d0bccffd19ed9","type":"text","text":"lib_ui","x":-78,"y":-160,"width":118,"height":60,"color":"3"},
|
||||
{"id":"cbfeda8989b260d8","type":"text","text":"Userspace Drivers #userspace","x":360,"y":-240,"width":281,"height":160,"color":"3"},
|
||||
{"id":"3acced35498279a0","type":"text","text":"Hardware #hardware\n- Display\n- Hard drives\n- Keyboard\n- Mouse","x":360,"y":640,"width":281,"height":280,"color":"1"},
|
||||
{"id":"31548bb91b4977eb","type":"text","text":"Syscall API","x":-219,"y":160,"width":281,"height":60,"color":"2"},
|
||||
{"id":"110b7bee2ba99819","type":"text","text":"Drivers & low level kernel libraries","x":-860,"y":320,"width":240,"height":60,"color":"2"}
|
||||
],
|
||||
"edges":[
|
||||
{"id":"6a8d6b7540c2898d","fromNode":"3d31fc276e0ba4a0","fromSide":"right","toNode":"4839a4f4f0980254","toSide":"left","color":"3"},
|
||||
{"id":"57aedf427a150ff1","fromNode":"6b5e17c10589a7b6","fromSide":"bottom","toNode":"4839a4f4f0980254","toSide":"top","color":"3","label":"Applications are statically \nlinked to system libraries"},
|
||||
{"id":"d292a19f88032809","fromNode":"4839a4f4f0980254","fromSide":"bottom","toNode":"31548bb91b4977eb","toSide":"top","color":"2","label":"system libraries make syscalls"},
|
||||
{"id":"8b437f1c08e1caf2","fromNode":"ba48ee2ccc891a62","fromSide":"top","toNode":"3d31fc276e0ba4a0","toSide":"bottom","color":"4","label":"Scheduler Starts\nUI in userspace"},
|
||||
{"id":"3e2c6f6d5dcd7613","fromNode":"4839a4f4f0980254","fromSide":"right","toNode":"cbfeda8989b260d8","toSide":"left","color":"3"},
|
||||
{"id":"88f6e95c288c933d","fromNode":"31548bb91b4977eb","fromSide":"top","toNode":"4839a4f4f0980254","toSide":"bottom","color":"2"},
|
||||
{"id":"156c8a89b537e219","fromNode":"cbfeda8989b260d8","fromSide":"left","toNode":"4839a4f4f0980254","toSide":"right","color":"3","label":"some libs talk to\nhardware through\nuserspace drivers"},
|
||||
{"id":"0d04c5b0f76a5d9b","fromNode":"cbfeda8989b260d8","fromSide":"bottom","toNode":"3acced35498279a0","toSide":"top","fromEnd":"arrow","color":"1","label":"Userspace drivers can talk\ndirectly to hardware so\nin the case of a driver crash\nthe kernel is unaffected"},
|
||||
{"id":"e9f1afb45bf17b77","fromNode":"4fdc8ae730503ad0","fromSide":"bottom","toNode":"3acced35498279a0","toSide":"left","fromEnd":"arrow","color":"1","label":"Libk handles most hardware\ninteraction, keeping the core kernel codebase as minimal\nas possible"},
|
||||
{"id":"99414d640e519c8c","fromNode":"4fdc8ae730503ad0","fromSide":"right","toNode":"d0c73e9e86edba62","toSide":"left","fromEnd":"arrow","color":"2","label":"kernel static linked to libk\nmost kernel functionality\nisfound in libk"},
|
||||
{"id":"85cd865c914dd125","fromNode":"549099b4188ff073","fromSide":"top","toNode":"d0c73e9e86edba62","toSide":"top","color":"2"},
|
||||
{"id":"e882694ec774c0d6","fromNode":"4fdc8ae730503ad0","fromSide":"top","toNode":"ba48ee2ccc891a62","toSide":"bottom","color":"2"},
|
||||
{"id":"c689b667be8cdfab","fromNode":"d0c73e9e86edba62","fromSide":"top","toNode":"31548bb91b4977eb","toSide":"bottom","color":"2"},
|
||||
{"id":"0c9da0cce11e4bd1","fromNode":"ba48ee2ccc891a62","fromSide":"bottom","toNode":"4fdc8ae730503ad0","toSide":"top","color":"2"},
|
||||
{"id":"c45efb0ad498f8a8","fromNode":"ba48ee2ccc891a62","fromSide":"right","toNode":"6b5e17c10589a7b6","toSide":"left","color":"4","label":"Scheduler\nstarts applications"},
|
||||
{"id":"aee2cd6ef9682f0f","fromNode":"31548bb91b4977eb","fromSide":"left","toNode":"ba48ee2ccc891a62","toSide":"right","color":"2","label":"system libs can talk to\nthe scheduler to manage\nprocesses"},
|
||||
{"id":"b1b2b96d8ac2b490","fromNode":"4fdc8ae730503ad0","fromSide":"bottom","toNode":"0a47f47a2c7b3609","toSide":"top","fromEnd":"arrow","color":"1"}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
- contains all proc macros for building the kernel
|
||||
|
||||
## Current Features
|
||||
### font importer:
|
||||
- a macro that takes a filename to a font file and turns it into a font.
|
||||
```rust
|
||||
pub struct Font {
|
||||
width: usize,
|
||||
height: usize,
|
||||
length: u16,
|
||||
data: [[u8; 16]; 512],
|
||||
}
|
||||
|
||||
pub static FONT_CP850_8X16: Font =
|
||||
Font::new(include_font!("./libk/resources/font/cp850-8x16.psf"));
|
||||
```
|
||||
+9
-1
@@ -6,11 +6,19 @@ authors.workspace = true
|
||||
|
||||
[dependencies]
|
||||
limine = "0.3.1"
|
||||
libk = { path = "../libk" }
|
||||
# libk = { path = "../libk" }
|
||||
x86_64 = "0.15.2"
|
||||
spin = "0.9.8"
|
||||
pic8259 = "0.11.0"
|
||||
pc-keyboard = "0.8.0"
|
||||
libm = { version = "0.1.0", path = "../libm" }
|
||||
crossbeam = { version = "0.8.4", default-features = false, features = [
|
||||
# "alloc",
|
||||
"crossbeam-queue",
|
||||
] }
|
||||
futures-util = { version = "0.3.31", default-features = false, features = [
|
||||
# "alloc",
|
||||
] }
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1.2.14"
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
#![expect(unused)]
|
||||
use core::arch::x86_64::__cpuid;
|
||||
|
||||
use libk::drivers::memory::FoundryOSFrameAllocator;
|
||||
use spin::Lazy;
|
||||
// use libk::drivers::memory::{FRAME_ALLOCATOR, FoundryOSFrameAllocator,
|
||||
// OFFSET_PAGE_TABLE};
|
||||
use x86_64::{
|
||||
PhysAddr, VirtAddr,
|
||||
instructions::port::Port,
|
||||
registers::model_specific::Msr,
|
||||
structures::paging::{
|
||||
FrameAllocator, Mapper, Page, PageTableFlags, PhysFrame, Size4KiB, Translate,
|
||||
},
|
||||
structures::paging::{Page, PageTableFlags, PhysFrame, Size4KiB},
|
||||
};
|
||||
|
||||
use crate::serial_print;
|
||||
// use crate::serial_print;
|
||||
|
||||
use super::{cpu::model_specific_registers::*, memmap::PHYSICAL_MEMORY_OFFSET};
|
||||
use super::{cpu::msr::*, memmap::PHYSICAL_MEMORY_OFFSET};
|
||||
|
||||
const IA32_APIC_BASE_MSR: u32 = 0x1b;
|
||||
const IA32_APIC_BASE_MSR_BSP: u64 = 0x100;
|
||||
@@ -22,12 +20,11 @@ const IA32_APIC_BASE_MSR_DISABLE: u64 = !IA32_APIC_BASE_MSR_ENABLE;
|
||||
|
||||
const CPUID_FEAT_EDX_APIC: u64 = 1 << 9; // the cpuid instruction will return this flag if it supports APIC
|
||||
|
||||
// const APIC_VIRTUAL_ADDRESS: Lazy<VirtAddr> = Lazy::new(|| {
|
||||
// let apic_base = get_apic_base();
|
||||
// let virt_addr = unsafe { phys_to_virt(apic_base) };
|
||||
static APIC_VIRTUAL_ADDRESS: Lazy<VirtAddr> = Lazy::new(|| {
|
||||
let apic_base = get_apic_base();
|
||||
|
||||
// virt_addr
|
||||
// });
|
||||
unsafe { phys_to_virt(apic_base) }
|
||||
});
|
||||
|
||||
fn set_apic_base_enable(apic: PhysAddr) {
|
||||
let rax = (apic.as_u64() & 0xfffff0000) | IA32_APIC_BASE_MSR_ENABLE;
|
||||
@@ -51,10 +48,10 @@ fn write_apic_register(apic_base: &VirtAddr, reg: u8, value: u32) {
|
||||
unsafe { *(reg_addr as *mut u32) = value };
|
||||
}
|
||||
|
||||
fn read_apic_register(apic_base: &VirtAddr, reg: u8) -> u32 {
|
||||
const fn read_apic_register(apic_base: &VirtAddr, reg: u8) -> u32 {
|
||||
let apic_base = apic_base.as_u64();
|
||||
|
||||
serial_print!("got apic base");
|
||||
// serial_print!("got apic base");
|
||||
|
||||
let reg_addr = (apic_base & 0xFFFFF0000) + reg as u64;
|
||||
unsafe { *(reg_addr as *const u32) }
|
||||
@@ -68,44 +65,36 @@ pub fn check_apic() -> bool {
|
||||
#[inline(always)]
|
||||
unsafe fn phys_to_virt(phys: PhysAddr) -> VirtAddr {
|
||||
let phys = phys.as_u64();
|
||||
match phys.checked_add(*PHYSICAL_MEMORY_OFFSET) {
|
||||
Some(virt) => {
|
||||
serial_print!("map worked!");
|
||||
VirtAddr::new(virt)
|
||||
}
|
||||
None => {
|
||||
serial_print!("THIS IS A PROBLEM");
|
||||
panic!("overflow")
|
||||
}
|
||||
}
|
||||
phys.checked_add(*PHYSICAL_MEMORY_OFFSET)
|
||||
.map_or_else(|| panic!(" overflow"), VirtAddr::new)
|
||||
}
|
||||
|
||||
pub fn enable_apic(
|
||||
mapper: &mut impl Mapper<Size4KiB>,
|
||||
frame_allocator: &mut FoundryOSFrameAllocator,
|
||||
) {
|
||||
pub fn enable_apic() {
|
||||
// let mut mapper = OFFSET_PAGE_TABLE.get().unwrap().lock();
|
||||
// let mut frame_allocator = FRAME_ALLOCATOR.get().unwrap().lock();
|
||||
|
||||
let apic_phys_addr = get_apic_base();
|
||||
set_apic_base_enable(apic_phys_addr);
|
||||
// map virt address of apic
|
||||
|
||||
let apic_virt = unsafe { phys_to_virt(apic_phys_addr) };
|
||||
// let page: Page<Size4KiB> = Page::containing_address(apic_virt);
|
||||
// let frame: PhysFrame<Size4KiB> = PhysFrame::containing_address(apic_phys_addr);
|
||||
// let flags: PageTableFlags = PageTableFlags::PRESENT | PageTableFlags::WRITABLE;
|
||||
|
||||
// unsafe {
|
||||
// match mapper.map_to(page, frame, flags, frame_allocator) {
|
||||
// Ok(_) => {}
|
||||
// Err(why) => panic!("failed to map apic: {:?}", why),
|
||||
// }
|
||||
// }
|
||||
let page: Page<Size4KiB> = Page::containing_address(apic_virt);
|
||||
let frame: PhysFrame<Size4KiB> = PhysFrame::containing_address(apic_phys_addr);
|
||||
let flags: PageTableFlags = PageTableFlags::PRESENT | PageTableFlags::WRITABLE;
|
||||
|
||||
/* unsafe {
|
||||
match mapper.map_to(page, frame, flags, &mut *frame_allocator) {
|
||||
Ok(_) => {}
|
||||
Err(why) => panic!("failed to map apic: {:?}", why),
|
||||
}
|
||||
}
|
||||
*/
|
||||
// // FIXME: this causes a page fault
|
||||
// // TODO: map to virtual memor
|
||||
|
||||
let reg = read_apic_register(&apic_virt, 0xF0);
|
||||
let reg = read_apic_register(&APIC_VIRTUAL_ADDRESS, 0xF0);
|
||||
|
||||
serial_print!("ok2");
|
||||
// serial_print!("ok2");
|
||||
|
||||
write_apic_register(&apic_virt, 0xF0, reg | 0x100);
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
pub mod model_specific_registers {
|
||||
use core::arch::x86_64::__cpuid;
|
||||
use spin::Lazy;
|
||||
use x86_64::registers::model_specific::Msr;
|
||||
|
||||
const CPUID_FLAG_MSR: u32 = 1 << 5;
|
||||
static EDX: Lazy<u32> = Lazy::new(|| unsafe { __cpuid(1).edx });
|
||||
|
||||
pub fn cpu_has_msr() -> bool {
|
||||
*EDX & CPUID_FLAG_MSR != 0
|
||||
}
|
||||
|
||||
pub fn cpu_get_msr(msr: u32, value: &mut u64) {
|
||||
let msr = Msr::new(msr);
|
||||
unsafe {
|
||||
*value = msr.read();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cpu_set_msr(msr: u32, value: u64) {
|
||||
let mut msr = Msr::new(msr);
|
||||
unsafe {
|
||||
msr.write(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
pub mod msr;
|
||||
pub mod port;
|
||||
@@ -0,0 +1,24 @@
|
||||
use core::arch::x86_64::__cpuid;
|
||||
use spin::Lazy;
|
||||
use x86_64::registers::model_specific::Msr;
|
||||
|
||||
const CPUID_FLAG_MSR: u32 = 1 << 5;
|
||||
static EDX: Lazy<u32> = Lazy::new(|| unsafe { __cpuid(1).edx });
|
||||
|
||||
pub fn cpu_has_msr() -> bool {
|
||||
*EDX & CPUID_FLAG_MSR != 0
|
||||
}
|
||||
|
||||
pub fn cpu_get_msr(msr: u32, value: &mut u64) {
|
||||
let msr = Msr::new(msr);
|
||||
unsafe {
|
||||
*value = msr.read();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cpu_set_msr(msr: u32, value: u64) {
|
||||
let mut msr = Msr::new(msr);
|
||||
unsafe {
|
||||
msr.write(value);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
//! Functions for IO using ports.
|
||||
|
||||
use core::arch::asm;
|
||||
|
||||
#[inline]
|
||||
pub fn inb(port: u16) -> u8 {
|
||||
/// Take a byte in from a port.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// This might have side effects so it is marked unsafe just in case.
|
||||
#[inline(always)]
|
||||
pub unsafe fn inb(port: u16) -> u8 {
|
||||
let value: u8;
|
||||
unsafe {
|
||||
asm!(
|
||||
@@ -16,8 +20,13 @@ pub fn inb(port: u16) -> u8 {
|
||||
value
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn outb(port: u16, value: u8) {
|
||||
/// Take a byte in from a port.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// This might have side effects so it is marked unsafe just in case.
|
||||
#[inline(always)]
|
||||
pub unsafe fn outb(port: u16, value: u8) {
|
||||
unsafe {
|
||||
asm!(
|
||||
"out dx, al",
|
||||
@@ -0,0 +1,2 @@
|
||||
pub mod pic;
|
||||
pub mod serial;
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(clippy::missing_safety_doc)]
|
||||
use x86_64::instructions::port::Port;
|
||||
|
||||
const CMD_INIT: u8 = 0x11;
|
||||
@@ -40,8 +41,9 @@ pub struct ChainedPics {
|
||||
}
|
||||
|
||||
impl ChainedPics {
|
||||
pub const unsafe fn new(offset1: u8, offset2: u8) -> Self {
|
||||
ChainedPics {
|
||||
/// Creates a new [`ChainedPics`].
|
||||
pub const fn new(offset1: u8, offset2: u8) -> Self {
|
||||
Self {
|
||||
pics: [
|
||||
Pic {
|
||||
offset: offset1,
|
||||
@@ -57,13 +59,8 @@ impl ChainedPics {
|
||||
}
|
||||
}
|
||||
|
||||
/// .
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// .
|
||||
pub const unsafe fn new_contiguous(primary_offset: u8) -> Self {
|
||||
unsafe { Self::new(primary_offset, primary_offset + 8) }
|
||||
pub const fn new_contiguous(primary_offset: u8) -> Self {
|
||||
Self::new(primary_offset, primary_offset + 8)
|
||||
}
|
||||
|
||||
/// Returns the initialize of this [`ChainedPics`].
|
||||
@@ -1,12 +1,14 @@
|
||||
use crate::arch::x86_64::cpu::port::{inb, outb};
|
||||
use core::{
|
||||
fmt,
|
||||
sync::atomic::{AtomicUsize, Ordering},
|
||||
};
|
||||
use spin::{Lazy, Mutex};
|
||||
use x86_64::instructions::interrupts;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! serial_print {
|
||||
($($arg:tt)*) => ($crate::_serial_write(format_args!($($arg)*)));
|
||||
($($arg:tt)*) => ($crate::arch::x86_64::dev::serial::_serial_write(format_args!($($arg)*)));
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
@@ -15,10 +17,6 @@ macro_rules! serial_println {
|
||||
($($arg:tt)*) => (serial_print!("{}\n", format_args!($($arg)*)));
|
||||
}
|
||||
|
||||
use super::port::{inb, outb};
|
||||
|
||||
use x86_64::instructions::interrupts;
|
||||
|
||||
pub fn _serial_write(args: fmt::Arguments) {
|
||||
use core::fmt::Write;
|
||||
|
||||
@@ -77,7 +75,7 @@ impl fmt::Write for Writer {
|
||||
|
||||
impl Writer {
|
||||
unsafe fn write_success(&self) -> bool {
|
||||
inb(PORT + 5) & 0x20 != 0
|
||||
unsafe { inb(PORT + 5) & 0x20 != 0 }
|
||||
}
|
||||
|
||||
pub fn write_byte(&self, data: u8) {
|
||||
@@ -103,21 +101,21 @@ pub fn init() -> Result<(), &'static str> {
|
||||
}
|
||||
|
||||
pub fn test() -> Result<(), &'static str> {
|
||||
outb(PORT + 1, 0x00); // Disable all interrupts
|
||||
outb(PORT + 3, 0x80); // Enable DLAB (set baud rate divisor)
|
||||
outb(PORT, 0x03); // Set divisor to 3 (lo byte) 38400 baud
|
||||
outb(PORT + 1, 0x00); // (hi byte)
|
||||
outb(PORT + 3, 0x03); // 8 bits, no parity, one stop bit
|
||||
outb(PORT + 2, 0xC7); // Enable FIFO, clear them, with 14-bytethreshold
|
||||
outb(PORT + 4, 0x0B); // IRQs enabled, RTS/DSR set
|
||||
outb(PORT + 4, 0x1E); // Set in loopback mode, test the serial chip
|
||||
outb(PORT, 0xAE); // Test serial chip (send byte 0xAE and check if serial returns same byte)
|
||||
unsafe { outb(PORT + 1, 0x00) }; // Disable all interrupts
|
||||
unsafe { outb(PORT + 3, 0x80) }; // Enable DLAB (set baud rate divisor)
|
||||
unsafe { outb(PORT, 0x03) }; // Set divisor to 3 (lo byte) 38400 baud
|
||||
unsafe { outb(PORT + 1, 0x00) }; // (hi byte)
|
||||
unsafe { outb(PORT + 3, 0x03) }; // 8 bits, no parity, one stop bit
|
||||
unsafe { outb(PORT + 2, 0xC7) }; // Enable FIFO, clear them, with 14-bytethreshold
|
||||
unsafe { outb(PORT + 4, 0x0B) }; // IRQs enabled, RTS/DSR set
|
||||
unsafe { outb(PORT + 4, 0x1E) }; // Set in loopback mode, test the serial chip
|
||||
unsafe { outb(PORT, 0xAE) }; // Test serial chip (send byte 0xAE and check if serial returns same byte)
|
||||
|
||||
if inb(PORT) != 0xAE {
|
||||
return Err("serial test failed");
|
||||
if unsafe { inb(PORT) } != 0xAE {
|
||||
return Err("Serial test failed");
|
||||
}
|
||||
|
||||
outb(PORT + 4, 0x0F);
|
||||
unsafe { outb(PORT + 4, 0x0F) };
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -143,7 +141,7 @@ impl Reader {
|
||||
}
|
||||
|
||||
unsafe fn read_ready(&self) -> bool {
|
||||
inb(PORT + 5) & 1 != 0
|
||||
unsafe { inb(PORT + 5) & 1 != 0 }
|
||||
}
|
||||
|
||||
pub fn read(&self) -> u8 {
|
||||
@@ -1,11 +1,11 @@
|
||||
use x86_64::{
|
||||
VirtAddr,
|
||||
instructions::tables::load_tss,
|
||||
registers::segmentation::{Segment, CS, DS, ES, SS},
|
||||
registers::segmentation::{CS, DS, ES, SS, Segment},
|
||||
structures::{
|
||||
gdt::{Descriptor, GlobalDescriptorTable, SegmentSelector},
|
||||
tss::TaskStateSegment,
|
||||
},
|
||||
VirtAddr,
|
||||
};
|
||||
|
||||
use spin::Lazy;
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
use libk::drivers::memory::{FRAME_ALLOCATOR, OFFSET_PAGE_TABLE};
|
||||
use libk::prelude::*;
|
||||
use pic8259::ChainedPics;
|
||||
use x86_64::registers::control::Cr2;
|
||||
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame, PageFaultErrorCode};
|
||||
use x86_64::structures::paging::mapper::MapperFlushAll;
|
||||
use x86_64::structures::paging::{FrameAllocator, Mapper, Page, PageTableFlags, Size4KiB};
|
||||
use x86_64::structures::idt::{
|
||||
InterruptDescriptorTable, InterruptStackFrame, PageFaultErrorCode,
|
||||
};
|
||||
|
||||
use spin::{Lazy, Mutex};
|
||||
|
||||
use super::apic::enable_apic;
|
||||
use crate::print_log;
|
||||
|
||||
use super::gdt;
|
||||
|
||||
static IDT: Lazy<InterruptDescriptorTable> = Lazy::new(|| {
|
||||
@@ -70,16 +68,18 @@ pub fn disable_pic() {
|
||||
}
|
||||
}
|
||||
|
||||
extern "x86-interrupt" fn breakpoint_handler(stack_frame: InterruptStackFrame) {
|
||||
serial_println!("Exception: Breakpoint\n{:#?}", stack_frame);
|
||||
println_log!("Exception: Breakpoint\n{:#?}", stack_frame);
|
||||
const extern "x86-interrupt" fn breakpoint_handler(
|
||||
_stack_frame: InterruptStackFrame,
|
||||
) {
|
||||
// serial_println!("Exception: Breakpoint\n{:#?}", stack_frame);
|
||||
// println_log!("Exception: Breakpoint\n{:#?}", stack_frame);
|
||||
}
|
||||
|
||||
extern "x86-interrupt" fn general_protection_fault_handler(
|
||||
stack_frame: InterruptStackFrame,
|
||||
_error_code: u64,
|
||||
) {
|
||||
serial_println!("Exception: General Protection Fault\n{:#?}", stack_frame);
|
||||
// serial_println!("Exception: General Protection Fault\n{:#?}", stack_frame);
|
||||
panic!("Exception: General Protection Fault\n{:#?}", stack_frame);
|
||||
}
|
||||
|
||||
@@ -87,17 +87,20 @@ extern "x86-interrupt" fn double_fault_handler(
|
||||
stack_frame: InterruptStackFrame,
|
||||
_error_code: u64,
|
||||
) -> ! {
|
||||
serial_println!("Exception: Double Fault\n{:#?}", stack_frame);
|
||||
// serial_println!("Exception: Double Fault\n{:#?}", stack_frame);
|
||||
panic!("Exception: Double Fault\n{:#?}", stack_frame);
|
||||
}
|
||||
|
||||
extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStackFrame) {
|
||||
extern "x86-interrupt" fn keyboard_interrupt_handler(
|
||||
_stack_frame: InterruptStackFrame,
|
||||
) {
|
||||
use pc_keyboard::{HandleControl, Keyboard, ScancodeSet1, layouts};
|
||||
// use pc_keyboard::DecodedKey;
|
||||
use spin::Mutex;
|
||||
use x86_64::instructions::port::Port;
|
||||
// use x86_64::instructions::port::Port;
|
||||
|
||||
static KEYBOARD: Lazy<Mutex<Keyboard<layouts::Uk105Key, ScancodeSet1>>> = Lazy::new(|| {
|
||||
static KEYBOARD: Lazy<Mutex<Keyboard<layouts::Uk105Key, ScancodeSet1>>> =
|
||||
Lazy::new(|| {
|
||||
Mutex::new(Keyboard::new(
|
||||
ScancodeSet1::new(),
|
||||
layouts::Uk105Key,
|
||||
@@ -106,10 +109,10 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac
|
||||
});
|
||||
|
||||
let _keyboard = KEYBOARD.lock();
|
||||
let mut port = Port::new(0x60);
|
||||
// let mut port = Port::new(0x60);
|
||||
|
||||
let scancode: u8 = unsafe { port.read() };
|
||||
libk::drivers::io::keyboard::add_scancode(scancode);
|
||||
// let scancode: u8 = unsafe { port.read() };
|
||||
// libk::drivers::io::keyboard::add_scancode(scancode);
|
||||
|
||||
unsafe {
|
||||
PICS.lock()
|
||||
@@ -117,23 +120,29 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac
|
||||
}
|
||||
}
|
||||
|
||||
extern "x86-interrupt" fn timer_interrupt_handler(_stack_frame: InterruptStackFrame) {
|
||||
extern "x86-interrupt" fn timer_interrupt_handler(
|
||||
_stack_frame: InterruptStackFrame,
|
||||
) {
|
||||
x86_64::instructions::interrupts::without_interrupts(|| {
|
||||
print_log!("{:?}", _stack_frame)
|
||||
});
|
||||
|
||||
unsafe {
|
||||
PICS.lock()
|
||||
.notify_end_of_interrupt(InterruptIndex::Timer.as_u8());
|
||||
}
|
||||
}
|
||||
|
||||
extern "x86-interrupt" fn page_fault_handler(
|
||||
stack_frame: InterruptStackFrame,
|
||||
error_code: PageFaultErrorCode,
|
||||
const extern "x86-interrupt" fn page_fault_handler(
|
||||
_stack_frame: InterruptStackFrame,
|
||||
_error_code: PageFaultErrorCode,
|
||||
) {
|
||||
// serial_println!("Exception: Page Fault");
|
||||
// serial_println!("Accessed Address: {:?}", Cr2::read());
|
||||
// serial_println!("Error Code: {:?}", error_code);
|
||||
// serial_println!("{:#?}", stack_frame);
|
||||
// serial_println!("Error Code: {:?}", _error_code);
|
||||
// serial_println!("{:#?}", _stack_frame);
|
||||
|
||||
if let Some(frame_allocator) = FRAME_ALLOCATOR.get() {
|
||||
/* if let Some(frame_allocator) = FRAME_ALLOCATOR.get() {
|
||||
let mut f = frame_allocator.lock();
|
||||
|
||||
let frame = f.allocate_frame().unwrap();
|
||||
@@ -152,4 +161,5 @@ extern "x86-interrupt" fn page_fault_handler(
|
||||
} else {
|
||||
panic!("failed to get frame allocator");
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//! Sets up a memory map using Limine.
|
||||
|
||||
use limine::{
|
||||
request::{HhdmRequest, KernelAddressRequest, MemoryMapRequest},
|
||||
response::MemoryMapResponse,
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
pub mod gdt;
|
||||
|
||||
pub mod interrupts;
|
||||
|
||||
pub mod memmap;
|
||||
|
||||
pub mod apic;
|
||||
|
||||
pub mod cpu;
|
||||
pub mod dev;
|
||||
pub mod gdt;
|
||||
pub mod interrupts;
|
||||
pub mod memmap;
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#[repr(u32)]
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
// Some predefined colours as well as custom colours in the proper format. This
|
||||
// assumes that the framebuffer uses 32bpp, something which we will assert on
|
||||
// initialisation.
|
||||
pub enum Colour {
|
||||
ARGB(u8, u8, u8, u8),
|
||||
RGB(u8, u8, u8),
|
||||
Argb(u8, u8, u8, u8),
|
||||
Rgb(u8, u8, u8),
|
||||
HexARGB(u32),
|
||||
Black = 0x000000FF,
|
||||
Blue = 0x0000FFFF,
|
||||
@@ -14,14 +17,19 @@ pub enum Colour {
|
||||
White = 0xFFFFFFFF,
|
||||
}
|
||||
|
||||
#[allow(clippy::use_self)]
|
||||
#[expect(
|
||||
clippy::use_self,
|
||||
reason = "Self is uglier and more verbose than `u32`"
|
||||
)]
|
||||
impl From<Colour> for u32 {
|
||||
fn from(val: Colour) -> Self {
|
||||
match val {
|
||||
Colour::ARGB(a, r, g, b) => {
|
||||
Colour::Argb(a, r, g, b) => {
|
||||
(a as u32) << 24 | (r as u32) << 16 | (g as u32) << 8 | (b as u32)
|
||||
}
|
||||
Colour::RGB(r, g, b) => ((r as u32) << 16) | (g as u32) << 8 | (b as u32),
|
||||
Colour::Rgb(r, g, b) => {
|
||||
((r as u32) << 16) | (g as u32) << 8 | (b as u32)
|
||||
}
|
||||
Colour::HexARGB(hex) => hex,
|
||||
Colour::Black => 0xFF000000,
|
||||
Colour::Blue => 0xFF0000FF,
|
||||
@@ -38,8 +46,10 @@ impl From<Colour> for u32 {
|
||||
impl core::fmt::Display for Colour {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
match self {
|
||||
Self::ARGB(r, g, b, a) => write!(f, "RGBA(#{:x}{:x}{:x}{:x})", r, g, b, a),
|
||||
Self::RGB(r, g, b) => write!(f, "RGB(#{:x}{:x}{:x})", r, g, b),
|
||||
Self::Argb(r, g, b, a) => {
|
||||
write!(f, "RGBA(#{:x}{:x}{:x}{:x})", r, g, b, a)
|
||||
}
|
||||
Self::Rgb(r, g, b) => write!(f, "RGB(#{:x}{:x}{:x})", r, g, b),
|
||||
Self::HexARGB(hex) => write!(f, "Hex(#{:x})", hex),
|
||||
Self::Black => write!(f, "Black"),
|
||||
Self::Blue => write!(f, "Blue"),
|
||||
@@ -0,0 +1,46 @@
|
||||
#![allow(unused)]
|
||||
use libm::include_font;
|
||||
|
||||
pub const FONT_SPLEEN_8X16: Font =
|
||||
Font::new(include_font!("../../resources/font/spleen-8x16.psf"));
|
||||
|
||||
pub const FONT_CP850_8X16: Font =
|
||||
Font::new(include_font!("../../resources/font/cp850-8x16.psf"));
|
||||
|
||||
pub struct Font {
|
||||
width: usize,
|
||||
height: usize,
|
||||
length: u16,
|
||||
data: [[u8; 16]; 512],
|
||||
}
|
||||
|
||||
impl Font {
|
||||
pub const fn new(data: [[u8; 16]; 512]) -> Self {
|
||||
Self {
|
||||
width: 8,
|
||||
height: 16,
|
||||
length: data.len() as u16,
|
||||
data,
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn glyph_for(&self, c: u16) -> &[u8] {
|
||||
if c > self.length {
|
||||
return &self.data[0];
|
||||
}
|
||||
|
||||
&self.data[c as usize]
|
||||
}
|
||||
|
||||
pub const fn width(&self) -> usize {
|
||||
self.width
|
||||
}
|
||||
|
||||
pub const fn height(&self) -> usize {
|
||||
self.height
|
||||
}
|
||||
|
||||
pub const fn default() -> &'static Self {
|
||||
&FONT_SPLEEN_8X16
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
//! Handles setting up the framebuffer passed to us by Limine.
|
||||
#![expect(unused)]
|
||||
use crate::DEFAULT_FONT;
|
||||
|
||||
use super::{colour::Colour, font::Font};
|
||||
|
||||
use limine::framebuffer::Framebuffer;
|
||||
use limine::request::FramebufferRequest;
|
||||
use spin::{Lazy, Mutex};
|
||||
|
||||
#[used]
|
||||
#[unsafe(link_section = ".requests")]
|
||||
/// The Limine framebuffer request.
|
||||
static FRAMEBUFFER_REQUEST: FramebufferRequest = FramebufferRequest::new();
|
||||
|
||||
/// A mutex used for writing to the framebuffer, in most cases we can abstract
|
||||
/// this behind calls to println! etc.
|
||||
pub static FRAMEBUFFER_WRITER: Lazy<Mutex<Option<FramebufferWriter>>> = Lazy::new(
|
||||
|| {
|
||||
Mutex::new(FRAMEBUFFER_REQUEST.get_response().map_or_else(
|
||||
|| {
|
||||
unreachable!("Framebuffer request failed, got None.");
|
||||
},
|
||||
|framebuffer_response| {
|
||||
let framebuffer =
|
||||
framebuffer_response.framebuffers().next()
|
||||
.expect("Expected to find at least one framebuffer in response, got zero.");
|
||||
Some(FramebufferWriter::new(framebuffer, Colour::Black))
|
||||
},
|
||||
))
|
||||
},
|
||||
);
|
||||
|
||||
/// The updated writer stores necessary fields from the [Framebuffer].
|
||||
/// This ensures that the contained types are Send, as Framebuffer was
|
||||
/// not marked as Send.
|
||||
///
|
||||
/// It also avoids the requirement for lifetimes.
|
||||
///
|
||||
/// Note this does not implement Writer as these functions only handle drawing
|
||||
/// pixels.
|
||||
pub struct FramebufferWriter {
|
||||
pitch: u64,
|
||||
/// Number of bits used per pixel, we expect 32 so this will be asserted
|
||||
/// when we initialise the framebuffer.
|
||||
bpp: u16,
|
||||
/// A raw pointer to the framebuffer.
|
||||
addr: *mut u8,
|
||||
/// The width of the screen in pixels.
|
||||
width: u64,
|
||||
/// The height of the screen in pixels.
|
||||
height: u64,
|
||||
/// The default background colour of the Framebuffer.
|
||||
background_colour: Colour,
|
||||
}
|
||||
|
||||
/// Marker trait required for sending the writer across threads, which will
|
||||
/// probably come in handy later.
|
||||
unsafe impl Send for FramebufferWriter {}
|
||||
/// Marker trait required for sharing the writer across threads, which will
|
||||
/// probably come in handy later.
|
||||
///
|
||||
/// # Note
|
||||
///
|
||||
/// We wrap this in a Mutex later so this should handle synchronising accesses.
|
||||
unsafe impl Sync for FramebufferWriter {}
|
||||
|
||||
impl FramebufferWriter {
|
||||
/// Creates a new [`FramebufferWriter`] with the specified background
|
||||
/// colour.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the bits per pixel for the framebuffer is not 32 bits per
|
||||
/// pixel, because we didn't exactly handle other cases.
|
||||
pub fn new(framebuffer: Framebuffer, background_colour: Colour) -> Self {
|
||||
// We don't handle other cases, this should not trigger on most newer
|
||||
// hardware.
|
||||
assert!(framebuffer.bpp() == 32);
|
||||
|
||||
Self {
|
||||
pitch: framebuffer.pitch(),
|
||||
bpp: framebuffer.bpp(),
|
||||
addr: framebuffer.addr(),
|
||||
width: framebuffer.width(),
|
||||
height: framebuffer.height(),
|
||||
background_colour,
|
||||
}
|
||||
}
|
||||
|
||||
/// Writes a pixel with `colour` to the screen at the given `(x, y)`
|
||||
/// coordinates (in pixels).
|
||||
pub fn write_pixel(&self, x: usize, y: usize, colour: Colour) {
|
||||
let pitch = self.pitch as usize;
|
||||
let bpp = (self.bpp / 8) as usize;
|
||||
let pixel_offset = y * pitch + x * bpp;
|
||||
|
||||
// Safety: We assume the pointer to the framebuffer is valid, which it likely
|
||||
// is because we copy it from the Limine request.
|
||||
unsafe {
|
||||
*(self.addr.add(pixel_offset) as *mut u32) = colour.into();
|
||||
}
|
||||
}
|
||||
|
||||
/// Writes a 2D slice `buffer` to the screen. This should be less than the
|
||||
/// size of the screen in dimensions, but does not neccessarily fill the
|
||||
/// whole screen.
|
||||
pub fn render_frame(&self, buffer: &[&[Colour]]) {
|
||||
// TODO: this should return errors.
|
||||
for (y, &row) in buffer.iter().enumerate() {
|
||||
if y >= self.height() as usize {
|
||||
break;
|
||||
}
|
||||
for (x, pixel) in row.iter().enumerate() {
|
||||
if x >= self.width() as usize {
|
||||
break;
|
||||
}
|
||||
self.write_pixel(x, y, *pixel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the width of the framebuffer in pixels.
|
||||
pub const fn width(&self) -> u32 {
|
||||
self.width as u32
|
||||
}
|
||||
|
||||
/// Returns the height of the framebuffer in pixels.
|
||||
pub const fn height(&self) -> u32 {
|
||||
self.height as u32
|
||||
}
|
||||
|
||||
/// Sets the new default background colour.
|
||||
pub const fn set_default_background_colour(&mut self, bg: Colour) {
|
||||
self.background_colour = bg;
|
||||
}
|
||||
|
||||
/// Clears the screen and sets the background to the default colour.
|
||||
pub fn clear(&self) {
|
||||
let width = self.width as usize;
|
||||
let height = self.height as usize;
|
||||
|
||||
for y in 0..height {
|
||||
for x in 0..width {
|
||||
// Write the background in the preferred background colour.
|
||||
self.write_pixel(x, y, self.background_colour);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the screen size in pixels or (0, 0) if something went wrong.
|
||||
pub fn screensize_px() -> (u32, u32) {
|
||||
FRAMEBUFFER_WRITER
|
||||
.lock()
|
||||
.as_mut()
|
||||
.map_or_else(|| (0, 0), |writer| (writer.width(), writer.height()))
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
pub mod colour;
|
||||
pub mod font;
|
||||
pub mod framebuffer;
|
||||
pub mod writer;
|
||||
@@ -1,10 +1,11 @@
|
||||
//! Formerly called ascii.rs, this file defines helper functions for drawing
|
||||
//! characters to the screen.
|
||||
|
||||
use core::fmt;
|
||||
use spin::{Lazy, Mutex};
|
||||
use x86_64::instructions::interrupts;
|
||||
|
||||
use super::framebuffer::{colour::Colour, display::FRAMEBUFFER_WRITER};
|
||||
|
||||
use crate::resources::font::{FONT_SPLEEN_8X16, Font};
|
||||
use super::{colour::Colour, font::Font, framebuffer::FRAMEBUFFER_WRITER};
|
||||
|
||||
static FONT_WIDTH: u32 = 8;
|
||||
static FONT_HEIGHT: u32 = 16;
|
||||
@@ -44,7 +45,7 @@ impl Writer {
|
||||
panic!("Framebuffer writer not initialized.");
|
||||
},
|
||||
|writer| Self {
|
||||
font: &FONT_SPLEEN_8X16,
|
||||
font: &crate::DEFAULT_FONT,
|
||||
screen_width: writer.width() / 8,
|
||||
screen_height: writer.height() / 16,
|
||||
text_line: 0,
|
||||
@@ -71,8 +72,9 @@ impl Writer {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the character data from the font array. -- each byte is a row of pixels
|
||||
let data: &[u8] = &self.font.0[c as usize];
|
||||
// Get the character data from the font array. -- each byte is a row of
|
||||
// pixels
|
||||
let data: &[u8] = self.font.glyph_for(c as u16);
|
||||
|
||||
if let Some(writer) = FRAMEBUFFER_WRITER.lock().as_mut() {
|
||||
for (row, line) in data.iter().enumerate().take(16) {
|
||||
@@ -82,10 +84,18 @@ impl Writer {
|
||||
|
||||
if line & (0x80 >> col) != 0 {
|
||||
// Write the foreground color
|
||||
writer.write_pixel(pixel_x as usize, pixel_y as usize, self.fg_color);
|
||||
writer.write_pixel(
|
||||
pixel_x as usize,
|
||||
pixel_y as usize,
|
||||
self.fg_color,
|
||||
);
|
||||
} else {
|
||||
// Write the background color
|
||||
writer.write_pixel(pixel_x as usize, pixel_y as usize, self.bg_color);
|
||||
writer.write_pixel(
|
||||
pixel_x as usize,
|
||||
pixel_y as usize,
|
||||
self.bg_color,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,8 +127,8 @@ impl Writer {
|
||||
}
|
||||
}
|
||||
|
||||
/// Handles the backspace character. TODO: Implement VT-100 style terminal control
|
||||
/// codes alongside a shell. Not simple.
|
||||
/// Handles the backspace character. TODO: Implement VT-100 style terminal
|
||||
/// control codes alongside a shell. Not simple.
|
||||
pub fn backspace(&mut self) {
|
||||
if self.text_col > 0 {
|
||||
self.text_col -= 1;
|
||||
@@ -163,18 +173,21 @@ fn write(args: fmt::Arguments, fg: Colour, bg: Colour) {
|
||||
});
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub fn _print(args: fmt::Arguments) {
|
||||
x86_64::instructions::interrupts::without_interrupts(|| {
|
||||
write(args, Colour::White, Colour::Black);
|
||||
})
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub fn _print_err(args: fmt::Arguments) {
|
||||
x86_64::instructions::interrupts::without_interrupts(|| {
|
||||
write(args, Colour::Red, Colour::Black);
|
||||
})
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub fn _print_log(args: fmt::Arguments) {
|
||||
x86_64::instructions::interrupts::without_interrupts(|| {
|
||||
write(args, Colour::Yellow, Colour::Black);
|
||||
@@ -209,7 +222,7 @@ macro_rules! println_log {
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! print_log {
|
||||
($($arg:tt)*) => ($crate::_print_log(format_args!($($arg)*)));
|
||||
($($arg:tt)*) => ($crate::graphics::writer::_print_log(format_args!($($arg)*)));
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
@@ -220,7 +233,7 @@ macro_rules! println {
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! print {
|
||||
($($arg:tt)*) => ($crate::_print(format_args!($($arg)*)));
|
||||
($($arg:tt)*) => ($crate::graphics::writer::_print(format_args!($($arg)*)));
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
@@ -231,5 +244,5 @@ macro_rules! printlnerr {
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! printerr {
|
||||
($($arg:tt)*) => ($crate::_print_err(format_args!($($arg)*)));
|
||||
($($arg:tt)*) => ($crate::graphics::writer::_print_err(format_args!($($arg)*)));
|
||||
}
|
||||
@@ -11,12 +11,11 @@ use pc_keyboard::{
|
||||
};
|
||||
use spin::{Lazy, Mutex, Once};
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
static KBD_QUEUE: Once<ArrayQueue<u8>> = Once::new();
|
||||
static WAKER: AtomicWaker = AtomicWaker::new();
|
||||
|
||||
pub static KEYBOARD: Lazy<Mutex<Keyboard<Uk105Key, ScancodeSet1>>> = Lazy::new(|| {
|
||||
pub static KEYBOARD: Lazy<Mutex<Keyboard<Uk105Key, ScancodeSet1>>> =
|
||||
Lazy::new(|| {
|
||||
Mutex::new(Keyboard::new(
|
||||
ScancodeSet1::new(),
|
||||
// TODO: Expose an API to change the default KB layout.
|
||||
@@ -30,12 +29,13 @@ pub static SCANCODE_STREAM: Lazy<Mutex<ScancodeStream>> =
|
||||
pub fn add_scancode(scancode: u8) {
|
||||
if let Some(queue) = KBD_QUEUE.get() {
|
||||
if queue.push(scancode).is_err() {
|
||||
println!("WARNING: scancode queue full; dropping keyboard input");
|
||||
// println!("WARNING: scancode queue full; dropping keyboard
|
||||
// input");
|
||||
} else {
|
||||
WAKER.wake();
|
||||
}
|
||||
} else {
|
||||
println!("WARNING: scancode queue not initialized");
|
||||
// println!("WARNING: scancode queue not initialized");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,10 @@ impl Default for ScancodeStream {
|
||||
impl Stream for ScancodeStream {
|
||||
type Item = u8;
|
||||
|
||||
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
||||
fn poll_next(
|
||||
self: Pin<&mut Self>,
|
||||
cx: &mut Context<'_>,
|
||||
) -> Poll<Option<Self::Item>> {
|
||||
let queue = KBD_QUEUE.get().unwrap();
|
||||
|
||||
if let Some(scancode) = queue.pop() {
|
||||
@@ -0,0 +1 @@
|
||||
// pub mod keyboard;
|
||||
+18
-56
@@ -11,101 +11,63 @@
|
||||
rustdoc::missing_panics_doc
|
||||
)]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
use arch::x86_64::apic::enable_apic;
|
||||
use arch::x86_64::dev::serial;
|
||||
use arch::x86_64::{gdt, interrupts};
|
||||
use core::arch::asm;
|
||||
use libk::drivers::memory;
|
||||
use graphics::font::{FONT_SPLEEN_8X16, Font};
|
||||
use limine::BaseRevision;
|
||||
|
||||
use libk::drivers::kalloc::allocator::init_heap;
|
||||
use libk::prelude::*;
|
||||
|
||||
use x86_64::VirtAddr;
|
||||
|
||||
mod arch;
|
||||
pub mod arch;
|
||||
pub mod graphics;
|
||||
pub mod io;
|
||||
|
||||
/// Sets the base revision to the latest revision supported by the crate.
|
||||
/// See specification for further info.
|
||||
/// Be sure to mark all limine requests with #[used], otherwise they may be removed by the compiler.
|
||||
/// Be sure to mark all limine requests with #[used], otherwise they may be
|
||||
/// removed by the compiler.
|
||||
#[used]
|
||||
// The .requests section allows limine to find the requests faster and more safely.
|
||||
#[unsafe(link_section = ".requests")]
|
||||
static BASE_REVISION: BaseRevision = BaseRevision::new();
|
||||
|
||||
/// The default font used when setting up the framebuffer code.
|
||||
pub const DEFAULT_FONT: Font = FONT_SPLEEN_8X16;
|
||||
|
||||
#[panic_handler]
|
||||
fn rust_panic(_info: &core::panic::PanicInfo) -> ! {
|
||||
println!("Kernel panic: {}", _info);
|
||||
serial_println!("Kernel panic: {}", _info);
|
||||
hcf();
|
||||
}
|
||||
|
||||
pub fn hcf() -> ! {
|
||||
loop {
|
||||
unsafe {
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
asm!("hlt");
|
||||
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
|
||||
asm!("wfi");
|
||||
#[cfg(target_arch = "loongarch64")]
|
||||
asm!("idle 0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn boot() -> Result<(), &'static str> {
|
||||
if !BASE_REVISION.is_supported() {
|
||||
return Err("base revision not supported");
|
||||
return Err("Base Revision was not supported.");
|
||||
}
|
||||
|
||||
use arch::x86_64::{gdt, interrupts, memmap};
|
||||
print_log!(" Setting up Serial Communication... ");
|
||||
|
||||
let memory_map = memmap::get_memory_map();
|
||||
|
||||
print_log!(" Initialising Serial... ");
|
||||
if libk::drivers::io::serial::init().is_err() {
|
||||
if serial::init().is_err() {
|
||||
println_log!("[Not Detected]")
|
||||
} else {
|
||||
println_log!("[Success]");
|
||||
println_log!("[Success]")
|
||||
}
|
||||
|
||||
print_log!(" Setting Up Global Descriptor Table... ");
|
||||
print_log!(" Setting up GDT... ");
|
||||
gdt::init();
|
||||
println_log!("[Success]");
|
||||
|
||||
print_log!(" Setting Up Interrupt Descriptor Table... ");
|
||||
interrupts::init_idt();
|
||||
println_log!("[Success]");
|
||||
|
||||
print_log!(" Initialising Memory Subsystem... ");
|
||||
let physical_memory_offset = VirtAddr::new(*memmap::PHYSICAL_MEMORY_OFFSET);
|
||||
let mut l4_table = memory::init_page_table(physical_memory_offset);
|
||||
println_log!("[Success]");
|
||||
|
||||
print_log!(" Setting Up Page Table... ");
|
||||
memory::init_frame_allocator(memory_map);
|
||||
println_log!("[Success]");
|
||||
|
||||
print_log!(" Initialising Heap... ");
|
||||
if init_heap().is_err() {
|
||||
return Err("Failed to initialise heap: error");
|
||||
}
|
||||
println_log!("[Success]");
|
||||
|
||||
print_log!(" Enabling PICs... ");
|
||||
interrupts::enable_pic();
|
||||
println_log!("[Success]");
|
||||
|
||||
// print_log!(" Disabling PICs... ");
|
||||
// interrupts::disable_pic();
|
||||
// println_log!("[Success]");
|
||||
//
|
||||
// print_log!(" Initialising APIC");
|
||||
// enable_apic(&mut l4_table, &mut frame_allocator);
|
||||
// println_log!("[Success]");
|
||||
|
||||
print_log!(" Enabling Interrupts... ");
|
||||
x86_64::instructions::interrupts::enable();
|
||||
print_log!(" Initialising interrupts... ");
|
||||
interrupts::init_idt();
|
||||
println_log!("[Success]");
|
||||
|
||||
Ok(())
|
||||
|
||||
+5
-33
@@ -1,40 +1,12 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
use libk::{
|
||||
drivers::{
|
||||
async_io::task::{Executor, Task},
|
||||
io,
|
||||
},
|
||||
prelude::*,
|
||||
util::shell::shell,
|
||||
};
|
||||
use foundry_os::boot;
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
extern "C" fn kmain() -> ! {
|
||||
println_log!(" [ Initialising Kernel Systems ] ");
|
||||
if let Err(err) = foundry_os::boot() {
|
||||
panic!("{}", err);
|
||||
}
|
||||
|
||||
println_log!("[ Kernel Initialised Successfully ] ");
|
||||
|
||||
let dimensions = io::ascii::screensize_chars();
|
||||
let dimensions2 = io::framebuffer::display::screensize_px();
|
||||
|
||||
println!("Dimensions: {}x{} (px)", dimensions2.0, dimensions2.1);
|
||||
println!("Dimensions: {}x{} (chars)", dimensions.0, dimensions.1);
|
||||
|
||||
let mut executor = Executor::new();
|
||||
|
||||
let mut v = Vec::with_capacity(1000 * 1000);
|
||||
for i in 0..1000 * 1000 {
|
||||
v.push(i);
|
||||
}
|
||||
println!("v.len(): {}", v.len());
|
||||
|
||||
executor.spawn(Task::new(shell()));
|
||||
executor.run();
|
||||
_ = boot();
|
||||
|
||||
#[allow(clippy::empty_loop)]
|
||||
loop {}
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
[package]
|
||||
name = "libk"
|
||||
publish = ["gitea"]
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
authors.workspace = true
|
||||
description = "A library crate used to write the kernel for Foundry OS."
|
||||
|
||||
[dependencies]
|
||||
limine = "0.3.1"
|
||||
x86_64 = "0.15.2"
|
||||
crossbeam = { version = "0.8.4", default-features = false, features = [
|
||||
"alloc",
|
||||
"crossbeam-queue",
|
||||
] }
|
||||
pc-keyboard = "0.8.0"
|
||||
spin = "0.9.8"
|
||||
futures-util = { version = "0.3.31", default-features = false, features = [
|
||||
"alloc",
|
||||
] }
|
||||
linked_list_allocator = "0.10.5"
|
||||
libm = { path = "../libm" }
|
||||
@@ -1,24 +0,0 @@
|
||||
# libk is for the code that did not make the kernel*
|
||||
|
||||
\*crate, lol.
|
||||
|
||||
libk is an attempt to move away from the godforsaken git submodules that plagued our forefathers. Now we have a crate containing a bunch of code that didn't quite make the core kernel crate, which should be:
|
||||
|
||||
* simpler to maintain
|
||||
* has a catchier name
|
||||
* less fighting with Cargo.toml manifests
|
||||
|
||||
## TODO:
|
||||
|
||||
A lot of things must be improved and worked on, feel free to add extra TODOs below.
|
||||
|
||||
[] Create a kernel logging abstraction similar to Linux. (this should probably just use the serial drivers)
|
||||
|
||||
The rationale behind this is that we want some sort of debug log/tracing support so we aren't just printf debugging forever.
|
||||
|
||||
## Authors
|
||||
|
||||
Again, write your name below if you like:
|
||||
|
||||
* @zxq5 (wrote most of the libraries as of 23/02/25)
|
||||
* @nullndvoid (made this lushious library crate)
|
||||
@@ -1 +0,0 @@
|
||||
pub mod task;
|
||||
@@ -1,147 +0,0 @@
|
||||
//! Allows creation of asynchronous IO bound tasks.
|
||||
//!
|
||||
//! Written by @zxq5 for the most part with code from
|
||||
//! [here](https://github.com/phil-opp/blog_os/).
|
||||
//!
|
||||
use crate::prelude::*;
|
||||
use alloc::collections::BTreeMap;
|
||||
use alloc::sync::Arc;
|
||||
use alloc::task::Wake;
|
||||
use core::{
|
||||
future::Future,
|
||||
pin::Pin,
|
||||
sync::atomic::AtomicU64,
|
||||
task::{Context, Poll, Waker},
|
||||
};
|
||||
use crossbeam::queue::ArrayQueue;
|
||||
use x86_64::instructions::interrupts::{self, enable_and_hlt};
|
||||
|
||||
pub struct Task {
|
||||
id: TaskId,
|
||||
future: Pin<Box<dyn Future<Output = ()>>>,
|
||||
}
|
||||
|
||||
impl Task {
|
||||
pub fn new(future: impl Future<Output = ()> + 'static) -> Self {
|
||||
Self {
|
||||
id: TaskId::new(),
|
||||
future: Box::pin(future),
|
||||
}
|
||||
}
|
||||
|
||||
fn poll(&mut self, context: &mut Context) -> Poll<()> {
|
||||
self.future.as_mut().poll(context)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||
struct TaskId(u64);
|
||||
|
||||
impl TaskId {
|
||||
fn new() -> Self {
|
||||
static NEXT: AtomicU64 = AtomicU64::new(0);
|
||||
Self(NEXT.fetch_add(1, core::sync::atomic::Ordering::Relaxed))
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Executor {
|
||||
tasks: BTreeMap<TaskId, Task>,
|
||||
task_queue: Arc<ArrayQueue<TaskId>>,
|
||||
waker_cache: BTreeMap<TaskId, Waker>,
|
||||
}
|
||||
|
||||
impl Executor {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
tasks: BTreeMap::new(),
|
||||
task_queue: Arc::new(ArrayQueue::new(100)),
|
||||
waker_cache: BTreeMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn spawn(&mut self, task: Task) {
|
||||
let task_id = task.id;
|
||||
if self.tasks.insert(task.id, task).is_some() {
|
||||
panic!("task with same id already in tasks");
|
||||
}
|
||||
self.task_queue.push(task_id).expect("queue full");
|
||||
}
|
||||
|
||||
fn run_ready_tasks(&mut self) {
|
||||
// destructure `self` to avoid borrow checker errors
|
||||
let Self {
|
||||
tasks,
|
||||
task_queue,
|
||||
waker_cache,
|
||||
} = self;
|
||||
|
||||
while let Some(task_id) = task_queue.pop() {
|
||||
let task = match tasks.get_mut(&task_id) {
|
||||
Some(task) => task,
|
||||
None => continue, // task no longer exists
|
||||
};
|
||||
let waker = waker_cache
|
||||
.entry(task_id)
|
||||
.or_insert_with(|| TaskWaker::new_waker(task_id, task_queue.clone()));
|
||||
let mut context = Context::from_waker(waker);
|
||||
match task.poll(&mut context) {
|
||||
Poll::Ready(()) => {
|
||||
// task done -> remove it and its cached waker
|
||||
tasks.remove(&task_id);
|
||||
waker_cache.remove(&task_id);
|
||||
}
|
||||
Poll::Pending => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run(&mut self) -> ! {
|
||||
loop {
|
||||
self.run_ready_tasks();
|
||||
self.sleep_if_idle();
|
||||
}
|
||||
}
|
||||
|
||||
fn sleep_if_idle(&self) {
|
||||
interrupts::disable();
|
||||
if self.task_queue.is_empty() {
|
||||
enable_and_hlt();
|
||||
} else {
|
||||
interrupts::enable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Executor {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
struct TaskWaker {
|
||||
task_id: TaskId,
|
||||
task_queue: Arc<ArrayQueue<TaskId>>,
|
||||
}
|
||||
|
||||
impl TaskWaker {
|
||||
fn wake_task(&self) {
|
||||
self.task_queue.push(self.task_id).expect("task_queue full");
|
||||
}
|
||||
|
||||
fn new_waker(task_id: TaskId, task_queue: Arc<ArrayQueue<TaskId>>) -> Waker {
|
||||
Waker::from(Arc::new(Self {
|
||||
task_id,
|
||||
task_queue,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
impl Wake for TaskWaker {
|
||||
fn wake(self: Arc<Self>) {
|
||||
self.wake_task();
|
||||
}
|
||||
|
||||
fn wake_by_ref(self: &Arc<Self>) {
|
||||
self.wake_task();
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
use limine::request::FramebufferRequest;
|
||||
|
||||
#[used]
|
||||
#[unsafe(link_section = ".requests")]
|
||||
static FRAMEBUFFER_REQUEST: FramebufferRequest = FramebufferRequest::new();
|
||||
|
||||
use super::colour::Colour;
|
||||
use core::panic;
|
||||
|
||||
use limine::framebuffer::Framebuffer;
|
||||
use spin::{Lazy, Mutex};
|
||||
|
||||
pub static FRAMEBUFFER_WRITER: Lazy<Mutex<Option<FramebufferWriter>>> = Lazy::new(|| {
|
||||
Mutex::new(FRAMEBUFFER_REQUEST.get_response().map_or_else(
|
||||
|| {
|
||||
panic!("Framebuffer request failed");
|
||||
},
|
||||
|framebuffer_response| {
|
||||
let framebuffer = framebuffer_response.framebuffers().next().unwrap();
|
||||
Some(FramebufferWriter::new(framebuffer))
|
||||
},
|
||||
))
|
||||
});
|
||||
|
||||
/// The updated writer stores necessary fields from the [Framebuffer].
|
||||
/// This ensures that the contained types are Send, as Framebuffer was
|
||||
/// not marked as Send.
|
||||
///
|
||||
/// It also avoids the requirement for lifetimes.
|
||||
///
|
||||
/// Note this does not implement Writer as these functions only handle drawing pixels.
|
||||
pub struct FramebufferWriter {
|
||||
pitch: u64,
|
||||
bpp: u16,
|
||||
addr: *mut u8,
|
||||
width: u64,
|
||||
height: u64,
|
||||
}
|
||||
|
||||
unsafe impl Send for FramebufferWriter {}
|
||||
unsafe impl Sync for FramebufferWriter {}
|
||||
|
||||
impl FramebufferWriter {
|
||||
pub fn new(framebuffer: Framebuffer) -> Self {
|
||||
Self {
|
||||
pitch: framebuffer.pitch(),
|
||||
bpp: framebuffer.bpp(),
|
||||
addr: framebuffer.addr(),
|
||||
width: framebuffer.width(),
|
||||
height: framebuffer.height(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn write_pixel(&self, x: usize, y: usize, color: Colour) {
|
||||
let pitch = self.pitch as usize;
|
||||
let bpp = (self.bpp / 8) as usize;
|
||||
let pixel_offset = y * pitch + x * bpp;
|
||||
|
||||
unsafe {
|
||||
*(self.addr.add(pixel_offset) as *mut u32) = color.into();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn render_frame(&self, buffer: &[Colour; 1280 * 800]) {
|
||||
for (y, row) in buffer.chunks(1280).enumerate() {
|
||||
for (x, pixel) in row.iter().enumerate() {
|
||||
self.write_pixel(x, y, *pixel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn width(&self) -> u32 {
|
||||
self.width as u32
|
||||
}
|
||||
|
||||
pub const fn height(&self) -> u32 {
|
||||
self.height as u32
|
||||
}
|
||||
|
||||
pub fn clear(&self) {
|
||||
let width = self.width as usize;
|
||||
let height = self.height as usize;
|
||||
|
||||
for y in 0..height {
|
||||
for x in 0..width {
|
||||
self.write_pixel(x, y, Colour::Black);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn screensize_px() -> (u32, u32) {
|
||||
FRAMEBUFFER_WRITER
|
||||
.lock()
|
||||
.as_mut()
|
||||
.map_or_else(|| (0, 0), |writer| (writer.width(), writer.height()))
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
pub mod colour;
|
||||
pub mod display;
|
||||
@@ -1,17 +0,0 @@
|
||||
pub mod ascii;
|
||||
pub mod framebuffer;
|
||||
pub mod keyboard;
|
||||
pub mod port;
|
||||
pub mod serial;
|
||||
|
||||
// Re-exported macro definitions.
|
||||
|
||||
pub use crate::print;
|
||||
pub use crate::print_log;
|
||||
pub use crate::printerr;
|
||||
pub use crate::println;
|
||||
pub use crate::println_log;
|
||||
pub use crate::printlnerr;
|
||||
|
||||
pub use crate::serial_print;
|
||||
pub use crate::serial_println;
|
||||
@@ -1,73 +0,0 @@
|
||||
use linked_list_allocator::LockedHeap;
|
||||
use x86_64::{
|
||||
VirtAddr,
|
||||
structures::paging::{
|
||||
FrameAllocator, Mapper, Page, PageTableFlags, Size4KiB,
|
||||
mapper::{MapToError, MapperFlushAll},
|
||||
},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
drivers::memory::{FRAME_ALLOCATOR, OFFSET_PAGE_TABLE},
|
||||
serial_print, serial_println,
|
||||
};
|
||||
|
||||
/// We are currently using a linked list heap allocator which uses our underlying page allocator.
|
||||
pub type FoundryAllocator = LockedHeap;
|
||||
|
||||
#[global_allocator]
|
||||
/// This is now Rust's global allocator, so we can use stuff requiring heap allocations.
|
||||
static ALLOCATOR: FoundryAllocator = FoundryAllocator::empty();
|
||||
|
||||
pub const HEAP_START: usize = 0x4444_4444_0000;
|
||||
pub const HEAP_SIZE: usize = 1024 * 1024 * 1024;
|
||||
|
||||
/// Sets up the heap using the backing page frame allocator.
|
||||
pub fn init_heap() -> Result<(), MapToError<Size4KiB>> {
|
||||
// let mut frame_allocator = if let Some(f) = FRAME_ALLOCATOR.get() {
|
||||
// f.lock()
|
||||
// } else {
|
||||
// return Err(MapToError::FrameAllocationFailed);
|
||||
// };
|
||||
|
||||
// let mut mapper = if let Some(m) = OFFSET_PAGE_TABLE.get() {
|
||||
// m.lock()
|
||||
// } else {
|
||||
// return Err(MapToError::FrameAllocationFailed);
|
||||
// };
|
||||
|
||||
// let range = {
|
||||
// let heap_start = VirtAddr::new(HEAP_START as u64);
|
||||
// let heap_end = heap_start + HEAP_SIZE as u64 - 1u64;
|
||||
// let heap_start_page = Page::<Size4KiB>::containing_address(heap_start);
|
||||
// let heap_end_page = Page::<Size4KiB>::containing_address(heap_end);
|
||||
// Page::range_inclusive(heap_start_page, heap_end_page)
|
||||
// };
|
||||
|
||||
// let usable_frames = frame_allocator.count_usable_frames();
|
||||
// serial_println!("usable frames: {}", usable_frames);
|
||||
|
||||
// let mut i = 0;
|
||||
// for page in range {
|
||||
// i += 1;
|
||||
// if i % 128 == 0 {
|
||||
// serial_println!("allocated {} pages", i);
|
||||
// }
|
||||
// let frame = frame_allocator
|
||||
// .allocate_frame()
|
||||
// .ok_or(MapToError::FrameAllocationFailed)?;
|
||||
// let flags = PageTableFlags::PRESENT | PageTableFlags::WRITABLE;
|
||||
// unsafe {
|
||||
// // IMPORTANT: make sure to flush the mapper!!!!
|
||||
// let _ = mapper.map_to(page, frame, flags, &mut *frame_allocator)?;
|
||||
// }
|
||||
// }
|
||||
|
||||
// MapperFlushAll::new().flush_all();
|
||||
|
||||
unsafe {
|
||||
ALLOCATOR.lock().init(HEAP_START as *mut u8, HEAP_SIZE);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
pub mod allocator;
|
||||
@@ -1,149 +0,0 @@
|
||||
// use lib_alloc::allocator::FoundryAllocator;
|
||||
use limine::{memory_map::EntryType, response::MemoryMapResponse};
|
||||
use spin::{Mutex, Once};
|
||||
use x86_64::{
|
||||
PhysAddr, VirtAddr,
|
||||
registers::control::Cr3,
|
||||
structures::paging::{
|
||||
FrameAllocator, Mapper, OffsetPageTable, Page, PageTable, PhysFrame, Size4KiB,
|
||||
page_table::FrameError,
|
||||
},
|
||||
};
|
||||
|
||||
pub static FRAME_ALLOCATOR: Once<Mutex<FoundryOSFrameAllocator>> = Once::new();
|
||||
pub static OFFSET_PAGE_TABLE: Once<Mutex<OffsetPageTable>> = Once::new();
|
||||
/// Returns a mutable reference to the current level 4 page table.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// The caller must ensure that the level 4 page table is not modified
|
||||
/// simultaneously. The caller must also ensure that the physical memory offset
|
||||
/// is correct, to ensure that the correct virtual address is constructed.
|
||||
unsafe fn active_l4_table(physical_memory_offset: VirtAddr) -> &'static mut PageTable {
|
||||
let (level_4_frame, _) = Cr3::read();
|
||||
|
||||
let phys_addr = level_4_frame.start_address();
|
||||
let virt = phys_addr.as_u64() + physical_memory_offset.as_u64();
|
||||
unsafe { &mut *(virt as *mut PageTable) }
|
||||
}
|
||||
|
||||
/// Initializes the `OffsetPageTable` for the current CPU architecture.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// This function must be called only once and should be called before any
|
||||
/// memory operations are performed that rely on virtual memory management.
|
||||
/// The provided `physical_memory_offset` must be accurate to ensure correct
|
||||
/// translation of physical addresses.
|
||||
///
|
||||
/// # Parameters
|
||||
///
|
||||
/// - `physical_memory_offset`: The offset to convert physical addresses to
|
||||
/// virtual addresses in the higher-half direct map.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// Returns an `OffsetPageTable` that allows for manipulation of the page
|
||||
/// tables for the current CPU architecture.
|
||||
pub fn init_page_table(physical_memory_offset: VirtAddr) {
|
||||
unsafe {
|
||||
let l4_table = active_l4_table(physical_memory_offset);
|
||||
let offset_table = OffsetPageTable::new(l4_table, physical_memory_offset);
|
||||
OFFSET_PAGE_TABLE.call_once(|| Mutex::new(offset_table));
|
||||
}
|
||||
}
|
||||
|
||||
pub struct FoundryOSFrameAllocator {
|
||||
memory_map: &'static MemoryMapResponse,
|
||||
next: usize,
|
||||
}
|
||||
|
||||
pub fn init_frame_allocator(memory_map: &'static MemoryMapResponse) {
|
||||
unsafe {
|
||||
FRAME_ALLOCATOR.call_once(|| Mutex::new(FoundryOSFrameAllocator::init(memory_map)));
|
||||
}
|
||||
}
|
||||
|
||||
impl FoundryOSFrameAllocator {
|
||||
/// Creates a new `FoundryOSFrameAllocator` from a memory map.
|
||||
///
|
||||
/// This function takes a reference to a `MemoryMapResponse` and initializes a
|
||||
/// `FoundryOSFrameAllocator` with it. The `next` field is set to 0, indicating that
|
||||
/// the first frame to be allocated is the first frame in the memory map.
|
||||
pub const unsafe fn init(memory_map: &'static MemoryMapResponse) -> Self {
|
||||
Self {
|
||||
memory_map,
|
||||
next: 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn count_usable_frames(&self) -> u32 {
|
||||
self.usable_frames().count() as u32
|
||||
}
|
||||
|
||||
/// An iterator over all usable frames in the memory map.
|
||||
///
|
||||
/// Yields one `PhysFrame` for each available 4KiB frame in the memory map.
|
||||
///
|
||||
/// This function is used to allocate frames for the pagemap.
|
||||
fn usable_frames(&self) -> impl Iterator<Item = PhysFrame> + use<> {
|
||||
let regions = self.memory_map.entries().iter();
|
||||
let usable_regions = regions.filter(|region| region.entry_type == EntryType::USABLE);
|
||||
|
||||
let addr_ranges = usable_regions.map(|region| region.base..region.base + region.length);
|
||||
|
||||
let frame_addresses = addr_ranges.flat_map(|r| r.step_by(4096));
|
||||
|
||||
frame_addresses.map(|addr| PhysFrame::from_start_address(PhysAddr::new(addr)).unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl FrameAllocator<Size4KiB> for FoundryOSFrameAllocator {
|
||||
/// Allocates a frame from the list of usable frames.
|
||||
///
|
||||
/// This function returns the next available `PhysFrame` from the memory map,
|
||||
/// if one exists. Once a frame is allocated, the internal counter is incremented
|
||||
/// to point to the next frame for future allocations.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// - `Some(PhysFrame)`: If a usable frame is available.
|
||||
/// - `None`: If there are no more usable frames to allocate.
|
||||
fn allocate_frame(&mut self) -> Option<PhysFrame> {
|
||||
let frame = self.usable_frames().nth(self.next);
|
||||
self.next += 1;
|
||||
frame
|
||||
}
|
||||
}
|
||||
|
||||
// pub unsafe fn translate_addr(addr: VirtAddr, physical_memory_offset: VirtAddr) -> Option<PhysAddr> {
|
||||
// translate_addr_inner(addr, physical_memory_offset)
|
||||
// }
|
||||
|
||||
// fn translate_addr_inner(addr: VirtAddr, physical_memory_offset: VirtAddr) -> Option<PhysAddr> {
|
||||
// let (l4_table_frame, _) = Cr3::read();
|
||||
|
||||
// let table_indexes = [
|
||||
// addr.p4_index(),
|
||||
// addr.p3_index(),
|
||||
// addr.p2_index(),
|
||||
// addr.p1_index(),
|
||||
// ];
|
||||
// let mut frame = l4_table_frame;
|
||||
|
||||
// for &i in &table_indexes {
|
||||
// let virt = physical_memory_offset + frame.start_address().as_u64();
|
||||
// let table_ptr: *const PageTable = virt.as_ptr();
|
||||
// let table = unsafe { &*table_ptr };
|
||||
|
||||
// let entry = &table[i];
|
||||
|
||||
// frame = match entry.frame() {
|
||||
// Ok(frame) => frame,
|
||||
// Err(FrameError::FrameNotPresent) => return None,
|
||||
// Err(FrameError::HugeFrame) => panic!("huge frames are not supported!"),
|
||||
// };
|
||||
// }
|
||||
|
||||
// Some(frame.start_address() + u64::from(addr.page_offset()))
|
||||
// }
|
||||
@@ -1,6 +0,0 @@
|
||||
pub mod io;
|
||||
pub mod kalloc;
|
||||
|
||||
pub mod async_io;
|
||||
pub mod memory;
|
||||
pub mod pic;
|
||||
@@ -1,38 +0,0 @@
|
||||
#![no_std]
|
||||
#![warn(
|
||||
clippy::correctness,
|
||||
clippy::nursery,
|
||||
clippy::unnecessary_cast,
|
||||
clippy::all,
|
||||
clippy::suspicious,
|
||||
clippy::perf,
|
||||
rustdoc::missing_errors_doc,
|
||||
rustdoc::missing_panics_doc,
|
||||
tail_expr_drop_order
|
||||
)]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
pub mod drivers;
|
||||
pub mod resources;
|
||||
pub mod threads;
|
||||
pub mod util;
|
||||
|
||||
#[allow(unused)] // We aren't using much of this right now.
|
||||
pub mod std;
|
||||
|
||||
/// Re-exports most of the IO macros as well as standard allocation stuff
|
||||
#[allow(unused)]
|
||||
pub mod prelude {
|
||||
pub use crate::std::io::*;
|
||||
pub use alloc::{
|
||||
boxed::Box,
|
||||
string::{String, ToString},
|
||||
vec::Vec,
|
||||
};
|
||||
}
|
||||
|
||||
pub use crate::drivers::io::{
|
||||
ascii::{_print, _print_log},
|
||||
serial::_serial_write,
|
||||
};
|
||||
@@ -1,578 +0,0 @@
|
||||
pub static FONT: [u8; 288 * 16] = [
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 0
|
||||
0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30, 0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00,
|
||||
0x00, // 1
|
||||
0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00,
|
||||
0x00, // 2
|
||||
0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00,
|
||||
0x00, // 3
|
||||
0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00,
|
||||
0x00, // 4
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 5
|
||||
0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x00, // 6
|
||||
0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x00, // 7
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 8
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, // 9
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 10
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, // 11
|
||||
0x00, 0x00, 0x1e, 0x0e, 0x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00,
|
||||
0x00, // 12
|
||||
0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00,
|
||||
0x00, // 13
|
||||
0x00, 0x00, 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00,
|
||||
0x00, // 14
|
||||
0x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18, 0x00, 0x00, 0x00,
|
||||
0x00, // 15
|
||||
0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00,
|
||||
0x00, // 16
|
||||
0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00,
|
||||
0x00, // 17
|
||||
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 18
|
||||
0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00,
|
||||
0x00, // 19
|
||||
0x00, 0x00, 0x7f, 0xdb, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00,
|
||||
0x00, // 20
|
||||
0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00,
|
||||
0x00, // 21
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00,
|
||||
0x00, // 22
|
||||
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00,
|
||||
0x00, // 23
|
||||
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00,
|
||||
0x00, // 24
|
||||
0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00,
|
||||
0x00, // 25
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 26
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 27
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 28
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x6c, 0xfe, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 29
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 30
|
||||
0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 31
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 32
|
||||
0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,
|
||||
0x00, // 33
|
||||
0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 34
|
||||
0x00, 0x00, 0x00, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00,
|
||||
0x00, // 35
|
||||
0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x06, 0x86, 0xc6, 0x7c, 0x18, 0x18, 0x00,
|
||||
0x00, // 36
|
||||
0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18, 0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00,
|
||||
0x00, // 37
|
||||
0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00,
|
||||
0x00, // 38
|
||||
0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 39
|
||||
0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00,
|
||||
0x00, // 40
|
||||
0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00,
|
||||
0x00, // 41
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 42
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 43
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00,
|
||||
0x00, // 44
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 45
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,
|
||||
0x00, // 46
|
||||
0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00,
|
||||
0x00, // 47
|
||||
0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xd6, 0xd6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00,
|
||||
0x00, // 48
|
||||
0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00,
|
||||
0x00, // 49
|
||||
0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00,
|
||||
0x00, // 50
|
||||
0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 51
|
||||
0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00,
|
||||
0x00, // 52
|
||||
0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 53
|
||||
0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 54
|
||||
0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00,
|
||||
0x00, // 55
|
||||
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 56
|
||||
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78, 0x00, 0x00, 0x00,
|
||||
0x00, // 57
|
||||
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 58
|
||||
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00,
|
||||
0x00, // 59
|
||||
0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00,
|
||||
0x00, // 60
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 61
|
||||
0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00,
|
||||
0x00, // 62
|
||||
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,
|
||||
0x00, // 63
|
||||
0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xde, 0xde, 0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 64
|
||||
0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00,
|
||||
0x00, // 65
|
||||
0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00,
|
||||
0x00, // 66
|
||||
0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x00, // 67
|
||||
0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00,
|
||||
0x00, // 68
|
||||
0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00,
|
||||
0x00, // 69
|
||||
0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00,
|
||||
0x00, // 70
|
||||
0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00,
|
||||
0x00, // 71
|
||||
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00,
|
||||
0x00, // 72
|
||||
0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x00, // 73
|
||||
0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00,
|
||||
0x00, // 74
|
||||
0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00,
|
||||
0x00, // 75
|
||||
0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00,
|
||||
0x00, // 76
|
||||
0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00,
|
||||
0x00, // 77
|
||||
0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00,
|
||||
0x00, // 78
|
||||
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 79
|
||||
0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00,
|
||||
0x00, // 80
|
||||
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, 0x0c, 0x0e, 0x00,
|
||||
0x00, // 81
|
||||
0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00,
|
||||
0x00, // 82
|
||||
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 83
|
||||
0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x00, // 84
|
||||
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 85
|
||||
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00,
|
||||
0x00, // 86
|
||||
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00,
|
||||
0x00, // 87
|
||||
0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00,
|
||||
0x00, // 88
|
||||
0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x00, // 89
|
||||
0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00,
|
||||
0x00, // 90
|
||||
0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x00, // 91
|
||||
0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00,
|
||||
0x00, // 92
|
||||
0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x00, // 93
|
||||
0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 94
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00,
|
||||
0x00, // 95
|
||||
0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 96
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00,
|
||||
0x00, // 97
|
||||
0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 98
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 99
|
||||
0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00,
|
||||
0x00, // 100
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 101
|
||||
0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00,
|
||||
0x00, // 102
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78,
|
||||
0x00, // 103
|
||||
0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00,
|
||||
0x00, // 104
|
||||
0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x00, // 105
|
||||
0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c,
|
||||
0x00, // 106
|
||||
0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00,
|
||||
0x00, // 107
|
||||
0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x00, // 108
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00,
|
||||
0x00, // 109
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00,
|
||||
0x00, // 110
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 111
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0,
|
||||
0x00, // 112
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e,
|
||||
0x00, // 113
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00,
|
||||
0x00, // 114
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 115
|
||||
0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00,
|
||||
0x00, // 116
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00,
|
||||
0x00, // 117
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00,
|
||||
0x00, // 118
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00,
|
||||
0x00, // 119
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00,
|
||||
0x00, // 120
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8,
|
||||
0x00, // 121
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00,
|
||||
0x00, // 122
|
||||
0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00,
|
||||
0x00, // 123
|
||||
0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00,
|
||||
0x00, // 124
|
||||
0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00,
|
||||
0x00, // 125
|
||||
0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 126
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 127
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 128
|
||||
0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00,
|
||||
0x00, // 129
|
||||
0x00, 0x18, 0x18, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00,
|
||||
0x00, // 130
|
||||
0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00,
|
||||
0x00, // 131
|
||||
0x00, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00,
|
||||
0x00, // 132
|
||||
0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00,
|
||||
0x00, // 133
|
||||
0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 134
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xd8, 0x6c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 135
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 136
|
||||
0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 137
|
||||
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
0x00, // 138
|
||||
0x00, 0x70, 0xd8, 0x30, 0x60, 0xc8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 139
|
||||
0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, 0x00,
|
||||
0x00, // 140
|
||||
0x00, 0x00, 0x7f, 0xdb, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00,
|
||||
0x00, // 141
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 142
|
||||
0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 143
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36, 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 144
|
||||
0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xce, 0x9e, 0x3e, 0x06, 0x06, 0x00,
|
||||
0x00, // 145
|
||||
0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xdc, 0x86, 0x0c, 0x18, 0x3e, 0x00,
|
||||
0x00, // 146
|
||||
0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xc0, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 147
|
||||
0x00, 0xc6, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00,
|
||||
0x00, // 148
|
||||
0x38, 0x6c, 0x38, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00,
|
||||
0x00, // 149
|
||||
0x00, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00,
|
||||
0x00, // 150
|
||||
0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x0c, 0x06, 0x7c, 0x00,
|
||||
0x00, // 151
|
||||
0x18, 0x30, 0x60, 0x00, 0xfe, 0x66, 0x60, 0x7c, 0x60, 0x60, 0x66, 0xfe, 0x00, 0x00, 0x00,
|
||||
0x00, // 152
|
||||
0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00,
|
||||
0x00, // 153
|
||||
0x00, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 154
|
||||
0x00, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 155
|
||||
0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0x00, 0x00, 0x00,
|
||||
0x00, // 156
|
||||
0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00,
|
||||
0x00, // 157
|
||||
0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00,
|
||||
0x00, // 158
|
||||
0x00, 0x10, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00,
|
||||
0x00, // 159
|
||||
0x00, 0x00, 0xcc, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00,
|
||||
0x00, // 160
|
||||
0x00, 0x38, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00,
|
||||
0x00, // 161
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x76, 0x36, 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00,
|
||||
0x00, // 162
|
||||
0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x66, 0x3c, 0x0c, 0x06, 0x3c, 0x00, 0x00,
|
||||
0x00, // 163
|
||||
0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 164
|
||||
0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 165
|
||||
0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 166
|
||||
0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 167
|
||||
0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x00, // 168
|
||||
0x00, 0x0c, 0x18, 0x30, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x00, // 169
|
||||
0x00, 0x18, 0x3c, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x00, // 170
|
||||
0x00, 0x00, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x00, // 171
|
||||
0x00, 0x00, 0x76, 0xdc, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00,
|
||||
0x00, // 172
|
||||
0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 173
|
||||
0x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 174
|
||||
0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 175
|
||||
0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, // 176
|
||||
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 177
|
||||
0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00,
|
||||
0x00, // 178
|
||||
0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00,
|
||||
0x00, // 179
|
||||
0x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00,
|
||||
0x00, // 180
|
||||
0x00, 0x00, 0xcc, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00,
|
||||
0x00, // 181
|
||||
0x00, 0x00, 0xc6, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78,
|
||||
0x00, // 182
|
||||
0x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0x70, 0x00,
|
||||
0x00, // 183
|
||||
0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00,
|
||||
0x00, // 184
|
||||
0x00, 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00,
|
||||
0x00, // 185
|
||||
0x00, 0x00, 0x00, 0xfe, 0xc6, 0x60, 0x30, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00,
|
||||
0x00, // 186
|
||||
0x00, 0x00, 0x00, 0x7e, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00,
|
||||
0x00, // 187
|
||||
0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x6c, 0xee, 0x00, 0x00, 0x00,
|
||||
0x00, // 188
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0xd8, 0xd8, 0xd8, 0xdc, 0x76, 0x00, 0x00, 0x00,
|
||||
0x00, // 189
|
||||
0x00, 0x00, 0x1e, 0x30, 0x18, 0x0c, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x00, // 190
|
||||
0x00, 0x00, 0x1c, 0x30, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x60, 0x30, 0x1c, 0x00, 0x00, 0x00,
|
||||
0x00, // 191
|
||||
0x00, 0x00, 0x00, 0x00, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00,
|
||||
0x00, // 192
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00,
|
||||
0x00, // 193
|
||||
0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00,
|
||||
0x00, // 194
|
||||
0x00, 0x00, 0x00, 0x03, 0x06, 0x7e, 0xdb, 0xdb, 0xf3, 0x7e, 0x60, 0xc0, 0x00, 0x00, 0x00,
|
||||
0x00, // 195
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 196
|
||||
0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00,
|
||||
0x00, // 197
|
||||
0x00, 0xd8, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 198
|
||||
0x00, 0xf8, 0xcc, 0xcc, 0xf8, 0xc4, 0xcc, 0xde, 0xcc, 0xcc, 0xcc, 0xc6, 0x00, 0x00, 0x00,
|
||||
0x00, // 199
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 200
|
||||
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00,
|
||||
0x00, // 201
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 202
|
||||
0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00,
|
||||
0x00, // 203
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x6c, 0xfe, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 204
|
||||
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 205
|
||||
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00,
|
||||
0x00, // 206
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 207
|
||||
0x00, 0x0f, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x6c, 0x3c, 0x1c, 0x00, 0x00, 0x00,
|
||||
0x00, // 208
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xdb, 0xdb, 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 209
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 210
|
||||
0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00,
|
||||
0x00, // 211
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 212
|
||||
0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 213
|
||||
0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x7e, 0x00, 0x00, 0x00,
|
||||
0x00, // 214
|
||||
0x00, 0x00, 0x00, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x7e, 0x00, 0x00, 0x00,
|
||||
0x00, // 215
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 216
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 217
|
||||
0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, // 218
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00,
|
||||
0x00, // 219
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 220
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, // 221
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, // 222
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, // 223
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 224
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 225
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, // 226
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, // 227
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, // 228
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 229
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, // 230
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 231
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, // 232
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, // 233
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, // 234
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, // 235
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, // 236
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, // 237
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, // 238
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 239
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 240
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 241
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 242
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 243
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 244
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, // 245
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, // 246
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, // 247
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, // 248
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, // 249
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, // 250
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, // 251
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, // 252
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, // 253
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 254
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 255
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 256
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, // 257
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, // 258
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, // 259
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 260
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, // 261
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, // 262
|
||||
0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
|
||||
0xf0, // 263
|
||||
0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
|
||||
0x0f, // 264
|
||||
0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11,
|
||||
0x44, // 265
|
||||
0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55,
|
||||
0xaa, // 266
|
||||
0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd,
|
||||
0x77, // 267
|
||||
0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 268
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00,
|
||||
0x00, // 269
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 270
|
||||
0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00,
|
||||
0x00, // 271
|
||||
0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 272
|
||||
0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00,
|
||||
0x00, // 273
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 274
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, // 275
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, // 276
|
||||
0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00,
|
||||
0x00, // 277
|
||||
0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00,
|
||||
0x00, // 278
|
||||
0x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18, 0x00, 0x00, 0x00,
|
||||
0x00, // 279
|
||||
0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00,
|
||||
0x00, // 280
|
||||
0x00, 0x00, 0x1e, 0x0e, 0x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00,
|
||||
0x00, // 281
|
||||
0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x00, // 282
|
||||
0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x00, // 283
|
||||
0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00,
|
||||
0x00, // 284
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, // 285
|
||||
0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30, 0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00,
|
||||
0x00, // 286
|
||||
0x00, 0x00, 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00,
|
||||
0x00, // 287
|
||||
];
|
||||
@@ -1,13 +0,0 @@
|
||||
use libm::include_font;
|
||||
|
||||
pub mod ibm_vga_8x16;
|
||||
|
||||
pub static FONT_SPLEEN_8X16: Font = Font(include_font!(
|
||||
"./libk/resources/font/spleen-8x16.psf"
|
||||
));
|
||||
|
||||
pub static FONT_CP850_8X16: Font = Font(include_font!(
|
||||
"./libk/resources/font/cp850-8x16.psf"
|
||||
));
|
||||
|
||||
pub struct Font(pub [[u8; 16]; 512]);
|
||||
@@ -1 +0,0 @@
|
||||
pub mod font;
|
||||
@@ -1,21 +0,0 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
mod frame;
|
||||
mod render;
|
||||
mod window;
|
||||
|
||||
pub trait Application {
|
||||
type Output;
|
||||
|
||||
fn run(
|
||||
&mut self,
|
||||
args: Vec<String>,
|
||||
) -> impl core::future::Future<Output = Result<Self::Output, Error>> + Send;
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
UnknownCommand(String),
|
||||
ApplicationFailed(String),
|
||||
KernelError(String),
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
use super::{
|
||||
render::{ColouredChar, RenderError},
|
||||
window::Window,
|
||||
};
|
||||
use alloc::vec::Vec;
|
||||
|
||||
pub struct Frame<'f> {
|
||||
data: Vec<Vec<ColouredChar>>,
|
||||
window: &'f Window,
|
||||
}
|
||||
|
||||
impl Frame<'_> {
|
||||
pub fn render(&self) -> Result<(), RenderError> {
|
||||
let data: Vec<&[ColouredChar]> = self.data.iter().map(|v| v.as_slice()).collect::<Vec<_>>();
|
||||
self.window
|
||||
.render(data.as_slice())
|
||||
.map_err(|_| RenderError::Generic)
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
use core::fmt::Display;
|
||||
|
||||
use crate::drivers::io::framebuffer::colour::Colour;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum RenderError {
|
||||
Generic,
|
||||
}
|
||||
|
||||
impl Display for RenderError {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
match self {
|
||||
Self::Generic => write!(f, "Generic render error"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl core::error::Error for RenderError {}
|
||||
|
||||
pub struct ColouredChar {
|
||||
ch: u8,
|
||||
colour: Colour,
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
use crate::{prelude::*, std::maths::geometry::Vec2};
|
||||
|
||||
use super::render::{ColouredChar, RenderError};
|
||||
|
||||
pub struct Window {
|
||||
dimensions: Vec2<usize>,
|
||||
position: Vec2<usize>,
|
||||
bordered: bool,
|
||||
opened: bool,
|
||||
title: String,
|
||||
}
|
||||
|
||||
impl Window {
|
||||
pub const fn new() -> Self {
|
||||
Self {
|
||||
dimensions: Vec2::new(0, 0),
|
||||
position: Vec2::new(0, 0),
|
||||
bordered: true,
|
||||
opened: false,
|
||||
title: String::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn render(&self, _data: &[&[ColouredChar]]) -> Result<(), RenderError> {
|
||||
todo!();
|
||||
}
|
||||
|
||||
pub const fn is_bordered(&self) -> bool {
|
||||
self.bordered
|
||||
}
|
||||
|
||||
pub const fn is_open(&self) -> bool {
|
||||
self.opened
|
||||
}
|
||||
|
||||
pub const fn open(&mut self) {
|
||||
self.opened = true;
|
||||
}
|
||||
|
||||
pub const fn close(&mut self) {
|
||||
self.opened = false;
|
||||
}
|
||||
|
||||
// some basic getters and setters for utility.
|
||||
pub fn title(&'static self) -> &'static str {
|
||||
self.title.as_str()
|
||||
}
|
||||
|
||||
pub const fn dimensions(&self) -> Vec2<usize> {
|
||||
self.dimensions
|
||||
}
|
||||
|
||||
pub const fn position(&self) -> Vec2<usize> {
|
||||
self.position
|
||||
}
|
||||
|
||||
pub fn set_title(&mut self, title: String) {
|
||||
self.title = title;
|
||||
}
|
||||
|
||||
pub fn move_window(&mut self, offset: Vec2<usize>) {
|
||||
self.position += offset;
|
||||
}
|
||||
|
||||
pub const fn set_position(&mut self, position: Vec2<usize>) {
|
||||
self.position = position;
|
||||
}
|
||||
|
||||
pub const fn set_dimensions(&mut self, dimensions: Vec2<usize>) {
|
||||
self.dimensions = dimensions;
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Window {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Window {
|
||||
fn drop(&mut self) {
|
||||
if self.opened {
|
||||
self.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
pub use crate::drivers::io::{
|
||||
ascii::{_print, _print_err, _print_log},
|
||||
print, print_log, printerr, println, println_log, printlnerr,
|
||||
serial::_serial_write,
|
||||
serial_print, serial_println,
|
||||
};
|
||||
|
||||
pub mod stdin {
|
||||
use alloc::string::String;
|
||||
|
||||
use crate::drivers::io::{
|
||||
ascii::WRITER,
|
||||
keyboard::{KeyStroke, get_keystroke_async, get_keystroke_optional},
|
||||
};
|
||||
|
||||
/// Reads a line of input from standard input asynchronously, returning a `String` containing
|
||||
/// the input line. Does not include the newline character at the end of the line.
|
||||
///
|
||||
/// If the user presses the abort key (usually Ctrl+C), the returned string will be empty.
|
||||
///
|
||||
/// This function is currently unimplemented.
|
||||
pub async fn read_line() -> String {
|
||||
let mut writer = WRITER.lock();
|
||||
|
||||
let mut buff = String::new();
|
||||
loop {
|
||||
match get_keystroke_async().await {
|
||||
KeyStroke::Char(c) => match c {
|
||||
'\n' => {
|
||||
writer.write_glyph(c as u8);
|
||||
return buff;
|
||||
}
|
||||
'\r' => {
|
||||
writer.write_glyph(c as u8);
|
||||
return buff;
|
||||
}
|
||||
'\x08' => {
|
||||
if !buff.is_empty() {
|
||||
buff.pop();
|
||||
writer.backspace();
|
||||
}
|
||||
}
|
||||
|
||||
c => {
|
||||
writer.write_glyph(c as u8);
|
||||
buff.push(c)
|
||||
}
|
||||
},
|
||||
KeyStroke::Enter => {
|
||||
writer.write_glyph(b'\n');
|
||||
return buff;
|
||||
}
|
||||
KeyStroke::Backspace => {
|
||||
if !buff.is_empty() {
|
||||
buff.pop();
|
||||
writer.backspace();
|
||||
}
|
||||
}
|
||||
_ => continue,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Reads a character from standard input and blocks the current task until a character is
|
||||
/// available.
|
||||
///
|
||||
/// # Note
|
||||
///
|
||||
/// This function is not yet implemented.
|
||||
pub async fn async_keystroke() -> KeyStroke {
|
||||
get_keystroke_async().await
|
||||
}
|
||||
|
||||
/// Attempt to read a character from standard input without blocking the current task.
|
||||
///
|
||||
/// If no character is available, returns `None`.
|
||||
///
|
||||
/// # Note
|
||||
///
|
||||
/// This function is not yet implemented.
|
||||
pub fn keystroke() -> Option<KeyStroke> {
|
||||
get_keystroke_optional()
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
use core::ops::{AddAssign, DivAssign, MulAssign, SubAssign};
|
||||
|
||||
pub trait Coordinate:
|
||||
Copy + Clone + PartialEq + AddAssign + MulAssign + SubAssign + DivAssign
|
||||
{
|
||||
}
|
||||
|
||||
impl Coordinate for usize {}
|
||||
impl Coordinate for isize {}
|
||||
impl Coordinate for u8 {}
|
||||
impl Coordinate for i8 {}
|
||||
impl Coordinate for u16 {}
|
||||
impl Coordinate for i16 {}
|
||||
impl Coordinate for u32 {}
|
||||
impl Coordinate for i32 {}
|
||||
impl Coordinate for u64 {}
|
||||
impl Coordinate for i64 {}
|
||||
impl Coordinate for u128 {}
|
||||
impl Coordinate for i128 {}
|
||||
impl Coordinate for f32 {}
|
||||
impl Coordinate for f64 {}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Debug)]
|
||||
pub struct Vec2<T: Coordinate> {
|
||||
x: T,
|
||||
y: T,
|
||||
}
|
||||
|
||||
impl<T: Coordinate> Vec2<T> {
|
||||
pub const fn new(x: T, y: T) -> Self {
|
||||
Self { x, y }
|
||||
}
|
||||
|
||||
pub fn into<S: Coordinate + From<T>>(&self) -> Vec2<S> {
|
||||
Vec2::new(self.x.into(), self.y.into())
|
||||
}
|
||||
|
||||
pub const fn x(&self) -> T {
|
||||
self.x
|
||||
}
|
||||
|
||||
pub const fn y(&self) -> T {
|
||||
self.y
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Coordinate> AddAssign for Vec2<T> {
|
||||
fn add_assign(&mut self, rhs: Self) {
|
||||
self.x += rhs.x;
|
||||
self.y += rhs.y;
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Coordinate> SubAssign for Vec2<T> {
|
||||
fn sub_assign(&mut self, rhs: Self) {
|
||||
self.x -= rhs.x;
|
||||
self.y -= rhs.y;
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Coordinate> MulAssign<T> for Vec2<T> {
|
||||
fn mul_assign(&mut self, rhs: T) {
|
||||
self.x *= rhs;
|
||||
self.y *= rhs;
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Coordinate> DivAssign<T> for Vec2<T> {
|
||||
fn div_assign(&mut self, rhs: T) {
|
||||
self.x /= rhs;
|
||||
self.y /= rhs;
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
pub mod geometry;
|
||||
@@ -1,3 +0,0 @@
|
||||
pub mod application;
|
||||
pub mod io;
|
||||
pub mod maths;
|
||||
@@ -1,113 +0,0 @@
|
||||
use core::arch::asm;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct Thread {
|
||||
id: usize,
|
||||
/// This shall be default before the program is interrupted, otherwise it will store
|
||||
/// CPU registers etc to be restored on context switch.
|
||||
ctx: ThreadContext,
|
||||
}
|
||||
|
||||
/// CPU state to be saved on context switches.
|
||||
#[repr(C)]
|
||||
#[derive(Default)]
|
||||
pub struct ThreadContext {
|
||||
/// Accumulator register.
|
||||
rax: u64,
|
||||
/// Base register.
|
||||
rbx: u64,
|
||||
/// Counter register.
|
||||
rcx: u64,
|
||||
/// Data register.
|
||||
rdx: u64,
|
||||
/// Source index register.
|
||||
rsi: u64,
|
||||
/// Destination index register.
|
||||
rdi: u64,
|
||||
/// Base pointer register.
|
||||
rbp: u64,
|
||||
/// Stack pointer register.
|
||||
rsp: u64,
|
||||
/// An extended register.
|
||||
r8: u64,
|
||||
/// An extended register.
|
||||
r9: u64,
|
||||
/// An extended register.
|
||||
r10: u64,
|
||||
/// An extended register.
|
||||
r11: u64,
|
||||
/// An extended register.
|
||||
r12: u64,
|
||||
/// An extended register.
|
||||
r13: u64,
|
||||
/// An extended register.
|
||||
r14: u64,
|
||||
/// An extended register.
|
||||
r15: u64,
|
||||
/// The instruction pointer.
|
||||
rip: u64,
|
||||
/// RFLAGS register.
|
||||
rflags: u64,
|
||||
}
|
||||
|
||||
impl ThreadContext {
|
||||
/// Saves the current registers of the CPU before a context switch
|
||||
/// to be restored later.
|
||||
///
|
||||
/// # Notes
|
||||
///
|
||||
/// This function should ONLY be called in interrupt handlers such
|
||||
/// as that of the timer. This will then save registers as required
|
||||
///
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe because of the usage of inline ASM.
|
||||
#[inline(always)]
|
||||
pub unsafe fn save_registers() -> Self {
|
||||
let mut context = Self::default();
|
||||
unsafe {
|
||||
asm!(
|
||||
"mov {0}, rax",
|
||||
"mov {1}, rbx",
|
||||
"mov {2}, rcx",
|
||||
"mov {3}, rdx",
|
||||
"mov {4}, rsi",
|
||||
"mov {5}, rdi",
|
||||
"mov {6}, rbp",
|
||||
"mov {7}, rsp",
|
||||
"mov {8}, r8",
|
||||
"mov {9}, r9",
|
||||
"mov {10}, r10",
|
||||
"mov {11}, r11",
|
||||
"mov {12}, r12",
|
||||
"mov {13}, r13",
|
||||
"mov {14}, r14",
|
||||
"mov {15}, r15",
|
||||
"lea {16}, [rip]",
|
||||
"pushf",
|
||||
"pop {17}",
|
||||
out(reg) context.rax,
|
||||
out(reg) context.rbx,
|
||||
out(reg) context.rcx,
|
||||
out(reg) context.rdx,
|
||||
out(reg) context.rsi,
|
||||
out(reg) context.rdi,
|
||||
out(reg) context.rbp,
|
||||
out(reg) context.rsp,
|
||||
out(reg) context.r8,
|
||||
out(reg) context.r9,
|
||||
out(reg) context.r10,
|
||||
out(reg) context.r11,
|
||||
out(reg) context.r12,
|
||||
out(reg) context.r13,
|
||||
out(reg) context.r14,
|
||||
out(reg) context.r15,
|
||||
out(reg) context.rip,
|
||||
out(reg) context.rflags,
|
||||
);
|
||||
}
|
||||
|
||||
context
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
pub mod shell;
|
||||
@@ -1,40 +0,0 @@
|
||||
// use x86_64::registers::rflags::read;
|
||||
|
||||
use crate::{drivers::io::ascii::clear_screen, prelude::stdin::read_line, print, println};
|
||||
|
||||
static FETCH: &str = "
|
||||
$$$$$$$$\\ $$\\
|
||||
$$ _____| $$ |
|
||||
$$ | $$$$$$\\ $$\\ $$\\ $$$$$$$\\ $$$$$$$ | $$$$$$\\ $$\\ $$\\
|
||||
$$$$$\\ $$ __$$\\ $$ | $$ |$$ __$$\\ $$ __$$ |$$ __$$\\ $$ | $$ |
|
||||
$$ __|$$ / $$ |$$ | $$ |$$ | $$ |$$ / $$ |$$ | \\__|$$ | $$ |
|
||||
$$ | $$ | $$ |$$ | $$ |$$ | $$ |$$ | $$ |$$ | $$ | $$ |
|
||||
$$ | \\$$$$$$ |\\$$$$$$ |$$ | $$ |\\$$$$$$$ |$$ | \\$$$$$$$ |
|
||||
\\__| \\______/ \\______/ \\__| \\__| \\_______|\\__| \\____$$ |
|
||||
$$$$$$\\ $$$$$$\\ $$\\ $$\\ $$\\ $$\\ $$ |
|
||||
$$ __$$\\ $$ __$$\\ $$ | $$ |$$$$ | \\$$$$$$ |
|
||||
$$ / $$ |$$ / \\__| $$ | $$ |\\_$$ | \\______/
|
||||
$$ | $$ |\\$$$$$$\\ \\$$\\ $$ | $$ |
|
||||
$$ | $$ | \\____$$\\ \\$$\\$$ / $$ |
|
||||
$$ | $$ |$$\\ $$ | \\$$$ / $$ |
|
||||
$$$$$$ |\\$$$$$$ | \\$ / $$$$$$\\
|
||||
\\______/ \\______/ \\_/ \\______|
|
||||
";
|
||||
|
||||
pub async fn shell() {
|
||||
println!("{}", FETCH);
|
||||
|
||||
loop {
|
||||
print!(" Shell> ");
|
||||
let line = read_line().await;
|
||||
match line.as_str() {
|
||||
"fetch" => {
|
||||
println!("{}", FETCH);
|
||||
}
|
||||
"clear" => clear_screen(),
|
||||
_ => {
|
||||
println!("Unknown command: {}", line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
[toolchain]
|
||||
channel = "nightly"
|
||||
targets = ["x86_64-linux-gnu"]
|
||||
+20
-5
@@ -1,3 +1,4 @@
|
||||
#![feature(proc_macro_span)]
|
||||
#![warn(
|
||||
clippy::correctness,
|
||||
clippy::nursery,
|
||||
@@ -12,18 +13,32 @@
|
||||
use std::fs::File;
|
||||
use std::io::{Read, Seek, SeekFrom};
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
use proc_macro::{Span, TokenStream};
|
||||
use quote::quote;
|
||||
use std::path::PathBuf;
|
||||
use syn::{LitStr, parse_macro_input};
|
||||
|
||||
extern crate proc_macro;
|
||||
|
||||
#[proc_macro]
|
||||
/// Expects the file path to be relative to the current file so this works
|
||||
/// similarly to the standard Rust include! macros.
|
||||
pub fn include_font(item: TokenStream) -> TokenStream {
|
||||
let filename = parse_macro_input!(item as LitStr);
|
||||
let file_path = filename.value();
|
||||
let span = Span::call_site();
|
||||
let source_file = span.source_file();
|
||||
|
||||
println!("Loading font: [{}]", file_path);
|
||||
if !source_file.is_real() {
|
||||
panic!(
|
||||
"We can't handle finding files if the source file does not exist. TODO: Can we?"
|
||||
)
|
||||
}
|
||||
|
||||
let filename = parse_macro_input!(item as LitStr);
|
||||
let source_filepath: PathBuf = source_file.path();
|
||||
let file_path = format!(
|
||||
"{}/{}",
|
||||
source_filepath.parent().unwrap_or_else(|| panic!("Expected to find the calling source file in a folder like src! Got: {}", source_filepath.display())).display(),
|
||||
filename.value()
|
||||
);
|
||||
|
||||
let font_bytes = match load_file(file_path) {
|
||||
Ok(bytes) => bytes,
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
max_width = 85
|
||||
format_code_in_doc_comments = true
|
||||
comment_width = 80
|
||||
wrap_comments = true
|
||||
inline_attribute_width = 80
|
||||
Reference in New Issue
Block a user