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
8e6f3660
authored
Nov 22, 2015
by
triazo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add elf and load it into kernel memory
parent
4e2be3d0
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
1 deletions
src/elf.h
src/hello.elf
src/kern.c
src/makefile
src/elf.h
0 → 100644
View file @
8e6f3660
/*
elf.h
Structures and symbols used for loading elf files
*/
#ifndef _ELF_INC
#define _ELF_INT
#include <stdint.h>
extern
uint8_t
elf_hello
[]
asm
(
"_binary_hello_elf_start"
);
#endif
src/hello.elf
0 → 100755
View file @
8e6f3660
No preview for this file type
src/kern.c
View file @
8e6f3660
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "pic.h"
#include "pic.h"
#include "pit.h"
#include "pit.h"
#include "io.h"
#include "io.h"
#include "elf.h"
// The parameters passed here ultimately come through the bootloader
// The parameters passed here ultimately come through the bootloader
void
kernel_main
(
multiboot_info
*
mbt
,
uint32_t
magic
)
void
kernel_main
(
multiboot_info
*
mbt
,
uint32_t
magic
)
...
@@ -68,6 +69,12 @@ void kernel_main(multiboot_info* mbt, uint32_t magic)
...
@@ -68,6 +69,12 @@ void kernel_main(multiboot_info* mbt, uint32_t magic)
// PCI
// PCI
checkAllBuses
();
checkAllBuses
();
// Elf testing
// This is defined in elf.h
serial_writestring
(
"Elf address: 0x"
);
serial_hexstring
(
elf_hello
,
4
);
serial_writestring
(
"
\n
"
);
test_idt
();
test_idt
();
while
(
true
)
while
(
true
)
{
{
...
...
src/makefile
View file @
8e6f3660
...
@@ -5,7 +5,7 @@ all:
...
@@ -5,7 +5,7 @@ all:
/usr/bin/nasm
-felf32
paging.asm
/usr/bin/nasm
-felf32
paging.asm
/usr/bin/nasm
-felf32
idta.asm
/usr/bin/nasm
-felf32
idta.asm
$C
*
.c
-std
=
gnu99
-ffreestanding
-O2
-Wall
-Wextra
-c
$C
*
.c
-std
=
gnu99
-ffreestanding
-O2
-Wall
-Wextra
-c
$C
-T
linker.ld
-o
myos.bin
-ffreestanding
-O2
-nostdlib
*
.o
-lgcc
$C
-
Wl
,--format
=
binary
-Wl
,hello.elf
-Wl
,--format
=
default
-
T
linker.ld
-o
myos.bin
-ffreestanding
-O2
-nostdlib
*
.o
-lgcc
clean
:
clean
:
rm
*
.o
*
.bin
rm
*
.o
*
.bin
...
...
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