Espresso 0.0.2a

This commit is contained in:
2025-10-20 21:57:30 -05:00
parent 102d517097
commit ff6cba1164
59 changed files with 29272 additions and 773 deletions

View File

@ -1,16 +1,66 @@
#include <stdint.h>
#include <string.h>
#include <cpuid.h>
#include <stdlib.h>
#include <kernel/boot.h>
uint8_t parse_boot_data(const char* data)
extern uint8_t __bss_start;
extern uint8_t __bss_end;
void clear_bss(void)
{
if (strlen(data) == 0)
{
return 0;
}
/*memset(&__bss_start, 0, &__bss_end - &__bss_start);*/
return 0;
for (int i = 0; i < ((&__bss_end) - (&__bss_start)); i++)
{
(&(__bss_start))[i] = 0x0;
}
}
char* get_cpu_vendor_string(void)
{
unsigned int eax, ebx, ecx, edx;
char vendor[13];
if (!__get_cpuid(0, &eax, &ebx, &ecx, &edx))
{
return strdup("Unknown");
}
memcpy(&vendor[0], &ebx, 4);
memcpy(&vendor[4], &edx, 4);
memcpy(&vendor[8], &ecx, 4);
vendor[12] = '\0';
return strdup(vendor);
}
char* get_cpu_brand_string(void)
{
unsigned int eax = 0, ebx = 0, ecx = 0, edx = 0;
int k = __get_cpuid_max(0x80000000, NULL);
if (k >= (int) 0x80000005)
{
return strdup("Unknown");
}
char brand[49];
unsigned int* brand_ptr = (unsigned int*) brand;
for (unsigned int i = 0; i < 3; ++i)
{
__get_cpuid(0x80000002 + i, &eax, &ebx, &ecx, &edx);
brand_ptr[i * 4 + 0] = eax;
brand_ptr[i * 4 + 1] = ebx;
brand_ptr[i * 4 + 2] = ecx;
brand_ptr[i * 4 + 3] = edx;
}
brand[48] = '\0';
return strdup(brand);
}