Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Things #157

Merged
merged 9 commits into from
Aug 18, 2024
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@
iso/boot/ramdisk
disk*.img
builds/
compile_commands.json
.cache/
11 changes: 11 additions & 0 deletions compile_flags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-O0
-nostdlib
-fno-stack-protector
-fno-builtin
-Ikernel/include/
-ffreestanding
-Wall
-Wno-div-by-zero
-Wno-address-of-packed-member
-Wno-implicit-function-declaration
-mno-red-zone
4 changes: 2 additions & 2 deletions kernel/include/io/ports.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ extern void (*default_qemu_printf)(const char *text, ...) __attribute__((format(

#define assert(condition, format, ...) do { if (condition) { \
qemu_printf("======================================\n"); \
qemu_printf("ASSERT FAILED: " format "\n", ##__VA_ARGS__); \
qemu_printf("[%s:%s:%d] ASSERT FAILED: " format "\n", __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
qemu_printf("======================================\n"); \
bsod_screen((registers_t){}, "ASSERT_FAIL", "See additional information on COM1 port. (Or Qemu.log if you're using QEMU)", 0xFFFF); \
} } while(0)
Expand Down Expand Up @@ -134,4 +134,4 @@ int32_t is_transmit_empty(uint16_t port);
uint8_t serial_readchar(uint16_t port);
void io_wait();

void new_qemu_printf(const char *format, ...);
void new_qemu_printf(const char *format, ...);
4 changes: 2 additions & 2 deletions kernel/include/mem/pmm.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extern size_t kernel_end;
#define PAGE_DIRTY (1U << 6)
#define PAGE_GLOBAL (1U << 8)

#define PAGE_BITMAP_SIZE (131072)
#define PAGE_BITMAP_SIZE (131072 * 4)

#define PD_INDEX(virt_addr) ((virt_addr) >> 22)
#define PT_INDEX(virt_addr) (((virt_addr) >> 12) & 0x3ff)
Expand Down Expand Up @@ -67,4 +67,4 @@ uint32_t* get_kernel_page_directory();

void map_pages_overlapping(physical_addr_t* page_directory, size_t physical_start, size_t virtual_start, size_t size, uint32_t flags);
void unmap_pages_overlapping(physical_addr_t* page_directory, size_t virtual, size_t size);
void phys_set_flags(uint32_t* page_dir, virtual_addr_t virtual, uint32_t flags);
void phys_set_flags(uint32_t* page_dir, virtual_addr_t virtual, uint32_t flags);
13 changes: 10 additions & 3 deletions kernel/include/net/stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@
#pragma once

#include "common.h"
#include "net/cards.h"

typedef struct {
netcard_entry_t* card;
void* data;
size_t length;
} netqueue_item_t;

void netstack_init();
void netstack_push(void* packet_data, size_t length);
void* netstack_pop();
void* netstack_poll();
void netstack_push(netcard_entry_t* card, void* packet_data, size_t length);
netqueue_item_t* netstack_pop();
netqueue_item_t* netstack_poll();
9 changes: 5 additions & 4 deletions kernel/include/net/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ typedef struct {
} tcp_packet_t;

typedef enum {
EIKS_CREATED,
EIKS_LISTENING,
EIKS_ESTABLISHED
TCP_NONE,
TCP_CREATED,
TCP_LISTENING,
TCP_ESTABLISHED
} tcp_connection_status_t;

typedef struct {
Expand All @@ -38,7 +39,7 @@ typedef struct {
uint16_t source_port;
uint16_t dest_port;
uint32_t seq;
uint32_t dst_seq;
uint32_t ack;
tcp_connection_status_t status;
} tcp_connection_t;

Expand Down
Loading
Loading