Added workflow?
This commit is contained in:
parent
1cf1bfeef9
commit
8bed1288ac
@ -9,4 +9,8 @@ trim_trailing_whitespace = false
|
||||
insert_final_newline = false
|
||||
|
||||
[*.asm]
|
||||
indent_style = space
|
||||
indent_style = space
|
||||
|
||||
[*.yml]
|
||||
indent_size = space
|
||||
indent_size = 2
|
56
.gitea/workflows/ci.yml
Normal file
56
.gitea/workflows/ci.yml
Normal file
@ -0,0 +1,56 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
typos:
|
||||
name: "Typos"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Check typos
|
||||
uses: crate-ci/typos@master
|
||||
with:
|
||||
config: ./typos.toml
|
||||
|
||||
clippy:
|
||||
name: "Clippy"
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: "Install Rust"
|
||||
run: |
|
||||
sudo apt update
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
sudo apt install --yes \
|
||||
rustup
|
||||
|
||||
- name: Run clippy
|
||||
working-directory: ./tetros
|
||||
run: cargo clippy --all-targets --all-features
|
||||
|
||||
build:
|
||||
name: "Build"
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: "Install Rust"
|
||||
run: |
|
||||
sudo apt update
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
sudo apt install --yes \
|
||||
rustup
|
||||
|
||||
- name: Build
|
||||
run: make
|
@ -1,6 +1,6 @@
|
||||
SECTION .text ; cannot use .data
|
||||
|
||||
struc GDTEntry
|
||||
struc GDTEntry ; spell:disable:line
|
||||
.limitl resw 1
|
||||
.basel resw 1
|
||||
.basem resb 1
|
||||
@ -26,21 +26,21 @@ gdt_attr:
|
||||
.accessed equ 1 << 0
|
||||
;system
|
||||
; legacy
|
||||
.tssAvailabe16 equ 0x1
|
||||
.tssAvailabe16 equ 0x1 ; spell:disable:line
|
||||
.ldt equ 0x2
|
||||
.tssBusy16 equ 0x3
|
||||
.call16 equ 0x4
|
||||
.task equ 0x5
|
||||
.interrupt16 equ 0x6
|
||||
.trap16 equ 0x7
|
||||
.tssAvailabe32 equ 0x9
|
||||
.tssAvailabe32 equ 0x9 ; spell:disable:line
|
||||
.tssBusy32 equ 0xB
|
||||
.call32 equ 0xC
|
||||
.interrupt32 equ 0xE
|
||||
.trap32 equ 0xF
|
||||
; long mode
|
||||
.ldt32 equ 0x2
|
||||
.tssAvailabe64 equ 0x9
|
||||
.tssAvailabe64 equ 0x9 ; spell:disable:line
|
||||
.tssBusy64 equ 0xB
|
||||
.call64 equ 0xC
|
||||
.interrupt64 equ 0xE
|
||||
|
@ -61,6 +61,7 @@ impl<T> fmt::Debug for Entry<T> {
|
||||
}
|
||||
}
|
||||
|
||||
// spell:off
|
||||
impl<F> Entry<F> {
|
||||
/// Create a valid non-present IDT entry.
|
||||
#[inline]
|
||||
@ -111,7 +112,9 @@ impl<F> Entry<F> {
|
||||
))
|
||||
}
|
||||
}
|
||||
// spell:on
|
||||
|
||||
// spell:off
|
||||
impl<F: HandlerFuncType> Entry<F> {
|
||||
/// Sets the handler address for the IDT entry and sets the following defaults:
|
||||
/// - The code selector is the code segment currently active in the CPU
|
||||
@ -125,3 +128,4 @@ impl<F: HandlerFuncType> Entry<F> {
|
||||
unsafe { self.set_handler_addr(handler.to_virt_addr()) }
|
||||
}
|
||||
}
|
||||
// spell:on
|
||||
|
@ -50,9 +50,9 @@ bitflags! {
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// MARK: types
|
||||
///
|
||||
//
|
||||
// MARK: types
|
||||
//
|
||||
|
||||
/// A handler function for an interrupt or an exception without error code.
|
||||
pub type HandlerFunc = extern "x86-interrupt" fn(InterruptStackFrame);
|
||||
@ -84,6 +84,7 @@ pub unsafe trait HandlerFuncType {
|
||||
unsafe impl HandlerFuncType for HandlerFunc {
|
||||
#[inline]
|
||||
fn to_virt_addr(self) -> VirtAddr {
|
||||
#[allow(clippy::fn_to_numeric_cast_with_truncation)]
|
||||
VirtAddr::new(self as u32)
|
||||
}
|
||||
}
|
||||
@ -91,6 +92,7 @@ unsafe impl HandlerFuncType for HandlerFunc {
|
||||
unsafe impl HandlerFuncType for HandlerFuncWithErrCode {
|
||||
#[inline]
|
||||
fn to_virt_addr(self) -> VirtAddr {
|
||||
#[allow(clippy::fn_to_numeric_cast_with_truncation)]
|
||||
VirtAddr::new(self as u32)
|
||||
}
|
||||
}
|
||||
@ -98,6 +100,7 @@ unsafe impl HandlerFuncType for HandlerFuncWithErrCode {
|
||||
unsafe impl HandlerFuncType for DivergingHandlerFunc {
|
||||
#[inline]
|
||||
fn to_virt_addr(self) -> VirtAddr {
|
||||
#[allow(clippy::fn_to_numeric_cast_with_truncation)]
|
||||
VirtAddr::new(self as u32)
|
||||
}
|
||||
}
|
||||
@ -105,6 +108,7 @@ unsafe impl HandlerFuncType for DivergingHandlerFunc {
|
||||
unsafe impl HandlerFuncType for DivergingHandlerFuncWithErrCode {
|
||||
#[inline]
|
||||
fn to_virt_addr(self) -> VirtAddr {
|
||||
#[allow(clippy::fn_to_numeric_cast_with_truncation)]
|
||||
VirtAddr::new(self as u32)
|
||||
}
|
||||
}
|
||||
@ -112,6 +116,7 @@ unsafe impl HandlerFuncType for DivergingHandlerFuncWithErrCode {
|
||||
unsafe impl HandlerFuncType for PageFaultHandlerFunc {
|
||||
#[inline]
|
||||
fn to_virt_addr(self) -> VirtAddr {
|
||||
#[allow(clippy::fn_to_numeric_cast_with_truncation)]
|
||||
VirtAddr::new(self as u32)
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ use super::{
|
||||
|
||||
// TODO: comments
|
||||
#[repr(C, packed(2))]
|
||||
struct IDTR {
|
||||
struct Idtr {
|
||||
size: u16,
|
||||
offset: u32,
|
||||
}
|
||||
@ -16,6 +16,7 @@ struct IDTR {
|
||||
// MARK: idt
|
||||
//
|
||||
|
||||
// spell:off
|
||||
#[derive(Clone, Debug)]
|
||||
#[repr(C)]
|
||||
#[repr(align(8))]
|
||||
@ -410,6 +411,7 @@ pub struct InterruptDescriptorTable {
|
||||
/// instruction pointer points to the instruction after the INTn.
|
||||
interrupts: [Entry<HandlerFunc>; 256 - 32],
|
||||
}
|
||||
// spell:on
|
||||
|
||||
//
|
||||
// MARK: impl
|
||||
@ -469,7 +471,7 @@ impl InterruptDescriptorTable {
|
||||
#[inline]
|
||||
pub unsafe fn load_unsafe(&self) {
|
||||
let idtr = {
|
||||
IDTR {
|
||||
Idtr {
|
||||
size: (size_of::<InterruptDescriptorTable>() - 1) as u16,
|
||||
offset: self as *const _ as u32,
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ pub fn rust_begin_unwind(info: &PanicInfo<'_>) -> ! {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[no_mangle]
|
||||
/// Required to handle panics
|
||||
pub extern "C" fn _Unwind_Resume() -> ! {
|
||||
|
@ -2,7 +2,6 @@ use core::ptr;
|
||||
|
||||
use super::THUNK_STACK_ADDR;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[repr(C, packed)]
|
||||
pub struct ThunkData {
|
||||
|
8
typos.toml
Normal file
8
typos.toml
Normal file
@ -0,0 +1,8 @@
|
||||
[default]
|
||||
extend-ignore-re = [
|
||||
# spell:disable-line
|
||||
"(?Rm)^.*(%|#|//|;)\\s*spell:disable-line$",
|
||||
|
||||
# spell:<on|off>
|
||||
"(?s)(%|#|//|;)\\s*spell:off.*?\\n\\s*(%|#|//)\\s*spell:on",
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user