Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
triazo
/
kernel
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
3
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
dd9209b7
authored
Oct 13, 2015
by
triazo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add multiboot header and test read some info
parent
09b732fe
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
src/head.asm
src/kern.c
src/head.asm
View file @
dd9209b7
...
...
@@ -56,6 +56,9 @@ _start:
; our stack (as it grows downwards).
mov
esp
,
stack_top
push
eax
; Multiboot magic number
push
ebx
; Multiboot info struct
; We are now ready to actually execute C code. We cannot embed that in an
; assembly file, so we'll create a kernel.c file in a moment. In that file,
; we'll create a C entry point called kernel_main and call it here.
...
...
src/kern.c
View file @
dd9209b7
#include <stdbool.h>
/* C doesn't have booleans by default. */
/*
kern.c is where the c code starts, as invoked by our heading
assembly. It should only contain high level code
*/
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
...
...
@@ -9,11 +14,10 @@
#include "gdt.h"
#include "idt.h"
#include "test.h"
#include "multiboot.h"
#if defined(__cplusplus)
extern
"C"
/* Use C linkage for kernel_main. */
#endif
void
kernel_main
()
// The parameters passed here ultimately come through the bootloader
void
kernel_main
(
multiboot_info
*
mbd
,
uint32_t
magic
)
{
/* Initialize terminal and serial interfaces */
terminal_initialize
();
...
...
@@ -29,6 +33,11 @@ void kernel_main()
terminal_writestring
(
"Hello, kernel World!
\n
"
);
//serial_writestring("Second Serial Test\n");
serial_hexstring
(
&
magic
,
4
);
serial_writestring
(
"
\n
"
);
serial_hexstring
(
&
(
mbd
->
flags
),
8
);
serial_writestring
(
"
\n
"
);
// Enable paging of memory. For now there is only one virtual
// memory space defined by page_dir
page_directory_entry
*
page_dir
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment