88
99
1010BITS 64
11- ORG 0x00008000
12- ;;ORG 0x0000200000
11+
12+ TSL_BASE_ADDRESS equ 0x8000
13+ ORG TSL_BASE_ADDRESS
1314
1415start:
1516 jmp bootmode ;; Will be overwritten with 'NOP's before AP's are started.
@@ -38,7 +39,7 @@ ap_startup:
3839 mov esp , 0x7000
3940 jmp 0x0000 :init_smp_ap
4041
41- %include "./asm/init/smp_ap.asm" ;; AP's will start execution at 0x8000 and fall through to this code
42+ %include "./asm/init/smp_ap.asm" ;; AP's will start execution at TSL_BASE_ADDRESS and fall through to this code
4243
4344;;==============================================================================
4445;; 32-bit code. Instructions must also be 64 bit compatible. If a 'U' is stored
@@ -59,8 +60,7 @@ BITS 64
5960
6061start64:
6162
62- mov rsp , 0x8000 ;; Init stack.
63- ;; mov rsp, 0x200000 ;; Init stack.
63+ mov rsp , TSL_BASE_ADDRESS ;; Init stack.
6464
6565
6666 ;; El cursor quedo en el anterior loader. Reseteo todo y borro pantalla.
@@ -416,7 +416,7 @@ skip1GB:
416416 xor rsi , rsi ; aka r6
417417 xor rdi , rdi ; aka r7
418418 xor rbp , rbp ; aka r5
419- mov rsp , 0x8000 ; aka r4
419+ mov rsp , TSL_BASE_ADDRESS ; aka r4
420420 xor r8 , r8
421421 xor r9 , r9
422422 xor r10 , r10
@@ -533,7 +533,7 @@ make_interrupt_gates: ; make gates for the other interrupts
533533 mov r9 , msg_ready
534534 call print
535535
536- ; Patch bootloader AP code ; The AP's will be told to start execution at 0x8000
536+ ; Patch bootloader AP code ; The AP's will be told to start execution at TSL_BASE_ADDRESS
537537 mov edi , start ; We need to remove the BSP Jump call to get the AP's
538538 mov rax , 0x9090909090909090 ; to fall through to the AP Init code
539539 stosq
@@ -794,7 +794,7 @@ pde_end:
794794
795795 call init_smp ; Init of SMP, deactivate interrupts
796796
797- ; Reset the stack to the proper location (was set to 0x8000 previously)
797+ ; Reset the stack to the proper location (was set to TSL_BASE_ADDRESS previously)
798798 mov rsi , [ p_LocalAPICAddress ] ; We would call p_smp_get_id here but the stack is not ...
799799 add rsi , 0x20 ; ... yet defined. It is safer to find the value directly.
800800 lodsd ; Load a 32-bit value. We only want the high 8 bits
@@ -950,7 +950,7 @@ lfb_wc_end:
950950 wbinvd ; Flush Cache
951951
952952; Move the trailing binary to its final location
953- mov esi , 0x8000 + BOOTLOADER_SIZE ; Memory offset to end of bootloader.sys
953+ mov esi , TSL_BASE_ADDRESS + BOOTLOADER_SIZE ; Memory offset to end of bootloader.sys
954954
955955;; esto es la direccion a la cual nuestro kernel se copia, tal como luego comienza ejecutando en _start en 100000
956956 mov edi , 0x100000 ; Destination address at the 1MiB mark
0 commit comments