gddr6x temp reading rtx 4090

This commit is contained in:
Ole Algoritme
2022-11-27 05:53:00 +01:00
parent 01b3926703
commit 58e52f4125
2 changed files with 19 additions and 17 deletions

View File

@@ -7,21 +7,23 @@
#include <fcntl.h>
#include <sys/mman.h>
int main(int argc, char **argv)
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 bar = 0xFB000000; // GA102 + GA104
uint32_t bar = 0xEC000000; // AD102 (RTX 4090)
uint32_t offset = bar + 0x0000E2A8; // GA102 + AD102
//uint32_t offset = bar + 0x0000EE50; // GA104
char *MEM_RES = "\x2f\x64\x65\x76\x2f\x6d\x65\x6d";
while (1)
while (1)
{
if ((fd = open(MEM_RES, O_RDWR | O_SYNC)) == -1)
if ((fd = open(MEM_RES, O_RDWR | O_SYNC)) == -1)
{
printf("Can't read memory. Are you r00t?\n");
exit(-1);
@@ -30,7 +32,7 @@ int main(int argc, char **argv)
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)
if (!map_base)
{
printf("Can't map memory. Are you r00t?\n");
exit(-1);
@@ -42,7 +44,7 @@ int main(int argc, char **argv)
printf("\rGDDR6X VRAM Temp: %d°c", temp);
fflush(stdout);
if (munmap(map_base, map_size) == -1)
if (munmap(map_base, map_size) == -1)
{
printf("Can't unmap memory!\n");
exit(-1);
@@ -53,4 +55,4 @@ int main(int argc, char **argv)
}
return 0;
}
}