Skip to content

Instantly share code, notes, and snippets.

View FedorLap2006's full-sized avatar

Fedor Lapshin FedorLap2006

View GitHub Profile
@FedorLap2006
FedorLap2006 / pic.c
Last active August 27, 2023 04:18
x86 customizable PIC handler
#include "pic.h" // Replace with an actual header
#define PIC_PRIMARY_CMD_PORT 0x20
#define PIC_SECONDARY_CMD_PORT 0x20
#define PIC_PRIMARY_DATA_PORT 0x21
#define PIC_SECONDARY_DATA_PORT 0xA1
static void pic_iowait() { __asm__ volatile("outb %%al, $0x80" : : "a"(0)); }
struct pic_config current_pic_config;
@FedorLap2006
FedorLap2006 / process_wikipedia.py
Created July 15, 2020 00:50 — forked from snakers4/process_wikipedia.py
Post process wikipedia files produced by wikiextractor
import os
import re
import sys
import glob
import nltk
import gensim
import numpy as np
import pandas as pd
from tqdm import tqdm
from uuid import uuid4

Source: man syscall

Architecture calling conventions

Every architecture has its own way of invoking and passing arguments to the kernel. The details for various architectures are listed in the two tables below.

The first table lists the instruction used to transition to kernel mode, (which might not be the fastest or best way to transition to

@FedorLap2006
FedorLap2006 / cpastd.c
Last active May 22, 2020 23:36
Pascal stdlib implementation for c
#include "cpastd.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
@FedorLap2006
FedorLap2006 / kgsys_docs.html
Created October 7, 2019 11:51
KGSytem Documentation
<!DOCTYPE html><html><head><meta charset="utf-8"><title>KGSystem.md</title><style>@charset "UTF-8";@import 'https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.9.0-alpha2/katex.min.css';code{color:#c7254e;background-color:#f9f2f4;border-radius:4px}code,kbd{padding:2px 4px}kbd{color:#fff;background-color:#333;border-radius:3px;box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;box-shadow:none}pre{display:block;margin:0 0 10px;word-break:break-all;word-wrap:break-word;color:#333;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}table{background-color:transparent}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>thead>tr>th{padding:8px;line-height:1.4285714;border-top:1px solid #ddd}.table>thead>tr>td,.table>tbody>tr>th,.table>tbody>tr>td,.table>tfoot>tr>th,.table>tfoot>tr>td{padding:8p
@FedorLap2006
FedorLap2006 / console.txt
Created June 11, 2019 10:00
DepthOS heap
└─< (master|MERGING)* >──» qemu-system-i386 -M pc-i440fx-2.8 -kernel DepthOS-1.0 -s -serial stdio -monitor none -append 'console=ttyS0'
[HEAP] heap info -
{.beg = 0x11c100, .magic = 2037504287, .cur = 0x11c100, .last = 0x11c100, .end = 0x11c164}
[HEAP] ALLOC cur chunk - at 0x11c000 ( mem - 0x11c100 )
{.size = 5, .magic = 2037504287, .used = 1, .next = 0x11c206}
[HEAP] heap info -
{.beg = 0x11c100, .magic = 2037504287, .cur = 0x11c206, .last = 0x11c100, .end = 0x11c164}
[HEAP] ALLOC cur chunk - at 0x11c106 ( mem - 0x11c206 )
{.size = 0, .magic = 0, .used = 0, .next = 0x100}
0x11c100 - hello
http://www.osdever.net/tutorials/view/implementing-basic-paging
@FedorLap2006
FedorLap2006 / exec_bin.asm
Last active May 4, 2019 17:02
execute binary command ( OSDev )
CS_ADDR equ 0x0 ; change this variable to your code ( this is code segment addr -- cs )
C_COUNTER equ 0x0 ; change this variable to your code ( this is next cpu command addr -- eip )
mov cs,SEC_ADDR
mov eip,COM_COUNTER
;------- or ---------
push eax
push edx