Skip to content

Commit

Permalink
Formating the source code
Browse files Browse the repository at this point in the history
  • Loading branch information
tor4z committed Sep 28, 2022
1 parent b719620 commit d01c940
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 41 deletions.
52 changes: 27 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
CC := gcc
AS := as
LD := ld
AR := ar
MAKE := make
OBJCOPY := objcopy
QEMU := qemu-system-i386
BOCHS := bochs
CC := gcc
AS := as
LD := ld
AR := ar
MAKE := make
OBJCOPY := objcopy
QEMU := qemu-system-i386
BOCHS := bochs
ROOT_PATH := $(shell pwd)


BOOT_DIR := boot
KLIB_DIR := lib
BOOT_DIR := boot
KLIB_DIR := lib
KERNEL_DIR := kernel
DOC_DIR := Documentation
DOC_DIR := Documentation

KLIB := libk.a
BOOT := boot.bin
LOADER := loader.bin
KERNEL := kernel.bin
IMG := a.img
KLIB := libk.a
BOOT := boot.bin
LOADER := loader.bin
KERNEL := kernel.bin
IMG := a.img
BOCHS_CONF := bochsrc.yaml

KLIB_PATH := $(ROOT_PATH)/$(KLIB_DIR)/$(KLIB)
BOOT_PATH := $(ROOT_PATH)/$(BOOT_DIR)/$(BOOT)
LOADER_PATH := $(ROOT_PATH)/$(BOOT_DIR)/$(LOADER)
KERNEL_PATH := $(ROOT_PATH)/$(KERNEL_DIR)/$(KERNEL)
KLIB_PATH := $(ROOT_PATH)/$(KLIB_DIR)/$(KLIB)
BOOT_PATH := $(ROOT_PATH)/$(BOOT_DIR)/$(BOOT)
LOADER_PATH := $(ROOT_PATH)/$(BOOT_DIR)/$(LOADER)
KERNEL_PATH := $(ROOT_PATH)/$(KERNEL_DIR)/$(KERNEL)
KLIB_SEARCH_PATH := $(ROOT_PATH)/$(KLIB_DIR)


BOOT_ENTRY := 0x7c00
BOOT_ENTRY := 0x7c00
LOADER_ENTRY := 0x9200
KERNEL_ENTRY := 0x30400
CFLAGS := -Wall -nostdinc -fno-builtin -m32 -MD
CFLAGS += -Wno-format -Wno-unused -Werror
CFLAGS += -fno-omit-frame-pointer -fno-stack-protector
CFLAGS += -I$(ROOT_PATH)/include


CFLAGS := -Wall -nostdinc -fno-builtin -m32 -MD
CFLAGS += -Wno-format -Wno-unused -Werror
CFLAGS += -fno-omit-frame-pointer -fno-stack-protector
CFLAGS += -I$(ROOT_PATH)/include
ASFLAGS := --32
LDFLAGS := -m elf_i386

Expand Down
2 changes: 1 addition & 1 deletion boot/loader.S
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ static_elf_loader:
pushl %edi

movl 8(%ebp), %eax
movzx ELF_PHNUM_OFFSET(%eax), %ecx /* read the number program header */
movzx ELF_PHNUM_OFFSET(%eax), %ecx /* read the number program header */
movl 8(%ebp), %eax
addl $ELF_PH_OFFSET, %eax /* skip ELF file header */
movl %eax, -4(%ebp)
Expand Down
2 changes: 1 addition & 1 deletion include/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ void *memset(void *ptr, int x, size_t n);
char* strcpy(char* dest, const char* src);
size_t strlen(const char *str);

#endif // STRING_H_
#endif // STRING_H_
2 changes: 1 addition & 1 deletion include/sys/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define RPL2 SELECTOR_RPL2
#define RPL3 SELECTOR_RPL3

#define NUM_TASK 1 // number of system task
#define NUM_TASK 1 // number of system task
#define NUM_UTASK 2 // number of user task

// bit 2 is always 1
Expand Down
1 change: 0 additions & 1 deletion include/sys/vga.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ void write_screen_xy(char c, uint32_t x, uint32_t y);


#endif // VGA_H_

2 changes: 1 addition & 1 deletion kernel/8259a.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ void slave_int(int id);
void disable_irq(int id);
void enable_irq(int id);

#endif // PIC8259A_H_
#endif // PIC8259A_H_
5 changes: 3 additions & 2 deletions kernel/clock.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#include <sys/const.h>
#include <sys/clock.h>
#include <sys/proc.h>
#include <klib.h>
#include <kio.h>
#include "8259a.h"
#include "global.h"
#include "int_handler.h"
#include "klib.h"
#include <kio.h>



void clock_handler()
Expand Down
2 changes: 1 addition & 1 deletion kernel/global.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define IN_GLOBAL_C
#include "global.h"

uint32_t kreenter = 0;
uint32_t kreenter = 0;
2 changes: 1 addition & 1 deletion kernel/int_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ void set_irq_handler(int id, irq_handler handler);
void syscall_handler();


#endif // INT_HANDLER_H_
#endif // INT_HANDLER_H_
4 changes: 2 additions & 2 deletions kernel/proc.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include <sys/const.h>
#include <sys/proc.h>
#include <sys/protect.h>
#include <sys/task.h>
#include <string.h>
#include <kio.h>
#include "global.h"
#include "kio.h"
#include "misc.h"
#include "sys/const.h"


#define UPDATE_LDT_ACCB(ldt, mask, attr) \
Expand Down
2 changes: 1 addition & 1 deletion kernel/restart.S
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ save:
cmpl $0, kreenter
jne in_kernel
not_kernel:
movl ker_stacktop, %esp // kernel stack top
movl ker_stacktop, %esp /* kernel stack top */
pushl $restart
jmp save_ret
in_kernel:
Expand Down
2 changes: 1 addition & 1 deletion lib/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
C_SRCS := $(wildcard *.c)
OBJS := $(patsubst %.c,%.o,$(C_SRCS))
OBJS := $(patsubst %.c,%.o,$(C_SRCS))

%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
Expand Down
2 changes: 1 addition & 1 deletion lib/klib.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ char *itoa (int value, char *str, int base)
v /= 8;
++s;
}

*s = '0';

reverse(str, s);
Expand Down
3 changes: 1 addition & 2 deletions lib/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void *memcpy(void *dest, const void *src, size_t n)
void *memset(void *ptr, int x, size_t n)
{
/*
* c − This is the value to be set. The value is passed as an
* x − This is the value to be set. The value is passed as an
* int, but the function fills the block of memory using the
* unsigned char conversion of this value.
*
Expand Down Expand Up @@ -76,4 +76,3 @@ size_t strlen(const char *str)
}
return len;
}

0 comments on commit d01c940

Please sign in to comment.