first commit

This commit is contained in:
Ole Algoritme
2022-09-05 21:52:22 +02:00
commit 698a8f7487
198 changed files with 951446 additions and 0 deletions

11
no_deps_version/Makefile Normal file
View File

@@ -0,0 +1,11 @@
all:
gcc -c gddr6_asm.s -o gddr6_asm.o
gcc gddr6_asm.o -o gddr6_asm
gcc -c gddr6.c -o gddr6.o
gcc gddr6.o -o gddr6
clean:
rm -f *.o
rm -f gddr6_asm gddr6

BIN
no_deps_version/gddr6 Executable file

Binary file not shown.

56
no_deps_version/gddr6.c Normal file
View File

@@ -0,0 +1,56 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
int main(int argc, char **argv)
{
int fd;
int map_size = 4096UL;
void *map_base, *virt_addr;
uint32_t read_result, base_offset, temp;
uint32_t bar = 0xFB000000;
uint32_t offset = bar + 0x0000E2A8; // GA102
//uint32_t offset = bar + 0x0000EE50; // GA104
char *MEM_RES = "\x2f\x64\x65\x76\x2f\x6d\x65\x6d";
while (1)
{
if ((fd = open(MEM_RES, O_RDWR | O_SYNC)) == -1)
{
printf("Can't read memory. Are you r00t?\n");
exit(-1);
}
base_offset = offset & ~(sysconf(_SC_PAGE_SIZE)-1);
map_base = mmap(0, map_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, base_offset);
if (!map_base)
{
printf("Can't map memory. Are you r00t?\n");
exit(-1);
}
virt_addr = map_base + offset - base_offset;
read_result = *((uint32_t *) virt_addr);
temp = (read_result & 0x00000fff) / 0x20;
printf("\rGDDR6X VRAM Temp: %d°c", temp);
fflush(stdout);
if (munmap(map_base, map_size) == -1)
{
printf("Can't unmap memory!\n");
exit(-1);
}
close(fd);
sleep(1);
}
return 0;
}

BIN
no_deps_version/gddr6.o Normal file

Binary file not shown.

BIN
no_deps_version/gddr6_asm Executable file

Binary file not shown.

BIN
no_deps_version/gddr6_asm.o Normal file

Binary file not shown.

127
no_deps_version/gddr6_asm.s Normal file
View File

@@ -0,0 +1,127 @@
.file "gddr6.s"
.text
.section .rodata
.LC0:
.string "/dev/mem"
.LC1:
.string "\rGDDR6 VRAM Temp: %d\302\260c"
.text
.globl main
.type main, @function
main:
.LFB6:
.cfi_startproc
endbr64
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $80, %rsp
movl %edi, -68(%rbp)
movq %rsi, -80(%rbp)
movl $4096, -56(%rbp)
movl $-83886080, -52(%rbp)
movl -52(%rbp), %eax
addl $58024, %eax
movl %eax, -48(%rbp)
leaq .LC0(%rip), %rax
movq %rax, -24(%rbp)
.L5:
movq -24(%rbp), %rax
movl $1052674, %esi
movq %rax, %rdi
movl $0, %eax
call open@PLT
movl %eax, -44(%rbp)
cmpl $-1, -44(%rbp)
jne .L2
movl $-1, %edi
call exit@PLT
.L2:
movl $30, %edi
call sysconf@PLT
subl $1, %eax
notl %eax
movl %eax, %edx
movl -48(%rbp), %eax
andl %edx, %eax
movl %eax, -40(%rbp)
movl -40(%rbp), %ecx
movl -56(%rbp), %eax
cltq
movl -44(%rbp), %edx
movq %rcx, %r9
movl %edx, %r8d
movl $1, %ecx
movl $3, %edx
movq %rax, %rsi
movl $0, %edi
call mmap@PLT
movq %rax, -16(%rbp)
cmpq $0, -16(%rbp)
jne .L3
movl $-1, %edi
call exit@PLT
.L3:
movl -48(%rbp), %edx
movl -40(%rbp), %eax
subq %rax, %rdx
movq -16(%rbp), %rax
addq %rdx, %rax
movq %rax, -8(%rbp)
movq -8(%rbp), %rax
movl (%rax), %eax
movl %eax, -36(%rbp)
movl -36(%rbp), %eax
andl $4095, %eax
movl %eax, -32(%rbp)
movl -32(%rbp), %eax
shrl $5, %eax
movl %eax, -28(%rbp)
movl -28(%rbp), %eax
movl %eax, %esi
leaq .LC1(%rip), %rdi
movl $0, %eax
call printf@PLT
movq stdout(%rip), %rax
movq %rax, %rdi
call fflush@PLT
movl -56(%rbp), %eax
movslq %eax, %rdx
movq -16(%rbp), %rax
movq %rdx, %rsi
movq %rax, %rdi
call munmap@PLT
cmpl $-1, %eax
jne .L4
movl $-1, %edi
call exit@PLT
.L4:
movl -44(%rbp), %eax
movl %eax, %edi
call close@PLT
movl $1, %edi
call sleep@PLT
jmp .L5
.cfi_endproc
.LFE6:
.size main, .-main
.ident "GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4: