summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/gdbinit31
-rw-r--r--config/grub.cfg9
-rw-r--r--config/kernel.ld36
-rw-r--r--config/user.ld51
4 files changed, 127 insertions, 0 deletions
diff --git a/config/gdbinit b/config/gdbinit
new file mode 100644
index 0000000..ca2c885
--- /dev/null
+++ b/config/gdbinit
@@ -0,0 +1,31 @@
+# adapted from the xv6 .gdbinit.tmpl file
+set $lastcs = -1
+
+define hook-stop
+ # There doesn't seem to be a good way to detect if we're in 16- or
+ # 32-bit mode, but we always run with CS == 8 in 32-bit mode.
+ if $cs == 8 || $cs == 27
+ if $lastcs != 8 && $lastcs != 27
+ set architecture i386
+ end
+ x/i $pc
+ else
+ if $lastcs == -1 || $lastcs == 8 || $lastcs == 27
+ set architecture i8086
+ end
+ # Translate the segment:offset into a physical address
+ printf "[%4x:%4x] ", $cs, $eip
+ x/i $cs*16+$eip
+ end
+ set $lastcs = $cs
+end
+
+echo + target remote localhost:1337\n
+target remote localhost:1337
+
+# If this fails, it's probably because your GDB doesn't support ELF.
+# Look at the tools page at
+# http://pdos.csail.mit.edu/6.828/2009/tools.html
+# for instructions on building GDB with ELF support.
+echo + symbol-file build/kernel/kernel\n
+symbol-file build/kernel/kernel
diff --git a/config/grub.cfg b/config/grub.cfg
new file mode 100644
index 0000000..6cedb28
--- /dev/null
+++ b/config/grub.cfg
@@ -0,0 +1,9 @@
+set timeout=1
+set default=0
+terminal_input at_keyboard
+termianl_output console
+
+menuentry "kern" {
+ multiboot2 /boot/kernel
+ boot
+}
diff --git a/config/kernel.ld b/config/kernel.ld
new file mode 100644
index 0000000..0806257
--- /dev/null
+++ b/config/kernel.ld
@@ -0,0 +1,36 @@
+ENTRY(_start)
+
+SECTIONS
+{
+ . = 1M;
+
+ kernel_start = .;
+
+ . = ALIGN(0x1000);
+
+ .text : {
+ *(.multiboot)
+ *(.text)
+ }
+
+ . = ALIGN(0x1000);
+
+ .rodata : {
+ *(.rodata)
+ }
+
+ . = ALIGN(0x1000);
+
+ .data : {
+ *(.data)
+ }
+
+ . = ALIGN(0x1000);
+
+ .bss : {
+ *(COMMON)
+ *(.bss)
+ }
+
+ kernel_end = .;
+}
diff --git a/config/user.ld b/config/user.ld
new file mode 100644
index 0000000..9e31dff
--- /dev/null
+++ b/config/user.ld
@@ -0,0 +1,51 @@
+/*
+** Simple linker script for user-level programs.
+*/
+
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH(i386)
+ENTRY(_start)
+
+SECTIONS
+{
+ /* user text begins at the second page of the address space */
+ . = 0x1000;
+
+ .text : {
+ KEEP(*(.text .stub .text.* .gnu.linkonce.t.*))
+ }
+
+ /* define some standard symbols */
+ PROVIDE(etext = .);
+ PROVIDE(_etext = .);
+
+ /* read-only data will go at the end of the text section */
+ .rodata : {
+ KEEP(*(.rodata .rodata.* .gnu.linkonce.r.*))
+ }
+
+ /* Align the data segment at the next page boundary */
+ . = ALIGN(0x1000);
+
+ .data : {
+ KEEP(*(.data))
+ }
+
+ PROVIDE(edata = .);
+ PROVIDE(_edata = .);
+
+ /* Page-align the BSS segment */
+ . = ALIGN(0x1000);
+
+ PROVIDE(__bss_start = .);
+
+ .bss : {
+ KEEP(*(.bss))
+ }
+
+ PROVIDE(_end = .);
+
+ /DISCARD/ : {
+ *(.stab .stab_info .stabstr .eh_frame .note.GNU-stack .note.gnu.property .comment)
+ }
+}