Ignore:
Timestamp:
2016-12-26T20:03:08Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
db521b05
Parents:
3b3faf51
Message:

Copy boot arguments from multiboot info to bargs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/multiboot/multiboot.c

    r3b3faf51 rba1ea40  
    100100}
    101101
     102static void multiboot_cmdline(char *cmdline)
     103{
     104        /*
     105         * GRUB passes the command line in an escaped form.
     106         */
     107        for (size_t i = 0, j = 0;
     108            cmdline[i] && j < CONFIG_BOOT_ARGUMENTS_BUFLEN;
     109            i++, j++) {
     110                if (cmdline[i] == '\\') {
     111                        switch (cmdline[i + 1]) {
     112                        case '\\':
     113                        case '\'':
     114                        case '\"':
     115                                i++;
     116                                break;
     117                        }
     118                }
     119                bargs[j] = cmdline[i];
     120        }
     121}
     122
    102123static void multiboot_modules(uint32_t count, multiboot_module_t *mods)
    103124{
     
    153174        if (signature != MULTIBOOT_LOADER_MAGIC)
    154175                return;
    155        
     176
     177        /* Copy command line. */
     178        if ((info->flags & MULTIBOOT_INFO_FLAGS_CMDLINE) != 0)
     179                multiboot_cmdline((char *) MULTIBOOT_PTR(info->cmd_line));
     180
    156181        /* Copy modules information. */
    157182        if ((info->flags & MULTIBOOT_INFO_FLAGS_MODS) != 0)
Note: See TracChangeset for help on using the changeset viewer.