Espresso 0.0.1c
This commit is contained in:
20
lib/stdio.c
20
lib/stdio.c
@ -25,7 +25,7 @@ char* getstring(void)
|
||||
return "HELLO\0";
|
||||
}
|
||||
|
||||
char* fgets(char* buf, int n, FILE file)
|
||||
/*char* fgets(char* buf, int n, FILE file)
|
||||
{
|
||||
if (!buf || n <= 1 || file < 1)
|
||||
{
|
||||
@ -37,26 +37,26 @@ char* fgets(char* buf, int n, FILE file)
|
||||
|
||||
while (total_read < n - 1)
|
||||
{
|
||||
int bytes = 0/*read_file(file, &c, 1)*/;
|
||||
int bytes = 0*//*read_file(file, &c, 1)*/;
|
||||
|
||||
if (bytes <= 0)
|
||||
/*if (bytes <= 0)
|
||||
{
|
||||
break; /* EOF or error */
|
||||
}
|
||||
break; *//* EOF or error */
|
||||
/*}
|
||||
|
||||
buf[total_read++] = c;
|
||||
|
||||
if (c == '\n')
|
||||
{
|
||||
break; /* Stop at newline */
|
||||
}
|
||||
break; *//* Stop at newline */
|
||||
/*}
|
||||
}
|
||||
|
||||
if (total_read == 0)
|
||||
{
|
||||
return NULL; /* Nothing read (e.g. EOF) */
|
||||
}
|
||||
return NULL; *//* Nothing read (e.g. EOF) */
|
||||
/*}
|
||||
|
||||
buf[total_read] = '\0';
|
||||
return buf;
|
||||
}
|
||||
}*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <vector_extentions/sse.h>
|
||||
#include <vector_extensions/sse.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@ -184,7 +184,6 @@ char* strchr(const char* s, int c)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void* memset(void *dst, char c, uint32_t n)
|
||||
{
|
||||
char *temp = dst;
|
||||
|
@ -1,10 +1,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <types.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <vector_extentions/sse.h>
|
||||
#include <vector_extensions/sse.h>
|
||||
|
||||
|
||||
void enable_sse(void)
|
||||
@ -12,17 +9,17 @@ void enable_sse(void)
|
||||
uint32_t cr0, cr4;
|
||||
|
||||
__asm__ volatile ("mov %%cr0, %0" : "=r"(cr0));
|
||||
cr0 &= ~(1 << 2); // EM = 0
|
||||
cr0 |= (1 << 1); // MP = 1
|
||||
cr0 &= ~(1 << 2);
|
||||
cr0 |= (1 << 1);
|
||||
__asm__ volatile ("mov %0, %%cr0" :: "r"(cr0));
|
||||
|
||||
__asm__ volatile ("mov %%cr4, %0" : "=r"(cr4));
|
||||
cr4 |= (1 << 9); // OSFXSR = 1
|
||||
cr4 |= (1 << 10); // OSXMMEXCPT = 1
|
||||
cr4 |= (1 << 9);
|
||||
cr4 |= (1 << 10);
|
||||
__asm__ volatile ("mov %0, %%cr4" :: "r"(cr4));
|
||||
}
|
||||
|
||||
// Basic SSE test: add two arrays of 4 floats using xmm registers
|
||||
/* Basic SSE test: add two arrays of 4 floats using xmm registers */
|
||||
__attribute__((force_align_arg_pointer))
|
||||
int32_t test_sse(void)
|
||||
{
|
Reference in New Issue
Block a user