1
0
mirror of https://github.com/taigrr/gopher-os synced 2025-01-18 04:43:13 -08:00

6 Commits

Author SHA1 Message Date
Achilleas Anagnostopoulos
9567f259bd Set m.curg = g0 2017-07-14 07:45:56 +01:00
Achilleas Anagnostopoulos
16ad4c856e Set framebuffer tag in multiboot header and add vesa grub menu entries 2017-07-13 23:35:20 +01:00
Achilleas Anagnostopoulos
cc4364f55c Pass the virtual page offset for the kernel to kernel.Kmain
Ths page offset is defined in arch/XXX/constants.inc and needs to be
passed to the kernel so we can correctly calculate the physical frame
addresses that correspond to the ELF section virtual memory addresses.
2017-07-13 00:08:40 +01:00
Achilleas Anagnostopoulos
4e0ad81770 Reload GDT with the descriptor VMA once the CPU switches to 64-bit mode
The GDT is initially loaded in the 32-bit rt0 code where we cannot use
the 48-bit VMA for the GDT table and instead we use its physical
address. This approach works as the rt0 code establishes an identity
mapping for the region 0-8M. However, when the kernel creates a more
granular PDT it only includes the VMA addresses for the kernel ELF image
sections making the 0-8M invalid. Unless the GDT is reloaded with the
VMA of the table, the CPU will cause a non-recoverable page fault when
it tries to restore the segment registers while returning from a
recoverable page fault.
2017-07-13 00:08:40 +01:00
Achilleas Anagnostopoulos
a1d65d4c09 Setup fs register according to the ELF TLS handling manual for x86-64
According to the ELF runtime handling of TLS document, the x86-64 arch
uses the same TLS handling variant (GNU) as the IA-32 ABI with the
exception that pointers are 8-byte wide and that the gs register is
swapped with fs. fs:0x0 points to the TCB; TLS variables are located
before it and are accessed using negative offsets from the TCB pointer.
In the Go case the G struct is accessed at fs:-0x8.

For more detauls see: https://www.akkadia.org/drepper/tls.pdf
2017-07-07 06:25:04 +01:00
Achilleas Anagnostopoulos
8dfc5d4e92 Use pwd as a workspace; move sources to src/gopheros and rewrite imports
By setting up pwd as a Go workspace, we can trim import paths from
something like "github.com/achilleasa/gopher-os/kernel" to just
"kernel".

These changes make forking easier and also allows us to move the code to
a different git hosting provider without having to rewrite the imports.
2017-07-01 20:37:09 +01:00