1 ;------------------------------------------------------------------------------ 2 ;* 3 ;* Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> 4 ;* This program and the accompanying materials 5 ;* are licensed and made available under the terms and conditions of the BSD License 6 ;* which accompanies this distribution. The full text of the license may be found at 7 ;* http://opensource.org/licenses/bsd-license.php 8 ;* 9 ;* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 ;* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 ;* 12 ;* CpuAsm.nasm 13 ;* 14 ;* Abstract: 15 ;* 16 ;------------------------------------------------------------------------------ 17 18 SECTION .text 19 20 ;------------------------------------------------------------------------------ 21 ; VOID 22 ; SetCodeSelector ( 23 ; UINT16 Selector 24 ; ); 25 ;------------------------------------------------------------------------------ 26 global ASM_PFX(SetCodeSelector) 27 ASM_PFX(SetCodeSelector): 28 mov ecx, [esp+4] 29 sub esp, 0x10 30 lea eax, [setCodeSelectorLongJump] 31 mov [esp], eax 32 mov [esp+4], cx 33 jmp dword far [esp] 34 setCodeSelectorLongJump: 35 add esp, 0x10 36 ret 37 38 ;------------------------------------------------------------------------------ 39 ; VOID 40 ; SetDataSelectors ( 41 ; UINT16 Selector 42 ; ); 43 ;------------------------------------------------------------------------------ 44 global ASM_PFX(SetDataSelectors) 45 ASM_PFX(SetDataSelectors): 46 mov ecx, [esp+4] 47 o16 mov ss, cx 48 o16 mov ds, cx 49 o16 mov es, cx 50 o16 mov fs, cx 51 o16 mov gs, cx 52 ret 53 54