There are many tutorials on the web that explain how to build a simple "Hello, World" in C without the use of libc
on AMD64, but most of them stop there.
This guide hopes to provide a more complete explanation that will allow you to build yourself a small framework to write more complex programs. The code will support both AMD64, and i386.
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 WRITE 1 | |
#define STDOUT 1 | |
#define EXIT 60 | |
#define EXIT_SUCCESS 0 |
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 <stdlib.h> | |
/** | |
* Checking whether a number is even or odd, | |
* | |
* A base ten '2' is equal to a base-two '0010'. | |
* When using a bitwise 'and' on the numbers '0001' | |
* and '0010' there are no matching digits, meaning | |
* a return of only zeros. |
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/env bash | |
# Add your JVM Args here. | |
declare -r LUNAR_JVM_ARGS="\ | |
--add-modules jdk.naming.dns \ | |
--add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming \ | |
-Djna.boot.library.path=natives \ | |
-Dlog4j2.formatMsgNoLookups=true \ | |
--add-opens java.base/java.io=ALL-UNNAMED \ | |
-Xms3072m \ |
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
bits 64 | |
section .text | |
global _start | |
_start: | |
push NUM_FORKS | |
.loop: | |
mov rax, SYS_FORK ; Moving '57' into 'rax', syscall for 'stub_fork()'. |
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> | |
void swap(int* a, int* b) | |
{ | |
int temp = *a; | |
*a = *b; | |
*b = temp; | |
} | |
int partition(int arr[], int low, int high) |