Compare commits
13 Commits
pmm
..
6e913b15d7
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e913b15d7 | |||
| 0a5269eeb0 | |||
| a0f5ce8797 | |||
| 2d3bc56962 | |||
| 5703032f87 | |||
| 3966e697da | |||
| 53d325749d | |||
| 8a3e9e3afc | |||
| e38c20dbd3 | |||
| c8bb85364c | |||
| fe18004f7d | |||
| 0b3dbed4be | |||
| 3b6e272fd2 |
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
[build]
|
[build]
|
||||||
target = "x86_64-kernel"
|
target = "x86_64-kernel.json"
|
||||||
target-dir = "build/target"
|
target-dir = "build/target"
|
||||||
|
|
||||||
[unstable]
|
[unstable]
|
||||||
|
|||||||
Generated
+2
@@ -4,6 +4,8 @@
|
|||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/kernel/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/kernel/src" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/lib_example/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" />
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
|
|||||||
Vendored
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"rust-analyzer.cargo.allTargets": false,
|
"rust-analyzer.cargo.allTargets": false,
|
||||||
"rust-analyzer.cargo.target": "x86_64-kernel",
|
"rust-analyzer.cargo.target": "x86_64-kernel.json",
|
||||||
"[rust]": {
|
"[rust]": {
|
||||||
"editor.defaultFormatter": "rust-lang.rust-analyzer",
|
"editor.defaultFormatter": "rust-lang.rust-analyzer",
|
||||||
"editor.formatOnSave": true
|
"editor.formatOnSave": true
|
||||||
},
|
},
|
||||||
"rust-analyzer.check.command": "clippy",
|
"rust-analyzer.check.command": "clippy"
|
||||||
}
|
}
|
||||||
Generated
+4
-15
@@ -110,8 +110,11 @@ name = "foundry_os"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"libk",
|
"crossbeam",
|
||||||
|
"futures-util",
|
||||||
|
"libm",
|
||||||
"limine",
|
"limine",
|
||||||
|
"linked_list_allocator",
|
||||||
"pc-keyboard",
|
"pc-keyboard",
|
||||||
"pic8259",
|
"pic8259",
|
||||||
"spin",
|
"spin",
|
||||||
@@ -148,20 +151,6 @@ version = "1.0.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libk"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"crossbeam",
|
|
||||||
"futures-util",
|
|
||||||
"libm",
|
|
||||||
"limine",
|
|
||||||
"linked_list_allocator",
|
|
||||||
"pc-keyboard",
|
|
||||||
"spin",
|
|
||||||
"x86_64",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libm"
|
name = "libm"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
members = ["kernel", "libk", "libm"]
|
members = ["kernel", "libm"]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
[workspace.package]
|
[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",
|
"type": "split",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
"id": "a20540b7c1ddbfca",
|
"id": "c178a2dff57ae0aa",
|
||||||
"type": "tabs",
|
"type": "tabs",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
"id": "e1fb15cab546d0b6",
|
"id": "6d395e6a4c72e1c8",
|
||||||
"type": "leaf",
|
"type": "leaf",
|
||||||
"state": {
|
"state": {
|
||||||
"type": "markdown",
|
"type": "markdown",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Usage/Building The Kernel.md",
|
"file": "Planning & To-Dos.md",
|
||||||
"mode": "source",
|
"mode": "source",
|
||||||
"source": false
|
"source": false
|
||||||
},
|
},
|
||||||
"icon": "lucide-file",
|
"icon": "lucide-file",
|
||||||
"title": "Building The Kernel"
|
"title": "Planning & To-Dos"
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"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"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -73,7 +53,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "search",
|
"type": "search",
|
||||||
"state": {
|
"state": {
|
||||||
"query": "tag:#usage",
|
"query": "",
|
||||||
"matchingCase": false,
|
"matchingCase": false,
|
||||||
"explainSearch": false,
|
"explainSearch": false,
|
||||||
"collapseAll": false,
|
"collapseAll": false,
|
||||||
@@ -98,8 +78,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"direction": "horizontal",
|
"direction": "horizontal",
|
||||||
"width": 200,
|
"width": 307.5
|
||||||
"collapsed": true
|
|
||||||
},
|
},
|
||||||
"right": {
|
"right": {
|
||||||
"id": "baa2a8e61b737fa6",
|
"id": "baa2a8e61b737fa6",
|
||||||
@@ -177,7 +156,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"direction": "horizontal",
|
"direction": "horizontal",
|
||||||
"width": 300
|
"width": 300,
|
||||||
|
"collapsed": true
|
||||||
},
|
},
|
||||||
"left-ribbon": {
|
"left-ribbon": {
|
||||||
"hiddenItems": {
|
"hiddenItems": {
|
||||||
@@ -185,14 +165,21 @@
|
|||||||
"graph:Open graph view": false,
|
"graph:Open graph view": false,
|
||||||
"canvas:Create new canvas": false,
|
"canvas:Create new canvas": false,
|
||||||
"daily-notes:Open today's daily note": 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": [
|
"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",
|
"Usage",
|
||||||
"Welcome.md",
|
"Welcome.md"
|
||||||
"Usage/Building The Kernel.md"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
> [!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] 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]
|
[dependencies]
|
||||||
limine = "0.3.1"
|
limine = "0.3.1"
|
||||||
libk = { path = "../libk" }
|
|
||||||
x86_64 = "0.15.2"
|
x86_64 = "0.15.2"
|
||||||
spin = "0.9.8"
|
spin = "0.9.8"
|
||||||
pic8259 = "0.11.0"
|
pic8259 = "0.11.0"
|
||||||
pc-keyboard = "0.8.0"
|
pc-keyboard = "0.8.0"
|
||||||
|
libm = { 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",
|
||||||
|
] }
|
||||||
|
linked_list_allocator = { version = "0.10.5", features = ["use_spin"] }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cc = "1.2.14"
|
cc = "1.2.14"
|
||||||
|
|||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
#![allow(unused)] // TODO: Remove this when ready.
|
|
||||||
use core::arch::x86_64::__cpuid;
|
use core::arch::x86_64::__cpuid;
|
||||||
|
|
||||||
|
use crate::arch::x86_64::memory::memory_map::PHYSICAL_MEMORY_OFFSET;
|
||||||
|
use crate::serial_print;
|
||||||
use x86_64::{
|
use x86_64::{
|
||||||
PhysAddr, VirtAddr,
|
PhysAddr, VirtAddr,
|
||||||
structures::paging::{Mapper, Size4KiB},
|
structures::paging::{Mapper, Page, PageTableFlags, PhysFrame, Size4KiB},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::serial_print;
|
use crate::arch::x86_64::cpu::msr::*;
|
||||||
|
use crate::arch::x86_64::memory::{FRAME_ALLOCATOR, OFFSET_PAGE_TABLE};
|
||||||
use super::{cpu::model_specific_registers::*, mem::memmap::PHYSICAL_MEMORY_OFFSET};
|
|
||||||
|
|
||||||
const IA32_APIC_BASE_MSR: u32 = 0x1b;
|
const IA32_APIC_BASE_MSR: u32 = 0x1b;
|
||||||
const IA32_APIC_BASE_MSR_BSP: u64 = 0x100;
|
const IA32_APIC_BASE_MSR_BSP: u64 = 0x100;
|
||||||
@@ -63,49 +63,38 @@ pub fn check_apic() -> bool {
|
|||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
unsafe fn phys_to_virt(phys: PhysAddr) -> VirtAddr {
|
unsafe fn phys_to_virt(phys: PhysAddr) -> VirtAddr {
|
||||||
let phys = phys.as_u64();
|
let phys = phys.as_u64();
|
||||||
phys.checked_add(*PHYSICAL_MEMORY_OFFSET).map_or_else(
|
phys.checked_add(*PHYSICAL_MEMORY_OFFSET)
|
||||||
|| {
|
.map_or_else(|| panic!(" overflow"), VirtAddr::new)
|
||||||
serial_print!("THIS IS A PROBLEM");
|
|
||||||
panic!("overflow")
|
|
||||||
},
|
|
||||||
|virt| {
|
|
||||||
serial_print!("map worked!");
|
|
||||||
VirtAddr::new(virt)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn enable_apic(
|
pub fn enable_apic() {
|
||||||
_mapper: &mut impl Mapper<Size4KiB>,
|
let mut mapper = OFFSET_PAGE_TABLE.get().unwrap().lock();
|
||||||
// TODO: Fix this function.
|
let mut frame_allocator = FRAME_ALLOCATOR.get().unwrap().lock();
|
||||||
// frame_allocator: &mut FoundryOSFrameAllocator,
|
|
||||||
) {
|
|
||||||
unimplemented!();
|
|
||||||
|
|
||||||
// let apic_phys_addr = get_apic_base();
|
let apic_phys_addr = get_apic_base();
|
||||||
// set_apic_base_enable(apic_phys_addr);
|
set_apic_base_enable(apic_phys_addr);
|
||||||
// map virt address of apic
|
// map virt address of apic
|
||||||
|
|
||||||
// let apic_virt = unsafe { phys_to_virt(apic_phys_addr) };
|
let apic_virt = unsafe { phys_to_virt(apic_phys_addr) };
|
||||||
// let page: Page<Size4KiB> = Page::containing_address(apic_virt);
|
let page: Page<Size4KiB> = Page::containing_address(apic_virt);
|
||||||
// let frame: PhysFrame<Size4KiB> = PhysFrame::containing_address(apic_phys_addr);
|
let frame: PhysFrame<Size4KiB> = PhysFrame::containing_address(apic_phys_addr);
|
||||||
// let flags: PageTableFlags = PageTableFlags::PRESENT | PageTableFlags::WRITABLE;
|
let flags: PageTableFlags = PageTableFlags::PRESENT | PageTableFlags::WRITABLE;
|
||||||
|
|
||||||
// unsafe {
|
unsafe {
|
||||||
// match mapper.map_to(page, frame, flags, frame_allocator) {
|
match mapper.map_to(page, frame, flags, &mut *frame_allocator) {
|
||||||
// Ok(_) => {}
|
Ok(_) => {}
|
||||||
// Err(why) => panic!("failed to map apic: {:?}", why),
|
Err(why) => panic!("failed to map apic: {:?}", why),
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // FIXME: this causes a page fault
|
// // FIXME: this causes a page fault
|
||||||
// // TODO: map to virtual memor
|
// // TODO: map to virtual memory
|
||||||
|
|
||||||
// let reg = read_apic_register(&apic_virt, 0xF0);
|
let reg = read_apic_register(&apic_virt, 0xF0);
|
||||||
|
|
||||||
// serial_print!("ok2");
|
serial_print!("ok2");
|
||||||
|
|
||||||
// write_apic_register(&apic_virt, 0xF0, reg | 0x100);
|
write_apic_register(&apic_virt, 0xF0, reg | 0x100);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Apic {}
|
pub struct Apic {}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
pub mod apic;
|
||||||
|
mod msr;
|
||||||
|
pub mod pic;
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,7 +40,15 @@ pub struct ChainedPics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ChainedPics {
|
impl ChainedPics {
|
||||||
pub const fn new(offset1: u8, offset2: u8) -> Self {
|
/// Construct a new `ChainedPics` given the base offsets of the two PICs.
|
||||||
|
///
|
||||||
|
/// # Safety
|
||||||
|
///
|
||||||
|
/// This function is unsafe because it requires you to pass valid offsets.
|
||||||
|
/// If you pass offsets that are out of range, or if you pass offsets that
|
||||||
|
/// conflict with one another, the resulting object will be useless and
|
||||||
|
/// will likely cause problems for your system.
|
||||||
|
pub const unsafe fn new(offset1: u8, offset2: u8) -> Self {
|
||||||
Self {
|
Self {
|
||||||
pics: [
|
pics: [
|
||||||
Pic {
|
Pic {
|
||||||
@@ -57,14 +65,20 @@ impl ChainedPics {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn new_contiguous(primary_offset: u8) -> Self {
|
/// .
|
||||||
Self::new(primary_offset, primary_offset + 8)
|
///
|
||||||
}
|
|
||||||
|
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// This should be safe if called just once on initialisation, however
|
/// .
|
||||||
/// sending data to IO ports tends to have side-effects.
|
pub const unsafe fn new_contiguous(primary_offset: u8) -> Self {
|
||||||
|
unsafe { Self::new(primary_offset, primary_offset + 8) }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a new instance of [`ChainedPics`].
|
||||||
|
///
|
||||||
|
/// # Safety
|
||||||
|
///
|
||||||
|
/// this is unsafe because it required writing to CPU I/O ports.
|
||||||
pub unsafe fn initialize(&mut self) {
|
pub unsafe fn initialize(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut wait_port: Port<u8> = Port::new(0x80);
|
let mut wait_port: Port<u8> = Port::new(0x80);
|
||||||
@@ -106,12 +120,12 @@ impl ChainedPics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Reads the interrupt masks of both PICs.
|
/// Reads the interrupt masks of both PICs.
|
||||||
pub fn read_masks(&mut self) -> [u8; 2] {
|
pub unsafe fn read_masks(&mut self) -> [u8; 2] {
|
||||||
unsafe { [self.pics[0].read_mask(), self.pics[1].read_mask()] }
|
unsafe { [self.pics[0].read_mask(), self.pics[1].read_mask()] }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Writes the interrupt masks of both PICs.
|
/// Writes the interrupt masks of both PICs.
|
||||||
pub fn write_masks(&mut self, mask1: u8, mask2: u8) {
|
pub unsafe fn write_masks(&mut self, mask1: u8, mask2: u8) {
|
||||||
unsafe {
|
unsafe {
|
||||||
self.pics[0].write_mask(mask1);
|
self.pics[0].write_mask(mask1);
|
||||||
self.pics[1].write_mask(mask2);
|
self.pics[1].write_mask(mask2);
|
||||||
@@ -119,8 +133,8 @@ impl ChainedPics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Disables both PICs by masking all interrupts.
|
/// Disables both PICs by masking all interrupts.
|
||||||
pub fn disable(&mut self) {
|
pub unsafe fn disable(&mut self) {
|
||||||
self.write_masks(u8::MAX, u8::MAX)
|
unsafe { self.write_masks(u8::MAX, u8::MAX) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Do we handle this interrupt?
|
/// Do we handle this interrupt?
|
||||||
@@ -131,7 +145,7 @@ impl ChainedPics {
|
|||||||
/// Figure out which (if any) PICs in our chain need to know about this
|
/// Figure out which (if any) PICs in our chain need to know about this
|
||||||
/// interrupt. This is tricky, because all interrupts from `pics[1]`
|
/// interrupt. This is tricky, because all interrupts from `pics[1]`
|
||||||
/// get chained through `pics[0]`.
|
/// get chained through `pics[0]`.
|
||||||
pub fn notify_end_of_interrupt(&mut self, interrupt_id: u8) {
|
pub unsafe fn notify_end_of_interrupt(&mut self, interrupt_id: u8) {
|
||||||
if self.handles_interrupt(interrupt_id) {
|
if self.handles_interrupt(interrupt_id) {
|
||||||
if self.pics[1].handles_interrupt(interrupt_id) {
|
if self.pics[1].handles_interrupt(interrupt_id) {
|
||||||
unsafe {
|
unsafe {
|
||||||
@@ -2,7 +2,7 @@ use core::fmt;
|
|||||||
use spin::{Lazy, Mutex};
|
use spin::{Lazy, Mutex};
|
||||||
use x86_64::instructions::interrupts;
|
use x86_64::instructions::interrupts;
|
||||||
|
|
||||||
use super::framebuffer::{colour::Colour, display::FRAMEBUFFER_WRITER};
|
use crate::arch::x86_64::drivers::framebuffer::{colour::Colour, display::FRAMEBUFFER_WRITER};
|
||||||
|
|
||||||
use crate::resources::font::{FONT_SPLEEN_8X16, Font};
|
use crate::resources::font::{FONT_SPLEEN_8X16, Font};
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ impl Writer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the character data from the font array. -- each byte is a row of pixels
|
// Get the character data from the font array. -- each byte is a row of pixels
|
||||||
let data: &[u8] = &self.font.glyphs[c as usize];
|
let data: &[u8] = self.font.glyph_for(c as u16);
|
||||||
|
|
||||||
if let Some(writer) = FRAMEBUFFER_WRITER.lock().as_mut() {
|
if let Some(writer) = FRAMEBUFFER_WRITER.lock().as_mut() {
|
||||||
for (row, line) in data.iter().enumerate().take(16) {
|
for (row, line) in data.iter().enumerate().take(16) {
|
||||||
@@ -145,7 +145,7 @@ impl Writer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl core::fmt::Write for Writer {
|
impl fmt::Write for Writer {
|
||||||
fn write_str(&mut self, s: &str) -> core::fmt::Result {
|
fn write_str(&mut self, s: &str) -> core::fmt::Result {
|
||||||
self.write_string(s);
|
self.write_string(s);
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -164,19 +164,19 @@ fn write(args: fmt::Arguments, fg: Colour, bg: Colour) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn _print(args: fmt::Arguments) {
|
pub fn _print(args: fmt::Arguments) {
|
||||||
x86_64::instructions::interrupts::without_interrupts(|| {
|
interrupts::without_interrupts(|| {
|
||||||
write(args, Colour::White, Colour::Black);
|
write(args, Colour::White, Colour::Black);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn _print_err(args: fmt::Arguments) {
|
pub fn _print_err(args: fmt::Arguments) {
|
||||||
x86_64::instructions::interrupts::without_interrupts(|| {
|
interrupts::without_interrupts(|| {
|
||||||
write(args, Colour::Red, Colour::Black);
|
write(args, Colour::Red, Colour::Black);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn _print_log(args: fmt::Arguments) {
|
pub fn _print_log(args: fmt::Arguments) {
|
||||||
x86_64::instructions::interrupts::without_interrupts(|| {
|
interrupts::without_interrupts(|| {
|
||||||
write(args, Colour::Yellow, Colour::Black);
|
write(args, Colour::Yellow, Colour::Black);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -209,7 +209,7 @@ macro_rules! println_log {
|
|||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! print_log {
|
macro_rules! print_log {
|
||||||
($($arg:tt)*) => ($crate::_print_log(format_args!($($arg)*)));
|
($($arg:tt)*) => ($crate::prelude::_print_log(format_args!($($arg)*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
@@ -220,7 +220,7 @@ macro_rules! println {
|
|||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! print {
|
macro_rules! print {
|
||||||
($($arg:tt)*) => ($crate::_print(format_args!($($arg)*)));
|
($($arg:tt)*) => ($crate::prelude::_print(format_args!($($arg)*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
@@ -231,5 +231,5 @@ macro_rules! printlnerr {
|
|||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! printerr {
|
macro_rules! printerr {
|
||||||
($($arg:tt)*) => ($crate::_print_err(format_args!($($arg)*)));
|
($($arg:tt)*) => ($crate::prelude::_print_err(format_args!($($arg)*)));
|
||||||
}
|
}
|
||||||
+9
-2
@@ -61,9 +61,16 @@ impl FramebufferWriter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render_frame(&self, buffer: &[Colour; 1280 * 800]) {
|
pub fn render_frame(&self, buffer: &[&[Colour]]) {
|
||||||
for (y, row) in buffer.chunks(1280).enumerate() {
|
// 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() {
|
for (x, pixel) in row.iter().enumerate() {
|
||||||
|
if x >= self.width() as usize {
|
||||||
|
break;
|
||||||
|
}
|
||||||
self.write_pixel(x, y, *pixel);
|
self.write_pixel(x, y, *pixel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,16 +3,12 @@ use core::{
|
|||||||
task::{Context, Poll},
|
task::{Context, Poll},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::println;
|
||||||
use crossbeam::queue::ArrayQueue;
|
use crossbeam::queue::ArrayQueue;
|
||||||
use futures_util::{Stream, StreamExt, task::AtomicWaker};
|
use futures_util::{Stream, StreamExt, task::AtomicWaker};
|
||||||
use pc_keyboard::{
|
use pc_keyboard::{DecodedKey, HandleControl, KeyCode, Keyboard, ScancodeSet1, layouts::Uk105Key};
|
||||||
DecodedKey, HandleControl, KeyCode, Keyboard, ScancodeSet1,
|
|
||||||
layouts::{self, Uk105Key},
|
|
||||||
};
|
|
||||||
use spin::{Lazy, Mutex, Once};
|
use spin::{Lazy, Mutex, Once};
|
||||||
|
|
||||||
use crate::prelude::*;
|
|
||||||
|
|
||||||
static KBD_QUEUE: Once<ArrayQueue<u8>> = Once::new();
|
static KBD_QUEUE: Once<ArrayQueue<u8>> = Once::new();
|
||||||
static WAKER: AtomicWaker = AtomicWaker::new();
|
static WAKER: AtomicWaker = AtomicWaker::new();
|
||||||
|
|
||||||
@@ -20,7 +16,7 @@ pub static KEYBOARD: Lazy<Mutex<Keyboard<Uk105Key, ScancodeSet1>>> = Lazy::new(|
|
|||||||
Mutex::new(Keyboard::new(
|
Mutex::new(Keyboard::new(
|
||||||
ScancodeSet1::new(),
|
ScancodeSet1::new(),
|
||||||
// TODO: Expose an API to change the default KB layout.
|
// TODO: Expose an API to change the default KB layout.
|
||||||
layouts::Uk105Key,
|
Uk105Key,
|
||||||
HandleControl::Ignore,
|
HandleControl::Ignore,
|
||||||
))
|
))
|
||||||
});
|
});
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
pub mod ascii;
|
||||||
|
pub mod framebuffer;
|
||||||
|
pub mod keyboard;
|
||||||
|
pub mod port;
|
||||||
|
pub mod serial;
|
||||||
@@ -15,7 +15,7 @@ macro_rules! serial_println {
|
|||||||
($($arg:tt)*) => (serial_print!("{}\n", format_args!($($arg)*)));
|
($($arg:tt)*) => (serial_print!("{}\n", format_args!($($arg)*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
use super::port::{inb, outb};
|
use crate::arch::x86_64::drivers::port::{inb, outb};
|
||||||
|
|
||||||
use x86_64::instructions::interrupts;
|
use x86_64::instructions::interrupts;
|
||||||
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
use x86_64::{
|
use x86_64::{
|
||||||
|
VirtAddr,
|
||||||
instructions::tables::load_tss,
|
instructions::tables::load_tss,
|
||||||
registers::segmentation::{Segment, CS, DS, ES, SS},
|
registers::segmentation::{CS, DS, ES, SS, Segment},
|
||||||
structures::{
|
structures::{
|
||||||
gdt::{Descriptor, GlobalDescriptorTable, SegmentSelector},
|
gdt::{Descriptor, GlobalDescriptorTable, SegmentSelector},
|
||||||
tss::TaskStateSegment,
|
tss::TaskStateSegment,
|
||||||
},
|
},
|
||||||
VirtAddr,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use spin::Lazy;
|
use spin::Lazy;
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
// use libk::drivers::mem::{FRAME_ALLOCATOR, OFFSET_PAGE_TABLE};
|
use crate::serial_print;
|
||||||
use libk::prelude::*;
|
|
||||||
use pic8259::ChainedPics;
|
use pic8259::ChainedPics;
|
||||||
|
use x86_64::registers::control::Cr2;
|
||||||
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame, PageFaultErrorCode};
|
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame, PageFaultErrorCode};
|
||||||
|
use x86_64::structures::paging::mapper::MapperFlushAll;
|
||||||
use spin::{Lazy, Mutex};
|
use x86_64::structures::paging::{FrameAllocator, Mapper, Page, PageTableFlags, Size4KiB};
|
||||||
|
|
||||||
use super::gdt;
|
use super::gdt;
|
||||||
|
use crate::arch::x86_64::memory::{FRAME_ALLOCATOR, OFFSET_PAGE_TABLE};
|
||||||
|
use crate::{println_log, serial_println};
|
||||||
|
use spin::{Lazy, Mutex};
|
||||||
|
|
||||||
static IDT: Lazy<InterruptDescriptorTable> = Lazy::new(|| {
|
static IDT: Lazy<InterruptDescriptorTable> = Lazy::new(|| {
|
||||||
let mut idt = InterruptDescriptorTable::new();
|
let mut idt = InterruptDescriptorTable::new();
|
||||||
@@ -60,7 +63,6 @@ pub fn enable_pic() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[expect(unused)]
|
|
||||||
pub fn disable_pic() {
|
pub fn disable_pic() {
|
||||||
unsafe {
|
unsafe {
|
||||||
PICS.lock().disable();
|
PICS.lock().disable();
|
||||||
@@ -106,7 +108,7 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac
|
|||||||
let mut port = Port::new(0x60);
|
let mut port = Port::new(0x60);
|
||||||
|
|
||||||
let scancode: u8 = unsafe { port.read() };
|
let scancode: u8 = unsafe { port.read() };
|
||||||
libk::drivers::io::keyboard::add_scancode(scancode);
|
crate::arch::x86_64::drivers::keyboard::add_scancode(scancode);
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
PICS.lock()
|
PICS.lock()
|
||||||
@@ -125,29 +127,28 @@ extern "x86-interrupt" fn page_fault_handler(
|
|||||||
_stack_frame: InterruptStackFrame,
|
_stack_frame: InterruptStackFrame,
|
||||||
_error_code: PageFaultErrorCode,
|
_error_code: PageFaultErrorCode,
|
||||||
) {
|
) {
|
||||||
todo!("Get this working again.")
|
serial_println!("Exception: Page Fault");
|
||||||
// serial_println!("Exception: Page Fault");
|
serial_println!("Accessed Address: {:?}", Cr2::read());
|
||||||
// serial_println!("Accessed Address: {:?}", Cr2::read());
|
serial_println!("Error Code: {:?}", _error_code);
|
||||||
// serial_println!("Error Code: {:?}", error_code);
|
serial_println!("{:#?}", _stack_frame);
|
||||||
// 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 mut f = frame_allocator.lock();
|
||||||
|
|
||||||
// let frame = f.allocate_frame().unwrap();
|
let frame = f.allocate_frame().unwrap();
|
||||||
// let flags = PageTableFlags::PRESENT | PageTableFlags::WRITABLE;
|
let flags = PageTableFlags::PRESENT | PageTableFlags::WRITABLE;
|
||||||
// let page: Page<Size4KiB> = Page::containing_address(Cr2::read().unwrap());
|
let page: Page<Size4KiB> = Page::containing_address(Cr2::read().unwrap());
|
||||||
|
|
||||||
// unsafe {
|
unsafe {
|
||||||
// let mut mapper = OFFSET_PAGE_TABLE.get().unwrap().lock();
|
let mut mapper = OFFSET_PAGE_TABLE.get().unwrap().lock();
|
||||||
|
|
||||||
// match mapper.map_to(page, frame, flags, &mut *f) {
|
match mapper.map_to(page, frame, flags, &mut *f) {
|
||||||
// Ok(_) => {}
|
Ok(_) => {}
|
||||||
// Err(why) => panic!("failed to map page: {:?}", why),
|
Err(why) => panic!("failed to map page: {:?}", why),
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// MapperFlushAll::new().flush_all();
|
MapperFlushAll::new().flush_all();
|
||||||
// } else {
|
} else {
|
||||||
// panic!("failed to get frame allocator");
|
panic!("failed to get frame allocator");
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
pub mod memmap;
|
|
||||||
pub mod pmm;
|
|
||||||
@@ -0,0 +1,255 @@
|
|||||||
|
use core::alloc::{GlobalAlloc, Layout};
|
||||||
|
use core::ptr;
|
||||||
|
use spin::{Mutex, MutexGuard};
|
||||||
|
use x86_64::structures::paging::{Size4KiB, mapper::MapToError};
|
||||||
|
|
||||||
|
/// We are currently using a linked list heap allocator which uses our underlying page allocator.
|
||||||
|
#[global_allocator]
|
||||||
|
/// This is now Rust's global allocator, so we can use stuff requiring heap allocations.
|
||||||
|
static ALLOCATOR: Locked<FoundryAllocator> = Locked::new(FoundryAllocator::new());
|
||||||
|
|
||||||
|
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 unsafe fn init_heap() -> Result<(), MapToError<Size4KiB>> {
|
||||||
|
unsafe {
|
||||||
|
// code to allocate frames is now done in the page fault interrupt handler!
|
||||||
|
ALLOCATOR.lock().init(HEAP_START, HEAP_SIZE);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Locked<T> {
|
||||||
|
inner: Mutex<T>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> Locked<T> {
|
||||||
|
pub const fn new(inner: T) -> Self {
|
||||||
|
Self {
|
||||||
|
inner: Mutex::new(inner),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn lock(&self) -> MutexGuard<T> {
|
||||||
|
self.inner.lock()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const BLOCK_SIZES: &[usize] = &[8, 16, 32, 64, 128, 256, 512, 1024, 2048];
|
||||||
|
|
||||||
|
struct ListNode {
|
||||||
|
next: Option<&'static mut ListNode>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct FoundryAllocator {
|
||||||
|
list_heads: [Option<&'static mut ListNode>; BLOCK_SIZES.len()],
|
||||||
|
fallback: Locked<FoundryFallbackAllocator>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for FoundryAllocator {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FoundryAllocator {
|
||||||
|
pub const fn new() -> Self {
|
||||||
|
const EMPTY: Option<&'static mut ListNode> = None;
|
||||||
|
Self {
|
||||||
|
list_heads: [EMPTY; BLOCK_SIZES.len()],
|
||||||
|
fallback: Locked::new(FoundryFallbackAllocator::new()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub unsafe fn init(&mut self, heap_start: usize, heap_size: usize) {
|
||||||
|
unsafe {
|
||||||
|
self.fallback.lock().init(heap_start, heap_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn fallback_alloc(&mut self, layout: Layout) -> *mut u8 {
|
||||||
|
unsafe { self.fallback.alloc(layout) }
|
||||||
|
}
|
||||||
|
|
||||||
|
fn block_size(&self, layout: &Layout) -> Option<usize> {
|
||||||
|
let required_block_size = layout.size().max(layout.align());
|
||||||
|
BLOCK_SIZES.iter().position(|&s| s >= required_block_size)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl GlobalAlloc for Locked<FoundryAllocator> {
|
||||||
|
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
|
||||||
|
let mut allocator = self.lock();
|
||||||
|
|
||||||
|
match allocator.block_size(&layout) {
|
||||||
|
Some(index) => {
|
||||||
|
match allocator.list_heads[index].take() {
|
||||||
|
Some(node) => {
|
||||||
|
allocator.list_heads[index] = node.next.take();
|
||||||
|
node as *mut ListNode as *mut u8
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
// no block exists in list => allocate new block
|
||||||
|
let block_size = BLOCK_SIZES[index];
|
||||||
|
// only works if all block sizes are a power of 2
|
||||||
|
let block_align = block_size;
|
||||||
|
let layout = Layout::from_size_align(block_size, block_align).unwrap();
|
||||||
|
unsafe { allocator.fallback_alloc(layout) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => unsafe { allocator.fallback_alloc(layout) },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
|
||||||
|
let mut allocator = self.lock();
|
||||||
|
match allocator.block_size(&layout) {
|
||||||
|
Some(idx) => {
|
||||||
|
let new_node = ListNode {
|
||||||
|
next: allocator.list_heads[idx].take(),
|
||||||
|
};
|
||||||
|
|
||||||
|
let new_ptr = ptr as *mut ListNode;
|
||||||
|
unsafe { new_ptr.write(new_node) };
|
||||||
|
allocator.list_heads[idx] = Some(unsafe { &mut *new_ptr });
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
unsafe { allocator.fallback.dealloc(ptr, layout) };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct FallbackListNode {
|
||||||
|
size: usize,
|
||||||
|
next: Option<&'static mut FallbackListNode>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FallbackListNode {
|
||||||
|
const fn new(size: usize) -> Self {
|
||||||
|
Self { size, next: None }
|
||||||
|
}
|
||||||
|
|
||||||
|
fn start_addr(&self) -> usize {
|
||||||
|
self as *const Self as usize
|
||||||
|
}
|
||||||
|
|
||||||
|
fn end_addr(&self) -> usize {
|
||||||
|
self.start_addr() + self.size
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct FoundryFallbackAllocator {
|
||||||
|
head: FallbackListNode,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for FoundryFallbackAllocator {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FoundryFallbackAllocator {
|
||||||
|
pub const fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
head: FallbackListNode::new(0),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub unsafe fn init(&mut self, heap_start: usize, heap_size: usize) {
|
||||||
|
unsafe { self.add_region(heap_start, heap_size) };
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn add_region(&mut self, addr: usize, size: usize) {
|
||||||
|
unsafe {
|
||||||
|
let mut node = FallbackListNode::new(size);
|
||||||
|
node.next = self.head.next.take();
|
||||||
|
let node_ptr = addr as *mut FallbackListNode;
|
||||||
|
node_ptr.write(node);
|
||||||
|
self.head.next = Some(&mut *node_ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn find_region(
|
||||||
|
&mut self,
|
||||||
|
size: usize,
|
||||||
|
align: usize,
|
||||||
|
) -> Option<(&'static mut FallbackListNode, usize)> {
|
||||||
|
let mut current = &mut self.head;
|
||||||
|
// look for a large enough memory region in linked list
|
||||||
|
while let Some(ref mut region) = current.next {
|
||||||
|
if let Ok(alloc_start) = Self::alloc_from_region(region, size, align) {
|
||||||
|
// region suitable for allocation -> remove node from list
|
||||||
|
let next = region.next.take();
|
||||||
|
let ret = Some((current.next.take().unwrap(), alloc_start));
|
||||||
|
current.next = next;
|
||||||
|
return ret;
|
||||||
|
} else {
|
||||||
|
// region not suitable -> continue with next region
|
||||||
|
current = current.next.as_mut().unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
const fn align_up(addr: usize, align: usize) -> usize {
|
||||||
|
(addr + align - 1) & !(align - 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn size_align(layout: Layout) -> (usize, usize) {
|
||||||
|
let layout = layout
|
||||||
|
.align_to(align_of::<ListNode>())
|
||||||
|
.expect("adjusting alignment failed")
|
||||||
|
.pad_to_align();
|
||||||
|
let size = layout.size().max(size_of::<ListNode>());
|
||||||
|
(size, layout.align())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn alloc_from_region(
|
||||||
|
region: &FallbackListNode,
|
||||||
|
size: usize,
|
||||||
|
align: usize,
|
||||||
|
) -> Result<usize, ()> {
|
||||||
|
let alloc_start = Self::align_up(region.start_addr(), align);
|
||||||
|
let alloc_end = alloc_start.checked_add(size).ok_or(())?;
|
||||||
|
|
||||||
|
if alloc_end > region.end_addr() {
|
||||||
|
return Err(());
|
||||||
|
}
|
||||||
|
|
||||||
|
let excess_size = region.end_addr() - alloc_end;
|
||||||
|
if excess_size > 0 && excess_size < size_of::<ListNode>() {
|
||||||
|
return Err(());
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(alloc_start)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl GlobalAlloc for Locked<FoundryFallbackAllocator> {
|
||||||
|
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
|
||||||
|
let mut allocator = self.lock();
|
||||||
|
// perform layout adjustments
|
||||||
|
let (size, align) = FoundryFallbackAllocator::size_align(layout);
|
||||||
|
|
||||||
|
if let Some((region, alloc_start)) = allocator.find_region(size, align) {
|
||||||
|
let alloc_end = alloc_start.checked_add(size).expect("overflow");
|
||||||
|
let excess_size = region.end_addr() - alloc_end;
|
||||||
|
if excess_size > 0 {
|
||||||
|
unsafe { allocator.add_region(alloc_end, excess_size) };
|
||||||
|
}
|
||||||
|
alloc_start as *mut u8
|
||||||
|
} else {
|
||||||
|
ptr::null_mut()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
|
||||||
|
let mut allocator = self.lock();
|
||||||
|
|
||||||
|
// perform layout adjustments
|
||||||
|
let (size, _) = FoundryFallbackAllocator::size_align(layout);
|
||||||
|
|
||||||
|
unsafe { allocator.add_region(ptr as usize, size) }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
pub mod heap_alloc;
|
||||||
|
pub mod stack_alloc;
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
use x86_64::structures::paging::{mapper, FrameAllocator, Mapper, Page, Size4KiB};
|
||||||
|
use x86_64::VirtAddr;
|
||||||
|
|
||||||
|
fn reserve_stack_memory(size_in_pages: u64) -> Page {
|
||||||
|
use core::sync::atomic::{AtomicU64, Ordering};
|
||||||
|
static STACK_ALLOC_NEXT: AtomicU64 = AtomicU64::new(0x_5555_5555_0000);
|
||||||
|
let start_addr = VirtAddr::new(STACK_ALLOC_NEXT.fetch_add(
|
||||||
|
size_in_pages * Page::<Size4KiB>::SIZE,
|
||||||
|
Ordering::Relaxed,
|
||||||
|
));
|
||||||
|
Page::from_start_address(start_addr)
|
||||||
|
.expect("`STACK_ALLOC_NEXT` not page aligned")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub unsafe fn alloc_stack(
|
||||||
|
size_in_pages: u64,
|
||||||
|
mapper: &mut impl Mapper<Size4KiB>,
|
||||||
|
frame_allocator: &mut impl FrameAllocator<Size4KiB>,
|
||||||
|
) -> Result<StackBounds, mapper::MapToError<Size4KiB>> { unsafe {
|
||||||
|
use x86_64::structures::paging::PageTableFlags as Flags;
|
||||||
|
|
||||||
|
let guard_page = reserve_stack_memory(size_in_pages + 1);
|
||||||
|
let stack_start = guard_page + 1;
|
||||||
|
let stack_end = stack_start + size_in_pages;
|
||||||
|
|
||||||
|
for page in Page::range(stack_start, stack_end) {
|
||||||
|
let frame = frame_allocator
|
||||||
|
.allocate_frame()
|
||||||
|
.ok_or(mapper::MapToError::FrameAllocationFailed)?;
|
||||||
|
let flags = Flags::PRESENT | Flags::WRITABLE;
|
||||||
|
mapper.map_to(page, frame, flags, frame_allocator)?.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(StackBounds {
|
||||||
|
start: stack_start.start_address(),
|
||||||
|
end: stack_end.start_address(),
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
|
pub struct StackBounds {
|
||||||
|
start: VirtAddr,
|
||||||
|
end: VirtAddr,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl StackBounds {
|
||||||
|
pub const fn new(start: VirtAddr, end: VirtAddr) -> Self {
|
||||||
|
Self { start, end }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const fn start(&self) -> VirtAddr {
|
||||||
|
self.start
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const fn end(&self) -> VirtAddr {
|
||||||
|
self.end
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
pub mod allocation;
|
||||||
|
pub mod memory_map;
|
||||||
|
|
||||||
|
// 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, OffsetPageTable, PageTable, PhysFrame, Size4KiB},
|
||||||
|
};
|
||||||
|
|
||||||
|
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,5 +1,6 @@
|
|||||||
pub mod apic;
|
|
||||||
pub mod cpu;
|
pub mod cpu;
|
||||||
|
pub mod drivers;
|
||||||
pub mod gdt;
|
pub mod gdt;
|
||||||
pub mod interrupts;
|
pub mod interrupts;
|
||||||
pub mod mem;
|
pub mod memory;
|
||||||
|
pub mod processing;
|
||||||
|
|||||||
+2
-1
@@ -3,7 +3,8 @@
|
|||||||
//! Written by @zxq5 for the most part with code from
|
//! Written by @zxq5 for the most part with code from
|
||||||
//! [here](https://github.com/phil-opp/blog_os/).
|
//! [here](https://github.com/phil-opp/blog_os/).
|
||||||
//!
|
//!
|
||||||
use crate::prelude::*;
|
|
||||||
|
use alloc::boxed::Box;
|
||||||
use alloc::collections::BTreeMap;
|
use alloc::collections::BTreeMap;
|
||||||
use alloc::sync::Arc;
|
use alloc::sync::Arc;
|
||||||
use alloc::task::Wake;
|
use alloc::task::Wake;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
pub mod async_io;
|
||||||
|
pub mod threading;
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
|
mod switch;
|
||||||
|
mod deprecated;
|
||||||
|
|
||||||
use core::arch::asm;
|
use core::arch::asm;
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
use x86_64::VirtAddr;
|
||||||
|
use crate::arch::x86_64::memory::allocation::stack_alloc::StackBounds;
|
||||||
|
|
||||||
|
mod switch;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct Thread {
|
||||||
|
id: ThreadId,
|
||||||
|
stack_ptr: Option<VirtAddr>,
|
||||||
|
stack_bounds: Option<StackBounds>,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
|
pub struct ThreadId(u64);
|
||||||
|
|
||||||
|
impl ThreadId {
|
||||||
|
pub const fn as_u64(&self) -> u64 {
|
||||||
|
self.0
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new() -> Self {
|
||||||
|
use core::sync::atomic::{AtomicU64, Ordering};
|
||||||
|
static NEXT_THREAD_ID: AtomicU64 = AtomicU64::new(1);
|
||||||
|
Self(NEXT_THREAD_ID.fetch_add(1, Ordering::Relaxed))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
.intel_syntax noprefix
|
||||||
|
|
||||||
|
switch_thread:
|
||||||
|
pushfq
|
||||||
|
|
||||||
|
mov rax, rsp
|
||||||
|
mov rsp, rdi
|
||||||
|
|
||||||
|
mov rdi, rax
|
||||||
|
call add_paused_thread
|
||||||
|
|
||||||
|
popfq
|
||||||
|
ret
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
+29
-22
@@ -12,16 +12,28 @@
|
|||||||
)]
|
)]
|
||||||
|
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
use crate::{
|
||||||
// use arch::x86_64::apic::enable_apic;
|
arch::x86_64::memory::{init_frame_allocator, init_page_table},
|
||||||
|
prelude::*,
|
||||||
|
};
|
||||||
|
use arch::x86_64::memory::allocation::heap_alloc::init_heap;
|
||||||
|
use arch::x86_64::memory::memory_map;
|
||||||
use core::arch::asm;
|
use core::arch::asm;
|
||||||
// use libk::drivers::mem::pmm;
|
|
||||||
use limine::BaseRevision;
|
use limine::BaseRevision;
|
||||||
|
use x86_64::VirtAddr;
|
||||||
|
|
||||||
// use libk::drivers::alloc::allocator::init_heap;
|
pub mod arch;
|
||||||
use libk::prelude::*;
|
pub mod resources;
|
||||||
|
#[allow(unused)] // We aren't using much of this right now.
|
||||||
|
pub mod std;
|
||||||
|
pub mod util;
|
||||||
|
|
||||||
mod arch;
|
pub mod prelude {
|
||||||
|
pub use crate::std::io::{_print, _print_log, _serial_write};
|
||||||
|
pub use crate::{
|
||||||
|
print, print_log, printerr, println, println_log, printlnerr, serial_print, serial_println,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/// Sets the base revision to the latest revision supported by the crate.
|
/// Sets the base revision to the latest revision supported by the crate.
|
||||||
/// See specification for further info.
|
/// See specification for further info.
|
||||||
@@ -43,10 +55,6 @@ pub fn hcf() -> ! {
|
|||||||
unsafe {
|
unsafe {
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
asm!("hlt");
|
asm!("hlt");
|
||||||
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
|
|
||||||
asm!("wfi");
|
|
||||||
#[cfg(target_arch = "loongarch64")]
|
|
||||||
asm!("idle 0");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,12 +64,12 @@ pub fn boot() -> Result<(), &'static str> {
|
|||||||
return Err("base revision not supported");
|
return Err("base revision not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
use arch::x86_64::{gdt, interrupts, mem::memmap};
|
use arch::x86_64::{gdt, interrupts};
|
||||||
|
|
||||||
let _memory_map = memmap::get_memory_map();
|
let memory_map = memory_map::get_memory_map();
|
||||||
|
|
||||||
print_log!(" Initialising Serial... ");
|
print_log!(" Initialising Serial... ");
|
||||||
if libk::drivers::io::serial::init().is_err() {
|
if arch::x86_64::drivers::serial::init().is_err() {
|
||||||
println_log!("[Not Detected]")
|
println_log!("[Not Detected]")
|
||||||
} else {
|
} else {
|
||||||
println_log!("[Success]");
|
println_log!("[Success]");
|
||||||
@@ -76,19 +84,18 @@ pub fn boot() -> Result<(), &'static str> {
|
|||||||
println_log!("[Success]");
|
println_log!("[Success]");
|
||||||
|
|
||||||
print_log!(" Initialising Memory Subsystem... ");
|
print_log!(" Initialising Memory Subsystem... ");
|
||||||
// let physical_memory_offset = VirtAddr::new(*memmap::PHYSICAL_MEMORY_OFFSET);
|
let physical_memory_offset = VirtAddr::new(*memory_map::PHYSICAL_MEMORY_OFFSET);
|
||||||
// pmm::init_page_table(physical_memory_offset);
|
init_page_table(physical_memory_offset);
|
||||||
println_log!("[Success]");
|
println_log!("[Success]");
|
||||||
|
|
||||||
print_log!(" Setting Up Page Table... ");
|
print_log!(" Setting Up Page Table... ");
|
||||||
// pmm::init_frame_allocator(memory_map);
|
init_frame_allocator(memory_map);
|
||||||
println_log!("[Success]");
|
println_log!("[Success]");
|
||||||
|
|
||||||
print_log!(" Initialising Heap... ");
|
print_log!(" Initialising Heap... ");
|
||||||
// TODO: Reenable the heap.
|
if unsafe { init_heap() }.is_err() {
|
||||||
// if init_heap().is_err() {
|
return Err("Failed to initialise heap: error");
|
||||||
// return Err("Failed to initialise heap: error");
|
}
|
||||||
// }
|
|
||||||
println_log!("[Success]");
|
println_log!("[Success]");
|
||||||
|
|
||||||
print_log!(" Enabling PICs... ");
|
print_log!(" Enabling PICs... ");
|
||||||
@@ -98,9 +105,9 @@ pub fn boot() -> Result<(), &'static str> {
|
|||||||
// print_log!(" Disabling PICs... ");
|
// print_log!(" Disabling PICs... ");
|
||||||
// interrupts::disable_pic();
|
// interrupts::disable_pic();
|
||||||
// println_log!("[Success]");
|
// println_log!("[Success]");
|
||||||
//
|
|
||||||
// print_log!(" Initialising APIC");
|
// print_log!(" Initialising APIC");
|
||||||
// enable_apic(&mut l4_table, &mut frame_allocator);
|
// enable_apic();
|
||||||
// println_log!("[Success]");
|
// println_log!("[Success]");
|
||||||
|
|
||||||
print_log!(" Enabling Interrupts... ");
|
print_log!(" Enabling Interrupts... ");
|
||||||
|
|||||||
+14
-19
@@ -2,15 +2,11 @@
|
|||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
use foundry_os::arch::x86_64::drivers::ascii::screensize_chars;
|
||||||
use libk::{
|
use foundry_os::arch::x86_64::drivers::framebuffer::display::screensize_px;
|
||||||
drivers::{
|
use foundry_os::arch::x86_64::processing::async_io::task::{Executor, Task};
|
||||||
async_io::task::{Executor, Task},
|
use foundry_os::util::shell::shell;
|
||||||
io,
|
use foundry_os::{println, println_log};
|
||||||
},
|
|
||||||
prelude::*,
|
|
||||||
util::shell::shell,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
extern "C" fn kmain() -> ! {
|
extern "C" fn kmain() -> ! {
|
||||||
@@ -21,20 +17,19 @@ extern "C" fn kmain() -> ! {
|
|||||||
|
|
||||||
println_log!("[ Kernel Initialised Successfully ] ");
|
println_log!("[ Kernel Initialised Successfully ] ");
|
||||||
|
|
||||||
let dimensions = io::ascii::screensize_chars();
|
let dimensions = screensize_chars();
|
||||||
let dimensions2 = io::framebuffer::display::screensize_px();
|
let dimensions2 = screensize_px();
|
||||||
|
|
||||||
println!("Dimensions: {}x{} (px)", dimensions2.0, dimensions2.1);
|
println!("Dimensions: {}x{} (px)", dimensions2.0, dimensions2.1);
|
||||||
println!("Dimensions: {}x{} (chars)", dimensions.0, dimensions.1);
|
println!("Dimensions: {}x{} (chars)", dimensions.0, dimensions.1);
|
||||||
|
|
||||||
|
// println!("TESTING :: Allocation");
|
||||||
|
// let somevec = vec![0; 1_000_000];
|
||||||
|
// println!("{:?}", somevec);
|
||||||
|
// println!("{}", somevec.len());
|
||||||
|
// println!("PASSED!");
|
||||||
|
|
||||||
let mut executor = Executor::new();
|
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.spawn(Task::new(shell()));
|
||||||
executor.run();
|
executor.run()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
use libm::include_font;
|
||||||
|
pub static FONT_SPLEEN_8X16: Font =
|
||||||
|
Font::new(include_font!("../../../resources/font/spleen-8x16.psf"));
|
||||||
|
|
||||||
|
pub static FONT_CP850_8X16: Font =
|
||||||
|
Font::new(include_font!("../../../resources/font/cp850-8x16.psf"));
|
||||||
|
|
||||||
|
// pub struct Font(pub [[u8; 16]; 512]);
|
||||||
|
|
||||||
|
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 fn default() -> &'static Self {
|
||||||
|
&FONT_CP850_8X16
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
use alloc::string::String;
|
||||||
|
use alloc::vec::Vec;
|
||||||
|
|
||||||
|
pub mod frame;
|
||||||
|
pub mod render;
|
||||||
|
pub mod window;
|
||||||
|
|
||||||
|
pub trait Application {
|
||||||
|
type Output;
|
||||||
|
|
||||||
|
async fn run(&mut self, args: Vec<String>) -> Result<Self::Output, Error>;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum Error {
|
||||||
|
UnknownCommand(String),
|
||||||
|
ApplicationFailed(String),
|
||||||
|
KernelError(String),
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
use super::{render::RenderError, window::Window};
|
||||||
|
use crate::arch::x86_64::drivers::framebuffer::colour::Colour;
|
||||||
|
use crate::std::maths::geometry::Vec2;
|
||||||
|
use alloc::{vec, vec::Vec};
|
||||||
|
|
||||||
|
pub struct Frame<'f> {
|
||||||
|
data: Vec<Vec<Colour>>,
|
||||||
|
window: &'f Window,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> Frame<'a> {
|
||||||
|
pub fn new(window: &'a Window) -> Self {
|
||||||
|
Self {
|
||||||
|
data: vec![vec![Colour::Black; window.dimensions().x()]; window.dimensions().y()],
|
||||||
|
window,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render(&self) -> Result<(), RenderError> {
|
||||||
|
let data: Vec<&[Colour]> = self.data.iter().map(|v| v.as_slice()).collect::<Vec<_>>();
|
||||||
|
self.window
|
||||||
|
.render(data.as_slice())
|
||||||
|
.map_err(|_| RenderError::Generic)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn write_pixel(&mut self, x: usize, y: usize, color: Colour) -> Result<(), RenderError> {
|
||||||
|
if x >= self.window.dimensions().x() || y >= self.window.dimensions().y() {
|
||||||
|
return Err(RenderError::Generic);
|
||||||
|
}
|
||||||
|
self.data[y][x] = color;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const fn dimensions(&self) -> Vec2<usize> {
|
||||||
|
self.window.dimensions()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
|
use crate::arch::x86_64::drivers::framebuffer::colour::Colour;
|
||||||
use core::fmt::Display;
|
use core::fmt::Display;
|
||||||
|
|
||||||
use crate::drivers::io::framebuffer::colour::Colour;
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
pub enum RenderError {
|
pub enum RenderError {
|
||||||
Generic,
|
Generic,
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
use crate::{prelude::*, std::maths::geometry::Vec2};
|
use super::render::RenderError;
|
||||||
|
use crate::arch::x86_64::drivers::framebuffer::colour::Colour;
|
||||||
use super::render::{ColouredChar, RenderError};
|
use crate::arch::x86_64::drivers::framebuffer::display::FRAMEBUFFER_WRITER;
|
||||||
|
use crate::std::maths::geometry::Vec2;
|
||||||
|
use alloc::string::String;
|
||||||
|
|
||||||
pub struct Window {
|
pub struct Window {
|
||||||
dimensions: Vec2<usize>,
|
dimensions: Vec2<usize>,
|
||||||
@@ -21,8 +23,12 @@ impl Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render(&self, _data: &[&[ColouredChar]]) -> Result<(), RenderError> {
|
pub fn render(&self, _data: &[&[Colour]]) -> Result<(), RenderError> {
|
||||||
todo!();
|
// TODO: error handling!! the kernel should return an error in some cases
|
||||||
|
if let Some(fb) = FRAMEBUFFER_WRITER.lock().as_mut() {
|
||||||
|
fb.render_frame(_data);
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn is_bordered(&self) -> bool {
|
pub const fn is_bordered(&self) -> bool {
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
use super::{
|
||||||
|
application::{frame::Frame, render::RenderError},
|
||||||
|
maths::geometry::Vec2,
|
||||||
|
};
|
||||||
|
use crate::arch::x86_64::drivers::framebuffer::colour::Colour;
|
||||||
|
use crate::resources::font::Font;
|
||||||
|
|
||||||
|
pub struct Writer<'a> {
|
||||||
|
font: &'a Font,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> Writer<'a> {
|
||||||
|
pub const fn new(font: &'a Font) -> Self {
|
||||||
|
Self { font }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const fn set_font(&mut self, font: &'a Font) {
|
||||||
|
self.font = font;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const fn font_size(&self) -> Vec2<usize> {
|
||||||
|
Vec2::new(self.font.width(), self.font.height())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render_glyph(
|
||||||
|
&self,
|
||||||
|
frame: &mut Frame,
|
||||||
|
pos: Vec2<usize>,
|
||||||
|
c: u8,
|
||||||
|
scale: usize,
|
||||||
|
) -> Result<(), RenderError> {
|
||||||
|
// get a reference to the character glyph from the font.
|
||||||
|
let data: &[u8] = self.font.glyph_for(c as u16);
|
||||||
|
|
||||||
|
if pos.x() + self.font.width() * scale > frame.dimensions().x()
|
||||||
|
|| pos.y() + self.font.height() * scale > frame.dimensions().y()
|
||||||
|
{
|
||||||
|
return Err(RenderError::Generic);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (row, line) in data.iter().enumerate().take(self.font.height()) {
|
||||||
|
for col in 0..self.font.width() {
|
||||||
|
let pixel_x: usize = pos.x() + col * scale;
|
||||||
|
let pixel_y: usize = pos.y() + row * scale;
|
||||||
|
|
||||||
|
if line & (0x80 >> col) != 0 {
|
||||||
|
for i in 0..scale {
|
||||||
|
for j in 0..scale {
|
||||||
|
frame.write_pixel(pixel_x + i, pixel_y + j, Colour::White)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,17 +1,16 @@
|
|||||||
pub use crate::drivers::io::{
|
pub use crate::arch::x86_64::drivers::{
|
||||||
ascii::{_print, _print_err, _print_log},
|
ascii::{_print, _print_err, _print_log},
|
||||||
print, print_log, printerr, println, println_log, printlnerr,
|
|
||||||
serial::_serial_write,
|
serial::_serial_write,
|
||||||
serial_print, serial_println,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod stdin {
|
pub mod stdin {
|
||||||
use alloc::string::String;
|
use crate::arch::x86_64::drivers::{
|
||||||
|
|
||||||
use crate::drivers::io::{
|
|
||||||
ascii::WRITER,
|
ascii::WRITER,
|
||||||
keyboard::{KeyStroke, get_keystroke_async, get_keystroke_optional},
|
keyboard::{
|
||||||
|
get_keystroke_async, get_keystroke_optional, KeyStroke,
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
use alloc::string::String;
|
||||||
|
|
||||||
/// Reads a line of input from standard input asynchronously, returning a `String` containing
|
/// 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.
|
/// the input line. Does not include the newline character at the end of the line.
|
||||||
@@ -71,3 +71,9 @@ impl<T: Coordinate> DivAssign<T> for Vec2<T> {
|
|||||||
self.y /= rhs;
|
self.y /= rhs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T: Coordinate> From<Vec2<T>> for (T, T) {
|
||||||
|
fn from(value: Vec2<T>) -> Self {
|
||||||
|
(value.x, value.y)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
pub mod application;
|
pub mod application;
|
||||||
|
pub mod ascii;
|
||||||
pub mod io;
|
pub mod io;
|
||||||
pub mod maths;
|
pub mod maths;
|
||||||
@@ -0,0 +1,239 @@
|
|||||||
|
use crate::serial_print;
|
||||||
|
use crate::arch::x86_64::drivers::keyboard::{KeyStroke, get_keystroke_async};
|
||||||
|
use crate::resources::font::Font;
|
||||||
|
use crate::std::application::frame::Frame;
|
||||||
|
use crate::std::application::render::RenderError;
|
||||||
|
use crate::std::application::window::Window;
|
||||||
|
use crate::std::application::{Application, Error};
|
||||||
|
use crate::std::ascii::Writer;
|
||||||
|
use crate::std::maths::geometry::Vec2;
|
||||||
|
use alloc::string::{String, ToString};
|
||||||
|
use alloc::vec::Vec;
|
||||||
|
use crate::serial_println;
|
||||||
|
|
||||||
|
pub struct Editor {
|
||||||
|
cursor_line: usize,
|
||||||
|
cursor_col: usize,
|
||||||
|
|
||||||
|
mode: Mode,
|
||||||
|
buffer: String,
|
||||||
|
window: Window,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Editor {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> Editor {
|
||||||
|
const PADDING: usize = 8;
|
||||||
|
|
||||||
|
pub const fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
cursor_line: 0,
|
||||||
|
cursor_col: 0,
|
||||||
|
|
||||||
|
mode: Mode::Nor,
|
||||||
|
buffer: String::new(),
|
||||||
|
window: Window::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render(&'a self) -> Result<Frame<'a>, RenderError> {
|
||||||
|
let mut frame = Frame::new(&self.window);
|
||||||
|
let writer = Writer::new(Font::default());
|
||||||
|
|
||||||
|
let (width, height) = writer.font_size().into();
|
||||||
|
|
||||||
|
let mut col = 0;
|
||||||
|
let mut line = 0;
|
||||||
|
let mut scale = 1;
|
||||||
|
|
||||||
|
for ch in self.buffer.chars() {
|
||||||
|
if ch == '\n' {
|
||||||
|
line += scale;
|
||||||
|
col = 0;
|
||||||
|
scale = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if width * (col + 1) > frame.dimensions().x() - 2 * Self::PADDING {
|
||||||
|
line += scale;
|
||||||
|
col = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.render_glyph(
|
||||||
|
&mut frame,
|
||||||
|
Vec2::new(col * width + Self::PADDING, line * height + Self::PADDING),
|
||||||
|
ch as u8,
|
||||||
|
scale,
|
||||||
|
)?;
|
||||||
|
col += scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
writer
|
||||||
|
.render_glyph(
|
||||||
|
&mut frame,
|
||||||
|
Vec2::new(
|
||||||
|
self.cursor_col * width + Self::PADDING,
|
||||||
|
self.cursor_line * height + Self::PADDING,
|
||||||
|
),
|
||||||
|
b'_',
|
||||||
|
scale,
|
||||||
|
)
|
||||||
|
.expect("TODO: panic message");
|
||||||
|
|
||||||
|
Ok(frame)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unused_variables, dead_code, clippy::needless_pass_by_ref_mut)]
|
||||||
|
fn get_lines(&self) -> Vec<&str> {
|
||||||
|
self.buffer.split('\n').collect::<Vec<&str>>()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unused_variables, dead_code, clippy::needless_pass_by_ref_mut)]
|
||||||
|
fn move_cursor(&mut self, x: i32, y: i32) {
|
||||||
|
self.cursor_line = self
|
||||||
|
.cursor_line
|
||||||
|
.checked_add_signed(y as isize)
|
||||||
|
.unwrap_or(self.cursor_line);
|
||||||
|
self.cursor_col = self
|
||||||
|
.cursor_col
|
||||||
|
.checked_add_signed(x as isize)
|
||||||
|
.unwrap_or(self.cursor_col);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unused_variables, dead_code, clippy::needless_pass_by_ref_mut)]
|
||||||
|
fn delete_char(&mut self) {
|
||||||
|
let i = self.get_char_idx();
|
||||||
|
self.buffer.remove(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unused_variables, dead_code, clippy::needless_pass_by_ref_mut)]
|
||||||
|
fn insert_char(&mut self, c: char) {
|
||||||
|
let i = self.get_char_idx();
|
||||||
|
self.buffer.insert(i, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unused_variables, dead_code, clippy::needless_pass_by_ref_mut)]
|
||||||
|
fn splitline(&mut self) {
|
||||||
|
let i = self.get_char_idx();
|
||||||
|
self.buffer.insert(i, '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_char_idx(&self) -> usize {
|
||||||
|
let frame = Frame::new(&self.window);
|
||||||
|
let writer = Writer::new(Font::default());
|
||||||
|
let (width, _height) = writer.font_size().into();
|
||||||
|
|
||||||
|
let mut col = 0;
|
||||||
|
let mut line = 0;
|
||||||
|
let mut scale = 1;
|
||||||
|
|
||||||
|
for (i, ch) in self.buffer.chars().enumerate() {
|
||||||
|
if ch == '\n' {
|
||||||
|
line += scale;
|
||||||
|
col = 0;
|
||||||
|
scale = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if width * (col + 1) > frame.dimensions().x() - 2 * Self::PADDING {
|
||||||
|
line += scale;
|
||||||
|
col = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if col == self.cursor_col && line == self.cursor_line {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
col += scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Application for Editor {
|
||||||
|
type Output = ();
|
||||||
|
async fn run(&mut self, _args: Vec<alloc::string::String>) -> Result<Self::Output, Error> {
|
||||||
|
self.window.set_dimensions(Vec2::new(1280, 800));
|
||||||
|
self.window.set_position(Vec2::new(0, 0));
|
||||||
|
self.window.open();
|
||||||
|
|
||||||
|
self.buffer = "Hello world, this is a test init. idk test \n ewntuiewi gjk gfdfg gndf ngdfgnmdfg ndfgmndfg gdfndfnkg njkdgjkndfjnkg ngnjfgnfgnfg fgn fn gfj gnfg jnfgjfngjk fgnjfgnjk jnkdgjnkdfg gfnd njkgdfgjn d fjnkgjkndfgjkndfgjn gndfjnk njkgdfng jnkfgdjknd jnfkgnjk".to_string();
|
||||||
|
|
||||||
|
loop {
|
||||||
|
if let Err(_err) = self.render().and_then(|frame| frame.render()) {
|
||||||
|
// TODO: Handle error
|
||||||
|
return Err(Error::ApplicationFailed("Rendering failed".to_string()));
|
||||||
|
}
|
||||||
|
|
||||||
|
let keystroke = get_keystroke_async().await;
|
||||||
|
|
||||||
|
match self.mode {
|
||||||
|
Mode::Nor => match keystroke {
|
||||||
|
KeyStroke::Char('i') => self.mode = Mode::Ins,
|
||||||
|
KeyStroke::Char('`') => return Ok(()),
|
||||||
|
_ => {}
|
||||||
|
},
|
||||||
|
Mode::Ins => {
|
||||||
|
match keystroke {
|
||||||
|
KeyStroke::Char(c) => {
|
||||||
|
match c {
|
||||||
|
// escape
|
||||||
|
'\x1B' => self.mode = Mode::Nor,
|
||||||
|
// delete
|
||||||
|
'\x7F' => self.delete_char(),
|
||||||
|
// backspace
|
||||||
|
'\x08' => {
|
||||||
|
self.move_cursor(-1, 0);
|
||||||
|
self.delete_char();
|
||||||
|
}
|
||||||
|
// enter
|
||||||
|
'\n' => self.splitline(),
|
||||||
|
_ => {
|
||||||
|
self.insert_char(c);
|
||||||
|
self.move_cursor(1, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
KeyStroke::Left => {
|
||||||
|
serial_println!("Left\n");
|
||||||
|
self.move_cursor(-1, 0);
|
||||||
|
}
|
||||||
|
KeyStroke::Right => {
|
||||||
|
serial_println!("Right\n");
|
||||||
|
self.move_cursor(1, 0);
|
||||||
|
}
|
||||||
|
KeyStroke::Up => {
|
||||||
|
serial_println!("Up\n");
|
||||||
|
self.move_cursor(0, -1);
|
||||||
|
}
|
||||||
|
KeyStroke::Down => {
|
||||||
|
serial_println!("Down\n");
|
||||||
|
self.move_cursor(0, 1);
|
||||||
|
}
|
||||||
|
KeyStroke::None => {}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum Mode {
|
||||||
|
Nor,
|
||||||
|
Ins,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl core::fmt::Display for Mode {
|
||||||
|
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::Nor => write!(f, "Normal"),
|
||||||
|
Self::Ins => write!(f, "Insert"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
pub mod editor;
|
||||||
|
pub mod shell;
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
// use x86_64::registers::rflags::read;
|
// use x86_64::registers::rflags::read;
|
||||||
|
|
||||||
use crate::{drivers::io::ascii::clear_screen, prelude::stdin::read_line, print, println};
|
use crate::arch::x86_64::drivers::ascii::clear_screen;
|
||||||
|
use crate::prelude::*;
|
||||||
|
use crate::std::application::Application;
|
||||||
|
use crate::std::io::stdin::read_line;
|
||||||
|
use crate::util::editor::Editor;
|
||||||
|
use alloc::vec::Vec;
|
||||||
|
|
||||||
static FETCH: &str = "
|
static FETCH: &str = "
|
||||||
$$$$$$$$\\ $$\\
|
$$$$$$$$\\ $$\\
|
||||||
@@ -31,6 +36,10 @@ pub async fn shell() {
|
|||||||
"fetch" => {
|
"fetch" => {
|
||||||
println!("{}", FETCH);
|
println!("{}", FETCH);
|
||||||
}
|
}
|
||||||
|
"editor" => {
|
||||||
|
let mut editor = Editor::new();
|
||||||
|
editor.run(Vec::new()).await.unwrap();
|
||||||
|
}
|
||||||
"clear" => clear_screen(),
|
"clear" => clear_screen(),
|
||||||
_ => {
|
_ => {
|
||||||
println!("Unknown command: {}", line);
|
println!("Unknown command: {}", line);
|
||||||
@@ -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,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,3 +0,0 @@
|
|||||||
pub mod async_io;
|
|
||||||
pub mod io;
|
|
||||||
pub mod pic;
|
|
||||||
@@ -1,47 +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,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub type FoundryAllocator = linked_list_allocator::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;
|
|
||||||
@@ -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,26 +0,0 @@
|
|||||||
// use libm::include_font;
|
|
||||||
|
|
||||||
use libm::include_font;
|
|
||||||
|
|
||||||
pub mod ibm_vga_8x16;
|
|
||||||
|
|
||||||
pub static FONT_SPLEEN_8X16: Font =
|
|
||||||
Font::new(include_font!("./libk/resources/font/spleen-8x16.psf"));
|
|
||||||
|
|
||||||
pub static FONT_CP850_8X16: Font = Font::new(include_font!("./libk/resources/font/cp850-8x16.psf"));
|
|
||||||
|
|
||||||
pub struct Font {
|
|
||||||
pub glyphs: [[u8; 16]; 512],
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for Font {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::new([[0; 16]; 512])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Font {
|
|
||||||
pub const fn new(glyphs: [[u8; 16]; 512]) -> Self {
|
|
||||||
Self { glyphs }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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 +0,0 @@
|
|||||||
pub mod shell;
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[toolchain]
|
||||||
|
channel = "nightly"
|
||||||
|
targets = ["x86_64-linux-gnu"]
|
||||||
+20
-5
@@ -1,3 +1,4 @@
|
|||||||
|
#![feature(proc_macro_span)]
|
||||||
#![warn(
|
#![warn(
|
||||||
clippy::correctness,
|
clippy::correctness,
|
||||||
clippy::nursery,
|
clippy::nursery,
|
||||||
@@ -12,18 +13,32 @@
|
|||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{Read, Seek, SeekFrom};
|
use std::io::{Read, Seek, SeekFrom};
|
||||||
|
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::{Span, TokenStream};
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
|
use std::path::PathBuf;
|
||||||
use syn::{LitStr, parse_macro_input};
|
use syn::{LitStr, parse_macro_input};
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
#[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 {
|
pub fn include_font(item: TokenStream) -> TokenStream {
|
||||||
let filename = parse_macro_input!(item as LitStr);
|
let span = Span::call_site();
|
||||||
let file_path = filename.value();
|
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) {
|
let font_bytes = match load_file(file_path) {
|
||||||
Ok(bytes) => bytes,
|
Ok(bytes) => bytes,
|
||||||
|
|||||||
Reference in New Issue
Block a user