summaryrefslogtreecommitdiffstats
path: root/include/asm-alpha/hwrpb.h
diff options
context:
space:
mode:
authorZachary Amsden <zach@vmware.com>2005-09-03 15:56:47 -0700
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-05 00:06:13 -0700
commitf2f30ebca6c0c95e987cb9a1fd1495770a75432e (patch)
treeea7b1763aa0e0d36b52fa245449c79338fe735b3 /include/asm-alpha/hwrpb.h
parente9f86e351fda5b3c40192fc3990453613f160779 (diff)
downloadblackbird-op-linux-f2f30ebca6c0c95e987cb9a1fd1495770a75432e.tar.gz
blackbird-op-linux-f2f30ebca6c0c95e987cb9a1fd1495770a75432e.zip
[PATCH] x86: introduce a write acessor for updating the current LDT
Introduce a write acessor for updating the current LDT. This is required for hypervisors like Xen that do not allow LDT pages to be directly written. Testing - here's a fun little LDT test that can be trivially modified to test limits as well. /* * Copyright (c) 2005, Zachary Amsden (zach@vmware.com) * This is licensed under the GPL. */ #include <stdio.h> #include <signal.h> #include <asm/ldt.h> #include <asm/segment.h> #include <sys/types.h> #include <unistd.h> #include <sys/mman.h> #define __KERNEL__ #include <asm/page.h> void main(void) { struct user_desc desc; char *code; unsigned long long tsc; code = (char *)mmap(0, 8192, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); desc.entry_number = 0; desc.base_addr = code; desc.limit = 1; desc.seg_32bit = 1; desc.contents = MODIFY_LDT_CONTENTS_CODE; desc.read_exec_only = 0; desc.limit_in_pages = 1; desc.seg_not_present = 0; desc.useable = 1; if (modify_ldt(1, &desc, sizeof(desc)) != 0) { perror("modify_ldt"); } printf("code base is 0x%08x\n", (unsigned)code); code[0x0ffe] = 0x0f; /* rdtsc */ code[0x0fff] = 0x31; code[0x1000] = 0xcb; /* lret */ __asm__ __volatile("lcall $7,$0xffe" : "=A" (tsc)); printf("TSC is 0x%016llx\n", tsc); } Signed-off-by: Zachary Amsden <zach@vmware.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-alpha/hwrpb.h')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud