This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; | |
; 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. | |
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 { |