Can i far jump to 0xffffffff80000000 from 32bit code???

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
criny
Posts: 7
Joined: Sun Jul 27, 2014 1:19 pm

Can i far jump to 0xffffffff80000000 from 32bit code???

Post by criny »

first of all, sorry for my bad english...
I'm making POSIX-compatible kernel by myself just for fun...

My kernel code is below(by nasm)

Code: Select all

[bits 32]
[org 100000]
// start from grub 32bit direct jump mode

// set page table for 64bit kernel 
[virtual mem addr]     [pys mem  addr]
0xffffffff80000000~      0x0~

// make gdt for 64bit kernel and "lgdt"

// set cr0 register for jumping to 64bit mode

jmp 0x??:start64

start64:
// 64bit start
my code is like above...
above code is not work because page mapping table for virtual mem address 0x10000~ is not set...
I already know that in linux kernel code, early 4gb maaping code is existed....
I just want to jumping to 0xffffffff8000000 virtual address from 32bit code by not making early 4gb mapping table....
Is there a way??? trampoline like early 4gb mapping table is esseantial for 64bit kernel???
Nable
Member
Member
Posts: 453
Joined: Tue Nov 08, 2011 11:35 am

Re: Can i far jump to 0xffffffff80000000 from 32bit code???

Post by Nable »

I think that this wiki article will help you: http://wiki.osdev.org/Entering_Long_Mode_Directly
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: Can i far jump to 0xffffffff80000000 from 32bit code???

Post by Gigasoft »

No, you can't. (And the wiki page has no relevance at all.)
User avatar
Marionumber1
Member
Member
Posts: 56
Joined: Sun May 08, 2011 9:03 am

Re: Can i far jump to 0xffffffff80000000 from 32bit code???

Post by Marionumber1 »

I know that you're using GRUB, but my way is to have a custom bootloader that loads the kernel as an ELF file. The bootloader runs in the first 1MiB of memory using identity-mapped paging, so it can make the jump into 64-bit code easily. Once it's up and running, it loads an ELF file off the filesystem to any arbitrary virtual address.

DISCLAIMER: I haven't actually implemented long mode support in the bootloader yet, but it's a trivial thing to add, and the general design is the same for both protected mode and long mode.
Programmer and security enthusiast
DarkSide OS Kernel

Those who do not understand Windows NT are doomed to criticize it, poorly.
criny
Posts: 7
Joined: Sun Jul 27, 2014 1:19 pm

Re: Can i far jump to 0xffffffff80000000 from 32bit code???

Post by criny »

Gigasoft wrote:No, you can't. (And the wiki page has no relevance at all.)
thank you for reply... I think that It's not allowed in x86 arcitecture now....
why linux kernel use eraly 4gb paging table is because of that....I think......
Post Reply