Initial commit
Signed-off-by: Jolan Rathelot <jrathelo@student.42nice.fr>
This commit is contained in:
commit
b20836700d
14
.gitignore
vendored
Normal file
14
.gitignore
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
*.o.cmd
|
||||||
|
*.ko.cmd
|
||||||
|
*.symvers.cmd
|
||||||
|
*.order.cmd
|
||||||
|
*.mod
|
||||||
|
*.mod.c
|
||||||
|
*.mod.cmd
|
||||||
|
*.mod.order
|
||||||
|
*.ko
|
||||||
|
*.o
|
||||||
|
*.symvers
|
||||||
|
*.order
|
||||||
|
|
||||||
|
*.tmp*
|
17
.idea/misc.xml
generated
Normal file
17
.idea/misc.xml
generated
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MakefileSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<MakefileProjectSettings>
|
||||||
|
<option name="buildOptions" value="--makefile=Makefile" />
|
||||||
|
<option name="buildSystemName" value="Kbuild" />
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="preConfigureCommands" value="#!/bin/sh # # Kbuild template, feel free to customize. # [ -f .config ] || "${MAKE:-make}" defconfig" />
|
||||||
|
<option name="switches" value="--makefile=Makefile V=1" />
|
||||||
|
<option name="version" value="2" />
|
||||||
|
</MakefileProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="MakefileWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||||
|
</project>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
144
.idea/workspace.xml
generated
Normal file
144
.idea/workspace.xml
generated
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AutoImportSettings">
|
||||||
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
|
</component>
|
||||||
|
<component name="CMakePresetLoader">{
|
||||||
|
"useNewFormat": true
|
||||||
|
}</component>
|
||||||
|
<component name="CMakeReloadState">
|
||||||
|
<option name="reloaded" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="CMakeRunConfigurationManager">
|
||||||
|
<generated />
|
||||||
|
</component>
|
||||||
|
<component name="CMakeSettings">
|
||||||
|
<configurations />
|
||||||
|
</component>
|
||||||
|
<component name="ChangeListManager">
|
||||||
|
<list default="true" id="2686ebbf-1c6c-4484-bb57-dec59a208d53" name="Changes" comment="" />
|
||||||
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
|
</component>
|
||||||
|
<component name="ClangdSettings">
|
||||||
|
<option name="formatViaClangd" value="false" />
|
||||||
|
</component>
|
||||||
|
<component name="Git.Settings">
|
||||||
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
|
</component>
|
||||||
|
<component name="MacroExpansionManager">
|
||||||
|
<option name="directoryName" value="5020vg1s" />
|
||||||
|
</component>
|
||||||
|
<component name="MakefileLocalSettings">
|
||||||
|
<option name="projectSyncType">
|
||||||
|
<map>
|
||||||
|
<entry key="$PROJECT_DIR$" value="RE_IMPORT" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="MarkdownSettingsMigration">
|
||||||
|
<option name="stateVersion" value="1" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectApplicationVersion">
|
||||||
|
<option name="ide" value="CLion" />
|
||||||
|
<option name="majorVersion" value="2023" />
|
||||||
|
<option name="minorVersion" value="2.2" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectColorInfo">{
|
||||||
|
"associatedIndex": 6
|
||||||
|
}</component>
|
||||||
|
<component name="ProjectId" id="2Z5tUgyrpsVuUm14pA98mjmx6Qr" />
|
||||||
|
<component name="ProjectLevelVcsManager">
|
||||||
|
<ConfirmationsSetting value="1" id="Add" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectViewState">
|
||||||
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
|
<option name="showLibraryContents" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PropertiesComponent">{
|
||||||
|
"keyToString": {
|
||||||
|
"ASKED_ADD_EXTERNAL_FILES": "true",
|
||||||
|
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
|
"RunOnceActivity.cidr.known.project.marker": "true",
|
||||||
|
"WebServerToolWindowFactoryState": "false",
|
||||||
|
"cf.first.check.clang-format": "false",
|
||||||
|
"cidr.known.project.marker": "true",
|
||||||
|
"git-widget-placeholder": "master",
|
||||||
|
"node.js.detected.package.eslint": "true",
|
||||||
|
"node.js.detected.package.tslint": "true",
|
||||||
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
|
"nodejs_package_manager_path": "npm",
|
||||||
|
"org.rust.cargo.project.model.PROJECT_DISCOVERY": "true",
|
||||||
|
"org.rust.hideNoCargoProjectNotifications/root/drivers-and-interrupts/src/main.rs": "true",
|
||||||
|
"settings.editor.selected.configurable": "CMakeSettings",
|
||||||
|
"vue.rearranger.settings.migration": "true"
|
||||||
|
}
|
||||||
|
}</component>
|
||||||
|
<component name="RdControllerToolWindowsLayoutState" isNewUi="true">
|
||||||
|
<layout>
|
||||||
|
<window_info id="Space Code Reviews" />
|
||||||
|
<window_info id="Bookmarks" side_tool="true" />
|
||||||
|
<window_info id="Merge Requests" />
|
||||||
|
<window_info id="Commit_Guest" />
|
||||||
|
<window_info id="Pull Requests" />
|
||||||
|
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.14206561" />
|
||||||
|
<window_info id="Commit" order="1" weight="0.25" />
|
||||||
|
<window_info id="Structure" order="2" side_tool="true" weight="0.25" />
|
||||||
|
<window_info anchor="bottom" id="CMake" weight="0.22384511" />
|
||||||
|
<window_info anchor="bottom" id="Database Changes" />
|
||||||
|
<window_info anchor="bottom" id="TypeScript" />
|
||||||
|
<window_info anchor="bottom" id="Build" weight="0.32982337" />
|
||||||
|
<window_info anchor="bottom" id="Python Packages" />
|
||||||
|
<window_info anchor="bottom" id="TODO" />
|
||||||
|
<window_info anchor="bottom" id="File Transfer" />
|
||||||
|
<window_info anchor="bottom" id="Vcpkg" />
|
||||||
|
<window_info anchor="bottom" id="clangd" />
|
||||||
|
<window_info anchor="bottom" id="Version Control" order="0" />
|
||||||
|
<window_info anchor="bottom" id="Problems View" order="1" />
|
||||||
|
<window_info active="true" anchor="bottom" id="Terminal" order="2" visible="true" weight="0.32982337" />
|
||||||
|
<window_info anchor="bottom" id="Services" order="3" weight="0.22384511" />
|
||||||
|
<window_info anchor="right" id="make" side_tool="true" />
|
||||||
|
<window_info anchor="right" id="Meet New UI" side_tool="true" />
|
||||||
|
<window_info anchor="right" content_ui="combo" id="Notifications" order="0" weight="0.25" />
|
||||||
|
<window_info anchor="right" id="Database" order="1" weight="0.25" />
|
||||||
|
</layout>
|
||||||
|
</component>
|
||||||
|
<component name="RustProjectSettings">
|
||||||
|
<option name="toolchainHomeDirectory" value="$PROJECT_DIR$/../.cargo/bin" />
|
||||||
|
</component>
|
||||||
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||||
|
<component name="TaskManager">
|
||||||
|
<task active="true" id="Default" summary="Default task">
|
||||||
|
<changelist id="2686ebbf-1c6c-4484-bb57-dec59a208d53" name="Changes" comment="" />
|
||||||
|
<created>1701723786817</created>
|
||||||
|
<option name="number" value="Default" />
|
||||||
|
<option name="presentableId" value="Default" />
|
||||||
|
<updated>1701723786817</updated>
|
||||||
|
<workItem from="1701723788674" duration="248000" />
|
||||||
|
<workItem from="1701724067142" duration="75000" />
|
||||||
|
<workItem from="1701724149106" duration="88000" />
|
||||||
|
<workItem from="1701724251213" duration="880000" />
|
||||||
|
<workItem from="1701777445625" duration="1698000" />
|
||||||
|
<workItem from="1709558648771" duration="601000" />
|
||||||
|
</task>
|
||||||
|
<servers />
|
||||||
|
</component>
|
||||||
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
|
<option name="version" value="3" />
|
||||||
|
</component>
|
||||||
|
<component name="VCPKGProject">
|
||||||
|
<isAutomaticEditVcpkgJson value="false" />
|
||||||
|
<isAutomaticCheckingOnLaunch value="false" />
|
||||||
|
<isAutomaticFoundErrors value="true" />
|
||||||
|
<isAutomaticFoundErrors value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="XSLT-Support.FileAssociations.UIState">
|
||||||
|
<expand />
|
||||||
|
<select />
|
||||||
|
</component>
|
||||||
|
</project>
|
4
Kbuild
Normal file
4
Kbuild
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
|
obj-m := driver_and_interrupts.o
|
||||||
|
driver_and_interrupts-y := src/lib.o
|
20
Makefile
Normal file
20
Makefile
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
KDIR ?= /lib/modules/`uname -r`/build
|
||||||
|
|
||||||
|
all: driver_and_interrupts.ko
|
||||||
|
|
||||||
|
driver_and_interrupts.ko: src/lib.rs
|
||||||
|
$(MAKE) -C $(KDIR) M=$$PWD LLVM=1
|
||||||
|
|
||||||
|
modules_install:
|
||||||
|
$(MAKE) -C $(KDIR) M=$$PWD LLVM=1 modules_install
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(MAKE) -C $(KDIR) M=$$PWD LLVM=1 clean
|
||||||
|
|
||||||
|
insmod:
|
||||||
|
insmod driver_and_interrupts.ko
|
||||||
|
|
||||||
|
rmmod:
|
||||||
|
rmmod driver_and_interrupts
|
||||||
|
|
||||||
|
.PHONY: all clean modules_install rmmod insmod
|
13420
rust-project.json
Normal file
13420
rust-project.json
Normal file
File diff suppressed because it is too large
Load Diff
28
src/lib.rs
Normal file
28
src/lib.rs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#![allow(unused_imports)]
|
||||||
|
#![allow(missing_docs)]
|
||||||
|
|
||||||
|
use kernel::prelude::*;
|
||||||
|
|
||||||
|
module! {
|
||||||
|
type: DriverAndInterrupts,
|
||||||
|
name: "driver_and_interrupts",
|
||||||
|
author: "Jolan Rathelot <jrathelo@student.42nice.fr>",
|
||||||
|
description: "driver_and_interrupts 42 project",
|
||||||
|
license: "GPL",
|
||||||
|
}
|
||||||
|
|
||||||
|
struct DriverAndInterrupts { }
|
||||||
|
|
||||||
|
impl kernel::Module for DriverAndInterrupts {
|
||||||
|
fn init(_module: &'static ThisModule) -> Result<Self> {
|
||||||
|
pr_info!("Drivers and Interrupts (Init)");
|
||||||
|
|
||||||
|
Ok(DriverAndInterrupts {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drop for DriverAndInterrupts {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
pr_info!("Drivers and Interrupts (exit)")
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user