|
|
1.1 ! root 1: * To pass a new data structure into the kernel: ! 2: * ! 3: * 1. Define your new data structure in typed.h. You will probably want ! 4: * to define some supporting routines for your data structure. These ! 5: * should go in a file by themselves. Be sure to add the file to the ! 6: * tboot Makefile. ! 7: * ! 8: * 2. Write a routine that takes at least an ffp, which will generate your ! 9: * data structure and write it into the ffp. The routine should return 0 ! 10: * if it ran out of space in the FIFO. Other return values are permissible, ! 11: * but ignored. Add arguments to prepare_gift() as needed. It is called ! 12: * only from the end of main() in tboot.c ! 13: * ! 14: * 3. Add a call to your routine to prepare_gift() in the section marked ! 15: * FILL THE BOX. This is an if statement with || seperated calls. The ! 16: * most important data structures should be called first, because later ! 17: * calls will be skipped if the FIFO fills. ! 18: * ! 19: * 4. In the kernel (probably in a driver) you will want to add a loop to ! 20: * look through the gift for your data structure: ! 21: * ! 22: * FIFO *ffp; ! 23: * typed_space *tp; ! 24: * ! 25: * ffp = fifo_open(&boot_gift, 0); -- Open gift for reading. ! 26: * ! 27: * if (F_NULL == ffp) { ! 28: * indicate_error("Could not open boot_gift."); ! 29: * } else { ! 30: * while (T_NULL != (tp = fifo_read(ffp))) { -- While not EOFIFO. ! 31: * if (T_MYTYPE == tp->ts_type) { -- Is this my type? ! 32: * my_handler(tp->ts_data); -- Process the data. ! 33: * } ! 34: * } ! 35: * } ! 36: * ! 37: * Be sure to include fifo_k.c and typed.h into your kernel. ! 38: ! 39: ! 40: gift_drive_params ! 41: ! 42: gift_argf ! 43: * To read gift_argf from bootgift, use the procedure outlined above in ! 44: * point 4 to find the entry marked T_STR_ARGF. You must then explicitly ! 45: * recast it with RETYPE(tp->ts_data, T_FIFO_SIC). Then you can open it ! 46: * as a FIFO, with code modeled on point 4 above. This scheme seemed ! 47: * the simplest for uniquely identifying the argument FIFO. ! 48: * Each element of the FIFO is a T_STR_STR, so ts_data for these is ! 49: * just a NUL terminated string. ! 50: ! 51: gift_rootdev
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.