Archive / / / / / / cmdline.asm
2002-09-21 13:01:48 UTC
previous next
section boot.data progbits alloc noexec write align=14 init db 'init',0 mem db 'mem',0 lmem db 'lower_mem',0 section boot.text progbits alloc exec nowrite align=16 global parse_command_line_function parse_command_line_function: mov ecx, init call check cmp ecx, 1 je found_init ret found_init: mov [eax], ebx ; Update Cmdline_Init .loop: cmp [ebx], byte ',' je .done_loop add ebx, 1 jmp .loop .done_loop: cmp [ebx-1], byte ' ' je .trim mov [ebx], 0 ; Zero terminate string add ebx, 1 ; Get ready for next argument ret .trim: sub ebx, 1 jmp .done_loop check: push ebx .loop: cmp [ecx], byte 0 je .equal1 mov edx, [ebx] cmp edx, [ecx] jne .not_equal add ebx, 1 add ecx, 1 jmp .loop .equal1: cmp [ebx], byte '=' je .done cmp [ebx], byte ' ' je .trim .trim: add ebx, 1 jmp .equal1 .not_equal: mov ecx, 0 pop ebx ret .done: add ebx, 1 cmp [ebx], byte ' ' je .done mov ecx, 1 pop edx ; Discard beginning of command line (edx does not get used) ret