How can I set CPL=0 for WBINVD in NASM (Linux)

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
yousafsajjad
Posts: 5
Joined: Thu Jul 08, 2010 6:03 pm

How can I set CPL=0 for WBINVD in NASM (Linux)

Post by yousafsajjad »

Hi,
I just started working on nasm 2 weeks ago and I am stuck at something (of course). Can anyone please tell me how can I set CPL=0 so that I can use WBINVD
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: How can I set CPL=0 for WBINVD in NASM (Linux)

Post by Brendan »

Hi,
yousafsajjad wrote:I just started working on nasm 2 weeks ago and I am stuck at something (of course). Can anyone please tell me how can I set CPL=0 so that I can use WBINVD
You can't, unless you're writing kernel code or a device driver (which runs as part of the kernel as a kernel module).

This basically means that normal processes can't screw everything up when the programmer makes the mistake of thinking that they want to use something like WBINVD... ;-)

Note: the CLFLUSH instruction may be what you actually want...


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
yousafsajjad
Posts: 5
Joined: Thu Jul 08, 2010 6:03 pm

Re: How can I set CPL=0 for WBINVD in NASM (Linux)

Post by yousafsajjad »

Yeah it seems like it would work but in this description it says something like "Invalidates the cache line that contains the linear address specified with the source operand from all levels of the processor cache hierarchy". I am not much sure what that suppose to mean
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: How can I set CPL=0 for WBINVD in NASM (Linux)

Post by Combuster »

The linear address is the address passed into the paging system. It's the same as the virtual address unless you use segmentation (which most people don't).
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply