diff options
Diffstat (limited to 'arch/amd64')
| -rw-r--r-- | arch/amd64/README | 4 | ||||
| -rw-r--r-- | arch/amd64/include/arch_stdint.h | 29 | ||||
| -rw-r--r-- | arch/amd64/linker.sc | 34 | ||||
| -rw-r--r-- | arch/amd64/meson.build | 13 | ||||
| -rw-r--r-- | arch/amd64/quirks.c | 7 |
5 files changed, 87 insertions, 0 deletions
diff --git a/arch/amd64/README b/arch/amd64/README new file mode 100644 index 0000000..1051958 --- /dev/null +++ b/arch/amd64/README @@ -0,0 +1,4 @@ +The [arch/amd64] module defines implementations and definitions +pertaining to the amd64 (x86_64) architecture, as well as the +entry point setting up the environment before jumping to the +common abstracted code.
\ No newline at end of file diff --git a/arch/amd64/include/arch_stdint.h b/arch/amd64/include/arch_stdint.h new file mode 100644 index 0000000..06040e2 --- /dev/null +++ b/arch/amd64/include/arch_stdint.h @@ -0,0 +1,29 @@ +#ifndef AMD64_STDINT_H +#define AMD64_STDINT_H + +#include <assert.h> + +typedef unsigned char u8; +typedef char i8; + +typedef unsigned short int u16; +typedef short int i16; +static_assert(sizeof(u16) == 2, "u16 is 2 bytes"); +static_assert(sizeof(i16) == 2, "i16 is 2 bytes"); + +typedef unsigned int u32; +typedef int i32; +static_assert(sizeof(u32) == 4, "u16 is 4 bytes"); +static_assert(sizeof(i32) == 4, "i16 is 4 bytes"); + +typedef unsigned long long int u64; +typedef long long int i64; +static_assert(sizeof(u64) == 8, "u64 is 8 bytes"); +static_assert(sizeof(i64) == 8, "i64 is 8 bytes"); + +typedef unsigned long long int usize; +typedef long long int isize; +static_assert(sizeof(usize) == 8, "usize is 8 bytes"); +static_assert(sizeof(isize) == 8, "isize is 8 bytes"); + +#endif
\ No newline at end of file diff --git a/arch/amd64/linker.sc b/arch/amd64/linker.sc new file mode 100644 index 0000000..16d9330 --- /dev/null +++ b/arch/amd64/linker.sc @@ -0,0 +1,34 @@ +OUTPUT(elf64-x86-64) +ENTRY(amd64_quirks) + +SECTIONS { + . = 0xffffffff80000000; + + .stack (NOLOAD) : { + . = ALIGN(8); + . += 0x10000; + . = ALIGN(8); + kernel_stack_high = .; + } :stack + + kernel_begin = .; + .text : { + KEEP(*(.text .text.*)) + } :text + + . += CONSTANT(MAXPAGESIZE); + + .rodata : { + KEEP(*(.rodata .rodata.*)) + } :rodata + + .data : { + KEEP(*(.data .data.*)) + } :data + + .bss (NOLOAD) : { + KEEP(*(COMMON)) + KEEP(*(.bss .bss.*)) + } :data + kernel_end = .; +}
\ No newline at end of file diff --git a/arch/amd64/meson.build b/arch/amd64/meson.build new file mode 100644 index 0000000..4c64c8c --- /dev/null +++ b/arch/amd64/meson.build @@ -0,0 +1,13 @@ +amd64_src = [ + 'quirks.c' +] + +amd64_linker_sc = meson.current_source_dir() / 'linker.sc' + +kernel_link_dep += amd64_linker_sc +kernel_link_arg += '-T' + amd64_linker_sc +kernel_inc += include_directories('include') + +amd64 = static_library('amd64', amd64_src, include_directories: kernel_inc) + +kernel_mod += amd64
\ No newline at end of file diff --git a/arch/amd64/quirks.c b/arch/amd64/quirks.c new file mode 100644 index 0000000..549f605 --- /dev/null +++ b/arch/amd64/quirks.c @@ -0,0 +1,7 @@ +#include <third/boot/bp.h> + +int boot(); + +int amd64_quirks(BpBootinfo *info) { + return boot(); +}
\ No newline at end of file |
