This file contains hidden or 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
#include <stdint.h> | |
//! Byte swap unsigned short | |
uint16_t swap_uint16( uint16_t val ) | |
{ | |
return (val << 8) | (val >> 8 ); | |
} | |
//! Byte swap short | |
int16_t swap_int16( int16_t val ) |
This file contains hidden or 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
#include <stdio.h> | |
#include <dlfcn.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <libelf.h> | |
#include <sys/stat.h> | |
#include <sys/mman.h> | |
char* buffer; | |
static struct stat fileinfo; |
This file contains hidden or 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
[Unit] | |
Description=Minecraft Server: %i | |
After=network.target | |
[Service] | |
Type=simple | |
WorkingDirectory=/srv/minecraft/instances/%i | |
Environment="ServerArgs=" | |
Environment="ServerName=minecraft_server.jar" |
This file contains hidden or 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
org 100h | |
bits 16 | |
section .text | |
global __start | |
jmp __start | |
Unsupported db 'This application requires at least an 80386 processor.', 0x0d, 0x0a, '$' ; $-terminated message | |
AlreadyInit db 'Already in Protected Mode!', 0x0d, 0x0a, '$' ; $-terminated message | |
A20LineFail db 'A20 Line is Disabled or Not Present.', 0x0d, 0x0a, '$' ; $-terminated message |
This file contains hidden or 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
org 0x100 | |
start: use16 | |
cli ; disable interrupts | |
in al, 0x92 ; IO port method to enable A20 | |
or al, 2 | |
and al,0xFE | |
out 0x92, al | |
lgdt [descriptor] ; load GDT header into GDT register, so the CPU can find the GDT entries |
This file contains hidden or 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
;--- | |
; Giza system bootstrap | |
; - check for a supported CPU, exit with error message if unsupported | |
; - Enter Protected Mode | |
; - Call system bootstrap | |
; - Leave Protected Mode | |
; - exit (status = byte obtatained) | |
; | |
Unsupported db "CPU: Not an 80386-class CPU; unable to start",0Dh,0Ah,'$' |
This file contains hidden or 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
const MyComponent = { | |
PostOffice: { | |
PaymentAuthorization: { | |
fromEcho: true, | |
isPublic: false | |
}, | |
"Foo": "Bar", | |
}, |
This file contains hidden or 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
/usr/bin/ld.bfd: /tmp/main-12cd4f.o: in function `main': | |
main.c:(.text+0x20): undefined reference to `_GLOBAL_OFFSET_TABLE_' | |
/usr/bin/ld.bfd: ../lib/libdos.a(doscrt0.o): in function `argstart': | |
doscrt0.c:(.text+0x1b): undefined reference to `_GLOBAL_OFFSET_TABLE_' | |
/usr/bin/ld.bfd: ../lib/libdos.a(conio.o): in function `_getcinfo': | |
conio.c:(.text+0xf): undefined reference to `_GLOBAL_OFFSET_TABLE_' | |
/usr/bin/ld.bfd: ../lib/libdos.a(conio.o): in function `setpage': | |
conio.c:(.text+0x56): undefined reference to `_GLOBAL_OFFSET_TABLE_' | |
/usr/bin/ld.bfd: ../lib/libdos.a(conio.o): in function `getpage': | |
conio.c:(.text+0xa6): undefined reference to `_GLOBAL_OFFSET_TABLE_' |
This file contains hidden or 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
$ clang -nostdlib -fno-{stack-protector,jump-tables,addrsig,builtin} -ffreestanding -I../include -oexample.com -Wall \ | |
-Wextra -pedantic -mregparm=3 -std=c99 -Oz -m16 -march=i386 -Wl,--omagic,--script=../lib/doscom.ld -fuse-ld=bfd main.c \ | |
../lib/libdos.a | |
/usr/bin/ld.bfd: /tmp/main-de9979.o: in function `main': | |
main.c:(.text+0x20): undefined reference to `_GLOBAL_OFFSET_TABLE_' | |
/usr/bin/ld.bfd: ../lib/libdos.a(doscrt0.o): in function `argstart': | |
doscrt0.c:(.text+0x1b): undefined reference to `_GLOBAL_OFFSET_TABLE_' | |
/usr/bin/ld.bfd: ../lib/libdos.a(conio.o): in function `_getcinfo': | |
conio.c:(.text+0xf): undefined reference to `_GLOBAL_OFFSET_TABLE_' | |
/usr/bin/ld.bfd: ../lib/libdos.a(conio.o): in function `setpage': |
This file contains hidden or 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
#define _GNU_SOURCE | |
#define STATIC_DECLARE_INIT(sym, name, id, ...) \ | |
sym __attribute__ ((section (id))) name = { __VA_ARGS__ }; | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <stdbool.h> |