You should be able to write assembler, even if you can’t do it inline. You
just have to make it an external routine and use MASM. The DDK contains a
64-bit version of MASM, and if you put a SOURCES file inside a AMD64
directory, and place a .asm file in this directory (and add it to the
sources file, of course), you should be able to build the code as part of a
normal DDK build.
If you use SLDT or SGDT, it shoul store a base-address and size [called
LIMIT by Intels documentation] (the first being 64-bit and the second being
16-bit). Then examine the address and size that comes out and see where
“the middle” is.
–
Mats
-------- Notice --------
The information in this message is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this
message by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying or distribution of the message, or any
action taken by you in reliance on it, is prohibited and may be unlawful.
If you have received this message in error, please delete it and contact
the sender immediately. Thank you.
xxxxx@lists.osr.com wrote on 01/21/2005 12:56:46 PM:
I’m only trying to “load and run a 32-bit code in a 64-bit process”.
Or “to prove a concept” after skim through a few pages of AMD’s
manuals. Really appreciate that you want to know “my true
intention” and offer help.
I asked for an API because I don’t know where in the descriptor
table I can touch. I’m afraid I mess it up and crash the system.
Moreover, inline assembly doesn’t work in (AMD) 64-bit compiler.
It’s kind of inconvenient even if I want to touch LDT/GDT directly.
BTW, “#pragma code_seg(.text)” doesn’t seem to work, either.
So I started to think there must be better ways.
Maybe I can try to modify the DT “around the middle” in a kernel
mode driver. To determine the middle, I’ll need to know its
length first 8-(. Anyway, I’ll give it a try.
Thank you.
Isaac Chen
“Mats PETERSSON” wrote in message
> news:xxxxx@ntdev…
> >
> > Isaac,
> >
> > What are you ACTUALLY trying to achieve here… If you explain what it
is
> > you’re trying to do, it is quite possible that I or someone else on
this
> > list can suggest a suitable solution. But trying to “reverse engineer”
> your
> > idea so that we can figure out what’s the best solution for your
situation
> > isn’t that easy, and trying to suggest solutions to unknown problems
isn’t
> > a good plan.
> >
> > “messing” with the descriptor table is definitely not something you
should
> > do unless there is ABSOLUTELY no other way.
> >
> > Of course, if you’re just trying to prove a concept, why not just use a
> > kernel driver to modify your LDT or GDT, just pick a selector somewhere
> > around the middle (far from either end), and use that. But that
obviously
> > won’t work for a commercial product. Don’t need a system call do modify
> the
> > GDT, just do “store GDT” and modify the address that it points to [you
may
> > have to map that address, I can’t remember if the GDT is physical or
> > logical addresses].
> >
> > –
> > Mats
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.
> osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@3dlabs.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
> ForwardSourceID:NT0000B49E