Skip to content

Instantly share code, notes, and snippets.

View R077A6r1an's full-sized avatar

R077A6r1an R077A6r1an

View GitHub Profile
@R077A6r1an
R077A6r1an / Kernel.c
Last active August 13, 2023 00:13
A tutorial for a minimal x86_32 operating system kernel #kernel #osdev #tutorial
// First, a minimal stdint.h
typedef __UINT32_TYPE__ uint32_t;
typedef __UINT64_TYPE__ uint64_t;
// NOTE: as kernel, we dont have any stdlib, so if you want to use one, implement one your self, and link it static!
// the multiboot info structure ( all we get by the multiboot bootloader )
struct multiboot_info {
@carlosascari
carlosascari / int32.s
Created October 6, 2017 02:36
BIOS Calls in Protected Mode by Napalm
;
; Protected Mode BIOS Call Functionailty v2.0 - by Napalm
; -------------------------------------------------------
;
; This is code shows how its POSSIBLE to execute BIOS interrupts
; by switch out to real-mode and then back into protected mode.
;
; If you wish to use all or part of this code you must agree
; to the license at the following URL.
;
@aprell
aprell / va_nargs.c
Last active March 9, 2024 08:44
Counting arguments in variadic macros
// RUN: cc -Wall -Wextra %s && ./a.out
#include <assert.h>
#if defined(__GNUC__) || defined(__clang__)
// Supports 0-10 arguments
#define VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
// ## deletes preceding comma if _VA_ARGS__ is empty (GCC, Clang)
#define VA_NARGS(...) VA_NARGS_IMPL(_, ## __VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
#else