Initial commit

Signed-off-by: Jolan Rathelot <jrathelo@student.42nice.fr>
This commit is contained in:
Jolan Rathelot 2024-03-04 16:42:01 +01:00
commit b20836700d
9 changed files with 13654 additions and 0 deletions

14
.gitignore vendored Normal file
View 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
View 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&#10;#&#10;# Kbuild template, feel free to customize.&#10;#&#10;[ -f .config ] || &quot;${MAKE:-make}&quot; 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
View 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
View 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">{
&quot;useNewFormat&quot;: 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">{
&quot;associatedIndex&quot;: 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">{
&quot;keyToString&quot;: {
&quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
&quot;ASKED_SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.cidr.known.project.marker&quot;: &quot;true&quot;,
&quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
&quot;cf.first.check.clang-format&quot;: &quot;false&quot;,
&quot;cidr.known.project.marker&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;master&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;org.rust.cargo.project.model.PROJECT_DISCOVERY&quot;: &quot;true&quot;,
&quot;org.rust.hideNoCargoProjectNotifications/root/drivers-and-interrupts/src/main.rs&quot;: &quot;true&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;CMakeSettings&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
}
}</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
View 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
View 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

1
README.md Normal file
View File

@ -0,0 +1 @@
# Drivers_and_interrupts

13420
rust-project.json Normal file

File diff suppressed because it is too large Load Diff

28
src/lib.rs Normal file
View 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)")
}
}