1 # TITLE CpuAsm.S: 2 3 #------------------------------------------------------------------------------ 4 #* 5 #* Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.<BR> 6 #* This program and the accompanying materials 7 #* are licensed and made available under the terms and conditions of the BSD License 8 #* which accompanies this distribution. The full text of the license may be found at 9 #* http://opensource.org/licenses/bsd-license.php 10 #* 11 #* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 #* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 #* 14 #* CpuAsm.S 15 #* 16 #* Abstract: 17 #* 18 #------------------------------------------------------------------------------ 19 20 21 #text SEGMENT 22 23 24 #------------------------------------------------------------------------------ 25 # VOID 26 # SetCodeSelector ( 27 # UINT16 Selector 28 # ); 29 #------------------------------------------------------------------------------ 30 ASM_GLOBAL ASM_PFX(SetCodeSelector) 31 ASM_PFX(SetCodeSelector): 32 subq $0x10, %rsp 33 leaq L_setCodeSelectorLongJump(%rip), %rax 34 movq %rax, (%rsp) 35 movw %cx, 4(%rsp) 36 .byte 0xFF, 0x2C, 0x24 # jmp (%rsp) note:fword jmp 37 L_setCodeSelectorLongJump: 38 addq $0x10, %rsp 39 ret 40 41 #------------------------------------------------------------------------------ 42 # VOID 43 # SetDataSelectors ( 44 # UINT16 Selector 45 # ); 46 #------------------------------------------------------------------------------ 47 ASM_GLOBAL ASM_PFX(SetDataSelectors) 48 ASM_PFX(SetDataSelectors): 49 movw %cx, %ss 50 movw %cx, %ds 51 movw %cx, %es 52 movw %cx, %fs 53 movw %cx, %gs 54 ret 55 56 #text ENDS 57 58 #END 59 60 61