Skip to content

Instantly share code, notes, and snippets.

@0x61nas
0x61nas / RFLAGS.md
Last active February 6, 2024 16:52

RFlags is like a veritable junk drawer of disjointed little bits of information. RFlags as a whole is a single 64-bit register buried inside he CPU. It's the 64-bit extension of the 32-bit EFlags register, which in turn is the 32-bit extension of the 16-bit Flags register. There's only 18 bits of the RFlags register are actually flags. The reset is reserved for later use in future generations of Intel CPUs. A flag is a single bit of information, whose meaning is independent from any other bits. A bit can be set to 1 or clered to 0 by the CPU as its needs require.

I Shorthand Name Description
0 CF Carry Flag Used in assigned arithmetic operations. If the result of arithmetic or shift operation carries out a bit from the operand.
1 - Undefind -
2 PF Parity Flag Indecates whether the number of set (1) bits in the low-order byte of a result is even(set), or odd(cleard).
exit
break start
exit
n
i reg
i reg cl
i reg dh
exit
n
i reg eax
; MOV instruction
; Used to move a byte, word(16bit), double word(32bit), or quad word(64bit) from the source(second operand) to the dist(first operand).
; **Note** that the MOV instruction cannot move data directly from one address in memory to different address in memory
; to do that you need to _two separate MOV instructions: frst move the datat from the memory to some registry and then move it from that registry to the dist memory.
; Assemble with:
; nasm -f elf64 -g -F dwarf mov101.asm
; ld -o mov101 mov101.o
section .data
section .text
; Print a message out
; Aassmbl with:
; nasm -f elf64 -g -F stabs eatsyscall.asm
; ld -o eatsyscall eatsyscall.o
section .data
EatMsg: db "Eat at Joe's!", 10
EatLen: equ $-EatMsg
section .bss ; section containing the unintialized data
section .data
section .text
global .start
start:
; When you want to put the value 0 into a register, the fastest way is to use XOR.
; XORing a value againsnt it self yields 0.
xor rbx, rbx
; Yes, you could use `mov rbx, 0` instnad, but that has to go out to memory to load the immediate value 0
; XORing register against it self doesn't go out of the CPU for either the source or the destination, so its a little bit faster.
; Data stored inside CPU register called _register data_.
; and accessing register data directly is addressing mode called _register addressing_
section .data
section .text
global .start
start:
mov rbp, rsi ; 64-bit
mov ecx, edx ; 32-bit
@startuml
!theme sketchy-outline
skinparam participantFontSize 19
skinparam componentFontSize 19
skinparam activityArrowFontSize 19
skinparam actorFontSize 19
skinparam databaseFontSize 19
skinparam queueFontSize 19
title Sequence digram
{
"timeStamp": 1700742074307,
"version": "1.53.0",
"userSettings": {
"advancedUserEnabled": true,
"cloudStorageEnabled": true,
"externalLists": "https://raw.githubusercontent.com/LanikSJ/ubo-filters/main/filters/cdn-filter-list.txt\nhttps://raw.githubusercontent.com/LanikSJ/ubo-filters/main/filters/malware-domains.txt\nhttps://raw.githubusercontent.com/LanikSJ/ubo-filters/main/filters/popads-domains.txt\nhttps://raw.githubusercontent.com/LanikSJ/ubo-filters/main/filters/youtube-antiadblock.txt",
"firewallPaneMinimized": false,
"importedLists": [
"https://raw.githubusercontent.com/LanikSJ/ubo-filters/main/filters/cdn-filter-list.txt",
no-csp-reports: * true
no-large-media: behind-the-scene false
* ads-twitter.com * block
* audio-ak-spotify-com.akamaized.net * block
* doubleclick.net * block
* dscc.akamai.net * block
* a1520.dscc.akamai.net * block
* a297.dscc.akamai.net * block
* google-analytics.com * block
* googleoptimize.com * block
@0x61nas
0x61nas / justfile
Created November 16, 2023 00:42
Review papers in brain tumor detection
#!/usr/bin/env just --justfile
OUTDIR := "."
_main := "main.tex"
_pdf_prog := "zathura"
_compiler := "pdflatex"
_cflags := "-halt-on-error -output-directory=" + OUTDIR
alias w := whatch
alias c := compile