Skip to content

Commit

Permalink
FIXED hang.
Browse files Browse the repository at this point in the history
Created types.h, added some typedefs, extend it.
  • Loading branch information
IPlayZed committed Feb 3, 2022
1 parent 7e4c977 commit dfd2a27
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void printf(char* str)
* */
extern LANG_C void call_ctors()
{
for(ctor* i = &start_ctors; i != end_ctors; i++)
for(ctor* i = &start_ctors; i != &end_ctors; i++)
{
(*i)();
}
Expand Down
3 changes: 1 addition & 2 deletions src/loader.s
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
loader:
mov $kernel_stack_ptr, %esp # set stack pointer, as kernel_main is a cpp program and it expects the stack pointer to be set.

# FIXME: When this is called, kernel doesn't run?
#call call_ctors # Call the compiler generated constructors.
call call_ctors # Call the compiler generated constructors.

push %eax # The (GRUB2) bootloader stores the multiboot structure's RAM adress in the AX register during loading the kernel of choice, which contains valuable information, like the size of the RAM. We should push this to the stack in order to access it later.
push %ebx # The (GRUB2) bootloader stores the MULTIBOOT_FLAG value in the BX register.
Expand Down
11 changes: 11 additions & 0 deletions src/types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef __TYPES_H__
#define __TYPES_H__

typedef char int8_t;
typedef unsigned char uint8_t;

typedef short int16_t;
typedef unsigned short uint16_t;


#endif

0 comments on commit dfd2a27

Please sign in to comment.