flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Problem with doing intersegmental syscalls :( HELP!!!!!! |
Author |
|
sid123 17 Nov 2013, 11:53
So, I have got two kernels,
One is the main one called from my own second stage bootloader known as NTLOAD.SYS, as APOS16.SYS (Kernel Filename), Now that I need to extend my kernel API and keeping my kernel size limited, I've got to do intersegmental syscalls like : Code: ; Assuming I'm in segment 0x2000 ; I would do this jmp 0x3000:0x0000 jmp 0x3000:0x0003 jmp 0x3000:0x0004 ; and so on........ Basically I would load a file called BOOTDRV.SYS which contains these calls, Now I have written some code but they don't seem to work. My Kernel Caller, Code: ; Load the BOOTDRV.SYS (Boot Drivers) in memory at 0x3000 ; First Initialize the FDD call init_FDD ; Set up segments cli ; Clear interrupts mov ax, 0 mov ss, ax mov sp, 0FFFFh sti cld mov ax,2000h mov ds, ax mov es, ax mov fs, ax mov ax,0x3000 ; ---> Reserved for BOOTDRV.SYS mov gs,ax call load_kernel call os_command_line ; Start the Interface load_kernel: mov ax, .pos16_sys mov cx, 28768 call os_load_file jc os_fatal_error push es push 0x3000 pop es mov si, 28768 mov di, 0 mov cx, bx rep movsb mov ax, 0000h mov es, ax mov word [es:0014h], 0x3000 mov word [es:0016h], .BOOT_BREAK mov word [es:006Ch], 0x3000 mov word [es:006Eh], .BOOT_BREAK pop es ret .pos16_sys db 'BOOTDRV.SYS',0 .BOOT_BREAK: cli pop ax pop ax push 2000h push os_command_line sti iret And here's how my extended kernel looks like : Code: ; POS16 Extended API jmp os_lol ; 0x3000:0x0000 SEGMENT_RETURN: pushf pop word [gs:flags_tmp] cmp byte [gs:internal_call], 1 jge .internal_return mov word [gs:return_ax_tmp], ax mov ax, fs mov ds, ax mov es, ax pop ax push 0x2000 push ax mov ax, [gs:return_ax_tmp] push word [gs:flags_tmp] popf retf .internal_return: ret flags_tmp dw 0 internal_call dw 0 ; cancels os_return return_ax_tmp dw 0 os_lol: mov ah,0x0E jmp .loop .loop: lodsb cmp al,0 je .done int 10h .done: jmp SEGMENT_RETURN And I perform the call like this : Code: ext_print equ 3000h:0000h mov si,lol2 call ext_print jmp back_2_interface lol2 db 'LOL! Printed from the Extended Kernel',0 When I execute this my OS halts and then the screen is almost unreadable? Is there something wrong?[/code] _________________ "Those who can make you believe in absurdities can make you commit atrocities" -- Voltaire https://github.com/Benderx2/R3X XD |
|||
17 Nov 2013, 11:53 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.