Switch: to freestanding stdint and stdbool headers
This commit is contained in:
2
makefile
2
makefile
@@ -1,5 +1,5 @@
|
|||||||
CC = i386-elf-7.5.0-Linux-x86_64/bin/i386-elf-gcc
|
CC = i386-elf-7.5.0-Linux-x86_64/bin/i386-elf-gcc
|
||||||
CFLAGS = -g -Wall -Wextra -Wno-builtin-declaration-mismatch -c -I src/
|
CFLAGS = -ffreestanding -g -Wall -Wextra -Wno-builtin-declaration-mismatch -c -I src/
|
||||||
LDFLAGS = -T link.ld -melf_i386
|
LDFLAGS = -T link.ld -melf_i386
|
||||||
AS = nasm
|
AS = nasm
|
||||||
ASFLAGS = -f elf
|
ASFLAGS = -f elf
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "../libc/stdint.h"
|
#include <stdint.h>
|
||||||
#include "../kernel/io.h"
|
#include "../kernel/io.h"
|
||||||
#include "../libc/stdio.h"
|
#include "../libc/stdio.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#ifndef ATA_H
|
#ifndef ATA_H
|
||||||
#define ATA_H
|
#define ATA_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
void ata_read_sector(uint32_t lba, uint8_t* buffer);
|
void ata_read_sector(uint32_t lba, uint8_t* buffer);
|
||||||
void test_read_sector();
|
void test_read_sector();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "../libc/stdint.h"
|
#include <stdint.h>
|
||||||
#include "framebuffer.h"
|
#include "framebuffer.h"
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
#include "../kernel/system.h"
|
#include "../kernel/system.h"
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#ifndef FRAMEBUFFER_H
|
#ifndef FRAMEBUFFER_H
|
||||||
#define FRAMEBUFFER_H
|
#define FRAMEBUFFER_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#define PSF1_FONT_MAGIC 0x0436
|
#define PSF1_FONT_MAGIC 0x0436
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -9,7 +11,6 @@ typedef struct {
|
|||||||
uint8_t characterSize; // PSF character size.
|
uint8_t characterSize; // PSF character size.
|
||||||
} PSF1_Header;
|
} PSF1_Header;
|
||||||
|
|
||||||
|
|
||||||
#define PSF_FONT_MAGIC 0x864ab572
|
#define PSF_FONT_MAGIC 0x864ab572
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef INCLUDE_IO_H
|
#ifndef INCLUDE_IO_H
|
||||||
#define INCLUDE_IO_H
|
#define INCLUDE_IO_H
|
||||||
|
|
||||||
#include "../libc/stdint.h"
|
#include <stdint.h>
|
||||||
|
|
||||||
void outb(unsigned short port, unsigned char data);
|
void outb(unsigned short port, unsigned char data);
|
||||||
unsigned char inb(unsigned short port);
|
unsigned char inb(unsigned short port);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "kheap.h"
|
#include "kheap.h"
|
||||||
|
|
||||||
#include "../libc/stdint.h"
|
#include <stdint.h>
|
||||||
|
|
||||||
extern uint32_t end;
|
extern uint32_t end;
|
||||||
uint32_t placement_address = (uint32_t)&end;
|
uint32_t placement_address = (uint32_t)&end;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef KHEAP_H
|
#ifndef KHEAP_H
|
||||||
#define KHEAP_H
|
#define KHEAP_H
|
||||||
|
|
||||||
#include "../libc/stdint.h"
|
#include <stdint.h>
|
||||||
|
|
||||||
uint32_t kmalloc_a(uint32_t sz);
|
uint32_t kmalloc_a(uint32_t sz);
|
||||||
uint32_t kmalloc_p(uint32_t sz, uint32_t *phys);
|
uint32_t kmalloc_p(uint32_t sz, uint32_t *phys);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "paging.h"
|
#include "paging.h"
|
||||||
#include "../drivers/ata.h"
|
#include "../drivers/ata.h"
|
||||||
#include "../libc/stdint.h"
|
#include <stdint.h>
|
||||||
#include "../drivers/framebuffer.h"
|
#include "../drivers/framebuffer.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "../libc/stdint.h"
|
#include <stdint.h>
|
||||||
#include "paging.h"
|
#include "paging.h"
|
||||||
#include "../libc/stdio.h"
|
#include "../libc/stdio.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#define PAGING_H
|
#define PAGING_H
|
||||||
|
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "../libc/stdint.h"
|
#include <stdint.h>
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint32_t present : 1;
|
uint32_t present : 1;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#include "../libc/stdio.h"
|
#include "../libc/stdio.h"
|
||||||
#include "../libc/string.h"
|
#include "../libc/string.h"
|
||||||
#include "../programs/programs.h"
|
#include "../programs/programs.h"
|
||||||
#include "../libc/stdint.h"
|
#include <stdint.h>
|
||||||
|
|
||||||
#define BUFFER_SIZE 256
|
#define BUFFER_SIZE 256
|
||||||
#define MAX_COMMANDS 16
|
#define MAX_COMMANDS 16
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "../libc/stdint.h"
|
#include <stdint.h>
|
||||||
|
|
||||||
void *memset(void *dest, char val, size_t count)
|
void *memset(void *dest, char val, size_t count)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
#ifndef SYSTEM_H
|
#ifndef SYSTEM_H
|
||||||
#define SYSTEM_H
|
#define SYSTEM_H
|
||||||
|
|
||||||
#include "../libc/stdint.h"
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef int size_t;
|
typedef int size_t;
|
||||||
|
#define NULL ((void*)0)
|
||||||
|
|
||||||
void *memset(void *dest, char val, size_t count);
|
void *memset(void *dest, char val, size_t count);
|
||||||
void *memmove(void* dest, const void* src, size_t n);
|
void *memmove(void* dest, const void* src, size_t n);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "crypto.h"
|
#include "crypto.h"
|
||||||
#include "../libc/stdint.h"
|
#include <stdint.h>
|
||||||
|
|
||||||
int lcg(int seed)
|
int lcg(int seed)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#define RAND_MAX 1024
|
#define RAND_MAX 1024
|
||||||
|
|
||||||
#include "../libc/stdint.h"
|
#include <stdint.h>
|
||||||
|
|
||||||
int lcg(int seed);
|
int lcg(int seed);
|
||||||
int randint(int seed);
|
int randint(int seed);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
#include "stdint.h"
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
bool isdigit(char c)
|
bool isdigit(char c)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef CTYPE_H
|
#ifndef CTYPE_H
|
||||||
#define CTYPE_H
|
#define CTYPE_H
|
||||||
|
|
||||||
#include "stdint.h"
|
#include <stdbool.h>
|
||||||
|
|
||||||
bool isdigit(char c);
|
bool isdigit(char c);
|
||||||
bool isspace(char c);
|
bool isspace(char c);
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
#ifndef INCLUDE_STDINT_H
|
|
||||||
#define INCLUDE_STDINT_H
|
|
||||||
|
|
||||||
typedef signed char int8_t;
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
|
|
||||||
typedef signed short int16_t;
|
|
||||||
typedef unsigned short uint16_t;
|
|
||||||
|
|
||||||
typedef signed long int int32_t;
|
|
||||||
typedef unsigned long int uint32_t;
|
|
||||||
|
|
||||||
typedef signed long long int int64_t;
|
|
||||||
typedef unsigned long long int uint64_t;
|
|
||||||
|
|
||||||
typedef uint8_t bool;
|
|
||||||
#define true 1
|
|
||||||
#define false 0
|
|
||||||
|
|
||||||
#define NULL ((void*)0)
|
|
||||||
|
|
||||||
typedef unsigned int uintptr_t;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "../kernel/io.h"
|
#include "../kernel/io.h"
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "stdint.h"
|
#include <stdint.h>
|
||||||
#include "../kernel/system.h"
|
#include "../kernel/system.h"
|
||||||
#include "../drivers/framebuffer.h"
|
#include "../drivers/framebuffer.h"
|
||||||
#include "../drivers/serial.h"
|
#include "../drivers/serial.h"
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
#ifndef INCLUDE_STDIO_H
|
#ifndef INCLUDE_STDIO_H
|
||||||
#define INCLUDE_STDIO_H
|
#define INCLUDE_STDIO_H
|
||||||
|
|
||||||
#include "stdint.h"
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#define FB_GREEN 2
|
#define FB_GREEN 2
|
||||||
#define FB_DARK_GREY 8
|
#define FB_DARK_GREY 8
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "stdint.h"
|
#include <stdint.h>
|
||||||
|
#include "../kernel/system.h"
|
||||||
|
|
||||||
int strlen(const char* str)
|
int strlen(const char* str)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ void program_rot13()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include "../libc/string.h"
|
#include "../libc/string.h"
|
||||||
#include "../libc/stdint.h"
|
#include <stdint.h>
|
||||||
|
|
||||||
const char* morse_alphabet[] = {
|
const char* morse_alphabet[] = {
|
||||||
".-", // A
|
".-", // A
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#include "../libc/stdio.h"
|
#include "../libc/stdio.h"
|
||||||
#include "../kernel/system.h"
|
#include "../kernel/system.h"
|
||||||
#include "../libc/crypto.h"
|
#include "../libc/crypto.h"
|
||||||
#include "../libc/stdint.h"
|
#include <stdint.h>
|
||||||
#include "../drivers/serial.h"
|
#include "../drivers/serial.h"
|
||||||
#include "../libc/string.h"
|
#include "../libc/string.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Math expression lexer and parser
|
// Math expression lexer and parser
|
||||||
|
|
||||||
#include "../libc/stdint.h"
|
#include <stdint.h>
|
||||||
#include "../kernel/system.h"
|
#include "../kernel/system.h"
|
||||||
#include "../libc/stdio.h"
|
#include "../libc/stdio.h"
|
||||||
#include "../libc/ctype.h"
|
#include "../libc/ctype.h"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "../libc/stdint.h"
|
#include <stdint.h>
|
||||||
#include "../libc/stdio.h"
|
#include "../libc/stdio.h"
|
||||||
#include "../kernel/system.h"
|
#include "../kernel/system.h"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user